fix(pterodactyl): don't ping users, roles, or @everyone/@here in console messages + ping only users in chat messages

This commit is contained in:
Seaswimmer 2024-03-04 19:53:12 -05:00
parent eecf1fb70f
commit 87dfc03812
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -58,7 +58,7 @@ async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
if content.startswith('['): if content.startswith('['):
pagified_content = pagify(content, delims=[" ", "\n"]) pagified_content = pagify(content, delims=[" ", "\n"])
for page in pagified_content: for page in pagified_content:
await channel.send(content=page) await channel.send(content=page, allowed_mentions=discord.AllowedMentions.none())
server_message = await check_if_server_message(content) server_message = await check_if_server_message(content)
if server_message: if server_message:
@ -230,7 +230,7 @@ async def send_chat_discord(coginstance: Pterodactyl, username: str, message: st
webhook = discord.utils.get(webhooks, name="Pterodactyl Chat") webhook = discord.utils.get(webhooks, name="Pterodactyl Chat")
if webhook is None: if webhook is None:
webhook = await channel.create_webhook(name="Pterodactyl Chat") webhook = await channel.create_webhook(name="Pterodactyl Chat")
await webhook.send(content=message, username=username, avatar_url=avatar_url, allowed_mentions=discord.AllowedMentions.none()) await webhook.send(content=message, username=username, avatar_url=avatar_url, allowed_mentions=discord.AllowedMentions(everyone=False, roles=False, users=True))
logger.debug("Chat message sent to Discord") logger.debug("Chat message sent to Discord")
else: else:
logger.debug("Chat channel not set. Skipping sending chat message to Discord") logger.debug("Chat channel not set. Skipping sending chat message to Discord")