refactor: move handleWebhookMessage into callback
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
e6337cf6bd
commit
889ef8820a
1 changed files with 2 additions and 7 deletions
|
@ -7,7 +7,6 @@ import {
|
|||
PermissionFlagsBits,
|
||||
ChannelType,
|
||||
Events,
|
||||
Message,
|
||||
} from 'discord.js';
|
||||
import { reuploadCommands } from './_reupload';
|
||||
import {
|
||||
|
@ -52,11 +51,6 @@ const client = new Client({
|
|||
partials: [Partials.Channel],
|
||||
});
|
||||
|
||||
const handleWebhookMessage = async (e: Message<boolean>) => {
|
||||
const pkMessage = await fetchPluralKitMessage(e);
|
||||
if (pkMessage !== null) storeUserPlurality(pkMessage.sender);
|
||||
};
|
||||
|
||||
client.once('ready', async () => {
|
||||
console.log(green('Discord bot ready!'));
|
||||
|
||||
|
@ -107,7 +101,8 @@ client.once('ready', async () => {
|
|||
if (e.webhookId !== null) {
|
||||
// defer PK detection
|
||||
setTimeout(async () => {
|
||||
await handleWebhookMessage(e);
|
||||
const pkMessage = await fetchPluralKitMessage(e);
|
||||
if (pkMessage !== null) storeUserPlurality(pkMessage.sender);
|
||||
}, pkDelay);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue