Finished audio list generator

This commit is contained in:
2022-09-01 15:15:30 +03:00
parent 5b134e6446
commit 3c0851102d
7 changed files with 139 additions and 67 deletions

View File

@@ -21,7 +21,6 @@ class Audio(commands.Cog, name='Audio'):
# todo: complete check activity
@commands.Cog.listener()
async def on_voice_state_update(self, member, before, after):
print(type(member.roles))
if before.channel is None and not member.bot:
if any('Escape from Tarkov' in str(user.activity) for user in after.channel.members):
logger.info('Skip playing by Game')
@@ -46,12 +45,12 @@ class Audio(commands.Cog, name='Audio'):
if audio_db is None: audio_db = []
logger.info(f'Play audio from DB')
full_audio = def_audio_db + audio_db
await play_audio(random.choice(full_audio), self.bot, after.channel)
await play_audio(f'audio/{random.choice(full_audio)}', self.bot, after.channel)
elif len(member.roles) == 1 or _role is None:
logger.info(f'Skip playing by role')
elif any(str(role.id) in _role for role in member.roles):
logger.info(f'Play audio from list by role')
await play_audio(random.choice(def_audio_ls), self.bot, after.channel)
await play_audio(f'audio/{random.choice(def_audio_ls)}', self.bot, after.channel)
else:
logger.info(f'Skip playing by any else')