Add staff command channel to config and update output channels for stafflist and serverlist to getChannel() in command.

This commit is contained in:
destro174 2022-04-16 15:07:11 +02:00
parent 78cecda508
commit 59cdd14cb2
3 changed files with 8 additions and 7 deletions

View File

@ -96,7 +96,7 @@ public class DiscordServerList extends DiscordCommand {
totalCharacters += rankname.length() + currentFieldText.length(); totalCharacters += rankname.length() + currentFieldText.length();
fieldCounter++; fieldCounter++;
if (totalCharacters > 6000 || fieldCounter > 25) { if (totalCharacters > 6000 || fieldCounter > 25) {
bot.sendEmbedToDiscord(BotConfig.COMMAND_CHANNEL, embedBuilder, 300); bot.sendEmbedToDiscord(getChannel(), embedBuilder, 300);
embedBuilder.clearFields(); embedBuilder.clearFields();
totalCharacters = title.length() + rankname.length() + currentFieldText.length(); totalCharacters = title.length() + rankname.length() + currentFieldText.length();
fieldCounter = 1; fieldCounter = 1;
@ -126,13 +126,13 @@ public class DiscordServerList extends DiscordCommand {
totalCharacters = title.length() + rankname.length() + currentFieldText.length(); totalCharacters = title.length() + rankname.length() + currentFieldText.length();
fieldCounter++; fieldCounter++;
if (totalCharacters > 6000 || fieldCounter > 25) { if (totalCharacters > 6000 || fieldCounter > 25) {
bot.sendEmbedToDiscord(BotConfig.COMMAND_CHANNEL, embedBuilder, 300); bot.sendEmbedToDiscord(getChannel(), embedBuilder, 300);
embedBuilder.clearFields(); embedBuilder.clearFields();
} }
embedBuilder.addField(rankname, currentFieldText.toString(), true); embedBuilder.addField(rankname, currentFieldText.toString(), true);
} }
message.delete().queueAfter(300, TimeUnit.SECONDS); message.delete().queueAfter(300, TimeUnit.SECONDS);
bot.sendEmbedToDiscord(BotConfig.COMMAND_CHANNEL, embedBuilder, 300); bot.sendEmbedToDiscord(getChannel(), embedBuilder, 300);
} }
} }

View File

@ -81,7 +81,7 @@ public class DiscordStaffList extends DiscordCommand {
totalCharacters += rankname.length() + currentFieldText.length(); totalCharacters += rankname.length() + currentFieldText.length();
fieldCounter++; fieldCounter++;
if (totalCharacters > 6000 || fieldCounter > 25) { if (totalCharacters > 6000 || fieldCounter > 25) {
bot.sendEmbedToDiscord(BotConfig.COMMAND_CHANNEL, embedBuilder, -1); bot.sendEmbedToDiscord(getChannel(), embedBuilder, -1);
embedBuilder.clearFields(); embedBuilder.clearFields();
totalCharacters = title.length() + rankname.length() + currentFieldText.length(); totalCharacters = title.length() + rankname.length() + currentFieldText.length();
fieldCounter = 1; fieldCounter = 1;
@ -119,7 +119,7 @@ public class DiscordStaffList extends DiscordCommand {
totalCharacters = title.length() + rankname.length() + currentFieldText.length(); totalCharacters = title.length() + rankname.length() + currentFieldText.length();
fieldCounter++; fieldCounter++;
if (totalCharacters > 6000 || fieldCounter > 25) { if (totalCharacters > 6000 || fieldCounter > 25) {
bot.sendEmbedToDiscord(BotConfig.COMMAND_CHANNEL, embedBuilder, -1); bot.sendEmbedToDiscord(getChannel(), embedBuilder, -1);
embedBuilder.clearFields(); embedBuilder.clearFields();
} }
embedBuilder.addField(rankname, currentFieldText.toString(), true); embedBuilder.addField(rankname, currentFieldText.toString(), true);
@ -141,12 +141,12 @@ public class DiscordStaffList extends DiscordCommand {
totalCharacters = title.length() + rankname.length() + currentFieldText.length(); totalCharacters = title.length() + rankname.length() + currentFieldText.length();
fieldCounter++; fieldCounter++;
if (totalCharacters > 6000 || fieldCounter > 25) { if (totalCharacters > 6000 || fieldCounter > 25) {
bot.sendEmbedToDiscord(BotConfig.COMMAND_CHANNEL, embedBuilder, -1); bot.sendEmbedToDiscord(getChannel(), embedBuilder, -1);
embedBuilder.clearFields(); embedBuilder.clearFields();
} }
embedBuilder.addField(rankname, currentFieldText.toString(), true); embedBuilder.addField(rankname, currentFieldText.toString(), true);
} }
bot.sendEmbedToDiscord(BotConfig.COMMAND_CHANNEL, embedBuilder, -1); bot.sendEmbedToDiscord(getChannel(), embedBuilder, -1);
} }
} }

View File

@ -176,6 +176,7 @@ public class BotConfig {
private static void settings() { private static void settings() {
BOT_TOKEN = getString("settings.token", BOT_TOKEN); BOT_TOKEN = getString("settings.token", BOT_TOKEN);
STAFF_COMMAND_CHANNEL = getLong("settings.staff-command-channel", STAFF_COMMAND_CHANNEL);
COMMAND_CHANNEL = getLong("settings.command-channel", COMMAND_CHANNEL); COMMAND_CHANNEL = getLong("settings.command-channel", COMMAND_CHANNEL);
LINK_CHANNEL = getLong("settings.link-channel", LINK_CHANNEL); LINK_CHANNEL = getLong("settings.link-channel", LINK_CHANNEL);
GUILD_ID = getLong("settings.guild-id", GUILD_ID); GUILD_ID = getLong("settings.guild-id", GUILD_ID);