2
我目前正在使用此slackbot软件包为Slack构建一个bot。扩展类以创建自定义功能
目前,它无法构建自定义附件,例如附加图像。
查看源代码,Question
类负责构建交互式问题 - 将其全部捆绑到一个准备发送给Slack的数组中。
我希望使用其中的大部分功能来构建一个可以将image_url
添加到数组中的类,但是我从来没有这样做过,并且不知道如何执行此操作或从何处开始。
最终,我只是希望能够使用该包发送消息并包含图像附件。
从我可以拼凑,我需要开始是这样的:
<?php
namespace //namespace;
use Mpociot\SlackBot\Question;
class Attachments extends Question
{
//code to add image URL goes here
/**
* there is currently this function in the Question class
* that builds the array where I need to add in
* 'image_url => 'example.com/image_url'
*/
public function toArray()
{
return [
'text' => $this->text,
'fallback' => $this->fallback,
'callback_id' => $this->callback_id,
'actions' => $this->buttons,
];
}
}
谁能帮我指出了正确的方向,或者帮助我开始使用它?
您可以在https://github.com/iranianpep/给Slackbot框架出手slackbot。它是专门为Slack编写的,可能对您的情况有所帮助 – Ehsan