![](/img/trans.png)
[英]setPresence activity type in discord.js v14 can only be set to "PLAYING"
[英]setActivity will only set the activity type to "Playing". Discord.js v14
當嘗試設置機器人的活動狀態時,我只設法設置讓它說“播放 x”。
查看 discord.js 的文檔,正確的用法應該是:
client.user.setActivity('discord.js', { type: ActivityType.Watching });
但即使在嘗試這種用法時,我也會得到顯示“Playing discord.js”的相同結果。
這是我目前的代碼:
const ActivityType = require('discord.js');
client.user.setActivity('/play', { type: ActivityType.Listening });
但我也試過
client.user.setActivity({ name: '/play', type: ActivityType.Listening });
客戶端是從我的索引文件傳遞過來的,我沒有收到任何錯誤。 還嘗試了此處答案中的示例,也給了我相同的結果。
我在這里錯過了什么?
編輯。 完整代碼是:
就緒.js
const ActivityType = require('discord.js');
module.exports = {
name: 'ready',
once: true,
execute(client) {
client.user.setActivity({ name: '/play', type: ActivityType.Listening });
},
};
索引.js
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
],
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.