Utilisation du e.getMember() au lieu de ce truc chelou que j'ai fait juste pour ce fichier

Discord record en 48000Hz et pas en 44100Hz
This commit is contained in:
2021-06-04 01:36:07 +02:00
parent 605b00026a
commit f42c58d6cd
5 changed files with 14 additions and 26 deletions

View File

@@ -24,22 +24,27 @@ public class Record extends Command {
@Override
public void call(GuildMessageReceivedEvent e)
{
if(e.getGuild().getMember(e.getAuthor()).hasPermission(Permission.ADMINISTRATOR)) {
if(e.getMember().hasPermission(Permission.ADMINISTRATOR)) {
RecordState currentRS = getGuildRecordState(e.getGuild());
if (e.getGuild().getMember(e.getAuthor()).getVoiceState().getChannel() != null && !currentRS.isRecording && !currentRS.isProcessing) {
if (currentRS.isProcessing) {
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Un enregistrement est en cours de finalisation");
return;
}
if (currentRS.isRecording) {
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Un enregistrement est déjà en cours");
return;
}
if (e.getMember().getVoiceState().getChannel() != null) {
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");
e.getGuild().getAudioManager().openAudioConnection(e.getGuild().getMember(e.getAuthor()).getVoiceState().getChannel());
e.getGuild().getAudioManager().openAudioConnection(e.getMember().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");
}

View File

@@ -146,7 +146,7 @@ public class RecordState {
* Defines a default audio format used to record
*/
private AudioFormat getAudioFormat() {
float sampleRate = 44100;
float sampleRate = 48000;
int sampleSizeInBits = 16;
int channels = 2;
boolean signed = true;

View File

@@ -1,3 +1,3 @@
Manifest-Version: 1.0
Main-Class: fr.Skydust.JdrBot.JdrBot
Main-Class: fr.Skydust.JdrBot.JdrBot;