- Basic interfacing to config, db.
- Printing current message.
- Sending the message to Slack.
--- /dev/null
+# -*- coding: utf-8 -*-
+"""Get data from database and publish them."""
+from json import dumps
+from requests import post
+from cbconf import Conf
+from cbdb import Db
+
+class CoffeebotGetter:
+ """This class connects configuration, database access and publishing."""
+ def __init__(self):
+ self.cfg = Conf()
+ self.db = Db(self.cfg.getCoffeeDbPath())
+ self.msg = ""
+ return None
+
+ def getMsg(self):
+ """Return message."""
+ return self.msg
+
+ def sendMsgToSlack(self):
+ """Send message to Slack Bot."""
+ return post(self.cfg.getCoffeebotURL(), dumps({"text": self.msg}))