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