Skip to content

Commit 6689ef2

Browse files
authored
Merge pull request #328 from KittyBot-Org/feature/new-filters
new filters
2 parents cfdbc61 + f829e0a commit 6689ef2

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies {
2525
implementation 'dev.mlnr:BotListHandler-jda:2.0.0_8'
2626

2727
// audio
28-
implementation('com.github.KittyBot-Org:Lavalink-Client:176ca86') {
28+
implementation('com.github.KittyBot-Org:Lavalink-Client:d48f1a6') {
2929
exclude group: 'com.sedmelluq', module: 'lavaplayer'
3030
}
3131
implementation 'com.sedmelluq:lavaplayer:1.3.78'

src/main/java/de/kittybot/kittybot/commands/music/FilterCommand.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public FilterCommand(){
2424
new VibratoCommand(),
2525
new RotationCommand(),
2626
new DistortionCommand(),
27+
new ChannelMixCommand(),
28+
new LowPassCommand(),
2729
new ClearCommand()
2830
);
2931
}
@@ -262,6 +264,70 @@ public void run(Options options, GuildInteraction ia){
262264

263265
}
264266

267+
private static class ChannelMixCommand extends GuildSubCommand{
268+
269+
public ChannelMixCommand(){
270+
super("channel-mix", "Mixes both channels, with a configurable factor on how much each channel affects the other.");
271+
addOptions(
272+
new CommandOptionFloat("left-to-left", "How much audio from the left channel goes to the left channel"),
273+
new CommandOptionFloat("left-to-right", "How much audio from the left channel goes to the right channel"),
274+
new CommandOptionFloat("right-to-left", "How much audio from the right channel goes to the left channel"),
275+
new CommandOptionFloat("right-to-right", "How much audio from the right channel goes to the right channel")
276+
);
277+
}
278+
279+
@Override
280+
public void run(Options options, GuildInteraction ia){
281+
var scheduler = ia.get(MusicModule.class).getScheduler(ia.getGuildId());
282+
if(!MusicUtils.checkCommandRequirements(ia, scheduler) || !MusicUtils.checkMusicPermissions(ia, scheduler)){
283+
return;
284+
}
285+
var channelMix = new ChannelMix();
286+
if(options.has("left-to-left")){
287+
channelMix = channelMix.setLeftToLeft(options.getFloat("left-to-left"));
288+
}
289+
if(options.has("left-to-right")){
290+
channelMix = channelMix.setLeftToRight(options.getFloat("left-to-right"));
291+
}
292+
if(options.has("right-to-left")){
293+
channelMix = channelMix.setRightToLeft(options.getFloat("right-to-left"));
294+
}
295+
if(options.has("right-to-right")){
296+
channelMix = channelMix.setRightToLeft(options.getFloat("right-to-right"));
297+
}
298+
299+
scheduler.getFilters().setChannelMix(channelMix).commit();
300+
ia.reply("Set channel-mix filter");
301+
}
302+
303+
}
304+
305+
private static class LowPassCommand extends GuildSubCommand{
306+
307+
public LowPassCommand(){
308+
super("low-pass", "Higher frequencies get suppressed, while lower frequencies pass through this filter.");
309+
addOptions(
310+
new CommandOptionFloat("smoothing", "The smoothing level")
311+
);
312+
}
313+
314+
@Override
315+
public void run(Options options, GuildInteraction ia){
316+
var scheduler = ia.get(MusicModule.class).getScheduler(ia.getGuildId());
317+
if(!MusicUtils.checkCommandRequirements(ia, scheduler) || !MusicUtils.checkMusicPermissions(ia, scheduler)){
318+
return;
319+
}
320+
var lowPass = new LowPass();
321+
if(options.has("smoothing")){
322+
lowPass = lowPass.setSmoothing(options.getFloat("smoothing"));
323+
}
324+
325+
scheduler.getFilters().setLowPass(lowPass).commit();
326+
ia.reply("Set low-pass filter");
327+
}
328+
329+
}
330+
265331
private static class ClearCommand extends GuildSubCommand{
266332

267333
public ClearCommand(){

src/main/java/de/kittybot/kittybot/main/KittyBot.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public KittyBot() throws IOException, MissingConfigValuesException, LoginExcepti
3737
.addBotList(BotList.TOP_GG, Config.TOP_GG_TOKEN)
3838
.addBotList(BotList.DBOATS, Config.DISCORD_BOATS_TOKEN)
3939
.addBotList(BotList.DISCORDLIST_SPACE, Config.BOTLIST_SPACE_TOKEN)
40-
.addBotList(BotList.BOTS_FOR_DISCORD, Config.BOTS_FOR_DISCORD_TOKEN)
4140
.addBotList(BotList.DSERVICES, Config.DISCORD_SERVICES_TOKEN)
4241
.addBotList(BotList.DBL, Config.DISCORD_BOT_LIST_TOKEN)
4342
.addBotList(BotList.DEL, Config.DISCORD_EXTREME_LIST_TOKEN)

0 commit comments

Comments
 (0)