diff --git a/src/bga_account.py b/src/bga_account.py index eb8efd4..e1b3d30 100644 --- a/src/bga_account.py +++ b/src/bga_account.py @@ -208,7 +208,13 @@ async def parse_options(self, options, table_id): # options will overwrite defaults if they are there defaults.update(options) updated_options = defaults + + if "open" not in updated_options \ + and "restrictgroup" in updated_options: + updated_options["open"] = "true" + url_data = [] + final_url_data = [] for option in updated_options: value = updated_options[option] option_data = {} @@ -275,6 +281,14 @@ async def parse_options(self, options, table_id): elif option == "lang": option_data["path"] = "/table/table/restrictToLanguage.html" option_data["params"] = {"lang": updated_options[option]} + elif option == "open": + if updated_options["open"].lower() in {"1", "on", "true", "y", "yes"}: + option_data["path"] = "/table/table/openTableNow.html" + option_data["params"] = {} + elif updated_options["open"].lower() in {"0", "off", "false", "n", "no"}: + continue + else: + return f"Option `open` should have value `true` or `false`." elif option.isdigit(): # If this is an HTML option, set it as such option_data["path"] = "/table/table/changeoption.html" @@ -283,6 +297,7 @@ async def parse_options(self, options, table_id): return f"Option {option} not a valid option." url_data.append(option_data) + url_data.extend(final_url_data) return url_data async def get_group_id(self, group_name): diff --git a/src/docs/bga_options_msg.md b/src/docs/bga_options_msg.md index 0eb302f..3d556ad 100644 --- a/src/docs/bga_options_msg.md +++ b/src/docs/bga_options_msg.md @@ -65,4 +65,6 @@ The default is marked with a * **lang**: ISO639-1 language code like en, es, fr, de. To find yours: en.wikipedia.org/wiki/List_of_ISO_639-1_codes Default language is none +**open**: If `true`, the table will be immediately opened for joining. Defaults to `true` if and only if `restrictgroup` is set. + _You can also specify options/values like 200:12 if you know what they are by looking at the HTML._