fix(pterodactyl): fixed incorrect placeholder name and fixed broken get_topic method
This commit is contained in:
parent
4135cd4f98
commit
5f4cb88ea8
1 changed files with 6 additions and 6 deletions
|
@ -99,26 +99,26 @@ class Pterodactyl(commands.Cog):
|
||||||
topic: str = await config.topic()
|
topic: str = await config.topic()
|
||||||
placeholders = {
|
placeholders = {
|
||||||
"H": await config.topic_hostname() or "unset",
|
"H": await config.topic_hostname() or "unset",
|
||||||
"P": str(await config.topic_port()),
|
"O": str(await config.topic_port()),
|
||||||
}
|
}
|
||||||
if await config.api_endpoint() == "minecraft":
|
if await config.api_endpoint() == "minecraft":
|
||||||
status, response = await mcsrvstatus.get_status(await config.topic_ip(), await config.topic_port())
|
status, response = await mcsrvstatus.get_status(await config.topic_ip(), await config.topic_port())
|
||||||
if status:
|
if status:
|
||||||
placeholders += {
|
placeholders.update({
|
||||||
"I": response['ip'],
|
"I": response['ip'],
|
||||||
"M": str(response['players']['max']),
|
"M": str(response['players']['max']),
|
||||||
"P": str(response['players']['online']),
|
"P": str(response['players']['online']),
|
||||||
"V": response['version'],
|
"V": response['version'],
|
||||||
"D": response['motd']['clean'][0] if response['motd']['clean'] else "unset",
|
"D": response['motd']['clean'][0] if response['motd']['clean'] else "unset",
|
||||||
}
|
})
|
||||||
else:
|
else:
|
||||||
placeholders += {
|
placeholders.update({
|
||||||
"I": response['ip'],
|
"I": response['ip'],
|
||||||
"M": "0",
|
"M": "0",
|
||||||
"P": "0",
|
"P": "0",
|
||||||
"V": "Server Offline",
|
"V": "Server Offline",
|
||||||
"D": "Server Offline",
|
"D": "Server Offline",
|
||||||
}
|
})
|
||||||
for key, value in placeholders.items():
|
for key, value in placeholders.items():
|
||||||
topic = topic.replace('.$' + key, value)
|
topic = topic.replace('.$' + key, value)
|
||||||
return topic
|
return topic
|
||||||
|
@ -348,7 +348,7 @@ class Pterodactyl(commands.Cog):
|
||||||
|
|
||||||
Available placeholders:
|
Available placeholders:
|
||||||
- `.$H` (hostname)
|
- `.$H` (hostname)
|
||||||
- `.$P` (port)
|
- `.$O` (port)
|
||||||
Available for Minecraft servers:
|
Available for Minecraft servers:
|
||||||
- `.$I` (ip)
|
- `.$I` (ip)
|
||||||
- `.$M` (max players)
|
- `.$M` (max players)
|
||||||
|
|
Loading…
Reference in a new issue