diff --git a/backend/src/data/GuildSavedMessages.ts b/backend/src/data/GuildSavedMessages.ts index b5759fde..423767ae 100644 --- a/backend/src/data/GuildSavedMessages.ts +++ b/backend/src/data/GuildSavedMessages.ts @@ -211,8 +211,9 @@ export class GuildSavedMessages extends BaseGuildRepository { const newMessage = { ...oldMessage, data: newData }; - //@ts-ignore - await this.messages.update( // FIXME? + // @ts-ignore + await this.messages.update( + // FIXME? { id }, { data: newData, diff --git a/backend/src/index.ts b/backend/src/index.ts index ad40ab22..fe3a07da 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -267,6 +267,8 @@ connect().then(async () => { startUptimeCounter(); }); - logger.info("Starting the bot"); + logger.info("Logging in..."); + await client.login(process.env.token); + logger.info("Initializing the bot"); bot.initialize(); }); diff --git a/backend/src/plugins/Automod/actions/setSlowmode.ts b/backend/src/plugins/Automod/actions/setSlowmode.ts index a2bacc38..7acfdd28 100644 --- a/backend/src/plugins/Automod/actions/setSlowmode.ts +++ b/backend/src/plugins/Automod/actions/setSlowmode.ts @@ -26,12 +26,13 @@ export const SetSlowmodeAction = automodAction({ continue; } - let channelsToSlowmode: TextChannel[] = []; + const channelsToSlowmode: TextChannel[] = []; if (channel.type === ChannelTypeStrings.CATEGORY) { // Find all text channels within the category for (const ch of pluginData.guild.channels.cache.values()) { - if (ch.parentID === channel.id && ch.type === ChannelTypeStrings.TEXT) + if (ch.parentID === channel.id && ch.type === ChannelTypeStrings.TEXT) { channelsToSlowmode.push(ch as TextChannel); + } } } else { channelsToSlowmode.push(channel as TextChannel); diff --git a/backend/src/plugins/Cases/functions/postToCaseLogChannel.ts b/backend/src/plugins/Cases/functions/postToCaseLogChannel.ts index 6d80698f..feacede1 100644 --- a/backend/src/plugins/Cases/functions/postToCaseLogChannel.ts +++ b/backend/src/plugins/Cases/functions/postToCaseLogChannel.ts @@ -21,7 +21,7 @@ export async function postToCaseLogChannel( let result; try { - if (file != undefined) { + if (file != null) { content.files = file; } result = await caseLogChannel.send({ ...content, split: false }); diff --git a/backend/src/plugins/Censor/util/censorMessage.ts b/backend/src/plugins/Censor/util/censorMessage.ts index ad4c32ba..69ed2859 100644 --- a/backend/src/plugins/Censor/util/censorMessage.ts +++ b/backend/src/plugins/Censor/util/censorMessage.ts @@ -14,8 +14,8 @@ export async function censorMessage( pluginData.state.serverLogs.ignoreLog(LogType.MESSAGE_DELETE, savedMessage.id); try { - const channel = pluginData.guild.channels.resolve(savedMessage.channel_id) as TextChannel; - await channel.messages.delete(savedMessage.id); + const resolvedChannel = pluginData.guild.channels.resolve(savedMessage.channel_id) as TextChannel; + await resolvedChannel.messages.delete(savedMessage.id); } catch { return; } diff --git a/backend/src/plugins/GuildInfoSaver/GuildInfoSaverPlugin.ts b/backend/src/plugins/GuildInfoSaver/GuildInfoSaverPlugin.ts index e2d51c6f..45858330 100644 --- a/backend/src/plugins/GuildInfoSaver/GuildInfoSaverPlugin.ts +++ b/backend/src/plugins/GuildInfoSaver/GuildInfoSaverPlugin.ts @@ -29,7 +29,7 @@ function updateGuildInfo(pluginData: GuildPluginData) pluginData.state.allowedGuilds.updateInfo( pluginData.guild.id, pluginData.guild.name, - pluginData.guild.iconURL, + pluginData.guild.iconURL(), pluginData.guild.ownerID, ); } diff --git a/backend/src/plugins/ModActions/commands/UnmuteCmd.ts b/backend/src/plugins/ModActions/commands/UnmuteCmd.ts index 53cc6728..0c3d09ac 100644 --- a/backend/src/plugins/ModActions/commands/UnmuteCmd.ts +++ b/backend/src/plugins/ModActions/commands/UnmuteCmd.ts @@ -61,7 +61,7 @@ export const UnmuteCmd = modActionsCmd({ } else { // Ask the mod if we should upgrade to a forceunmute as the user is not on the server const notOnServerMsg = await msg.channel.send("User not found on the server, forceunmute instead?"); - const reply = false; //await waitForReaction(pluginData.client, notOnServerMsg, ["✅", "❌"], msg.author.id); FIXME waiting on waitForButton + const reply = false; // await waitForReaction(pluginData.client, notOnServerMsg, ["✅", "❌"], msg.author.id); FIXME waiting on waitForButton notOnServerMsg.delete().catch(noop); if (!reply /*|| reply.name === "❌"*/) { diff --git a/backend/src/plugins/ModActions/commands/WarnCmd.ts b/backend/src/plugins/ModActions/commands/WarnCmd.ts index 9f347c97..b50caa35 100644 --- a/backend/src/plugins/ModActions/commands/WarnCmd.ts +++ b/backend/src/plugins/ModActions/commands/WarnCmd.ts @@ -73,7 +73,7 @@ export const WarnCmd = modActionsCmd({ config.warn_notify_message.replace("{priorWarnings}", `${priorWarnAmount}`), ); - const reply = false; //await waitForReaction(pluginData.client, tooManyWarningsMsg, ["✅", "❌"], msg.author.id); FIXME waiting on waitForButton + const reply = false; // await waitForReaction(pluginData.client, tooManyWarningsMsg, ["✅", "❌"], msg.author.id); FIXME waiting on waitForButton tooManyWarningsMsg.delete(); if (!reply /*|| reply.name === "❌"*/) { msg.channel.send(errorMessage("Warn cancelled by moderator")); diff --git a/backend/src/plugins/ModActions/functions/warnMember.ts b/backend/src/plugins/ModActions/functions/warnMember.ts index 1ffcf0d7..cf4e8eee 100644 --- a/backend/src/plugins/ModActions/functions/warnMember.ts +++ b/backend/src/plugins/ModActions/functions/warnMember.ts @@ -46,7 +46,7 @@ export async function warnMember( const failedMsg = await warnOptions.retryPromptChannel.send( "Failed to message the user. Log the warning anyway?", ); - const reply = false; //await waitForReaction(pluginData.client, failedMsg, ["✅", "❌"]); FIXME waiting on waitForButton + const reply = false; // await waitForReaction(pluginData.client, failedMsg, ["✅", "❌"]); FIXME waiting on waitForButton failedMsg.delete(); if (!reply /*|| reply.name === "❌"*/) { return { diff --git a/backend/src/plugins/Persist/events/LoadDataEvt.ts b/backend/src/plugins/Persist/events/LoadDataEvt.ts index 96c63027..091c8fac 100644 --- a/backend/src/plugins/Persist/events/LoadDataEvt.ts +++ b/backend/src/plugins/Persist/events/LoadDataEvt.ts @@ -27,7 +27,7 @@ export const LoadDataEvt = persistEvt({ return; } - let toRestore: GuildMemberEditData = {}; + const toRestore: GuildMemberEditData = {}; const config = await pluginData.config.getForMember(member); const restoredData: string[] = []; diff --git a/backend/src/plugins/Utility/commands/AboutCmd.ts b/backend/src/plugins/Utility/commands/AboutCmd.ts index ad1d2bbf..1b60fa3c 100644 --- a/backend/src/plugins/Utility/commands/AboutCmd.ts +++ b/backend/src/plugins/Utility/commands/AboutCmd.ts @@ -41,7 +41,7 @@ export const AboutCmd = utilityCmd({ version = "?"; } - //const shard = pluginData.client.shards.get(pluginData.client.guildShardMap[pluginData.guild.id])!; FIXME Sharding stuff + // const shard = pluginData.client.shards.get(pluginData.client.guildShardMap[pluginData.guild.id])!; FIXME Sharding stuff const lastReload = humanizeDuration(Date.now() - pluginData.state.lastReload, { largest: 2, diff --git a/backend/src/plugins/Utility/search.ts b/backend/src/plugins/Utility/search.ts index 75c8dbce..a42bd150 100644 --- a/backend/src/plugins/Utility/search.ts +++ b/backend/src/plugins/Utility/search.ts @@ -309,7 +309,7 @@ async function performMemberSearch( const execRegExp = getOptimizedRegExpRunner(pluginData, isSafeRegex); - /** FIXME if we ever get the intent for this again + /* FIXME if we ever get the intent for this again if (args["status-search"]) { matchingMembers = await asyncFilter(matchingMembers, async member => { if (member.game) { diff --git a/backend/src/utils.test.ts b/backend/src/utils.test.ts index ba1da55e..08baba41 100644 --- a/backend/src/utils.test.ts +++ b/backend/src/utils.test.ts @@ -2,7 +2,7 @@ import * as ioTs from "io-ts"; import { convertDelayStringToMS, convertMSToDelayString, getUrlsInString, tAllowedMentions } from "./utils"; import test from "ava"; -import { erisAllowedMentionFormat } from "./utils/erisAllowedMentionsToDjsMentionOptions"; +import { ErisAllowedMentionFormat } from "./utils/erisAllowedMentionsToDjsMentionOptions"; type AssertEquals = TActual extends TExpected ? true : false; @@ -52,6 +52,6 @@ test("delay strings: reverse conversion (conservative)", t => { test("tAllowedMentions matches Eris's AllowedMentions", t => { type TAllowedMentions = ioTs.TypeOf; - const typeTest: AssertEquals = true; + const typeTest: AssertEquals = true; t.pass(); }); diff --git a/backend/src/utils.ts b/backend/src/utils.ts index cfd33bf3..91dab927 100644 --- a/backend/src/utils.ts +++ b/backend/src/utils.ts @@ -1159,7 +1159,7 @@ export async function resolveUser(bot, value) { } // If we have the user cached, return that directly - if (bot.users.has(userId)) { + if (bot.users.cache.has(userId)) { return bot.users.get(userId); } diff --git a/backend/src/utils/erisAllowedMentionsToDjsMentionOptions.ts b/backend/src/utils/erisAllowedMentionsToDjsMentionOptions.ts index c12cec79..324ea826 100644 --- a/backend/src/utils/erisAllowedMentionsToDjsMentionOptions.ts +++ b/backend/src/utils/erisAllowedMentionsToDjsMentionOptions.ts @@ -1,13 +1,13 @@ import { MessageMentionOptions, MessageMentionTypes } from "discord.js"; export function erisAllowedMentionsToDjsMentionOptions( - allowedMentions: erisAllowedMentionFormat | undefined, + allowedMentions: ErisAllowedMentionFormat | undefined, ): MessageMentionOptions | undefined { if (allowedMentions === undefined) return undefined; - let parse: MessageMentionTypes[] = []; - let users: string[] | undefined = undefined; - let roles: string[] | undefined = undefined; + const parse: MessageMentionTypes[] = []; + let users: string[] | undefined; + let roles: string[] | undefined; if (Array.isArray(allowedMentions.users)) { users = allowedMentions.users; @@ -35,7 +35,7 @@ export function erisAllowedMentionsToDjsMentionOptions( return mentions; } -export interface erisAllowedMentionFormat { +export interface ErisAllowedMentionFormat { everyone?: boolean | undefined; users?: boolean | string[] | undefined; roles?: boolean | string[] | undefined; diff --git a/backend/src/validatorUtils.ts b/backend/src/validatorUtils.ts index afc1297f..fad5ba94 100644 --- a/backend/src/validatorUtils.ts +++ b/backend/src/validatorUtils.ts @@ -123,7 +123,7 @@ export function decodeAndValidateStrict( err => report(validationResult), result => { // Make sure there are no extra properties - if (debug) + if (debug) { console.log( "JSON.stringify() check:", JSON.stringify(value) === JSON.stringify(result) @@ -131,6 +131,7 @@ export function decodeAndValidateStrict( : "they are not the same, might have excess", result, ); + } if (JSON.stringify(value) !== JSON.stringify(result)) { const diff = deepDiff(result, value); const errors = diff.filter(d => d.kind === "N").map(d => `Unknown property <${d.path.join(".")}>`);