📅  最后修改于: 2022-03-11 15:04:25.849000             🧑  作者: Mango
//THIS METHOD USES THE BOTKIT-DISCORD CONNECTOR
//To get it, open the terminal, navigate to your bot's folder and do
//$ npm install --save botkit-discord
const discordBotkit = require('botkit-discord');
const configuration = {
token: 'YOUR_DISCORD_TOKEN'
};
const discordBot = discordBotkit(configuration);
discordBot.hears('.*', 'mention', (bot, message) => {
const responses = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes – definitely",
"You may rely on it",
"As I see it",
"yes",
"Most Likely",
"Outlook good",
"Yes",
"Signs point to yes"
];
const randomIndex = Math.floor(Math.random() * responses.length);
bot.reply(message, responses[randomIndex]);
});