繁体   English   中英

aiogram 图书馆电报机器人与 python

[英]aiogram library telegram bot with python

from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import ReplyKeyboardMarkup, ReplyKeyboardRemove, KeyboardButton

# token API
bot = Bot(token='token')
dp = Dispatcher(bot)
#

button1 = KeyboardButton('Hello')
keyboard1 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button1)


# start command
@dp.message_handlers(commands=['start'])
async def welcome(message: types.Message):
    await message.reply("Vampir koylu oyununa hos geldiniz!", reply_markup=keyboard1)


executor.start_polling(dp)

当我尝试运行代码时出现错误,第 14 行“Handler”object is not callable 我找不到解决方案你能帮我吗?

尝试将启动命令更改为(没有 s)

@dp.message_handler(commands=['start'])

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM