use logger_discord for print_jobs()
This commit is contained in:
parent
2ae54934c3
commit
a145c15b20
1 changed files with 8 additions and 7 deletions
|
@ -47,7 +47,7 @@ async def on_ready():
|
|||
# Schedule a database update
|
||||
scheduler.add_job(func=query_database, trigger='interval', seconds=30, id='query_database')
|
||||
scheduler.start()
|
||||
scheduler.print_jobs()
|
||||
logger_discord.info(scheduler.print_jobs())
|
||||
|
||||
@bot.command(name='hello', help='Say hello to the bot')
|
||||
@has_role(worshipper_role_name)
|
||||
|
@ -98,9 +98,9 @@ async def rec(ctx):
|
|||
stream_prio = playhead['prio']
|
||||
# Check if the recorder job already exists
|
||||
if scheduler.get_job('recorder') is None:
|
||||
scheduler.add_job(func=exec_recorder, id='recorder', args=playhead)
|
||||
logger_discord.info(scheduler.print_jobs())
|
||||
await ctx.channel.send(f'Recording from {stream_name} (prio={stream_prio})')
|
||||
scheduler.add_job(func=exec_recorder, id='recorder', args=(playhead))
|
||||
scheduler.print_jobs()
|
||||
else:
|
||||
await ctx.channel.send(f'Recorder is busy!')
|
||||
|
||||
|
@ -116,7 +116,7 @@ async def stop(ctx):
|
|||
if scheduler.get_job('recorder') is not None:
|
||||
await ctx.channel.send(f'Shutting down recorder')
|
||||
scheduler.remove_job('recorder')
|
||||
scheduler.print_jobs()
|
||||
logger_discord.info(scheduler.print_jobs())
|
||||
else:
|
||||
await ctx.channel.send(f'Recorder is stopped.')
|
||||
|
||||
|
@ -131,7 +131,8 @@ async def query_playhead():
|
|||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get(head_url)
|
||||
playhead = response.json()
|
||||
logger_discord.info(f'Playhead at {playhead['head']}')
|
||||
head = playhead['head']
|
||||
logger_discord.info(f'Playhead at {head}')
|
||||
except Exception as e:
|
||||
logger_discord.error('Cannot connect to the playhead!')
|
||||
logger_discord.error(e)
|
||||
|
@ -168,7 +169,7 @@ async def query_database():
|
|||
logger_discord.info(f'{stream_name} live stream detected!')
|
||||
scheduler.add_job(func=announce_live_channel, trigger='interval', minutes=int(live_channel_update), id='announce_live_channel', args=(stream_name, stream_meta))
|
||||
scheduler.get_job('announce_live_channel').modify(next_run_time=datetime.now())
|
||||
scheduler.print_jobs()
|
||||
logger_discord.info(scheduler.print_jobs())
|
||||
return
|
||||
else:
|
||||
# Exit since we already have a live announcement job
|
||||
|
@ -177,7 +178,7 @@ async def query_database():
|
|||
# Cleanup the announce job
|
||||
if scheduler.get_job('announce_live_channel') is not None:
|
||||
scheduler.remove_job('announce_live_channel')
|
||||
scheduler.print_jobs()
|
||||
logger_discord.info(scheduler.print_jobs())
|
||||
if live_channel_id != 0:
|
||||
live_channel = bot.get_channel(int(live_channel_id))
|
||||
await live_channel.send(f'{stream_name} is offline.')
|
||||
|
|
Loading…
Add table
Reference in a new issue