mirror of
https://github.com/TheCommsChannel/TC2-BBS-mesh.git
synced 2024-10-01 01:15:36 -04:00
Add ability to remove menu items
Added the ability to remove items from menus for those who may not be using features like JS8call, etc..
This commit is contained in:
parent
33020e8ec5
commit
fc86fe923e
@ -1,3 +1,4 @@
|
||||
import configparser
|
||||
import logging
|
||||
import random
|
||||
import time
|
||||
@ -16,17 +17,51 @@ from utils import (
|
||||
update_user_state
|
||||
)
|
||||
|
||||
# Read the configuration for menu options
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config.ini')
|
||||
|
||||
main_menu_items = config['menu']['main_menu_items'].split(',')
|
||||
bbs_menu_items = config['menu']['bbs_menu_items'].split(',')
|
||||
utilities_menu_items = config['menu']['utilities_menu_items'].split(',')
|
||||
|
||||
|
||||
def build_menu(items, menu_name):
|
||||
menu_str = f"{menu_name}\n"
|
||||
for item in items:
|
||||
if item.strip() == 'Q':
|
||||
menu_str += "[Q]uick Commands\n"
|
||||
elif item.strip() == 'B':
|
||||
menu_str += "[B]BS\n"
|
||||
elif item.strip() == 'U':
|
||||
menu_str += "[U]tilities\n"
|
||||
elif item.strip() == 'X':
|
||||
menu_str += "E[X]IT\n"
|
||||
elif item.strip() == 'M':
|
||||
menu_str += "[M]ail\n"
|
||||
elif item.strip() == 'C':
|
||||
menu_str += "[C]hannel Dir\n"
|
||||
elif item.strip() == 'J':
|
||||
menu_str += "[J]S8CALL\n"
|
||||
elif item.strip() == 'S':
|
||||
menu_str += "[S]tats\n"
|
||||
elif item.strip() == 'F':
|
||||
menu_str += "[F]ortune\n"
|
||||
elif item.strip() == 'W':
|
||||
menu_str += "[W]all of Shame\n"
|
||||
return menu_str
|
||||
|
||||
|
||||
def handle_help_command(sender_id, interface, menu_name=None):
|
||||
if menu_name:
|
||||
update_user_state(sender_id, {'command': 'MENU', 'menu': menu_name, 'step': 1})
|
||||
if menu_name == 'bbs':
|
||||
response = "📰BBS Menu📰\n[M]ail\n[B]ulletins\n[C]hannel Dir\n[J]S8CALL\nE[X]IT"
|
||||
response = build_menu(bbs_menu_items, "📰BBS Menu📰")
|
||||
elif menu_name == 'utilities':
|
||||
response = "🛠️Utilities Menu🛠️\n[S]tats\n[F]ortune\n[W]all of Shame\nE[X]IT"
|
||||
response = build_menu(utilities_menu_items, "🛠️Utilities Menu🛠️")
|
||||
else:
|
||||
update_user_state(sender_id, {'command': 'MAIN_MENU', 'step': 1}) # Reset to main menu state
|
||||
response = "💾TC² BBS💾\n[Q]uick Commands\n[B]BS\n[U]tilities\nE[X]IT"
|
||||
response = build_menu(main_menu_items, "💾TC² BBS💾")
|
||||
send_message(response, sender_id, interface)
|
||||
|
||||
|
||||
|
@ -47,6 +47,41 @@ type = serial
|
||||
# allowed_nodes = !17d7e4b7
|
||||
|
||||
|
||||
####################
|
||||
#### Menu Items ####
|
||||
####################
|
||||
# Remove any menu items you don't plan on using with your BBS below
|
||||
#
|
||||
[menu]
|
||||
# Default Main Menu options for reference
|
||||
# [Q]uick Commands
|
||||
# [B]BS
|
||||
# [U]tilities
|
||||
# E[X]IT
|
||||
#
|
||||
# Remove any menu items from the list below that you want to exclude from the main menu
|
||||
main_menu_items = Q, B, U, X
|
||||
|
||||
# Default BBS Menu options for reference
|
||||
# [M]ail
|
||||
# [B]ulletins
|
||||
# [C]hannel Dir
|
||||
# [J]S8CALL
|
||||
# E[X]IT
|
||||
#
|
||||
# Remove any menu items from the list below that you want to exclude from the BBS menu
|
||||
bbs_menu_items = M, B, C, J, X
|
||||
|
||||
# Default BBS Menu option for reference
|
||||
# [S]tats
|
||||
# [F]ortune
|
||||
# [W]all of Shame
|
||||
# E[X]IT
|
||||
#
|
||||
# Remove any menu items from the list below that you want to exclude from the utilities menu
|
||||
utilities_menu_items = S, F, W, X
|
||||
|
||||
|
||||
##########################
|
||||
#### JS8Call Settings ####
|
||||
##########################
|
||||
|
Loading…
Reference in New Issue
Block a user