Just updated to 5.2.1 nothing working and no errors

My bot is apparently logged in, and good to go according to the logs. Discord shows the bot status green. But no commands at all work. I was on Sapphire 2 and I generated a fresh Sapphire project and basically painstakingly copied everything over sicne that was the easiest upgrade path for me. All of my secrets are in the .env file.
No description
23 Replies
kyra
kyra7mo ago
By “nothing works” is that just message commands? Or also chat input and context menu ones? Also, it’s best to use latest, which is 5.2.1 at this moment. 4.0.0 is not only outdated, but it’s also broken.
Ownix
OwnixOP7mo ago
@kyra 🩵🩷🤍🩷🩵 Thanks for your reply. I meant 5.2.1 that is my bad. What do you mean by Chat input? And I do not see any context menu items but I will admit I am new with context menu items. For example, typing !ping as per the default command that ships with the "Complete template" does nothng right now.
Ownix
OwnixOP7mo ago
No description
Ownix
OwnixOP7mo ago
If I at least had some log errors to go off of...
kyra
kyra7mo ago
Like the with-typescript-complete template?
Ownix
OwnixOP7mo ago
yes, when you do sapphire new and then select "Complete template" from the options. It will generate a simple bot which will include a "Ping" command. The default prefix is "!" as well. Starting my bot and running !ping does nothing. No logs either. As you can see login seems successful and many commands have been scanned and registered.
kyra
kyra7mo ago
Did you modify the template in any way?
Ownix
OwnixOP7mo ago
Yes I ported my old commands over to it as there were many changes to setup.ts and index.ts and utils.ts and basically every file.
kyra
kyra7mo ago
What changes have you done in index.ts?
Ownix
OwnixOP7mo ago
import './lib/setup';
import { LogLevel, SapphireClient } from '@sapphire/framework';
import { GatewayIntentBits, Partials } from 'discord.js';
import '@sapphire/plugin-logger/register';

const client = new SapphireClient({
defaultPrefix: '!',
regexPrefix: /^(hey +)?bot[,! ]/i,
caseInsensitiveCommands: true,
logger: {
level: LogLevel.Debug
},
shards: 'auto',
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
],
partials: [Partials.Channel],
loadMessageCommandListeners: true
});

const main = async () => {
try {
client.logger.info('Logging in');
await client.login();
client.logger.info('logged in');
} catch (error) {
client.logger.fatal(error);
client.destroy();
process.exit(1);
}
};

main();
import './lib/setup';
import { LogLevel, SapphireClient } from '@sapphire/framework';
import { GatewayIntentBits, Partials } from 'discord.js';
import '@sapphire/plugin-logger/register';

const client = new SapphireClient({
defaultPrefix: '!',
regexPrefix: /^(hey +)?bot[,! ]/i,
caseInsensitiveCommands: true,
logger: {
level: LogLevel.Debug
},
shards: 'auto',
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
],
partials: [Partials.Channel],
loadMessageCommandListeners: true
});

const main = async () => {
try {
client.logger.info('Logging in');
await client.login();
client.logger.info('logged in');
} catch (error) {
client.logger.fatal(error);
client.destroy();
process.exit(1);
}
};

main();
kyra
kyra7mo ago
I need more information considering the template works perfectly fine as-is, after all
Ownix
OwnixOP7mo ago
If there was a conflict with my intents, would that cause Discord to ignore my bot?
kyra
kyra7mo ago
Oh, of course You removed one of the required intents GatewayIntentBits.MessageContent It's specified in the template, but not in your modified code: https://github.com/sapphiredev/examples/blob/main/examples/with-typescript-complete/src/index.ts#L24
Ownix
OwnixOP7mo ago
That fixed it. Why is there 0 errors in logs???
kyra
kyra7mo ago
Because... we don't validate intents
Ownix
OwnixOP7mo ago
I ported my intents from just strings: old:
intents: [
'GUILDS',
'GUILD_MEMBERS',
'GUILD_BANS',
'GUILD_EMOJIS_AND_STICKERS',
'GUILD_VOICE_STATES',
'GUILD_MESSAGES',
'GUILD_MESSAGE_REACTIONS',
'DIRECT_MESSAGES',
'DIRECT_MESSAGE_REACTIONS'
],
intents: [
'GUILDS',
'GUILD_MEMBERS',
'GUILD_BANS',
'GUILD_EMOJIS_AND_STICKERS',
'GUILD_VOICE_STATES',
'GUILD_MESSAGES',
'GUILD_MESSAGE_REACTIONS',
'DIRECT_MESSAGES',
'DIRECT_MESSAGE_REACTIONS'
],
kyra
kyra7mo ago
Old didn't need it because Sapphire v2 used Discord.js v13, which used Discord API v9. Specifying MessageContent is required in API v10 if you want message contents. Otherwise you'd only receive the content from messages pinging your bot
Ownix
OwnixOP7mo ago
@kyra 🩵🩷🤍🩷🩵 Thanks for the quick help. It would probably have taken me agest to compare the intents before I noticed the new required one.
kyra
kyra7mo ago
No problem ^^
Ownix
OwnixOP7mo ago
That is helpful information regarding this being a discord API v9 -> v10 thing.
kyra
kyra7mo ago
Yeah, it's often overlooked when switching API versions, it's well hidden within many other changes, specially considering Discord.js (and we) recommend interaction commands over message commands, which is why the latter is opt-in. After all, having commands rely on prefixes is not enough for getting the intent's approval.
Ownix
OwnixOP7mo ago
After all, having commands rely on prefixes is not enough for getting the intent's approval.
Is that just because the API has more ceremony around slash commands?
kyra
kyra7mo ago
It is because bots having access to all messages' content is a privacy liability that slash commands don't have.
Want results from more Discord servers?
Add your server