Shadow
Shadow
DIAdiscord.js - Imagine an app
Created by Shadow on 2/10/2024 in #djs-questions
Bot status occasionally reverts back to initial status from the status set in ClientReady
Im using DJS with sharding. I initialize the client with a status of "Starting" and then in ClientReady I basically set the status to something else ("bla" in this case).
const client = new DiscordClient({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
],
presence: {
status: "dnd",
activities: [{ name: "Starting...", type: ActivityType.Playing }],
},
});

client.on(Events.ClientReady, async() => {
client.user?.setActivity({ name: `Bla`, type: ActivityType.Playing });
});

// login and stuff
const client = new DiscordClient({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
],
presence: {
status: "dnd",
activities: [{ name: "Starting...", type: ActivityType.Playing }],
},
});

client.on(Events.ClientReady, async() => {
client.user?.setActivity({ name: `Bla`, type: ActivityType.Playing });
});

// login and stuff
so pretty straight forward stuff. However: if the bot is unattended for some time without restart, sometimes the activity resets back to "Starting..." and remains stuck there. I assume that happens when some connection times our for a bit (shard?) but I'm not sure. Is there a way to "catch" that and set the status again? Im not sure if its a sharding issue but would Events.ShardResume or something work? Is that a common issue? --- npm list discord.js: discord.js@14.14.1 node -v: v21.0.0
11 replies
DIAdiscord.js - Imagine an app
Created by Shadow on 5/27/2023 in #djs-questions
Can't use Emoji from other Server in followUp.
11 replies