Spaces:
Sleeping
Sleeping
Rifat Azad commited on
Commit ·
22e1201
1
Parent(s): 8db67a1
fixed update 1.4.0 list command
Browse files- pydvpl_bot.py +43 -43
pydvpl_bot.py
CHANGED
|
@@ -84,33 +84,6 @@ def ensure_folders():
|
|
| 84 |
# FUNCTION ------------------------------------------------------ SPLIT
|
| 85 |
|
| 86 |
|
| 87 |
-
async def list_feedback(ctx, folder_path, title):
|
| 88 |
-
files = os.listdir(folder_path)
|
| 89 |
-
feedback_embed = discord.Embed(title=title, color=discord.Color.yellow())
|
| 90 |
-
for file in files:
|
| 91 |
-
file_path = os.path.join(folder_path, file)
|
| 92 |
-
with open(file_path, "r") as f:
|
| 93 |
-
feedback_data = json.load(f)
|
| 94 |
-
for feedback in feedback_data:
|
| 95 |
-
author_name = feedback['author_name']
|
| 96 |
-
author_id = feedback['author_id']
|
| 97 |
-
timestamp = feedback['timestamp']
|
| 98 |
-
message = feedback['message']
|
| 99 |
-
feedback_embed.add_field(
|
| 100 |
-
name=f"Author: {author_name} (ID: {author_id})",
|
| 101 |
-
value=f"Timestamp: {timestamp}\nMessage: {message}",
|
| 102 |
-
inline=False
|
| 103 |
-
)
|
| 104 |
-
if feedback_embed.fields:
|
| 105 |
-
await ctx.reply(embed=feedback_embed)
|
| 106 |
-
else:
|
| 107 |
-
await ctx.reply("No feedback found.")
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
# FUNCTION ------------------------------------------------------ SPLIT
|
| 112 |
-
|
| 113 |
-
|
| 114 |
async def clean_directory(ctx, directory):
|
| 115 |
try:
|
| 116 |
|
|
@@ -1224,25 +1197,52 @@ async def list(ctx, list_type):
|
|
| 1224 |
await ctx.reply("You are not authorized to use this command.")
|
| 1225 |
return
|
| 1226 |
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
| 1230 |
-
|
| 1231 |
-
|
| 1232 |
-
|
| 1233 |
-
|
| 1234 |
-
|
| 1235 |
-
|
| 1236 |
-
|
| 1237 |
-
|
| 1238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1239 |
|
| 1240 |
-
# Execute based on the provided list type
|
| 1241 |
if list_type.lower() == 'servers':
|
| 1242 |
-
|
| 1243 |
-
|
| 1244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1245 |
embed.timestamp = ctx.message.created_at
|
|
|
|
|
|
|
| 1246 |
await ctx.reply(embed=embed)
|
| 1247 |
|
| 1248 |
elif list_type.lower() == 'issues':
|
|
|
|
| 84 |
# FUNCTION ------------------------------------------------------ SPLIT
|
| 85 |
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
async def clean_directory(ctx, directory):
|
| 88 |
try:
|
| 89 |
|
|
|
|
| 1197 |
await ctx.reply("You are not authorized to use this command.")
|
| 1198 |
return
|
| 1199 |
|
| 1200 |
+
async def list_feedback(ctx, folder_path, title):
|
| 1201 |
+
files = os.listdir(folder_path)
|
| 1202 |
+
feedback_embed = discord.Embed(title=title, color=discord.Color.yellow())
|
| 1203 |
+
for file in files:
|
| 1204 |
+
file_path = os.path.join(folder_path, file)
|
| 1205 |
+
with open(file_path, "r") as f:
|
| 1206 |
+
feedback_data = json.load(f)
|
| 1207 |
+
for feedback in feedback_data:
|
| 1208 |
+
author_name = feedback['author_name']
|
| 1209 |
+
author_id = feedback['author_id']
|
| 1210 |
+
timestamp = feedback['timestamp']
|
| 1211 |
+
message = feedback['message']
|
| 1212 |
+
feedback_embed.add_field(
|
| 1213 |
+
name=f"Author: {author_name} (ID: {author_id})",
|
| 1214 |
+
value=f"Timestamp: {timestamp}\nMessage: {message}",
|
| 1215 |
+
inline=False
|
| 1216 |
+
)
|
| 1217 |
+
if feedback_embed.fields:
|
| 1218 |
+
feedback_embed.set_footer(text=f"Requested by {ctx.author.display_name}", icon_url=ctx.author.display_avatar.url if ctx.author.display_avatar else discord.Embed.Empty)
|
| 1219 |
+
feedback_embed.timestamp = ctx.message.created_at
|
| 1220 |
+
await ctx.reply(embed=feedback_embed)
|
| 1221 |
+
else:
|
| 1222 |
+
await ctx.reply("No feedback found.")
|
| 1223 |
+
|
| 1224 |
|
|
|
|
| 1225 |
if list_type.lower() == 'servers':
|
| 1226 |
+
# Create a list of embed fields for each server
|
| 1227 |
+
fields = []
|
| 1228 |
+
for server in bot.guilds:
|
| 1229 |
+
joined_date = server.me.joined_at.strftime("%Y-%m-%d")
|
| 1230 |
+
field_name = server.name
|
| 1231 |
+
field_value = f"Joined ({joined_date})\nID: {server.id}"
|
| 1232 |
+
fields.append((field_name, field_value))
|
| 1233 |
+
|
| 1234 |
+
# Create an embed with the servers list
|
| 1235 |
+
embed = discord.Embed(title="Servers List", color=discord.Color.green())
|
| 1236 |
+
|
| 1237 |
+
# Add embed fields for each server
|
| 1238 |
+
for name, value in fields:
|
| 1239 |
+
embed.add_field(name=name, value=value, inline=False)
|
| 1240 |
+
|
| 1241 |
+
# Set footer with requester's display name and timestamp
|
| 1242 |
+
embed.set_footer(text=f"Requested by {ctx.author.display_name}", icon_url=ctx.author.avatar.url if ctx.author.avatar else discord.Embed.Empty)
|
| 1243 |
embed.timestamp = ctx.message.created_at
|
| 1244 |
+
|
| 1245 |
+
# Send the embed as a reply
|
| 1246 |
await ctx.reply(embed=embed)
|
| 1247 |
|
| 1248 |
elif list_type.lower() == 'issues':
|