-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
46 lines (39 loc) · 1.17 KB
/
bot.py
File metadata and controls
46 lines (39 loc) · 1.17 KB
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
import praw
from Dora import *
import time
reddit = praw.Reddit(client_id='xxx',
client_secret='xxx',
user_agent='xxx',
username='xxx',
password='xxx')
# sub where it will be operating
my_subreddit = reddit.subreddit('AboutJayant')
# Phrase to activate bot
call_phrase = '!AskJ'
replied_to = []
# For checking the comments
for comment in my_subreddit.stream.comments():
redditor = comment.author
poster = redditor.name
flag = comment.id not in replied_to
flag2 = poster != "BeatMyMeatBoi"
if call_phrase in comment.body and flag and flag2:
replied_to.append(comment.id)
qns = comment.body.replace(call_phrase, '')
# time.sleep(5)
try:
reply = get_reply(qns)
comment.reply(reply)
except:
continue
elif flag2:
print(poster)
# try:
# reply = 'You asked: '
# comment.reply(reply+qns)
# print(poster)
# except:
# print("eror")
# # elif flag and flag2:
# # print(poster)
# # comment.reply("Please use <!AskJ> tag to ask questions!")