using new gitlab webhook
This commit is contained in:
parent
54bee59aa8
commit
155ff9244e
1 changed files with 26 additions and 23 deletions
|
@ -51,37 +51,40 @@ class ConfrerieDuKassoulait(commands.Cog):
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_message_delete(self, message):
|
async def on_message_delete(self, message):
|
||||||
if message.author.guild.id == 441208120644075520: # Confrérie du Kassoulait
|
try:
|
||||||
prefix = await self.client.get_prefix(message)
|
if message.author.guild.id == 441208120644075520: # Confrérie du Kassoulait
|
||||||
if not (
|
prefix = await self.client.get_prefix(message)
|
||||||
message.content.startswith(f"{prefix}note") or
|
if not (
|
||||||
message.content.startswith(f"{prefix}memo") or
|
message.content.startswith(f"{prefix}note") or
|
||||||
len(findall(".com/channels/", message.content)) != 0 or
|
message.content.startswith(f"{prefix}memo") or
|
||||||
self.client.user.id is message.author.id
|
len(findall(".com/channels/", message.content)) != 0 or
|
||||||
):
|
self.client.user.id is message.author.id
|
||||||
user_suppressed = None
|
):
|
||||||
|
user_suppressed = None
|
||||||
|
|
||||||
async for entry in message.guild.audit_logs(limit=1):
|
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':
|
if (intToDatetime(nowCustom()) - entry.created_at).seconds < 5 and str(entry.action) == 'AuditLogAction.message_delete':
|
||||||
user_suppressed = entry.user
|
user_suppressed = entry.user
|
||||||
|
|
||||||
channel = self.client.get_channel(742588187456831659)
|
channel = self.client.get_channel(742588187456831659)
|
||||||
embed = discord.Embed(description = f"{message.content}")
|
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:
|
if not user_suppressed:
|
||||||
embed.set_footer(text = f"Channel: #{message.channel.name} | Date : {timestampScreen(message.created_at)}\nSupprimé le {timestampScreen(intToDatetime(nowUTC()))}")
|
embed.set_footer(text = f"Channel: #{message.channel.name} | Date : {timestampScreen(message.created_at)}\nSupprimé le {timestampScreen(intToDatetime(nowUTC()))}")
|
||||||
else:
|
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()))}")
|
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)
|
await channel.send(embed = embed)
|
||||||
# ne fonctionne pas quand un message a été supprimé avant que le bot ai démarré
|
# 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)
|
# 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()
|
@commands.Cog.listener()
|
||||||
async def on_message(self, message):
|
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()
|
await message.publish()
|
||||||
|
|
||||||
# autre serveur
|
# autre serveur
|
||||||
|
|
Reference in a new issue