-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclear.py
36 lines (33 loc) · 1019 Bytes
/
clear.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
import telebot
import time
class Clear():
def clear(self,token,chatID,singlechatID,cfg):
bot = telebot.TeleBot(token)
## delete old overviewLists
try:
f = open(cfg.areaName+cfg.areaNumber+"/lists.txt", "r")
except:
return
oldMessages = f.read()
f.close()
oldMessages = oldMessages[1:len(oldMessages)-1]
oldMessages = oldMessages.split(', ')
for messageID in oldMessages:
try:
bot.delete_message(chatID,message_id=messageID)
except:
print("Alte LISTE konnte nicht entfernt werden")
## delete old venue messages
try:
f = open(cfg.areaName+cfg.areaNumber+"/output.txt", "r")
except:
return
oldMessages = f.read()
f.close()
oldMessages = oldMessages[1:len(oldMessages)-1]
oldMessages = oldMessages.split(', ')
for messageID in oldMessages:
try:
bot.delete_message(singlechatID,message_id=messageID)
except:
print("Alte Map Nachricht konnte nicht entfernt werden")