/
ping.go
32 lines (29 loc) · 851 Bytes
/
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
package handlers
import (
"database/sql"
"fmt"
"github.com/MattiasBerlin/outbot/commands"
"github.com/bwmarrin/discordgo"
)
// PingCommand for getting help descriptions.
func PingCommand() commands.Command {
return commands.Command{
CallPhrase: "ping",
Permission: commands.All,
HelpDescription: "Check if OutBot is online",
Handler: HandlePing,
Help: commands.Help{
Summary: "Check if OutBot is online",
DetailedDescription: "Check if OutBot is online.",
Syntax: "ping",
Example: "ping",
},
}
}
func HandlePing(msg string, s *discordgo.Session, m *discordgo.MessageCreate, db *sql.DB, guildID string, cmds []commands.Command) {
_, err := s.ChannelMessageSend(m.ChannelID, "Pong! v2")
if err != nil {
fmt.Println("Failed to send message:", err)
return
}
}