Fix team chat integration
This commit is contained in:
@@ -4,6 +4,7 @@ import asyncio
|
||||
import socketio
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
from env import WEBUI_URL, TOKEN
|
||||
from utils import send_message, send_typing
|
||||
import aiohttp
|
||||
@@ -188,13 +189,25 @@ async def main():
|
||||
|
||||
try:
|
||||
# Callback function for user-join
|
||||
async def join_callback(data):
|
||||
async def join_callback(*args):
|
||||
try:
|
||||
bot_id = data["id"]
|
||||
print(f"Bot connected with ID: {bot_id}")
|
||||
events(bot_id) # Attach the event handlers dynamically
|
||||
if args and len(args) > 0:
|
||||
data = args[0]
|
||||
print(f"Received callback data: {data}")
|
||||
if isinstance(data, dict) and "id" in data:
|
||||
bot_id = data["id"]
|
||||
print(f"Bot connected with ID: {bot_id}")
|
||||
events(bot_id) # Attach the event handlers dynamically
|
||||
else:
|
||||
print(f"Invalid callback data format: {data}")
|
||||
else:
|
||||
print("No callback data received")
|
||||
# If no data is received, use a default ID
|
||||
print("Using default bot ID")
|
||||
events("bot-default-id") # Attach the event handlers with a default ID
|
||||
except Exception as e:
|
||||
print(f"Error in join_callback: {str(e)}")
|
||||
print(traceback.format_exc())
|
||||
|
||||
# Authenticate with the server
|
||||
print("Authenticating with the server...")
|
||||
|
||||
Reference in New Issue
Block a user