1.6.0 • Published 7 years ago

@popcorn.moe/migi v1.6.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Migi

npm

logo 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)
1.6.0

7 years ago

1.5.0

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago