diff --git a/bot/ctx.go b/bot/ctx.go index a6505fb..24362e1 100644 --- a/bot/ctx.go +++ b/bot/ctx.go @@ -217,13 +217,13 @@ func (ctx *Context) Subcommands() []*Subcommand { return ctx.subcommands } -// FindCommand finds a command based on the struct and method name. The queried +// FindMethod finds a method based on the struct and method name. The queried // names will have their flags stripped. // // // Find a command from the main context: -// cmd := ctx.FindCommand("", "Method") +// cmd := ctx.FindMethod("", "Method") // // Find a command from a subcommand: -// cmd = ctx.FindCommand("Starboard", "Reset") +// cmd = ctx.FindMethod("Starboard", "Reset") // func (ctx *Context) FindCommand(structname, methodname string) *MethodContext { if structname == "" { diff --git a/bot/ctx_test.go b/bot/ctx_test.go index 792c568..45e7d92 100644 --- a/bot/ctx_test.go +++ b/bot/ctx_test.go @@ -103,7 +103,7 @@ func TestContext(t *testing.T) { }) t.Run("find commands", func(t *testing.T) { - cmd := ctx.FindCommand("", "NoArgs") + cmd := ctx.FindMethod("", "NoArgs") if cmd == nil { t.Fatal("Failed to find NoArgs") } @@ -242,7 +242,7 @@ func TestContext(t *testing.T) { t.Fatal("Unexpected call error:", err) } - if cmd := ctx.FindCommand("testc", "Noop"); cmd == nil { + if cmd := ctx.FindMethod("testc", "Noop"); cmd == nil { t.Fatal("Failed to find subcommand Noop") } }) diff --git a/bot/extras/middlewares/test.go b/bot/extras/middlewares/test.go new file mode 100644 index 0000000..9ff2af6 --- /dev/null +++ b/bot/extras/middlewares/test.go @@ -0,0 +1,11 @@ +package main + +import "testing" + +func TestAdminOnly(t *testing.T) { + t.Fatal("Do me.") +} + +func TestGuildOnly(t *testing.T) { + t.Fatal("Do me.") +} diff --git a/bot/subcommand_test.go b/bot/subcommand_test.go index 05a1c5f..1954cb3 100644 --- a/bot/subcommand_test.go +++ b/bot/subcommand_test.go @@ -42,7 +42,7 @@ func TestSubcommand(t *testing.T) { foundNoArgs bool ) - for _, this := range sub.Commands { + for _, this := range sub.Methods { switch this.Command { case "send": foundSend = true