]> git.somenet.org - pub/jan/mattermost-bot.git/blob - config.py.example
new file: modules/CommandFSOpen.py
[pub/jan/mattermost-bot.git] / config.py.example
1 #
2 # Someone's Mattermost scripts.
3 #  Copyright (c) 2016-2022 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
4 #  published under MIT-License
5 #
6 # Example config file.
7 #  mv to config.py.examle config.py + edit.
8 #
9
10 ####################################################################################################
11 # currently everything is done here and main.py is only used by the init script to launch the bot. #
12 ####################################################################################################
13
14 import logging
15 logging.basicConfig(level = logging.INFO, format = "%(levelname)s::%(message)s")
16 #logging.basicConfig(level = logging.DEBUG, format = "%(asctime)s::%(levelname)s::%(message)s")
17
18 from MMBot import *
19 from CoreCommandUse import *
20
21 bot = MMBot(api_user="...", api_user_pw="...", local_websrv_hostname="bot\"s hostname", local_websrv_port=18065, local_public_websrv_port=18066, 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
24
25
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],
30     }
31
32
33 # global commands
34 for _,team_info in bot.teams.items():
35     bot.register(CoreCommandUse(team_info[0]))
36
37
38 # websocket handlers
39 bot.register_ws(WSOnboarding(), ["new_user"])
40
41
42 # non-global commands
43 bot.register(CommandTissJoin(bot.teams["other team"]))
44