mirror of
https://github.com/open-webui/bot
synced 2025-06-08 15:45:44 +00:00
refac
This commit is contained in:
parent
4cb3e243c9
commit
133c0df876
@ -3,7 +3,7 @@ from env import WEBUI_URL, TOKEN
|
|||||||
from utils import send_message
|
from utils import send_message
|
||||||
|
|
||||||
# Create a Socket.IO client instance
|
# Create a Socket.IO client instance
|
||||||
sio = socketio.Client(logger=True, engineio_logger=True)
|
sio = socketio.Client(logger=False, engineio_logger=False)
|
||||||
|
|
||||||
|
|
||||||
# Event handlers
|
# Event handlers
|
||||||
@ -24,10 +24,9 @@ def events(sio, user_id):
|
|||||||
# Ignore events from the bot itself
|
# Ignore events from the bot itself
|
||||||
return
|
return
|
||||||
|
|
||||||
print("Channel events:", data)
|
print(f"{data["user"]["name"]}: {data["data"]["data"]["content"]}")
|
||||||
send_message(data["channel_id"], "Pong!")
|
send_message(data["channel_id"], "Pong!")
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print(f"Connecting to {WEBUI_URL}...")
|
print(f"Connecting to {WEBUI_URL}...")
|
||||||
sio.connect(WEBUI_URL, socketio_path="/ws/socket.io", transports=["websocket"])
|
sio.connect(WEBUI_URL, socketio_path="/ws/socket.io", transports=["websocket"])
|
||||||
|
@ -3,7 +3,7 @@ from env import WEBUI_URL, TOKEN
|
|||||||
from utils import send_message
|
from utils import send_message
|
||||||
|
|
||||||
# Create a Socket.IO client instance
|
# Create a Socket.IO client instance
|
||||||
sio = socketio.Client(logger=True, engineio_logger=True)
|
sio = socketio.Client(logger=False, engineio_logger=False)
|
||||||
|
|
||||||
|
|
||||||
# Event handlers
|
# Event handlers
|
||||||
|
Loading…
Reference in New Issue
Block a user