-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: IThundxr <[email protected]>
- Loading branch information
Showing
5 changed files
with
67 additions
and
83 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { EmbedBuilder, Events } from 'discord.js'; | ||
import { Handler } from '..'; | ||
import { textCommands } from '../commands/_commands'; | ||
|
||
const textCommandHandler: Handler = (client) => { | ||
client.on(Events.MessageCreate, async (event) => { | ||
if (!event.content.startsWith('!')) return; // make sure that the interaction came from a command | ||
try { | ||
for (const command of textCommands) command(event); // try execute the command | ||
} catch (error) { | ||
// in case of an error | ||
await event.channel.send({ | ||
// send a followup to the interaction | ||
embeds: [ | ||
new EmbedBuilder({ | ||
color: 0xff2222, | ||
title: 'Internal error', | ||
}), | ||
], | ||
}); | ||
return; | ||
} | ||
}); | ||
}; | ||
|
||
export default textCommandHandler; |
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