contextMenuRun not firing

Unsure where to look or what's wrong, I had this command working a month or so ago. The registration happens fine, and I can see the command (and see it updated), but the interaction itself just times out.
@ApplyOptions<CommandOptions>({
name: "Create Issue", //changed to "command registers and updates" in the attached screenshot
})
export class JiraSuggestionCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
super(context, { ...options });
}

public override registerApplicationCommands(registry: Command.Registry) {
const e = registry.registerContextMenuCommand((builder) =>
builder //
.setName(this.name)
.setType(ApplicationCommandType.Message),
);

console.log(e);
}

public async contextMenuRun(interaction: Command.ContextMenuCommandInteraction) {
//Not firing !!!
console.log("aaaaa"); //Not logged

if (interaction.user.id !== "85615542861312000") {
const embed = Logger.warn(`${interaction.user} - you do not have permission to use ${this.name}`);
return interaction.reply({ embeds: [embed], ephemeral: true });
}

const targetMessage: Message = await interaction.channel.messages.fetch(interaction.targetId);

await JiraTaskMaster(interaction, targetMessage);
}
}
@ApplyOptions<CommandOptions>({
name: "Create Issue", //changed to "command registers and updates" in the attached screenshot
})
export class JiraSuggestionCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
super(context, { ...options });
}

public override registerApplicationCommands(registry: Command.Registry) {
const e = registry.registerContextMenuCommand((builder) =>
builder //
.setName(this.name)
.setType(ApplicationCommandType.Message),
);

console.log(e);
}

public async contextMenuRun(interaction: Command.ContextMenuCommandInteraction) {
//Not firing !!!
console.log("aaaaa"); //Not logged

if (interaction.user.id !== "85615542861312000") {
const embed = Logger.warn(`${interaction.user} - you do not have permission to use ${this.name}`);
return interaction.reply({ embeds: [embed], ephemeral: true });
}

const targetMessage: Message = await interaction.channel.messages.fetch(interaction.targetId);

await JiraTaskMaster(interaction, targetMessage);
}
}
const CLIENT_OPTIONS: ClientOptions = {
caseInsensitiveCommands: true,
caseInsensitivePrefixes: true,
loadMessageCommandListeners: true,
defaultPrefix: "^",
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.MessageContent,
],
partials: [Partials.User, Partials.GuildMember, Partials.Channel, Partials.Reaction, Partials.Message],
shards: "auto",
typing: false,
presence: {
activities: [
{
name: process.env.ACTIVITY_NAME ?? "SWRPGV2 /help",
type: ActivityType.Playing,
},
],
},
};
const CLIENT_OPTIONS: ClientOptions = {
caseInsensitiveCommands: true,
caseInsensitivePrefixes: true,
loadMessageCommandListeners: true,
defaultPrefix: "^",
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.MessageContent,
],
partials: [Partials.User, Partials.GuildMember, Partials.Channel, Partials.Reaction, Partials.Message],
shards: "auto",
typing: false,
presence: {
activities: [
{
name: process.env.ACTIVITY_NAME ?? "SWRPGV2 /help",
type: ActivityType.Playing,
},
],
},
};
I feel I'm missing something stupid or knocked something in a merge 🫣 I referred to the docs but I have everything I need? Any pointers as to what I'm missing or what I'm doing wrong?
No description
4 Replies
Bejasc
BejascOP•17mo ago
I am also using
await client.login(); ApplicationCommandRegistries.setDefaultBehaviorWhenNotIdentical(RegisterBehavior.BulkOverwrite);
await client.login(); ApplicationCommandRegistries.setDefaultBehaviorWhenNotIdentical(RegisterBehavior.BulkOverwrite);
(Tried setting BulkOverwrite before and after - docs weren't clear on where that should be placed, I assume before login, so that it applies before command registration) I found the issue, based on <#1122234565122064466> this thread. - I have a number of Preconditions set up, that have both public override async chatInputRun and public override async messageRun - but did not have an override provided for public override async contextMenuRun I had to add this to all preconditions for the context menu command to work. Couldn't find anything in the docs that suggested that the all preconditions must explicitly provide a handler for all command types, else the command type wouldn't work. Might be a good idea to add this to the doc? @Favna
Favna
Favna•17mo ago
Always open to PRs
Bejasc
BejascOP•17mo ago
I'd be very happy to contribute, would you mind pointing me to the correct repo if I were to include this in any relevant spots of the guide or documentation?
Favna
Favna•17mo ago
GitHub
website/docs/Guide/preconditions/creating-your-own-preconditions.md...
Documentation for Sapphire Project. Contribute to sapphiredev/website development by creating an account on GitHub.
Want results from more Discord servers?
Add your server