rename strings

This commit is contained in:
deflax 2024-01-17 04:58:56 +02:00
parent 26b413725f
commit 03a629e13b

View file

@ -74,11 +74,11 @@ async def update_database():
database = response.json() database = response.json()
if database != {}: if database != {}:
for key, value in database.items(): for key, value in database.items():
name = value['name'] stream_name = value['name']
start_at = value['start_at'] stream_start_at = value['start_at']
if start_at == 'now': if stream_start_at == 'now':
logger_discord.info(f'{name} live stream detected!') logger_discord.info(f'{stream_name} live stream detected!')
scheduler.add_job(func=announce_live_channel, trigger='interval', seconds=60, id='announce_live_channel', args=(name)) scheduler.add_job(func=announce_live_channel, trigger='interval', seconds=60, id='announce_live_channel', args=(stream_name))
return return
try: try:
@ -86,20 +86,20 @@ async def update_database():
if job: if job:
scheduler.remove_job('announce_live_channel') scheduler.remove_job('announce_live_channel')
live_channel = bot.get_channel(announce_channel_id) live_channel = bot.get_channel(announce_channel_id)
logger_discord.info(f'{name} finished') logger_discord.info(f'{stream_name} finished')
await live_channel.send(f'{name} finished') await live_channel.send(f'{stream_name} finished')
else: else:
return return
except JobLookupError: except JobLookupError:
return return
async def announce_live_channel(name): async def announce_live_channel(stream_name):
if announce_channel_id == 'disabled': if announce_channel_id == 'disabled':
return return
else: else:
live_channel = bot.get_channel(announce_channel_id) live_channel = bot.get_channel(announce_channel_id)
logger_discord.info(f'{name} is live!') logger_discord.info(f'{stream_name} is live!')
await live_channel.send(f'{name} is live!') await live_channel.send(f'{stream_name} is live!')
# Run the bot with your token # Run the bot with your token
asyncio.run(bot.run(bot_token)) asyncio.run(bot.run(bot_token))