2 # Copyright (c) 2016-2022 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
3 # published under MIT-License
9 class AbstractPublicWS():
12 CONFIG = {"display_name": "somebot-command", "auto_complete": True}
17 def __init__(self, team_id):
18 self.TEAM_ID = team_id
21 return str(self.__class__)
27 # can/should be overridden by the user
28 def on_register_public(self):
29 """Consider to override. Handles the post-command-registration logic at bot startup."""
32 # should be overridden by the user
33 def on_public_GET(self, request, data):
34 """Override. Handles the post-command logic."""
37 # should be overridden by the user
38 def on_public_POST(self, request, data):
39 """Override. Handles the post-command logic."""
43 def _on_register_public(self, bot):
45 #self.URL = ("http://"+self.bot.local_websrv_hostname+":"+str(self.bot.local_websrv_port)+"/").strip("/")+"/"+self.TEAM_ID+"/"+self.TRIGGER
46 self.URL = ("http://"+self.bot.local_websrv_hostname+":"+str(self.bot.local_websrv_port)+"/").strip("/")+"/"+self.TRIGGER
47 self.on_register_public()
50 def _on_shutdown(self):
54 def _on_public_GET(self, request, data):
55 return self.on_public_GET(request, data)
57 def _on_public_POST(self, request, data):
58 return self.on_public_POST(request, data)