This commit is contained in:
SpudGunMan
2025-10-25 18:50:12 -07:00
parent 166c49854f
commit 80fc795f35
3 changed files with 15 additions and 12 deletions
+1 -1
View File
@@ -287,7 +287,7 @@ message = "MeshBot says Hello! DM for more info."
# enable overides the above and uses the motd as the message
schedulerMotd = False
# value can be min,hour,day,mon,tue,wed,thu,fri,sat,sun.
# value can also be 'joke' (everyXmin) or 'weather' (hour) or 'link' (hour) for special auto messages
# value can also be 'joke' (min/interval) or 'weather' (time/day) or 'link' (hour/interval) for special auto messages
# 'custom' for module/scheduler.py custom schedule examples
value =
# interval to use when time is not set (e.g. every 2 days)
+6 -6
View File
@@ -285,9 +285,9 @@ See modules/custom_scheduler.py for advanced scheduling using python
**Features:**
- **Basic Scheduling:** Send messages on a set schedule (e.g., every day at 09:00, every Monday at noon, every hour, etc.).
- **Joke Scheduler:** Automatically send jokes at a chosen interval.
- **Weather Scheduler:** Send weather updates at a chosen interval.
- **Custom Scheduler:** Import and run your own scheduled jobs by editing `custom_scheduler.py`.
- **Joke Scheduler:** Automatically send jokes every x min
- **Weather Scheduler:** Send weather updates at time of day, daily.
- **Custom Scheduler:** run your own scheduled jobs by editing `custom_scheduler.py`.
- **Logging:** All scheduling actions are logged for debugging and monitoring.
**Example Configuration:**
@@ -348,11 +348,11 @@ You can schedule messages or actions using the following options in your configu
- → Sends a bbslink message every 2 hours.
#### **weather**
- Schedules the bot to send a weather update at the specified interval (in hours).
- Schedules the bot to send a weather update at the specified time of day, daily.
- **Example:**
- Option: `weather`
- Interval: `3`
- → Sends a weather update every 3 hours.
- Interval: `08:00`
- → Sends a weather update daily at 8:00a.
---
+8 -5
View File
@@ -117,20 +117,21 @@ def setup_scheduler(
elif 'min' in schedulerValue.lower():
schedule.every(schedulerIntervalInt).minutes.do(lambda: send_message(scheduler_message, schedulerChannel, 0, schedulerInterface))
logger.debug(f"System: Starting the basic scheduler to send '{scheduler_message}' on schedule '{schedulerValue}' every {schedulerIntervalInt} interval at time '{schedulerTime}' on Device:{schedulerInterface} Channel:{schedulerChannel}")
# value can also be 'joke' (interval), 'weather' (time), or 'link' (interval) for special auto messages
elif 'joke' in schedulerValue.lower():
# Schedule to send a joke every specified interval
# Schedule to send a joke every specified interval minutes
schedule.every(schedulerIntervalInt).minutes.do(lambda: send_message(tell_joke(), schedulerChannel, 0, schedulerInterface))
logger.debug(f"System: Starting the joke scheduler to send a joke every {schedulerIntervalInt} minutes on Device:{schedulerInterface} Channel:{schedulerChannel}")
elif 'link' in schedulerValue.lower():
# Schedule to send a link message every specified interval
# Schedule to send a link message every specified interval hours
schedule.every(schedulerIntervalInt).hours.do(lambda: send_message(handle_satpass(schedulerInterface, 'link'), schedulerChannel, 0, schedulerInterface))
logger.debug(f"System: Starting the link scheduler to send link messages every {schedulerIntervalInt} hours on Device:{schedulerInterface} Channel:{schedulerChannel}")
elif 'weather' in schedulerValue.lower():
# Schedule to send weather updates every specified interval
schedule.every(schedulerIntervalInt).hours.do(lambda: send_message(handle_wxc(0, schedulerInterface, 'wx'), schedulerChannel, 0, schedulerInterface))
# Schedule to send weather updates every specified time every day
schedule.every().day.at(schedulerTime)(lambda: send_message(handle_wxc(0, schedulerInterface, 'wx'), schedulerChannel, 0, schedulerInterface))
logger.debug(f"System: Starting the weather scheduler to send weather updates every {schedulerIntervalInt} hours on Device:{schedulerInterface} Channel:{schedulerChannel}")
elif 'custom' in schedulerValue.lower():
# Import and setup custom schedules from custom_scheduler.py
# Import and setup custom schedules from custom_scheduler.py
try:
# This file is located in etc/custom_scheduler.py and copied to modules/custom_scheduler.py at install
from modules.custom_scheduler import setup_custom_schedules # type: ignore # pylance
@@ -143,3 +144,5 @@ def setup_scheduler(
logger.warning("Custom scheduler file not found or failed to import. cp etc/custom_scheduler.py modules/custom_scheduler.py")
except Exception as e:
logger.error(f"System: Scheduler Error {e}")
return True