Fixed typo
This commit is contained in:
@@ -136,11 +136,11 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
if not result['playlist']['tracks']:
|
||||
return await send(ctx, 'playlistNoTrack', result['playlist']['name'], ephemeral=True)
|
||||
|
||||
playtrack = []
|
||||
_tracks = []
|
||||
for track in result['playlist']['tracks'][:max_t]:
|
||||
playtrack.append(voicelink.Track(track_id=track, info=voicelink.decode(track), requester=ctx.author))
|
||||
_tracks.append(voicelink.Track(track_id=track, info=voicelink.decode(track), requester=ctx.author))
|
||||
|
||||
tracks = {"name": result['playlist']['name'], "tracks": playtrack}
|
||||
tracks = {"name": result['playlist']['name'], "tracks": _tracks}
|
||||
|
||||
if not tracks:
|
||||
return await send(ctx, 'playlistNoTrack', result['playlist']['name'], ephemeral=True)
|
||||
@@ -237,7 +237,7 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
if link:
|
||||
tracks = await voicelink.NodePool.get_node().get_tracks(link, requester=ctx.author)
|
||||
if not isinstance(tracks, voicelink.Playlist):
|
||||
return await send(ctx, "playlistNotInvaildUrl", ephemeral=True)
|
||||
return await send(ctx, "playlistNotInvalidUrl", ephemeral=True)
|
||||
|
||||
data = {'uri': link, 'perms': {'read': []}, 'name': name, 'type': 'link'} if link else {'tracks': [], 'perms': {'read': [], 'write': [], 'remove': []}, 'name': name, 'type': 'playlist'}
|
||||
await update_user(ctx.author.id, {"$set": {f"playlist.{assign_playlist_id([data for data in user])}": data}})
|
||||
@@ -351,7 +351,7 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
return
|
||||
|
||||
update_data, dId = {}, {dId for dId in user["playlist"]}
|
||||
for data in view.newplaylist[:(max_p - len(user['playlist']))]:
|
||||
for data in view.new_playlist[:(max_p - len(user['playlist']))]:
|
||||
addId = assign_playlist_id(dId)
|
||||
await update_user(data['sender'], {"$push": {f"playlist.{data['referId']}.perms.read": ctx.author.id}})
|
||||
update_data[f'playlist.{addId}'] = {
|
||||
@@ -449,11 +449,11 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
if not result['playlist']['tracks']:
|
||||
return await send(ctx, 'playlistNoTrack', result['playlist']['name'], ephemeral=True)
|
||||
|
||||
playtrack = []
|
||||
_tracks = []
|
||||
for track in result['playlist']['tracks']:
|
||||
playtrack.append(voicelink.Track(track_id=track, info=voicelink.decode(track), requester=ctx.author))
|
||||
_tracks.append(voicelink.Track(track_id=track, info=voicelink.decode(track), requester=ctx.author))
|
||||
|
||||
tracks = {"name": result['playlist']['name'], "tracks": playtrack}
|
||||
tracks = {"name": result['playlist']['name'], "tracks": _tracks}
|
||||
|
||||
if not tracks:
|
||||
return await send(ctx, 'playlistNoTrack', result['playlist']['name'], ephemeral=True)
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"noPlaylistAcc": "{0} 沒有建立播放清單帳戶。",
|
||||
"overPlaylistCreation": "你不能建立超過 `{0}` 個播放清單!",
|
||||
"playlistExists": "播放清單 [`{0}`] 已存在。",
|
||||
"playlistNotInvaildUrl": "請輸入有效的連結或公開的 Spotify 或 YouTube 播放清單連結。",
|
||||
"playlistNotInvalidUrl": "請輸入有效的連結或公開的 Spotify 或 YouTube 播放清單連結。",
|
||||
"playlistCreated": "你已建立 `{0}` 播放清單。輸入 /playlist view 檢視更多資訊。",
|
||||
"playlistRenamed": "你已將 `{0}` 更名為 `{1}`。",
|
||||
"playlistLimitTrack": "你已達到限制!你只能將 `{0}` 首歌曲添加至你的播放清單中。",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"noPlaylistAcc": "{0} hat noch kein Playlist-Konto erstellt.",
|
||||
"overPlaylistCreation": "Du kannst nicht mehr als `{0}` Wiedergabelisten erstellen!",
|
||||
"playlistExists": "Die Playlist [`{0}`] existiert bereits.",
|
||||
"playlistNotInvaildUrl": "Bitte gebe einen gültigen Link oder öffentlichen Spotify/YouTube-Playlist-Link ein.",
|
||||
"playlistNotInvalidUrl": "Bitte gebe einen gültigen Link oder öffentlichen Spotify/YouTube-Playlist-Link ein.",
|
||||
"playlistCreated": "Du hast die Wiedergabeliste `{0}` erstellt. Gebe /playlist view ein, um weitere Informationen zu erhalten.",
|
||||
"playlistRenamed": "Du hast `{0}` zu `{1}` umbenannt.",
|
||||
"playlistLimitTrack": "Du hast die Grenze erreicht! Du kannst deiner Playlist nur noch `{0}` Songs hinzufügen.",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"noPlaylistAcc": "{0} didn't create a playlist account.",
|
||||
"overPlaylistCreation": "You cannot create more than `{0}` playlists!",
|
||||
"playlistExists": "Playlist [`{0}`] already exists.",
|
||||
"playlistNotInvaildUrl": "Please enter a valid link or public spotify or youtube playlist link.",
|
||||
"playlistNotInvalidUrl": "Please enter a valid link or public spotify or youtube playlist link.",
|
||||
"playlistCreated": "You have created `{0}` playlist. Type /playlist view for more info.",
|
||||
"playlistRenamed": "You have renamed `{0}` to `{1}`.",
|
||||
"playlistLimitTrack": "You have reached the limit! You can only add `{0}` songs to your playlist.",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"noPlaylistAcc": "`{0}` no ha creado una cuenta de lista de reproducción.",
|
||||
"overPlaylistCreation": "¡No puede crear más de `{0}` listas de reproducción!",
|
||||
"playlistExists": "La lista de reproducción [`{0}`] ya existe.",
|
||||
"playlistNotInvaildUrl": "Ingrese un enlace válido o un enlace público de lista de reproducción de Spotify o YouTube.",
|
||||
"playlistNotInvalidUrl": "Ingrese un enlace válido o un enlace público de lista de reproducción de Spotify o YouTube.",
|
||||
"playlistCreated": "Ha creado una lista de reproducción llamada `{0}`. Escriba /playlist view para obtener más información.",
|
||||
"playlistRenamed": "Ha cambiado el nombre de `{0}` a `{1}`.",
|
||||
"playlistLimitTrack": "¡Ha alcanzado el límite! Solo puede agregar `{0}` canciones a su lista de reproducción.",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"noPlaylistAcc": "{0}さんはプレイリストアカウントを作成していません。",
|
||||
"overPlaylistCreation": " {0}個以上のプレイリストを作成することはできません!",
|
||||
"playlistExists": "プレイリスト[{0}]はすでに存在します。",
|
||||
"playlistNotInvaildUrl": "有効なリンクまたは公開SpotifyまたはYouTubeプレイリストリンクを入力してください。",
|
||||
"playlistNotInvalidUrl": "有効なリンクまたは公開SpotifyまたはYouTubeプレイリストリンクを入力してください。",
|
||||
"playlistCreated": "{0}プレイリストを作成しました。詳細については、/playlist viewを入力してください。",
|
||||
"playlistRenamed": "{0}を{1}に名前を変更しました。",
|
||||
"playlistLimitTrack": "この制限に達しました!プレイリストには{0}曲しか追加できません。",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"noPlaylistAcc": "{0}님은 재생 목록 계정을 만들지 않았습니다.",
|
||||
"overPlaylistCreation": "더 이상 {0}개 이상의 재생 목록을 만들 수 없습니다!",
|
||||
"playlistExists": "재생 목록 [{0}]이(가) 이미 있습니다.",
|
||||
"playlistNotInvaildUrl": "유효한 링크 또는 공개 Spotify 또는 YouTube 재생 목록 링크를 입력하세요.",
|
||||
"playlistNotInvalidUrl": "유효한 링크 또는 공개 Spotify 또는 YouTube 재생 목록 링크를 입력하세요.",
|
||||
"playlistCreated": "{0} 재생 목록을 만들었습니다. 자세한 내용은 /playlist view를 입력하세요.",
|
||||
"playlistRenamed": "{0}을(를) {1}(으)로 이름을 바꿨습니다.",
|
||||
"playlistLimitTrack": "죄송합니다! 재생 목록에 추가할 수 있는 노래는 {0}곡까지입니다.",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"noPlaylistAcc": "Пользователь `{0}` не создал учетную запись плейлиста.",
|
||||
"overPlaylistCreation": "Вы не можете создавать больше `{0}` плейлистов!",
|
||||
"playlistExists": "Плейлист [`{0}`] уже существует.",
|
||||
"playlistNotInvaildUrl": "Пожалуйста, введите действительную ссылку или публичную плейлист-ссылку на Spotify или YouTube.",
|
||||
"playlistNotInvalidUrl": "Пожалуйста, введите действительную ссылку или публичную плейлист-ссылку на Spotify или YouTube.",
|
||||
"playlistCreated": "Вы создали плейлист `{0}`. Введите /playlist view для получения дополнительной информации.",
|
||||
"playlistRenamed": "Вы переименовали `{0}` в `{1}`.",
|
||||
"playlistLimitTrack": "Вы достигли лимита! Вы можете добавить только `{0}` треков в свой плейлист.",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"noPlaylistAcc": "{0} не створив обліковий запис плейлиста.",
|
||||
"overPlaylistCreation": "Ви не можете створювати більше `{0}` плейлистів!",
|
||||
"playlistExists": "Плейлист [`{0}`] вже існує.",
|
||||
"playlistNotInvaildUrl": "Будь ласка, введіть дійсне посилання або публічне плейлист-посилання на Spotify або YouTube.",
|
||||
"playlistNotInvalidUrl": "Будь ласка, введіть дійсне посилання або публічне плейлист-посилання на Spotify або YouTube.",
|
||||
"playlistCreated": "Ви створили плейлист `{0}`. Введіть /playlist view для отримання додаткової інформації.",
|
||||
"playlistRenamed": "Ви перейменували `{0}` на `{1}`.",
|
||||
"playlistLimitTrack": "Ви досягли ліміту! Ви можете додати тільки `{0}` пісень до свого плейлиста.",
|
||||
|
||||
@@ -32,7 +32,7 @@ import function as func
|
||||
from typing import Optional
|
||||
from discord.ext import commands
|
||||
|
||||
class ExceuteModal(discord.ui.Modal):
|
||||
class ExecuteModal(discord.ui.Modal):
|
||||
def __init__(self, code: str, *args, **kwargs) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self.code: str = code
|
||||
@@ -139,7 +139,7 @@ class CogsDropdown(discord.ui.Select):
|
||||
except Exception as e:
|
||||
return await interaction.response.send_message(f"Unable to reload `{selected}`! Reason: {e}", ephemeral=True)
|
||||
|
||||
await interaction.response.send_message(f"Reloaded `{selected}` sucessfully!", ephemeral=True)
|
||||
await interaction.response.send_message(f"Reloaded `{selected}` successfully!", ephemeral=True)
|
||||
|
||||
class NodesDropdown(discord.ui.Select):
|
||||
def __init__(self, bot: commands.Bot):
|
||||
@@ -177,7 +177,7 @@ class NodesDropdown(discord.ui.Select):
|
||||
await interaction.response.defer()
|
||||
await self.view.message.edit(embed=self.view.build_embed(), view=self.view)
|
||||
|
||||
class ExceutePanel(discord.ui.View):
|
||||
class ExecutePanel(discord.ui.View):
|
||||
def __init__(self, bot, *, timeout = 180):
|
||||
self.bot: commands.Bot = bot
|
||||
|
||||
@@ -208,7 +208,7 @@ class ExceutePanel(discord.ui.View):
|
||||
await self.message.edit(view=self)
|
||||
|
||||
async def execute(self, interaction: discord.Interaction):
|
||||
modal = ExceuteModal(self.code, title="Enter Your Code")
|
||||
modal = ExecuteModal(self.code, title="Enter Your Code")
|
||||
await interaction.response.send_modal(modal)
|
||||
await modal.wait()
|
||||
|
||||
@@ -362,7 +362,7 @@ class CogsView(discord.ui.View):
|
||||
class DebugView(discord.ui.View):
|
||||
def __init__(self, bot, *, timeout: float | None = 180):
|
||||
self.bot: commands.Bot = bot
|
||||
self.panel: ExceutePanel = ExceutePanel(bot)
|
||||
self.panel: ExecutePanel = ExecutePanel(bot)
|
||||
|
||||
super().__init__(timeout=timeout)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ from discord.ext import commands
|
||||
import function as func
|
||||
|
||||
class HelpDropdown(discord.ui.Select):
|
||||
def __init__(self, categorys:list):
|
||||
def __init__(self, categories:list):
|
||||
self.view: HelpView
|
||||
|
||||
super().__init__(
|
||||
@@ -38,7 +38,7 @@ class HelpDropdown(discord.ui.Select):
|
||||
discord.SelectOption(emoji="🕹️", label="Tutorial", description="How to use Vocard."),
|
||||
] + [
|
||||
discord.SelectOption(emoji=emoji, label=f"{category} Commands", description=f"This is {category.lower()} Category.")
|
||||
for category, emoji in zip(categorys, ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣"])
|
||||
for category, emoji in zip(categories, ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣"])
|
||||
],
|
||||
custom_id="select"
|
||||
)
|
||||
@@ -54,13 +54,13 @@ class HelpView(discord.ui.View):
|
||||
self.author: discord.Member = author
|
||||
self.bot: commands.Bot = bot
|
||||
self.response: discord.Message = None
|
||||
self.categorys: list[str] = [ name.capitalize() for name, cog in bot.cogs.items() if len([c for c in cog.walk_commands()]) ]
|
||||
self.categories: list[str] = [ name.capitalize() for name, cog in bot.cogs.items() if len([c for c in cog.walk_commands()]) ]
|
||||
|
||||
self.add_item(discord.ui.Button(label='Website', emoji='🌎', url='https://vocard.xyz'))
|
||||
self.add_item(discord.ui.Button(label='Document', emoji=':support:915152950471581696', url='https://docs.vocard.xyz'))
|
||||
self.add_item(discord.ui.Button(label='Github', emoji=':github:1098265017268322406', url='https://github.com/ChocoMeow/Vocard'))
|
||||
self.add_item(discord.ui.Button(label='Donate', emoji=':patreon:913397909024800878', url='https://www.patreon.com/Vocard'))
|
||||
self.add_item(HelpDropdown(self.categorys))
|
||||
self.add_item(HelpDropdown(self.categories))
|
||||
|
||||
async def on_error(self, error, item, interaction) -> None:
|
||||
return
|
||||
@@ -82,8 +82,8 @@ class HelpView(discord.ui.View):
|
||||
if category == "news":
|
||||
embed = discord.Embed(title="Vocard Help Menu", url="https://discord.com/channels/811542332678996008/811909963718459392/1069971173116481636", color=func.settings.embed_color)
|
||||
embed.add_field(
|
||||
name=f"Available Categories: [{2 + len(self.categorys)}]",
|
||||
value="```py\n👉 News\n2. Tutorial\n{}```".format("".join(f"{i}. {c}\n" for i, c in enumerate(self.categorys, start=3))),
|
||||
name=f"Available Categories: [{2 + len(self.categories)}]",
|
||||
value="```py\n👉 News\n2. Tutorial\n{}```".format("".join(f"{i}. {c}\n" for i, c in enumerate(self.categories, start=3))),
|
||||
inline=True
|
||||
)
|
||||
|
||||
@@ -94,7 +94,7 @@ class HelpView(discord.ui.View):
|
||||
return embed
|
||||
|
||||
embed = discord.Embed(title=f"Category: {category.capitalize()}", color=func.settings.embed_color)
|
||||
embed.add_field(name=f"Categories: [{2 + len(self.categorys)}]", value="```py\n" + "\n".join(("👉 " if c == category.capitalize() else f"{i}. ") + c for i, c in enumerate(['News', 'Tutorial'] + self.categorys, start=1)) + "```", inline=True)
|
||||
embed.add_field(name=f"Categories: [{2 + len(self.categories)}]", value="```py\n" + "\n".join(("👉 " if c == category.capitalize() else f"{i}. ") + c for i, c in enumerate(['News', 'Tutorial'] + self.categories, start=1)) + "```", inline=True)
|
||||
|
||||
if category == 'tutorial':
|
||||
embed.description = "How can use Vocard? Some simple commands you should know now after watching this video."
|
||||
|
||||
@@ -44,7 +44,7 @@ class InboxView(discord.ui.View):
|
||||
def __init__(self, author: discord.Member, inbox: list[dict[str, Any]]):
|
||||
super().__init__(timeout=60)
|
||||
self.inbox: list[dict[str, Any]] = inbox
|
||||
self.newplaylist = []
|
||||
self.new_playlist = []
|
||||
|
||||
self.author: discord.Member = author
|
||||
self.response: discord.Message = None
|
||||
@@ -88,7 +88,7 @@ class InboxView(discord.ui.View):
|
||||
|
||||
@discord.ui.button(label='Accept', style=discord.ButtonStyle.green, custom_id="accept", disabled=True)
|
||||
async def accept_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
self.newplaylist.append(self.current)
|
||||
self.new_playlist.append(self.current)
|
||||
self.inbox.remove(self.current)
|
||||
self.current = None
|
||||
await self.button_change(interaction)
|
||||
|
||||
@@ -287,7 +287,7 @@ class Vibrato(Filter):
|
||||
self._init_with_scope({
|
||||
"frequency": [0, 14],
|
||||
"depth": [0, 1]
|
||||
}, tag=tag, frequenc=frequency, depth=depth)
|
||||
}, tag=tag, frequency=frequency, depth=depth)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Voicelink.VibratoFilter tag={self.tag} payload={self.payload}"
|
||||
|
||||
@@ -96,7 +96,7 @@ class Track:
|
||||
self.thumbnail = f"https://img.youtube.com/vi/{self.identifier}/maxresdefault.jpg"
|
||||
|
||||
self.emoji: str = get_source(self.source, "emoji")
|
||||
self.length: float = 3000 if self.source == "soundcloud" and "/preview/" in self.identifier else info.get("length")
|
||||
self.length: float = info.get("length")
|
||||
|
||||
self.requester: Member = requester
|
||||
self.is_stream: bool = info.get("isStream", False)
|
||||
@@ -117,13 +117,6 @@ class Track:
|
||||
def __repr__(self) -> str:
|
||||
return f"<Voicelink.track title={self.title!r} uri=<{self.uri!r}> length={self.length}>"
|
||||
|
||||
def toDict(self) -> dict:
|
||||
return {
|
||||
"track_id": self.track_id,
|
||||
"info": self.info,
|
||||
"thumbnail": self.thumbnail
|
||||
}
|
||||
|
||||
@property
|
||||
def track_id(self) -> str:
|
||||
if not self._track_id:
|
||||
@@ -135,6 +128,14 @@ class Track:
|
||||
def formatted_length(self) -> str:
|
||||
return ctime(self.length)
|
||||
|
||||
@property
|
||||
def data(self) -> dict:
|
||||
return {
|
||||
"track_id": self.track_id,
|
||||
"info": self.info,
|
||||
"thumbnail": self.thumbnail
|
||||
}
|
||||
|
||||
class Playlist:
|
||||
"""The base playlist object.
|
||||
Returns critical playlist information needed for parsing by Lavalink.
|
||||
|
||||
Reference in New Issue
Block a user