Add Pterodactyl cog #19

Merged
cswimr merged 139 commits from pterodactyl into main 2024-03-02 00:07:42 -05:00
Showing only changes of commit 9023ea160b - Show all commits

View file

@ -159,9 +159,12 @@ 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 message.author.id != self.bot.user.id:
await message.channel.send(f"Received message from {message.author.id}: {message.content}") 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 message.author.id != self.bot.user.id:
channel = self.bot.get_channel(await self.config.console_channel())
if channel:
await channel.send(f"Received chat message from {message.author.id}: {message.content[:1900]}")
await self.websocket.send(json.dumps({"event": "send command", "args": ['tellraw @a ["",{"text":"%s (DISCORD): ","color":"blue"},{"text":"%s","color":"white"}]', message.author.name, message.content]})) await self.websocket.send(json.dumps({"event": "send command", "args": ['tellraw @a ["",{"text":"%s (DISCORD): ","color":"blue"},{"text":"%s","color":"white"}]', message.author.name, message.content]}))
@commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"]) @commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"])