如何制作一个根据观看状态类型更改状态的 Discord 机器人?
How do I make a Discord bot that change status with watching status type?
const activities_list = [
"happy holidays!❄️",
"happy holidays!",
"happy holidays!",
"happy holidays!⛄"
];
bot.on('ready', () => {
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
bot.user.setActivity(activities_list[index]);
}, 30000);
});
但是我想在 WATCHING 状态类型中显示这个,我该怎么做?
首先查看 the Discord.js documentation,它为您提供了一个直接示例:
client.user.setActivity('YouTube', { type: 'WATCHING' })
bot.on('ready', () => {
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
bot.user.setActivity(activities_list[index], {type: 'Watching'});
}, 30000);
});
const activities_list = [
"happy holidays!❄️",
"happy holidays!",
"happy holidays!",
"happy holidays!⛄"
];
bot.on('ready', () => {
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
bot.user.setActivity(activities_list[index]);
}, 30000);
});
但是我想在 WATCHING 状态类型中显示这个,我该怎么做?
首先查看 the Discord.js documentation,它为您提供了一个直接示例:
client.user.setActivity('YouTube', { type: 'WATCHING' })
bot.on('ready', () => {
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
bot.user.setActivity(activities_list[index], {type: 'Watching'});
}, 30000);
});