如何从成员处获取消息并将其发送到通道



如果成员发送randomize ${text},我希望bot发送Your choice is ${text}

const collec = new Discord.MessageCollector(channelfilteroptions);
const text = collec.collect();
client.on("message", (message) => {
if (!message.guild) return;
if (message.author.bot) return;
if (message === `randomize ${text}`) {
message.channel.send(`u send ${text}`);
}
});

这只会替换第一个"randomize"因此,如果由于某种原因用户输入了& & randomize",它将发送& &;你发送了随机">

const text = message.content.replace('randomize', '');
message.channel.send(`You sent ${text});

最新更新