forked from Galactic/galactic-bot
bugfixes
This commit is contained in:
parent
2964dc24e5
commit
393337fbbd
@ -87,7 +87,7 @@ else 'one option';
|
||||
{emoji_loading} Starting poll...
|
||||
|
||||
[COMMAND_POLL_DURATION]
|
||||
Poll runs for {time}, ends in <t:{duration}:R>
|
||||
Poll runs for {time}, ends <t:{duration}:R>
|
||||
|
||||
[COMMAND_POLL_INFINITE]
|
||||
Poll has no end time.
|
||||
|
@ -84,7 +84,7 @@ class GuildWrapper {
|
||||
result[emoji] = reaction.count - 1;
|
||||
}
|
||||
|
||||
const [embed] = msg.embeds;
|
||||
const embed = msg.embeds[0].toJSON();
|
||||
const results = Object.entries(result).map(([emoji, count]) => `${emoji} - ${count}`).join('\n');
|
||||
embed.description = this.format('COMMAND_POLL_END', { results });
|
||||
await msg.edit({ embeds: [embed] });
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { Guild, InteractionType } = require('discord.js');
|
||||
const { Guild, InteractionType, ApplicationCommandOptionType } = require('discord.js');
|
||||
const GuildWrapper = require('./GuildWrapper.js');
|
||||
|
||||
class InteractionWrapper {
|
||||
@ -168,15 +168,15 @@ class InteractionWrapper {
|
||||
get subcommand() {
|
||||
const [data] = this.options.data;
|
||||
if (!data) return null;
|
||||
else if (data.type === 'SUB_COMMAND') return data;
|
||||
else if (data.type === 'SUB_COMMAND_GROUP') return data.options[0];
|
||||
else if (data.type === ApplicationCommandOptionType.Subcommand) return data;
|
||||
else if (data.type === ApplicationCommandOptionType.SubcommandGroup) return data.options[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
get subcommandGroup() {
|
||||
const [data] = this.options.data;
|
||||
if (!data) return null;
|
||||
else if (data.type === 'SUB_COMMAND_GROUP') return data;
|
||||
else if (data.type === ApplicationCommandOptionType.SubcommandGroup) return data;
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -187,7 +187,8 @@ class InteractionWrapper {
|
||||
*/
|
||||
_options(options) {
|
||||
if (!options?.length) return [];
|
||||
if (['SUB_COMMAND_GROUP', 'SUB_COMMAND'].includes(options[0].type)) return this._options(options[0].options);
|
||||
if ([ApplicationCommandOptionType.SubcommandGroup, ApplicationCommandOptionType.Subcommand].includes(options[0].type))
|
||||
return this._options(options[0].options);
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ class InvokerWrapper {
|
||||
if(options.embed) options.embeds = [options.embed];
|
||||
|
||||
if (options.embeds) options.embeds.forEach((embed) => {
|
||||
if (!embed.color) embed.color = 619452;
|
||||
if (!embed.data.color) embed.setColor(619452);
|
||||
});
|
||||
|
||||
if (options.dm) {
|
||||
|
@ -175,7 +175,7 @@ class SettingsCommand extends SlashCommand {
|
||||
if(field.name.length > 1) field.name = guild.format(field.name);
|
||||
});
|
||||
|
||||
embed.fields.push(...dataFields);
|
||||
embed.addFields(dataFields);
|
||||
await invoker.reply({ embeds: [embed] });
|
||||
// .catch((error) => {
|
||||
// this.client.logger.error(`${error.stack || error}\nError context: ${JSON.stringify(embed)}`);
|
||||
|
Loading…
Reference in New Issue
Block a user