feat(pterodactyl): added more placeholders and updated documentation to match
This commit is contained in:
parent
4979e44b7c
commit
dab56bed94
3 changed files with 16 additions and 10 deletions
|
@ -71,7 +71,7 @@ class Pterodactyl(commands.Cog):
|
|||
channel = self.bot.get_channel(await config.console_channel())
|
||||
if channel:
|
||||
await channel.send(f"Received chat message from {message.author.id}: {message.content[:1900]}")
|
||||
msg = json.dumps({"event": "send command", "args": [await self.get_chat_command(message.author.display_name, message.content, message.author.color)]})
|
||||
msg = json.dumps({"event": "send command", "args": [await self.get_chat_command(message)]})
|
||||
logger.debug("Sending chat message to server:\n%s", msg)
|
||||
try:
|
||||
await self.websocket.send(msg)
|
||||
|
@ -81,12 +81,15 @@ class Pterodactyl(commands.Cog):
|
|||
self.retry_counter = 0
|
||||
self.task = self.get_task()
|
||||
|
||||
async def get_chat_command(self, username: str, message: str, color: discord.Color) -> str:
|
||||
async def get_chat_command(self, message: discord.Message) -> str:
|
||||
command: str = await config.chat_command()
|
||||
placeholders = {
|
||||
"U": username,
|
||||
"M": message,
|
||||
"C": str(color)
|
||||
"C": str(message.author.color),
|
||||
"D": message.author.discriminator,
|
||||
"M": message.content,
|
||||
"N": message.author.display_name,
|
||||
"I": str(message.author.id),
|
||||
"U": message.author.name,
|
||||
}
|
||||
for key, value in placeholders.items():
|
||||
command = command.replace('$.' + key, value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue