forked from blizzthewolf/SeaCogs
feat(pterodactyl): updated how placeholders are parsed in get_chat_command(), updated documentation to match
This commit is contained in:
parent
1bc1c7a90e
commit
4979e44b7c
2 changed files with 11 additions and 5 deletions
|
@ -127,11 +127,11 @@ achivement messages: ^\[\d{2}:\d{2}:\d{2} INFO\]: (.*) has (made the advancement
|
|||
|
||||
The cog uses a tellraw command to send messages to Minecraft from Discord. To change this, use the `[p]pterodactyl config chat command` command. The JSON format Minecraft uses for this is very janky sometimes, if you need help with changing the command, you can join my [Discord server](https://discord.gg/eMUMe77Yb8).
|
||||
|
||||
Required placeholders:
|
||||
Available placeholders:
|
||||
|
||||
- `.%U` - replaced with display name
|
||||
- `.%M` - replaced with message contents
|
||||
- `.%C` - replaced with top role color (hex)
|
||||
- `.$U` - replaced with display name
|
||||
- `.$M` - replaced with message contents
|
||||
- `.$C` - replaced with top role color (hex)
|
||||
|
||||
Default:
|
||||
```json
|
||||
|
|
|
@ -83,7 +83,13 @@ class Pterodactyl(commands.Cog):
|
|||
|
||||
async def get_chat_command(self, username: str, message: str, color: discord.Color) -> str:
|
||||
command: str = await config.chat_command()
|
||||
command = command.replace(".$U", username).replace(".$M", message).replace(".$C", str(color))
|
||||
placeholders = {
|
||||
"U": username,
|
||||
"M": message,
|
||||
"C": str(color)
|
||||
}
|
||||
for key, value in placeholders.items():
|
||||
command = command.replace('$.' + key, value)
|
||||
return command
|
||||
|
||||
@commands.Cog.listener()
|
||||
|
|
Loading…
Reference in a new issue