mirror of
https://github.com/deadcxap/YandexMusicDiscordBot.git
synced 2026-01-11 21:51:40 +03:00
fix: Missed checks.
This commit is contained in:
@@ -207,6 +207,11 @@ class General(Cog):
|
|||||||
@account.command(description="Удалить токен из базы данных бота.")
|
@account.command(description="Удалить токен из базы данных бота.")
|
||||||
async def remove(self, ctx: discord.ApplicationContext) -> None:
|
async def remove(self, ctx: discord.ApplicationContext) -> None:
|
||||||
logging.info(f"[GENERAL] Remove command invoked by user {ctx.author.id} in guild {ctx.guild.id}")
|
logging.info(f"[GENERAL] Remove command invoked by user {ctx.author.id} in guild {ctx.guild.id}")
|
||||||
|
if not await self.users_db.get_ym_token(ctx.user.id):
|
||||||
|
logging.info(f"[GENERAL] No token found for user {ctx.author.id}")
|
||||||
|
await ctx.respond('❌ Токен не указан.', delete_after=15, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
await self.users_db.update(ctx.user.id, {'ym_token': None})
|
await self.users_db.update(ctx.user.id, {'ym_token': None})
|
||||||
await ctx.respond(f'Токен был удалён.', delete_after=15, ephemeral=True)
|
await ctx.respond(f'Токен был удалён.', delete_after=15, ephemeral=True)
|
||||||
|
|
||||||
|
|||||||
@@ -282,14 +282,17 @@ class Voice(Cog, VoiceExtension):
|
|||||||
await ctx.respond("❌ У вас нет прав для выполнения этой команды.", delete_after=15, ephemeral=True)
|
await ctx.respond("❌ У вас нет прав для выполнения этой команды.", delete_after=15, ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (vc := await self.get_voice_client(ctx)) and await self.voice_check(ctx):
|
if (vc := await self.get_voice_client(ctx)) and await self.voice_check(ctx) and vc.is_connected:
|
||||||
res = await self.stop_playing(ctx, full=True)
|
res = await self.stop_playing(ctx, full=True)
|
||||||
if res:
|
if res:
|
||||||
await vc.disconnect(force=True)
|
await vc.disconnect(force=True)
|
||||||
await ctx.respond("Отключение успешно!", delete_after=15, ephemeral=True)
|
await ctx.respond("Отключение успешно!", delete_after=15, ephemeral=True)
|
||||||
logging.info(f"[VOICE] Successfully disconnected from voice channel in guild {ctx.guild.id}")
|
logging.info(f"[VOICE] Successfully disconnected from voice channel in guild {ctx.guild.id}")
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
await ctx.respond("❌ Не удалось отключиться.", delete_after=15, ephemeral=True)
|
await ctx.respond("❌ Не удалось отключиться.", delete_after=15, ephemeral=True)
|
||||||
|
else:
|
||||||
|
await ctx.respond("❌ Бот не подключен к голосовому каналу.", delete_after=15, ephemeral=True)
|
||||||
|
|
||||||
@queue.command(description="Очистить очередь треков и историю прослушивания.")
|
@queue.command(description="Очистить очередь треков и историю прослушивания.")
|
||||||
async def clear(self, ctx: discord.ApplicationContext) -> None:
|
async def clear(self, ctx: discord.ApplicationContext) -> None:
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class BaseGuildsDatabase:
|
|||||||
is_stopped=True,
|
is_stopped=True,
|
||||||
allow_explicit=True,
|
allow_explicit=True,
|
||||||
always_allow_menu=False,
|
always_allow_menu=False,
|
||||||
allow_connect=False,
|
allow_connect=True,
|
||||||
vote_next_track=True,
|
vote_next_track=True,
|
||||||
vote_add_track=True,
|
vote_add_track=True,
|
||||||
vote_add_album=True,
|
vote_add_album=True,
|
||||||
|
|||||||
Reference in New Issue
Block a user