@@ -0,0 +1,1572 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage Audio;%0A%0Aimport Command.*;%0Aimport Config.*;%0Aimport Main.*;%0A%0Aimport net.dv8tion.jda.core.entities.VoiceChannel;%0Aimport net.dv8tion.jda.core.managers.AudioManager;%0Aimport net.dv8tion.jda.core.events.message.MessageReceivedEvent;%0A%0A/**%0A *%0A * @author liaoyilin%0A */%0Apublic class AudioConnection %7B%0A    %0A    public static VoiceChannel vc;%0A    public static AudioManager am;%0A    %0A    public static void connect(MessageReceivedEvent e)%0A    %7B%0A        try %7B%0A            vc = e.getMember().getVoiceState().getChannel();%0A            am = e.getGuild().getAudioManager();%0A            am.openAudioConnection(vc);%0A            %0A            e.getChannel().sendMessage(Emoji.globe + %22 Joined Voice Channel %60%22 + vc.getName() + %22%60%22).queue();%0A        %7D catch (IllegalArgumentException iea) %7B%0A            e.getChannel().sendMessage(Emoji.error + %22 You must connect to a voice channel first.%22).queue();%0A        %7D%0A    %7D%0A    %0A    public static void disconnect(MessageReceivedEvent e)%0A    %7B%0A            try %7B%0A                am = e.getGuild().getAudioManager();%0A                am.closeAudioConnection();%0A            %7D catch (NullPointerException npe) %7B%0A                e.getChannel().sendMessage(Emoji.error + %22 You are not in a voice channel.%22).queue();%0A            %7D%0A            %0A            e.getChannel().sendMessage(Emoji.globe + %22 Left Voice Channel %60%22 + vc.getName() + %22%60%22).queue();%0A    %7D%0A    %0A    %0A%7D%0A

rename connection