Search in sources :

Example 1 with VoiceChannel

use of net.dv8tion.jda.api.entities.VoiceChannel in project c0debaseBot by Biospheere.

the class GuildReadyListener method initTempchannel.

private void initTempchannel(final Guild guild) {
    for (VoiceChannel voiceChannel : guild.getVoiceChannels()) {
        final String name = ("temp-" + voiceChannel.getName().toLowerCase()).replaceAll("\\s+", "-");
        final TextChannel textChannel = voiceChannel.getGuild().getTextChannelsByName(name, true).isEmpty() ? null : voiceChannel.getGuild().getTextChannelsByName(name, true).get(0);
        if (textChannel == null) {
            bot.getTempchannels().put(voiceChannel.getId(), new Tempchannel());
        } else {
            Tempchannel tempchannel = new Tempchannel(textChannel);
            tempchannel.onLoad(textChannel, voiceChannel);
            bot.getTempchannels().put(voiceChannel.getId(), tempchannel);
        }
    }
}
Also used : TextChannel(net.dv8tion.jda.api.entities.TextChannel) VoiceChannel(net.dv8tion.jda.api.entities.VoiceChannel) Tempchannel(de.c0debase.bot.tempchannel.Tempchannel)

Aggregations

Tempchannel (de.c0debase.bot.tempchannel.Tempchannel)1 TextChannel (net.dv8tion.jda.api.entities.TextChannel)1 VoiceChannel (net.dv8tion.jda.api.entities.VoiceChannel)1