diff --git a/pom.xml b/pom.xml
index 601ef5f8a..46e9f66ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -206,9 +206,9 @@
3.0.4
- net.dv8tion
+ com.github.DV8FromTheWorld
JDA
- 5.0.0-alpha.13
+ 07e8166fc5
me.carleslc.Simple-YAML
diff --git a/src/main/java/de/presti/ree6/audio/AudioPlayerReceiveHandler.java b/src/main/java/de/presti/ree6/audio/AudioPlayerReceiveHandler.java
new file mode 100644
index 000000000..818150207
--- /dev/null
+++ b/src/main/java/de/presti/ree6/audio/AudioPlayerReceiveHandler.java
@@ -0,0 +1,121 @@
+package de.presti.ree6.audio;
+
+import de.presti.ree6.utils.data.AudioUtil;
+import net.dv8tion.jda.api.audio.AudioReceiveHandler;
+import net.dv8tion.jda.api.audio.CombinedAudio;
+import net.dv8tion.jda.api.entities.User;
+import net.dv8tion.jda.api.entities.VoiceChannel;
+import org.jetbrains.annotations.NotNull;
+
+import java.nio.ByteBuffer;
+import java.text.SimpleDateFormat;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/*
+ All methods in this class are called by JDA threads when resources are available/ready for processing.
+ The receiver will be provided with the latest 20ms of PCM stereo audio
+ Note you can receive even while setting yourself to deafened
+ */
+public class AudioPlayerReceiveHandler implements AudioReceiveHandler {
+
+ /**
+ * Queue of audio to be sent afterwards.
+ */
+ private final Queue queue = new ConcurrentLinkedQueue<>();
+
+ /**
+ * Boolean used to indicated that handler finished his Job.
+ */
+ private boolean finished = false;
+
+ /**
+ * The voice channel this handler is currently handling.
+ */
+ private final VoiceChannel voiceChannel;
+
+ /**
+ * Constructor.
+ *
+ * @param voiceChannel The voice channel this handler should handle.
+ */
+ public AudioPlayerReceiveHandler(VoiceChannel voiceChannel) {
+ this.voiceChannel = voiceChannel;
+ }
+
+ /**
+ * @see AudioReceiveHandler#canReceiveCombined()
+ */
+ @Override // combine multiple user audio-streams into a single one
+ public boolean canReceiveCombined() {
+ /* one entry = 20ms of audio, which means 20 * 100 = 2000ms = 2s of audio,
+ * but since we want to allow up to 5 minute of audio we have to do
+ * 20 * 100 * 150 = 300.000ms = 5 minutes of audio.
+ * And since 100 entries are 2s we would need 15000 entries for 5 minutes of audio.
+ */
+ return queue.size() < 15000;
+ }
+
+ /**
+ * @see AudioReceiveHandler#canReceiveUser()
+ */
+ @Override
+ public boolean includeUserInCombinedAudio(@NotNull User user) {
+ return !user.isBot();
+ }
+
+ /**
+ * @see AudioReceiveHandler#handleCombinedAudio(CombinedAudio)
+ */
+ @Override
+ public void handleCombinedAudio(CombinedAudio combinedAudio) {
+ if (finished) {
+ return;
+ }
+
+ if (combinedAudio.getUsers().isEmpty()) {
+ if (voiceChannel.getMembers().size() == 1) {
+ endReceiving();
+ }
+ return;
+ }
+
+ if (voiceChannel.getMembers().size() == 1) {
+ endReceiving();
+ return;
+ }
+
+ byte[] data = combinedAudio.getAudioData(1.0f);
+ queue.add(data);
+
+ if (!canReceiveCombined()) {
+ endReceiving();
+ }
+ }
+
+ /**
+ * Method called when the recording should stop.
+ */
+ public void endReceiving() {
+ if (finished) {
+ return;
+ }
+
+ finished = true;
+
+ try {
+ int queueSize = queue.stream().mapToInt(data -> data.length).sum();
+ ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[queueSize]);
+ for (byte[] data : queue) {
+ byteBuffer.put(data);
+ }
+
+ voiceChannel.sendMessage("Here is your audio!").addFile(AudioUtil.convert(byteBuffer), new SimpleDateFormat("dd.MM.yyyy HH/mm").format(System.currentTimeMillis()) + "-" + voiceChannel.getId() + ".wav").queue();
+ } catch (Exception ex) {
+ voiceChannel.sendMessage("Something went wrong while converting your audio!\nReason: " + ex.getMessage()).queue();
+ }
+
+ voiceChannel.getGuild().getAudioManager().closeAudioConnection();
+ queue.clear();
+ }
+}
diff --git a/src/main/java/de/presti/ree6/audio/music/MusicWorker.java b/src/main/java/de/presti/ree6/audio/music/MusicWorker.java
index 1bed112b6..151bd96ae 100644
--- a/src/main/java/de/presti/ree6/audio/music/MusicWorker.java
+++ b/src/main/java/de/presti/ree6/audio/music/MusicWorker.java
@@ -21,7 +21,7 @@
import net.dv8tion.jda.api.entities.AudioChannel;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
-import net.dv8tion.jda.api.entities.TextChannel;
+import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.interactions.InteractionHook;
import net.dv8tion.jda.api.managers.AudioManager;
@@ -77,10 +77,10 @@ public synchronized GuildMusicManager getGuildAudioPlayer(Guild guild) {
* @param trackUrl the Track URL.
* @param interactionHook a InteractionHook if it was an SlashCommand.
*/
- public void loadAndPlaySilence(final TextChannel channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook) {
- GuildMusicManager musicManager = getGuildAudioPlayer(channel.getGuild());
+ public void loadAndPlaySilence(final MessageChannelUnion channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook) {
+ GuildMusicManager musicManager = getGuildAudioPlayer(channel.asGuildMessageChannel().getGuild());
- musicManager.scheduler.textChannel = channel;
+ musicManager.scheduler.channel = channel;
playerManager.loadItemOrdered(musicManager, trackUrl, new AudioLoadResultHandler() {
/**
@@ -121,12 +121,12 @@ public void playlistLoaded(AudioPlaylist playlist) {
@Override
public void noMatches() {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
- .setAuthor(channel.getGuild().getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getGuild().getJDA().getSelfUser().getAvatarUrl())
+ .setAuthor(channel.asGuildMessageChannel().getGuild().getJDA().getSelfUser().getName(), Data.WEBSITE, channel.asGuildMessageChannel().getGuild().getJDA().getSelfUser().getAvatarUrl())
.setTitle("Music Player!")
- .setThumbnail(channel.getGuild().getJDA().getSelfUser().getAvatarUrl())
+ .setThumbnail(channel.asGuildMessageChannel().getGuild().getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("A Song with the URL ``" + FormatUtil.filter(trackUrl) + "`` couldn't be found!")
- .setFooter(channel.getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.getGuild().getIconUrl()), 5, channel, interactionHook);
+ .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
}
/**
@@ -140,7 +140,7 @@ public void loadFailed(FriendlyException exception) {
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("Error while playing: " + exception.getMessage())
- .setFooter(channel.getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.getGuild().getIconUrl()), 5, channel, interactionHook);
+ .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
}
});
}
@@ -153,10 +153,10 @@ public void loadFailed(FriendlyException exception) {
* @param trackUrl the Track URL.
* @param interactionHook a InteractionHook if it was an SlashCommand.
*/
- public void loadAndPlay(final TextChannel channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook) {
- GuildMusicManager musicManager = getGuildAudioPlayer(channel.getGuild());
+ public void loadAndPlay(final MessageChannelUnion channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook) {
+ GuildMusicManager musicManager = getGuildAudioPlayer(channel.asGuildMessageChannel().getGuild());
- musicManager.scheduler.textChannel = channel;
+ musicManager.scheduler.channel = channel;
playerManager.loadItemOrdered(musicManager, trackUrl, new AudioLoadResultHandler() {
@@ -172,7 +172,7 @@ public void trackLoaded(AudioTrack track) {
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("The Song ``" + FormatUtil.filter(track.getInfo().title) + "`` has been added to the Queue!")
- .setFooter(channel.getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.getGuild().getIconUrl()), 5, channel, interactionHook);
+ .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
play(audioChannel, musicManager, track);
}
@@ -196,7 +196,7 @@ public void playlistLoaded(AudioPlaylist playlist) {
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("The Song ``" + FormatUtil.filter(firstTrack.getInfo().title) + "`` has been added to the Queue! (The first Song of the Playlist: " + FormatUtil.filter(playlist.getName()) + ")")
- .setFooter(channel.getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.getGuild().getIconUrl()), 5, channel, interactionHook);
+ .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
play(audioChannel, musicManager, firstTrack);
@@ -220,7 +220,7 @@ public void noMatches() {
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("A Song with the URL ``" + FormatUtil.filter(trackUrl) + "`` couldn't be found!")
- .setFooter(channel.getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.getGuild().getIconUrl()), 5, channel, interactionHook);
+ .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
}
/**
@@ -234,7 +234,7 @@ public void loadFailed(FriendlyException exception) {
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("Error while playing: " + exception.getMessage())
- .setFooter(channel.getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.getGuild().getIconUrl()), 5, channel, interactionHook);
+ .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
}
});
}
@@ -257,15 +257,15 @@ public void play(AudioChannel audioChannel, GuildMusicManager musicManager, Audi
* @param channel the TextChannel, used to inform the user about the skip.
* @param interactionHook the Interaction-Hook, used to replace the channel if it is a SlashCommand.
*/
- public void skipTrack(TextChannel channel, InteractionHook interactionHook) {
+ public void skipTrack(MessageChannelUnion channel, InteractionHook interactionHook) {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder().setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle("Music Player!")
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("Skipping to the next Song!")
- .setFooter(channel.getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.getGuild().getIconUrl()), 5, channel, interactionHook);
+ .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
- getGuildAudioPlayer(channel.getGuild()).scheduler.nextTrack(channel);
+ getGuildAudioPlayer(channel.asGuildMessageChannel().getGuild()).scheduler.nextTrack(channel);
}
/**
@@ -325,12 +325,12 @@ public boolean isConnectedMember(Member member) {
public boolean checkInteractPermission(CommandEvent commandEvent) {
if (commandEvent.getMember().getVoiceState() == null || !commandEvent.getMember().getVoiceState().inAudioChannel()) {
- Main.getInstance().getCommandManager().sendMessage("Please join a Channel!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please join a Channel!", commandEvent.getChannel(), commandEvent.getInteractionHook());
return false;
}
if (commandEvent.getGuild().getSelfMember().getVoiceState() != null && commandEvent.getGuild().getSelfMember().getVoiceState().inAudioChannel() && commandEvent.getGuild().getSelfMember().getVoiceState().getChannel() != null && commandEvent.getMember().getVoiceState().getChannel() != null && !commandEvent.getGuild().getSelfMember().getVoiceState().getChannel().getId().equalsIgnoreCase(commandEvent.getMember().getVoiceState().getChannel().getId())) {
- Main.getInstance().getCommandManager().sendMessage("You have to be in the same Channel as me!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You have to be in the same Channel as me!", commandEvent.getChannel(), commandEvent.getInteractionHook());
return false;
}
diff --git a/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java b/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java
index ce9e15d5c..a88233a23 100644
--- a/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java
+++ b/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java
@@ -10,6 +10,7 @@
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.TextChannel;
+import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.interactions.InteractionHook;
import java.awt.*;
@@ -26,7 +27,7 @@
public class TrackScheduler extends AudioEventAdapter {
private final AudioPlayer player;
private final BlockingQueue queue;
- TextChannel textChannel;
+ MessageChannelUnion channel;
boolean loop = false;
/**
@@ -99,17 +100,17 @@ public void shuffle() {
*
* @return the {@link TextChannel}.
*/
- public TextChannel getTextChannel() {
- return textChannel;
+ public MessageChannelUnion getChannel() {
+ return channel;
}
/**
* Change the Text-Channel where the commands have been performed from.
*
- * @param textChannel the {@link TextChannel}.
+ * @param channel the {@link TextChannel}.
*/
- public void setTextChannel(TextChannel textChannel) {
- this.textChannel = textChannel;
+ public void setChannel(MessageChannelUnion channel) {
+ this.channel = channel;
}
/**
@@ -142,25 +143,25 @@ public void clearQueue() {
*
* @param textChannel the Text-Channel where the command have been performed from.
*/
- public void nextTrack(TextChannel textChannel) {
+ public void nextTrack(MessageChannelUnion textChannel) {
// Start the next track, regardless of if something is already playing or not.
// In case queue was empty, we are
// giving null to startTrack, which is a valid argument and will simply stop the
// player.
- setTextChannel(textChannel);
+ setChannel(textChannel);
AudioTrack track = queue.poll();
if (track != null) {
- if (getTextChannel() != null) {
+ if (getChannel() != null) {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
.setAuthor(textChannel.getJDA().getSelfUser().getName(), Data.WEBSITE, textChannel.getJDA().getSelfUser().getAvatarUrl())
.setTitle("Music Player!")
.setThumbnail(textChannel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("Next Song!\nSong: ``" + FormatUtil.filter(track.getInfo().title) + "``")
- .setFooter(getTextChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, getTextChannel().getGuild().getIconUrl()), 5, getTextChannel());
+ .setFooter(getChannel().asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, getChannel().asGuildMessageChannel().getGuild().getIconUrl()), 5, getChannel());
}
player.startTrack(track, false);
}
@@ -187,46 +188,46 @@ public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason
if (loopTrack != null && player != null) {
player.startTrack(loopTrack, false);
} else {
- if (getTextChannel() != null) {
+ if (getChannel() != null) {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
- .setAuthor(textChannel.getJDA().getSelfUser().getName(), Data.WEBSITE, textChannel.getJDA().getSelfUser().getAvatarUrl())
+ .setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle("Music Player!")
- .setThumbnail(textChannel.getJDA().getSelfUser().getAvatarUrl())
+ .setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.RED)
.setDescription("Error while playing: ``" + FormatUtil.filter(track.getInfo().title) + "``\nError: Track is not existing!")
- .setFooter(getTextChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, getTextChannel().getGuild().getIconUrl()), 5, getTextChannel());
+ .setFooter(getChannel().asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, getChannel().asGuildMessageChannel().getGuild().getIconUrl()), 5, getChannel());
}
- nextTrack(getTextChannel());
+ nextTrack(getChannel());
}
// If there was a error cancel the loop, and go to the next song in the playlist.
} else if (endReason == AudioTrackEndReason.LOAD_FAILED) {
- if (getTextChannel() != null) {
+ if (getChannel() != null) {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
- .setAuthor(textChannel.getJDA().getSelfUser().getName(), Data.WEBSITE, textChannel.getJDA().getSelfUser().getAvatarUrl())
+ .setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle("Music Player!")
- .setThumbnail(textChannel.getJDA().getSelfUser().getAvatarUrl())
+ .setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.RED)
.setDescription("Error while playing: ``" + FormatUtil.filter(track.getInfo().title) + "``\nError: " + endReason.name())
- .setFooter(getTextChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, getTextChannel().getGuild().getIconUrl()), 5, getTextChannel());
+ .setFooter(getChannel().asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, getChannel().asGuildMessageChannel().getGuild().getIconUrl()), 5, getChannel());
}
- nextTrack(getTextChannel());
+ nextTrack(getChannel());
}
} else {
// Check if a new song shoud be played or not.
if (endReason.mayStartNext) {
// check if there was an error on the current song if so inform user.
- if (endReason == AudioTrackEndReason.LOAD_FAILED && getTextChannel() != null) {
+ if (endReason == AudioTrackEndReason.LOAD_FAILED && getChannel() != null) {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
- .setAuthor(textChannel.getJDA().getSelfUser().getName(), Data.WEBSITE, textChannel.getJDA().getSelfUser().getAvatarUrl())
+ .setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle("Music Player!")
- .setThumbnail(textChannel.getJDA().getSelfUser().getAvatarUrl())
+ .setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.RED)
.setDescription("Error while playing: ``" + FormatUtil.filter(track.getInfo().title) + "``\nError: " + endReason.name())
- .setFooter(getTextChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, getTextChannel().getGuild().getIconUrl()), 5, getTextChannel());
+ .setFooter(getChannel().asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, getChannel().asGuildMessageChannel().getGuild().getIconUrl()), 5, getChannel());
}
- nextTrack(getTextChannel());
+ nextTrack(getChannel());
}
}
}
@@ -239,7 +240,7 @@ public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason
*/
public void stopAll(Guild guild, InteractionHook interactionHook) {
EmbedBuilder em = new EmbedBuilder();
- if (Main.getInstance().getMusicWorker().isConnected(getTextChannel().getGuild()) || getPlayer().getPlayingTrack() != null) {
+ if (Main.getInstance().getMusicWorker().isConnected(getChannel().asGuildMessageChannel().getGuild()) || getPlayer().getPlayingTrack() != null) {
GuildMusicManager gmm = Main.getInstance().getMusicWorker().getGuildAudioPlayer(guild);
@@ -248,20 +249,20 @@ public void stopAll(Guild guild, InteractionHook interactionHook) {
gmm.scheduler.clearQueue();
Main.getInstance().getMusicWorker().disconnect(guild);
- em.setAuthor(textChannel.getJDA().getSelfUser().getName(), Data.WEBSITE, textChannel.getJDA().getSelfUser().getAvatarUrl());
+ em.setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl());
em.setTitle("Music Player!");
- em.setThumbnail(textChannel.getJDA().getSelfUser().getAvatarUrl());
+ em.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl());
em.setColor(Color.GREEN);
em.setDescription("Successfully stopped the Player!");
} else {
- em.setAuthor(textChannel.getJDA().getSelfUser().getName(), Data.WEBSITE, textChannel.getJDA().getSelfUser().getAvatarUrl());
+ em.setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl());
em.setTitle("Music Player!");
- em.setThumbnail(textChannel.getJDA().getSelfUser().getAvatarUrl());
+ em.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl());
em.setColor(Color.RED);
em.setDescription("Im not playing any Music!");
}
em.setFooter(Data.ADVERTISEMENT);
- Main.getInstance().getCommandManager().sendMessage(em, 5, getTextChannel(), interactionHook);
+ Main.getInstance().getCommandManager().sendMessage(em, 5, getChannel(), interactionHook);
}
}
\ No newline at end of file
diff --git a/src/main/java/de/presti/ree6/commands/CommandEvent.java b/src/main/java/de/presti/ree6/commands/CommandEvent.java
index e5ae7da80..155ec2f15 100644
--- a/src/main/java/de/presti/ree6/commands/CommandEvent.java
+++ b/src/main/java/de/presti/ree6/commands/CommandEvent.java
@@ -4,6 +4,7 @@
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.TextChannel;
+import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.interactions.InteractionHook;
@@ -22,7 +23,7 @@ public class CommandEvent {
Message message;
// The Text channel which has been used, to fire the Event.
- TextChannel textChannel;
+ MessageChannelUnion channel;
// Argument that have been given.
String[] arguments;
@@ -39,11 +40,11 @@ public class CommandEvent {
* @param arguments the given Arguments.
* @param slashCommandInteractionEvent the {@link SlashCommandInteractionEvent} Entity.
*/
- public CommandEvent(Member member, Guild guild, Message message, TextChannel textChannel, String[] arguments, SlashCommandInteractionEvent slashCommandInteractionEvent) {
+ public CommandEvent(Member member, Guild guild, Message message, MessageChannelUnion textChannel, String[] arguments, SlashCommandInteractionEvent slashCommandInteractionEvent) {
this.member = member;
this.guild = guild;
this.message = message;
- this.textChannel = textChannel;
+ this.channel = textChannel;
this.arguments = arguments;
this.slashCommandInteractionEvent = slashCommandInteractionEvent;
}
@@ -76,8 +77,8 @@ public Message getMessage() {
* Get the {@link TextChannel} Entity associated with the Event.
* @return the {@link TextChannel} Entity.
*/
- public TextChannel getTextChannel() {
- return textChannel;
+ public MessageChannelUnion getChannel() {
+ return channel;
}
/**
diff --git a/src/main/java/de/presti/ree6/commands/CommandManager.java b/src/main/java/de/presti/ree6/commands/CommandManager.java
index 5ed7ffb3f..2de2d42c1 100644
--- a/src/main/java/de/presti/ree6/commands/CommandManager.java
+++ b/src/main/java/de/presti/ree6/commands/CommandManager.java
@@ -5,6 +5,7 @@
import de.presti.ree6.commands.exceptions.CommandInitializerException;
import de.presti.ree6.commands.impl.community.TwitchNotifier;
import de.presti.ree6.commands.impl.community.TwitterNotifier;
+import de.presti.ree6.commands.impl.fun.Record;
import de.presti.ree6.commands.impl.fun.*;
import de.presti.ree6.commands.impl.hidden.Addon;
import de.presti.ree6.commands.impl.info.Invite;
@@ -22,6 +23,7 @@
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.*;
+import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.interactions.InteractionHook;
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
@@ -43,6 +45,7 @@ public class CommandManager {
/**
* Constructor for the Command-Manager used to register every Command.
+ *
* @throws CommandInitializerException if an error occurs while initializing the Commands.
*/
public CommandManager() throws CommandInitializerException {
@@ -87,6 +90,7 @@ public CommandManager() throws CommandInitializerException {
addCommand(new SongList());
//Fun
+ addCommand(new Record());
addCommand(new RandomAnswer());
addCommand(new FunFact());
addCommand(new CatImage());
@@ -211,7 +215,7 @@ public ArrayList getCommands() {
* @param slashCommandInteractionEvent the Slash Command Event if it was a Slash Command.
* @return true, if a command has been performed.
*/
- public boolean perform(Member member, Guild guild, String messageContent, Message message, TextChannel textChannel, SlashCommandInteractionEvent slashCommandInteractionEvent) {
+ public boolean perform(Member member, Guild guild, String messageContent, Message message, MessageChannelUnion textChannel, SlashCommandInteractionEvent slashCommandInteractionEvent) {
// Check if the User is under Cooldown.
if (isTimeout(member.getUser())) {
@@ -266,7 +270,7 @@ public boolean perform(Member member, Guild guild, String messageContent, Messag
return true;
}
- private boolean performMessageCommand(Member member, Guild guild, String messageContent, Message message, TextChannel textChannel) {
+ private boolean performMessageCommand(Member member, Guild guild, String messageContent, Message message, MessageChannelUnion textChannel) {
// Check if the Message is null.
if (message == null) {
sendMessage("There was an error while executing the Command!", 5, textChannel, null);
@@ -385,7 +389,7 @@ public void sendMessage(String messageContent, int deleteSecond, MessageChannel
if (messageChannel == null) return;
if (messageChannel.canTalk())
messageChannel.sendMessage(messageContent).delay(deleteSecond, TimeUnit.SECONDS).flatMap(message -> {
- if (message != null && message.getTextChannel().retrieveMessageById(message.getId()).complete() != null) {
+ if (message != null && message.getChannel().retrieveMessageById(message.getId()).complete() != null) {
return message.delete();
}
@@ -443,7 +447,7 @@ public void sendMessage(EmbedBuilder embedBuilder, int deleteSecond, MessageChan
if (messageChannel == null) return;
if (messageChannel.canTalk())
messageChannel.sendMessageEmbeds(embedBuilder.build()).delay(deleteSecond, TimeUnit.SECONDS).flatMap(message -> {
- if (message != null && message.getTextChannel().retrieveMessageById(message.getId()).complete() != null) {
+ if (message != null && message.getChannel().retrieveMessageById(message.getId()).complete() != null) {
return message.delete();
}
@@ -461,12 +465,16 @@ public void sendMessage(EmbedBuilder embedBuilder, int deleteSecond, MessageChan
* @param interactionHook the Interaction-hook, if it is a slash event.
*/
public void deleteMessage(Message message, InteractionHook interactionHook) {
- if (message != null && message.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE) && message.getTextChannel().retrieveMessageById(message.getIdLong()).complete() != null && !message.isEphemeral() && interactionHook == null) {
- try {
- message.delete().queue();
- } catch (Exception ex) {
- Main.getInstance().getLogger().error("[CommandManager] Couldn't delete a Message!");
- }
+ if (message != null &&
+ message.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE) &&
+ message.getChannel().retrieveMessageById(message.getIdLong()).complete() != null &&
+ message.getType().canDelete() &&
+ !message.isEphemeral() &&
+ interactionHook == null) {
+ message.delete().onErrorFlatMap(throwable -> {
+ Main.getInstance().getLogger().error("[CommandManager] Couldn't delete a Message!", throwable);
+ return null;
+ }).queue();
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java
index d8d79a105..7400b1556 100644
--- a/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java
+++ b/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java
@@ -14,7 +14,7 @@ public class TwitchNotifier implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.isSlashCommand()) {
- Main.getInstance().getCommandManager().sendMessage("This Command doesn't support slash commands yet.", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("This Command doesn't support slash commands yet.", commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -28,47 +28,47 @@ public void onPerform(CommandEvent commandEvent) {
end.append("```");
- Main.getInstance().getCommandManager().sendMessage(end.toString(), 10, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(end.toString(), 10, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch list/add/remove", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else if (commandEvent.getArguments().length == 3) {
if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch add/remove TwitchName #Channel", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch add/remove TwitchName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
String name = commandEvent.getArguments()[1];
if (commandEvent.getArguments()[0].equalsIgnoreCase("add")) {
commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).createWebhook("Ree6-TwitchNotifier-" + name).queue(w -> Main.getInstance().getSqlConnector().getSqlWorker().addTwitchWebhook(commandEvent.getGuild().getId(), w.getId(), w.getToken(), name.toLowerCase()));
- Main.getInstance().getCommandManager().sendMessage("A TwitchStream Notifier has been created for the User " + name + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("A TwitchStream Notifier has been created for the User " + name + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
if (!Main.getInstance().getNotifier().isTwitchRegistered(name)) {
Main.getInstance().getNotifier().registerTwitchChannel(name);
}
} else if (commandEvent.getArguments()[0].equalsIgnoreCase("remove")) {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch remove TwitchName", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch remove TwitchName", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch add TwitchName #Channel", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch add TwitchName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else if (commandEvent.getArguments().length == 2) {
String name = commandEvent.getArguments()[1];
if (commandEvent.getArguments()[0].equalsIgnoreCase("remove")) {
Main.getInstance().getSqlConnector().getSqlWorker().removeTwitchWebhook(commandEvent.getGuild().getId(), name);
- Main.getInstance().getCommandManager().sendMessage("A TwitchStream Notifier has been removed from the User " + name + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("A TwitchStream Notifier has been removed from the User " + name + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
if (Main.getInstance().getNotifier().isTwitchRegistered(name)) {
Main.getInstance().getNotifier().unregisterTwitchChannel(name);
}
} else if (commandEvent.getArguments()[0].equalsIgnoreCase("add")) {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch add TwitchName #Channel", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch add TwitchName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch remove TwitchName", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch remove TwitchName", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch list/add/remove", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitch list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java
index f2394d9c7..3c48e6984 100644
--- a/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java
+++ b/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java
@@ -14,7 +14,7 @@ public class TwitterNotifier implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.isSlashCommand()) {
- Main.getInstance().getCommandManager().sendMessage("This Command doesn't support slash commands yet.", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("This Command doesn't support slash commands yet.", commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -28,47 +28,47 @@ public void onPerform(CommandEvent commandEvent) {
end.append("```");
- Main.getInstance().getCommandManager().sendMessage(end.toString(), 10, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(end.toString(), 10, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier list/add/remove", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else if(commandEvent.getArguments().length == 3) {
if (commandEvent.getMessage().getMentions().getChannels(TextChannel.class).isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier add/remove TwitterName #Channel", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier add/remove TwitterName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
String name = commandEvent.getArguments()[1];
if (commandEvent.getArguments()[0].equalsIgnoreCase("add")) {
commandEvent.getMessage().getMentions().getChannels(TextChannel.class).get(0).createWebhook("Ree6-TwitterNotifier-" + name).queue(w -> Main.getInstance().getSqlConnector().getSqlWorker().addTwitterWebhook(commandEvent.getGuild().getId(), w.getId(), w.getToken(), name.toLowerCase()));
- Main.getInstance().getCommandManager().sendMessage("A TwitterTweet Notifier has been created for the User " + name + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("A TwitterTweet Notifier has been created for the User " + name + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
if (!Main.getInstance().getNotifier().isTwitterRegistered(name)) {
Main.getInstance().getNotifier().registerTwitterUser(name);
}
} else if (commandEvent.getArguments()[0].equalsIgnoreCase("remove")) {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier remove TwitterName", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier remove TwitterName", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier add TwitterName #Channel", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier add TwitterName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else if(commandEvent.getArguments().length == 2) {
String name = commandEvent.getArguments()[1];
if(commandEvent.getArguments()[0].equalsIgnoreCase("remove")) {
Main.getInstance().getSqlConnector().getSqlWorker().removeTwitterWebhook(commandEvent.getGuild().getId(), name);
- Main.getInstance().getCommandManager().sendMessage("A TwitterTweet Notifier has been removed from the User " + name + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("A TwitterTweet Notifier has been removed from the User " + name + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
if (Main.getInstance().getNotifier().isTwitterRegistered(name)) {
Main.getInstance().getNotifier().unregisterTwitterUser(name);
}
} else if (commandEvent.getArguments()[0].equalsIgnoreCase("add")) {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier add TwitterName #Channel", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier add TwitterName #Channel", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier remove TwitterName", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier remove TwitterName", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier list/add/remove", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitternotifier list/add/remove", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/CatImage.java b/src/main/java/de/presti/ree6/commands/impl/fun/CatImage.java
index 1e6a79bd1..5ad51b695 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/CatImage.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/CatImage.java
@@ -3,8 +3,8 @@
import com.google.gson.JsonArray;
import de.presti.ree6.bot.BotWorker;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -27,7 +27,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setImage(js.get(0).getAsJsonObject().get("url").getAsString());
em.setFooter("Requested by " + commandEvent.getMember().getUser().getAsTag() + " - " + Data.ADVERTISEMENT, commandEvent.getMember().getUser().getAvatarUrl());
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Cringe.java b/src/main/java/de/presti/ree6/commands/impl/fun/Cringe.java
index cb4527945..3e2a26a0e 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/Cringe.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/Cringe.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.fun;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
@@ -12,7 +12,7 @@ public class Cringe implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
- commandEvent.getTextChannel().getHistoryBefore(commandEvent.getMessage().getId(), 1).complete().getRetrievedHistory().get(0).reply("https://images.ree6.de/cringe.gif").queue();
+ commandEvent.getChannel().getHistoryBefore(commandEvent.getMessage().getId(), 1).complete().getRetrievedHistory().get(0).reply("https://images.ree6.de/cringe.gif").queue();
if (commandEvent.isSlashCommand()) commandEvent.getInteractionHook().sendMessage("Check below!").queue();
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/DogImage.java b/src/main/java/de/presti/ree6/commands/impl/fun/DogImage.java
index 425dbb132..fc72bdd86 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/DogImage.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/DogImage.java
@@ -3,8 +3,8 @@
import com.google.gson.JsonObject;
import de.presti.ree6.bot.BotWorker;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -26,7 +26,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setImage(js.get("message").getAsString());
em.setFooter("Requested by " + commandEvent.getMember().getUser().getAsTag() + " - " + Data.ADVERTISEMENT, commandEvent.getMember().getUser().getAvatarUrl());
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/FunFact.java b/src/main/java/de/presti/ree6/commands/impl/fun/FunFact.java
index 211ce02fb..4376dea55 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/FunFact.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/FunFact.java
@@ -2,8 +2,8 @@
import com.google.gson.JsonObject;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
import de.presti.ree6.utils.external.RequestUtility;
@@ -16,7 +16,7 @@ public class FunFact implements ICommand {
public void onPerform(CommandEvent commandEvent) {
JsonObject js = RequestUtility.request(new RequestUtility.Request("https://useless-facts.sameerkumar.website/api")).getAsJsonObject();
- Main.getInstance().getCommandManager().sendMessage(js.get("data").getAsString(), commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(js.get("data").getAsString(), commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/FunnyCryptocurrencies.java b/src/main/java/de/presti/ree6/commands/impl/fun/FunnyCryptocurrencies.java
index d4c4444d1..a1b390957 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/FunnyCryptocurrencies.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/FunnyCryptocurrencies.java
@@ -39,7 +39,7 @@ public void onPerform(CommandEvent commandEvent) {
embedBuilder.addField("**DogeCoin**", dogeCoin + " USD", true);
embedBuilder.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(embedBuilder, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(embedBuilder, commandEvent.getChannel(), commandEvent.getInteractionHook());
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/HornyJail.java b/src/main/java/de/presti/ree6/commands/impl/fun/HornyJail.java
index 2e4a3e7d2..dfcb6035a 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/HornyJail.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/HornyJail.java
@@ -24,17 +24,17 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null) {
sendHornyJail(targetOption.getAsMember(), commandEvent);
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to put into the Hornyjail!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to put into the Hornyjail!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User given!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User given!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
sendHornyJail(commandEvent.getMessage().getMentions().getMembers().get(0), commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "hornyjail @User", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "hornyjail @User", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
@@ -51,11 +51,11 @@ public String[] getAlias() {
public void sendHornyJail(Member member, CommandEvent commandEvent) {
try {
- Main.getInstance().getCommandManager().sendMessage(member.getAsMention() + " is now in the Hornyjail!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- commandEvent.getTextChannel().sendFile(ImageCreationUtility.createHornyJailImage(member.getUser()), "hornyjail.png").queue();
+ Main.getInstance().getCommandManager().sendMessage(member.getAsMention() + " is now in the Hornyjail!", commandEvent.getChannel(), commandEvent.getInteractionHook());
+ commandEvent.getChannel().sendFile(ImageCreationUtility.createHornyJailImage(member.getUser()), "hornyjail.png").queue();
if (commandEvent.isSlashCommand()) commandEvent.getInteractionHook().sendMessage("Check below!").queue();
} catch (Exception ex) {
- Main.getInstance().getCommandManager().sendMessage("Error while putting someone in the Hornyjail!\nError: " + ex.getMessage().replaceAll(Main.getInstance().getConfig().getConfiguration().getString("dagpi.apitoken"), "Ree6TopSecretAPIToken"), commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Error while putting someone in the Hornyjail!\nError: " + ex.getMessage().replaceAll(Main.getInstance().getConfig().getConfiguration().getString("dagpi.apitoken"), "Ree6TopSecretAPIToken"), commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
\ No newline at end of file
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Hug.java b/src/main/java/de/presti/ree6/commands/impl/fun/Hug.java
index 7bc2cf132..1c7c11622 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/Hug.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/Hug.java
@@ -26,19 +26,19 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null && targetOption.getAsMember() != null) {
sendHug(targetOption.getAsMember(), commandEvent);
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to Hug!" , 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to Hug!" , 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "hug @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "hug @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
sendHug(commandEvent.getMessage().getMentions().getMembers().get(0), commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "hug @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "hug @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
@@ -54,7 +54,7 @@ public String[] getAlias() {
}
public void sendHug(Member member, CommandEvent commandEvent) {
- Main.getInstance().getCommandManager().sendMessage(commandEvent.getMember().getAsMention() + " hugged " + member.getAsMention(), commandEvent.getTextChannel(), null);
+ Main.getInstance().getCommandManager().sendMessage(commandEvent.getMember().getAsMention() + " hugged " + member.getAsMention(), commandEvent.getChannel(), null);
ImageProvider ip = Neko4JsAPI.imageAPI.getImageProvider();
@@ -64,7 +64,7 @@ public void sendHug(Member member, CommandEvent commandEvent) {
} catch (Exception ignored) {
}
- Main.getInstance().getCommandManager().sendMessage((im != null ? im.getUrl() : "https://images.ree6.de/notfound.png"), commandEvent.getTextChannel(), null);
+ Main.getInstance().getCommandManager().sendMessage((im != null ? im.getUrl() : "https://images.ree6.de/notfound.png"), commandEvent.getChannel(), null);
if (commandEvent.isSlashCommand()) commandEvent.getInteractionHook().sendMessage("Check below!").queue();
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Kiss.java b/src/main/java/de/presti/ree6/commands/impl/fun/Kiss.java
index 6c768b729..af2ca9afa 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/Kiss.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/Kiss.java
@@ -26,19 +26,19 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null && targetOption.getAsMember() != null) {
sendKiss(targetOption.getAsMember(), commandEvent);
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to Kiss!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to Kiss!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "kiss @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "kiss @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
sendKiss(commandEvent.getMessage().getMentions().getMembers().get(0), commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "kiss @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "kiss @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
@@ -56,7 +56,7 @@ public String[] getAlias() {
public void sendKiss(Member member, CommandEvent commandEvent) {
- Main.getInstance().getCommandManager().sendMessage(commandEvent.getMember().getAsMention() + " kissed " + member.getAsMention(), commandEvent.getTextChannel(), null);
+ Main.getInstance().getCommandManager().sendMessage(commandEvent.getMember().getAsMention() + " kissed " + member.getAsMention(), commandEvent.getChannel(), null);
ImageProvider ip = Neko4JsAPI.imageAPI.getImageProvider();
@@ -66,7 +66,7 @@ public void sendKiss(Member member, CommandEvent commandEvent) {
} catch (Exception ignored) {
}
- Main.getInstance().getCommandManager().sendMessage((im != null ? im.getUrl() : "https://images.ree6.de/notfound.png"), commandEvent.getTextChannel(), null);
+ Main.getInstance().getCommandManager().sendMessage((im != null ? im.getUrl() : "https://images.ree6.de/notfound.png"), commandEvent.getChannel(), null);
if (commandEvent.isSlashCommand()) commandEvent.getInteractionHook().sendMessage("Check below!").queue();
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/MemeImage.java b/src/main/java/de/presti/ree6/commands/impl/fun/MemeImage.java
index 09116ffd1..8d2001f05 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/MemeImage.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/MemeImage.java
@@ -3,8 +3,8 @@
import com.google.gson.JsonObject;
import de.presti.ree6.bot.BotWorker;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -32,7 +32,7 @@ public void onPerform(CommandEvent commandEvent) {
}
em.setFooter("Requested by " + commandEvent.getMember().getUser().getAsTag() + " - " + Data.ADVERTISEMENT, commandEvent.getMember().getUser().getAvatarUrl());
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Ping.java b/src/main/java/de/presti/ree6/commands/impl/fun/Ping.java
index d40862355..67acc8d01 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/Ping.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/Ping.java
@@ -12,7 +12,7 @@ public class Ping implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
- Main.getInstance().getCommandManager().sendMessage("Pong", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Pong", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/RandomAnswer.java b/src/main/java/de/presti/ree6/commands/impl/fun/RandomAnswer.java
index 24a2eb5e3..dabc44eba 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/RandomAnswer.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/RandomAnswer.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.fun;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
import de.presti.ree6.utils.data.ArrayUtil;
@@ -14,7 +14,7 @@ public class RandomAnswer implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
- Main.getInstance().getCommandManager().sendMessage(ArrayUtil.answers[RandomUtils.random.nextInt((ArrayUtil.answers.length - 1))], commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(ArrayUtil.answers[RandomUtils.random.nextInt((ArrayUtil.answers.length - 1))], commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Record.java b/src/main/java/de/presti/ree6/commands/impl/fun/Record.java
new file mode 100644
index 000000000..07ef09fe4
--- /dev/null
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/Record.java
@@ -0,0 +1,85 @@
+package de.presti.ree6.commands.impl.fun;
+
+import de.presti.ree6.audio.AudioPlayerReceiveHandler;
+import de.presti.ree6.audio.music.GuildMusicManager;
+import de.presti.ree6.commands.Category;
+import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
+import de.presti.ree6.commands.interfaces.ICommand;
+import de.presti.ree6.main.Main;
+import net.dv8tion.jda.api.entities.ChannelType;
+import net.dv8tion.jda.api.entities.GuildVoiceState;
+import net.dv8tion.jda.api.entities.VoiceChannel;
+import net.dv8tion.jda.api.interactions.commands.build.CommandData;
+import net.dv8tion.jda.api.managers.AudioManager;
+
+/**
+ * A command used to record the conversation of a voice channel.
+ */
+@Command(name = "record", description = "Record the voice channel!", category = Category.FUN)
+public class Record implements ICommand {
+
+ /**
+ * @inheritDoc
+ */
+ @Override
+ public void onPerform(CommandEvent commandEvent) {
+ if (commandEvent.getGuild().getAudioManager().isConnected()) {
+ GuildMusicManager guildMusicManager = Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild());
+ if (guildMusicManager == null || !guildMusicManager.getSendHandler().isMusicPlaying(commandEvent.getGuild())) {
+ AudioManager audioManager = commandEvent.getGuild().getAudioManager();
+
+ AudioPlayerReceiveHandler handler = (AudioPlayerReceiveHandler) audioManager.getReceivingHandler();
+
+ if (handler != null) {
+ handler.endReceiving();
+ } else {
+ commandEvent.getGuild().getAudioManager().closeAudioConnection();
+ }
+ Main.getInstance().getCommandManager().sendMessage("Recording stopped!", commandEvent.getChannel(), commandEvent.getInteractionHook());
+ } else {
+ Main.getInstance().getCommandManager().sendMessage("I am already in a channel!",
+ commandEvent.getChannel(), commandEvent.getInteractionHook());
+ }
+ } else {
+ connectAndRecord(commandEvent);
+ }
+ }
+
+ public void connectAndRecord(CommandEvent commandEvent) {
+ GuildVoiceState voiceState = commandEvent.getMember().getVoiceState();
+ if (voiceState != null &&
+ voiceState.inAudioChannel() &&
+ voiceState.getChannel().getType() == ChannelType.VOICE &&
+ voiceState.getChannel() instanceof VoiceChannel voiceChannel) {
+ AudioManager audioManager = commandEvent.getGuild().getAudioManager();
+ audioManager.openAudioConnection(voiceChannel);
+
+ AudioPlayerReceiveHandler handler = new AudioPlayerReceiveHandler(voiceChannel);
+
+ audioManager.setReceivingHandler(handler);
+
+ Main.getInstance().getCommandManager().sendMessage("I am now recording the voice channel!",
+ commandEvent.getChannel(), commandEvent.getInteractionHook());
+ } else {
+ Main.getInstance().getCommandManager().sendMessage("You are not in a voice channel!",
+ commandEvent.getChannel(), commandEvent.getInteractionHook());
+ }
+ }
+
+ /**
+ * @inheritDoc
+ */
+ @Override
+ public CommandData getCommandData() {
+ return null;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ @Override
+ public String[] getAlias() {
+ return new String[0];
+ }
+}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Slap.java b/src/main/java/de/presti/ree6/commands/impl/fun/Slap.java
index b0bc1d19d..c0c5372a1 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/Slap.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/Slap.java
@@ -26,19 +26,19 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null && targetOption.getAsMember() != null) {
sendSlap(targetOption.getAsMember(), commandEvent);
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to Slap!" , 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to Slap!" , 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "slap @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "slap @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
sendSlap(commandEvent.getMessage().getMentions().getMembers().get(0), commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "slap @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "slap @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
@@ -55,7 +55,7 @@ public String[] getAlias() {
}
public void sendSlap(Member member, CommandEvent commandEvent) {
- Main.getInstance().getCommandManager().sendMessage(commandEvent.getMember().getAsMention() + " slapped " + member.getAsMention(), commandEvent.getTextChannel(), null);
+ Main.getInstance().getCommandManager().sendMessage(commandEvent.getMember().getAsMention() + " slapped " + member.getAsMention(), commandEvent.getChannel(), null);
ImageProvider ip = Neko4JsAPI.imageAPI.getImageProvider();
@@ -65,7 +65,7 @@ public void sendSlap(Member member, CommandEvent commandEvent) {
} catch (Exception ignored) {
}
- Main.getInstance().getCommandManager().sendMessage((im != null ? im.getUrl() : "https://images.ree6.de/notfound.png"), commandEvent.getTextChannel(), null);
+ Main.getInstance().getCommandManager().sendMessage((im != null ? im.getUrl() : "https://images.ree6.de/notfound.png"), commandEvent.getChannel(), null);
if (commandEvent.isSlashCommand()) commandEvent.getInteractionHook().sendMessage("Check below!").queue();
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Twitter.java b/src/main/java/de/presti/ree6/commands/impl/fun/Twitter.java
index 116e1170e..d241566c5 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/Twitter.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/Twitter.java
@@ -31,14 +31,14 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null && contentOption != null) {
sendTwitterTweet(targetOption.getAsMember(), contentOption.getAsString(), commandEvent);
} else {
- if (targetOption == null) Main.getInstance().getCommandManager().sendMessage("No User was given to use for the Tweet!" , 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- if (contentOption == null) Main.getInstance().getCommandManager().sendMessage("No Tweet Content was given!" , 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ if (targetOption == null) Main.getInstance().getCommandManager().sendMessage("No User was given to use for the Tweet!" , 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ if (contentOption == null) Main.getInstance().getCommandManager().sendMessage("No Tweet Content was given!" , 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length >= 2) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User given!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User given!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
StringBuilder stringBuilder = new StringBuilder();
@@ -49,7 +49,7 @@ public void onPerform(CommandEvent commandEvent) {
sendTwitterTweet(commandEvent.getMessage().getMentions().getMembers().get(0), stringBuilder.toString(), commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitter @User Yourtexthere", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "twitter @User Yourtexthere", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
@@ -78,11 +78,11 @@ public void sendTwitterTweet(Member member, String content, CommandEvent command
request.setHeader("Authorization", Main.getInstance().getConfig().getConfiguration().getString("dagpi.apitoken"));
HttpResponse response = httpClient.execute(request);
- commandEvent.getTextChannel().sendFile(response.getEntity().getContent(), "twitter.png").queue();
+ commandEvent.getChannel().sendFile(response.getEntity().getContent(), "twitter.png").queue();
if (commandEvent.isSlashCommand()) commandEvent.getInteractionHook().sendMessage("Check below!").queue();
} catch (Exception ex) {
- Main.getInstance().getCommandManager().sendMessage("Error while creating the Tweet!\nError: " + ex.getMessage().replaceAll(Main.getInstance().getConfig().getConfiguration().getString("dagpi.apitoken"), "Ree6TopSecretAPIToken"), commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Error while creating the Tweet!\nError: " + ex.getMessage().replaceAll(Main.getInstance().getConfig().getConfiguration().getString("dagpi.apitoken"), "Ree6TopSecretAPIToken"), commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Waifu.java b/src/main/java/de/presti/ree6/commands/impl/fun/Waifu.java
index 1bb977d45..e74217452 100644
--- a/src/main/java/de/presti/ree6/commands/impl/fun/Waifu.java
+++ b/src/main/java/de/presti/ree6/commands/impl/fun/Waifu.java
@@ -2,8 +2,8 @@
import com.google.gson.JsonObject;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -27,7 +27,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setColor(Color.RED);
em.setDescription("There was a problem with the API-Server! If this continues please visit ");
em.setFooter(commandEvent.getMember().getUser().getAsTag() + " - " + Data.ADVERTISEMENT, commandEvent.getMember().getUser().getAvatarUrl());
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -41,7 +41,7 @@ public void onPerform(CommandEvent commandEvent) {
}
em.setFooter(commandEvent.getMember().getUser().getAsTag() + " - " + Data.ADVERTISEMENT, commandEvent.getMember().getUser().getAvatarUrl());
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/hidden/Addon.java b/src/main/java/de/presti/ree6/commands/impl/hidden/Addon.java
index 04a950529..3274e9ea5 100644
--- a/src/main/java/de/presti/ree6/commands/impl/hidden/Addon.java
+++ b/src/main/java/de/presti/ree6/commands/impl/hidden/Addon.java
@@ -1,6 +1,7 @@
package de.presti.ree6.commands.impl.hidden;
-import de.presti.ree6.commands.*;
+import de.presti.ree6.commands.Category;
+import de.presti.ree6.commands.CommandEvent;
import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
@@ -19,18 +20,18 @@ public void onPerform(CommandEvent commandEvent) {
.append(" ").append("for").append(" ").append("by").append(" ").append(addon.getAuthor()).append("\n");
}
stringBuilder.append("```");
- Main.getInstance().getCommandManager().sendMessage("List of all Addons: " + (stringBuilder.length() == 6 ? "None" : stringBuilder), commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("List of all Addons: " + (stringBuilder.length() == 6 ? "None" : stringBuilder), commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
if (commandEvent.getArguments()[0].equalsIgnoreCase("reload")) {
- Main.getInstance().getCommandManager().sendMessage("Reloading Addons ...", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Reloading Addons ...", commandEvent.getChannel(), commandEvent.getInteractionHook());
Main.getInstance().getAddonManager().reload();
- Main.getInstance().getCommandManager().sendMessage("Reloaded Addons!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Reloaded Addons!", commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Invalid Argument!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Invalid Argument!", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("This Command is not made for users.", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("This Command is not made for users.", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Credits.java b/src/main/java/de/presti/ree6/commands/impl/info/Credits.java
index d47aa7059..5d792ed72 100644
--- a/src/main/java/de/presti/ree6/commands/impl/info/Credits.java
+++ b/src/main/java/de/presti/ree6/commands/impl/info/Credits.java
@@ -1,6 +1,7 @@
package de.presti.ree6.commands.impl.info;
-import de.presti.ree6.commands.*;
+import de.presti.ree6.commands.Category;
+import de.presti.ree6.commands.CommandEvent;
import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
@@ -11,7 +12,7 @@ public class Credits implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
- Main.getInstance().getCommandManager().sendMessage("Lead Developer : Presti | 平和#0240\nSupport Developer : xazed | xazed#5014\ndavid. | david.#3120", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Lead Developer : Presti | 平和#0240\nSupport Developer : xazed | xazed#5014\ndavid. | david.#3120", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Help.java b/src/main/java/de/presti/ree6/commands/impl/info/Help.java
index 73e9c5305..8eb34e44c 100644
--- a/src/main/java/de/presti/ree6/commands/impl/info/Help.java
+++ b/src/main/java/de/presti/ree6/commands/impl/info/Help.java
@@ -73,7 +73,7 @@ public void sendHelpInformation(String categoryString, CommandEvent commandEvent
}
}
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Info.java b/src/main/java/de/presti/ree6/commands/impl/info/Info.java
index dd80d88f2..c5f81b0d9 100644
--- a/src/main/java/de/presti/ree6/commands/impl/info/Info.java
+++ b/src/main/java/de/presti/ree6/commands/impl/info/Info.java
@@ -28,20 +28,20 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null && targetOption.getAsMember() != null) {
sendInfo(targetOption.getAsMember(), commandEvent);
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to get the Data from!" , 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to get the Data from!" , 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "info @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "info @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
sendInfo(commandEvent.getMessage().getMentions().getMembers().get(0), commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "info @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "info @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
@@ -69,6 +69,6 @@ public void sendInfo(Member member, CommandEvent commandEvent) {
em.setFooter("Requested by " + commandEvent.getMember().getUser().getAsTag() + " - " + Data.ADVERTISEMENT, commandEvent.getMember().getUser().getAvatarUrl());
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Invite.java b/src/main/java/de/presti/ree6/commands/impl/info/Invite.java
index aafbea78a..f00bccbe1 100644
--- a/src/main/java/de/presti/ree6/commands/impl/info/Invite.java
+++ b/src/main/java/de/presti/ree6/commands/impl/info/Invite.java
@@ -1,6 +1,7 @@
package de.presti.ree6.commands.impl.info;
-import de.presti.ree6.commands.*;
+import de.presti.ree6.commands.Category;
+import de.presti.ree6.commands.CommandEvent;
import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
@@ -11,7 +12,7 @@ public class Invite implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
- Main.getInstance().getCommandManager().sendMessage("https://invite.ree6.de", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("https://invite.ree6.de", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Optout.java b/src/main/java/de/presti/ree6/commands/impl/info/Optout.java
index 24523d2d6..62165749e 100644
--- a/src/main/java/de/presti/ree6/commands/impl/info/Optout.java
+++ b/src/main/java/de/presti/ree6/commands/impl/info/Optout.java
@@ -13,7 +13,7 @@ public class Optout implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
Main.getInstance().getCommandManager().sendMessage("This command is yet to be implemented.",
- commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ commandEvent.getChannel(), commandEvent.getInteractionHook());
/* Main.getInstance().getCommandManager().sendMessage("You have successfully opted out of any data collection on this Guild.",
commandEvent.getTextChannel(), commandEvent.getInteractionHook());*/
diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Server.java b/src/main/java/de/presti/ree6/commands/impl/info/Server.java
index 633ca8d14..8b5280bc6 100644
--- a/src/main/java/de/presti/ree6/commands/impl/info/Server.java
+++ b/src/main/java/de/presti/ree6/commands/impl/info/Server.java
@@ -1,7 +1,8 @@
package de.presti.ree6.commands.impl.info;
import de.presti.ree6.bot.BotWorker;
-import de.presti.ree6.commands.*;
+import de.presti.ree6.commands.Category;
+import de.presti.ree6.commands.CommandEvent;
import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
@@ -35,9 +36,9 @@ public void onPerform(CommandEvent commandEvent) {
em.addField(":earth_africa: **Other**", "**Verification-level:** " + commandEvent.getGuild().getVerificationLevel().getKey(), true);
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else
- Main.getInstance().getCommandManager().sendMessage("You dont have ADMINISTRATOR Permissions for this Command!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You dont have ADMINISTRATOR Permissions for this Command!", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Stats.java b/src/main/java/de/presti/ree6/commands/impl/info/Stats.java
index 148ed6c6d..81cb5a5c1 100644
--- a/src/main/java/de/presti/ree6/commands/impl/info/Stats.java
+++ b/src/main/java/de/presti/ree6/commands/impl/info/Stats.java
@@ -1,7 +1,8 @@
package de.presti.ree6.commands.impl.info;
import de.presti.ree6.bot.BotWorker;
-import de.presti.ree6.commands.*;
+import de.presti.ree6.commands.Category;
+import de.presti.ree6.commands.CommandEvent;
import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
@@ -69,7 +70,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Support.java b/src/main/java/de/presti/ree6/commands/impl/info/Support.java
index a10546bfd..158a19553 100644
--- a/src/main/java/de/presti/ree6/commands/impl/info/Support.java
+++ b/src/main/java/de/presti/ree6/commands/impl/info/Support.java
@@ -1,6 +1,7 @@
package de.presti.ree6.commands.impl.info;
-import de.presti.ree6.commands.*;
+import de.presti.ree6.commands.Category;
+import de.presti.ree6.commands.CommandEvent;
import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
@@ -11,7 +12,7 @@ public class Support implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
- Main.getInstance().getCommandManager().sendMessage("Join our Support Discord Server!\nhttps://support.ree6.de/", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Join our Support Discord Server!\nhttps://support.ree6.de/", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/level/Leaderboards.java b/src/main/java/de/presti/ree6/commands/impl/level/Leaderboards.java
index 708a9c3dd..3ac54b3d5 100644
--- a/src/main/java/de/presti/ree6/commands/impl/level/Leaderboards.java
+++ b/src/main/java/de/presti/ree6/commands/impl/level/Leaderboards.java
@@ -17,7 +17,7 @@ public void onPerform(CommandEvent commandEvent) {
"chat leaderboard: \n" +
"Please noted that you have to be logged in to see these stats, reason for this is Discords Guidelines.\n" +
"If you want to read more about this please visit: ",
- commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/level/Level.java b/src/main/java/de/presti/ree6/commands/impl/level/Level.java
index 5a43bf5ca..6dc6d9f30 100644
--- a/src/main/java/de/presti/ree6/commands/impl/level/Level.java
+++ b/src/main/java/de/presti/ree6/commands/impl/level/Level.java
@@ -39,8 +39,8 @@ public void onPerform(CommandEvent commandEvent) {
sendLevel(commandEvent.getMessage().getMentions().getMembers().get(0), commandEvent, typ);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "level chat/voice or " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "level chat/voice @user", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "level chat/voice or " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "level chat/voice @user", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
@@ -67,13 +67,13 @@ public void sendLevel(Member member, CommandEvent commandEvent, String type) {
try {
commandEvent.getInteractionHook().sendFile(ImageCreationUtility.createRankImage(userLevel), "rank.png").queue();
} catch (Exception ignore) {
- Main.getInstance().getCommandManager().sendMessage("Couldn't generated Rank Image!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Couldn't generated Rank Image!", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
try {
- commandEvent.getTextChannel().sendFile(ImageCreationUtility.createRankImage(userLevel), "rank.png").queue();
+ commandEvent.getChannel().sendFile(ImageCreationUtility.createRankImage(userLevel), "rank.png").queue();
} catch (Exception ignore) {
- Main.getInstance().getCommandManager().sendMessage("Couldn't generated Rank Image!", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Couldn't generated Rank Image!", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Ban.java b/src/main/java/de/presti/ree6/commands/impl/mod/Ban.java
index 53efa1f6d..5b7062ab1 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Ban.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Ban.java
@@ -20,7 +20,7 @@ public class Ban implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (!commandEvent.getGuild().getSelfMember().hasPermission(Permission.BAN_MEMBERS)) {
- Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -37,13 +37,13 @@ public void onPerform(CommandEvent commandEvent) {
banMember(targetOption.getAsMember(), null, commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to Ban!" , 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to Ban!" , 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length > 0) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "ban @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "ban @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
if (commandEvent.getArguments().length == 1) {
banMember(commandEvent.getMessage().getMentions().getMembers().get(0), null, commandEvent);
@@ -57,12 +57,12 @@ public void onPerform(CommandEvent commandEvent) {
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "ban @user [reason]", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "ban @user [reason]", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
@@ -85,13 +85,13 @@ public String[] getAlias() {
public void banMember(Member member, String reason, CommandEvent commandEvent) {
if (commandEvent.getGuild().getSelfMember().canInteract(member) && commandEvent.getMember().canInteract(member)) {
- Main.getInstance().getCommandManager().sendMessage("User " + member.getAsMention() + " has been banned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("User " + member.getAsMention() + " has been banned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
commandEvent.getGuild().ban(member, 7, reason).queue();
} else {
if (commandEvent.getGuild().getSelfMember().canInteract(member)) {
- Main.getInstance().getCommandManager().sendMessage("Couldn't ban this User because he has the same or a higher Rank then you!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Couldn't ban this User because he has the same or a higher Rank then you!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Couldn't ban this User because he has a higher Rank then me!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Couldn't ban this User because he has a higher Rank then me!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/ChatProtector.java b/src/main/java/de/presti/ree6/commands/impl/mod/ChatProtector.java
index 38ddf6495..f8c7b0893 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/ChatProtector.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/ChatProtector.java
@@ -20,7 +20,7 @@ public class ChatProtector implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.isSlashCommand()) {
- Main.getInstance().getCommandManager().sendMessage("This Command doesn't support slash commands yet.", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("This Command doesn't support slash commands yet.", commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -28,11 +28,11 @@ public void onPerform(CommandEvent commandEvent) {
if(commandEvent.getArguments().length >= 1) {
if(commandEvent.getArguments().length == 1) {
if(commandEvent.getArguments()[0].equalsIgnoreCase("add")) {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add WORD WORD2 WORD3 AND MORE WORDS", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add WORD WORD2 WORD3 AND MORE WORDS", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else if(commandEvent.getArguments()[0].equalsIgnoreCase("remove")) {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector remove WORD", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector remove WORD", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else if (commandEvent.getArguments()[0].equalsIgnoreCase("list")) {
if(de.presti.ree6.addons.impl.ChatProtector.isChatProtectorSetup(commandEvent.getGuild().getId())) {
StringBuilder end = new StringBuilder();
@@ -41,14 +41,14 @@ public void onPerform(CommandEvent commandEvent) {
end.append("\n").append(s);
}
- Main.getInstance().getCommandManager().sendMessage("```" + end + "```", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("```" + end + "```", commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Your ChatProtector isn't setuped!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add WORD WORD2 WORD3 AND MORE WORDS", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Your ChatProtector isn't setuped!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add WORD WORD2 WORD3 AND MORE WORDS", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Couldn't find " + commandEvent.getArguments()[0] + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add/remove/list", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Couldn't find " + commandEvent.getArguments()[0] + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add/remove/list", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if(commandEvent.getArguments()[0].equalsIgnoreCase("add")) {
@@ -60,25 +60,25 @@ public void onPerform(CommandEvent commandEvent) {
end.append("\n").append(commandEvent.getArguments()[i]);
}
de.presti.ree6.addons.impl.ChatProtector.blacklist(commandEvent.getGuild().getId(), words);
- Main.getInstance().getCommandManager().sendMessage("The Wordlist has been added to your ChatProtector!\nYour Wordlist:\n```" + end + "```", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("The Wordlist has been added to your ChatProtector!\nYour Wordlist:\n```" + end + "```", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
de.presti.ree6.addons.impl.ChatProtector.blacklist(commandEvent.getGuild().getId(), commandEvent.getArguments()[1]);
- Main.getInstance().getCommandManager().sendMessage("The Word " + commandEvent.getArguments()[1] + " has been added to your ChatProtector!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("The Word " + commandEvent.getArguments()[1] + " has been added to your ChatProtector!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else if(commandEvent.getArguments()[0].equalsIgnoreCase("remove")) {
de.presti.ree6.addons.impl.ChatProtector.removeFromBlacklist(commandEvent.getGuild().getId(), commandEvent.getArguments()[1]);
- Main.getInstance().getCommandManager().sendMessage("The Word " + commandEvent.getArguments()[1] + " has been removed from your ChatProtector!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("The Word " + commandEvent.getArguments()[1] + " has been removed from your ChatProtector!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Couldn't find " + commandEvent.getArguments()[0] + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add/remove/list", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Couldn't find " + commandEvent.getArguments()[0] + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add/remove/list", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add/remove/list", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "chatprotector add/remove/list", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Clear.java b/src/main/java/de/presti/ree6/commands/impl/mod/Clear.java
index bf5001f92..f5f7367a3 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Clear.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Clear.java
@@ -20,7 +20,7 @@ public class Clear implements ICommand {
public void onPerform(CommandEvent commandEvent) {
if (!commandEvent.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
- Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -39,20 +39,20 @@ public void onPerform(CommandEvent commandEvent) {
if (amount <= 100 && amount >= 2) {
deleteMessages(commandEvent, amount);
} else {
- Main.getInstance().getCommandManager().sendMessage(commandEvent.getArguments()[0] + " isn't between 2 and 100 !", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(commandEvent.getArguments()[0] + " isn't between 2 and 100 !", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} catch (Exception ex) {
- Main.getInstance().getCommandManager().sendMessage(commandEvent.getArguments()[0] + " isn't a number!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(commandEvent.getArguments()[0] + " isn't a number!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
@@ -73,21 +73,21 @@ public void deleteMessages(CommandEvent commandEvent, int amount) {
if (amount <= 200 && amount >= 2) {
try {
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
- commandEvent.getTextChannel().getIterableHistory().takeAsync(amount).thenAccept(messages -> {
- commandEvent.getTextChannel().purgeMessages(messages);
- Main.getInstance().getCommandManager().sendMessage("Successfully deleted " + messages.size() + " Messages!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ commandEvent.getChannel().getIterableHistory().takeAsync(amount).thenAccept(messages -> {
+ commandEvent.getChannel().purgeMessages(messages);
+ Main.getInstance().getCommandManager().sendMessage("Successfully deleted " + messages.size() + " Messages!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}).exceptionally(throwable -> {
- Main.getInstance().getCommandManager().sendMessage("An Error occurred while deleting the Messages!\nError: " + throwable.getMessage(), 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("An Error occurred while deleting the Messages!\nError: " + throwable.getMessage(), 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return null;
});
} catch (IllegalArgumentException exception) {
- Main.getInstance().getCommandManager().sendMessage("" + (exception.toString().toLowerCase().startsWith("java.lang.illegalargumentexception: must provide at") ? "Given Parameter is either above 100 or below 2!" : "Error while deleting:" + exception.toString().split(":")[1]), 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("" + (exception.toString().toLowerCase().startsWith("java.lang.illegalargumentexception: must provide at") ? "Given Parameter is either above 100 or below 2!" : "Error while deleting:" + exception.toString().split(":")[1]), 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} catch (Exception exception) {
- Main.getInstance().getCommandManager().sendMessage("Error while deleting:" + exception.toString().split(":")[1], 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Error while deleting:" + exception.toString().split(":")[1], 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage(amount + " isn't between 2 and 100 !", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(amount + " isn't between 2 and 100 !", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "clear 2-100", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/ClearData.java b/src/main/java/de/presti/ree6/commands/impl/mod/ClearData.java
index a50692409..1ea4dda19 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/ClearData.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/ClearData.java
@@ -23,7 +23,7 @@ public void onPerform(CommandEvent commandEvent) {
Main.getInstance().getSqlConnector().getSqlWorker().clearInvites(commandEvent.getGuild().getId());
if (commandEvent.getGuild().getSelfMember().hasPermission(Permission.MANAGE_SERVER))
commandEvent.getGuild().retrieveInvites().queue(invites -> invites.stream().filter(invite -> invite.getInviter() != null).forEach(invite -> Main.getInstance().getSqlConnector().getSqlWorker().setInvite(commandEvent.getGuild().getId(), invite.getInviter().getId(), invite.getCode(), invite.getUses())));
- Main.getInstance().getCommandManager().sendMessage("All stored Invites have been cleared, and replaced.", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("All stored Invites have been cleared, and replaced.", commandEvent.getChannel(), commandEvent.getInteractionHook());
new Thread(() -> {
try {
Thread.sleep(Duration.ofMinutes(10).toMillis());
@@ -31,10 +31,10 @@ public void onPerform(CommandEvent commandEvent) {
timeout.remove(commandEvent.getGuild().getId());
}).start();
} else {
- Main.getInstance().getCommandManager().sendMessage("You already used this Command in the last 10 Minutes, please wait until you use it again.", commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You already used this Command in the last 10 Minutes, please wait until you use it again.", commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Kick.java b/src/main/java/de/presti/ree6/commands/impl/mod/Kick.java
index a114267e3..134682a8a 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Kick.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Kick.java
@@ -20,7 +20,7 @@ public class Kick implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (!commandEvent.getGuild().getSelfMember().hasPermission(Permission.KICK_MEMBERS)) {
- Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -34,25 +34,25 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null) {
kickMember(targetOption.getAsMember(), (reasonOption != null ? reasonOption.getAsString() : "No Reason given!"), commandEvent);
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to Kick!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to Kick!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length <= 1 && commandEvent.getArguments().length <= 2) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "kick @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "kick @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
String reason = commandEvent.getArguments().length == 2 ? commandEvent.getArguments()[1] : "No Reason given!";
kickMember(commandEvent.getMessage().getMentions().getMembers().get(0), reason, commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "kick @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "kick @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
@@ -73,13 +73,13 @@ public String[] getAlias() {
public void kickMember(Member member, String reason, CommandEvent commandEvent) {
if (commandEvent.getGuild().getSelfMember().canInteract(member) && commandEvent.getMember().canInteract(member)) {
- Main.getInstance().getCommandManager().sendMessage("User " + member.getAsMention() + " has been kicked!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("User " + member.getAsMention() + " has been kicked!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
commandEvent.getGuild().kick(member).reason(reason).queue();
} else {
if (commandEvent.getGuild().getSelfMember().canInteract(member)) {
- Main.getInstance().getCommandManager().sendMessage("Couldn't kick this User because he has the same or a higher Rank then you!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Couldn't kick this User because he has the same or a higher Rank then you!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Couldn't kick this User because he has a higher Rank then me!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Couldn't kick this User because he has a higher Rank then me!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Mute.java b/src/main/java/de/presti/ree6/commands/impl/mod/Mute.java
index 181a0c248..11d36b08f 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Mute.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Mute.java
@@ -22,7 +22,7 @@ public class Mute implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (!commandEvent.getGuild().getSelfMember().hasPermission(Permission.MODERATE_MEMBERS)) {
- Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -39,26 +39,26 @@ public void onPerform(CommandEvent commandEvent) {
try {
time = timeOption.getAsLong();
} catch (Exception ignore) {
- Main.getInstance().getCommandManager().sendMessage("The given Time is not a valid Number!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("The given Time is not a valid Number!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
Duration duration = Duration.ofMinutes(time);
muteMember(commandEvent.getMember(), targetOption.getAsMember(), duration, (reasonOption != null ? reasonOption.getAsString() : "No Reason given!"), commandEvent);
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to Mute!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to Mute!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length <= 2 && commandEvent.getArguments().length <= 3) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "mute @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "mute @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
long time;
try {
time = Long.parseLong(commandEvent.getArguments()[1]);
} catch (Exception ignore) {
- Main.getInstance().getCommandManager().sendMessage("The given Time is not a valid Number!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("The given Time is not a valid Number!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
Duration duration = Duration.ofMinutes(time);
@@ -66,12 +66,12 @@ public void onPerform(CommandEvent commandEvent) {
muteMember(commandEvent.getMember(), commandEvent.getMessage().getMentions().getMembers().get(0), duration, reason, commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "mute @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "mute @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
@@ -94,16 +94,16 @@ public void muteMember(Member executor, Member member, Duration duration, String
if (executor.canInteract(member) && commandEvent.getGuild().getSelfMember().canInteract(member)) {
member.timeoutFor(duration).reason(reason).onErrorFlatMap(throwable -> {
- Main.getInstance().getCommandManager().sendMessage("Couldn't mute " + member.getAsMention() + "!\nReason: " + throwable.getMessage(), commandEvent.getTextChannel()
+ Main.getInstance().getCommandManager().sendMessage("Couldn't mute " + member.getAsMention() + "!\nReason: " + throwable.getMessage(), commandEvent.getChannel()
, commandEvent.getInteractionHook());
return null;
- }).queue(unused -> Main.getInstance().getCommandManager().sendMessage(member.getAsMention() + " was muted for " + duration.getSeconds() + " seconds!", commandEvent.getTextChannel()
+ }).queue(unused -> Main.getInstance().getCommandManager().sendMessage(member.getAsMention() + " was muted for " + duration.getSeconds() + " seconds!", commandEvent.getChannel()
, commandEvent.getInteractionHook()));
} else {
if (!executor.canInteract(member)) {
- Main.getInstance().getCommandManager().sendMessage("I couldn't timeout the Member, because you do not have enough permissions!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("I couldn't timeout the Member, because you do not have enough permissions!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("I couldn't timeout the Member, because I do not have enough permissions for this!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("I couldn't timeout the Member, because I do not have enough permissions for this!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Prefix.java b/src/main/java/de/presti/ree6/commands/impl/mod/Prefix.java
index 07b8ffce6..44dc05150 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Prefix.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Prefix.java
@@ -26,21 +26,21 @@ public void onPerform(CommandEvent commandEvent) {
if (prefixOption != null) {
Main.getInstance().getSqlConnector().getSqlWorker().setSetting(commandEvent.getGuild().getId(), "chatprefix", prefixOption.getAsString());
- Main.getInstance().getCommandManager().sendMessage("Your new Prefix has been set to: " + prefixOption.getAsString(), 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Your new Prefix has been set to: " + prefixOption.getAsString(), 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "prefix PREFIX", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "prefix PREFIX", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length != 1) {
- Main.getInstance().getCommandManager().sendMessage((commandEvent.getArguments().length < 1 ? "Not enough" : "Too many") + " Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "prefix PREFIX", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage((commandEvent.getArguments().length < 1 ? "Not enough" : "Too many") + " Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "prefix PREFIX", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
Main.getInstance().getSqlConnector().getSqlWorker().setSetting(commandEvent.getGuild().getId(), "chatprefix", commandEvent.getArguments()[0]);
- Main.getInstance().getCommandManager().sendMessage("Your new Prefix has been set to: " + commandEvent.getArguments()[0], 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Your new Prefix has been set to: " + commandEvent.getArguments()[0], 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You don't have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java b/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java
index e6ca11078..6052dc36d 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java
@@ -45,11 +45,11 @@ public void onPerform(CommandEvent commandEvent) {
commandEvent.getInteractionHook().sendMessageEmbeds(embedBuilder.build())
.addActionRow(selectMenu).queue();
} else {
- commandEvent.getTextChannel().sendMessageEmbeds(embedBuilder.build())
+ commandEvent.getChannel().sendMessageEmbeds(embedBuilder.build())
.setActionRows(ActionRow.of(selectMenu)).queue();
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Unban.java b/src/main/java/de/presti/ree6/commands/impl/mod/Unban.java
index 3e884ace1..8fe237367 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Unban.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Unban.java
@@ -29,12 +29,12 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null) {
try {
commandEvent.getGuild().unban(UserSnowflake.fromId(targetOption.getAsString())).queue();
- Main.getInstance().getCommandManager().sendMessage("User <@" + targetOption.getAsString() + "> has been unbanned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("User <@" + targetOption.getAsString() + "> has been unbanned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} catch (Exception ignored) {
- Main.getInstance().getCommandManager().sendMessage("Received a Invalid UserID", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Received a Invalid UserID", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to Unban!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to Unban!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
@@ -42,17 +42,17 @@ public void onPerform(CommandEvent commandEvent) {
try {
String userId = commandEvent.getArguments()[0];
commandEvent.getGuild().unban(UserSnowflake.fromId(userId)).queue();
- Main.getInstance().getCommandManager().sendMessage("User <@" + userId + "> has been unbanned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("User <@" + userId + "> has been unbanned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} catch (Exception ignored) {
- Main.getInstance().getCommandManager().sendMessage("Received a Invalid UserID", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Received a Invalid UserID", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "unban @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "unban @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Unmute.java b/src/main/java/de/presti/ree6/commands/impl/mod/Unmute.java
index 0884f05d6..bcdac1234 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Unmute.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Unmute.java
@@ -21,7 +21,7 @@ public class Unmute implements ICommand {
public void onPerform(CommandEvent commandEvent) {
if (!commandEvent.getGuild().getSelfMember().hasPermission(Permission.MODERATE_MEMBERS)) {
- Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("It seems like I do not have the permissions to do that :/\nPlease re-invite me!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -34,24 +34,24 @@ public void onPerform(CommandEvent commandEvent) {
if (targetOption != null) {
unmuteMember(commandEvent.getMember(), targetOption.getAsMember(), commandEvent);
} else {
- Main.getInstance().getCommandManager().sendMessage("No User was given to Unmute!" , 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User was given to Unmute!" , 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
if (commandEvent.getArguments().length == 1) {
if (commandEvent.getMessage().getMentions().getMembers().isEmpty()) {
- Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "unmute @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("No User mentioned!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "unmute @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
unmuteMember(commandEvent.getMember(), commandEvent.getMessage().getMentions().getMembers().get(0), commandEvent);
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
- Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "unmute @user", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Not enough Arguments!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Use " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "unmute @user", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
- Main.getInstance().getCommandManager().sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
@@ -73,17 +73,17 @@ public void unmuteMember(Member executor, Member member, CommandEvent commandEve
if (executor.canInteract(member) && commandEvent.getGuild().getSelfMember().canInteract(member)) {
member.removeTimeout().onErrorFlatMap(throwable -> {
- Main.getInstance().getCommandManager().sendMessage("Could not unmute " + member.getUser().getAsTag() + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Could not unmute " + member.getUser().getAsTag() + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return null;
}).queue(unused -> {
- Main.getInstance().getCommandManager().sendMessage("User " + member.getAsMention() + " was unmuted!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("User " + member.getAsMention() + " was unmuted!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
});
- Main.getInstance().getCommandManager().sendMessage("User " + member.getAsMention() + " has been unmuted!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("User " + member.getAsMention() + " has been unmuted!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
if (!executor.canInteract(member)) {
- Main.getInstance().getCommandManager().sendMessage("You cannot unmute " + member.getUser().getAsTag() + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You cannot unmute " + member.getUser().getAsTag() + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("I cannot unmute " + member.getUser().getAsTag() + "!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("I cannot unmute " + member.getUser().getAsTag() + "!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Webinterface.java b/src/main/java/de/presti/ree6/commands/impl/mod/Webinterface.java
index 00b6f538a..cbc25f208 100644
--- a/src/main/java/de/presti/ree6/commands/impl/mod/Webinterface.java
+++ b/src/main/java/de/presti/ree6/commands/impl/mod/Webinterface.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.mod;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
import net.dv8tion.jda.api.Permission;
@@ -15,9 +15,9 @@ public class Webinterface implements ICommand {
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.getMember().hasPermission(Permission.ADMINISTRATOR) && commandEvent.getMember().hasPermission(Permission.MANAGE_SERVER)) {
- Main.getInstance().getCommandManager().sendMessage("Please visit ", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Please visit ", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage("You can't use this Command you need the following Permissions: Administrator and Manage Server", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("You can't use this Command you need the following Permissions: Administrator and Manage Server", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
Main.getInstance().getCommandManager().deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Clearqueue.java b/src/main/java/de/presti/ree6/commands/impl/music/Clearqueue.java
index 8e86c291c..3ea37a343 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Clearqueue.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Clearqueue.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -31,7 +31,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setDescription("The Queue has been cleaned!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).scheduler.clearQueue();
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Disconnect.java b/src/main/java/de/presti/ree6/commands/impl/music/Disconnect.java
index 76ae581c5..d84ec6dda 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Disconnect.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Disconnect.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -34,7 +34,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setDescription("Im not playing any Music!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Loop.java b/src/main/java/de/presti/ree6/commands/impl/music/Loop.java
index c35b57dbc..c93d424b9 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Loop.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Loop.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -17,7 +17,7 @@ public class Loop implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (!Main.getInstance().getMusicWorker().isConnected(commandEvent.getGuild())) {
- Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to loop!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to loop!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
if (Main.getInstance().getMusicWorker().checkInteractPermission(commandEvent)) {
@@ -38,7 +38,7 @@ public void onPerform(CommandEvent commandEvent) {
: "Song Loop has been deactivated!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Lyrics.java b/src/main/java/de/presti/ree6/commands/impl/music/Lyrics.java
index 240a6a4bf..eb153a460 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Lyrics.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Lyrics.java
@@ -24,7 +24,7 @@ public class Lyrics implements ICommand {
public void onPerform(CommandEvent commandEvent) {
if (!Main.getInstance().getMusicWorker().isConnected(commandEvent.getGuild())) {
- Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to see the lyrics of!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to see the lyrics of!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
AudioPlayerSendHandler sendingHandler = (AudioPlayerSendHandler) commandEvent.getGuild().getAudioManager().getSendingHandler();
@@ -43,7 +43,7 @@ public void onPerform(CommandEvent commandEvent) {
commandEvent.getGuild().getJDA().getSelfUser().getAvatarUrl()).setTitle("Music Player!")
.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getAvatarUrl()).setColor(Color.RED)
.setDescription("Couldn't find the Lyrics for ``" + FormatUtil.filter(title) + "``.")
- .setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl()), 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ .setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl()), 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
return;
}
@@ -51,7 +51,7 @@ public void onPerform(CommandEvent commandEvent) {
.setAuthor(lyrics.getAuthor())
.setTitle(lyrics.getTitle(), lyrics.getURL());
if (lyrics.getContent().length() > 15000) {
- Main.getInstance().getCommandManager().sendMessage("Lyrics for `" + FormatUtil.filter(title) + "` found but likely not correct: " + lyrics.getURL(), commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Lyrics for `" + FormatUtil.filter(title) + "` found but likely not correct: " + lyrics.getURL(), commandEvent.getChannel(), commandEvent.getInteractionHook());
} else if (lyrics.getContent().length() > 2000) {
String content = lyrics.getContent().trim();
while (content.length() > 2000) {
@@ -62,15 +62,15 @@ public void onPerform(CommandEvent commandEvent) {
index = content.lastIndexOf(" ", 2000);
if (index == -1)
index = 2000;
- Main.getInstance().getCommandManager().sendMessage(eb.setDescription(content.substring(0, index).trim()), commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(eb.setDescription(content.substring(0, index).trim()), commandEvent.getChannel(), commandEvent.getInteractionHook());
content = content.substring(index).trim();
eb.setAuthor(null).setTitle(null, null);
eb.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
}
- Main.getInstance().getCommandManager().sendMessage(eb.setDescription(content), commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(eb.setDescription(content), commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getCommandManager().sendMessage(eb.setDescription(lyrics.getContent()), commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(eb.setDescription(lyrics.getContent()), commandEvent.getChannel(), commandEvent.getInteractionHook());
}
});
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Pause.java b/src/main/java/de/presti/ree6/commands/impl/music/Pause.java
index 019eff833..38e7f34a3 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Pause.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Pause.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -18,7 +18,7 @@ public class Pause implements ICommand {
public void onPerform(CommandEvent commandEvent) {
if (!Main.getInstance().getMusicWorker().isConnected(commandEvent.getGuild())) {
- Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to pause!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to pause!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
if (!Main.getInstance().getMusicWorker().checkInteractPermission(commandEvent)) {
@@ -36,7 +36,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setColor(Color.GREEN);
em.setDescription("Song has been paused!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Play.java b/src/main/java/de/presti/ree6/commands/impl/music/Play.java
index d945b6f30..fe5ede208 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Play.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Play.java
@@ -47,7 +47,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setColor(Color.GREEN);
em.setDescription("Usage: " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "play (Url)");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
} else {
@@ -61,7 +61,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setColor(Color.GREEN);
em.setDescription("Usage: " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue() + "play (Url)");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
playSong(commandEvent.getArguments()[0], commandEvent);
}
@@ -94,7 +94,7 @@ public void playSong(String value, CommandEvent commandEvent) {
}
if (!isspotify) {
- Main.getInstance().getMusicWorker().loadAndPlay(commandEvent.getTextChannel(), Objects.requireNonNull(commandEvent.getMember().getVoiceState()).getChannel(), value, commandEvent.getInteractionHook());
+ Main.getInstance().getMusicWorker().loadAndPlay(commandEvent.getChannel(), Objects.requireNonNull(commandEvent.getMember().getVoiceState()).getChannel(), value, commandEvent.getInteractionHook());
} else {
ArrayList loadFailed = new ArrayList<>();
@@ -112,10 +112,10 @@ public void playSong(String value, CommandEvent commandEvent) {
loadFailed.add(search);
} else {
if (!tempBoolean) {
- Main.getInstance().getMusicWorker().loadAndPlay(commandEvent.getTextChannel(), Objects.requireNonNull(commandEvent.getMember().getVoiceState()).getChannel(), result, commandEvent.getInteractionHook());
+ Main.getInstance().getMusicWorker().loadAndPlay(commandEvent.getChannel(), Objects.requireNonNull(commandEvent.getMember().getVoiceState()).getChannel(), result, commandEvent.getInteractionHook());
tempBoolean = true;
} else {
- Main.getInstance().getMusicWorker().loadAndPlaySilence(commandEvent.getTextChannel(), Objects.requireNonNull(commandEvent.getMember().getVoiceState()).getChannel(), result, commandEvent.getInteractionHook());
+ Main.getInstance().getMusicWorker().loadAndPlaySilence(commandEvent.getChannel(), Objects.requireNonNull(commandEvent.getMember().getVoiceState()).getChannel(), result, commandEvent.getInteractionHook());
}
}
}
@@ -128,7 +128,7 @@ public void playSong(String value, CommandEvent commandEvent) {
em.setColor(Color.GREEN);
em.setDescription("We couldn't find ``" + loadFailed.size() + "`` Songs!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
} else {
@@ -154,7 +154,7 @@ public void playSong(String value, CommandEvent commandEvent) {
em.setColor(Color.RED);
em.setDescription("We had an Issue searching for the Song, please try again in 15 minutes!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
Main.getInstance().getLogger().error("Error while searching for " + search + " on YouTube", exception);
return;
}
@@ -167,9 +167,9 @@ public void playSong(String value, CommandEvent commandEvent) {
em.setColor(Color.YELLOW);
em.setDescription("A Song with the Name ``" + FormatUtil.filter(search.toString()) + "`` couldn't be found!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
} else {
- Main.getInstance().getMusicWorker().loadAndPlay(commandEvent.getTextChannel(), Objects.requireNonNull(commandEvent.getMember().getVoiceState()).getChannel(), ytResult, commandEvent.getInteractionHook());
+ Main.getInstance().getMusicWorker().loadAndPlay(commandEvent.getChannel(), Objects.requireNonNull(commandEvent.getMember().getVoiceState()).getChannel(), ytResult, commandEvent.getInteractionHook());
}
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Resume.java b/src/main/java/de/presti/ree6/commands/impl/music/Resume.java
index f9af3e6d4..07620c23e 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Resume.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Resume.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -17,7 +17,7 @@ public class Resume implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (!Main.getInstance().getMusicWorker().isConnected(commandEvent.getGuild())) {
- Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to resume!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to resume!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
if (!Main.getInstance().getMusicWorker().checkInteractPermission(commandEvent)) {
@@ -36,7 +36,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setDescription("Song is going to be resumed!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Shuffle.java b/src/main/java/de/presti/ree6/commands/impl/music/Shuffle.java
index 9f64a623f..e3b6be82b 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Shuffle.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Shuffle.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -17,7 +17,7 @@ public class Shuffle implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (!Main.getInstance().getMusicWorker().isConnected(commandEvent.getGuild())) {
- Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to shuffle!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to shuffle!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
if (!Main.getInstance().getMusicWorker().checkInteractPermission(commandEvent)) {
@@ -37,7 +37,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setDescription("The current Song-Queue has been shuffled!");
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Skip.java b/src/main/java/de/presti/ree6/commands/impl/music/Skip.java
index 603a8697f..a6f99936f 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Skip.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Skip.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Main;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
@@ -13,14 +13,14 @@ public class Skip implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (!Main.getInstance().getMusicWorker().isConnected(commandEvent.getGuild())) {
- Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to skip!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to skip!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
if (!Main.getInstance().getMusicWorker().checkInteractPermission(commandEvent)) {
return;
}
- Main.getInstance().getMusicWorker().skipTrack(commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getMusicWorker().skipTrack(commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/SongInfo.java b/src/main/java/de/presti/ree6/commands/impl/music/SongInfo.java
index 2dbaaa600..ad4f1cd8d 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/SongInfo.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/SongInfo.java
@@ -37,7 +37,7 @@ public void onPerform(CommandEvent commandEvent) {
FormatUtil.volumeIcon(guildMusicManager.player.getVolume()));
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/SongList.java b/src/main/java/de/presti/ree6/commands/impl/music/SongList.java
index 30a5961e3..a9c49b8d4 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/SongList.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/SongList.java
@@ -2,8 +2,8 @@
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -35,7 +35,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setDescription(Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).scheduler.getQueue().isEmpty() ? "No Song in the Queue" : (end.length() > 4096 ? "Error (M-SL-01)" : "Songs: " + end));
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Stop.java b/src/main/java/de/presti/ree6/commands/impl/music/Stop.java
index 762dbdbcd..c099713a1 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Stop.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Stop.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -26,7 +26,7 @@ public void onPerform(CommandEvent commandEvent) {
commandEvent.getGuild().getJDA().getSelfUser().getAvatarUrl()).setTitle("Music Player!")
.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.RED)
- .setDescription("Im not playing any Music!"), 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ .setDescription("Im not playing any Music!"), 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Volume.java b/src/main/java/de/presti/ree6/commands/impl/music/Volume.java
index de2ae824a..0821680b2 100644
--- a/src/main/java/de/presti/ree6/commands/impl/music/Volume.java
+++ b/src/main/java/de/presti/ree6/commands/impl/music/Volume.java
@@ -1,8 +1,8 @@
package de.presti.ree6.commands.impl.music;
import de.presti.ree6.commands.Category;
-import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.CommandEvent;
+import de.presti.ree6.commands.interfaces.Command;
import de.presti.ree6.commands.interfaces.ICommand;
import de.presti.ree6.main.Data;
import de.presti.ree6.main.Main;
@@ -10,8 +10,8 @@
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
-import net.dv8tion.jda.internal.interactions.CommandDataImpl;
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
+import net.dv8tion.jda.internal.interactions.CommandDataImpl;
import java.awt.*;
@@ -21,7 +21,7 @@ public class Volume implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
if (!Main.getInstance().getMusicWorker().isConnected(commandEvent.getGuild())) {
- Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to set the volume for!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Im not connected to any Channel, so there is nothing to set the volume for!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
if (!Main.getInstance().getMusicWorker().checkInteractPermission(commandEvent)) {
@@ -87,7 +87,7 @@ public void onPerform(CommandEvent commandEvent) {
em.setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl());
- Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage(em, 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
@Override
diff --git a/src/main/java/de/presti/ree6/commands/impl/nsfw/NSFW.java b/src/main/java/de/presti/ree6/commands/impl/nsfw/NSFW.java
index 6f300c73b..32c2d88d5 100644
--- a/src/main/java/de/presti/ree6/commands/impl/nsfw/NSFW.java
+++ b/src/main/java/de/presti/ree6/commands/impl/nsfw/NSFW.java
@@ -12,6 +12,7 @@
import de.presti.ree6.utils.external.RequestUtility;
import de.presti.ree6.utils.others.RandomUtils;
import net.dv8tion.jda.api.EmbedBuilder;
+import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
@@ -25,11 +26,11 @@ public class NSFW implements ICommand {
@Override
public void onPerform(CommandEvent commandEvent) {
- if (commandEvent.getTextChannel().isNSFW()) {
+ if (commandEvent.getChannel().getType() == ChannelType.TEXT && commandEvent.getChannel().asTextChannel().isNSFW()) {
Message message = commandEvent.isSlashCommand() ?
commandEvent.getInteractionHook().sendMessage("Searching for Image...").complete() :
- commandEvent.getTextChannel().sendMessage("Searching for Image...").complete();
+ commandEvent.getChannel().sendMessage("Searching for Image...").complete();
JsonElement jsonElement = RequestUtility.request(new RequestUtility.Request("https://www.reddit.com/r/hentai/new.json?sort=hot&limit=50"));
@@ -74,7 +75,7 @@ public void onPerform(CommandEvent commandEvent) {
if (commandEvent.isSlashCommand()) {
message.editMessage("Image found!").queue();
- Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getTextChannel(), null);
+ Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), null);
} else {
message.editMessageEmbeds(em.build()).queue(message1 -> message1.editMessage("Image found!").queue());
}
@@ -85,7 +86,7 @@ public void onPerform(CommandEvent commandEvent) {
message.editMessage("We received an Invalid response from Reddit? Please try again later!").delay(Duration.ofSeconds(5)).flatMap(Message::delete).queue();
}
} else {
- Main.getInstance().getCommandManager().sendMessage("Only available in NSFW Channels!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
+ Main.getInstance().getCommandManager().sendMessage("Only available in NSFW Channels!", 5, commandEvent.getChannel(), commandEvent.getInteractionHook());
}
}
diff --git a/src/main/java/de/presti/ree6/events/LoggingEvents.java b/src/main/java/de/presti/ree6/events/LoggingEvents.java
index 4fb49424c..d27898aca 100644
--- a/src/main/java/de/presti/ree6/events/LoggingEvents.java
+++ b/src/main/java/de/presti/ree6/events/LoggingEvents.java
@@ -701,7 +701,7 @@ public void onMessageDelete(@Nonnull MessageDeleteEvent event) {
wm.append("The Message had Attachments, please be careful when checking them out!\n");
}
- we.setDescription(":wastebasket: **Message of " + user.getAsMention() + " in " + event.getTextChannel().getAsMention() + " has been deleted.**\n" +
+ we.setDescription(":wastebasket: **Message of " + user.getAsMention() + " in " + event.getChannel().getAsMention() + " has been deleted.**\n" +
(message != null ? message.getContentRaw().length() >= 650 ? "Message is too long to display!" : message.getContentRaw() : ""));
if (message != null && message.getContentRaw().length() >= 650) wm.addFile("message.txt", message.getContentRaw().getBytes(StandardCharsets.UTF_8));
diff --git a/src/main/java/de/presti/ree6/events/OtherEvents.java b/src/main/java/de/presti/ree6/events/OtherEvents.java
index 977f0095e..108b61d02 100644
--- a/src/main/java/de/presti/ree6/events/OtherEvents.java
+++ b/src/main/java/de/presti/ree6/events/OtherEvents.java
@@ -125,7 +125,7 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
if (ChatProtector.isChatProtectorSetup(event.getGuild().getId()) &&
ChatProtector.checkMessage(event.getGuild().getId(), event.getMessage().getContentRaw())) {
Main.getInstance().getCommandManager().deleteMessage(event.getMessage(), null);
- Main.getInstance().getCommandManager().sendMessage("You can't write that!", event.getTextChannel(), null);
+ Main.getInstance().getCommandManager().sendMessage("You can't write that!", event.getChannel(), null);
return;
}
@@ -140,7 +140,7 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
}
- if (!Main.getInstance().getCommandManager().perform(event.getMember(), event.getGuild(), event.getMessage().getContentRaw(), event.getMessage(), event.getTextChannel(), null)) {
+ if (!Main.getInstance().getCommandManager().perform(event.getMember(), event.getGuild(), event.getMessage().getContentRaw(), event.getMessage(), event.getChannel(), null)) {
if (!event.getMessage().getMentions().getUsers().isEmpty() && event.getMessage().getMentions().getUsers().contains(event.getJDA().getSelfUser())) {
event.getChannel().sendMessage("Usage " + Main.getInstance().getSqlConnector().getSqlWorker().getSetting(event.getGuild().getId(), "chatprefix").getStringValue() + "help").queue();
@@ -184,7 +184,7 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
event.deferReply(true).queue();
- Main.getInstance().getCommandManager().perform(Objects.requireNonNull(event.getMember()), event.getGuild(), null, null, event.getTextChannel(), event);
+ Main.getInstance().getCommandManager().perform(Objects.requireNonNull(event.getMember()), event.getGuild(), null, null, event.getChannel(), event);
}
@Override
diff --git a/src/main/java/de/presti/ree6/main/Main.java b/src/main/java/de/presti/ree6/main/Main.java
index dcd41f7bb..8f4c0e465 100644
--- a/src/main/java/de/presti/ree6/main/Main.java
+++ b/src/main/java/de/presti/ree6/main/Main.java
@@ -133,7 +133,7 @@ public static void main(String[] args) {
// Create a new Instance of the Bot, as well as add the Events.
try {
- BotWorker.createBot(BotVersion.PUBLIC, "1.7.17");
+ BotWorker.createBot(BotVersion.DEV, "1.7.17");
instance.musicWorker = new MusicWorker();
instance.addEvents();
} catch (Exception ex) {
diff --git a/src/main/java/de/presti/ree6/utils/data/AudioUtil.java b/src/main/java/de/presti/ree6/utils/data/AudioUtil.java
new file mode 100644
index 000000000..c6b897916
--- /dev/null
+++ b/src/main/java/de/presti/ree6/utils/data/AudioUtil.java
@@ -0,0 +1,51 @@
+package de.presti.ree6.utils.data;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.AudioSystem;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * A utility class to work with Audio files.
+ */
+public class AudioUtil {
+
+ /**
+ * Constructor for the AudioUtil class.
+ */
+ private AudioUtil() {
+ throw new IllegalStateException("Utility class");
+ }
+
+ /**
+ * WAV sample rate.
+ */
+ private static final long SAMPLE_RATE = 48000L;
+
+ /**
+ * Audio channels.
+ */
+ private static final int CHANNELS = 2;
+
+ /**
+ * Convert a PCM ByteBuffer into a WAV encoded byte array.
+ * @param byteBuffer The PCM ByteBuffer.
+ * @return The WAV encoded byte array.
+ * @throws IOException If an error occurs.
+ */
+ public static byte[] convert(ByteBuffer byteBuffer) throws IOException {
+ AudioInputStream audioInputStream =
+ AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED,
+ new AudioInputStream(new ByteArrayInputStream(byteBuffer.array()),
+ new AudioFormat(SAMPLE_RATE, 16, CHANNELS, true, true), byteBuffer.limit()));
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+
+ AudioSystem.write(audioInputStream, AudioFileFormat.Type.WAVE, byteArrayOutputStream);
+
+ return byteArrayOutputStream.toByteArray();
+ }
+}