我只是想知道,你是如何让一个Discord机器人用“.say”这样的命令说出来的东西它删除了消息,然后说出了“”部分 . 你是如何用Python做到的?我知道如何在JavaScript中执行此操作,这是我在Discord.JS中使用的代码:
const args = message.content.split(" ").slice(1);
if(message.content.startsWith(prefix + 'say')) {
message.delete()
var saytext = args.join(" ");
message.channel.send(saytext)
fs.appendFile("fbkbotlog.txt", `\n${ts} ${message.author.username} in ${message.guild.id} or ${message.guild.name} used say with text " ${saytext} "`)
}
我想知道如何在discord.py中执行此操作 . 我对Discord.PY甚至Python都不是很熟悉 .
注意:我正在尝试使用Just-Some-Bots MusicBot代码
2 回答
基本上是一样的:
Using the message event listener (非常类似于你的JS示例)
Using the in-built command handler