|
7 | 7 | import traceback |
8 | 8 | import datetime |
9 | 9 | import uuid |
| 10 | +import platform |
| 11 | +import time |
10 | 12 |
|
11 | 13 | from disnake.ext import commands |
12 | 14 | from disnake.ui import View, Button |
|
17 | 19 | DATA_FILE = "forums.json" |
18 | 20 | client.remove_command("help") |
19 | 21 |
|
| 22 | +start_time = time.time() |
20 | 23 |
|
21 | 24 | @client.event |
22 | 25 | async def on_guild_join(guild: disnake.Guild): |
@@ -199,6 +202,52 @@ async def about(interaction: disnake.CommandInteraction): |
199 | 202 | await interaction.response.send_message(embed=embed, ephemeral=True) |
200 | 203 |
|
201 | 204 |
|
| 205 | +@client.slash_command(name="info", description="Информация о боте") |
| 206 | +async def info(interaction: disnake.CommandInteraction): |
| 207 | + uptime_seconds = int(time.time() - start_time) |
| 208 | + hours, remainder = divmod(uptime_seconds, 3600) |
| 209 | + minutes, seconds = divmod(remainder, 60) |
| 210 | + |
| 211 | + ping = round(client.latency * 1000) |
| 212 | + guild_count = len(client.guilds) |
| 213 | + user_count = len(set(member.id for guild in client.guilds for member in guild.members)) |
| 214 | + disnake_version = disnake.__version__ |
| 215 | + python_version = platform.python_version() |
| 216 | + os_info = f"{platform.system()} {platform.release()} ({platform.machine()})" |
| 217 | + |
| 218 | + embed_color = ( |
| 219 | + disnake.Color.green() if ping < 100 else |
| 220 | + disnake.Color.yellow() if ping < 250 else |
| 221 | + disnake.Color.red() |
| 222 | + ) |
| 223 | + |
| 224 | + embed = disnake.Embed( |
| 225 | + title="Информация о боте", |
| 226 | + color=embed_color, |
| 227 | + timestamp=disnake.utils.utcnow() |
| 228 | + ) |
| 229 | + |
| 230 | + embed.add_field(name="📡 Пинг", value=f"`{ping} ms`", inline=True) |
| 231 | + embed.add_field(name="⏳ Аптайм", value=f"`{hours}h {minutes}m {seconds}s`", inline=True) |
| 232 | + embed.add_field(name="", value="", inline=False) |
| 233 | + embed.add_field(name="🛠️ Серверов", value=f"`{guild_count}`", inline=True) |
| 234 | + embed.add_field(name="👥 Пользователей", value=f"`{user_count}`", inline=True) |
| 235 | + embed.add_field(name="", value="", inline=False) |
| 236 | + embed.add_field(name="📦 Disnake", value=f"`v{disnake_version}`", inline=True) |
| 237 | + embed.add_field(name="🐍 Python", value=f"`v{python_version}`", inline=True) |
| 238 | + embed.add_field(name="", value="", inline=False) |
| 239 | + embed.add_field(name="💻 ОС", value=f"`{os_info}`", inline=False) |
| 240 | + |
| 241 | + |
| 242 | + embed.set_footer( |
| 243 | + text=f"Made with ❤️ by PrivateKey2", icon_url=client.user.display_avatar.url |
| 244 | + ) |
| 245 | + |
| 246 | + await interaction.response.send_message(embed=embed, ephemeral=True) |
| 247 | + |
| 248 | + |
| 249 | + |
| 250 | + |
202 | 251 | @forum.sub_command(name="add", description="Создать новый форум") |
203 | 252 | async def forum_add( |
204 | 253 | interaction: disnake.CommandInteraction, |
|
0 commit comments