From 9d25bf6076429930703425b68877c5183c23fbf1 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Wed, 5 Jun 2024 18:50:08 +0200 Subject: [PATCH] Add more system information commands --- arthur/exts/systems/system_information.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arthur/exts/systems/system_information.py b/arthur/exts/systems/system_information.py index 53caac9..c53237d 100644 --- a/arthur/exts/systems/system_information.py +++ b/arthur/exts/systems/system_information.py @@ -4,6 +4,7 @@ import io import random from datetime import UTC, datetime +from typing import Literal from urllib import parse import aiohttp @@ -175,6 +176,23 @@ async def face( await ctx.reply(file=File(out_bytes, filename="face.png")) + @command(name="wisdom") + async def wisdom(self, ctx: Context, by: Literal["ken", "rob", "rsc", "theo", "uriel"] | None = None) -> None: + """Retrieve some software engineering wisdom.""" + if by is None: + by = random.choice(("ken", "rob", "rsc", "theo", "uriel")) + + contents = await self.fetch_resource(f"lib/{by}") + result = random.choice(contents.splitlines()) + await ctx.reply(result) + + @command(name="troll") + async def troll(self, ctx: Context) -> None: + """Utter statements of utmost importance.""" + contents = await self.fetch_resource("lib/troll") + result = random.choice(contents.splitlines()) + await ctx.reply(result) + async def setup(bot: KingArthur) -> None: """Add cog to bot."""