some refractor

This commit is contained in:
2022-08-29 00:38:13 +03:00
parent caa8d6b20e
commit 4a33b35283
9 changed files with 87 additions and 89 deletions

View File

@@ -1,12 +1,15 @@
import logging
import random
from os import path, makedirs, rename, remove
from typing import Optional
import disnake
from disnake import Option, OptionType
from disnake.ext import commands
from lib.Comands import determine_time
from lib.DB import read_db, check_exist_audio, add_audio
from lib.Player import play_audio
from lib.Player import play_audio, get_audio_list
# todo: write chose audio from list by slash command
@@ -54,6 +57,18 @@ class Audio(commands.Cog):
else:
logging.info(f'Skip playing by any else')
@commands.slash_command(name="play_audio",
description="Set channel whitch itterate with bot",
options=[
Option("audio", "select audio", OptionType.string, required=True),
]
)
async def play_audio(self,
integration: disnake.ApplicationCommandInteraction,
audio: Optional[str]
) -> None:
await get_audio_list(integration, audio)
@commands.command(name="upload_audio")
async def upload_audio(self, ctx, user=None):
user = user or ctx.author