[英]How can I get a message from a member then send it to a channel
If the member sends randomize ${text}
, I want the bot to send Your choice is ${text}
如果会员发送
randomize ${text}
,我希望机器人发送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}`);
}
});
This will only replace the first "randomize" found in your string, so if for some reason the user enters "randomize randomize", it will send "You sent randomize"这只会替换在您的字符串中找到的第一个“randomize”,因此如果由于某种原因用户输入“randomize randomize”,它将发送“You sent randomize”
const text = message.content.replace('randomize', '');
message.channel.send(`You sent ${text});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.