【问题标题】:Discord.io - Bot StatusDiscord.io - 机器人状态
【发布时间】:2018-12-31 16:42:47
【问题描述】:

我想设置我的不和谐机器人状态,但我使用的是discord.io 没有discord.js,所以我找不到适合我的教程。我也尝试观看 discord.js 教程并尝试:

bot.user.setPresence({ 
  status: 'online', 
  game: { 
    name: '/help' 
  } 
});

错误:启动后崩溃node bot.js

或者:

bot.on('ready', () => {
  bot.user.setGame('/help')
})

错误:解析错误:意外令牌)

有人可以帮帮我吗?

【问题讨论】:

  • 能否请您在您的问题中发布相应的错误?请编辑您的问题(避免向其发布 cmets)。谢谢

标签: bots statusbar discord status discord.io


【解决方案1】:

我正在使用 Visual Studio Code 编写我的代码。它似乎有一个很好的自动完成功能,通过稍微探索一下,我找到了这个提示:

bot.setPresence(
选项:{ idle_since:任何;游戏:{名称:字符串;类型:数字;网址?:字符串;}}
): 无效

我不确定 everything 的确切含义,但其中大部分似乎是可选的。例如,我可以通过以下方式更改机器人的游戏:

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

【讨论】:

    【解决方案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
    }});
    

    【讨论】:

    • 先列出变量,然后输入这种格式。放置一个 url 是强制性的,即使它没有显示。适用于 discord.io
    • type = 0(正在播放)
    • type = 1(流式传输)
    • type = 2(听)
    • 如果您想添加更多详细信息,请编辑答案。此外,简短的解释会有所帮助。
    猜你喜欢
    • 2022-01-07
    • 2022-11-11
    • 2019-05-26
    • 2020-11-06
    • 2021-07-29
    • 2019-06-15
    • 1970-01-01
    • 2021-04-03
    • 2018-08-23
    相关资源
    最近更新 更多