1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-05 06:26:08 +00:00

Bot: Getter for Plumbed and Help generation fix

This commit is contained in:
diamondburned 2020-12-14 13:43:36 -08:00
parent d65807ce15
commit 66c95761a7

View file

@ -261,7 +261,7 @@ func (sub *Subcommand) HelpGenerate(showHidden bool) string {
buf.WriteString(sub.Command) buf.WriteString(sub.Command)
if !sub.IsPlumbed() { if cmd != sub.PlumbedMethod() {
buf.WriteByte(' ') buf.WriteByte(' ')
buf.WriteString(cmd.Command) buf.WriteString(cmd.Command)
} }
@ -478,11 +478,18 @@ func (sub *Subcommand) eventCallers(evT reflect.Type) (callers []caller) {
return return
} }
// IsPlumbed returns true if the subcommand is plumbed. // IsPlumbed returns true if the subcommand is plumbed. To get the plumbed
// method, use PlumbedMethod().
func (sub *Subcommand) IsPlumbed() bool { func (sub *Subcommand) IsPlumbed() bool {
return sub.plumbed != nil return sub.plumbed != nil
} }
// PlumbedMethod returns the plumbed method's context, or nil if the subcommand
// is not plumbed.
func (sub *Subcommand) PlumbedMethod() *MethodContext {
return sub.plumbed
}
// SetPlumb sets the method as the plumbed command. If method is nil, then the // SetPlumb sets the method as the plumbed command. If method is nil, then the
// plumbing is also disabled. // plumbing is also disabled.
func (sub *Subcommand) SetPlumb(method interface{}) { func (sub *Subcommand) SetPlumb(method interface{}) {