【发布时间】:2020-09-03 18:24:47
【问题描述】:
我想让 Discord 机器人在看到类似“!t start”的消息时执行命令(sudo service terraria start)。我看过这个指南https://thomlom.dev/create-a-discord-bot-under-15-minutes/,我知道如何让机器人知道你何时发送某个消息,但我不知道如何让它执行命令。我将复制我的 index.js。 谢谢!
const client = new Discord.Client()
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on("message", msg => {
if (msg.content === "Ping") {
msg.reply("Pong!")
}
})
Obviously at the end would be the token.
【问题讨论】:
标签: javascript bots discord