javascript - 如何将机器人的状态从播放更改为收听?
问题描述
我想将机器人的状态从播放更改为收听。
这是我的代码:
client.on("ready", () => {
console.log(`${client.user.username} ready!`);
client.user.setActivity(`${PREFIX}help`);
});
解决方案
client.on("ready", () => {
// This event will run if the bot starts, and logs in, successfully.
console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
// Example of changing the bot's playing game to something useful. `client.user` is what the
// docs refer to as the "ClientUser".
client.user.setActivity('<activity>', { type: 'LISTENING' });
});
这帮助了我。
推荐阅读
- ruby-on-rails - 如何在我的控制器中使用委托来重构代码?
- angular - 我正在尝试将字符串变量(城市)从服务传递到控制器,但它没有正确传递
- video.js - 使用 videojs-panorama 的 180 度视频播放器无法按预期工作
- haskell - 表达式中的模式语法
- swift - 如何保存在单元格内按下按钮的动作,以便我可以添加图像而不会复制或消失
- c# - 从服务打开弹出窗口
- java - 如何在 Java 中读取“.csv”文件?
- crm - vtiger 7.1安装错误已弃用:与其类同名的方法在未来版本的PHP中将不再是构造函数
- kylin - Apache kylin 登录问题
- asp.net-core - “模型构建器”不包含“ApplyAllConfigurations”的定义?