Changelog - Version 3.10 (2024-04-09)
Fixed
- Rolled out a fix for the timed messages not being scheduled and posted to chat during the stream.
- Added two new imports to fix the timed messages
from asyncio import Task, create_task, sleep from typing import List
- Added two new imports to fix the timed messages
Added
- Added the function for the scheduled tasks for the timed messages.
scheduled_tasks: List[Task] = []
Changed
- The entire timed function ```py async def send_timed_message(message, interval): try: await sleep(interval) if stream_online: channel = bot.get_channel(CHANNEL_NAME) await channel.send(message) except asyncio.CancelledError: pass await sleep(interval)
async def timed_message(): global stream_online while True: if stream_online: cursor.execute(‘SELECT interval, message FROM timed_messages’) messages = cursor.fetchall() for message, interval in messages: time_now = datetime.now() send_time = time_now + timedelta(minutes=int(interval)) wait_time = (send_time - time_now).total_seconds() task = create_task(send_timed_message(message, wait_time)) scheduled_tasks.append(task) # Keep track of the task else: # Cancel all scheduled tasks if the stream goes offline for task in scheduled_tasks: task.cancel() scheduled_tasks.clear() # Clear the list of tasks
await sleep(300) ```
Removed
- Removed webhook port as it’s no longer needed moving forward.
- Removed websocket port as it’s no longer needed forward.