Creating thread via command #1209
-
I'm attempting to have a bot create threads in a "forum." I found a relevant part of the Discord documentation, which pointed me towards having my bot make a thread. But I can't find a command that'd do that. The closest I can get is Thread::sendMessage(), documentation found here. Any help? An example would be especially appreciated. (Though this one looks similar, they already have a thread to post to.) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The method you are looking for is After thread is created in forum, you can also send a message using Lacking in documentation, here is the example: // Start thread (Channel type must be forum)
$channel->startThread([
'name' => 'New forum post',
'message' => MessageBuilder::new()->setContent('Post content here'),
// more options here from the relevant discord documentation that you found
])->then(function (Thread $thread) {
// make another message
return $thread->sendMessage(MessageBuilder::new()->setContent('A post reply'));
})->done(); |
Beta Was this translation helpful? Give feedback.
The method you are looking for is
Channel::startThread()
in the documentation: https://discord-php.github.io/DiscordPHP/classes/Discord-Parts-Channel-Channel.html#method_startThread available since v10After thread is created in forum, you can also send a message using
Thread::sendMessage()
Lacking in documentation, here is the example: