From 1c5236345c21af269758a7363464b7e2da01072d Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sun, 26 Jul 2020 21:47:27 -0600 Subject: [PATCH] fixed two minor issues... * Regex misuse in server.ts (matching media URL) * Dead value assignment in quote.ts --- src/commands/quote.ts | 2 +- src/server.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/quote.ts b/src/commands/quote.ts index c34c620..2eee13c 100644 --- a/src/commands/quote.ts +++ b/src/commands/quote.ts @@ -2,7 +2,7 @@ import discord = require('discord.js'); export const roles = ['Admins', 'Moderators']; export function command (message: discord.Message, reply: string) { - let replyMessage = 'Hello.'; + let replyMessage; if (reply == null) { replyMessage = message.content.substr(message.content.indexOf(' ') + 1); } else { diff --git a/src/server.ts b/src/server.ts index 55273f3..c961a41 100644 --- a/src/server.ts +++ b/src/server.ts @@ -145,7 +145,7 @@ client.on('message', message => { return; } if (!findArray(authorRoles, AllowedMediaRoles)) { - const urlRegex = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/gi); + const urlRegex = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_+.~#?&\/=]*)/gi); if (message.attachments.size > 0 || message.content.match(urlRegex)) { mediaUsers.set(message.author.id, true); } else if (mediaUsers.get(message.author.id)) {