/
ping.go
57 lines (45 loc) · 1.15 KB
/
ping.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package systemcmds
import (
"time"
"github.com/bwmarrin/discordgo"
"github.com/rotisserie/eris"
"github.com/zekrotja/ken"
)
type PingCommand struct{}
var (
_ ken.SlashCommand = (*PingCommand)(nil)
_ ken.DmCapable = (*PingCommand)(nil)
)
func (c *PingCommand) Name() string {
return "ping"
}
func (c *PingCommand) Description() string {
return "Basic ping command"
}
func (c *PingCommand) Version() string {
return "1.0.0"
}
func (c *PingCommand) Type() discordgo.ApplicationCommandType {
return discordgo.ChatApplicationCommand
}
func (c *PingCommand) Options() []*discordgo.ApplicationCommandOption {
return []*discordgo.ApplicationCommandOption{}
}
func (c *PingCommand) IsDmCapable() bool {
return true
}
func (c *PingCommand) Help(ctx ken.SubCommandContext) (emb *discordgo.MessageEmbed, err error) {
emb = &discordgo.MessageEmbed{
Color: 0x00ff00,
Description: c.Description(),
}
return
}
func (c *PingCommand) Run(ctx ken.Context) (err error) {
err = ctx.FollowUpEmbed(&discordgo.MessageEmbed{
Title: "pong!",
Timestamp: time.Now().Format(time.RFC3339),
}).Send().Error
err = eris.Wrap(err, "Ping cmd response")
return
}