Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c52ba94
Undocumented start of the new Game.
DxsSucuk Nov 29, 2022
9193b5f
Added the Azura EventBus for further implementation.
DxsSucuk Nov 29, 2022
ba28f98
Removed Azura Event bus since it is not needed.
DxsSucuk Nov 29, 2022
d1152b6
Merge branch 'master' into feature/music-quiz
DxsSucuk Nov 29, 2022
91ace2e
Code preparation.
DxsSucuk Nov 29, 2022
df28ed6
Code preparation.
DxsSucuk Nov 29, 2022
55d3c17
Code preparation and End-Game leaderboard.
DxsSucuk Nov 30, 2022
7e3f607
Code preparation and Game-Core upgrade.
DxsSucuk Nov 30, 2022
0abd3f1
Added automatic message deletion after notification.
DxsSucuk Nov 30, 2022
9c344df
Documentation and code clean up.
DxsSucuk Nov 30, 2022
f6f8ea3
Added TODO.
DxsSucuk Nov 30, 2022
860ace4
Added function to skip songs in the Music Quiz.
DxsSucuk Nov 30, 2022
a11cc4f
Merge branch 'master' into feature/music-quiz
DxsSucuk Dec 12, 2022
fe04d99
Merge branch 'master' into feature/music-quiz
DxsSucuk Dec 28, 2022
2a3eccc
Merge branch 'master' into feature/music-quiz
DxsSucuk Jan 3, 2023
0484926
More work!
DxsSucuk Jan 10, 2023
a9b38f5
Merge branch 'master' into feature/music-quiz
DxsSucuk Jan 12, 2023
7642463
Merge branch 'master' into feature/music-quiz
DxsSucuk Jan 16, 2023
4bbf950
Merge branch 'master' into feature/music-quiz
DxsSucuk Jan 26, 2023
35cc7ac
Fixing.
DxsSucuk Jan 26, 2023
c77e129
Merge branch 'master' into feature/music-quiz
DxsSucuk Jan 26, 2023
3c95f5f
Switch version.
DxsSucuk Jan 26, 2023
c80c262
Merge branch 'master' into feature/music-quiz
DxsSucuk Jan 27, 2023
20e35ea
Added an internal timer and a time playback.
DxsSucuk Jan 27, 2023
e17eca4
Merge remote-tracking branch 'origin/feature/music-quiz' into feature…
DxsSucuk Jan 27, 2023
49caf79
Fixing the file
DxsSucuk Jan 27, 2023
878e594
Fixing some search stuff.
DxsSucuk Jan 27, 2023
f0c82b4
Fixing up some stupid errors and cleaning up.
DxsSucuk Jan 27, 2023
73c23c0
More fix up of bad code!
DxsSucuk Jan 27, 2023
a645577
Fixing up a bug that would allow users to play music and would force …
DxsSucuk Jan 27, 2023
f1e07fb
Added leave logic.
DxsSucuk Jan 27, 2023
dd74ea7
Merge branch 'master' into feature/music-quiz
DxsSucuk Jan 27, 2023
ef014a9
Added a leave option?
DxsSucuk Jan 27, 2023
a2bb836
cleaning up code!
DxsSucuk Jan 27, 2023
8aa7f86
Made it ready for release.
DxsSucuk Jan 27, 2023
e350245
Code cleanup!
DxsSucuk Jan 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion languages/en-GB.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language:
name: "English (UK)"
locale: "en-GB"
version: "2.1.12"
version: "2.2.0"
author: "Presti"
logging:
banned: ":airplane_departure: %s **banned.**"
Expand Down Expand Up @@ -133,6 +133,7 @@ label:
voice: "Voice"
startGame: "Start Game"
joinGame: "Join Game"
leaveGame: "Leave Game"
blackJack: "BlackJack"
hit: "Hit"
stand: "Stand"
Expand Down Expand Up @@ -176,6 +177,9 @@ label:
game: "Game"
viewer: "Viewer"
more: "More"
skip: "Skip"
musicQuiz: "Music Quiz"
position: "Position %s"
message:
default:
usage: "Usage {guild_prefix}%s."
Expand Down Expand Up @@ -439,6 +443,16 @@ message:
removed: "Successfully removed the Reaction-Role for the Role %s!"
roleAdded: "You have received the Role %s!"
roleRemoved: "You have lost the Role %s!"
musicQuiz:
welcome: "Welcome to Music Quiz! You can start the game by clicking the button below!\nBefore you can start it thou, you will need someone else to play with you!\nThey will need to use /game join %s to join the game!\nOr press the button below!"
foundTitle: "You have guessed the Title it was %s! You receive 1pts"
foundArtists: "You have guessed the Artists it was %s! You receive 2pts"
foundFeature: "You have guessed a Feature it was %s! You receive 3pts"
foundAll: "Everything has been guessed!"
skipSong: "The Song has been skipped!"
finishedSong: "The current Song has ended, it was %s by %s! Lets start with the next one!"
newSong: "Guess the Title(1pts), the Artists(2pts) or a Feature (3pts)"
points: "%s reached %s pts"
announcement:
added: "Successfully added the Announcement!"
game:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<dependency>
<groupId>com.github.DxsSucuk</groupId>
<artifactId>YoutubeWrapper</artifactId>
<version>a5c55e7b2f</version>
<version>5a839de905</version>
</dependency>

<!-- Database -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class GuildMusicManager {
* Audio player for the guild.
*/
private final AudioPlayer player;

/**
* Track scheduler for the player.
*/
Expand Down
87 changes: 65 additions & 22 deletions src/main/java/de/presti/ree6/audio/music/MusicWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import java.util.HashMap;
import java.util.Map;

//TODO:: translate

/**
* Wrapper class that handles most Music related stuff.
*/
Expand Down Expand Up @@ -91,6 +93,19 @@ public void loadAndPlaySilence(final MessageChannelUnion channel, final AudioCha
loadAndPlay(channel, audioChannel, trackUrl, interactionHook, true);
}

/**
* Play or add a Song to the Queue without a Message.
*
* @param channel the TextChannel where the command has been performed, used for errors.
* @param audioChannel the AudioChannel for the Bot to join.
* @param trackUrl the Track URL.
* @param interactionHook a InteractionHook if it was an SlashCommand.
* @param silent if the Bot shouldn't send a Message.
*/
public void loadAndPlay(final MessageChannelUnion channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook, boolean silent) {
loadAndPlay(channel, audioChannel, trackUrl, interactionHook, silent, false);
}

/**
* Play or add a Song to the Queue with a Message.
*
Expand All @@ -100,7 +115,7 @@ public void loadAndPlaySilence(final MessageChannelUnion channel, final AudioCha
* @param interactionHook a InteractionHook if it was an SlashCommand.
* @param silent if the Bot shouldn't send a Message.
*/
public void loadAndPlay(final MessageChannelUnion channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook, boolean silent) {
public void loadAndPlay(final MessageChannelUnion channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook, boolean silent, boolean force) {
GuildMusicManager musicManager = getGuildAudioPlayer(channel.asGuildMessageChannel().getGuild());

musicManager.getScheduler().setChannel(channel);
Expand All @@ -116,13 +131,13 @@ public void trackLoaded(AudioTrack track) {
if (!silent)
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
.setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(),"label.musicPlayer"))
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(), "label.musicPlayer"))
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("The Song ``" + FormatUtil.filter(track.getInfo().title) + "`` has been added to the Queue!")
.setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);

play(audioChannel, musicManager, track);
play(audioChannel, musicManager, track, force);
}

/**
Expand All @@ -141,13 +156,13 @@ public void playlistLoaded(AudioPlaylist playlist) {
if (!silent)
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
.setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(),"label.musicPlayer"))
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(), "label.musicPlayer"))
.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.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);

play(audioChannel, musicManager, firstTrack);
play(audioChannel, musicManager, firstTrack, force);

if (playlist.getTracks().size() > 1) {
for (AudioTrack tracks : playlist.getTracks()) {
Expand All @@ -164,7 +179,7 @@ public void noMatches() {
if (!silent)
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
.setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(),"label.musicPlayer"))
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(), "label.musicPlayer"))
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("A Song with the URL ``" + FormatUtil.filter(trackUrl) + "`` couldn't be found!")
Expand All @@ -176,13 +191,14 @@ public void noMatches() {
*/
@Override
public void loadFailed(FriendlyException exception) {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
.setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(),"label.musicPlayer"))
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("Error while playing: " + exception.getMessage())
.setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
if (!silent)
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder()
.setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(), "label.musicPlayer"))
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("Error while playing: " + exception.getMessage())
.setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
}
});
}
Expand All @@ -195,10 +211,23 @@ public void loadFailed(FriendlyException exception) {
* @param track the AudioTrack that should be played.
*/
public void play(AudioChannel audioChannel, GuildMusicManager musicManager, AudioTrack track) {
play(audioChannel, musicManager, track, false);
}

/**
* The simple Audio play method, used to Queue songs and let the Bot join the Audio-channel if not present.
*
* @param audioChannel the Audio-channel for the Bot.
* @param musicManager the Music-Manager of the Guild.
* @param track the AudioTrack that should be played.
* @param force if the Track should be played immediately.
*/
public void play(AudioChannel audioChannel, GuildMusicManager musicManager, AudioTrack track, boolean force) {
connectToAudioChannel(musicManager.getGuild().getAudioManager(), audioChannel);
musicManager.getScheduler().queue(track);
musicManager.getScheduler().queue(track, force);
}


/**
* A method use to skip the current AudioTrack that is played.
*
Expand All @@ -207,14 +236,28 @@ public void play(AudioChannel audioChannel, GuildMusicManager musicManager, Audi
* @param skipAmount the amount of Tracks that should be skipped.
*/
public void skipTrack(MessageChannelUnion channel, InteractionHook interactionHook, int skipAmount) {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder().setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(),"label.musicPlayer"))
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("Skipping to the next Song!")
.setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);

getGuildAudioPlayer(channel.asGuildMessageChannel().getGuild()).getScheduler().nextTrack(channel, skipAmount);
skipTrack(channel, interactionHook, skipAmount, false);
}

/**
* A method use to skip the current AudioTrack that is played.
*
* @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.
* @param skipAmount the amount of Tracks that should be skipped.
* @param silent if the skip should be silent or not.
*/
public void skipTrack(MessageChannelUnion channel, InteractionHook interactionHook, int skipAmount, boolean silent) {
if (!silent) {
Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder().setAuthor(channel.getJDA().getSelfUser().getName(), Data.WEBSITE, channel.getJDA().getSelfUser().getAvatarUrl())
.setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(), "label.musicPlayer"))
.setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl())
.setColor(Color.GREEN)
.setDescription("Skipping to the next Song!")
.setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.ADVERTISEMENT, channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook);
}

getGuildAudioPlayer(channel.asGuildMessageChannel().getGuild()).getScheduler().nextTrack(channel, skipAmount, silent);
}

/**
Expand Down
Loading