#
# Someone's Mattermost scripts.
#  Copyright (c) 2016-2022 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
#  published under MIT-License
#
# Example config file.
#  mv to config.py.examle config.py + edit.
#

####################################################################################################
# currently everything is done here and main.py is only used by the init script to launch the bot. #
####################################################################################################

import logging
logging.basicConfig(level = logging.INFO, format = "%(levelname)s::%(message)s")
#logging.basicConfig(level = logging.DEBUG, format = "%(asctime)s::%(levelname)s::%(message)s")

from MMBot import *
from CoreCommandUse import *

bot = MMBot(api_user="...", api_user_pw="...", local_websrv_hostname="bot\"s hostname", local_websrv_port=18065, mm_api_url="http://mattermostserver:8065/api", mm_ws_url="ws://mattermostserver:8065/api/v4/websocket")
# local_websrv_hostname = None or local_websrv_port = None to disable bot-local webserver
# mm_ws_url = None  to disable websocket client


bot.admin_ids = ["..."] # user_ids of bot admins. Basically useless.
bot.teams = { # "bot-internal-alias": ["<team_id>", <allow bot to add users to team>],
    "some team": ["...", False],
    "other team":["...", True],
    }


# global commands
for _,team_info in bot.teams.items():
    bot.register(CoreCommandUse(team_info[0]))


# websocket handlers
bot.register_ws(WSOnboarding(), ["new_user"])


# non-global commands
bot.register(CommandTissJoin(bot.teams["other team"]))