-
Notifications
You must be signed in to change notification settings - Fork 0
/
tbot.py
39 lines (31 loc) · 988 Bytes
/
tbot.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
#pip install pyTelegramBotAPI
import telebot
import csv
def tbot(bot_token):
bot = telebot.TeleBot(token=bot_token, parse_mode=None)
@bot.message_handler(commands=["start", "meetings"])
def sendmessage(message):
if message.text=='/start':
bot.reply_to(message,
'''
commands: /meetings
''')
elif message.text == '/meetings':
title = "GITAM Meetings"
msg = '\n\n'
with open('meet.csv', 'r') as file:
reader = csv.reader(file)
for row in reader:
msg += row[0]
msg += '\n'
msg += row[1]
msg += '\n'
msg += row[2]
msg += '\n\n'
bot.reply_to(message,
title
+ msg +
'''
''')
print('Updated in Telegram')
bot.polling()