|
|
|
@ -46,7 +46,6 @@ class CringeBotClient(BotClient): |
|
|
|
|
self.spawner_thread.start() |
|
|
|
|
|
|
|
|
|
def spawner(self): |
|
|
|
|
if not learning: |
|
|
|
|
self.purger_thread.start() |
|
|
|
|
|
|
|
|
|
while True: |
|
|
|
@ -76,22 +75,6 @@ class CringeBotClient(BotClient): |
|
|
|
|
preview.body = md_text |
|
|
|
|
preview_text = preview.format() |
|
|
|
|
|
|
|
|
|
if learning: |
|
|
|
|
self.log(preview_text) |
|
|
|
|
self.log() |
|
|
|
|
|
|
|
|
|
category = None |
|
|
|
|
while not category in bogofilter.categories: |
|
|
|
|
category = input("H(am), S(pam) or U(nknown)? ").upper() |
|
|
|
|
|
|
|
|
|
if category != bogofilter.UNSURE: |
|
|
|
|
bogofilter.run(mail_text, [category]) |
|
|
|
|
|
|
|
|
|
if category == bogofilter.SPAM: |
|
|
|
|
self.track_status(status) |
|
|
|
|
|
|
|
|
|
self.log() |
|
|
|
|
else: |
|
|
|
|
replied_id = status.get("in_reply_to_id", None) |
|
|
|
|
if replied_id: |
|
|
|
|
try: |
|
|
|
@ -326,8 +309,6 @@ def toot_dict_to_mail(toot_dict): |
|
|
|
|
|
|
|
|
|
return bogofilter.Mail(headers = headers, body = body) |
|
|
|
|
|
|
|
|
|
learning = "-l" in sys.argv[1:] |
|
|
|
|
|
|
|
|
|
with open("config.json") as json_file: |
|
|
|
|
bot = Bot(CringeBotClient, json.load(json_file)) |
|
|
|
|
bot.start() |
|
|
|
|