Sapphire registering applications bug

So I updated sapphire to the latest version and when i start my bot the ApplicationCommand registering keeps thinking that there is differences found in every single command (Provided few screenshots)
No description
No description
No description
No description
Solution:
@sapphire/framework@pr-701
Jump to solution
56 Replies
Favna
Favna12mo ago
@vladdy Also please provide code or preferably a small repo where the issue can be reproduced @Stealth
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
How do i provide code? Im confused because this happens with the package itself not my bots code.
Favna
Favna12mo ago
They're your bots commands so yes they happen with your bot. Sapphire doesn't have any internal commands.
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
No no. The problem is that Sapphire thinks my already existing registered application commands have differences on every launch even though i havent modified them at all
Favna
Favna12mo ago
Yes so please provide the code to some of the commands...
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
import { Command } from "@sapphire/framework";

export class MemberCommand extends Command {
constructor(ctx: Command.Context, opts: Command.Options) {
super(ctx, {
...opts,
name: "whois",
aliases: ["user"],
description: "Information about a member",
runIn: "GUILD_ANY"
});
}

/**
* Register Slash Command and Context Menu
*/
override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.setDMPermission(false)
.addUserOption((option) =>
option
.setName("member")
.setDescription(
"Which user's information do you want to view?"
)
.setRequired(false)
)
);

registry.registerContextMenuCommand((builder) =>
builder.setName("User Info").setDMPermission(false).setType(2)
);
}

/**
* Execute Slash Command
*/
async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
if (!interaction.inCachedGuild())
return interaction.reply({
content: "This command can only be used in a server",
ephemeral: true
});

let member = interaction.options.getMember("member");

if (!member) member = interaction.member;

const { user } = member;

if (user.bot)
return interaction.reply({
content: `${member} is a bot`,
ephemeral: true
});

await interaction.deferReply();

const { kanvas, util } = this.container;

const rows = util.member.actionRow(interaction.member, member);

const profile = await kanvas.member.profile(member);

const attachment = util.attachment(profile, `profile-${user.id}.png`);

return interaction.editReply({
components: rows,
files: [attachment]
});
}

/**
* Execute Context Menu
*/
async contextMenuRun(interaction: Command.ContextMenuCommandInteraction) {
if (!interaction.inCachedGuild())
return interaction.reply({
content: "This command can only be used in a server",
ephemeral: true
});

const { guild, targetId } = interaction;

const member = await guild.members.fetch(targetId);
if (!member)
return interaction.reply({
content: "Member not found",
ephemeral: true
});

if (member.user.bot)
return interaction.reply({
content: `${member} is a bot`,
ephemeral: true
});

await interaction.deferReply();

const { kanvas, util } = this.container;

const rows = util.member.actionRow(interaction.member, member);

const profile = await kanvas.member.profile(member);

const attachment = util.attachment(profile, `profile-${member.id}.png`);

return interaction.editReply({ files: [attachment], components: rows });
}
}
import { Command } from "@sapphire/framework";

export class MemberCommand extends Command {
constructor(ctx: Command.Context, opts: Command.Options) {
super(ctx, {
...opts,
name: "whois",
aliases: ["user"],
description: "Information about a member",
runIn: "GUILD_ANY"
});
}

/**
* Register Slash Command and Context Menu
*/
override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.setDMPermission(false)
.addUserOption((option) =>
option
.setName("member")
.setDescription(
"Which user's information do you want to view?"
)
.setRequired(false)
)
);

registry.registerContextMenuCommand((builder) =>
builder.setName("User Info").setDMPermission(false).setType(2)
);
}

/**
* Execute Slash Command
*/
async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
if (!interaction.inCachedGuild())
return interaction.reply({
content: "This command can only be used in a server",
ephemeral: true
});

let member = interaction.options.getMember("member");

if (!member) member = interaction.member;

const { user } = member;

if (user.bot)
return interaction.reply({
content: `${member} is a bot`,
ephemeral: true
});

await interaction.deferReply();

const { kanvas, util } = this.container;

const rows = util.member.actionRow(interaction.member, member);

const profile = await kanvas.member.profile(member);

const attachment = util.attachment(profile, `profile-${user.id}.png`);

return interaction.editReply({
components: rows,
files: [attachment]
});
}

/**
* Execute Context Menu
*/
async contextMenuRun(interaction: Command.ContextMenuCommandInteraction) {
if (!interaction.inCachedGuild())
return interaction.reply({
content: "This command can only be used in a server",
ephemeral: true
});

const { guild, targetId } = interaction;

const member = await guild.members.fetch(targetId);
if (!member)
return interaction.reply({
content: "Member not found",
ephemeral: true
});

if (member.user.bot)
return interaction.reply({
content: `${member} is a bot`,
ephemeral: true
});

await interaction.deferReply();

const { kanvas, util } = this.container;

const rows = util.member.actionRow(interaction.member, member);

const profile = await kanvas.member.profile(member);

const attachment = util.attachment(profile, `profile-${member.id}.png`);

return interaction.editReply({ files: [attachment], components: rows });
}
}
import { Command } from "@sapphire/framework";

export class EightBallCommand extends Command {
constructor(ctx: Command.Context, opts: Command.Options) {
super(ctx, {
...opts,
name: "8ball",
aliases: ["ask", "8b"],
description: "8ball answers your burning questions"
});
}

/**
* Register Slash Command
*/
override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.addStringOption((option) =>
option
.setName("question")
.setDescription("Question for the 8 Ball")
.setRequired(true)
)
);
}

/**
* Execute Slash Command
*/
async chatInputRun(interaction: Command.ChatInputCommandInteraction) {

const { options } = interaction;

let question = options.getString("question", true);

const { util } = this.container;

if (!question.includes("?")) question += "?";

const { url, response } = await util.nekos.eightBall({
text: question
});

if (url) {
const attachment = util.attachment(
url,
`8ball-answer-${question.trim()}.png`
);

return interaction.reply({
content: `${interaction.user}: **${question}**`,
files: [attachment],
allowedMentions: { repliedUser: false, users: [] }
});
}

await interaction.reply(response);
}
}
import { Command } from "@sapphire/framework";

export class EightBallCommand extends Command {
constructor(ctx: Command.Context, opts: Command.Options) {
super(ctx, {
...opts,
name: "8ball",
aliases: ["ask", "8b"],
description: "8ball answers your burning questions"
});
}

/**
* Register Slash Command
*/
override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.addStringOption((option) =>
option
.setName("question")
.setDescription("Question for the 8 Ball")
.setRequired(true)
)
);
}

/**
* Execute Slash Command
*/
async chatInputRun(interaction: Command.ChatInputCommandInteraction) {

const { options } = interaction;

let question = options.getString("question", true);

const { util } = this.container;

if (!question.includes("?")) question += "?";

const { url, response } = await util.nekos.eightBall({
text: question
});

if (url) {
const attachment = util.attachment(
url,
`8ball-answer-${question.trim()}.png`
);

return interaction.reply({
content: `${interaction.user}: **${question}**`,
files: [attachment],
allowedMentions: { repliedUser: false, users: [] }
});
}

await interaction.reply(response);
}
}
vladdy
vladdy12mo ago
1. Send the commands that were found to be different 2. Use VerboseOverwrite as your default behavior when present Let me find the guide for you
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Every single command finds to be different Read my initial post Please
vladdy
vladdy12mo ago
The screenshots you shared show only the profile command saying it found differences Others say they are identical Please use VerboseOverwrite as I said and send the logs in a gist or similar 🙏
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Gist
Weird logs
Weird logs. GitHub Gist: instantly share code, notes, and snippets.
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
This log happens without me editing any commands
vladdy
vladdy12mo ago
You didnt use verboseOverwrite @Stealth Please set the defaultBehavior to VerboseOverwrite, then send logs
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
I did No? Im sorry I will do that when i get on my pc
vladdy
vladdy12mo ago
no worries
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Here is the new log oh wait nvm it's still going By looking at the log i noticed what's wrong with it, so pretty much every command has this sissue
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Preparing to process 1 possible command registrations / updates...
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Registering id "1055584122912899102" to internal chat input map
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Checking if command "eval" is identical with global chat input command with id "1055584122912899102"
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Took 0ms to process differences via computing differences
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Found differences for command "eval" (1055584122912899102) versus provided api data.
2023-12-05 16:39:08 - DEBUG - └── At path: defaultMemberPermissions
2023-12-05 16:39:08 - DEBUG - ├── Received: null
2023-12-05 16:39:08 - DEBUG - └── Expected: undefined
2023-12-05 16:39:08 - DEBUG -
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Preparing to process 1 possible command registrations / updates...
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Registering id "1055584122912899102" to internal chat input map
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Checking if command "eval" is identical with global chat input command with id "1055584122912899102"
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Took 0ms to process differences via computing differences
2023-12-05 16:39:08 - DEBUG - ApplicationCommandRegistry[eval] Found differences for command "eval" (1055584122912899102) versus provided api data.
2023-12-05 16:39:08 - DEBUG - └── At path: defaultMemberPermissions
2023-12-05 16:39:08 - DEBUG - ├── Received: null
2023-12-05 16:39:08 - DEBUG - └── Expected: undefined
2023-12-05 16:39:08 - DEBUG -
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
@vladdy I did it you can @ me anytime when you look at my issue
vladdy
vladdy12mo ago
Oh perfect, ty that's all i need
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Any fix? or it's framework issue
vladdy
vladdy12mo ago
Its a small bug in framework, I'll fix it when i get some time
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Can i contribute?
vladdy
vladdy12mo ago
I mean yeah but it's somewhere in the depths of computer difference
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Damn ill try if not, what can i do meanwhile? Any like temp fix?
vladdy
vladdy12mo ago
Well considering its a non issue, you can just ignore it for now
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Sounds good ty it does take 100k/ms to load the registry lool just fyi I appreciate your responses ^^ Alright so Ignoring it rlly doesnt work because the framework is not updating my commands when i modify them :/ @vladdy i hope it's okay that im @ ing you
vladdy
vladdy12mo ago
I don't mind the @s, dw, but the command should still modify Are you sureee its not updating? Bc that's a bigger issue
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Yea because i have updated it and it didnt update at all for hours now i thought it was discord api being slow but it's still havent updated
vladdy
vladdy12mo ago
concern uh thats a bigger issue lol
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand(builder =>
builder
.setName(this.name)
.setDescription(this.description)
.addSubcommand(command =>
command
.setName("login")
.setDescription("Login to your valorant account")
.addStringOption(option =>
option
.setName("val_username")
.setDescription("Your valorant username")
.setRequired(true)
)
.addStringOption(option =>
option
.setName("val_password")
.setDescription("Your valorant password")
.setRequired(true)
)
)
.addSubcommand(command =>
command
.setName("logout")
.setDescription("Logout from your valorant account(s)")
.addStringOption(option =>
option
.setName("your_val_account")
.setDescription("Your Valorant Account")
.setRequired(false)
.setAutocomplete(true)
)
)
.addSubcommand(command =>
command
.setName("agents")
.setDescription("Get info about valorant agents")
.addStringOption(option =>
option
.setName("valorant_agent_name")
.setDescription("Valorant agent name")
.setRequired(true)
.setAutocomplete(true)
)
)
);
}
override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand(builder =>
builder
.setName(this.name)
.setDescription(this.description)
.addSubcommand(command =>
command
.setName("login")
.setDescription("Login to your valorant account")
.addStringOption(option =>
option
.setName("val_username")
.setDescription("Your valorant username")
.setRequired(true)
)
.addStringOption(option =>
option
.setName("val_password")
.setDescription("Your valorant password")
.setRequired(true)
)
)
.addSubcommand(command =>
command
.setName("logout")
.setDescription("Logout from your valorant account(s)")
.addStringOption(option =>
option
.setName("your_val_account")
.setDescription("Your Valorant Account")
.setRequired(false)
.setAutocomplete(true)
)
)
.addSubcommand(command =>
command
.setName("agents")
.setDescription("Get info about valorant agents")
.addStringOption(option =>
option
.setName("valorant_agent_name")
.setDescription("Valorant agent name")
.setRequired(true)
.setAutocomplete(true)
)
)
);
}
this is the code "agents" never appears
vladdy
vladdy12mo ago
whats your default behavior?
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
by default it updates
vladdy
vladdy12mo ago
wait a new command hasn't appeared?
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
on launch nope
vladdy
vladdy12mo ago
Thqnkqng
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
the agents subcommand has not appeared
vladdy
vladdy12mo ago
oh its a subcmd ok
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
other pre existing commands before this bug still works Ill run it again with VerboseOverwrite
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Nothing about subcommand
No description
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
No description
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
WAit now it worked hm Weird
vladdy
vladdy12mo ago
it should've logged the subcmd too h m m m
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Not gonna lie im confused as hell Possibly from the new updates where CJS and stuff happen? ill reinstall the framework right now same issue with the api versus stuff
vladdy
vladdy12mo ago
theres no fix for it yet, patience pls
Favna
Favna12mo ago
nah the ESM / CJS split shouldnt matter, as long as all your packages are up-to-date. If you use subcommands I cannot say for certain if @kaname-png's plugin is updated, but the sapphire one definitely is. That said, around the same time we shipped changed to compute difference of application commands so that is more likely related.
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
All good dw im patient
Solution
vladdy
vladdy12mo ago
@sapphire/framework@pr-701
vladdy
vladdy12mo ago
try this pls otherwise it seems to work fine
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
I will when i can i cant rn im sorry
vladdy
vladdy12mo ago
yeah no worries i tried it on my bot and it seems to fix the wrong defaultMemberPermission found issue
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Also where can i ask a question about getting my bot on the /tag? Im just curious what are the requirements
vladdy
vladdy12mo ago
you can PR it to the tags repo
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
No requirements?
vladdy
vladdy12mo ago
well we have some mostly that its open source
⸸⛧Stealth⛧⸸
⸸⛧Stealth⛧⸸OP12mo ago
Thats fine sounds good. Thank you. I need to flesh out some things and then ill try it ^^ I wont bring that topic up in here anymore since its not related to the issue ty for answers tho
Want results from more Discord servers?
Add your server