Tweaked voting logic
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
(source .venv/bin/activate && python3 "get_user_list.py" configs/config.yaml > "/home/nolan/dev/titlebot-ng-ng/logs/get_user_list-config.log" 2>&1) &
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
1850235
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
(source .venv/bin/activate && python3 "get_votes.py" configs/config.yaml > "/home/nolan/dev/titlebot-ng-ng/logs/get_votes-config.log" 2>&1) &
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
1850182
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
(cd "jsonEndpoint" && ."/jep" > "/home/nolan/dev/titlebot-ng-ng/logs/jsonEndpoint.log" 2>&1) &
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
1849964
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
(source .venv/bin/activate && python3 "post_results.py" configs/config.yaml > "/home/nolan/dev/titlebot-ng-ng/logs/post_results-config.log" 2>&1) &
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
1850091
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
(source .venv/bin/activate && python3 "scraper.py" configs/config.yaml > "/home/nolan/dev/titlebot-ng-ng/logs/scraper-config.log" 2>&1) &
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
1849912
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
(cd "voteServer" && ."/vs" > "/home/nolan/dev/titlebot-ng-ng/logs/voteServer.log" 2>&1) &
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
1850043
|
|
||||||
Binary file not shown.
Binary file not shown.
+2
-2
@@ -17,9 +17,9 @@ vote_activity_hours: 6672 # Hours a user must have been active within to be eli
|
|||||||
|
|
||||||
# --- Wait times (seconds) ---
|
# --- Wait times (seconds) ---
|
||||||
sync_timeout: 3000 # Initial sync timeout for scraper/user-list (ms)
|
sync_timeout: 3000 # Initial sync timeout for scraper/user-list (ms)
|
||||||
poll_interval: 30 # How often the scraper polls for new messages (s)
|
poll_interval: 10 # How often the scraper polls for new messages (s)
|
||||||
command_sync_timeout: 30000 # Sync timeout when listening for chat commands (ms)
|
command_sync_timeout: 30000 # Sync timeout when listening for chat commands (ms)
|
||||||
post_interval: 0.5 # Delay between posting each suggestion (s)
|
post_interval: 0.2 # Delay between posting each suggestion (s)
|
||||||
initial_sync_timeout: 300 # Initial sync timeout for post_results (ms)
|
initial_sync_timeout: 300 # Initial sync timeout for post_results (ms)
|
||||||
post_loop_interval: 1 # Delay between post_results loop iterations (s)
|
post_loop_interval: 1 # Delay between post_results loop iterations (s)
|
||||||
user_list_interval: 300 # How often the user-list service refreshes (s)
|
user_list_interval: 300 # How often the user-list service refreshes (s)
|
||||||
|
|||||||
+4
-1
@@ -39,7 +39,10 @@ async def main():
|
|||||||
|
|
||||||
if command:
|
if command:
|
||||||
print("!getvotes command detected, posting vote results...")
|
print("!getvotes command detected, posting vote results...")
|
||||||
|
|
||||||
|
# Clear the web poll by marking all pending suggestions as posted
|
||||||
|
room.mark_submissions_posted()
|
||||||
|
|
||||||
# Read and format vote results
|
# Read and format vote results
|
||||||
vote_message = format_vote_results(room)
|
vote_message = format_vote_results(room)
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
@@ -14,3 +14,5 @@
|
|||||||
2026/09/04 10:20:33 Loaded 4 users from database (most recent post: 1788535088)
|
2026/09/04 10:20:33 Loaded 4 users from database (most recent post: 1788535088)
|
||||||
2026/09/04 10:21:03 Loaded 0 submissions from database
|
2026/09/04 10:21:03 Loaded 0 submissions from database
|
||||||
2026/09/04 10:21:03 Loaded 4 users from database (most recent post: 1788535088)
|
2026/09/04 10:21:03 Loaded 4 users from database (most recent post: 1788535088)
|
||||||
|
2026/09/04 10:21:33 Loaded 0 submissions from database
|
||||||
|
2026/09/04 10:21:33 Loaded 4 users from database (most recent post: 1788535088)
|
||||||
|
|||||||
@@ -34,4 +34,6 @@ Looked back on 100 messages...
Looked back on 200 messages...
Looked back on 300
|
|||||||
Last run for this room was at UNIX timestamp 1788535208
|
Last run for this room was at UNIX timestamp 1788535208
|
||||||
Looked back on 100 messages...␍Looked back on 200 messages...␍Looked back on 300 messages...␍Looked back on 400 messages...␍Stored 70 suggestions in database.
|
Looked back on 100 messages...␍Looked back on 200 messages...␍Looked back on 300 messages...␍Looked back on 400 messages...␍Stored 70 suggestions in database.
|
||||||
Last run for this room was at UNIX timestamp 1788535240
|
Last run for this room was at UNIX timestamp 1788535240
|
||||||
|
Looked back on 100 messages...␍Looked back on 200 messages...␍Looked back on 300 messages...␍Looked back on 400 messages...␍Stored 70 suggestions in database.
|
||||||
|
Last run for this room was at UNIX timestamp 1788535270
|
||||||
Looked back on 100 messages...␍Looked back on 200 messages...␍Looked back on 300 messages...␍Looked back on 400 messages...␍
|
Looked back on 100 messages...␍Looked back on 200 messages...␍Looked back on 300 messages...␍Looked back on 400 messages...␍
|
||||||
@@ -14,3 +14,5 @@
|
|||||||
2026/09/04 10:20:37 Fetched 4 users (most recent post: 1788535088)
|
2026/09/04 10:20:37 Fetched 4 users (most recent post: 1788535088)
|
||||||
2026/09/04 10:21:07 Fetched 0 submissions
|
2026/09/04 10:21:07 Fetched 0 submissions
|
||||||
2026/09/04 10:21:07 Fetched 4 users (most recent post: 1788535088)
|
2026/09/04 10:21:07 Fetched 4 users (most recent post: 1788535088)
|
||||||
|
2026/09/04 10:21:37 Fetched 4 users (most recent post: 1788535088)
|
||||||
|
2026/09/04 10:21:37 Fetched 0 submissions
|
||||||
|
|||||||
@@ -838,8 +838,6 @@ class Room:
|
|||||||
print(f"Failed to post suggestion {idx}: {resp}")
|
print(f"Failed to post suggestion {idx}: {resp}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
post.is_posted = True
|
|
||||||
|
|
||||||
reaction = {
|
reaction = {
|
||||||
"m.relates_to": {
|
"m.relates_to": {
|
||||||
"rel_type": "m.annotation",
|
"rel_type": "m.annotation",
|
||||||
@@ -855,7 +853,6 @@ class Room:
|
|||||||
|
|
||||||
await asyncio.sleep(self.config.post_interval)
|
await asyncio.sleep(self.config.post_interval)
|
||||||
|
|
||||||
self.mark_posts_as_posted([p for p in unposted_posts if p.is_posted])
|
|
||||||
print("Suggestions posted!")
|
print("Suggestions posted!")
|
||||||
|
|
||||||
def mark_posts_as_posted(self, posts=None):
|
def mark_posts_as_posted(self, posts=None):
|
||||||
@@ -873,6 +870,13 @@ class Room:
|
|||||||
dbutil.commit(conn)
|
dbutil.commit(conn)
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
def mark_submissions_posted(self):
|
||||||
|
conn = dbutil.connect(self.db_path)
|
||||||
|
c = conn.cursor()
|
||||||
|
_ = c.execute("UPDATE suggestions SET is_posted = 1 WHERE is_posted = 0")
|
||||||
|
dbutil.commit(conn)
|
||||||
|
conn.close()
|
||||||
|
|
||||||
async def close(self):
|
async def close(self):
|
||||||
if self.client:
|
if self.client:
|
||||||
await self.client.close()
|
await self.client.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user