Skip to content

Commit

Permalink
Create events.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Kile committed May 16, 2021
1 parent 1575ae4 commit 84348c8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as CONSTANTS from './constants';
import * as functions from './functions';

// This handles the "test" message to gain tokens
discord.on(discord.Event.MESSAGE_CREATE, async (message) => {
if (message.channelId !== CONSTANTS.TESTING_CHANNEL) {
return;
}
if (message.content !== 'test') {
await message.delete();
return;
}
await functions.handleTest(message);
});

// Deleting messages that aren't command in the shop channel
discord.on(discord.Event.MESSAGE_CREATE, async (message) => {
if (message.channelId !== CONSTANTS.SHOP_CHANNEL) {
return;
}
if (message.content.startsWith(CONSTANTS.PREFIX)) {
return;
}
functions.unknownCommand(message);
});

0 comments on commit 84348c8

Please sign in to comment.