gpt4 book ai didi

javascript - 将文本发送到特定 channel 的命令

转载 作者:行者123 更新时间:2023-11-30 14:27:09 25 4
gpt4 key购买 nike

我想制作一个命令,将文本发送到我选择的 channel 。
示例:

!command "text"

然后“文本”被发送到我选择的 channel 。

最佳答案

这与 this thread 中的代码相同,我只是修改了一小部分,就像我在评论中告诉你的那样。

client.on('message', msg => {
if (msg.guild && msg.content.startsWith('/log')) {
let text = msg.content.slice('/log'.length); // cuts off the /log part
let channel = msg.guild.channels.find('name', 'channel_name_here');
if (channel) channel.send(text);
else msg.reply("Can't find channel");
});

关于javascript - 将文本发送到特定 channel 的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51753661/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com