Upload WarOnline_Chat.py
Browse files- WarOnline_Chat.py +23 -6
WarOnline_Chat.py
CHANGED
@@ -6,6 +6,8 @@ import re
|
|
6 |
from bs4 import BeautifulSoup
|
7 |
import urllib.request as urllib
|
8 |
import warnings
|
|
|
|
|
9 |
warnings.filterwarnings("ignore")
|
10 |
|
11 |
# Define the login URL and the thread URL
|
@@ -146,10 +148,7 @@ def allQuotesFor(thread_url=thread_url, username=username, startingPage=1):
|
|
146 |
|
147 |
return allquotes
|
148 |
|
149 |
-
|
150 |
-
login(username=username, password=password, thread_url=thread_url)
|
151 |
-
#post(message=message, thread_url=thread_url, post_url=post_url,quoted_by='Василий Пупкин',quote_text='Testing the XenForo response mechanism')
|
152 |
-
|
153 |
# Get All Quotes
|
154 |
quotes = allQuotesFor(thread_url=thread_url, username=username, startingPage=1)
|
155 |
|
@@ -157,5 +156,23 @@ if __name__ == '__main__':
|
|
157 |
for quote in quotes:
|
158 |
reply = allQuotesFor(thread_url=thread_url, username=quote['messengerName'], startingPage=1)
|
159 |
if not reply:
|
160 |
-
print('Quote: ',quote['reply'])
|
161 |
-
print(WarClient.getReply(message=quote['reply']))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
from bs4 import BeautifulSoup
|
7 |
import urllib.request as urllib
|
8 |
import warnings
|
9 |
+
import schedule
|
10 |
+
import time
|
11 |
warnings.filterwarnings("ignore")
|
12 |
|
13 |
# Define the login URL and the thread URL
|
|
|
148 |
|
149 |
return allquotes
|
150 |
|
151 |
+
def WarOnlineBot():
|
|
|
|
|
|
|
152 |
# Get All Quotes
|
153 |
quotes = allQuotesFor(thread_url=thread_url, username=username, startingPage=1)
|
154 |
|
|
|
156 |
for quote in quotes:
|
157 |
reply = allQuotesFor(thread_url=thread_url, username=quote['messengerName'], startingPage=1)
|
158 |
if not reply:
|
159 |
+
print('Quote: ', quote['reply'])
|
160 |
+
print(WarClient.getReply(message=quote['reply']))
|
161 |
+
|
162 |
+
|
163 |
+
if __name__ == '__main__':
|
164 |
+
timeout = 1 # min
|
165 |
+
login(username=username, password=password, thread_url=thread_url)
|
166 |
+
|
167 |
+
#post(message=message, thread_url=thread_url, post_url=post_url,quoted_by='Василий Пупкин',quote_text='Testing the XenForo response mechanism')
|
168 |
+
|
169 |
+
# Set up schedule function
|
170 |
+
schedule.every(timeout).minutes.do(WarOnlineBot)
|
171 |
+
|
172 |
+
# Start the scheduler
|
173 |
+
while True:
|
174 |
+
schedule.run_pending()
|
175 |
+
time.sleep(1)
|
176 |
+
|
177 |
+
|
178 |
+
|