Fix: récupération des issues_gitlab après incident

This commit is contained in:
Mathis 2026-06-04 08:40:14 +02:00
parent ed6e25c219
commit b6d2995916
8 changed files with 682 additions and 308 deletions

View file

@ -18,6 +18,15 @@ def get_log_channel(guild, settings):
return guild.get_channel(int(channel_id))
return None
def load_settings():
if not os.path.exists(SETTINGS_FILE):
return {}
try:
with open(SETTINGS_FILE, "r", encoding="utf-8") as f:
return json.load(f)
except Exception:
return {}
class LogsManager(commands.Cog):
def __init__(self, bot):
self.bot = bot
@ -25,7 +34,7 @@ class LogsManager(commands.Cog):
@commands.Cog.listener()
async def on_message_delete(self, message):
if message.author.bot: return
settings = dict(json.load(open(SETTINGS_FILE, "r"))).get(str(message.guild.id), {})
settings = dict(load_settings()).get(str(message.guild.id), {})
log_chan = get_log_channel(message.guild, settings)
if log_chan:
@ -40,7 +49,7 @@ class LogsManager(commands.Cog):
@commands.Cog.listener()
async def on_member_remove(self, member):
settings = dict(json.load(open(SETTINGS_FILE, "r"))).get(str(member.guild.id), {})
settings = dict(load_settings()).get(str(member.guild.id), {})
log_chan = get_log_channel(member.guild, settings)
if log_chan:
embed = disnake.Embed(
@ -53,7 +62,7 @@ class LogsManager(commands.Cog):
@commands.Cog.listener()
async def on_member_ban(self, guild, user):
settings = dict(json.load(open(SETTINGS_FILE, "r"))).get(str(guild.id), {})
settings = dict(load_settings()).get(str(guild.id), {})
log_chan = get_log_channel(guild, settings)
if log_chan:
embed = disnake.Embed(