Spaces:
Sleeping
Sleeping
Rifat Azad commited on
Commit ·
d2289a7
1
Parent(s): 8db37a5
version command
Browse files- pydvpl_bot.py +24 -3
pydvpl_bot.py
CHANGED
|
@@ -6,6 +6,7 @@ import discord
|
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
from discord.ext import commands, tasks
|
| 8 |
from pydvpl.dvpl import compress_dvpl, decompress_dvpl
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
# ENV_LOADER ------------------------------------------------------ START
|
|
@@ -20,6 +21,8 @@ load_dotenv()
|
|
| 20 |
# DEFINES ------------------------------------------------------ START
|
| 21 |
|
| 22 |
|
|
|
|
|
|
|
| 23 |
AUTHORIZED_USER_ID = os.getenv('AUTHORIZED_ID')
|
| 24 |
|
| 25 |
TOKEN = os.getenv('DISCORD_TOKEN')
|
|
@@ -63,7 +66,7 @@ def ensure_folders():
|
|
| 63 |
|
| 64 |
async def list_feedback(ctx, folder_path, title):
|
| 65 |
files = os.listdir(folder_path)
|
| 66 |
-
feedback_embed = discord.Embed(title=title, color=discord.Color.
|
| 67 |
for file in files:
|
| 68 |
file_path = os.path.join(folder_path, file)
|
| 69 |
with open(file_path, "r") as f:
|
|
@@ -262,7 +265,7 @@ bot.remove_command("help")
|
|
| 262 |
|
| 263 |
@bot.hybrid_command(help="Displays the list of available commands.")
|
| 264 |
async def help(ctx):
|
| 265 |
-
embed = discord.Embed(title="Command List", description="Here's a list of available commands:", color=discord.Color.
|
| 266 |
|
| 267 |
# Add commands to the embed with descriptions
|
| 268 |
embed.add_field(name="Dvpl Commands:", value="`compress` - Compresses files.\n`decompress` - Decompresses files.", inline=False)
|
|
@@ -443,7 +446,25 @@ async def uptime(ctx):
|
|
| 443 |
bot_mention = ctx.me.mention
|
| 444 |
uptime_message = f"{bot_mention} has been playing for - {hours} hours, {minutes} minutes, {seconds} seconds."
|
| 445 |
await ctx.send(uptime_message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
|
|
|
|
|
|
|
| 447 |
|
| 448 |
|
| 449 |
# UTILITY USER_CMD ------------------------------------------------------ END
|
|
@@ -630,7 +651,7 @@ async def announce(ctx, *, message):
|
|
| 630 |
|
| 631 |
return
|
| 632 |
|
| 633 |
-
embed = discord.Embed(title="Announcement", description=message, color=discord.Color.
|
| 634 |
|
| 635 |
for server in bot.guilds:
|
| 636 |
# First, check for an "important-announcements" channel
|
|
|
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
from discord.ext import commands, tasks
|
| 8 |
from pydvpl.dvpl import compress_dvpl, decompress_dvpl
|
| 9 |
+
import pydvpl.version
|
| 10 |
|
| 11 |
|
| 12 |
# ENV_LOADER ------------------------------------------------------ START
|
|
|
|
| 21 |
# DEFINES ------------------------------------------------------ START
|
| 22 |
|
| 23 |
|
| 24 |
+
BOT_VERSION = '1.1.0'
|
| 25 |
+
|
| 26 |
AUTHORIZED_USER_ID = os.getenv('AUTHORIZED_ID')
|
| 27 |
|
| 28 |
TOKEN = os.getenv('DISCORD_TOKEN')
|
|
|
|
| 66 |
|
| 67 |
async def list_feedback(ctx, folder_path, title):
|
| 68 |
files = os.listdir(folder_path)
|
| 69 |
+
feedback_embed = discord.Embed(title=title, color=discord.Color.yellow())
|
| 70 |
for file in files:
|
| 71 |
file_path = os.path.join(folder_path, file)
|
| 72 |
with open(file_path, "r") as f:
|
|
|
|
| 265 |
|
| 266 |
@bot.hybrid_command(help="Displays the list of available commands.")
|
| 267 |
async def help(ctx):
|
| 268 |
+
embed = discord.Embed(title="Command List", description="Here's a list of available commands:", color=discord.Color.yellow())
|
| 269 |
|
| 270 |
# Add commands to the embed with descriptions
|
| 271 |
embed.add_field(name="Dvpl Commands:", value="`compress` - Compresses files.\n`decompress` - Decompresses files.", inline=False)
|
|
|
|
| 446 |
bot_mention = ctx.me.mention
|
| 447 |
uptime_message = f"{bot_mention} has been playing for - {hours} hours, {minutes} minutes, {seconds} seconds."
|
| 448 |
await ctx.send(uptime_message)
|
| 449 |
+
|
| 450 |
+
|
| 451 |
+
# FUNCTION ------------------------------------------------------ SPLIT
|
| 452 |
+
|
| 453 |
+
@bot.hybrid_command(help="Shows the bot's version number.")
|
| 454 |
+
async def version(ctx):
|
| 455 |
+
# Create an embed message to display the bot version
|
| 456 |
+
embed = discord.Embed(
|
| 457 |
+
title="Version Info",
|
| 458 |
+
description=f"The current version of libraries.",
|
| 459 |
+
color=discord.Color.yellow()
|
| 460 |
+
)
|
| 461 |
+
|
| 462 |
+
embed.add_field(name="PyDVPL Bot Version:", value=f"``{BOT_VERSION}``", inline=False)
|
| 463 |
+
embed.add_field(name="PyDVPL Lib Version:", value=f"``{pydvpl.version.__version__}``", inline=False)
|
| 464 |
+
embed.add_field(name="Discord.PY Version:", value=f"``{discord.__version__}``", inline=False)
|
| 465 |
|
| 466 |
+
# Send the embed message
|
| 467 |
+
await ctx.send(embed=embed)
|
| 468 |
|
| 469 |
|
| 470 |
# UTILITY USER_CMD ------------------------------------------------------ END
|
|
|
|
| 651 |
|
| 652 |
return
|
| 653 |
|
| 654 |
+
embed = discord.Embed(title="Announcement", description=message, color=discord.Color.yellow())
|
| 655 |
|
| 656 |
for server in bot.guilds:
|
| 657 |
# First, check for an "important-announcements" channel
|