fixed two minor issues...

* Regex misuse in server.ts (matching media URL)
* Dead value assignment in quote.ts
This commit is contained in:
liushuyu 2020-07-26 21:47:27 -06:00
parent 89ed704d09
commit 1c5236345c
No known key found for this signature in database
GPG key ID: 23D1CE4534419437
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,7 @@ import discord = require('discord.js');
export const roles = ['Admins', 'Moderators']; export const roles = ['Admins', 'Moderators'];
export function command (message: discord.Message, reply: string) { export function command (message: discord.Message, reply: string) {
let replyMessage = 'Hello.'; let replyMessage;
if (reply == null) { if (reply == null) {
replyMessage = message.content.substr(message.content.indexOf(' ') + 1); replyMessage = message.content.substr(message.content.indexOf(' ') + 1);
} else { } else {

View file

@ -145,7 +145,7 @@ client.on('message', message => {
return; return;
} }
if (!findArray(authorRoles, AllowedMediaRoles)) { 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)) { if (message.attachments.size > 0 || message.content.match(urlRegex)) {
mediaUsers.set(message.author.id, true); mediaUsers.set(message.author.id, true);
} else if (mediaUsers.get(message.author.id)) { } else if (mediaUsers.get(message.author.id)) {