using new gitlab webhook

This commit is contained in:
Mylloon 2021-07-28 03:24:53 +02:00
parent 54bee59aa8
commit 155ff9244e

View file

@ -51,37 +51,40 @@ class ConfrerieDuKassoulait(commands.Cog):
@commands.Cog.listener()
async def on_message_delete(self, message):
if message.author.guild.id == 441208120644075520: # Confrérie du Kassoulait
prefix = await self.client.get_prefix(message)
if not (
message.content.startswith(f"{prefix}note") or
message.content.startswith(f"{prefix}memo") or
len(findall(".com/channels/", message.content)) != 0 or
self.client.user.id is message.author.id
):
user_suppressed = None
try:
if message.author.guild.id == 441208120644075520: # Confrérie du Kassoulait
prefix = await self.client.get_prefix(message)
if not (
message.content.startswith(f"{prefix}note") or
message.content.startswith(f"{prefix}memo") or
len(findall(".com/channels/", message.content)) != 0 or
self.client.user.id is message.author.id
):
user_suppressed = None
async for entry in message.guild.audit_logs(limit=1):
if (intToDatetime(nowCustom()) - entry.created_at).seconds < 5 and str(entry.action) == 'AuditLogAction.message_delete':
user_suppressed = entry.user
async for entry in message.guild.audit_logs(limit=1):
if (intToDatetime(nowCustom()) - entry.created_at).seconds < 5 and str(entry.action) == 'AuditLogAction.message_delete':
user_suppressed = entry.user
channel = self.client.get_channel(742588187456831659)
embed = discord.Embed(description = f"{message.content}")
channel = self.client.get_channel(742588187456831659)
embed = discord.Embed(description = f"{message.content}")
embed.set_author(name = userOrNick(message.author), icon_url = message.author.avatar_url)
embed.set_author(name = userOrNick(message.author), icon_url = message.author.avatar_url)
if not user_suppressed:
embed.set_footer(text = f"Channel: #{message.channel.name} | Date : {timestampScreen(message.created_at)}\nSupprimé le {timestampScreen(intToDatetime(nowUTC()))}")
else:
embed.set_footer(icon_url = user_suppressed.avatar_url, text = f"Channel: #{message.channel.name} | Date : {timestampScreen(message.created_at)}\nSupprimé par {userOrNick(user_suppressed)} le {timestampScreen(intToDatetime(nowUTC()))}")
if not user_suppressed:
embed.set_footer(text = f"Channel: #{message.channel.name} | Date : {timestampScreen(message.created_at)}\nSupprimé le {timestampScreen(intToDatetime(nowUTC()))}")
else:
embed.set_footer(icon_url = user_suppressed.avatar_url, text = f"Channel: #{message.channel.name} | Date : {timestampScreen(message.created_at)}\nSupprimé par {userOrNick(user_suppressed)} le {timestampScreen(intToDatetime(nowUTC()))}")
await channel.send(embed = embed)
# ne fonctionne pas quand un message a été supprimé avant que le bot ai démarré
# info sur la personne qui a supprimé ne fonctionne pas si il a supprimé un message auparavant (les logs se rajoute a un log deja existant)
await channel.send(embed = embed)
# ne fonctionne pas quand un message a été supprimé avant que le bot ai démarré
# info sur la personne qui a supprimé ne fonctionne pas si il a supprimé un message auparavant (les logs se rajoute a un log deja existant)
except: # ignore error when deleting webhook message
pass
@commands.Cog.listener()
async def on_message(self, message):
if message.author.id == 786897204816117771 and message.author.name == "GitHub" and message.author.bot: # Autopublish
if message.author.id == 869726667294248970 and message.author.bot: # Autopublish
await message.publish()
# autre serveur