diff --git a/src/index.ts b/src/index.ts index 696d1589..e33afd30 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,6 +26,7 @@ import { sayCommand } from './commands/say'; import random from 'just-random'; import { green, bold, yellow, cyan } from 'kleur/colors'; import 'dotenv/config'; +import { proxied } from './utils/pluralKit'; const client = new Client({ intents: [ @@ -88,6 +89,8 @@ client.once('ready', async () => { if (e.author === client.user) return; + if (await proxied(e)) return; + if (e.cleanContent.match(BuildConfig.ETA_REGEX)) { await e.reply( `${random(BuildConfig.ETA_MESSAGES)} <:pofat:1031701005559144458>` diff --git a/src/utils/pluralKit.ts b/src/utils/pluralKit.ts new file mode 100644 index 00000000..7753a955 --- /dev/null +++ b/src/utils/pluralKit.ts @@ -0,0 +1,10 @@ +import { Message } from "discord.js"; + +export async function proxied(message: Message): Promise { + if (message.webhookId !== null) + return false; + + await new Promise(resolve => setTimeout(resolve, 300)); + const response = await fetch(`https://api.pluralkit.me/v2/messages/${message.id}`); + return response.ok; +}