-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreboot.go
33 lines (27 loc) · 914 Bytes
/
reboot.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
package slash
import (
"os"
"github.com/bwmarrin/discordgo"
"github.com/ritsec/ops-bot-iii/commands/slash/permission"
"github.com/ritsec/ops-bot-iii/logging"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
)
// Reboot is a slash command that reboots the bot
func Reboot() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *discordgo.InteractionCreate)) {
return &discordgo.ApplicationCommand{
Name: "reboot",
Description: "Reboot the bot",
DefaultMemberPermissions: &permission.Admin,
},
func(s *discordgo.Session, i *discordgo.InteractionCreate) {
span := tracer.StartSpan(
"commands.slash.reboot:Reboot",
tracer.ResourceName("/reboot"),
)
defer span.Finish()
logging.Debug(s, "Reboot command received", i.Member.User, span)
logging.Critical(s, "Rebooting bot", i.Member.User, span)
span.Finish()
os.Exit(0)
}
}