luceos
Thanks for reply. I am not familiar with code but I don't think it's using API.
The code looks like this
use Annonny\GptBot\Job\SendBotReplyJob;
use Annonny\GptBot\Job\SendBotReplyJob1;
use Illuminate\Contracts\Bus\Dispatcher;
use Flarum\Post\Event\Posted;
use Flarum\Post\CommentPost;
use Illuminate\Contracts\Queue\Queue;
class GiveAnswer
{
protected $events;
private $queue;
public function __construct(Dispatcher $events, Queue $queue)
{
$this->events = $events;
$this->queue = $queue;
}
public function postWasPosted(Posted $event)
{
// 获取当前发布的帖子
$post = $event->post;
$result = str_replace("~", "~", $result);
$content = $this->mention . " " . $result;
$bot_reply = CommentPost::reply($this->post->discussion_id, $content, 2201, null);
$bot_reply->save();
$bot_reply->mentionsPosts()->sync($this->post);
$discussion = $this->post->discussion;
$discussion->refreshLastPost();
$discussion->refreshCommentCount();
$discussion->refreshParticipantCount();
$discussion->save();