Added filter selector in music controller

This commit is contained in:
Choco
2024-07-10 17:51:15 +08:00
parent 81239066b7
commit bddb9a9677
12 changed files with 115 additions and 120 deletions

View File

@@ -69,8 +69,10 @@ class Effect(commands.Cog):
if player.filters.has_filter(filter_tag="speed"):
player.filters.remove_filter(filter_tag="speed")
await player.add_filter(voicelink.Timescale(tag="speed", speed=value), ctx.author)
await ctx.send(f"You set the speed to **{value}**.")
effect = voicelink.Timescale(tag="speed", speed=value)
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="karaoke", aliases=get_aliases("karaoke"))
@app_commands.describe(
@@ -86,8 +88,10 @@ class Effect(commands.Cog):
if player.filters.has_filter(filter_tag="karaoke"):
player.filters.remove_filter(filter_tag="karaoke")
await player.add_filter(voicelink.Karaoke(tag="karaoke", level=level, mono_level=monolevel, filter_band=filterband, filter_width=filterwidth), ctx.author)
await send(ctx, "karaoke", level, monolevel, filterband, filterwidth)
effect = voicelink.Karaoke(tag="karaoke", level=level, mono_level=monolevel, filter_band=filterband, filter_width=filterwidth)
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="tremolo", aliases=get_aliases("tremolo"))
@app_commands.describe(
@@ -101,8 +105,10 @@ class Effect(commands.Cog):
if player.filters.has_filter(filter_tag="tremolo"):
player.filters.remove_filter(filter_tag="tremolo")
await player.add_filter(voicelink.Tremolo(tag="tremolo", frequency=frequency, depth=depth), ctx.author)
await send(ctx, "tremolo&vibrato", frequency, depth)
effect = voicelink.Tremolo(tag="tremolo", frequency=frequency, depth=depth)
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="vibrato", aliases=get_aliases("vibrato"))
@app_commands.describe(
@@ -116,8 +122,10 @@ class Effect(commands.Cog):
if player.filters.has_filter(filter_tag="vibrato"):
player.filters.remove_filter(filter_tag="vibrato")
await player.add_filter(voicelink.Vibrato(tag="vibrato", frequency=frequency, depth=depth), ctx.author)
await send(ctx, "tremolo&vibrato", frequency, depth)
effect = voicelink.Vibrato(tag="vibrato", frequency=frequency, depth=depth)
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="rotation", aliases=get_aliases("rotation"))
@app_commands.describe(hertz="The hertz of the rotation. Default is `0.2`")
@@ -128,8 +136,10 @@ class Effect(commands.Cog):
if player.filters.has_filter(filter_tag="rotation"):
player.filters.remove_filter(filter_tag="rotation")
await player.add_filter(voicelink.Rotation(tag="rotation", rotation_hertz=hertz), ctx.author)
await send(ctx, "rotation", hertz)
effect = voicelink.Rotation(tag="rotation", rotation_hertz=hertz)
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="distortion", aliases=get_aliases("distortion"))
@commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild)
@@ -139,8 +149,10 @@ class Effect(commands.Cog):
if player.filters.has_filter(filter_tag="distortion"):
player.filters.remove_filter(filter_tag="distortion")
await player.add_filter(voicelink.Distortion(tag="distortion", sin_offset=0.0, sin_scale=1.0, cos_offset=0.0, cos_scale=1.0, tan_offset=0.0, tan_scale=1.0, offset=0.0, scale=1.0), ctx.author)
await send(ctx, "distortion")
effect = voicelink.Distortion(tag="distortion", sin_offset=0.0, sin_scale=1.0, cos_offset=0.0, cos_scale=1.0, tan_offset=0.0, tan_scale=1.0, offset=0.0, scale=1.0)
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="lowpass", aliases=get_aliases("lowpass"))
@app_commands.describe(smoothing="The level of the lowPass. Default is `20.0`")
@@ -151,8 +163,10 @@ class Effect(commands.Cog):
if player.filters.has_filter(filter_tag="lowpass"):
player.filters.remove_filter(filter_tag="lowpass")
await player.add_filter(voicelink.LowPass(tag="lowpass", smoothing=smoothing), ctx.author)
await send(ctx, "lowpass", smoothing)
effect = voicelink.LowPass(tag="lowpass", smoothing=smoothing)
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="channelmix", aliases=get_aliases("channelmix"))
@app_commands.describe(
@@ -168,8 +182,10 @@ class Effect(commands.Cog):
if player.filters.has_filter(filter_tag="channelmix"):
player.filters.remove_filter(filter_tag="channelmix")
await player.add_filter(voicelink.ChannelMix(tag="channelmix", left_to_left=left_to_left, right_to_right=right_to_right, left_to_right=left_to_right, right_to_left=right_to_left), ctx.author)
await send(ctx, "channelmix", left_to_left, right_to_right, left_to_right, right_to_left)
effect = voicelink.ChannelMix(tag="channelmix", left_to_left=left_to_left, right_to_right=right_to_right, left_to_right=left_to_right, right_to_left=right_to_left)
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="nightcore", aliases=get_aliases("nightcore"))
@commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild)
@@ -177,8 +193,9 @@ class Effect(commands.Cog):
"Add nightcore filter into your player."
player = await check_access(ctx)
await player.add_filter(voicelink.Timescale.nightcore(), ctx.author)
await send(ctx, "nightcore")
effect = voicelink.Timescale.nightcore()
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="8d", aliases=get_aliases("8d"))
@commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild)
@@ -186,8 +203,9 @@ class Effect(commands.Cog):
"Add 8D filter into your player."
player = await check_access(ctx)
await player.add_filter(voicelink.Rotation.nightD(), ctx.author)
await send(ctx, "8d")
effect = voicelink.Rotation.nightD()
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="vaporwave", aliases=get_aliases("vaporwave"))
@commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild)
@@ -195,8 +213,9 @@ class Effect(commands.Cog):
"Add vaporwave filter into your player."
player = await check_access(ctx)
await player.add_filter(voicelink.Timescale.vaporwave(), ctx.author)
await send(ctx, "vaporwave")
effect = voicelink.Timescale.vaporwave()
await player.add_filter(effect, ctx.author)
await send(ctx, "addEffect", effect.tag)
@commands.hybrid_command(name="cleareffect", aliases=get_aliases("cleareffect"))
@app_commands.describe(effect="Remove a specific sound effects.")
@@ -211,7 +230,7 @@ class Effect(commands.Cog):
else:
await player.reset_filter()
await send(ctx, "cleareffect")
await send(ctx, "clearEffect")
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(Effect(bot))

View File

@@ -32,16 +32,8 @@
"pingTitle2": "播放器信息:",
"pingfield1": "```分片 ID: {0}/{1}\n分片延遲: {2:.3f}s {3}\n區域: {4}```",
"pingfield2": "```節點: {0} - {1:.3f}s\n播放器數量: {2}\n語音區域: {3}```",
"karaoke": "你已更新等級到 **{0}**,單聲道等級到 **{1}**,濾波頻帶到 **{2}**,濾波寬度到 **{3}**",
"tremolo&vibrato": "你已更新頻率到 {0},深度到 {1}",
"rotation": "你已更新旋轉 Hz 到 {0}",
"distortion": "你已啟用失真。",
"lowpass": "你已更新低通濾波器到 {0}",
"channelmix": "你已更新聲道混音。左左: {0},右右: {1},左右: {2},右左: {3}",
"nightcore": "你已加入夜蒼聲音效果。",
"8d": "你已加入 8D 聲音效果。",
"vaporwave": "你已加入 vaporwave 聲音效果。",
"cleareffect": "聲音效果已清除!",
"addEffect": "套用音效`{0}`濾鏡。",
"clearEffect": "聲音效果已清除!",
"FilterTagAlreadyInUse": "此聲音效果已在使用中!請使用 /cleareffect <Tag> 移除它。",
"playlistViewTitle": "📜 所有 {0} 的播放清單",
@@ -105,6 +97,7 @@
"playlistAdded": "❤️ 已將 **{0}** 添加到 {1} 的播放清單中 [`{2}`]!",
"playerDropdown": "選擇要跳轉到的音軌...",
"playerFilter": "選擇要套用的篩選器...",
"buttonBack": "返回",
"buttonPause": "暫停",

View File

@@ -32,16 +32,8 @@
"pingTitle2": "Spielerinfo:",
"pingfield1": "```Shard-ID: {0}/{1}\nShard-Latenz: {2:.3f} s {3}\nRegion: {4}```",
"pingfield2": "```Knoten: {0} - {1:.3f}s\nSpieler: {2}\nSprachregion: {3}```",
"karaoke": "Sie setzen den Pegel auf **{0}**, monoLevel auf **{1}**, filterBand auf **{2}** und filterWidth auf **{3}**.",
"tremolo&vibrato": "Sie stellen die Frequenz auf **{0}** und die Tiefe auf **{1}** ein.",
"rotation": "Sie setzen die RotationHz auf **{0}**.",
"distortion": "Sie haben die Verzerrung aktiviert.",
"lowpass": "Sie setzen den LowPass auf **{0}**.",
"channelmix": "Sie haben den channelMix aktualisiert. Von links nach links: **{0}**, von rechts nach rechts: **{1}**, von links nach rechts: **{2}**, von rechts nach links: ** {3}**.",
"nightcore": "Sie haben Nightcore-Soundeffekte hinzugefügt.",
"8d": "Sie haben 8D-Soundeffekte hinzugefügt.",
"vaporwave": "Sie haben Dampfwellen-Soundeffekte hinzugefügt.",
"cleareffect": "Die Soundeffekte wurden gelöscht!",
"addEffect": "Wende den Effekt `{0}` Filter an.",
"clearEffect": "Die Soundeffekte wurden gelöscht!",
"FilterTagAlreadyInUse": "Diese Soundeffekte sind bereits im Einsatz! Bitte verwenden Sie /cleareffect <Tag>, um sie zu entfernen.",
"playlistViewTitle": "📜 Alle Playlists von {0}",
@@ -105,6 +97,7 @@
"playlistAdded": "❤️ Hinzugefügt **{0}** in {1}'s Wiedergabeliste [`{2}`]!",
"playerDropdown": "Wählen Sie einen Song aus, um zu überspringen ...",
"playerFilter": "Wählen Sie einen Filter aus, um ihn anzuwenden ...",
"buttonBack": "Zurück",
"buttonPause": "Pause",

View File

@@ -32,16 +32,8 @@
"pingTitle2": "Player Info:",
"pingfield1": "```Shard ID: {0}/{1}\nShard Latency: {2:.3f}s {3}\nRegion: {4}```",
"pingfield2": "```Node: {0} - {1:.3f}s\nPlayers: {2}\nVoice Region: {3}```",
"karaoke": "You have updated the level to **{0}**, monoLevel to **{1}**, filterBand to **{2}** and filterWidth to **{3}**",
"tremolo&vibrato": "You updated the frequency to **{0}** and depth to **{1}**",
"rotation": "You have updated the rotationHz to **{0}**",
"distortion": "You have enabled distortion.",
"lowpass": "You have updated the lowPass to **{0}**",
"channelmix": "You have updated the channelMix. Left-to-left: **{0}**, Right-to-right: **{1}**, Left-to-right: **{2}**, Right-to-left: **{3}**",
"nightcore": "You have added nightcore sound effects.",
"8d": "You have added 8D sound effects.",
"vaporwave": "You have added vaporwave sound effects.",
"cleareffect": "The sound effects have been cleared!",
"addEffect": "Apply the effect `{0}` filter.",
"clearEffect": "The sound effects have been cleared!",
"FilterTagAlreadyInUse": "This sound effects has already in use! Please use /cleareffect <Tag> to remove it.",
"playlistViewTitle": "📜 All {0}'s Playlists",
@@ -105,6 +97,7 @@
"playlistAdded": "❤️ Added **{0}** into {1}'s playlist [`{2}`]!",
"playerDropdown": "Select a song to skip to ...",
"playerFilter": "Select a filter to apply ...",
"buttonBack": "Back",
"buttonPause": "Pause",

View File

@@ -32,16 +32,8 @@
"pingTitle2": "Información del reproductor:",
"pingfield1": "```ID de fragmento: {0}/{1}\nLatencia de fragmento: {2:.3f}s {3}\nRegión: {4}```",
"pingfield2": "```Nodo: {0} - {1:.3f}s\nReproductores: {2}\nRegión de voz: {3}```",
"karaoke": "Ha actualizado el nivel a **{0}**, monoLevel a **{1}**, filterBand a **{2}** y filterWidth a **{3}**.",
"tremolo&vibrato": "Ha actualizado la frecuencia a **{0}** y la profundidad a **{1}**.",
"rotation": "Ha actualizado la rotación Hz a **{0}**.",
"distortion": "Ha habilitado la distorsión.",
"lowpass": "Ha actualizado el paso bajo a **{0}**",
"channelmix": "Ha actualizado la mezcla de canales. De izquierda a izquierda: **{0}**, de derecha a derecha: **{1}**, de izquierda a derecha: **{2}**, de derecha a izquierda: **{3}**.",
"nightcore": "Ha agregado efectos de sonido nightcore.",
"8d": "Ha agregado efectos de sonido 8D.",
"vaporwave": "Ha agregado efectos de sonido vaporwave.",
"cleareffect": "¡Los efectos de sonido se han borrado!",
"addEffect": "plica el efecto `{0}` filtro.",
"clearEffect": "¡Los efectos de sonido se han borrado!",
"FilterTagAlreadyInUse": "¡Este efecto de sonido ya está en uso! Utilice /cleareffect <Tag> para eliminarlo.",
"playlistViewTitle": "📜 Todas las listas de reproducción de {0}",
@@ -105,6 +97,7 @@
"playlistAdded": "❤️ Agregado **{0}** a la lista de reproducción de {1} [`{2}`]!",
"playerDropdown": "Seleccione una canción para saltar a ...",
"playerFilter": "Seleccione un filtro para aplicar ...",
"buttonBack": "Atrás",
"buttonPause": "Pausa",

View File

@@ -32,16 +32,8 @@
"pingTitle2": "プレーヤー情報:",
"pingfield1": "```シャードID{0}/{1}\nシャードレイテンシ{2:.3f}s {3}\nリージョン{4}```",
"pingfield2": "```ノード:{0} - {1:.3f}s\nプレイヤー数{2}\n音声リージョン{3}```",
"karaoke": "**{0}**のレベル、**{1}**のモノレベル、**{2}**のフィルターバンド、および**{3}**のフィルター幅を更新しました。",
"tremolo&vibrato": "周波数を**{0}**、深度を**{1}**に更新しました",
"rotation": "回転Hzを**{0}**に更新しました。",
"distortion": "歪みを有効にしました。",
"lowpass": "lowPassを**{0}**に更新しました。",
"channelmix": "チャンネルミックスを更新しました。左から左へ:**{0}**、右から右へ:**{1}**、左から右へ:**{2}**、右から左へ:**{3}**",
"nightcore": "ナイトコアサウンドエフェクトを追加しました。",
"8d": "8Dサウンドエフェクトを追加しました。",
"vaporwave": "ヴェイパーウェーブサウンドエフェクトを追加しました。",
"cleareffect": "効果音がクリアされました!",
"addEffect": "`{0}` フィルターを適用します。",
"clearEffect": "効果音がクリアされました",
"FilterTagAlreadyInUse": "このサウンドエフェクトはすでに使用されています!削除するには/cleareffect <Tag>を使用してください。",
"playlistViewTitle": "📜 {0}のすべてのプレイリスト",
@@ -105,6 +97,7 @@
"playlistAdded": "❤️ **{0}**を{1}のプレイリスト[`{2}`]に追加しました!",
"playerDropdown": "スキップする曲を選択してください...",
"playerFilter": "適用するフィルターを選択してください...",
"buttonBack": "戻る",
"buttonPause": "一時停止",

View File

@@ -32,16 +32,8 @@
"pingTitle2": "플레이어 정보:",
"pingfield1": "```쉬드 ID: {0}/{1}\n쉬드 대기 시간: {2:.3f}s {3}\n지역: {4}```",
"pingfield2": "```노드: {0} - {1:.3f}s\n플레이어: {2}\n음성 지역: {3}```",
"karaoke": "**{0}** 레벨, 모노 레벨 **{1}**, 필터 밴드 **{2}**, 필터 너비 **{3}**으로 업데이트되었습니다.",
"tremolo&vibrato": "주파수를 **{0}**으로, 깊이를 **{1}**으로 업데이트했습니다.",
"rotation": "회전 주파수를 **{0}**으로 업데이트했습니다.",
"distortion": "왜곡이 활성화되었습니다.",
"lowpass": "LowPass를 **{0}**으로 업데이트했습니다.",
"channelmix": "채널 믹스를 업데이트했습니다. 왼쪽-왼쪽: **{0}**, 오른쪽-오른쪽: **{1}**, 왼쪽-오른쪽: **{2}**, 오른쪽-왼쪽: **{3}**",
"nightcore": "나이트코어 효과를 추가했습니다.",
"8d": "8D 효과를 추가했습니다.",
"vaporwave": "Vaporwave 효과를 추가했습니다.",
"cleareffect": "효과가 삭제되었습니다!",
"addEffect": "`{0}` 필터를 적용하세요.",
"clearEffect": "효과가 삭제되었습니다!",
"FilterTagAlreadyInUse": "이 필터는 이미 사용 중입니다! 삭제하려면 /cleareffect <Tag>를 사용하십시오.",
"playlistViewTitle": "📜 {0}의 모든 재생 목록",
@@ -105,6 +97,7 @@
"playlistAdded": "❤️ **{0}**을(를) {1}의 재생목록 [`{2}`] 에 추가했습니다!",
"playerDropdown": "건너뛰기 할 노래를 선택하세요...",
"playerFilter": "적용할 필터를 선택하세요...",
"buttonBack": "이전",
"buttonPause": "일시정지",

View File

@@ -32,16 +32,8 @@
"pingTitle2": "Информация о плеере:",
"pingfield1": "```ID Шарда: {0}/{1}\nЗадержка Шарда: {2:.3f}s {3}\nРегион: {4}```",
"pingfield2": "```Сервис: {0} - {1:.3f}s\nИгроки: {2}\nРегион Голоса: {3}```",
"karaoke": "Вы обновили уровень на **{0}**, моноуровень на **{1}**, фильтрующая полоса на **{2}** и ширина фильтра на **{3}**",
"tremolo&vibrato": "Вы обновили значение эффекта tremolo на **{0}** и vibrato на **{1}**",
"rotation": "Вы обновили значение эффекта rotation на **{0}**",
"distortion": "Вы включили эффект rotation.",
"lowpass": "Вы обновили значение эффекта lowpass на **{0}**",
"channelmix": "Вы обновили ChannelMix. Левый-на-левый: **{0}**, Правый-на-правый: **{1}**, Левый-на-правый: **{2}**, Правый-на-левый: **{3}**",
"nightcore": "Вы включили эффект Nightcore.",
"8d": "Вы включили эффект 8D.",
"vaporwave": "Вы включили эффект Vaporwave.",
"cleareffect": "Звуковые эффекты были очищены!",
"addEffect": "Примените эффект `{0}` фильтр.",
"clearEffect": "Звуковые эффекты были очищены!",
"FilterTagAlreadyInUse": "Этот звуковой эффект уже используется! Пожалуйста, используйте /cleareffect <Тег>, чтобы удалить его.",
"playlistViewTitle": "📜 Все плейлисты пользователя {0}",
@@ -105,6 +97,7 @@
"playlistAdded": "❤️ Добавлен **{0}** в плейлист пользователя {1} [`{2}`]!",
"playerDropdown": "Выберите трек для перехода ...",
"playerFilter": "Выберите фильтр для применения ...",
"buttonBack": "Назад",
"buttonPause": "Пауза",
@@ -190,4 +183,4 @@
"invalidStartTime": "Hевозможное время начала! Вход времени должен быть внутри `00:00` и `{0}`.",
"invalidEndTime": "Невозможное время конца! Вход времени должен быть внутри `00:00` и `{0}`.",
"invalidTimeOrder": "Время конца не может быть меньше или равно времени начала."
}
}

View File

@@ -32,16 +32,8 @@
"pingTitle2": "Інформація про плеєр:",
"pingfield1": "````ID Шарда: {0}/{1}\nЗатримка Шарда: {2:.3f}s {3}\nРегіон: {4}````",
"pingfield2": "```Вузол: {0} - {1:.3f}s\nГравці: {2}\nРегіон Голосу: {3}```",
"karaoke": "Ви оновили рівень на **{0}**, моно-рівень на **{1}**, фільтрувальну смугу на **{2}** і ширину фільтра на **{3}**",
"tremolo&vibrato": "Ви оновили значення ефекту tremolo на **{0}** і vibrato на **{1}**",
"rotation": "Ви оновили значення ефекту rotation на **{0}***",
"distortion": "Ви ввімкнули ефект rotation.",
"lowpass": "Ви оновили значення ефекту lowpass на **{0}**",
"channelmix": "Ви оновили ChannelMix. Лівий-на-лівий: **{0}**, Правий-на-правий: **{1}**, Лівий-на-правий: **{2}**, Правий-на-лівий: **{3}**",
"nightcore": "Ви ввімкнули ефект Nightcore.",
"8d": "Ви ввімкнули ефект 8D.",
"vaporwave": "Ви ввімкнули ефект Vaporwave.",
"cleareffect": "Звукові ефекти були очищені!",
"addEffect": "Застосуйте ефект `{0}` фільтр.",
"clearEffect": "Звукові ефекти були очищені!",
"FilterTagAlreadyInUse": "Цей звуковий ефект уже використовується! Будь ласка, використовуйте /cleareffect <Тег>, щоб видалити його.",
"playlistViewTitle": "📜 Усі плейлисти користувача {0}",
@@ -105,6 +97,7 @@
"playlistAdded": "❤️ Додано **{0}** до плейлиста користувача {1} [`{2}`]!",
"playerDropdown": "Виберіть пісню для переходу ...",
"playerFilter": "Виберіть фільтр для застосування ...",
"buttonBack": "Назад",
"buttonPause": "Призупинити",
@@ -190,4 +183,4 @@
"invalidStartTime": "Недійснений час початку! Час має бути в межах `00:00` та `{0}`.",
"invalidEndTime": "Недійснений час закінчення! Час має бути в межах `00:00` та `{0}`.",
"invalidTimeOrder": "Час закінчення не може бути меншим або рівним часу початку."
}
}

View File

@@ -43,7 +43,7 @@ class ControlButton(discord.ui.Button):
self.player: voicelink.Player = player
self.disable_button_text: bool = func.settings.controller.get("disableButtonText", False)
super().__init__(label=player.get_msg(label) if label and not self.disable_button_text else None, **kwargs)
super().__init__(label=self.player.get_msg(label) if label and not self.disable_button_text else None, **kwargs)
async def send(self, interaction: discord.Interaction, key:str, *params, ephemeral: bool = False) -> None:
stay = self.player.settings.get("controller_msg", True)
@@ -374,8 +374,7 @@ class Tracks(discord.ui.Select):
options.append(discord.SelectOption(label=f"{index}. {track.title[:40]}", description=f"{track.author[:30]} · " + ("Live" if track.is_stream else track.formatted_length), emoji=track.emoji))
super().__init__(
placeholder=player.get_msg("playerDropdown"),
min_values=1, max_values=1,
placeholder=self.player.get_msg("playerDropdown"),
options=options,
row=row
)
@@ -390,6 +389,38 @@ class Tracks(discord.ui.Select):
if self.player.settings.get("controller_msg", True):
await func.send(interaction, "skipped", interaction.user)
class Effects(discord.ui.Select):
def __init__(self, player, style, row):
self.player: voicelink.Player = player
options = [discord.SelectOption(label="None", value="None")]
for name in voicelink.Filters.get_available_filters():
options.append(discord.SelectOption(label=name.capitalize(), value=name))
super().__init__(
placeholder=self.player.get_msg("playerFilter"),
options=options,
row=row
)
async def callback(self, interaction: discord.Interaction):
if not self.player.is_privileged(interaction.user):
return await func.send(interaction, "missingPerms_function", ephemeral=True)
avalibable_filters = voicelink.Filters.get_available_filters()
if self.values[0] == "None":
await self.player.reset_filter(requester=interaction.user)
return await func.send(interaction, "clearEffect")
selected_filter = avalibable_filters.get(self.values[0].lower())()
if self.player.filters.has_filter(filter_tag=selected_filter.tag):
await self.player.remove_filter(filter_tag=selected_filter.tag, requester=interaction.user)
await func.send(interaction, "clearEffect")
else:
await self.player.add_filter(selected_filter, requester=interaction.user)
await func.send(interaction, "addEffect", selected_filter.tag)
BUTTONTYPE: Dict[str, ControlButton] = {
"back": Back,
"resume": Resume,
@@ -400,11 +431,12 @@ BUTTONTYPE: Dict[str, ControlButton] = {
"volumeup": VolumeUp,
"volumedown": VolumeDown,
"volumemute": VolumeMute,
"tracks": Tracks,
"autoplay": AutoPlay,
"shuffle": Shuffle,
"forward": Forward,
"rewind": Rewind
"rewind": Rewind,
"tracks": Tracks,
"effects": Effects
}
BUTTONCOLOR: Dict[str, discord.ButtonStyle] = {

View File

@@ -76,15 +76,15 @@ class Filters:
@classmethod
def get_available_filters(cls) -> Dict[str, Filter]:
return {
"karaoke": Karaoke(),
"tremolo": Tremolo(),
"vibrato": Vibrato(),
"rotation": Rotation(),
"distortion": Distortion(),
"lowpass": LowPass(),
"nightcore": Timescale.nightcore(),
"vaporwave": Timescale.vaporwave(),
"8d": Rotation.nightD(),
"karaoke": Karaoke,
"tremolo": Tremolo,
"vibrato": Vibrato,
"rotation": Rotation,
"distortion": Distortion,
"lowpass": LowPass,
"nightcore": Timescale.nightcore,
"vaporwave": Timescale.vaporwave,
"8d": Rotation.nightD,
}
class Equalizer(Filter):

View File

@@ -27,7 +27,7 @@ import function as func
from math import ceil
from asyncio import sleep
from views import InteractiveController
from typing import Any, Dict, Optional, Union, List, Tuple
from typing import Any, Dict, List, Optional, Union, Tuple
from discord import (
Client,