fix: incorrect guild_d

This commit is contained in:
MARCROCK22 2024-03-27 21:38:28 -04:00
parent 6368c10d3e
commit 865f863e53

View File

@ -29,8 +29,8 @@ export async function onInteractionCreate(
case InteractionType.ApplicationCommandAutocomplete: case InteractionType.ApplicationCommandAutocomplete:
{ {
const parentCommand = self.commands?.values.find(x => { const parentCommand = self.commands?.values.find(x => {
if (x.guild_id && !x.guild_id.includes(body.data.guild_id ?? '')) { if (body.data.guild_id) {
return false; return x.guild_id?.includes(body.data.guild_id) && x.name === body.data.name;
} }
return x.name === body.data.name; return x.name === body.data.name;
}); });
@ -38,7 +38,7 @@ export async function onInteractionCreate(
self, self,
body.data.options ?? [], body.data.options ?? [],
parentCommand as Command, parentCommand as Command,
body.data.guild_id, body.guild_id,
body.data.resolved as ContextOptionsResolved, body.data.resolved as ContextOptionsResolved,
); );
const interaction = new AutocompleteInteraction(self, body, __reply); const interaction = new AutocompleteInteraction(self, body, __reply);
@ -77,8 +77,8 @@ export async function onInteractionCreate(
case ApplicationCommandType.User: case ApplicationCommandType.User:
{ {
const command = self.commands?.values.find(x => { const command = self.commands?.values.find(x => {
if (x.guild_id && !x.guild_id.includes(body.data.guild_id ?? '')) { if (body.data.guild_id) {
return false; return x.guild_id?.includes(body.data.guild_id) && x.name === body.data.name;
} }
return x.name === body.data.name; return x.name === body.data.name;
}) as ContextMenuCommand; }) as ContextMenuCommand;
@ -134,19 +134,18 @@ export async function onInteractionCreate(
break; break;
case ApplicationCommandType.ChatInput: case ApplicationCommandType.ChatInput:
{ {
const packetData = body.data;
const parentCommand = self.commands?.values.find(x => { const parentCommand = self.commands?.values.find(x => {
if (x.guild_id && !x.guild_id.includes(packetData.guild_id ?? '')) { if (body.data.guild_id) {
return false; return x.guild_id?.includes(body.data.guild_id) && x.name === body.data.name;
} }
return x.name === packetData.name; return x.name === body.data.name;
}); });
const optionsResolver = new OptionResolver( const optionsResolver = new OptionResolver(
self, self,
packetData.options ?? [], body.data.options ?? [],
parentCommand as Command, parentCommand as Command,
packetData.guild_id, body.guild_id,
packetData.resolved as ContextOptionsResolved, body.data.resolved as ContextOptionsResolved,
); );
const interaction = BaseInteraction.from(self, body, __reply) as ChatInputCommandInteraction; const interaction = BaseInteraction.from(self, body, __reply) as ChatInputCommandInteraction;
const command = optionsResolver.getCommand(); const command = optionsResolver.getCommand();