-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_telegram.py
105 lines (85 loc) · 2.23 KB
/
update_telegram.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/python3
import pickle
fin=open("announcement_data.bin","ab")
fout=open("announcement_data.bin","rb")
import os
l=[]
pickle.dump(l,fin)
def display():
a=[]
fout=open("announcement_data.bin","rb")
l=pickle.load(fout)
for i in range(len(l)):
a.append("\n"+str(i+1)+". "+l[i]+"\n")
for i in l:
bot.send_message(chat_id=update.message.chat_id, text=i)
import pickle
fin=open("announcement_data.bin","ab")
fout=open("announcement_data.bin","rb")
import os
l=[]
pickle.dump(l,fin)
def display():
a=[]
fout=open("announcement_data.bin","rb")
l=pickle.load(fout)
for i in range(len(l)):
a.append("\n"+str(i+1)+". "+l[i]+"\n")
for i in l:
bot.send_message(chat_id=update.message.chat_id, text=i)
def newdata(pos,an):
#pos=input("\nEnter Position\n")
#an=input("Enter the announcement\n")
fout=open("announcement_data.bin","rb")
l=pickle.load(fout)
l.insert(int(pos)-1,an)
fin=open("announcement_data.bin","wb")
pickle.dump(l,fin)
def deldata(pos):
fout=open("announcement_data.bin","rb")
#pos=input("Enter the no you want to delete\n")
l=pickle.load(fout)
del l[int(pos)-1]
fin=open("announcement_data.bin","wb")
pickle.dump(l,fin)
def mark_finished(pos):
fout=open("announcement_data.bin","rb")
#pos=input("Enter the no you want to mark finished\n")
l=pickle.load(fout)
l[int(pos)-1]+=u'\u274c'
fin=open("announcement_data.bin","wb")
pickle.dump(l,fin)
def findspace(a):
s=[]
for i in range(len(a)):
if a[i] ==' ':
s.append(i)
return s
def newdata(pos,an):
#pos=input("\nEnter Position\n")
#an=input("Enter the announcement\n")
fout=open("announcement_data.bin","rb")
l=pickle.load(fout)
l.insert(int(pos)-1,an)
fin=open("announcement_data.bin","wb")
pickle.dump(l,fin)
def deldata(pos):
fout=open("announcement_data.bin","rb")
#pos=input("Enter the no you want to delete\n")
l=pickle.load(fout)
del l[int(pos)-1]
fin=open("announcement_data.bin","wb")
pickle.dump(l,fin)
def mark_finished(pos):
fout=open("announcement_data.bin","rb")
#pos=input("Enter the no you want to mark finished\n")
l=pickle.load(fout)
l[int(pos)-1]+=u'\u274c'
fin=open("announcement_data.bin","wb")
pickle.dump(l,fin)
def findspace(a):
s=[]
for i in range(len(a)):
if a[i] ==' ':
s.append(i)
return s