@popcorn.moe/migi
v1.6.0
Published
Our right hand to write Discord bots
Downloads
4
Readme
Migi
Our right hand to write Discord bots
Examples
With decorators (Need babel)
import Migi, { command, on } from '@popcorn.moe/migi'
class Ping {
@command(/^ping(?: (.*))?$/)
ping({ channel }, arg) {
channel.send(`Ping ${arg}!`)
}
@on('ready')
onReady() {
console.log('Ready')
}
}
const migi = new Migi({
root: __dirname
})
migi.loadModule(Ping)
migi.on('ready', () => console.log(`Ready @${migi.user.tag}`))
migi.login(process.env.DISCORD_TOKEN)
Without decorators
const { Migi } = require('@popcorn.moe/migi')
class Ping {
constructor(migi) {
migi.command(/^ping(?: (.*))?$/, this, 'ping')
migi.listen('ready', this, 'onReady')
}
ping({ channel }, arg) {
channel.send(`Ping ${arg}!`)
}
onReady() {
console.log('Ready')
}
}
const migi = new Migi({
root: __dirname
})
migi.loadModule(Ping)
migi.on('ready', () => console.log(`Ready @${migi.user.tag}`))
migi.login(process.env.DISCORD_TOKEN)