]> git.somenet.org - pub/jan/mattermost.git/blob - somebot/core/AbstractWSHandler.py
[somebot] /ta-wipe-channel "--really-all"|<username>
[pub/jan/mattermost.git] / somebot / core / AbstractWSHandler.py
1 # Mattermost Bot.
2 #  Copyright (c) 2016-2020 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
3 #  published under MIT-License
4
5
6 class AbstractWSHandler():
7     NAME = None
8     bot = None
9
10
11     def __init__(self):
12         pass
13
14     # should be overridden by the user
15     def on_register_ws_evtype(self, evtype):
16         pass
17
18     # can/should be overridden by the user
19     def on_shutdown(self):
20         """Consider to override. Handles the shutdown-procedure."""
21         return
22
23     # should be overridden by the user
24     def on_WS_EVENT(self, data):
25         return False
26
27     # should be overridden by the user
28     # manual command authentication needed!
29     def on_POST_interactive(self, request, data):
30         return
31
32
33     def _on_register_ws_evtype(self, bot, evtype):
34         self.bot = bot
35         self.on_register_ws_evtype(evtype)
36
37
38     def _on_shutdown(self):
39         self.on_shutdown()