Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 1.6 KB

README.md

File metadata and controls

35 lines (27 loc) · 1.6 KB

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")