msg.ts
v0.5.0
Published
MSG is the framework for make discord bot easily
Downloads
7
Readme
Table of contents
- About
- Installation
- Usage
- [Other packages](#Other packages)
- Contributing
- Links
About
MSG is a discord bot framework that made for complement discord.js library.
it runs on discord.js base, but it can do a lot of things to easy, than discord.js does.
so, MSG can provide legacy workload that base on discord.js library.
also, MSG can help you more with repetitive and meaningless tasks such as separation and controlling commands.
Installation
Node.js 16.0.0 or newer is required.
npm i msg.ts
Usage
const MSG = require('msg.ts')
const prefix = '!'
const bot = new MSG.Bot()
bot.setConfig({
prefix,
})
bot.on('readyState', bot => {
console.log(`${bot.user.tag} is ready!`)
})
bot.indent('now', [
MSG.subCall('day', ctx => {
ctx.reply(
`current day is \`${new Intl.DateTimeFormat('en-US', {
weekday: 'long',
}).format(new Date().getDay())}\``,
)
return ctx.finish()
}),
MSG.subCall('date', ctx => {
ctx.reply(`today is the \`${new Date().getDate()}th\``)
return ctx.finish()
}),
MSG.subCall(true, ctx => {
ctx.reply(`now time is \`${new Date()}\``)
return ctx.finish()
}),
])
bot.addCommand(
MSG.subCall(true, ctx => {
const commandDoc = `now:
usage: \`${prefix}now\`
description: show current time
subcommands:
name: day
usage: \`${prefix}now day \`
description: show current day of week
name: date
usage: \`${prefix}now date\`
description: show current date
<default>
description: just show all data
usage: \`${prefix}now\``
ctx.reply(`command list:\n\`\`\`yml\n${commandDoc}\n\`\`\``)
return ctx.finish()
}),
)
bot.login(process.env.DISCORD_TOKEN)
Other packages
generator-msg scaffolding for MSG framework (npm i -g yo generator-msg ; yo msg
)
Contributing
are you want to contribute?
thanks so much!
please read our contributing guide before start contribute