fix(moderation): export temp writes to a directory it actually has access to
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 55s

This commit is contained in:
Seaswimmer 2023-12-13 15:38:40 -05:00
parent 6681a7d938
commit 5740ba851f
Signed by: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -9,7 +9,7 @@ import humanize
import mysql.connector import mysql.connector
from discord.ext import tasks from discord.ext import tasks
from pytimeparse2 import disable_dateutil, parse from pytimeparse2 import disable_dateutil, parse
from redbot.core import app_commands, checks, Config, commands from redbot.core import app_commands, checks, Config, commands, data_manager
from redbot.core.app_commands import Choice from redbot.core.app_commands import Choice
@ -747,7 +747,7 @@ class Moderation(commands.Cog):
result_dict_list.append(case_dict) result_dict_list.append(case_dict)
if export: if export:
try: try:
filename = f"moderation_{interaction.guild.id}.json" filename = data_manager.cog_data_path(cog_instance=self) + f"moderation_{interaction.guild.id}.json"
with open(filename, "w") as f: with open(filename, "w") as f:
json.dump(result_dict_list, f) json.dump(result_dict_list, f)
await interaction.followup.send(file=discord.File(f"moderation_{interaction.guild.id}.json"), ephemeral=ephemeral) await interaction.followup.send(file=discord.File(f"moderation_{interaction.guild.id}.json"), ephemeral=ephemeral)