Finished audio list generator
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user