-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscord.js
43 lines (35 loc) · 1.02 KB
/
discord.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const { Client, Intents } = require('discord.js')
const { cron } = require('./lib/cron/esportal')
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
})
const { addEsportal } = require('./lib/services/bot')
const { parseChannelMessage } = require('./lib/services/channel')
require('dotenv').config()
cron.start()
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) {
return
}
if (interaction.commandName === 'esportal') {
addEsportal(interaction)
}
})
client.on('messageCreate', async (message) => {
var user = message.author
var channel = client.channels.cache.get(message.channelId)
console.log(
"User '" +
user.username +
"' wrote '" +
message.content +
"' in '#" +
channel.name +
"'"
)
parseChannelMessage(user, channel, message)
})
client.login(process.env.TOKEN_ID)