| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package cmd |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "strings" |
||
| 5 | "time" |
||
| 6 | |||
| 7 | "github.com/FlameInTheDark/dtbot/bot" |
||
| 8 | ) |
||
| 9 | |||
| 10 | // DebugCommand special bot commands handler |
||
| 11 | func DebugCommand(ctx bot.Context) { |
||
| 12 | ctx.MetricsCommand("debug", "admin") |
||
| 13 | if ctx.GetRoles().ExistsName("bot.admin") { |
||
| 14 | if len(ctx.Args) == 0 { |
||
| 15 | return |
||
| 16 | } |
||
| 17 | switch ctx.Args[0] { |
||
| 18 | case "roles": |
||
| 19 | var roles []string |
||
| 20 | for _, val := range ctx.GetRoles().Roles { |
||
| 21 | roles = append(roles, val.Name) |
||
| 22 | } |
||
| 23 | ctx.ReplyEmbedPM("Debug", strings.Join(roles, ", ")) |
||
| 24 | case "time": |
||
| 25 | ctx.ReplyEmbedPM("Debug", time.Now().String()) |
||
| 26 | case "session": |
||
| 27 | sess := ctx.Sessions.GetByGuild(ctx.Guild.ID) |
||
| 28 | if sess != nil { |
||
| 29 | ctx.ReplyEmbed("Debug", sess.ChannelID) |
||
| 30 | } else { |
||
| 31 | ctx.ReplyEmbed("Debug", "Session is nil") |
||
| 32 | } |
||
| 33 | } |
||
| 34 | } else { |
||
| 35 | ctx.ReplyEmbedPM("Debug", "Not a Admin") |
||
| 36 | } |
||
| 38 |