set default announcement interval at 24hours
This commit is contained in:
parent
3a335b5dba
commit
4b0a06ba80
2 changed files with 7 additions and 6 deletions
|
@ -10,7 +10,7 @@ import logging
|
||||||
# Read env variables
|
# Read env variables
|
||||||
bot_token = os.environ.get('DISCORDBOT_TOKEN', 'token')
|
bot_token = os.environ.get('DISCORDBOT_TOKEN', 'token')
|
||||||
live_channel_id = os.environ.get('DISCORDBOT_LIVE_CHANNEL_ID', 0)
|
live_channel_id = os.environ.get('DISCORDBOT_LIVE_CHANNEL_ID', 0)
|
||||||
live_channel_update = os.environ.get('DISCORDBOT_LIVE_CHANNEL_UPDATE', 5)
|
live_channel_update = os.environ.get('DISCORDBOT_LIVE_CHANNEL_UPDATE', 1440)
|
||||||
scheduler_hostname = os.environ.get('SCHEDULER_API_HOSTNAME', 'tv.example.com')
|
scheduler_hostname = os.environ.get('SCHEDULER_API_HOSTNAME', 'tv.example.com')
|
||||||
|
|
||||||
# Discord API Intents
|
# Discord API Intents
|
||||||
|
@ -136,7 +136,7 @@ async def query_database():
|
||||||
# Exit since we found one
|
# Exit since we found one
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
# Exit since we already have a announcement job
|
# Exit since we already have a live announcement job
|
||||||
return
|
return
|
||||||
|
|
||||||
# Cleanup the announce job
|
# Cleanup the announce job
|
||||||
|
@ -150,7 +150,6 @@ async def query_database():
|
||||||
thumb_filename = rechead['thumb']
|
thumb_filename = rechead['thumb']
|
||||||
# Reset the rechead
|
# Reset the rechead
|
||||||
rechead = {}
|
rechead = {}
|
||||||
await live_channel.send('Stream is offline.')
|
|
||||||
|
|
||||||
# Creating an embed
|
# Creating an embed
|
||||||
img_url = f'https://{scheduler_hostname}/img'
|
img_url = f'https://{scheduler_hostname}/img'
|
||||||
|
@ -176,8 +175,10 @@ async def query_database():
|
||||||
# Sending the embed to the channel
|
# Sending the embed to the channel
|
||||||
await live_channel.send(embed=embed)
|
await live_channel.send(embed=embed)
|
||||||
logger_discord.info(f'{rec_stream_name} is offline. VOD: {video_filename_no_extension}')
|
logger_discord.info(f'{rec_stream_name} is offline. VOD: {video_filename_no_extension}')
|
||||||
else:
|
else:
|
||||||
logger_discord.info('Stream is offline.')
|
# Send offline message only
|
||||||
|
await live_channel.send('Stream is offline.')
|
||||||
|
logger_discord.info('Stream is offline.')
|
||||||
|
|
||||||
async def announce_live_channel(stream_name, stream_meta):
|
async def announce_live_channel(stream_name, stream_meta):
|
||||||
logger_discord.info(f'{stream_name} is live! {stream_meta}')
|
logger_discord.info(f'{stream_name} is live! {stream_meta}')
|
||||||
|
|
|
@ -8,4 +8,4 @@ SCHEDULER_LOG_LEVEL=warn
|
||||||
SCHEDULER_API_HOSTNAME=tv.example.com
|
SCHEDULER_API_HOSTNAME=tv.example.com
|
||||||
DISCORDBOT_TOKEN=changeme
|
DISCORDBOT_TOKEN=changeme
|
||||||
DISCORDBOT_LIVE_CHANNEL_ID=0
|
DISCORDBOT_LIVE_CHANNEL_ID=0
|
||||||
DISCORDBOT_LIVE_CHANNEL_UPDATE=5
|
DISCORDBOT_LIVE_CHANNEL_UPDATE=1440
|
||||||
|
|
Loading…
Reference in a new issue