diff --git a/cogs/playlist.py b/cogs/playlist.py index 38ec9c7..bdba67e 100644 --- a/cogs/playlist.py +++ b/cogs/playlist.py @@ -8,7 +8,7 @@ from function import ( time as ctime, get_playlist, create_account, - checkroles, + check_roles, update_playlist, update_inbox, get_lang, @@ -103,7 +103,7 @@ class Playlists(commands.Cog, name="playlist"): return await create_account(ctx) if not result['playlist']: return await ctx.send(get_lang(ctx.guild.id, 'playlistNotFound').format(name), ephemeral=True) - rank, max_p, max_t = await checkroles() + rank, max_p, max_t = check_roles() if result['position'] > max_p: return await ctx.send(get_lang(ctx.guild.id, 'playlistNotAccess'), ephemeral=True) @@ -141,7 +141,7 @@ class Playlists(commands.Cog, name="playlist"): user = await check_playlist(ctx, full=True) if not user: return await create_account(ctx) - rank, max_p, max_t = await checkroles() + rank, max_p, max_t = check_roles() results = [] for index, data in enumerate(user, start=1): @@ -195,7 +195,7 @@ class Playlists(commands.Cog, name="playlist"): if len(name) > 10: return await ctx.send(get_lang(ctx.guild.id, 'playlistOverText'), ephemeral=True) - rank, max_p, max_t = await checkroles() + rank, max_p, max_t = check_roles() user = await check_playlist(ctx, full=True) if not user: return await create_account(ctx) @@ -344,7 +344,7 @@ class Playlists(commands.Cog, name="playlist"): if result['playlist']['type'] in ['share', 'link']: return await ctx.send(get_lang(ctx.guild.id, 'playlistNotAllow'), ephemeral=True) - rank, max_p, max_t = await checkroles() + rank, max_p, max_t = check_roles() if len(result['playlist']['tracks']) >= max_t: return await ctx.send(get_lang(ctx.guild.id, 'playlistLimitTrack').format(max_t), ephemeral=True) @@ -456,7 +456,7 @@ class Playlists(commands.Cog, name="playlist"): if len(name) > 10: return await ctx.send(get_lang(ctx.guild.id, 'playlistOverText'), ephemeral=True) - rank, max_p, max_t = await checkroles() + rank, max_p, max_t = check_roles() user = await check_playlist(ctx, full=True) if not user: return await create_account(ctx) diff --git a/function.py b/function.py index 1e0fb30..6e09162 100644 --- a/function.py +++ b/function.py @@ -163,6 +163,9 @@ def cooldown_check(ctx: commands.Context) -> Optional[commands.Cooldown]: def get_aliases(name: str) -> list: return settings.aliases_settings.get(name, []) +def check_roles() -> tuple[str, int, int]: + return 'Normal', 5, 500 + async def requests_api(url: str) -> dict: async with aiohttp.ClientSession() as session: resp = await session.get(url) @@ -211,7 +214,4 @@ async def update_playlist(user_id:int, data:dict, *, mode:str="set", update_cach PLAYLISTS_DB.update_one({"_id":user_id}, {f"${mode}": data}) async def update_inbox(user_id:int, data:dict) -> None: - return PLAYLISTS_DB.update_one({"_id":user_id}, {"$push":{'inbox':data}}) - -async def checkroles(): - return 'Normal', 5, 500 \ No newline at end of file + return PLAYLISTS_DB.update_one({"_id":user_id}, {"$push":{'inbox':data}}) \ No newline at end of file diff --git a/views/controller.py b/views/controller.py index a779020..ea8f8b1 100644 --- a/views/controller.py +++ b/views/controller.py @@ -31,7 +31,7 @@ from function import ( get_playlist, update_playlist, create_account, - checkroles + check_roles ) from typing import Dict @@ -200,7 +200,7 @@ class Add(ControlButton): user = await get_playlist(interaction.user.id, 'playlist') if not user: return await create_account(interaction) - rank, max_p, max_t = await checkroles() + rank, max_p, max_t = check_roles() if len(user['200']['tracks']) >= max_t: return await self.send(interaction, self.player.get_msg("playlistlimited").format(max_t), ephemeral=True) diff --git a/web/ipc/methods.py b/web/ipc/methods.py index 4705fcb..74fcc6d 100644 --- a/web/ipc/methods.py +++ b/web/ipc/methods.py @@ -321,7 +321,7 @@ async def addPlaylistTrack(member: Member, data: dict): if playlist["type"] != "playlist": return error_msg(func.get_lang(member.guild.id, 'playlistNotAllow'), user_id=member.id) - rank, max_p, max_t = await func.checkroles() + rank, max_p, max_t = func.check_roles() if len(playlist["tracks"]) >= max_t: return error_msg(func.get_lang(member.guild.id, "playlistlimited").format(max_t), user_id=member.id)