1
0
Fork 0
mirror of https://git.mctaylors.ru/mctaylors/Lurker.git synced 2024-11-25 06:28:02 +03:00

Compare commits

...

5 commits

Author SHA1 Message Date
b5b801f07f
timestamp: Add list[str] for timestamp styles
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-11-07 00:43:07 +03:00
befd494de2
random: Show the given range as a table
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-11-07 00:33:32 +03:00
4211f72b9d
timestamp: Add chat syntax table
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-11-06 23:36:24 +03:00
92797df873
timestamp: Send formatted timestamp
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-11-06 23:26:04 +03:00
4b7b7bc062
server: Fix stats by using ctx.author.server
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-11-06 23:12:29 +03:00
4 changed files with 27 additions and 10 deletions

6
.gitignore vendored
View file

@ -1,2 +1,6 @@
.idea/ .idea/
.venv/ .venv/
build/
dist/
__pycache__/
*.spec

View file

@ -36,18 +36,25 @@ class Client(commands.CommandsClient):
return return
if x > y: if x > y:
message = randrange(y, x + 1) result = randrange(y, x + 1)
await ctx.send(f"**{str(message)}** `({y};{x})`") await ctx.send(extensions.random_message(result, y, x))
return return
message = randrange(x, y + 1) result = randrange(x, y + 1)
await ctx.send(f"**{str(message)}** `({x};{y})`") await ctx.send(extensions.random_message(result, x, y))
@commands.command() @commands.command()
async def timestamp(self, ctx: commands.Context): async def timestamp(self, ctx: commands.Context):
"""Shows current timestamp""" """Shows current timestamp"""
message = trunc(time()) timestamp = trunc(time())
await ctx.send(str(message)) table = str()
styles = ['d', 'D', 't', 'T', 'f', 'F', 'R']
for style in styles:
table = table + f"\n| `<t:{timestamp}:{style}>` | <t:{timestamp}:{style}> |"
await ctx.send(f"## {timestamp}\n"
f"| Chat syntax | Result |\n"
f"| --- | --- |"
+ table)
@commands.command() @commands.command()
async def self(self, ctx: commands.Context): async def self(self, ctx: commands.Context):
@ -99,7 +106,6 @@ class Client(commands.CommandsClient):
if server.banner is not None: if server.banner is not None:
banner = extensions.icon_info(server.banner) banner = extensions.icon_info(server.banner)
state = server.state # used for statistics
await ctx.send(f"## {server.name}\n" await ctx.send(f"## {server.name}\n"
f"{description}\n" f"{description}\n"
f"| ID | `{server.id}` |\n| --- | --- |\n" f"| ID | `{server.id}` |\n| --- | --- |\n"
@ -108,7 +114,7 @@ class Client(commands.CommandsClient):
f"| Server banner | {banner} |\n" f"| Server banner | {banner} |\n"
f"| Server owner | {server.owner.original_name}#{server.owner.discriminator} |\n" f"| Server owner | {server.owner.original_name}#{server.owner.discriminator} |\n"
f"---\n| Statistics | Value |\n| --- | --- |\n" f"---\n| Statistics | Value |\n| --- | --- |\n"
f"| Members | {len(state.users)} |\n" f"| Members | {len(server.members)} |\n"
f"| Channels | {len(state.channels)} |\n" f"| Channels | {len(server.channels)} |\n"
f"| Roles | {len(server.roles)} |\n" f"| Roles | {len(server.roles)} |\n"
f"| Emojis | {len(server.emojis)} |") f"| Emojis | {len(server.emojis)} |")

View file

@ -1,2 +1,8 @@
def icon_info(icon): def icon_info(icon):
return f"[{icon.filename}](<{icon.url}>) ({icon.width}x{icon.height})" 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}|")

View file

@ -4,6 +4,7 @@ import client
import asyncio import asyncio
from next.ext.commands import DefaultHelpCommand from next.ext.commands import DefaultHelpCommand
from sys import exit
async def main(): async def main():