Reject feedback messages if they contain links, increased image request timeout, some other fixes

This commit is contained in:
TheEssem 2020-08-13 08:47:41 -05:00
parent 23eb83d7b6
commit ba664fd19a
7 changed files with 14 additions and 9 deletions

View file

@ -9,6 +9,8 @@ ${process.env.NODE_ENV === "development" ? "\n**You are currently using esmBot D
Default prefix is \`&\`.
**Want to help support esmBot's development? Consider donating on Patreon!** https://patreon.com/TheEssem
> Tip: You can get more info about a command by using \`help [command]\`.
## Table of Contents

View file

@ -12,7 +12,7 @@ const typeCheck = async (image, image2, gifv = false) => {
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
}, 25000);
try {
const imageRequest = await fetch(image, { signal: controller.signal });
const imageBuffer = await imageRequest.buffer();

View file

@ -1,11 +1,11 @@
module.exports = (string) => {
var protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
var domainRE = /^[^\s.]+\.\S{2,}$/;
var match = string.match(protocolAndDomainRE);
const protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
const domainRE = /^[^\s.]+\.\S{2,}$/;
const match = string.match(protocolAndDomainRE);
if (!match) {
return false;
}
var everythingAfterProtocol = match[1];
const everythingAfterProtocol = match[1];
if (!everythingAfterProtocol) {
return false;
}