-24s startup time. #238
@ -103,10 +103,10 @@ public class SteamwarDiscordBot {
|
||||
serverTeamChatListener = new ServerTeamChatListener();
|
||||
new SlashCommandListener();
|
||||
|
||||
jda.retrieveCommands().complete().forEach(command -> jda.deleteCommandById(command.getId()).complete());
|
||||
jda.retrieveCommands().complete().forEach(command -> jda.deleteCommandById(command.getId()).queue());
|
||||
|
||||
Guild guild = jda.getGuildById(SteamwarDiscordBotConfig.GUILD);
|
||||
guild.retrieveCommands().complete().forEach(command -> guild.deleteCommandById(command.getId()).complete());
|
||||
guild.retrieveCommands().complete().forEach(command -> guild.deleteCommandById(command.getId()).queue());
|
||||
CommandListUpdateAction commands = jda.getGuildById(SteamwarDiscordBotConfig.GUILD).updateCommands();
|
||||
addCommand(commands, new MuteCommand());
|
||||
addCommand(commands, new BanCommand());
|
||||
@ -114,7 +114,7 @@ public class SteamwarDiscordBot {
|
||||
addCommand(commands, new TeamCommand());
|
||||
addCommand(commands, new ListCommand());
|
||||
addCommand(commands, new UnbanCommand());
|
||||
commands.complete();
|
||||
commands.queue();
|
||||
}
|
||||
|
||||
private void addCommand(CommandListUpdateAction commands, BasicDiscordCommand basicDiscordCommand) {
|
||||
|
@ -38,10 +38,6 @@ public class DiscordRolesMessage {
|
||||
public void sendMessage() {
|
||||
TextChannel channel = SteamwarDiscordBot.instance().getJda().getGuildById(SteamwarDiscordBotConfig.GUILD).getTextChannelById(SteamwarDiscordBotConfig.ROLES_CHANNEL);
|
||||
assert channel != null;
|
||||
Message message = null;
|
||||
if(channel.hasLatestMessage()) {
|
||||
message = channel.getIterableHistory().complete().stream().filter(m -> m.getAuthor().isBot()).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
MessageBuilder builder = new MessageBuilder();
|
||||
builder.setContent(SteamwarDiscordBotConfig.ROLES_BASE_MESSAGE);
|
||||
@ -49,10 +45,17 @@ public class DiscordRolesMessage {
|
||||
SteamwarDiscordBotConfig.ROLES.forEach(discordRole -> buttons.add(discordRole.toButton()));
|
||||
builder.setActionRows(ActionRow.of(buttons));
|
||||
|
||||
if (message != null) {
|
||||
message.editMessage(builder.build()).complete();
|
||||
if(channel.hasLatestMessage()) {
|
||||
channel.getIterableHistory().queue(messages -> {
|
||||
Message message = messages.stream().filter(m -> m.getAuthor().isBot()).findFirst().orElse(null);
|
||||
if (message != null) {
|
||||
message.editMessage(builder.build()).queue();
|
||||
} else {
|
||||
channel.sendMessage(builder.build()).queue();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
channel.sendMessage(builder.build()).complete();
|
||||
channel.sendMessage(builder.build()).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren