diff --git a/main.py b/main.py index de8f024..f4699e5 100644 --- a/main.py +++ b/main.py @@ -4,8 +4,9 @@ import websockets import requests import base64 import json -from rule34Py import rule34Py from datetime import datetime, time, timedelta +# from rule34py import rule34py + # Set up environment variable for the phone number @@ -121,7 +122,7 @@ def extract_source_uuid(message): command_map = { ("!kot", "!koty", "!kots", "!cat", "!cats", "!meow", "!miau", "!ᴋᴏᴛ", "!𝓴𝓸𝓽", "!π—Έπ—Όπ˜"): lambda recipient: send_image(fetch_and_download_image("https://api.thecatapi.com/v1/images/search", [0, 'url']), recipient), ("!pies", "!psy", "!dog", "!dogs", "!woof", "!szczek", "!π—½π—Άπ—²π˜€", "!Μ½Ν“pΜ½Ν“iΜ½Ν“eΜ½Ν“sΜ½Ν“"): lambda recipient: send_image(fetch_and_download_image("https://dog.ceo/api/breeds/image/random", 'message'), recipient), - ("!traps"): lambda recipient: send_image(download_image(((rule34Py().random_post(["trap"])).sample)), recipient) + ("!traps"): lambda recipient: send_message("No traps for now, sorry πŸ˜”", recipient) } def extract_source_name(message): @@ -222,7 +223,7 @@ async def listen_to_server(counter): message_content = extract_message_content(message) await send_to_group(message_content, counter, message) if message_content.get('destinationNumber', {}) == PHONE_NUMBER: - #await count_messages(json.loads(message).get('envelope', {}), counter) + await count_messages(json.loads(message).get('envelope', {}), counter) await trigger_command(message_content, PHONE_NUMBER) except websockets.ConnectionClosed as e: print(f"Connection closed: {e}") diff --git a/readme.md b/readme.md index 202cc5e..e22f6fa 100644 --- a/readme.md +++ b/readme.md @@ -70,9 +70,10 @@ The bot uses `asyncio` for running the WebSocket server and simple Python fetch ```sh sudo docker run -d --name signal-api --restart=always -p 9922:8080 \ -v /home/user/signal-api:/home/.local/share/signal-cli \ - -e 'MODE=json-rpc' bbernhard/signal-cli-rest-api + -e 'MODE=json-rpc' bbernhard/signal-cli-rest-api:0.167-dev ``` - +Pay attention to `:0.167-dev`! Try to upgrade if there is a new one as you can see errors connected with connecting your signal account otherwise +Double check if you are using correct version using: [http://localhost:9922/v1/about](http://localhost:9922/v1/about) 2. Access the Signal CLI setup page: ```sh