initial yandex music
This commit is contained in:
@@ -14,11 +14,3 @@ qodana:
|
||||
expose_as: 'qodana_report'
|
||||
expire_in: 1 week
|
||||
paths: [ '.qodana/results/' ]
|
||||
|
||||
deploy:
|
||||
only:
|
||||
- master
|
||||
image: alpine
|
||||
script:
|
||||
- apk --update add openssh-client
|
||||
- ssh -i $SSH_KEY $BOT_HOST && cd /opt/discord/tarkov && git pull
|
||||
10
bot.py
10
bot.py
@@ -6,7 +6,7 @@ import disnake
|
||||
from dotenv import load_dotenv
|
||||
from disnake import OptionType, Option
|
||||
from disnake.ext import commands
|
||||
from __init__ import version_info as ver
|
||||
from __init__ import version_info as ver, __version__
|
||||
from lib.CogsPrep import work_with_cogs, cog_list
|
||||
from lib.Comands import determine_prefix
|
||||
from lib.Logger import logger
|
||||
@@ -42,8 +42,8 @@ asyncio.run(work_with_cogs('load', bot, asyncio.run(cog_list())))
|
||||
async def on_ready():
|
||||
logger.info('Bot started')
|
||||
logger.info(f'Disnake version {disnake.__version__}')
|
||||
logger.info('We have logged in as {0.user}'.format(bot))
|
||||
logger.info(f'Version of bot is - v{ver.major}.{ver.minor}.{ver.micro}-{ver.releaselevel}')
|
||||
logger.info(f'We have logged in as {bot.user}')
|
||||
logger.info(f'Version of bot is - v{__version__}-{ver.releaselevel}')
|
||||
|
||||
|
||||
@bot.slash_command(
|
||||
@@ -71,12 +71,14 @@ async def slash_cogs(inter: disnake.ApplicationCommandInteraction, what_do, cog:
|
||||
|
||||
|
||||
@slash_cogs.autocomplete('cog')
|
||||
async def _cog_opt(inter: disnake.ApplicationCommandInteraction, current: str, what_do):
|
||||
async def _cog_opt(inter: disnake.ApplicationCommandInteraction, what_do, current: str):
|
||||
current = current.lower()
|
||||
if what_do == 'enable':
|
||||
_list = await cog_list('./cogs/disabled/')
|
||||
logger.error(_list)
|
||||
else:
|
||||
_list = await cog_list()
|
||||
logger.error(_list)
|
||||
return [choice for choice in _list if current in choice.lower()]
|
||||
|
||||
|
||||
|
||||
@@ -13,9 +13,12 @@ class Testing(commands.Cog, name='Testing'):
|
||||
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')
|
||||
Option(name='search', description='seach track/artist'),
|
||||
Option(name='type', description='type of search',
|
||||
choices=['all', 'artist', 'user', 'album', 'playlist', 'track', 'podcast', 'podcast_episode'])
|
||||
])
|
||||
async def play(self, inter: disnake.ApplicationCommandInteraction, audio):
|
||||
# TODO add yandex_music player with queue, playlists
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@ from disnake import FFmpegOpusAudio
|
||||
|
||||
async def play_audio(audio, bot, vc):
|
||||
if not bot.voice_clients:
|
||||
# logger.info(audio)
|
||||
logger.error(f'Playing: {audio}')
|
||||
await sleep(1)
|
||||
vp = await vc.connect()
|
||||
if not vp.is_playing():
|
||||
vp.play(FFmpegOpusAudio(f'{audio}'))
|
||||
|
||||
10
lib/YandexPlayer.py
Normal file
10
lib/YandexPlayer.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import os
|
||||
|
||||
from yandex_music import Client
|
||||
|
||||
client = Client(os.getenv('Yandex_Token')).init()
|
||||
|
||||
|
||||
def _search(self, _str: str, _type: str):
|
||||
search_result = client.search(_str, type_=_type)
|
||||
pass
|
||||
Reference in New Issue
Block a user