1package command 2 3import ( 4 "github.com/nicksnyder/go-i18n/v2/i18n" 5 "strings" 6) 7 8type Type int 9 10const ( 11 Help Type = iota 12 New 13 End 14 Pause 15 Refresh 16 Link 17 Unlink 18 UnmuteAll 19 Force 20 Settings 21 Map 22 Cache 23 Privacy 24 Info 25 DebugState 26 ASCII 27 Stats 28 Premium 29 Null 30) 31 32type Command struct { 33 Aliases []string 34 Command string 35 Example string 36 Emoji string 37 CommandType Type 38 ShortDesc *i18n.Message 39 Description *i18n.Message 40 Arguments *i18n.Message 41 IsSecret bool 42 IsAdmin bool 43 IsOperator bool 44} 45 46func GetCommand(arg string) Command { 47 arg = strings.ToLower(arg) 48 for _, cmd := range AllCommands { 49 if arg == cmd.Command { 50 return cmd 51 } 52 for _, al := range cmd.Aliases { 53 if arg == al { 54 return cmd 55 } 56 } 57 } 58 return AllCommands[Null] 59} 60 61// note, this mapping is HIERARCHICAL. If you type `l`, "link" would be used over "log" 62var AllCommands = []Command{ 63 { 64 CommandType: Help, 65 Command: "help", 66 Example: "help track", 67 ShortDesc: &i18n.Message{ 68 ID: "commands.AllCommands.Help.shortDesc", 69 Other: "Display help", 70 }, 71 Description: &i18n.Message{ 72 ID: "commands.AllCommands.Help.desc", 73 Other: "Display bot help message, or see info about a Command", 74 }, 75 Arguments: &i18n.Message{ 76 ID: "commands.AllCommands.Help.args", 77 Other: "None, or optional Command to see info for", 78 }, 79 Aliases: []string{"h"}, 80 IsSecret: false, 81 Emoji: "❓", 82 IsAdmin: false, 83 IsOperator: false, 84 }, 85 { 86 CommandType: New, 87 Command: "new", 88 Example: "new", 89 ShortDesc: &i18n.Message{ 90 ID: "commands.AllCommands.New.shortDesc", 91 Other: "Start a new game", 92 }, 93 Description: &i18n.Message{ 94 ID: "commands.AllCommands.New.desc", 95 Other: "Start a new game", 96 }, 97 Arguments: &i18n.Message{ 98 ID: "commands.AllCommands.New.args", 99 Other: "None", 100 }, 101 Aliases: []string{"start", "n"}, 102 IsSecret: false, 103 Emoji: "", 104 IsAdmin: false, 105 IsOperator: true, 106 }, 107 { 108 CommandType: End, 109 Command: "end", 110 Example: "end", 111 ShortDesc: &i18n.Message{ 112 ID: "commands.AllCommands.End.shortDesc", 113 Other: "End the game", 114 }, 115 Description: &i18n.Message{ 116 ID: "commands.AllCommands.End.desc", 117 Other: "End the current game", 118 }, 119 Arguments: &i18n.Message{ 120 ID: "commands.AllCommands.End.args", 121 Other: "None", 122 }, 123 Aliases: []string{"stop", "e"}, 124 IsSecret: false, 125 Emoji: "", 126 IsAdmin: false, 127 IsOperator: true, 128 }, 129 { 130 CommandType: Pause, 131 Command: "pause", 132 Example: "pause", 133 ShortDesc: &i18n.Message{ 134 ID: "commands.AllCommands.Pause.shortDesc", 135 Other: "Pause the bot", 136 }, 137 Description: &i18n.Message{ 138 ID: "commands.AllCommands.Pause.desc", 139 Other: "Pause the bot so it doesn't automute/deafen. Will unmute/undeafen all players!", 140 }, 141 Arguments: &i18n.Message{ 142 ID: "commands.AllCommands.Pause.args", 143 Other: "None", 144 }, 145 Aliases: []string{"unpause", "p"}, 146 IsSecret: false, 147 Emoji: "⏸", 148 IsAdmin: false, 149 IsOperator: true, 150 }, 151 { 152 CommandType: Refresh, 153 Command: "refresh", 154 Example: "refresh", 155 ShortDesc: &i18n.Message{ 156 ID: "commands.AllCommands.Refresh.shortDesc", 157 Other: "Refresh the bot status", 158 }, 159 Description: &i18n.Message{ 160 ID: "commands.AllCommands.Refresh.desc", 161 Other: "Recreate the bot status message if it ends up too far in the chat", 162 }, 163 Arguments: &i18n.Message{ 164 ID: "commands.AllCommands.Refresh.args", 165 Other: "None", 166 }, 167 Aliases: []string{"reload", "ref", "rel", "r"}, 168 IsSecret: false, 169 Emoji: "♻", 170 IsAdmin: false, 171 IsOperator: true, 172 }, 173 { 174 CommandType: Link, 175 Command: "link", 176 Example: "link @Soup red", 177 ShortDesc: &i18n.Message{ 178 ID: "commands.AllCommands.Link.shortDesc", 179 Other: "Link a Discord User", 180 }, 181 Description: &i18n.Message{ 182 ID: "commands.AllCommands.Link.desc", 183 Other: "Manually link a Discord User to their in-game color or name", 184 }, 185 Arguments: &i18n.Message{ 186 ID: "commands.AllCommands.Link.args", 187 Other: "<discord User> <in-game color or name>", 188 }, 189 Aliases: []string{"l"}, 190 IsSecret: false, 191 Emoji: "", 192 IsAdmin: false, 193 IsOperator: true, 194 }, 195 { 196 CommandType: Unlink, 197 Command: "unlink", 198 Example: "unlink @Soup", 199 ShortDesc: &i18n.Message{ 200 ID: "commands.AllCommands.Unlink.shortDesc", 201 Other: "Unlink a Discord User", 202 }, 203 Description: &i18n.Message{ 204 ID: "commands.AllCommands.Unlink.desc", 205 Other: "Manually unlink a Discord User from their in-game player", 206 }, 207 Arguments: &i18n.Message{ 208 ID: "commands.AllCommands.Unlink.args", 209 Other: "<discord User>", 210 }, 211 Aliases: []string{"un", "ul", "u"}, 212 IsSecret: false, 213 Emoji: "", 214 IsAdmin: false, 215 IsOperator: true, 216 }, 217 { 218 CommandType: UnmuteAll, 219 Command: "unmuteall", 220 Example: "unmuteall", 221 ShortDesc: &i18n.Message{ 222 ID: "commands.AllCommands.UnmuteAll.shortDesc", 223 Other: "Force the bot to unmute all", 224 }, 225 Description: &i18n.Message{ 226 ID: "commands.AllCommands.UnmuteAll.desc", 227 Other: "Force the bot to unmute all linked players", 228 }, 229 Arguments: &i18n.Message{ 230 ID: "commands.AllCommands.UnmuteAll.args", 231 Other: "None", 232 }, 233 Aliases: []string{"unmute", "ua"}, 234 IsSecret: false, 235 Emoji: "", 236 IsAdmin: false, 237 IsOperator: true, 238 }, 239 { 240 CommandType: Force, 241 Command: "force", 242 Example: "force task", 243 ShortDesc: &i18n.Message{ 244 ID: "commands.AllCommands.Force.shortDesc", 245 Other: "Force the bot to transition", 246 }, 247 Description: &i18n.Message{ 248 ID: "commands.AllCommands.Force.desc", 249 Other: "Force the bot to transition to another game stage, if it doesn't transition properly", 250 }, 251 Arguments: &i18n.Message{ 252 ID: "commands.AllCommands.Force.args", 253 Other: "<phase name> (task, discuss, or lobby / t,d, or l)", 254 }, 255 Aliases: []string{"f"}, 256 IsSecret: true, // force is broken rn, so hide it 257 Emoji: "", 258 IsAdmin: false, 259 IsOperator: true, 260 }, 261 { 262 CommandType: Map, 263 Command: "map", 264 Example: "map skeld", 265 ShortDesc: &i18n.Message{ 266 ID: "commands.AllCommands.Map.shortDesc", 267 Other: "Display an in-game map", 268 }, 269 Description: &i18n.Message{ 270 ID: "commands.AllCommands.Map.desc", 271 Other: "Display an image of an in-game map in the text channel. Two supported versions: simple or detailed", 272 }, 273 Arguments: &i18n.Message{ 274 ID: "commands.AllCommands.Map.args", 275 Other: "<map_name> (skeld, mira_hq, polus, airship) <version> (optional, simple or detailed)", 276 }, 277 Aliases: []string{"map"}, 278 IsSecret: false, 279 Emoji: "", 280 IsAdmin: false, 281 IsOperator: false, 282 }, 283 { 284 CommandType: Cache, 285 Command: "cache", 286 Example: "cache @Soup", 287 ShortDesc: &i18n.Message{ 288 ID: "commands.AllCommands.Cache.shortDesc", 289 Other: "View cached usernames", 290 }, 291 Description: &i18n.Message{ 292 ID: "commands.AllCommands.Cache.desc", 293 Other: "View a player's cached in-game names, and/or clear them", 294 }, 295 Arguments: &i18n.Message{ 296 ID: "commands.AllCommands.Cache.args", 297 Other: "<player> (optionally, \"clear\")", 298 }, 299 Aliases: []string{"c"}, 300 IsSecret: false, 301 Emoji: "", 302 IsAdmin: false, 303 IsOperator: true, 304 }, 305 { 306 CommandType: Privacy, 307 Command: "privacy", 308 Example: "privacy showme", 309 ShortDesc: &i18n.Message{ 310 ID: "commands.AllCommands.Privacy.shortDesc", 311 Other: "View AutoMuteUs privacy information", 312 }, 313 Description: &i18n.Message{ 314 ID: "commands.AllCommands.Privacy.desc", 315 Other: "AutoMuteUs privacy and data collection details.\nMore details [here](https://github.com/denverquane/automuteus/blob/master/PRIVACY.md)", 316 }, 317 Arguments: &i18n.Message{ 318 ID: "commands.AllCommands.Privacy.args", 319 Other: "showme, optin, or optout", 320 }, 321 Aliases: []string{"private", "priv", "gdpr"}, 322 IsSecret: false, 323 Emoji: "", 324 IsAdmin: false, 325 IsOperator: false, 326 }, 327 { 328 CommandType: Settings, 329 Command: "settings", 330 Example: "settings commandPrefix !", 331 ShortDesc: &i18n.Message{ 332 ID: "commands.AllCommands.Settings.shortDesc", 333 Other: "Adjust bot settings", 334 }, 335 Description: &i18n.Message{ 336 ID: "commands.AllCommands.Settings.desc", 337 Other: "Adjust the bot settings. Type `{{.CommandPrefix}} settings` with no arguments to see more.", 338 }, 339 Arguments: &i18n.Message{ 340 ID: "commands.AllCommands.Settings.args", 341 Other: "<setting> <value>", 342 }, 343 Aliases: []string{"sett", "set", "s"}, 344 IsSecret: false, 345 Emoji: "", 346 IsAdmin: true, 347 IsOperator: true, 348 }, 349 { 350 CommandType: Premium, 351 Command: "premium", 352 Example: "premium", 353 ShortDesc: &i18n.Message{ 354 ID: "commands.AllCommands.Premium.shortDesc", 355 Other: "View Premium Bot Features", 356 }, 357 Description: &i18n.Message{ 358 ID: "commands.AllCommands.Premium.desc", 359 Other: "View all the features and perks of Premium AutoMuteUs membership", 360 }, 361 Arguments: &i18n.Message{ 362 ID: "commands.AllCommands.Premium.args", 363 Other: "None", 364 }, 365 Aliases: []string{"donate", "paypal", "prem", "$"}, 366 IsSecret: false, 367 Emoji: "", 368 IsAdmin: false, 369 IsOperator: false, 370 }, 371 { 372 CommandType: Stats, 373 Command: "stats", 374 Example: "stats @Soup", 375 ShortDesc: &i18n.Message{ 376 ID: "commands.AllCommands.Stats.shortDesc", 377 Other: "View Player and Guild stats", 378 }, 379 Description: &i18n.Message{ 380 ID: "commands.AllCommands.Stats.desc", 381 Other: "View Player and Guild stats", 382 }, 383 Arguments: &i18n.Message{ 384 ID: "commands.AllCommands.Stats.args", 385 Other: "<@discord user> or \"guild\"", 386 }, 387 Aliases: []string{"stat", "st"}, 388 IsSecret: false, 389 Emoji: "", 390 IsAdmin: false, 391 IsOperator: false, 392 }, 393 { 394 CommandType: Info, 395 Command: "info", 396 Example: "info", 397 ShortDesc: &i18n.Message{ 398 ID: "commands.AllCommands.Info.shortDesc", 399 Other: "View Bot info", 400 }, 401 Description: &i18n.Message{ 402 ID: "commands.AllCommands.Info.desc", 403 Other: "View info about the bot, like total guild number, active games, etc", 404 }, 405 Arguments: &i18n.Message{ 406 ID: "commands.AllCommands.Info.args", 407 Other: "None", 408 }, 409 Aliases: []string{"info", "inf", "in", "i"}, 410 IsSecret: false, 411 Emoji: "", 412 IsAdmin: false, 413 IsOperator: false, 414 }, 415 { 416 CommandType: ASCII, 417 Command: "ascii", 418 Example: "ascii @Soup t 10", 419 ShortDesc: &i18n.Message{ 420 ID: "commands.AllCommands.Ascii.shortDesc", 421 Other: "Print an ASCII crewmate", 422 }, 423 Description: &i18n.Message{ 424 ID: "commands.AllCommands.Ascii.desc", 425 Other: "Print an ASCII crewmate", 426 }, 427 Arguments: &i18n.Message{ 428 ID: "commands.AllCommands.Ascii.args", 429 Other: "<@discord user> <is imposter> (true|false) <x impostor remains> (count)", 430 }, 431 Aliases: []string{"ascii", "asc"}, 432 IsSecret: true, 433 IsAdmin: false, 434 IsOperator: false, 435 }, 436 { 437 CommandType: DebugState, 438 Command: "debugstate", 439 Example: "debugstate", 440 ShortDesc: &i18n.Message{ 441 ID: "commands.AllCommands.DebugState.shortDesc", 442 Other: "View the full state of the Discord Guild Data", 443 }, 444 Description: &i18n.Message{ 445 ID: "commands.AllCommands.DebugState.desc", 446 Other: "View the full state of the Discord Guild Data", 447 }, 448 Arguments: &i18n.Message{ 449 ID: "commands.AllCommands.DebugState.args", 450 Other: "None", 451 }, 452 Aliases: []string{"debug", "ds", "state"}, 453 IsSecret: true, 454 IsAdmin: false, 455 IsOperator: true, 456 }, 457 { 458 CommandType: Null, 459 Command: "", 460 Example: "", 461 ShortDesc: nil, 462 Description: nil, 463 Arguments: nil, 464 Aliases: []string{""}, 465 IsSecret: true, 466 IsAdmin: true, 467 IsOperator: true, 468 }, 469} 470