Typed log functions + more

This commit is contained in:
Dragory 2021-08-18 01:51:42 +03:00
parent d2ac700143
commit bed6589d48
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
166 changed files with 4021 additions and 869 deletions

View file

@ -24,14 +24,14 @@ export const PostAlertOnMemberJoinEvt = modActionsEvt({
if (actions.length) {
const alertChannel = pluginData.guild.channels.cache.get(alertChannelId as Snowflake);
if (!alertChannel) {
logs.log(LogType.BOT_ALERT, {
logs.logBotAlert({
body: `Unknown \`alert_channel\` configured for \`mod_actions\`: \`${alertChannelId}\``,
});
return;
}
if (!(alertChannel instanceof TextChannel)) {
logs.log(LogType.BOT_ALERT, {
logs.logBotAlert({
body: `Non-text channel configured as \`alert_channel\` in \`mod_actions\`: \`${alertChannelId}\``,
});
return;
@ -40,7 +40,7 @@ export const PostAlertOnMemberJoinEvt = modActionsEvt({
const botMember = await resolveMember(pluginData.client, pluginData.guild, pluginData.client.user!.id);
const botPerms = alertChannel.permissionsFor(botMember ?? pluginData.client.user!.id);
if (!hasDiscordPermissions(botPerms, Permissions.FLAGS.SEND_MESSAGES)) {
logs.log(LogType.BOT_ALERT, {
logs.logBotAlert({
body: `Missing "Send Messages" permissions for the \`alert_channel\` configured in \`mod_actions\`: \`${alertChannelId}\``,
});
return;