mirror of
https://github.com/kuhyx/signal-bot.git
synced 2026-07-04 13:43:12 +02:00
fix: self sending !kot works now
This commit is contained in:
parent
dd11f33d21
commit
09e811a2b7
2
.gitignore
vendored
2
.gitignore
vendored
@ -160,3 +160,5 @@ cython_debug/
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
*.jpg
|
||||
*.gif
|
||||
11
main.py
11
main.py
@ -35,7 +35,7 @@ def fetch_and_download_cat_image():
|
||||
with open(image_filename, 'rb') as image_file:
|
||||
base64_encoded_data = base64.b64encode(image_file.read()).decode('utf-8')
|
||||
|
||||
print(f"Base64 Encoded Data: {base64_encoded_data}")
|
||||
os.remove(image_filename)
|
||||
return base64_encoded_data
|
||||
|
||||
def send_cat():
|
||||
@ -61,13 +61,12 @@ async def listen_to_server():
|
||||
try:
|
||||
async for message in websocket:
|
||||
message_json = json.loads(message)
|
||||
#inside_message = message_json.get('envelope', {}).get('syncMessage', {}).get('sentMessage', {})
|
||||
inside_message = message_json.get('envelope', {}).get('dataMessage', {})
|
||||
if inside_message == {}:
|
||||
inside_message = message_json.get('envelope', {}).get('syncMessage', {}).get('sentMessage', {})
|
||||
print("message", message)
|
||||
if inside_message.get('message') == "!kot":
|
||||
print("kot message detected")
|
||||
if inside_message.get('groupInfo', {}).get('groupId', {}) == GROUP_ID:
|
||||
send_cat()
|
||||
if inside_message.get('message') == "!kot" and inside_message.get('groupInfo', {}).get('groupId', {}) == GROUP_ID:
|
||||
send_cat()
|
||||
except websockets.ConnectionClosed as e:
|
||||
print(f"Connection closed: {e}")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user