| Conditions | 5 |
| Total Lines | 36 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package cmd |
||
| 8 | func HelpCommand(ctx bot.Context) { |
||
| 9 | ctx.MetricsCommand("help_command", "main") |
||
| 10 | if len(ctx.Args) == 0 { |
||
| 11 | ctx.ReplyEmbed(ctx.Loc("help"), ctx.Loc("help_reply")) |
||
| 12 | return |
||
| 13 | } |
||
| 14 | |||
| 15 | commandMap := map[string]string{ |
||
| 16 | "v": "help_command_!v", |
||
| 17 | "b": "help_command_!b", |
||
| 18 | "y": "help_command_!y", |
||
| 19 | "r": "help_command_!r", |
||
| 20 | "w": "help_command_!w", |
||
| 21 | "n": "help_command_!n", |
||
| 22 | "t": "help_command_!t", |
||
| 23 | "c": "help_command_!c", |
||
| 24 | "p": "help_command_!p", |
||
| 25 | "geoip": "help_command_!geoip", |
||
| 26 | "twitch": "help_command_!twitch", |
||
| 27 | "greetings": "help_command_!greetings", |
||
| 28 | "bot.admin": "admin_help", |
||
| 29 | } |
||
| 30 | |||
| 31 | adminCommandMap := map[string]string{ |
||
| 32 | "b": "help_command_!b_admin", |
||
| 33 | } |
||
| 34 | |||
| 35 | if _, ok := commandMap[ctx.Args[0]]; !ok { |
||
| 36 | ctx.ReplyEmbed(ctx.Loc("help"), ctx.Loc("help_reply")) |
||
| 37 | } |
||
| 38 | |||
| 39 | ctx.ReplyEmbed(ctx.Loc("help"), ctx.Loc(commandMap[ctx.Args[0]])) |
||
| 40 | |||
| 41 | if ctx.IsAdmin() { |
||
| 42 | if _, ok := adminCommandMap[ctx.Args[0]]; ok { |
||
| 43 | ctx.ReplyEmbed(ctx.Loc("help"), ctx.Loc(adminCommandMap[ctx.Args[0]])) |
||
| 44 | } |
||
| 47 |