Created
April 20, 2022 14:31
-
-
Save mikkipastel/baea57c04945559f412353aa8fae2e82 to your computer and use it in GitHub Desktop.
register discord bot command
This file contains hidden or 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
client.on('interactionCreate', async interaction => { | |
if (!interaction.isCommand()) return; | |
const { commandName } = interaction; | |
if (commandName === 'ping') { | |
const timeTaken = Date.now() - interaction.createdTimestamp; | |
await interaction.reply(`Pong! This message had a latency of ${timeTaken}ms.`); | |
} else if (commandName === 'holiday') { | |
await interaction.reply(await calendar.getHolidayList()); | |
} | |
}); | |
client.login(process.env.DISCORD_BOT_TOKEN); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment