Showing
2 changed files
with
6 additions
and
4 deletions
1 | +config.json | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | const { Client, Intents } = require('discord.js'); | 1 | const { Client, Intents } = require('discord.js'); |
2 | +const { token } = require('./config.json'); | ||
2 | 3 | ||
3 | -const client = new Client({ intents: [Intents.FLAGS.GUILDS] }); | 4 | +const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); |
4 | 5 | ||
5 | -client.on('ready', () => { | 6 | +client.once('ready', () => { |
6 | console.log(`Logged in as ${client.user.tag}!`); | 7 | console.log(`Logged in as ${client.user.tag}!`); |
7 | }); | 8 | }); |
8 | 9 | ||
9 | -client.on('message', msg => { | 10 | +client.on('messageCreate', msg => { |
10 | if (msg.content === 'ping') { | 11 | if (msg.content === 'ping') { |
11 | msg.reply('Pong!'); | 12 | msg.reply('Pong!'); |
12 | } | 13 | } |
13 | }); | 14 | }); |
14 | 15 | ||
15 | -client.login('token'); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
16 | +client.login(token); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment