Добавлено ограничение пользователей (#7)
All checks were successful
Actions Build Docker Image / Build-Docker (push) Successful in 38s
All checks were successful
Actions Build Docker Image / Build-Docker (push) Successful in 38s
- Ограничение доступа - gpt2 генерация промпта Co-authored-by: vladus <devlad671@gmail.com> Co-authored-by: kls <devlad671@gmail.com> Reviewed-on: #7 Co-authored-by: Alex Borisov <79996669747@ya.ru> Co-committed-by: Alex Borisov <79996669747@ya.ru>
This commit is contained in:
parent
d3ab18f1b7
commit
37dade2c0a
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
||||
venv
|
||||
.venv
|
||||
.env
|
||||
.gitea
|
||||
example.env
|
||||
LICENSE
|
||||
README.md
|
@ -3,7 +3,7 @@ run-name: ${{ gitea.actor }} is building new image 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
Build-Docker:
|
||||
runs-on: soaska
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
@ -27,17 +27,13 @@ jobs:
|
||||
- name: Build Dockerfile
|
||||
run: |
|
||||
docker build -t sd_telegram .
|
||||
- name: Add new variables
|
||||
run: |
|
||||
package_name=$(basename ${{ github.repository }})
|
||||
commit_date=$(git log -1 --format=%cd --date=format:'%Y%m%d%H%M%S')
|
||||
echo "package_name=$package_name, commit_date=$commit_date"
|
||||
- name: Upload Docker image to soaska.ru
|
||||
run: |
|
||||
package_name=$(basename ${{ github.repository }})
|
||||
commit_date=$(git log -1 --format=%cd --date=format:'%Y%m%d%H%M%S')
|
||||
branch_name=$(git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
docker login -u ${{ secrets.username }} -p ${{ secrets.password }} soaska.ru
|
||||
docker tag sd_telegram soaska.ru/soaska/$package_name:$commit_date
|
||||
docker tag sd_telegram soaska.ru/soaska/$package_name:latest
|
||||
docker push soaska.ru/soaska/$package_name:$commit_date
|
||||
docker push soaska.ru/soaska/$package_name:latest
|
||||
docker tag sd_telegram soaska.ru/${{ secrets.username }}/$package_name:$branch_name
|
||||
docker tag sd_telegram soaska.ru/${{ secrets.username }}/$package_name:latest
|
||||
docker push soaska.ru/${{ secrets.username }}/$package_name:$branch_name
|
||||
docker push soaska.ru/${{ secrets.username }}/$package_name:latest
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.vscode
|
||||
.venv
|
||||
.env
|
||||
venv
|
@ -42,6 +42,7 @@ docker run -e VK_TOKEN='VK_TOKEN_HERE' \
|
||||
-e SD_USERNAME='user' \
|
||||
-e SD_PASSWORD='1234' \
|
||||
-e DEBUG='no' \
|
||||
-e ALLOWED_USERS='[id1, id2, id3]' # где id - id пользователей telegram в виде числа (пример: [1234, 5678]) без апострофов и тд, если хотите сделать бота общедоступным, то дайте значение '[]'
|
||||
soaska.ru/soaska/sd_telegram:latest
|
||||
```
|
||||
|
||||
|
85
bot.py
85
bot.py
@ -61,13 +61,17 @@ OK_APPLICATION_KEY = os.getenv('OK_APPLICATION_KEY')
|
||||
OK_APPLICATION_SECRET_KEY = os.getenv('OK_APPLICATION_SECRET_KEY')
|
||||
OK_GROUP_ID = os.getenv('OK_GROUP_ID')
|
||||
ARRAY_INLINE = []
|
||||
try:
|
||||
ALLOWED_USERS = json.loads(os.getenv('ALLOWED_USERS'))
|
||||
except json.decoder.JSONDecodeError:
|
||||
print("Вы не ввели id в переменную ALLOWED_USERS, если вы хотите сделать бота общедоступным, то задайте ALLOWED_USERS='[]'")
|
||||
|
||||
bot = Bot(token=API_BOT_TOKEN)
|
||||
storage = MemoryStorage()
|
||||
dp = Dispatcher(bot, storage=storage)
|
||||
|
||||
# /create_post_vk
|
||||
@dp.message_handler(commands=['create_post_vk'])
|
||||
@dp.message_handler(lambda message: message.from_user.id or len(ALLOWED_USERS) == 0, commands=['create_post_vk'])
|
||||
async def create_post_vk(message: types.Message) -> None:
|
||||
result = subprocess.run(
|
||||
['C:\OSPanel\modules\php\PHP_7.3\php.exe', "C:/OSPanel/domains/localhost/vk/create_post.php"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
@ -278,11 +282,13 @@ async def getProgress(msgTime):
|
||||
# TODO aiogram.utils.exceptions.MessageToEditNotFound: Message to edit not found
|
||||
proc = round(api.get_progress()['progress']*100)
|
||||
points = '.' * (proc % 9)
|
||||
try:
|
||||
await bot.edit_message_text(
|
||||
chat_id=msgTime.chat.id,
|
||||
message_id=msgTime.message_id,
|
||||
text=str(proc)+'% ' + points
|
||||
)
|
||||
finally:
|
||||
await asyncio.sleep(1)
|
||||
#TODO
|
||||
async def getProgress2(msgTime):
|
||||
@ -361,6 +367,7 @@ def getKeyboard(keysArr, returnAll):
|
||||
# Стандартное меню
|
||||
async def getKeyboardUnion(txt, message, keyboard, parse_mode = 'Markdown'):
|
||||
# Если команда с слешем
|
||||
try:
|
||||
if hasattr(message, "content_type"):
|
||||
await bot.send_message(
|
||||
chat_id=message.from_user.id,
|
||||
@ -376,6 +383,8 @@ async def getKeyboardUnion(txt, message, keyboard, parse_mode = 'Markdown'):
|
||||
reply_markup=keyboard,
|
||||
parse_mode=parse_mode
|
||||
)
|
||||
except:
|
||||
pass
|
||||
|
||||
def getStart(returnAll = 1) -> InlineKeyboardMarkup:
|
||||
keysArr = [
|
||||
@ -591,8 +600,8 @@ async def show_thumbs(chat_id, res):
|
||||
|
||||
# start или help
|
||||
@dp.callback_query_handler(text="help")
|
||||
@dp.message_handler(commands=["help"])
|
||||
@dp.message_handler(commands=["start"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["help"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["start"])
|
||||
async def cmd_start(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("cmd_start")
|
||||
txt = "Это бот для локального запуска SD\n" + getTxt()
|
||||
@ -600,7 +609,7 @@ async def cmd_start(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
|
||||
# TODO optimize
|
||||
# Запуск/Остановка SD. Завязываемся на глобальную иконку sd
|
||||
@dp.message_handler(commands=["stop"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["stop"])
|
||||
@dp.callback_query_handler(text="sd")
|
||||
async def inl_sd(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("inl_sd")
|
||||
@ -660,12 +669,15 @@ async def inl_save_prompt(callback: types.CallbackQuery) -> None:
|
||||
global data, chatHistoryPrompt
|
||||
data['prompt'] = chatHistoryPrompt
|
||||
keyboard = InlineKeyboardMarkup(inline_keyboard=[getPromptFromJson(0), getStart(0)])
|
||||
try:
|
||||
await bot.edit_message_text(
|
||||
chat_id=callback.message.chat.id,
|
||||
message_id=callback.message.message_id,
|
||||
text='Промпт сохранён: ' + chatHistoryPrompt,
|
||||
reply_markup=keyboard
|
||||
)
|
||||
except:
|
||||
pass
|
||||
|
||||
# upload result.json from chat history
|
||||
@dp.callback_query_handler(text="uplchat")
|
||||
@ -687,6 +699,7 @@ async def inl_uplchat(callback: types.CallbackQuery) -> None:
|
||||
|
||||
chatHistoryPrompt = t#translateRuToEng(t)
|
||||
keyboard = InlineKeyboardMarkup(inline_keyboard=[getPromptFromJson(0), getStart(0)])
|
||||
try:
|
||||
await bot.edit_message_text(
|
||||
chat_id=callback.message.chat.id,
|
||||
message_id=callback.message.message_id,
|
||||
@ -694,6 +707,8 @@ async def inl_uplchat(callback: types.CallbackQuery) -> None:
|
||||
reply_markup=keyboard,
|
||||
parse_mode = types.ParseMode.HTML
|
||||
)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
# upload Lora/Model
|
||||
@ -718,7 +733,7 @@ async def inl_uplora(callback: types.CallbackQuery) -> None:
|
||||
await callback.message.reply(f"Файл '{file_name}' загружен в {folder_path}")
|
||||
|
||||
# Вызов reset_param, сброс JSON
|
||||
@dp.message_handler(commands=["reset_param"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["reset_param"])
|
||||
@dp.callback_query_handler(text="reset_param")
|
||||
async def inl_reset_param(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("inl_reset_param")
|
||||
@ -733,7 +748,7 @@ async def inl_reset_param(message: Union[types.Message, types.CallbackQuery]) ->
|
||||
await getKeyboardUnion(txt, message, keyboard, '')
|
||||
|
||||
# Вызов fast_param, быстрые настройки
|
||||
@dp.message_handler(commands=["fast_param"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["fast_param"])
|
||||
@dp.callback_query_handler(text="fast_param")
|
||||
async def inl_fast_param(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("inl_fast_param")
|
||||
@ -741,13 +756,13 @@ async def inl_fast_param(message: Union[types.Message, types.CallbackQuery]) ->
|
||||
await getKeyboardUnion('Выбери быстрые настройки', message, keyboard, '')
|
||||
|
||||
# Список быстрых настроек
|
||||
@dp.message_handler(commands=["fp_comp"])
|
||||
@dp.message_handler(commands=["fp_mobile"])
|
||||
@dp.message_handler(commands=["fp_no_hr"])
|
||||
@dp.message_handler(commands=["fp_sdxl"])
|
||||
@dp.message_handler(commands=["fp_big"])
|
||||
@dp.message_handler(commands=["fp_inc"])
|
||||
@dp.message_handler(commands=["fp_wh"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["fp_comp"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["fp_mobile"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["fp_no_hr"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["fp_sdxl"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["fp_big"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["fp_inc"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["fp_wh"])
|
||||
@dp.callback_query_handler(text="fp_comp")
|
||||
@dp.callback_query_handler(text="fp_mobile")
|
||||
@dp.callback_query_handler(text="fp_no_hr")
|
||||
@ -774,7 +789,7 @@ async def inl_fp(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
data['hr_second_pass_steps'] = '10'
|
||||
data['cfg_scale'] = '6'
|
||||
data['width'] = '512'
|
||||
data['height'] = '768'
|
||||
data['height'] = '512'
|
||||
data['restore_faces'] = 'false'
|
||||
data['do_not_save_grid'] = 'true'
|
||||
data['negative_prompt'] = 'easynegative, bad-hands-5, bad-picture-chill-75v, bad-artist, bad_prompt_version2, rmadanegative4_sd15-neg, bad-image-v2-39000, illustration, painting, cartoons, sketch, (worst quality:2), (low quality:2), (normal quality:2), lowres, bad anatomy, bad hands, ((monochrome)), ((grayscale)), collapsed eyeshadow, multiple eyeblows, vaginas in breasts, (cropped), oversaturated, extra limb, missing limbs, deformed hands, long neck, long body, imperfect, (bad hands), signature, watermark, username, artist name, conjoined fingers, deformed fingers, ugly eyes, imperfect eyes, skewed eyes, unnatural face, unnatural body, error, asian, obese, tatoo, stacked torsos, totem pole, watermark, black and white, close up, cartoon, 3d, denim, (disfigured), (deformed), (poorly drawn), (extra limbs), blurry, boring, sketch, lackluster, signature, letters'
|
||||
@ -875,7 +890,7 @@ async def inl_fp(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
await getKeyboardUnion(txt, message, keyboard, '')
|
||||
|
||||
# Обработчик команды /skip
|
||||
@dp.message_handler(commands=["skip"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["skip"])
|
||||
@dp.callback_query_handler(text="skip")
|
||||
async def inl_skip(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info('inl_skip')
|
||||
@ -888,14 +903,17 @@ async def inl_skip(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
if hasattr(message, "content_type"):
|
||||
await message.answer("skip")
|
||||
else:
|
||||
try:
|
||||
await bot.edit_message_text(
|
||||
chat_id=message.message.chat.id,
|
||||
message_id=message.message.message_id,
|
||||
text="Пропущено",
|
||||
reply_markup=getStart(),
|
||||
)
|
||||
except:
|
||||
pass
|
||||
|
||||
@dp.message_handler(commands=["gen"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["gen"])
|
||||
@dp.callback_query_handler(text="gen")
|
||||
async def inl_gen(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
if hasattr(message, "content_type"):
|
||||
@ -1044,7 +1062,7 @@ async def cmd_prompt(message: Union[types.Message, types.CallbackQuery]) -> None
|
||||
await getKeyboardUnion("Опции", message, keyboard)
|
||||
|
||||
# Получить опции
|
||||
@dp.message_handler(commands=["opt"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["opt"])
|
||||
@dp.callback_query_handler(text="opt")
|
||||
async def cmd_opt(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("cmd_opt")
|
||||
@ -1052,7 +1070,7 @@ async def cmd_opt(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
await getKeyboardUnion("Опции", message, keyboard)
|
||||
|
||||
# Вызов sttngs
|
||||
@dp.message_handler(commands=["sttngs"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["sttngs"])
|
||||
@dp.callback_query_handler(text="sttngs")
|
||||
async def inl_sttngs(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("inl_sttngs")
|
||||
@ -1060,7 +1078,7 @@ async def inl_sttngs(message: Union[types.Message, types.CallbackQuery]) -> None
|
||||
await getKeyboardUnion("Настройки", message, keyboard)
|
||||
|
||||
# Вызов script
|
||||
@dp.message_handler(commands=["scrpts"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["scrpts"])
|
||||
@dp.callback_query_handler(text="scrpts")
|
||||
async def inl_scrpts(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("inl_scrpts")
|
||||
@ -1068,7 +1086,7 @@ async def inl_scrpts(message: Union[types.Message, types.CallbackQuery]) -> None
|
||||
await getKeyboardUnion("Скрипты", message, keyboard)
|
||||
|
||||
# Вызов get_models
|
||||
@dp.message_handler(commands=["mdl"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["mdl"])
|
||||
@dp.callback_query_handler(text="mdl")
|
||||
async def inl_mdl(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("inl_mdl")
|
||||
@ -1083,8 +1101,8 @@ async def inl_mdl(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
await getKeyboardUnion("Turn on SD"+sd, message, keyboard)
|
||||
|
||||
# Вызов get_samplers
|
||||
@dp.message_handler(commands=["smplr"])
|
||||
@dp.message_handler(commands=["sampler_name"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["smplr"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["sampler_name"])
|
||||
@dp.callback_query_handler(text="smplr")
|
||||
async def inl_smplr(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("inl_smplr")
|
||||
@ -1099,8 +1117,8 @@ async def inl_smplr(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
await getKeyboardUnion("Turn on SD"+sd, message, keyboard)
|
||||
|
||||
# Вызов get_hr_list
|
||||
@dp.message_handler(commands=["hr"])
|
||||
@dp.message_handler(commands=["hr_upscaler"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["hr"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["hr_upscaler"])
|
||||
@dp.callback_query_handler(text="hr")
|
||||
async def inl_hr(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("inl_hr")
|
||||
@ -1128,14 +1146,14 @@ async def inl_change_param(callback: types.CallbackQuery) -> None:
|
||||
)
|
||||
|
||||
# script random gen from models
|
||||
@dp.message_handler(commands=["rnd_mdl"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["rnd_mdl"])
|
||||
@dp.callback_query_handler(text='rnd_mdl')
|
||||
async def inl_rnd_mdl(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info('inl_rnd_mdl')
|
||||
await rnd_script(message, 'models')
|
||||
|
||||
# script random gen from models
|
||||
@dp.message_handler(commands=["rnd_smp"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["rnd_smp"])
|
||||
@dp.callback_query_handler(text='rnd_smp')
|
||||
async def inl_rnd_smp(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info('inl_rnd_smp')
|
||||
@ -1189,7 +1207,7 @@ async def inf_func(chatId):
|
||||
)
|
||||
|
||||
# script random infinity gen from https://random-word-api.herokuapp.com/word?lang=en
|
||||
@dp.message_handler(commands=["inf"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["inf"])
|
||||
@dp.callback_query_handler(text='inf')
|
||||
async def inl_rnd_inf(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info('inl_rnd_inf')
|
||||
@ -1228,7 +1246,7 @@ async def inl_rnd_inf(message: Union[types.Message, types.CallbackQuery]) -> Non
|
||||
await inf_func(chatId)
|
||||
|
||||
# Получить LORA
|
||||
@dp.message_handler(commands=["get_lora"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["get_lora"])
|
||||
@dp.callback_query_handler(text="get_lora")
|
||||
async def getLora(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("getLora")
|
||||
@ -1252,7 +1270,7 @@ async def getLora(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
await getKeyboardUnion(arr, message, keyboard)
|
||||
|
||||
# Рандомный промпт с lexica.art на основе data['prompt']
|
||||
@dp.message_handler(commands=["lxc_prompt"])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, commands=["lxc_prompt"])
|
||||
@dp.callback_query_handler(text="lxc_prompt")
|
||||
async def get_lxc_prompt(message: Union[types.Message, types.CallbackQuery]) -> None:
|
||||
logging.info("get_lxc_prompt")
|
||||
@ -1328,12 +1346,15 @@ async def inl_yes_no(callback: types.CallbackQuery) -> None:
|
||||
if callback.data[1:] in dataParams.keys():
|
||||
dataParams[callback.data[1:]] = 'False'
|
||||
#await bot.delete_message(chat_id=callback.message.chat.id, message_id=callback.message.message_id)
|
||||
try:
|
||||
await bot.edit_message_text(
|
||||
chat_id=callback.message.chat.id,
|
||||
message_id=callback.message.message_id,
|
||||
text=f"JSON параметры:\n{getJson()}\n{getJson(1)}",
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
except:
|
||||
pass
|
||||
|
||||
# отлов поста с канала и мгновенная генерация если включен just_gen
|
||||
@dp.channel_post_handler()
|
||||
@ -1352,7 +1373,7 @@ async def handle_channel_post(message: types.Message):
|
||||
)
|
||||
|
||||
# Ввели любой текст
|
||||
@dp.message_handler(lambda message: True)
|
||||
@dp.message_handler(lambda message: True and (message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0))
|
||||
async def change_json(message: types.Message):
|
||||
logging.info("change_json")
|
||||
keyboard = InlineKeyboardMarkup(inline_keyboard=[getSet(0), getOpt(0), getStart(0)])
|
||||
@ -1409,7 +1430,7 @@ async def change_json(message: types.Message):
|
||||
)
|
||||
|
||||
# Ввели ответ на change_json
|
||||
@dp.message_handler(state=Form)
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, state=Form)
|
||||
async def answer_handler(message: types.Message, state: FSMContext):
|
||||
logging.info('answer_handler')
|
||||
keyboard = InlineKeyboardMarkup(inline_keyboard=[getSet(0), getOpt(0), getStart(0)])
|
||||
@ -1432,7 +1453,7 @@ async def answer_handler(message: types.Message, state: FSMContext):
|
||||
f"JSON параметры:\n{getJson()}\n{getJson(1)}", reply_markup=keyboard
|
||||
)
|
||||
|
||||
@dp.message_handler(content_types=['document'])
|
||||
@dp.message_handler(lambda message: message.from_user.id in ALLOWED_USERS or len(ALLOWED_USERS) == 0, content_types=['document'])
|
||||
async def handle_file(message: types.Message):
|
||||
logging.info('handle_file')
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM python:3.11
|
||||
FROM soaska.ru/soaska/pytorch:latest
|
||||
LABEL maintainer="info@borisov-ab.ru"
|
||||
|
||||
WORKDIR /bot
|
||||
|
@ -10,3 +10,6 @@ SD_PORT = '7861'
|
||||
SD_USERNAME = 'user'
|
||||
SD_PASSWORD = '1234'
|
||||
DEBUG = 'no' # 'yes' to debug
|
||||
# ids are type int
|
||||
#ALLOWED_USERS = '[id1, id2, idN]'
|
||||
ALLOWED_USERS = '[]' # for public access
|
@ -1,6 +1,7 @@
|
||||
aiogram==2.22.2
|
||||
webuiapi
|
||||
translate
|
||||
torch
|
||||
transformers
|
||||
vk_api
|
||||
ok_api
|
||||
|
Loading…
Reference in New Issue
Block a user