aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/exts/fun/devops_rules.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2023-01-01 17:17:21 +0000
committerGravatar Chris Lovering <[email protected]>2023-01-01 17:21:02 +0000
commit6b0785e4e2030ac2f43cfe5d00f84fba87a921d8 (patch)
tree151afb0468a1732dfed7a84bf1301098fd9320b9 /arthur/exts/fun/devops_rules.py
parentMerge pull request #30 from Xithrius/patch-1 (diff)
Add command to refresh devops rules
Diffstat (limited to 'arthur/exts/fun/devops_rules.py')
-rw-r--r--arthur/exts/fun/devops_rules.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/arthur/exts/fun/devops_rules.py b/arthur/exts/fun/devops_rules.py
index 9c231d8..24c41f2 100644
--- a/arthur/exts/fun/devops_rules.py
+++ b/arthur/exts/fun/devops_rules.py
@@ -3,7 +3,7 @@
from typing import TypedDict
import discord
-from discord.ext.commands import Cog, Context, Greedy, command
+from discord.ext.commands import Cog, Context, Greedy, group
from arthur.bot import KingArthur, logger
from arthur.config import CONFIG
@@ -72,8 +72,8 @@ class Rules(Cog):
if block.get("type") == "numbered_list_item"
}
- @command(name="rules", aliases=("rule",))
- async def get_rules(self, ctx: Context, rules: Greedy[int]) -> None:
+ @group(name="rules", aliases=("rule",))
+ async def rules_group(self, ctx: Context, rules: Greedy[int]) -> None:
"""List the requested rule(s), or all of them if not defined."""
if rules:
output_rules = set(rules) & set(self.rules.keys())
@@ -96,6 +96,11 @@ class Rules(Cog):
url="https://www.notion.so/pythondiscord/Rules-149bc48f6f7947afadd8036f11d4e9a7",
))
+ @rules_group.command(name="refresh", aliases=("fetch", "update"))
+ async def update_rules(self, ctx: Context) -> None:
+ """Re-fetch the list of rules from notion."""
+ await self.cog_load()
+
async def setup(bot: KingArthur) -> None:
"""Add cog to bot."""