mirror of
https://github.com/kuhyx/signal-bot.git
synced 2026-11-28 18:09:21 +01:00
fix: updated readme, stopped traps untiull fixed
This commit is contained in:
parent
ef0c46f64d
commit
470cc14c24
7
main.py
7
main.py
@ -4,8 +4,9 @@ import websockets
|
|||||||
import requests
|
import requests
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
from rule34Py import rule34Py
|
|
||||||
from datetime import datetime, time, timedelta
|
from datetime import datetime, time, timedelta
|
||||||
|
# from rule34py import rule34py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Set up environment variable for the phone number
|
# Set up environment variable for the phone number
|
||||||
@ -121,7 +122,7 @@ def extract_source_uuid(message):
|
|||||||
command_map = {
|
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),
|
("!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),
|
("!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):
|
def extract_source_name(message):
|
||||||
@ -222,7 +223,7 @@ async def listen_to_server(counter):
|
|||||||
message_content = extract_message_content(message)
|
message_content = extract_message_content(message)
|
||||||
await send_to_group(message_content, counter, message)
|
await send_to_group(message_content, counter, message)
|
||||||
if message_content.get('destinationNumber', {}) == PHONE_NUMBER:
|
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)
|
await trigger_command(message_content, PHONE_NUMBER)
|
||||||
except websockets.ConnectionClosed as e:
|
except websockets.ConnectionClosed as e:
|
||||||
print(f"Connection closed: {e}")
|
print(f"Connection closed: {e}")
|
||||||
|
|||||||
@ -70,9 +70,10 @@ The bot uses `asyncio` for running the WebSocket server and simple Python fetch
|
|||||||
```sh
|
```sh
|
||||||
sudo docker run -d --name signal-api --restart=always -p 9922:8080 \
|
sudo docker run -d --name signal-api --restart=always -p 9922:8080 \
|
||||||
-v /home/user/signal-api:/home/.local/share/signal-cli \
|
-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:
|
2. Access the Signal CLI setup page:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user