diff --git a/src/commands/bot/InfoCommand.js b/src/commands/bot/InfoCommand.js index e0262c95f..52a759b90 100644 --- a/src/commands/bot/InfoCommand.js +++ b/src/commands/bot/InfoCommand.js @@ -1,18 +1,18 @@ import Command from '../Command.js'; import { ActionRowBuilder, - ButtonBuilder, ButtonStyle, hyperlink, PermissionFlagsBits, PermissionsBitField } from 'discord.js'; import bot from '../../bot/Bot.js'; -import config from '../../bot/Config.js'; import KeyValueEmbed from '../../embeds/KeyValueEmbed.js'; import {formatTime} from '../../util/timeutils.js'; import {readFile} from 'fs/promises'; import {exec} from 'child_process'; import {promisify} from 'util'; +import {componentEmojiIfExists} from '../../util/format.js'; +import BetterButtonBuilder from '../../embeds/BetterButtonBuilder.js'; export const DISCORD_INVITE_LINK = 'https://discord.gg/zYYhgPtmxw'; export const GITHUB_REPOSITORY = 'https://github.com/aternosorg/modbot'; @@ -97,11 +97,11 @@ export default class InfoCommand extends Command { new ActionRowBuilder() .addComponents( /** @type {*} */ buttons.map(data => - new ButtonBuilder() + new BetterButtonBuilder() .setLabel(data.name) .setStyle(ButtonStyle.Link) .setURL(data.url) - .setEmoji(config.data.emoji[data.emoji] ?? {})) + .setEmojiIfPresent(componentEmojiIfExists(data.emoji, null))) ) ] }); diff --git a/src/commands/settings/SettingsOverviewCommand.js b/src/commands/settings/SettingsOverviewCommand.js index 013e883be..17a11fcb8 100644 --- a/src/commands/settings/SettingsOverviewCommand.js +++ b/src/commands/settings/SettingsOverviewCommand.js @@ -1,8 +1,9 @@ import SubCommand from '../SubCommand.js'; import GuildSettings from '../../settings/GuildSettings.js'; -import {ActionRowBuilder, ButtonBuilder, ButtonStyle} from 'discord.js'; +import {ActionRowBuilder, ButtonStyle} from 'discord.js'; import {componentEmojiIfExists} from '../../util/format.js'; import icons from '../../util/icons.js'; +import BetterButtonBuilder from '../../embeds/BetterButtonBuilder.js'; export default class SettingsOverviewCommand extends SubCommand { @@ -17,7 +18,7 @@ export default class SettingsOverviewCommand extends SubCommand { /** * * @param {import('discord.js').Interaction} interaction - * @return {Promise<{components: ActionRowBuilder[], ephemeral: boolean, embeds: EmbedBuilder[]}>} + * @return {Promise<{components: ActionRowBuilder[], ephemeral: boolean, embeds: import('discord.js').EmbedBuilder[]}>} */ async buildMessage(interaction) { const guildSettings = await GuildSettings.get(interaction.guildId); @@ -28,15 +29,15 @@ export default class SettingsOverviewCommand extends SubCommand { .setAuthor({name: `${interaction.guild.name}| Settings`, iconURL: interaction.guild.iconURL()}) ], components: [ - /** @type {ActionRowBuilder}*/ + /** @type {ActionRowBuilder}*/ new ActionRowBuilder() .addComponents( /** @type {*} */ - new ButtonBuilder() + new BetterButtonBuilder() .setLabel('Refresh') .setStyle(ButtonStyle.Secondary) .setCustomId('settings:overview') - .setEmoji(componentEmojiIfExists('refresh', icons.refresh)) + .setEmojiIfPresent(componentEmojiIfExists('refresh', icons.refresh)) ) ] };