dev #43
@ -15,7 +15,8 @@ from modules import custom_filters
|
|||||||
from modules.database import col_applications, col_sponsorships, col_warnings
|
from modules.database import col_applications, col_sponsorships, col_warnings
|
||||||
from modules.logging import logWrite
|
from modules.logging import logWrite
|
||||||
from modules.utils import locale, should_quote
|
from modules.utils import locale, should_quote
|
||||||
from modules.event import col_event
|
|
||||||
|
# from modules.event import col_event
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(
|
@app.on_message(
|
||||||
@ -34,7 +35,13 @@ async def cmd_export(app: Client, msg: Message):
|
|||||||
|
|
||||||
selection = msg.command[1].lower()
|
selection = msg.command[1].lower()
|
||||||
|
|
||||||
if selection not in ["applications", "warnings", "sponsorships", "bans", "event"]:
|
if selection not in [
|
||||||
|
"applications",
|
||||||
|
"warnings",
|
||||||
|
"sponsorships",
|
||||||
|
"bans",
|
||||||
|
# "event",
|
||||||
|
]:
|
||||||
await msg.reply_text(
|
await msg.reply_text(
|
||||||
locale("syntax_export", "message", locale=msg.from_user),
|
locale("syntax_export", "message", locale=msg.from_user),
|
||||||
quote=should_quote(msg),
|
quote=should_quote(msg),
|
||||||
@ -146,14 +153,14 @@ async def cmd_export(app: Client, msg: Message):
|
|||||||
output_json.append(entry)
|
output_json.append(entry)
|
||||||
output_csv.append(entry)
|
output_csv.append(entry)
|
||||||
|
|
||||||
elif selection == "event":
|
# elif selection == "event":
|
||||||
header_csv = ["user", "stage", "date"]
|
# header_csv = ["user", "stage", "date"]
|
||||||
|
|
||||||
for entry in list(col_event.find()):
|
# for entry in list(col_event.find()):
|
||||||
del entry["_id"]
|
# del entry["_id"]
|
||||||
entry["date"] = entry["date"].isoformat()
|
# entry["date"] = entry["date"].isoformat()
|
||||||
output_json.append(entry)
|
# output_json.append(entry)
|
||||||
output_csv.append(entry)
|
# output_csv.append(entry)
|
||||||
|
|
||||||
# Saving CSV
|
# Saving CSV
|
||||||
async with aiofiles.open(temp_file + ".csv", mode="w", encoding="utf-8") as file:
|
async with aiofiles.open(temp_file + ".csv", mode="w", encoding="utf-8") as file:
|
||||||
|
Reference in New Issue
Block a user