From 7fdc4f56397f8dc4bc48af740bfe9e0a7d72bcb5 Mon Sep 17 00:00:00 2001 From: aronson Date: Tue, 3 Oct 2023 05:51:48 -0500 Subject: [PATCH] Upgrade IRC library to v0.14.1 for nicklist hotfix (#27) --- lib/bot.ts | 7 ++++++- lib/deps.ts | 30 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/bot.ts b/lib/bot.ts index 990b468..dfb58d5 100644 --- a/lib/bot.ts +++ b/lib/bot.ts @@ -26,6 +26,7 @@ import { createDiscordReadyListener, } from './discordListeners.ts'; import { AllWebhookMessageOptions } from 'https://raw.githubusercontent.com/harmonyland/harmony/main/src/structures/webhook.ts'; +import { DiscordAPIError } from 'https://raw.githubusercontent.com/harmonyland/harmony/main/mod.ts'; // Usernames need to be between 2 and 32 characters for webhooks: const USERNAME_MIN_LENGTH = 2; @@ -228,7 +229,11 @@ export default class Bot { return content.replace(userMentionRegex, `@${displayName}`); } catch (e) { // Happens when a webhook is mentioned similar to a user, prevent 404 from crashing bot - this.logger.error(e); + if (e instanceof DiscordAPIError) { + this.logger.error(`Discord API error in user mention lookup, falling back to no mention:\n${e}`); + } else { + this.logger.error(e); + } return ''; } } diff --git a/lib/deps.ts b/lib/deps.ts index 8e9ae10..9fa74b9 100644 --- a/lib/deps.ts +++ b/lib/deps.ts @@ -1,17 +1,17 @@ // IRC exports -export { Client as IrcClient } from 'https://deno.land/x/irc@v0.14.0/mod.ts'; -export type { ClientOptions } from 'https://deno.land/x/irc@v0.14.0/mod.ts'; -export type { PrivmsgEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/privmsg.ts'; -export type { ClientError } from 'https://deno.land/x/irc@v0.14.0/core/errors.ts'; -export type { RegisterEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/register.ts'; -export type { NoticeEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/notice.ts'; -export type { NickEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/nick.ts'; -export type { JoinEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/join.ts'; -export type { PartEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/part.ts'; -export type { QuitEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/quit.ts'; -export type { NicklistEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/nicklist.ts'; -export type { CtcpActionEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/action.ts'; -export type { InviteEvent } from 'https://deno.land/x/irc@v0.14.0/plugins/invite.ts'; +export { Client as IrcClient } from 'https://deno.land/x/irc@v0.14.1/mod.ts'; +export type { ClientOptions } from 'https://deno.land/x/irc@v0.14.1/mod.ts'; +export type { PrivmsgEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/privmsg.ts'; +export type { ClientError } from 'https://deno.land/x/irc@v0.14.1/core/errors.ts'; +export type { RegisterEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/register.ts'; +export type { NoticeEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/notice.ts'; +export type { NickEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/nick.ts'; +export type { JoinEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/join.ts'; +export type { PartEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/part.ts'; +export type { QuitEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/quit.ts'; +export type { NicklistEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/nicklist.ts'; +export type { CtcpActionEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/action.ts'; +export type { InviteEvent } from 'https://deno.land/x/irc@v0.14.1/plugins/invite.ts'; // Harmony/Discord exports export { AllowedMentionType, @@ -23,5 +23,5 @@ export { Webhook, } from 'https://raw.githubusercontent.com/harmonyland/harmony/main/mod.ts'; // std exports -export { resolve as resolvePath } from 'https://deno.land/std@0.200.0/path/mod.ts'; -export { parse as parseCLI } from 'https://deno.land/std@0.200.0/flags/mod.ts'; +export { resolve as resolvePath } from 'https://deno.land/std@0.203.0/path/mod.ts'; +export { parse as parseCLI } from 'https://deno.land/std@0.203.0/flags/mod.ts';