42 lines
986 B
JavaScript
42 lines
986 B
JavaScript
/*
|
|
SkeptCOM [Discord] | Pour envoyer des notifications sur un serveur Discord
|
|
*/
|
|
// LOAD configFiles
|
|
const discordConf = require('../conf/discord.json')
|
|
const routage = require('../modules/routage')('discordBot')
|
|
|
|
// REQUIRE, CONST, VARIABLES
|
|
const Discord = require('discord.js')
|
|
const client = new Discord.Client()
|
|
|
|
|
|
// FUNCTIONS
|
|
const myDiscord = {
|
|
send: function() {}
|
|
}
|
|
|
|
// INIT
|
|
client.on('ready', () => {
|
|
console.log(` --- [Discord] Logged in as ${client.user.tag}!`)
|
|
routage.send(` --- [Discord] Logged in as ${client.user.tag}!`)
|
|
|
|
myDiscord.send = (channel, msg) => {
|
|
client.channels.fetch(channel)
|
|
.then(channel => channel.send(msg))
|
|
.catch(console.error)
|
|
}
|
|
|
|
})
|
|
|
|
// client.on('message', message => {
|
|
// if (message.content.startsWith('!ping')) {
|
|
// console.log(`on a un ping`)
|
|
// routage.send(message.content)
|
|
// }
|
|
// })
|
|
|
|
|
|
client.login(discordConf.token)
|
|
|
|
module.exports = myDiscord
|