|
|
|
|
@@ -9,6 +9,7 @@ import fr.Skydust.JdrBot.stock.RecordState;
|
|
|
|
|
import fr.Skydust.JdrBot.stock.Command;
|
|
|
|
|
import fr.Skydust.JdrBot.utils.MessageType;
|
|
|
|
|
import fr.Skydust.JdrBot.utils.Utils;
|
|
|
|
|
import net.dv8tion.jda.api.Permission;
|
|
|
|
|
import net.dv8tion.jda.api.entities.Guild;
|
|
|
|
|
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
|
|
|
|
|
|
|
|
|
@@ -17,29 +18,31 @@ public class Record extends Command {
|
|
|
|
|
|
|
|
|
|
public Record() {
|
|
|
|
|
SetName("record");
|
|
|
|
|
SetDesc("Enregistre le chat vocal");
|
|
|
|
|
SetDesc("(Admin) Enregistre le chat vocal");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void call(GuildMessageReceivedEvent e)
|
|
|
|
|
{
|
|
|
|
|
RecordState currentRS = getGuildRecordState(e.getGuild());
|
|
|
|
|
if(e.getGuild().getMember(e.getAuthor()).hasPermission(Permission.ADMINISTRATOR)) {
|
|
|
|
|
RecordState currentRS = getGuildRecordState(e.getGuild());
|
|
|
|
|
|
|
|
|
|
if(e.getGuild().getMember(e.getAuthor()).getVoiceState().getChannel() != null && !currentRS.isRecording && !currentRS.isProcessing) {
|
|
|
|
|
Utils.sendMessage(e.getChannel(), MessageType.NORMAL, "Lancement d'un enregistrement par "+e.getAuthor().getAsMention()+"\n`!stoprecord` pour le terminer\n`!crecord` pour annuler");
|
|
|
|
|
if (e.getGuild().getMember(e.getAuthor()).getVoiceState().getChannel() != null && !currentRS.isRecording && !currentRS.isProcessing) {
|
|
|
|
|
Utils.sendMessage(e.getChannel(), MessageType.NORMAL, "Lancement d'un enregistrement par " + e.getAuthor().getAsMention() + "\n`!stoprecord` pour le terminer\n`!crecord` pour annuler");
|
|
|
|
|
|
|
|
|
|
System.out.println("["+new Date()+"] Le serveur ID "+e.getGuild().getId()+"("+e.getGuild().getName()+") vient de lancer un enregistrement");
|
|
|
|
|
System.out.println("[" + new Date() + "] Le serveur ID " + e.getGuild().getId() + "(" + e.getGuild().getName() + ") vient de lancer un enregistrement");
|
|
|
|
|
|
|
|
|
|
e.getGuild().getAudioManager().openAudioConnection(e.getGuild().getMember(e.getAuthor()).getVoiceState().getChannel());
|
|
|
|
|
e.getGuild().getAudioManager().openAudioConnection(e.getGuild().getMember(e.getAuthor()).getVoiceState().getChannel());
|
|
|
|
|
|
|
|
|
|
currentRS.newRecord();
|
|
|
|
|
currentRS.isRecording = true;
|
|
|
|
|
} else if(currentRS.isProcessing) {
|
|
|
|
|
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Un enregistrement est en cours de finalisation");
|
|
|
|
|
} else if(currentRS.isRecording) {
|
|
|
|
|
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Un enregistrement est déjà en cours");
|
|
|
|
|
} else {
|
|
|
|
|
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Vous n'êtes pas dans un salon vocal");
|
|
|
|
|
currentRS.newRecord();
|
|
|
|
|
currentRS.isRecording = true;
|
|
|
|
|
} else if (currentRS.isProcessing) {
|
|
|
|
|
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Un enregistrement est en cours de finalisation");
|
|
|
|
|
} else if (currentRS.isRecording) {
|
|
|
|
|
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Un enregistrement est déjà en cours");
|
|
|
|
|
} else {
|
|
|
|
|
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Vous n'êtes pas dans un salon vocal");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|