Skip to content

Commit

Permalink
Merge pull request #328 from KittyBot-Org/feature/new-filters
Browse files Browse the repository at this point in the history
new filters
  • Loading branch information
topi314 authored Jul 25, 2021
2 parents cfdbc61 + f829e0a commit 6689ef2
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
implementation 'dev.mlnr:BotListHandler-jda:2.0.0_8'

// audio
implementation('com.github.KittyBot-Org:Lavalink-Client:176ca86') {
implementation('com.github.KittyBot-Org:Lavalink-Client:d48f1a6') {
exclude group: 'com.sedmelluq', module: 'lavaplayer'
}
implementation 'com.sedmelluq:lavaplayer:1.3.78'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public FilterCommand(){
new VibratoCommand(),
new RotationCommand(),
new DistortionCommand(),
new ChannelMixCommand(),
new LowPassCommand(),
new ClearCommand()
);
}
Expand Down Expand Up @@ -262,6 +264,70 @@ public void run(Options options, GuildInteraction ia){

}

private static class ChannelMixCommand extends GuildSubCommand{

public ChannelMixCommand(){
super("channel-mix", "Mixes both channels, with a configurable factor on how much each channel affects the other.");
addOptions(
new CommandOptionFloat("left-to-left", "How much audio from the left channel goes to the left channel"),
new CommandOptionFloat("left-to-right", "How much audio from the left channel goes to the right channel"),
new CommandOptionFloat("right-to-left", "How much audio from the right channel goes to the left channel"),
new CommandOptionFloat("right-to-right", "How much audio from the right channel goes to the right channel")
);
}

@Override
public void run(Options options, GuildInteraction ia){
var scheduler = ia.get(MusicModule.class).getScheduler(ia.getGuildId());
if(!MusicUtils.checkCommandRequirements(ia, scheduler) || !MusicUtils.checkMusicPermissions(ia, scheduler)){
return;
}
var channelMix = new ChannelMix();
if(options.has("left-to-left")){
channelMix = channelMix.setLeftToLeft(options.getFloat("left-to-left"));
}
if(options.has("left-to-right")){
channelMix = channelMix.setLeftToRight(options.getFloat("left-to-right"));
}
if(options.has("right-to-left")){
channelMix = channelMix.setRightToLeft(options.getFloat("right-to-left"));
}
if(options.has("right-to-right")){
channelMix = channelMix.setRightToLeft(options.getFloat("right-to-right"));
}

scheduler.getFilters().setChannelMix(channelMix).commit();
ia.reply("Set channel-mix filter");
}

}

private static class LowPassCommand extends GuildSubCommand{

public LowPassCommand(){
super("low-pass", "Higher frequencies get suppressed, while lower frequencies pass through this filter.");
addOptions(
new CommandOptionFloat("smoothing", "The smoothing level")
);
}

@Override
public void run(Options options, GuildInteraction ia){
var scheduler = ia.get(MusicModule.class).getScheduler(ia.getGuildId());
if(!MusicUtils.checkCommandRequirements(ia, scheduler) || !MusicUtils.checkMusicPermissions(ia, scheduler)){
return;
}
var lowPass = new LowPass();
if(options.has("smoothing")){
lowPass = lowPass.setSmoothing(options.getFloat("smoothing"));
}

scheduler.getFilters().setLowPass(lowPass).commit();
ia.reply("Set low-pass filter");
}

}

private static class ClearCommand extends GuildSubCommand{

public ClearCommand(){
Expand Down
1 change: 0 additions & 1 deletion src/main/java/de/kittybot/kittybot/main/KittyBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public KittyBot() throws IOException, MissingConfigValuesException, LoginExcepti
.addBotList(BotList.TOP_GG, Config.TOP_GG_TOKEN)
.addBotList(BotList.DBOATS, Config.DISCORD_BOATS_TOKEN)
.addBotList(BotList.DISCORDLIST_SPACE, Config.BOTLIST_SPACE_TOKEN)
.addBotList(BotList.BOTS_FOR_DISCORD, Config.BOTS_FOR_DISCORD_TOKEN)
.addBotList(BotList.DSERVICES, Config.DISCORD_SERVICES_TOKEN)
.addBotList(BotList.DBL, Config.DISCORD_BOT_LIST_TOKEN)
.addBotList(BotList.DEL, Config.DISCORD_EXTREME_LIST_TOKEN)
Expand Down

0 comments on commit 6689ef2

Please sign in to comment.