General Clean Code

This commit is contained in:
Choco
2023-04-05 22:48:12 +08:00
parent d98c8fdb77
commit 9570c0e9d3
9 changed files with 44 additions and 41 deletions

View File

@@ -22,20 +22,17 @@ from function import (
from datetime import datetime
from views import PlaylistView, InboxView, HelpView
def assign_playlistId(existed: list) -> str:
for i in range(200, 210):
if str(i) not in existed:
return str(i)
async def check_playlist_perms(userid: int, authorid: int, dId: str) -> dict:
playlist = await get_playlist(authorid, 'playlist', dId)
if not playlist or userid not in playlist['perms']['read']:
return {}
return playlist
async def check_playlist(ctx: commands.Context, name: str = None, full: bool = False, share: bool = True) -> dict:
user = await get_playlist(ctx.author.id, 'playlist')
if not user:
@@ -56,7 +53,6 @@ async def check_playlist(ctx: commands.Context, name: str = None, full: bool = F
return {'playlist': playlist, 'position': index, 'id': data}
return {'playlist': None, 'position': None, 'id': None}
async def search_playlist(url: str, requester: discord.Member, timeNeed=True):
try:
tracks = await voicelink.NodePool.get_node().get_tracks(url, requester=requester)