grim/wasdead
Clone
Summary
Browse
Changes
Graph
Don't output errors directly to the channel, commands should be handling that themselves
draft
2020-09-26, Gary Kramlich
c6d101eb5c05
Don't output errors directly to the channel, commands should be handling that themselves
package
discord
import
(
"fmt"
"github.com/alecthomas/kong"
)
type
HelpCmd
struct
{
Command
[]
string
`kong:"arg,optional,help='command to get help on'"`
}
func
(
c
*
HelpCmd
)
Run
(
g
*
Globals
)
error
{
ctx
,
err
:=
kong
.
Trace
(
g
.
ctx
.
Kong
,
c
.
Command
)
if
err
!=
nil
{
return
err
}
if
ctx
.
Error
!=
nil
{
return
ctx
.
Error
}
err
=
ctx
.
PrintUsage
(
true
)
if
err
!=
nil
{
return
err
}
fmt
.
Fprintln
(
g
.
ctx
.
Stdout
)
return
nil
}