aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Ionite <[email protected]>2022-10-25 01:01:56 -0400
committerGravatar Ionite <[email protected]>2022-10-25 01:01:56 -0400
commit461c7fff23384187add4e5fa0eb37f5b0721098f (patch)
tree8b23c75f3e932510f8a3618ded24f2c2cb844f0a
parentTemporary fix for greedy parsing freezing (diff)
Made arg fix compatible with tests
-rw-r--r--bot/exts/info/information.py5
-rw-r--r--tests/bot/exts/info/test_information.py6
2 files changed, 6 insertions, 5 deletions
diff --git a/bot/exts/info/information.py b/bot/exts/info/information.py
index 088d0af6e..5aa721a01 100644
--- a/bot/exts/info/information.py
+++ b/bot/exts/info/information.py
@@ -524,7 +524,7 @@ class Information(Cog):
await self.send_raw_content(ctx, message, json=True)
@command(aliases=("rule",))
- async def rules(self, ctx: Context, arg: Optional[str]) -> Optional[Set[int]]:
+ async def rules(self, ctx: Context, args: Optional[str]) -> Optional[Set[int]]:
"""
Provides a link to all rules or, if specified, displays specific rule(s).
@@ -532,7 +532,8 @@ class Information(Cog):
Rule numbers and keywords can be sent in any order.
"""
# Temporary fix for discord.py greedy string quote conversion bug
- args = (arg or "",)
+ if not args:
+ args = ("",)
rules_embed = Embed(title="Rules", color=Colour.og_blurple(), url="https://www.pythondiscord.com/pages/rules")
keywords, rule_numbers = [], []
diff --git a/tests/bot/exts/info/test_information.py b/tests/bot/exts/info/test_information.py
index 9f5143c01..267346c58 100644
--- a/tests/bot/exts/info/test_information.py
+++ b/tests/bot/exts/info/test_information.py
@@ -614,7 +614,7 @@ class RuleCommandTests(unittest.IsolatedAsyncioTestCase):
str(rule_number) for rule_number in extracted_rule_numbers
if rule_number < 1 or rule_number > len(self.full_rules))
- final_rule_numbers = await self.cog.rules(self.cog, self.ctx, *raw_user_input)
+ final_rule_numbers = await self.cog.rules(self.cog, self.ctx, raw_user_input)
self.assertEqual(
self.ctx.send.call_args,
@@ -631,7 +631,7 @@ class RuleCommandTests(unittest.IsolatedAsyncioTestCase):
for raw_user_input, expected_matched_rule_numbers in test_cases:
with self.subTest(identifier=raw_user_input):
- final_rule_numbers = await self.cog.rules(self.cog, self.ctx, *raw_user_input)
+ final_rule_numbers = await self.cog.rules(self.cog, self.ctx, raw_user_input)
self.assertEqual(expected_matched_rule_numbers, final_rule_numbers)
async def test_return_default_rules_when_no_input_or_no_match_are_found(self):
@@ -643,7 +643,7 @@ class RuleCommandTests(unittest.IsolatedAsyncioTestCase):
for raw_user_input, expected_matched_rule_numbers in test_cases:
with self.subTest(identifier=raw_user_input):
- final_rule_numbers = await self.cog.rules(self.cog, self.ctx, *raw_user_input)
+ final_rule_numbers = await self.cog.rules(self.cog, self.ctx, raw_user_input)
embed = self.ctx.send.call_args.kwargs['embed']
self.assertEqual(information.DEFAULT_RULES_DESCRIPTION, embed.description)
self.assertEqual(expected_matched_rule_numbers, final_rule_numbers)