updated structure
This commit is contained in:
29
bot/cogs/disabled/test.py
Normal file
29
bot/cogs/disabled/test.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import disnake
|
||||
from disnake import Option
|
||||
from disnake.ext import commands
|
||||
|
||||
from bot.lib import YandexPlayer
|
||||
from bot.lib import logger
|
||||
|
||||
|
||||
class Testing(commands.Cog, name='Testing'):
|
||||
def __init__(self, bot: commands.Bot):
|
||||
self.bot = bot # defining bot as global var in class
|
||||
|
||||
@commands.Cog.listener() # this is a decorator for events/listeners
|
||||
async def on_ready(self):
|
||||
logger.info(f'Cog {__name__.split(".")[1]} is ready!.')
|
||||
|
||||
@commands.slash_command(name='play', description='play audio test from yandex.music', options=[
|
||||
Option(name='search',
|
||||
description='seach track/artist',
|
||||
required=True),
|
||||
])
|
||||
async def play(self, inter: disnake.ApplicationCommandInteraction, search: str):
|
||||
# TODO add yandex_music player with queue, playlists
|
||||
result = YandexPlayer.search(search)
|
||||
await inter.response.send_message(result, ephemeral=True)
|
||||
|
||||
|
||||
def setup(bot): # an extension must have a setup function
|
||||
bot.add_cog(Testing(bot)) # adding a cog
|
||||
Reference in New Issue
Block a user