Add Pterodactyl cog #19
1 changed files with 5 additions and 1 deletions
|
@ -159,13 +159,17 @@ 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:
|
||||||
|
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 message.author.id != self.bot.user.id:
|
||||||
|
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:
|
||||||
await channel.send(f"Received chat message from {message.author.id}: {message.content[:1900]}")
|
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]}))
|
msg = json.dumps({"event": "send command", "args": ['tellraw @a ["",{"text":"%s (DISCORD): ","color":"blue"},{"text":"%s","color":"white"}]', message.author.name, message.content]})
|
||||||
|
self.logger.debug("Sending chat message to server:\n%s", msg)
|
||||||
|
await self.websocket.send(msg)
|
||||||
|
|
||||||
@commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"])
|
@commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"])
|
||||||
async def pterodactyl(self, ctx: commands.Context):
|
async def pterodactyl(self, ctx: commands.Context):
|
||||||
|
|
Loading…
Reference in a new issue