summaryrefslogtreecommitdiff
path: root/src/commands/server/quotemessage.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-06-27 22:52:54 -0700
committer8cy <[email protected]>2020-06-27 22:52:54 -0700
commit80951013e391aab140800e4f386867e6c391553f (patch)
tree3d7101237ef1cd8d6fe2a2fab751a2dc55ae7d84 /src/commands/server/quotemessage.ts
parentmore config shit (diff)
downloaddep-core-80951013e391aab140800e4f386867e6c391553f.tar.xz
dep-core-80951013e391aab140800e4f386867e6c391553f.zip
add ts defs so not a lot of errors left
- made .todo file for epic error tracking
Diffstat (limited to 'src/commands/server/quotemessage.ts')
-rw-r--r--src/commands/server/quotemessage.ts20
1 files changed, 10 insertions, 10 deletions
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