diff --git a/.gitignore b/.gitignore index 3e8ecb4..a56dfdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ .idea/ -.venv/ \ No newline at end of file +.venv/ +build/ +dist/ +__pycache__/ +*.spec \ No newline at end of file diff --git a/client.py b/client.py index 0ed35ae..4c284a8 100644 --- a/client.py +++ b/client.py @@ -36,18 +36,25 @@ class Client(commands.CommandsClient): return if x > y: - message = randrange(y, x + 1) - await ctx.send(f"**{str(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"**{str(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): """Shows current timestamp""" - message = trunc(time()) - await ctx.send(str(message)) + timestamp = trunc(time()) + table = str() + styles = ['d', 'D', 't', 'T', 'f', 'F', 'R'] + for style in styles: + table = table + f"\n| `` | |" + await ctx.send(f"## {timestamp}\n" + f"| Chat syntax | Result |\n" + f"| --- | --- |" + + table) @commands.command() async def self(self, ctx: commands.Context): @@ -99,7 +106,6 @@ class Client(commands.CommandsClient): if server.banner is not None: banner = extensions.icon_info(server.banner) - state = server.state # used for statistics await ctx.send(f"## {server.name}\n" f"{description}\n" f"| ID | `{server.id}` |\n| --- | --- |\n" @@ -108,7 +114,7 @@ class Client(commands.CommandsClient): f"| Server banner | {banner} |\n" f"| Server owner | {server.owner.original_name}#{server.owner.discriminator} |\n" f"---\n| Statistics | Value |\n| --- | --- |\n" - f"| Members | {len(state.users)} |\n" - f"| Channels | {len(state.channels)} |\n" + f"| Members | {len(server.members)} |\n" + f"| Channels | {len(server.channels)} |\n" f"| Roles | {len(server.roles)} |\n" f"| Emojis | {len(server.emojis)} |") 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}|") diff --git a/main.py b/main.py index 1a480c1..5a71573 100644 --- a/main.py +++ b/main.py @@ -4,6 +4,7 @@ import client import asyncio from next.ext.commands import DefaultHelpCommand +from sys import exit async def main():