Update command_handlers.py

This commit is contained in:
ReneKlever 2025-04-12 11:38:41 +02:00 committed by GitHub
parent ba8285552f
commit 32ece9e0d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,14 +7,14 @@ from meshtastic import BROADCAST_NUM
from db_operations import ( from db_operations import (
add_bulletin, add_mail, delete_mail, add_bulletin, add_mail, delete_mail,
get_bulletin_content, get_bulletins, get_hot_bulletin, get_bulletin_content, get_bulletins, get_hot_bulletin, get_hot_bulletins,
get_mail, get_mail_content, get_mail, get_mail_content,
add_channel, get_channels, get_sender_id_by_mail_id add_channel, get_channels, get_sender_id_by_mail_id
) )
from utils import ( from utils import (
get_node_id_from_num, get_node_info, get_node_id_from_num, get_node_info,
get_node_short_name, send_message, get_node_short_name, send_message,
update_user_state update_user_state, datum
) )
# Read the configuration for menu options # Read the configuration for menu options
@ -60,10 +60,8 @@ def handle_help_command(sender_id, interface, menu_name=None):
else: else:
update_user_state(sender_id, {'command': 'MAIN_MENU', 'step': 1}) # Reset to main menu state update_user_state(sender_id, {'command': 'MAIN_MENU', 'step': 1}) # Reset to main menu state
mails = len(get_mail(get_node_id_from_num(sender_id, interface))) mails = len(get_mail(get_node_id_from_num(sender_id, interface)))
date = str(get_hot_bulletin()) date = get_hot_bulletins()
date = date[2:] response = build_menu(main_menu_items, f"💾NieuwAlphen BBS💾", mails, datum(date[0]))
date = date[:-3]
response = build_menu(main_menu_items, f"💾NieuwAlphen BBS💾", mails, date)
send_message(response, sender_id, interface) send_message(response, sender_id, interface)
def get_node_name(node_id, interface): def get_node_name(node_id, interface):
@ -81,7 +79,14 @@ def handle_mail_command(sender_id, interface):
def handle_bulletin_command(sender_id, interface): def handle_bulletin_command(sender_id, interface):
response = f"📰Bulletin Menu📰\nWhich board would you like to enter?\n[G]eneral [I]nfo [N]ews [U]rgent" date = get_hot_bulletin("general")
response = f"📰Bulletin Menu📰\nWhich board would you like to enter?\n[G]eneral (" + datum(date[0]) + ")\n"
date = get_hot_bulletin("info")
response += "[I]nfo (" + datum(date[0]) + ")\n"
date = get_hot_bulletin("news")
response += "[N]ews (" + datum(date[0]) + ")\n"
date = get_hot_bulletin("urgent")
response += "[U]rgent (" + datum(date[0]) + ")\n"
send_message(response, sender_id, interface) send_message(response, sender_id, interface)
update_user_state(sender_id, {'command': 'BULLETIN_MENU', 'step': 1}) update_user_state(sender_id, {'command': 'BULLETIN_MENU', 'step': 1})