From befd494de2f5a6192a45f31ccdf806b0d48fd1f7 Mon Sep 17 00:00:00 2001 From: mctaylors Date: Thu, 7 Nov 2024 00:33:32 +0300 Subject: [PATCH] random: Show the given range as a table Signed-off-by: mctaylors --- client.py | 8 ++++---- extensions.py | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client.py b/client.py index 4bab57c..f382ee3 100644 --- a/client.py +++ b/client.py @@ -36,12 +36,12 @@ class Client(commands.CommandsClient): return if x > y: - message = randrange(y, x + 1) - await ctx.send(f"**{message}** `({y};{x})`") + result = randrange(y, x + 1) + await ctx.send(extensions.random_message(result, y, x)) return - message = randrange(x, y + 1) - await ctx.send(f"**{message}** `({x};{y})`") + result = randrange(x, y + 1) + await ctx.send(extensions.random_message(result, x, y)) @commands.command() async def timestamp(self, ctx: commands.Context): diff --git a/extensions.py b/extensions.py index d92dc5e..96c6d4a 100644 --- a/extensions.py +++ b/extensions.py @@ -1,2 +1,8 @@ def icon_info(icon): return f"[{icon.filename}](<{icon.url}>) ({icon.width}x{icon.height})" + +def random_message(result, min, max): + return (f"## {result}\n" + f"| Min | Max |\n" + f"| --- | --- |\n" + f"|{min}|{max}|")