python_bot/handlers/davinci.py
Pavel_Durov fc437530e4
All checks were successful
continuous-integration/drone/push Build is passing
fix
2023-07-17 23:52:36 +03:00

45 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import openai
from aiogram import types, Dispatcher
from create_bot import dp, bot
token = '5947963644:AAF_GKgMmU5ovqMpc1KXIpcf4aN0JMyKPqc'
#openai.api_key = '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'
openai.api_key = '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'
ban_comands = ['/dick','/topdick']
@dp.message_handler()
async def send(message: types.Message):
if message.text.lower().startswith('тупица'):
## TODO уточнить остатки токенов и денег
response = openai.Completion.create(
model="text-davinci-003",
prompt=message.text,
temperature=0.7,
max_tokens=1000,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.6,
stop=["сброс"]
)
await message.reply(response['choices'][0]['text'])
# elif message.reply_to_message.bot:
# response = openai.Completion.create(
# model="text-davinci-003",
# prompt=message.text,
# temperature=0.7,
# max_tokens=1000,
# top_p=1.0,
# frequency_penalty=0.0,
# presence_penalty=0.6,
# stop=["сброс"]
# )
# await message.reply(response['choices'][0]['text'])