简体   繁体   English

Discord.js v14 不显示状态

[英]Discord.js v14 doesn't show the status

I've been trying for hours in vain to give my testbot its own status, I just can't find a solution why this doesn't work.几个小时以来,我一直在徒劳地尝试为我的测试机器人提供自己的状态,我只是找不到解决方案,为什么这不起作用。 I'm quite new in the topic Discord.js, so if someone has a solution or finds errors here please report back:)我是 Discord.js 主题的新手,所以如果有人有解决方案或在这里发现错误,请反馈:)

I have tried to set the status with setActivity and setPresence and the corresponding parameters but both without success.我曾尝试使用 setActivity 和 setPresence 以及相应的参数来设置状态,但都没有成功。 I created a second bot and again the bot did not show any status.我创建了第二个机器人,但机器人没有显示任何状态。

const {BOT_TOKEN}=require("./config.json");
const {Client, Events, GatewayIntentBits, Collection} = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.on("ready", async () => {
    try {
        await client.user.setPresence({
            status: 'online',
            activity: {
                name: 'Test',
                type: 'PLAYING'
            }
        });
        console.log(`Bot's Status: successfully updated`)
    } catch (error) {
        console.error("Bot's Status: error while updating status")
    }

    //client.user.setStatus("online");

    console.log(`Bot's current status: ${client.user.presence.status}`);
    console.log(`Login process as: ${client.user.tag} was successful`);
});

client.login(BOT_TOKEN);

It's activities and not activity ( Discord.js Guide )它是activities而不是activityDiscord.js 指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM