Skip to content

Commit 1ce903e

Browse files
committed
refactor: Updated bot
1 parent 64adc90 commit 1ce903e

File tree

3 files changed

+45
-48
lines changed

3 files changed

+45
-48
lines changed

deploy/docker/lavalink/application.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ plugins:
1313
# refreshToken: ""
1414
clients:
1515
- MUSIC
16-
# - TV
17-
# - TVHTML5EMBEDDED
16+
- TV
17+
- TVHTML5EMBEDDED
1818
- WEB
1919
- WEBEMBEDDED
2020
- MWEB

internal/command/music.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,28 @@ func musicCommands(bot *bot.RobotoBot, r *handler.Mux) discord.ApplicationComman
7777
},
7878
},
7979
},
80-
discord.ApplicationCommandOptionSubCommand{
81-
Name: "filter",
82-
Description: "Toggle music filters",
83-
Options: []discord.ApplicationCommandOption{
84-
discord.ApplicationCommandOptionString{
85-
Name: "filter",
86-
Description: "The filter to toggle",
87-
Required: true,
88-
Choices: []discord.ApplicationCommandOptionChoiceString{
89-
{
90-
Name: "Karaoke",
91-
Value: string(player.FilterTypeKaraoke),
92-
},
93-
{
94-
Name: "Vibrato",
95-
Value: string(player.FilterTypeVibrato),
80+
/*
81+
discord.ApplicationCommandOptionSubCommand{
82+
Name: "filter",
83+
Description: "Toggle music filters",
84+
Options: []discord.ApplicationCommandOption{
85+
discord.ApplicationCommandOptionString{
86+
Name: "filter",
87+
Description: "The filter to toggle",
88+
Required: true,
89+
Choices: []discord.ApplicationCommandOptionChoiceString{
90+
{
91+
Name: "Karaoke",
92+
Value: string(player.FilterTypeKaraoke),
93+
},
94+
{
95+
Name: "Vibrato",
96+
Value: string(player.FilterTypeVibrato),
97+
},
9698
},
9799
},
98100
},
99-
},
100-
},
101+
},*/
101102
discord.ApplicationCommandOptionSubCommand{
102103
Name: "volume",
103104
Description: "Adjust the music volume",
@@ -160,7 +161,7 @@ func musicCommands(bot *bot.RobotoBot, r *handler.Mux) discord.ApplicationComman
160161
}
161162
})
162163

163-
r.SlashCommand("/filter", h.onFilter)
164+
//r.SlashCommand("/filter", h.onFilter)
164165
r.SlashCommand("/volume", h.onVolume)
165166
r.SlashCommand("/clear", h.onClear)
166167
r.Component("/skip", h.onSkipButton)

internal/player/player.go

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,41 +59,37 @@ func (p *Player) Filter(ctx context.Context, guildID snowflake.ID, filter Filter
5959
}
6060

6161
// NOTE:
62-
// Filters doesn't unmarshal correctly...
63-
// Need to check with the library creator if this is also bugged :(
64-
//filters := lp.Filters()
62+
// This disgolink function is bugged (https://github.com/disgoorg/disgolink/issues/59)
63+
filters := lp.Filters()
6564
enabled := false
66-
6765
switch filter {
68-
/*
69-
case FilterTypeKaraoke:
70-
enabled = !(filters.Karaoke != nil)
71-
if enabled {
72-
filters.Karaoke = &lavalink.Karaoke{
73-
Level: 1.0,
74-
MonoLevel: 1.0,
75-
FilterBand: 220.0,
76-
FilterWidth: 100.0,
77-
}
78-
} else {
79-
filters.Karaoke = nil
66+
case FilterTypeKaraoke:
67+
enabled = !(filters.Karaoke != nil)
68+
if enabled {
69+
filters.Karaoke = &lavalink.Karaoke{
70+
Level: 1.0,
71+
MonoLevel: 1.0,
72+
FilterBand: 220.0,
73+
FilterWidth: 100.0,
8074
}
81-
case FilterTypeVibrato:
82-
enabled = !(filters.Vibrato != nil)
83-
if enabled {
84-
filters.Vibrato = &lavalink.Vibrato{
85-
Frequency: 2.0,
86-
Depth: 0.5,
87-
}
88-
} else {
89-
filters.Vibrato = nil
75+
} else {
76+
filters.Karaoke = nil
77+
}
78+
case FilterTypeVibrato:
79+
enabled = !(filters.Vibrato != nil)
80+
if enabled {
81+
filters.Vibrato = &lavalink.Vibrato{
82+
Frequency: 2.0,
83+
Depth: 0.5,
9084
}
91-
*/
85+
} else {
86+
filters.Vibrato = nil
87+
}
9288
default:
9389
return enabled, fmt.Errorf("currently unsupported filter type: %s", filter)
9490
}
9591

96-
//return enabled, lp.Update(ctx, lavalink.WithFilters(filters))
92+
return enabled, lp.Update(ctx, lavalink.WithFilters(filters))
9793
}
9894

9995
func (p *Player) Volume(ctx context.Context, guildID snowflake.ID, volume int) error {

0 commit comments

Comments
 (0)