!7 !include once #1025344 // Discord Audio cmodule DiscordAudioSpike > DynTalkBot2 { S myName = "Discord Audio Spike"; start { makeByServer = () -> new ByServer; useAGIBlueForDropPunctuation = false; preprocessAtSelfToMyName = false; } 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(); AudioPlayerManager playerManager = lavaPlayer_playerManager(); AudioPlayer player = playerManager.createPlayer(); lavaPlayer_printPlayerEvents(player); am.setSendingHandler(new JDA_AudioPlayerSendHandler(player)); am.openAudioConnection(vc); S trackID = "http://s3.free-shoutcast.com:18162/;?type=http&nocache=" + randomInt(); lavaPlayer_loadItem(module(), playerManager, player, trackID); ret "Playing radio in " + vc.getName(); } } }