Skip to content

Instantly share code, notes, and snippets.

@wylie39
Created September 21, 2021 17:05
Show Gist options
  • Save wylie39/babbf086205d96bb95c62be654a9c687 to your computer and use it in GitHub Desktop.
Save wylie39/babbf086205d96bb95c62be654a9c687 to your computer and use it in GitHub Desktop.
Discord.js example
const { Client, Intents } = require('discord.js')
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES
],
partials: ['CHANNEL', 'MESSAGE'],
})
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on('messageCreate', (message) => {
if (message.content.startsWith('ping')) {
message.channel.send('Pong')
}
})
client.login('token')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment