@stasbombit

WebAppInfo берёт 1 аргумент, я даю 1 аргумент, но python видит 2?

У меня есть python код:
import asyncio
import logging
from aiogram import Bot, Dispatcher, types
from aiogram.types import WebAppInfo
from aiogram.filters.command import Command

url="https://gd.games/instant-builds/4397e427-46f2-41a0-9afb-da3b0325600e"

# Включаем логирование, чтобы не пропустить важные сообщения
logging.basicConfig(level=logging.INFO)
# Объект бота
bot = Bot(token="нету")
# Диспетчер
dp = Dispatcher()

# Хэндлер на команду /start
@dp.message(Command("start"))
async def cmd_start(message: types.Message):
    kb = [
        [types.InlineKeyboardButton("Начать игру", web_app=WebAppInfo("https://gd.games/instant-builds/4397e427-46f2-41a0-9afb-da3b0325600e"))]
    ]
    keyboard = types.ReplyKeyboardMarkup(keyboard=kb)
    await message.answer("Привет, я бот игры KITcoin", reply_markup=keyboard)
    

# Запуск процесса поллинга новых апдейтов
async def main():
    await dp.start_polling(bot)

if __name__ == "__main__":
    asyncio.run(main())

Но он возращает ошибку:
File "c:\Users\stast\Documents\projects\kitcoin\bot.py", line 20, in cmd_start
    [types.InlineKeyboardButton("Начать игру", web_app=WebAppInfo("https://gd.games/instant-builds/4397e427-46f2-41a0-9afb-da3b0325600e"))]
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BaseModel.__init__() takes 1 positional argument but 2 were given
  • Вопрос задан
  • 44 просмотра
Пригласить эксперта
Ответы на вопрос 1
@Everything_is_bad
types.InlineKeyboardButton(text="Начать игру", web_app=WebAppInfo(url="https://gd.games/instant-builds/4397e427-46f2-41a0-9afb-da3b0325600e"))
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы