Last active
September 21, 2021 17:04
-
-
Save wylie39/87e34f807f88958fa8ad7d5f7480f0a7 to your computer and use it in GitHub Desktop.
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
const { Client, Intents } = require('discord.js') | |
const client = new Client({ | |
intents: [ | |
Intents.FLAGS.GUILDS, | |
Intents.FLAGS.GUILD_MESSAGES, | |
Intents.FLAGS.DIRECT_MESSAGES, | |
], | |
partials: ['CHANNEL', 'MESSAGE'], | |
}) | |
client.on('ready', () => { | |
console.log(`Logged in as ${client.user.tag}!`) | |
}) | |
client.on('messageCreate', (message) => { | |
if (message.guild === null) { | |
console.log('This is a DM') // if is DM | |
} | |
if (message.content.startsWith('ping')) { | |
message.author.send('Pong') | |
} | |
}) | |
client.login('token') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment