Add Pterodactyl cog #19
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).
|
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
|
- `.$U` - replaced with display name
|
||||||
- `.%M` - replaced with message contents
|
- `.$M` - replaced with message contents
|
||||||
- `.%C` - replaced with top role color (hex)
|
- `.$C` - replaced with top role color (hex)
|
||||||
|
|
||||||
Default:
|
Default:
|
||||||
```json
|
```json
|
||||||
|
|
|
@ -83,7 +83,13 @@ class Pterodactyl(commands.Cog):
|
||||||
|
|
||||||
async def get_chat_command(self, username: str, message: str, color: discord.Color) -> str:
|
async def get_chat_command(self, username: str, message: str, color: discord.Color) -> str:
|
||||||
command: str = await config.chat_command()
|
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
|
return command
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
|
|
Loading…
Reference in a new issue