Skip to content

Commit 1d58f4c

Browse files
committed
v6.2.0
1 parent 14c9de0 commit 1d58f4c

File tree

12 files changed

+99
-14
lines changed

12 files changed

+99
-14
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Users inside the **blacklisted** class are well... blacklisted from using ANY fu
116116
| - | - |
117117
| `/play` | Plays tracks from various sources on a voice channel |
118118
| `/queue show` | Shows the current song queue |
119+
| `/queue skip` | Shows the current song queue and allows you to choose and skip to a specific track |
119120
| `/queue clear` | Clears tracks from the current song queue |
120121
| `/queue shuffle` | Shuffles the current queue |
121122
| `/recommend` | Toggles the autoplay of recommended tracks on and off |

changelog

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
> 6.0.0:
1+
* 6.0.0:
22
* Initial release.
33

4-
> 6.0.1:
4+
* 6.0.1:
55
* Fixed an issue where the bot wouldn't respond if the user's language was anything but pt-BR or en-GB / en-US.
66

7-
> 6.1.0:
7+
* 6.1.0:
88
* Added back valorant daily shop functionality.
99
* Modified config file so that the fortnite daily shop language isn't invalid.
1010
* Modified config file so that the daily shops are disabled by default.
1111
* Made sure all guild-exclusive commands have the is_guild() check on them.
12+
13+
* 6.2.0:
14+
* Added `/queue skip` command.
15+
* Fixed incorrect text formatting on the *QueueEditView*.

init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
RinBot v6.0.1 'Alvorada'
2+
RinBot v6.2.0 'Alvorada'
33
development started on 11/06/2024
44
made by rin (https://github.com/kmrin, km.rin on https://discord.gg)
55
"""

rinbot/assets/docs/help_en-GB.md

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
### Music
5555
`/play` Plays tracks from various sources on a voice channel
5656
`/queue show` Shows the current song queue
57+
`/queue skip` Shows the current song queue and allows you to choose and skip to a specific track
5758
`/queue clear` Clears tracks from the current song queue
5859
`/queue shuffle` Shuffles the current queue
5960
`/recommend` Toggles the autoplay of recommended tracks on and off

rinbot/assets/docs/help_pt-BR.md

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
### Music
5454
`/tocar` Toca músicas por URLs ou buscas
5555
`/fila mostrar` Mostra a fila atual
56+
`/fila pular` Mostra a fila atual e permite que você pule para uma música específica
5657
`/fila limpar` Limpa a fila inteira ou uma ou mais músicas específicas
5758
`/fila randomizar` Randomiza a fila atual
5859
`/recomendar` Alterna a funcionalidade de adicionar músicas na fila automaticamente

rinbot/config/client/rin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"VERSION": "v6.1.0 'Alvorada' (STABLE)",
2+
"VERSION": "v6.2.0 'Alvorada' (STABLE)",
33
"STATUS_LANG": "en-GB",
44
"LOG_STATUS_CHANGE": false,
55
"PREFIX": "!",

rinbot/config/localization/en-GB.json

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
"INTERFACE_VIDEO_SEARCH_PLAYLIST_ADDED": " • `{tracks}` from `{name}`",
5353
"INTERFACE_QUEUE_EDIT_PLACEHOLDER": "Choose one or more tracks to remove...",
5454
"INTERFACE_QUEUE_EDIT_REMOVED": " ✅ Queue items removed!",
55+
"INTERFACE_QUEUE_EDIT_SKIP_PLACEHOLDER": "Choose a track to skip to...",
56+
"INTERFACE_QUEUE_EDIT_SKIP_SKIPPED": " ✅ Skipping...",
5557
"INTERFACE_FAV_EDIT_PLAYLIST_DESC": "Tracks: {tracks} | Uploader: {uploader}",
5658
"INTERFACE_FAV_EDIT_TRACK_DESC": "Duration: {duration} | Uploader: {uploader}",
5759
"INTERFACE_FAV_EDIT_PLACEHOLDER": "Choose one or more items to be removed...",
@@ -369,6 +371,8 @@
369371
"MUSIC_QUEUE_SHOW_DESC": "Shows the current queue",
370372
"MUSIC_QUEUE_SHOW_URL_NAME": "show-urls",
371373
"MUSIC_QUEUE_SHOW_URL_DESC": "Show URLs instead of titles",
374+
"MUSIC_QUEUE_SKIP_NAME": "skip",
375+
"MUSIC_QUEUE_SKIP_DESC": "Skips to a specific track on the queue",
372376
"MUSIC_NO_PLAYERS": " ❌ No players active on this server",
373377
"MUSIC_QUEUE_EMPTY": " ❌ Queue is empty",
374378
"MUSIC_CURRENT_QUEUE": " 📋 Current queue",

rinbot/config/localization/pt-BR.json

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
"INTERFACE_VIDEO_SEARCH_PLAYLIST_ADDED": " • `{tracks}` músicas de `{name}`",
5656
"INTERFACE_QUEUE_EDIT_PLACEHOLDER": "Escolha uma ou mais músicas para remover...",
5757
"INTERFACE_QUEUE_EDIT_REMOVED": " ✅ Músicas removidas da fila!",
58+
"INTERFACE_QUEUE_EDIT_SKIP_PLACEHOLDER": "Escolha uma música...",
59+
"INTERFACE_QUEUE_EDIT_SKIP_SKIPPED": " ✅ Pulando...",
5860
"INTERFACE_FAV_EDIT_PLAYLIST_DESC": "Músicas: {tracks} | Por: {uploader}",
5961
"INTERFACE_FAV_EDIT_TRACK_DESC": "Duração: {duration} | Por: {uploader}",
6062
"INTERFACE_FAV_EDIT_PLACEHOLDER": "Escolha um ou mais itens para remover...",
@@ -370,6 +372,8 @@
370372
"MUSIC_QUEUE_ROOT_DESC": "Comandos de manipulação da fila de músicas",
371373
"MUSIC_QUEUE_SHOW_NAME": "mostrar",
372374
"MUSIC_QUEUE_SHOW_DESC": "Mostra a fila atual",
375+
"MUSIC_QUEUE_SKIP_NAME": "pular",
376+
"MUSIC_QUEUE_SKIP_DESC": "Pula para uma música específica na fila",
373377
"MUSIC_QUEUE_SHOW_URL_NAME": "mostrar-urls",
374378
"MUSIC_QUEUE_SHOW_URL_DESC": "Mostrar URLs invés de títulos",
375379
"MUSIC_NO_PLAYERS": " ❌ Nenhum player ativo no servidor",

rinbot/core/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .command_checks import is_owner, is_admin, is_guild, not_blacklisted
66
from .client import RinBot
77
from .db import DBTable, DBManager
8-
from .interface import Paginator, SetWelcomeConfirmation, StoreCreateRoleModal, HeadsOrTails, RockPaperScissorsView, MediaControls, VideoSearchView, QueueEditView, FavouritesEditView, FavouritesPlayView, Valorant2FAView, get_timeout_embed
8+
from .interface import Paginator, SetWelcomeConfirmation, StoreCreateRoleModal, HeadsOrTails, RockPaperScissorsView, MediaControls, VideoSearchView, QueueEditViewMode, QueueEditView, FavouritesEditView, FavouritesPlayView, Valorant2FAView, get_timeout_embed
99
from .errors import RinBotInteractionError, UserNotOwner, UserNotAdmin, UserNotInGuild, UserBlacklisted, InteractionTimedOut
1010
from .helpers import get_localized_string, get_interaction_locale, remove_nl_from_string_iterable, ms_to_str, is_url, get_expiration_time
1111
from .helpers import translate, get_specs, is_hex_colour, hex_to_colour, hex_to_int

rinbot/core/interface.py

+27-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from .loggers import Loggers
1717
from .helpers import get_localized_string, get_interaction_locale, is_hex_colour, hex_to_colour, url_to_playable, ms_to_str
1818
from .responder import respond
19-
from .types import Track, Playlist, VideoSearchViewMode
19+
from .types import Track, Playlist, VideoSearchViewMode, QueueEditViewMode
2020

2121
if TYPE_CHECKING:
2222
from .client import RinBot
@@ -710,9 +710,10 @@ async def callback_next(self, interaction: Interaction) -> None:
710710
await interaction.response.edit_message(view=self)
711711

712712
class QueueEditView(nextcord.ui.View):
713-
def __init__(self, locale: str, player: Player) -> None:
713+
def __init__(self, locale: str, player: Player, mode: QueueEditViewMode) -> None:
714714
super().__init__(timeout=60)
715715

716+
self.mode = mode
716717
self.locale = locale
717718
self.player = player
718719
self.current_page = 0
@@ -724,7 +725,7 @@ def __init__(self, locale: str, player: Player) -> None:
724725
self.next_button.callback = self.callback_next
725726

726727
self.select = self.create_select()
727-
self.select.callback = self.callback_select
728+
self.select.callback = self.callback_select if mode.value == 0 else self.callback_select_skip
728729

729730
self.add_item(self.select)
730731
if len(self.queue_parts) > 1:
@@ -753,11 +754,11 @@ def create_select(self) -> nextcord.ui.Select:
753754

754755
return nextcord.ui.Select(
755756
placeholder=get_localized_string(
756-
self.locale, 'INTERFACE_QUEUE_EDIT_PLACEHOLDER'
757+
self.locale, 'INTERFACE_QUEUE_EDIT_PLACEHOLDER' if self.mode.value == 0 else 'INTERFACE_QUEUE_EDIT_SKIP_PLACEHOLDER'
757758
),
758759
options=options,
759760
min_values=1,
760-
max_values=len(options)
761+
max_values=len(options) if self.mode.value == 0 else 1
761762
)
762763

763764
def update_buttons(self) -> None:
@@ -770,7 +771,7 @@ def update_select(self) -> None:
770771
label=track.title, value=str(i),
771772
description=get_localized_string(
772773
self.locale, 'INTERFACE_VIDEO_SEARCH_TRACK_DESC',
773-
uploader=track.author
774+
duration=ms_to_str(track.length), uploader=track.author
774775
)
775776
)
776777
for i, track in enumerate(self.queue_parts[self.current_page])
@@ -796,6 +797,26 @@ async def callback_select(self, interaction: Interaction) -> None:
796797
self.stop()
797798
await interaction.response.edit_message(embed=embed, view=None)
798799

800+
async def callback_select_skip(self, interaction: Interaction) -> None:
801+
index = int(self.select.values[0])
802+
selected_track = self.queue_parts[self.current_page][index]
803+
to_remove = self.player.queue[:self.player.queue.index(selected_track)]
804+
805+
for track in to_remove:
806+
self.player.queue.remove(track)
807+
808+
await self.player.skip(force=True)
809+
810+
embed = Embed(
811+
description=get_localized_string(
812+
self.locale, 'INTERFACE_QUEUE_EDIT_SKIP_SKIPPED'
813+
),
814+
colour=Colour.green()
815+
)
816+
817+
self.stop()
818+
await interaction.response.edit_message(embed=embed, view=None)
819+
799820
async def callback_prev(self, interaction: Interaction) -> None:
800821
self.current_page -= 1
801822
self.update_buttons()

rinbot/core/types.py

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ class VideoSearchViewMode(Enum):
1010
TRACK_MODE = 0
1111
PLAYLIST_MODE = 1
1212

13+
class QueueEditViewMode(Enum):
14+
REMOVE = 0
15+
SKIP = 1
16+
1317
@dataclass
1418
class Track:
1519
title: str

rinbot/extensions/music.py

+47-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Commands:
44
* /play - Plays songs through URLs or search queries
55
* /queue show - Shows the current song queue
6+
* /queue skip - Shows the current song queue and allows you to choose and skip to a specific track
67
* /queue clear - Shows the current song queue and allows you to choose and remove tracks from it
78
* /queue shuffle - Shuffles the current song queue
89
* /recommend - Toggles on and off the auto-filling of the song queue
@@ -27,7 +28,7 @@
2728

2829
from rinbot.core import RinBot
2930
from rinbot.core import Loggers
30-
from rinbot.core import VideoSearchViewMode
31+
from rinbot.core import VideoSearchViewMode, QueueEditViewMode
3132
from rinbot.core import ResponseType
3233
from rinbot.core import DBTable
3334
from rinbot.core import Track, Playlist
@@ -444,6 +445,50 @@ async def _queue_show(
444445
embed.description = message
445446
await respond(interaction, message=embed)
446447

448+
# /queue skip
449+
@_queue.subcommand(
450+
name=get_localized_string('en-GB', 'MUSIC_QUEUE_SKIP_NAME'),
451+
name_localizations={
452+
Locale.pt_BR: get_localized_string(
453+
'pt-BR', 'MUSIC_QUEUE_SKIP_NAME'
454+
)
455+
},
456+
description=get_localized_string('en-GB', 'MUSIC_QUEUE_SKIP_DESC'),
457+
description_localizations={
458+
Locale.pt_BR: get_localized_string(
459+
'pt-BR', 'MUSIC_QUEUE_SKIP_DESC'
460+
)
461+
}
462+
)
463+
@not_blacklisted()
464+
@is_guild()
465+
async def _queue_skip(self, interaction: Interaction) -> None:
466+
locale = get_interaction_locale(interaction)
467+
468+
if interaction.guild.id not in self.bot.music_clients:
469+
return await respond(
470+
interaction, Colour.red(),
471+
get_localized_string(
472+
locale, 'MUSIC_NO_PLAYERS'
473+
),
474+
hidden=True
475+
)
476+
477+
player = self.bot.music_clients[interaction.guild.id]
478+
queue = player.queue
479+
480+
if len(queue) <= 0:
481+
return await respond(
482+
interaction, Colour.red(),
483+
get_localized_string(
484+
locale, 'MUSIC_QUEUE_EMPTY'
485+
),
486+
hidden=True
487+
)
488+
489+
view = QueueEditView(locale, player, QueueEditViewMode.SKIP)
490+
await interaction.response.send_message(view=view)
491+
447492
# /queue clear
448493
@_queue.subcommand(
449494
name=get_localized_string('en-GB', 'MUSIC_QUEUE_CLEAR_NAME'),
@@ -525,7 +570,7 @@ async def _queue_clear(
525570
)
526571
)
527572

528-
view = QueueEditView(locale, player)
573+
view = QueueEditView(locale, player, QueueEditViewMode.REMOVE)
529574
await interaction.response.send_message(view=view)
530575

531576
# /queue shuffle

0 commit comments

Comments
 (0)