2 # Someone's Mattermost scripts.
 
   3 #  Copyright (c) 2016-2020 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
 
   4 #  published under MIT-License
 
   7 #  mv to config.py.examle config.py + edit.
 
  10 ####################################################################################################
 
  11 # currently everything is done here and main.py is only used by the init script to launch the bot. #
 
  12 ####################################################################################################
 
  15 logging.basicConfig(level = logging.INFO, format = "%(levelname)s::%(message)s")
 
  16 #logging.basicConfig(level = logging.DEBUG, format = "%(asctime)s::%(levelname)s::%(message)s")
 
  19 from CoreCommandUse import *
 
  21 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")
 
  22 # local_websrv_hostname = None or local_websrv_port = None to disable bot-local webserver
 
  23 # mm_ws_url = None  to disable websocket client
 
  26 bot.admin_ids = ["..."] # user_ids of bot admins. Basically useless.
 
  27 bot.teams = { # "bot-internal-alias": ["<team_id>", <allow bot to add users to team>],
 
  28     "some team": ["...", False],
 
  29     "other team":["...", True],
 
  34 for _,team_info in bot.teams.items():
 
  35     bot.register(CoreCommandUse(team_info[0]))
 
  39 bot.register_ws(WSOnboarding(), ["new_user"])
 
  43 bot.register(CommandTissJoin(bot.teams["other team"]))