Upload WarOnline_Chat.py
Browse filesFurther Advance in the Quote and Response methods
- WarOnline_Chat.py +7 -7
WarOnline_Chat.py
CHANGED
@@ -67,9 +67,10 @@ def login(username=username, password=password, thread_url=thread_url):
|
|
67 |
print('Login failed!')
|
68 |
exit()
|
69 |
|
70 |
-
def post(message=message, thread_url=thread_url, post_url=post_url, quoted_by="",quote_text=""):
|
71 |
#Post a message to the forum (with or without the quote
|
72 |
-
quote_source
|
|
|
73 |
|
74 |
if quoted_by:
|
75 |
message = f'[QUOTE="{quoted_by}, post: {quote_source}"]{quote_text}[/QUOTE]{message}'
|
@@ -151,9 +152,8 @@ def readQuote(thread_url=thread_url, username=username):
|
|
151 |
if __name__ == '__main__':
|
152 |
login(username=username, password=password, thread_url=thread_url)
|
153 |
#post(message=message, thread_url=thread_url, post_url=post_url,quoted_by='Василий Пупкин',quote_text='Testing the XenForo response mechanism')
|
154 |
-
quote = readQuote(thread_url=get_last_page_of_thread(thread_url,1))
|
|
|
155 |
print(quote)
|
156 |
-
|
157 |
-
# The task is to fine the
|
158 |
-
# Answered quote = there is a post with reply by WarBot
|
159 |
-
# The answer shall be with blockQuote
|
|
|
67 |
print('Login failed!')
|
68 |
exit()
|
69 |
|
70 |
+
def post(message=message, thread_url=thread_url, post_url=post_url, quoted_by="",quote_text="",quote_source=""):
|
71 |
#Post a message to the forum (with or without the quote
|
72 |
+
#quote_source is in format 'post-3920992'
|
73 |
+
quote_source = quote_source.split('-')[-1] # Take the numbers only
|
74 |
|
75 |
if quoted_by:
|
76 |
message = f'[QUOTE="{quoted_by}, post: {quote_source}"]{quote_text}[/QUOTE]{message}'
|
|
|
152 |
if __name__ == '__main__':
|
153 |
login(username=username, password=password, thread_url=thread_url)
|
154 |
#post(message=message, thread_url=thread_url, post_url=post_url,quoted_by='Василий Пупкин',quote_text='Testing the XenForo response mechanism')
|
155 |
+
quote = readQuote(thread_url=get_last_page_of_thread(thread_url,1), username=username)
|
156 |
+
messangerQuote = readQuote(thread_url=get_last_page_of_thread(thread_url,1),username=quote['messengerName'])
|
157 |
print(quote)
|
158 |
+
print(messangerQuote)
|
159 |
+
# The task is to fine all the unanswered quotes
|
|
|
|