mirror of
https://github.com/PHIDIAS0303/ClusterChatSync.git
synced 2026-11-11 15:14:52 +09:00
Update controller.ts
This commit is contained in:
1 parent
9622e7d52e
commit
f28cad665e
1 file changed
+2
-15
+2
-15
@@ -130,21 +130,8 @@ export default async function(context: ControllerPluginContext) {
|
||||
? text.slice(0, -verb.length).trim()
|
||||
: text;
|
||||
|
||||
const connection = await controller.instances.get(instanceId);
|
||||
|
||||
if (!connection) {
|
||||
await sendMessage(instanceName, `**\`${name}\`** ${verb}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let pc = '';
|
||||
|
||||
try {
|
||||
pc = String(await connection.sendRcon('/_rcon return #game.connected_players', false, instanceName)).trim();
|
||||
} catch {
|
||||
}
|
||||
|
||||
await sendMessage(instanceName, `**\`${name}\`** ${verb}${pc ? ` (${pc})` : ''}`);
|
||||
const instance = await controller.instances.get(instanceId);
|
||||
await sendMessage(instanceName, `**\`${name}\`** ${verb}${instance.playersOnline.size}`);
|
||||
});
|
||||
|
||||
controller.config.on('fieldChanged', (field) => {
|
||||
|
||||
Reference in new issue
Block a user