-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
38 lines (29 loc) · 1016 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import mail
import PythonTelegramWraper.bot as BotWrapper
import time
import os
import config
sender = mail.Sender()
def start(update, context):
chatID = BotWrapper.chatID(update)
BotWrapper.sendMessage(chatID, "Your ChatID is: "+str(chatID))
BotWrapper.addBotCommand("start", start)
BotWrapper.startBot()
while True:
out = sender.check()
if out is not None:
for mail in out:
out_string = "*Neuer Druckauftrag*\n\n"
for key in mail:
if key == "Email:":
continue
out_string += "_"+key+"_"
out_string += "\n "
out_string += mail[key]
out_string += "\n"
BotWrapper.sendMessage(config.chatID, out_string)
if "file" in mail:
BotWrapper.botBackend.dispatcher.bot.send_document(
chat_id=config.chatID, document=open(mail['file'], 'rb'))
os.remove(mail['file'])
time.sleep(10)