commit
Accept -g anywhere in d!autoproxy
Co-Authored-By: Sandrone <[email protected]>
diff --git a/src/commands/autoproxy.ts b/src/commands/autoproxy.ts
index fe9e26d..f5b6f35 100644
--- a/src/commands/autoproxy.ts
+++ b/src/commands/autoproxy.ts
@@ -13,13 +13,14 @@ export async function autoproxyCommand(
message: Message,
args: string[],
): Promise<void> {
- if (args[0] === "-g") {
- await globalAutoproxy(message, args[1]);
+ // -g can go anywhere, so "-g on" and "on -g" both work
+ const [choice] = args.filter((arg) => arg !== "-g");
+
+ if (args.includes("-g")) {
+ await globalAutoproxy(message, choice);
return;
}
- const [choice] = args;
-
// Commands only run from server messages, so guildId is always set
const autoproxy = guildSettings(message.guildId!).autoproxy;
const current = autoproxy.enabled ? "on" : "off";