SteamWar/BungeeCore
Archiviert
13
2

-24s startup time. #238

Manuell gemergt
Lixfel hat 3 Commits von betterDiscord nach master 2021-09-07 15:37:34 +02:00 zusammengeführt
2 geänderte Dateien mit 13 neuen und 10 gelöschten Zeilen
Nur Änderungen aus Commit f0e7f52fd6 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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) {

Datei anzeigen

@ -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();
}
}
}