Release/1.0.0 #14
@ -4,7 +4,7 @@ import { getGuildSetting, isPremiumActive } from "../tools/data";
|
|||||||
import getDefaultEmbed from "../tools/defaultEmbeds";
|
import getDefaultEmbed from "../tools/defaultEmbeds";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { Color, Emoji } from "../tools/design";
|
import { Color, Emoji } from "../tools/design";
|
||||||
import { getGuildChannel } from "../tools/discord";
|
import { getGuildChannel, getChannelPermission } from "../tools/discord";
|
||||||
|
|
||||||
const builder = new SlashCommandBuilder();
|
const builder = new SlashCommandBuilder();
|
||||||
builder.setName("showsettings");
|
builder.setName("showsettings");
|
||||||
@ -35,7 +35,7 @@ async function execute(interaction: ChatInputCommandInteraction): Promise<void>
|
|||||||
inline: true
|
inline: true
|
||||||
}, {
|
}, {
|
||||||
name: "Logchannel",
|
name: "Logchannel",
|
||||||
value: logChannel && logChannel.isTextBased() ? `<#${logChannel.id}>` : "Not configured",
|
value: settings.notificationChannelID ? `<#${settings.notificationChannelID}>` : "Not configured",
|
||||||
inline: true
|
inline: true
|
||||||
}, {
|
}, {
|
||||||
name: "Words in Blocklist",
|
name: "Words in Blocklist",
|
||||||
@ -49,8 +49,27 @@ async function execute(interaction: ChatInputCommandInteraction): Promise<void>
|
|||||||
value: "Join the support server at https://go.astrogd.eu/discord"
|
value: "Join the support server at https://go.astrogd.eu/discord"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const embeds = [];
|
||||||
|
embeds.push(embed);
|
||||||
|
|
||||||
|
const invalidLogChannelEmbed = getDefaultEmbed();
|
||||||
|
invalidLogChannelEmbed.setColor(Color.WARNING_YELLOW);
|
||||||
|
invalidLogChannelEmbed.setTitle(`${Emoji.SECURITY_CHALLENGE_FAILED} Logchannel is misconfigured!`);
|
||||||
|
invalidLogChannelEmbed.setDescription("The bot is unable to read and/or write in the configured logChannel. Please adjust your permissions.");
|
||||||
|
|
||||||
|
if (logChannel && logChannel.isTextBased()) {
|
||||||
|
const permissions = await getChannelPermission(logChannel);
|
||||||
|
if (!permissions || !permissions.has(PermissionFlagsBits.ViewChannel) || !permissions.has(PermissionFlagsBits.SendMessages)) {
|
||||||
|
embeds.push(invalidLogChannelEmbed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!logChannel || !logChannel.isTextBased()) && settings.notificationChannelID) {
|
||||||
|
embeds.push(invalidLogChannelEmbed);
|
||||||
|
}
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed],
|
embeds: embeds,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
}).catch();
|
}).catch();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user