Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bots Discord.io-机器人状态_Bots_Statusbar_Discord_Status_Discord.io - Fatal编程技术网

Bots Discord.io-机器人状态

Bots Discord.io-机器人状态,bots,statusbar,discord,status,discord.io,Bots,Statusbar,Discord,Status,Discord.io,我想设置我的discord机器人状态,但我使用的是discord.ionodiscord.js,所以我找不到一些教程。我还尝试观看discord.js教程,并尝试: bot.user.setPresence({ status: 'online', game: { name: '/help' } }); 错误:它在启动节点bot.js后崩溃 或: bot.on('ready', () => { bot.user.setGame('/help') }) 错

我想设置我的discord机器人状态,但我使用的是
discord.io
no
discord.js
,所以我找不到一些教程。我还尝试观看discord.js教程,并尝试:

bot.user.setPresence({ 
  status: 'online', 
  game: { 
    name: '/help' 
  } 
});
错误:它在启动节点bot.js后崩溃

或:

bot.on('ready', () => {
  bot.user.setGame('/help')
})
错误:分析错误:意外标记)


有人能帮我吗?

我正在用Visual Studio代码编写代码。它似乎有一个很好的自动完成功能,通过对它进行一点探索,我找到了以下提示:

bot.setPresence(
选项:{idle_-since:any;游戏:{name:string;type:number;url?:string;}}}
):无效

我不确定每件事的确切含义,但大部分似乎都是可选的。例如,我能够改变机器人的游戏方式:

bot.on('ready', function (evt) {
    bot.setPresence( {game: {name:"/help"}} );
});

你能在你的问题中贴出相应的错误吗?请编辑您的问题(避免发表评论)。感谢首先列出变量,然后以这种格式输入。即使未显示url,也必须放置url。适用于discord。iotype=0(播放)type=1(流媒体)type=2(收听)如果您想添加更多详细信息,请编辑答案。此外,简短的解释也会有所帮助。
var name = "with the boys. Built by Ayser & Khalid"
var type = 0;
var url = "https://www.twitch.tv/legendarysharkkk";
bot.setPresence({
    game: {
        name,
        type,
        url
}});