GokaiM / github-slideshow

A robot powered training repository :robot:
https://lab.github.com/githubtraining/introduction-to-github
MIT License
0 stars 0 forks source link

Code #1

Open github-learning-lab[bot] opened 4 years ago

github-learning-lab[bot] commented 4 years ago

const { cpuUsage } = require('process')

const Discord = require('discord.js'), client = new Discord.Client(), config = require('./config.json'), fs = require('fs')

client.login(config.token) client.commands = new Discord.Collection()

fs.readdir('./commabds', (err, files) => { if (err) throw err files.forEach(file => { if (!file.endsWith('.js')) return const command = require (./commands/${file}) client.commands.set(command.name, command)

})

})

client.on('message', message => { if (message.type !== 'DEFAULT' || message.author.bot) return

const args = message.content.trim().split(/ +/g)
const commandName = args.shift().toLowerCase()
if (!commandName.startsWith(config.prefix)) return
const command = client.commands.get(commandName.slice(config.prefix.lenght))
if (command) return 
command.run(message, args, client)

})

github-learning-lab[bot] commented 4 years ago

{ "token": "Le Token du bot :v", "prefix": "+"

}