mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 14:04:25 -05:00
Tidy DiscordRcon plugin
This commit is contained in:
parent
47b8b3321a
commit
cfde3b2f6a
@ -42,17 +42,23 @@ export default class DiscordRcon extends BasePlugin {
|
||||
|
||||
let command = message.content;
|
||||
|
||||
if (options.prependAdminNameInBroadcast && command.match(/^adminbroadcast/i))
|
||||
if (options.prependAdminNameInBroadcast)
|
||||
command = command.replace(
|
||||
/^AdminBroadcast /i,
|
||||
`AdminBroadcast ${message.member.displayName}: `
|
||||
);
|
||||
|
||||
for (const responseMessage of this.splitLongResponse(await server.rcon.execute(command)))
|
||||
await message.channel.send(`\`\`\`${responseMessage}\`\`\``);
|
||||
const response = await server.rcon.execute(command);
|
||||
|
||||
await this.respondToMessage(message, response);
|
||||
});
|
||||
}
|
||||
|
||||
async respondToMessage(message, response) {
|
||||
for (const splitResponse of this.splitLongResponse(response))
|
||||
await message.channel.send(`\`\`\`${splitResponse}\`\`\``);
|
||||
}
|
||||
|
||||
splitLongResponse(response) {
|
||||
const responseMessages = [''];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user