feat(pterodactyl): added role coloring for discord roles
This commit is contained in:
parent
d3cc445802
commit
5a4dc4866c
1 changed files with 3 additions and 3 deletions
|
@ -146,8 +146,8 @@ class Pterodactyl(commands.Cog):
|
||||||
else:
|
else:
|
||||||
self.logger.debug("Chat channel not set. Skipping sending chat message to Discord")
|
self.logger.debug("Chat channel not set. Skipping sending chat message to Discord")
|
||||||
|
|
||||||
def get_tellraw_string(self, username: str, message: str):
|
def get_tellraw_string(self, username: str, message: str, color: discord.Color):
|
||||||
return f'tellraw @a ["",{{"text":"{username} (DISCORD): ","color":"#ff8d84"}},{{"text":"{message}","color":"white"}}]'
|
return f'tellraw @a ["",{{"text":"{username} ","color":"{str(color)}"}},{{"text":" (DISCORD): ","color":"blue"}},{{"text":"{message}","color":"white"}}]'
|
||||||
|
|
||||||
def get_task(self):
|
def get_task(self):
|
||||||
return self.bot.loop.create_task(self.establish_websocket_connection(), name="Pterodactyl Websocket Connection")
|
return self.bot.loop.create_task(self.establish_websocket_connection(), name="Pterodactyl Websocket Connection")
|
||||||
|
@ -170,7 +170,7 @@ class Pterodactyl(commands.Cog):
|
||||||
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]}")
|
||||||
msg = json.dumps({"event": "send command", "args": [self.get_tellraw_string(message.author.name, message.content)]})
|
msg = json.dumps({"event": "send command", "args": [self.get_tellraw_string(message.author.name, message.content, message.author.color)]})
|
||||||
self.logger.debug("Sending chat message to server:\n%s", msg)
|
self.logger.debug("Sending chat message to server:\n%s", msg)
|
||||||
await self.websocket.send(msg)
|
await self.websocket.send(msg)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue