mirror of
https://github.com/kurbezz/discord-bot.git
synced 2025-12-06 15:15:37 +01:00
Fix
This commit is contained in:
@@ -93,7 +93,7 @@ class MessageEvent(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_completion(message: str):
|
async def get_completion(message: str):
|
||||||
async with AsyncClient() as client:
|
async with AsyncClient() as client:
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
"https://openrouter.ai/api/v1/chat/completions",
|
"https://openrouter.ai/api/v1/chat/completions",
|
||||||
@@ -141,13 +141,7 @@ class MessagesProc:
|
|||||||
twitch = await authorize()
|
twitch = await authorize()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
loop = asyncio.get_event_loop()
|
completion = await get_completion(event.message.text)
|
||||||
|
|
||||||
completion = await loop.run_in_executor(
|
|
||||||
None,
|
|
||||||
get_completion,
|
|
||||||
event.message.text
|
|
||||||
)
|
|
||||||
|
|
||||||
if not completion:
|
if not completion:
|
||||||
completion = "Пошел нахуй!"
|
completion = "Пошел нахуй!"
|
||||||
|
|||||||
Reference in New Issue
Block a user