fix(pterodactyl): don't accept messages from bots

This commit is contained in:
Seaswimmer 2024-02-29 18:53:17 -05:00
parent d00b70758a
commit 4174bc4be7
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -161,11 +161,11 @@ class Pterodactyl(commands.Cog):
@commands.Cog.listener() @commands.Cog.listener()
async def on_message(self, message: discord.Message): async def on_message(self, message: discord.Message):
if message.channel.id == await self.config.console_channel() and message.author.id != self.bot.user.id: if message.channel.id == await self.config.console_channel() and not message.author.bot:
self.logger.debug("Received console command from %s: %s", message.author.id, message.content) self.logger.debug("Received console command from %s: %s", message.author.id, message.content)
await message.channel.send(f"Received console command from {message.author.id}: {message.content[:1900]}") await message.channel.send(f"Received console command from {message.author.id}: {message.content[:1900]}")
await self.websocket.send(json.dumps({"event": "send command", "args": [message.content]})) await self.websocket.send(json.dumps({"event": "send command", "args": [message.content]}))
if message.channel.id == await self.config.chat_channel() and message.author.id != self.bot.user.id: if message.channel.id == await self.config.chat_channel() and not message.author.bot:
self.logger.debug("Received chat message from %s: %s", message.author.id, message.content) self.logger.debug("Received chat message from %s: %s", message.author.id, message.content)
channel = self.bot.get_channel(await self.config.console_channel()) channel = self.bot.get_channel(await self.config.console_channel())
if channel: if channel: