Necroforger / dgrouter

router to help speed up bot development in discordgo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dgrouter

Router to simplify command routing in discord bots. exrouter provides some extra features like wrapping the router type to add command handlers which typecast to its own Context type.

If you make any interesting changes feel free to submit a Pull Request

Features

example

router.On("ping", func(ctx *exrouter.Context) { ctx.Reply("pong")}).Desc("responds with pong")

router.On("avatar", func(ctx *exrouter.Context) {
	ctx.Reply(ctx.Msg.Author.AvatarURL("2048"))
}).Desc("returns the user's avatar")

router.Default = router.On("help", func(ctx *exrouter.Context) {
	var text = ""
	for _, v := range router.Routes {
		text += v.Name + " : \t" + v.Description + "\n"
	}
	ctx.Reply("```" + text + "```")
}).Desc("prints this help menu")

About

router to help speed up bot development in discordgo


Languages

Language:Go 100.0%