Do everything in one command

This commit is contained in:
sclement 2023-12-28 16:53:22 +01:00
parent 5bb2f20221
commit db70d06dc4

View File

@ -41,20 +41,18 @@ public class AutoVoiceChannel {
GuildPreferenceEntity pref = SettingsUtils.getInstance().getPreference(guild); GuildPreferenceEntity pref = SettingsUtils.getInstance().getPreference(guild);
if (pref.isAutoVoice() && voiceChannel.getId().equals(pref.getAutoVoiceChannelID())) { if (pref.isAutoVoice() && voiceChannel.getId().equals(pref.getAutoVoiceChannelID())) {
logger.info("Creating new voice channel for Guild : {}", guild.getName()); logger.info("Creating new voice channel for Guild : {}", guild.getName());
voiceChannel.createCopy().queue(newChannel -> { int next = getNextNumber();
int next = getNextNumber(); String title = pref.getAutoVoiceChannelTitle();
String title = pref.getAutoVoiceChannelTitle(); if (title.isEmpty()) {
if (title.isEmpty()) { title = "Voice @count";
title = "Voice @count"; }
} title = title.replace("@count", Integer.toString(next));
voiceChannel.createCopy().setName(title).setPosition(voiceChannel.getPosition()).queue(newChannel -> {
title = title.replace("@count", Integer.toString(next)); moveMembers(voiceChannel.getMembers(), (AudioChannel) newChannel);
newChannel.getManager().setName(title).queue(t -> { createdChannels.put(next, newChannel.getId());
// moveMembers(voiceChannel.getMembers(), (AudioChannel) newChannel);
createdChannels.put(next, newChannel.getId());
});
}); });
} }
} }
public void leave(AudioChannel voiceChannel) { public void leave(AudioChannel voiceChannel) {