!7 //set flag DifferentJDA. //lib 1400185 // discord with opus/JNA (hopefully not a problem) import net.dv8tion.jda.core.managers.AudioManager; // Note: moved from core to api in JDA 4.0 import com.sedmelluq.discord.lavaplayer.player.*; //lib 1400286 // lavaplayer 1.3.22 lib 1400288 // lavaplayer fat lib 1400289 // httpclient static AudioPlayerManager playerManager; svoid cleanMeUp { dispose playerManager; } cmodule DiscordAudioSpike > DynTalkBot2 { S myName = "Discord Audio Spike"; start { makeByServer = () -> new ByServer; useAGIBlueForDropPunctuation = false; preprocessAtSelfToMyName = false; if (playerManager == null) playerManager = new DefaultAudioPlayerManager; } class ByServer extends DynTalkBot2.ByServer { synchronized S processSimplifiedLine(S s, O... _) { try answer super.processSimplifiedLine(s, _); // adding authorized users etc. new Matches m; if null (s = dropMyPrefixOrNull(s)) null; optPar Message msg; Guild guild = msg == null ? null : msg.getGuild(); if "voice channels" ret str(guild.getVoiceChannels()); if "join voice channel" ret joinVoiceChannel(first(guild.getVoiceChannels()); if (eqic(s, "help")) ret ltrim([[ I'm a Discord Audio Test [Bot made by https://BotCompany.de] ]]).replace("@me", atSelf()); null; } S joinVoiceChannel(VoiceChannel vc) { if (vc == null) ret "No channel"; Guild guild = vc.getGuild(); AudioManager am = guild.getAudioManager(); am.openAudioConnection(vc); ret "Audio connection to " + vc.getName() + " opened"; } } }