-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathspammer.py
49 lines (35 loc) · 1.03 KB
/
spammer.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
import telepot
import os
import time
TOKEN = os.environ['TOKEN']
bot = telepot.Bot(TOKEN)
from pymongo import MongoClient
client = MongoClient(os.environ['MLABFRIDAYURL'])
db = client.friday
def handle(msg):
sender_id = msg['chat']['id']
msg_recieved = msg['text']
content_type, chat_type, chat_id = telepot.glance(msg)
try:
bot.message_loop({'chat': handle})
except Exception as error:
print(error)
msg = """
Now Get the Lyrics of Your Favourite Song By Using the new \n/lyrics command.
Usage :
/lyrics SONGNAME
To show your support to Friday , type /rate and rate us 5 stars.
"""
users = db.users.find({})
for user in users :
sender_id = user['sender_id']
# if user['username'] == 'dhruvramdev' :
# bot.sendMessage(sender_id , msg)
try :
bot.sendMessage(sender_id , msg)
print "Sent to :" , user['username']
except Exception as e :
print str(e)
print "Unable to Send :" , user['username']
print "Done"
# Remeber to Delete Webhook before Doing This