Last active
March 6, 2022 05:03
-
-
Save trezy/f085454ea6baa68701f88a532fd88eb4 to your computer and use it in GitHub Desktop.
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
// Module imports | |
import 'dotenv/config' | |
import { | |
Client, | |
Intents, | |
} from 'discord.js' | |
// Create a new client instance | |
const client = new Client({ | |
intents: [ | |
Intents.FLAGS.GUILD_MEMBERS, | |
Intents.FLAGS.GUILD_MESSAGES, | |
], | |
partials: [ | |
'CHANNEL', | |
'MESSAGE', | |
'REACTION', | |
], | |
}) | |
// When the client is ready, run this code (only once) | |
client.once('ready', () => { | |
console.log('Ready!') | |
}) | |
client.on('interactionCreate', async interaction => { | |
if (!interaction.isCommand()) return | |
const { commandName } = interaction | |
if (commandName === 'ping') { | |
console.log('Executing \'ping\' command...') | |
await interaction.reply('Pong!') | |
console.log(`Done.`) | |
} | |
}) | |
client.login(process.env.DISCORD_TOKEN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment