From 80951013e391aab140800e4f386867e6c391553f Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Sat, 27 Jun 2020 22:52:54 -0700 Subject: add ts defs so not a lot of errors left - made .todo file for epic error tracking --- src/commands/server/quotemessage.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/commands/server/quotemessage.ts') diff --git a/src/commands/server/quotemessage.ts b/src/commands/server/quotemessage.ts index 315c581..d421f68 100644 --- a/src/commands/server/quotemessage.ts +++ b/src/commands/server/quotemessage.ts @@ -1,11 +1,10 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random' +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; -import tt from '../../utils/truncateText.js' +const tt = require('../../utils/truncateText.js') import path from 'path' module.exports = class QuoteMessageServer extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'quotemessage', aliases: [ @@ -33,7 +32,7 @@ module.exports = class QuoteMessageServer extends Command { ] }); } - run(msg: CommandoMessage, { mMsg }) { + run(msg: CommandoMessage, { mMsg }: any) { let emb = new MessageEmbed() .setColor(0xFFCC4D) .setTimestamp(mMsg.createdAt) @@ -61,13 +60,14 @@ module.exports = class QuoteMessageServer extends Command { const linkRegex = /https?:\/\/(?:\w+\.)?[\w-]+\.[\w]{2,3}(?:\/[\w-_.]+)+\.(?:png|jpg|jpeg|gif|webp)/; // embed (that may or may not exist) with an img in it - const imageEmbed = mMsg.embeds.find( - msgEmbed => msgEmbed.type === 'rich' && msgEmbed.image && extensions.includes(path.extname(msgEmbed.image.url)) - ) + const imageEmbed = mMsg.embeds.find((msgEmbed: { type: string; image: { url: string; }; }) => { + msgEmbed.type === 'rich' && msgEmbed.image && extensions.includes(path.extname(msgEmbed.image.url)) + }) + if (imageEmbed) messageImage = imageEmbed.image.url // uploaded img - const attachment = mMsg.attachments.find(file => extensions.includes(path.extname(file.url))) + const attachment = mMsg.attachments.find((file: { url: string; }) => extensions.includes(path.extname(file.url))) if (attachment) { messageImage = attachment.url } @@ -83,6 +83,6 @@ module.exports = class QuoteMessageServer extends Command { // if there was an img, set embed image to it if (messageImage) emb.setImage(messageImage) - msg.say(emb) + return msg.say(emb) } }; \ No newline at end of file -- cgit v1.2.3