Created
March 21, 2021 11:40
-
-
Save noxzym/a47b73280d8a161adf114f4312c6c5a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Listener } from "discord-akairo"; | |
import { createEmbed } from "../../Utils/ArgumentHandler"; | |
import { Message, User } from "discord.js"; | |
import MunariClient from "../../Structures/MunariClient"; | |
export default class ShoobTimerEvent extends Listener { | |
constructor(public client: MunariClient) { | |
super("ShoobTimerEvent", { | |
emitter: "client", | |
event: "message", | |
category: "client", | |
}) | |
} | |
async exec(message: Message): Promise<void> { | |
if (message.channel.type === 'dm') return | |
if ((message.guild !== null && !message.guild.me?.hasPermission('SEND_MESSAGES'))) return | |
if (message.channel.type !== 'dm' as unknown && !message.channel.permissionsFor(this.client.user as User)?.has('SEND_MESSAGES')) return | |
const embed = message.embeds[0]; | |
if (message.guild?.id === '733474234600521850') return; | |
if (message.author.id !== '673362753489993749') return; | |
if (!embed) return | |
if (!embed.title) return; | |
if (!embed.title.includes("Tier")) return; | |
if (!embed.image) return; | |
let i = 15; | |
const time = await message.channel.send(createEmbed().setDescription(`:green_circle:**\`| ❝ ${embed.title} ❞ Despawn in ${i}\`**`).setColor("#78b159")) | |
const interval = setInterval(() => { | |
i = i - 5; | |
if (i === 10) { | |
time.edit(createEmbed().setDescription(`:yellow_circle:**\`| ❝ ${embed.title} ❞ Despawn in ${i}\`**`).setColor('#fdcb58')) | |
} | |
if (i === 5) { | |
time.edit(createEmbed().setDescription(`:red_circle:**\`| ❝ ${embed.title} ❞ Despawn in ${i}\`**`).setColor('#dd2e44')) | |
} | |
if (i === 0) { | |
clearInterval(interval) | |
time.edit(createEmbed().setDescription(`:black_circle:**\`| ❝ ${embed.title} ❞ Despawn in ${i}\`**`).setColor('#31373d')).then(x => x.delete({ timeout: 3000 })) | |
} | |
}, 5000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment