forked from cswimr/SeaCogs
feat(pterodactyl): fixed some issues and added logging for what user executed a command through the console
This commit is contained in:
parent
a8f60b1aec
commit
c740cdc6dc
1 changed files with 2 additions and 1 deletions
|
@ -52,7 +52,7 @@ class Pterodactyl(commands.Cog):
|
||||||
self.logger.error('Failed to retrieve Pterodactyl websocket: %s', e)
|
self.logger.error('Failed to retrieve Pterodactyl websocket: %s', e)
|
||||||
return
|
return
|
||||||
|
|
||||||
async for websocket in websockets.connect(websocket_credentials['data']['socket'], origin=base_url):
|
async for websocket in websockets.connect(websocket_credentials['data']['socket'], origin=base_url, ping_timeout=60):
|
||||||
try:
|
try:
|
||||||
self.logger.debug("WebSocket connection established")
|
self.logger.debug("WebSocket connection established")
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ 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 self.websocket.send(json.dumps({"event": "send command", "args": [message.content]}))
|
await self.websocket.send(json.dumps({"event": "send command", "args": [message.content]}))
|
||||||
|
|
||||||
@commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"])
|
@commands.group(autohelp = True, name = "pterodactyl", aliases = ["ptero"])
|
||||||
|
|
Loading…
Reference in a new issue