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

@ -1,7 +1,9 @@
const client = require("../utils/client.js");
const regex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
exports.run = async (message, args) => {
if (args.length !== 0) {
if (regex.test(args.join(" "))) return `${message.author.mention}, you can't send a message containing a URL. If you want to report an issue, please join the esmBot Support server instead.`;
const feedbackChannel = client.guilds.get("592399417676529688").channels.get("592429860769497098");
feedbackChannel.createMessage({
embed: {

View file

@ -1,5 +1,6 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const { clean } = require("../utils/misc.js");
exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
@ -7,7 +8,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const {qrText, missing} = await promisify(magick.qrread)(image.path);
if (missing) return `${message.author.mention}, I couldn't find a QR code!`;
return `\`\`\`\n${qrText}\n\`\`\``;
return `\`\`\`\n${await clean(qrText)}\n\`\`\``;
};
exports.category = 1;