eweww
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pavel_Durov 2024-05-10 19:46:37 +03:00
parent a571709afa
commit db842a1ceb
2 changed files with 28 additions and 26 deletions

View File

@ -12,7 +12,8 @@ telegram_admins_ids:
- 317051301 # hogweed1
- 226765676 # blackjack
- 94830892 # viktorRMI
- 132002803
openai:
token: 5947963644:AAF_GKgMmU5ovqMpc1KXIpcf4aN0JMyKPqc
api_key: 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 ## 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
api_key: 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 ## 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

View File

@ -3,7 +3,7 @@ from aiogram import types
from create_bot import dp, bot
import logging
from global_conf import CONFIG
admins = CONFIG['telegram_admins_ids']
token = CONFIG['openai']['token']
@ -16,36 +16,37 @@ ban_comands = ['/dick','/topdick']
@dp.message_handler(commands=['image'])
async def send_image(message: types.Message):
try:
description = message.text.replace('/image', '').strip()
if message.from_user.id in admins and message.chat.type == 'private':
try:
description = message.text.replace('/image', '').strip()
if not description:
await message.reply('Ты даун, описание запроса напиши после пробела')
return
except Exception as e:
logging.error(f'Error in send_image: {e}')
try:
if not description:
await message.reply('Ты даун, описание запроса напиши после пробела')
return
except Exception as e:
logging.error(f'Error in send_image: {e}')
try:
response = openai.Image.create(
prompt=message.text,
n=1,
size="1024x1024",
response_format="url",
response = openai.Image.create(
prompt=message.text,
n=1,
size="1024x1024",
response_format="url",
)
image_url = response['data'][0]['url']
await message.answer('Генерирую изображение...')
await message.reply_photo(image_url)
except Exception as e:
await message.reply('у меня не получилось')
)
image_url = response['data'][0]['url']
await message.answer('Генерирую изображение...')
await message.reply_photo(image_url)
except Exception as e:
await message.reply('у меня не получилось')
@dp.message_handler()
async def send(message: types.Message):
if message.text.lower().startswith('тупица'):
if message.from_user.id in admins and message.chat.type == 'private':
## TODO уточнить остатки токенов и денег
response = openai.Completion.create(
model="text-davinci-003",
model="gpt-4-turbo",
prompt=message.text[7:],
temperature=0.7,
max_tokens=1000,
@ -58,7 +59,7 @@ async def send(message: types.Message):
elif message.reply_to_message.from_user.is_bot:
response = openai.Completion.create(
model="text-davinci-003",
model="gpt-4-turbo",
prompt=message.text,
temperature=0.7,
max_tokens=1000,