diff --git a/cogs/task.py b/cogs/task.py index 8b9ca0d..379ee20 100644 --- a/cogs/task.py +++ b/cogs/task.py @@ -113,15 +113,5 @@ class Task(commands.Cog): func.SETTINGS_BUFFER.clear() func.USERS_BUFFER.clear() - errorFile = func.gen_report() - if errorFile: - report_channel = self.bot.get_channel(func.report_channel_id) - if report_channel: - try: - await report_channel.send(content=f"Report Before: ", file=errorFile) - except Exception as e: - func.logger.error(f"Report could not be sent!", exc_info=e) - func.ERROR_LOGS.clear() - async def setup(bot: commands.Bot): await bot.add_cog(Task(bot)) diff --git a/function.py b/function.py index c9dbdf7..1071603 100644 --- a/function.py +++ b/function.py @@ -1,9 +1,7 @@ import discord, json, os, copy, logging from discord.ext import commands -from datetime import datetime from time import strptime -from io import BytesIO from typing import Optional, Union, Dict, Any from addons import Settings, TOKENS @@ -26,7 +24,6 @@ MONGO_DB: AsyncIOMotorClient SETTINGS_DB: AsyncIOMotorCollection USERS_DB: AsyncIOMotorCollection -ERROR_LOGS: dict[int, dict[int, str]] = {} #Stores error that not a Voicelink Exception LANGS: dict[str, dict[str, str]] = {} #Stores all the languages in ./langs LOCAL_LANGS: dict[str, dict[str, str]] = {} #Stores all the localization languages in ./local_langs SETTINGS_BUFFER: dict[int, dict[str, Any]] = {} #Cache guild language @@ -103,21 +100,6 @@ def get_source(source: str, type: str) -> str: source_settings: dict = settings.sources_settings.get(source.lower(), {}) return source_settings.get(type, ("🔗" if type == "emoji" else settings.embed_color)) -def gen_report() -> Optional[discord.File]: - if ERROR_LOGS: - errorText = "" - for guild_id, error in ERROR_LOGS.items(): - errorText += f"Guild ID: {guild_id}\n" + "-" * 30 + "\n" - for index, (key, value) in enumerate(error.items() , start=1): - errorText += f"Error No: {index}, Time: {datetime.fromtimestamp(key)}\n" + value + "-" * 30 + "\n\n" - - buffer = BytesIO(errorText.encode('utf-8')) - file = discord.File(buffer, filename='report.txt') - buffer.close() - - return file - return None - def cooldown_check(ctx: commands.Context) -> Optional[commands.Cooldown]: if ctx.author.id in settings.bot_access_user: return None diff --git a/views/debug.py b/views/debug.py index 0f9b14a..b7120b8 100644 --- a/views/debug.py +++ b/views/debug.py @@ -179,11 +179,4 @@ class DebugView(discord.ui.View): @discord.ui.button(label='Cogs', emoji="🔃") async def reload_cog(self, interaction: discord.Interaction, button: discord.ui.Button): - return await interaction.response.send_message("Reload Cogs", view=CogsView(self.bot), ephemeral=True) - - @discord.ui.button(label='Send Logs', emoji="📥", style=discord.ButtonStyle.red) - async def send_error_logs(self, interaction: discord.Interaction, button: discord.ui.Button): - if not function.ERROR_LOGS: - return await interaction.response.send_message("Sorry there are not error logs!", ephemeral=True) - - await interaction.response.send_message(file=function.gen_report(), ephemeral=True) \ No newline at end of file + return await interaction.response.send_message("Reload Cogs", view=CogsView(self.bot), ephemeral=True) \ No newline at end of file