Compare commits

..

No commits in common. "d61c1d0f1b4041bed446865fe89c4066cc12c0f1" and "c41810994a77238987a58f51a9d261ac43b1f233" have entirely different histories.

3 changed files with 2 additions and 29 deletions

View File

@ -1,7 +0,0 @@
FROM python:3-alpine
WORKDIR /repo
ADD requirements.txt /repo
RUN pip3 install -r requirements.txt
CMD ["python3", "main.py"]

View File

@ -1,8 +0,0 @@
version: '3'
services:
maidbot:
build:
context: .
volumes:
- ./:/repo

16
main.py
View File

@ -1,7 +1,6 @@
import logging
import json
import os
import signal
import time
from datetime import datetime, timezone
@ -55,10 +54,6 @@ class App:
self.mods = {}
self.alive = True
signal.signal(signal.SIGTERM, lambda a,b: self.exit())
signal.signal(signal.SIGINT, lambda a,b: self.exit())
def authenticate(self):
if os.path.exists("auth.json"):
with open("auth.json", "r") as f:
@ -97,7 +92,7 @@ class App:
def run(self):
self.install("elicense", mods.elicense)
while self.alive:
while True:
try:
self.cycle()
self.logging.debug("cycle done")
@ -106,10 +101,7 @@ class App:
for mod in self.mods:
self.mods[mod].cycle()
for i in range(self.CONFIG["interval"]):
if not self.alive: break
time.sleep(1)
time.sleep(self.CONFIG["interval"])
def cycle(self):
items = self.M.notifications(
@ -125,10 +117,6 @@ class App:
# TODO: call mod cycles
def exit(self):
self.alive = False
self.logging.info("exit requested")
def reply(self, st, msg):
try:
self.logging.debug("reply:", msg)