modified: bot.py
This commit is contained in:
18
bot.py
18
bot.py
@@ -490,15 +490,17 @@ async def on_message(message):
|
||||
if message.author.bot: # Bots ignorieren
|
||||
return
|
||||
|
||||
channel =message.channel
|
||||
|
||||
await channel.send("test")
|
||||
|
||||
channel_id = message.channel.id
|
||||
|
||||
# Prüfen, ob der Live-Chat aktiv ist
|
||||
if channel_id in live_chats and live_chats[channel_id]["active"]:
|
||||
await live_chat_queue.put((message, message.id, message.author.id, message.author.display_name, message.content))
|
||||
# Alle benötigten Daten aus dem message-Objekt extrahieren
|
||||
msg_id = str(message.id)
|
||||
user_id = str(message.author.id)
|
||||
nickname = message.author.display_name
|
||||
content = message.content
|
||||
|
||||
# Füge die Nachricht zur Warteschlange hinzu
|
||||
await live_chat_queue.put((message, msg_id, user_id, nickname, content))
|
||||
await client.process_commands(message)
|
||||
|
||||
async def process_live_chat_queue():
|
||||
@@ -507,7 +509,7 @@ async def process_live_chat_queue():
|
||||
try:
|
||||
if not askmultus_queue.empty():
|
||||
|
||||
message, message.id, message.author.id, message.author.display_name, message.content = await live_chat_queue.get()
|
||||
message, msg_id, user_id, nickname, content = await live_chat_queue.get()
|
||||
|
||||
live_introduction = read_file("live_introduction.txt")
|
||||
live_background_data = read_file("live_background_data.txt")
|
||||
@@ -516,7 +518,7 @@ async def process_live_chat_queue():
|
||||
|
||||
timestamp = int(time.time()) # Unix-Timestamp
|
||||
|
||||
content = timestamp + "/" + message.id + "/" + message.author.id + "/" + message.author.display_name + ":" + message.content
|
||||
content = timestamp + "/" + msg_id + "/" + user_id + "/" + nickname + ":" + content
|
||||
|
||||
chat_history.append({"role": "user", "content": f"{content}"})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user