forked from Pavel_Durov/python_bot
добавил кнопки
This commit is contained in:
parent
b3f47e4754
commit
cf87d86413
17
bot.py
17
bot.py
@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aiogram import Bot, Dispatcher, executor, types
|
from aiogram import Bot, Dispatcher, executor, types
|
||||||
|
from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton
|
||||||
API_TOKEN = '5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w'
|
API_TOKEN = '5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w'
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
@ -10,23 +11,23 @@ bot = Bot(token=API_TOKEN)
|
|||||||
dp = Dispatcher(bot)
|
dp = Dispatcher(bot)
|
||||||
@dp.message_handler(commands=['start', 'help'])
|
@dp.message_handler(commands=['start', 'help'])
|
||||||
async def send_welcome(message: types.Message):
|
async def send_welcome(message: types.Message):
|
||||||
"""
|
|
||||||
This handler will be called when user sends `/start` or `/help` command
|
|
||||||
"""
|
|
||||||
await message.reply("Дарова пидорас!")
|
await message.reply("Дарова пидорас!")
|
||||||
|
|
||||||
|
async def send_welcome(message: types.Message):
|
||||||
|
kb = [types.KeyboardButton(text="Пошел на хуй"), types.KeyboardButton(text="Нет, ты!")]
|
||||||
|
keyboard = types.ReplyKeyboardMarkup(keyboard=kb)
|
||||||
|
await message.reply("Дарова", reply_markup=keyboard)
|
||||||
|
"""
|
||||||
@dp.message_handler()
|
@dp.message_handler()
|
||||||
async def echo(message: types.Message):
|
async def echo(message: types.Message):
|
||||||
# old style:
|
|
||||||
# await bot.send_message(message.chat.id, message.text)
|
|
||||||
|
|
||||||
if 'привет' in message.text:
|
if 'привет' in message.text:
|
||||||
await message.answer('pidor2')
|
await message.answer('pidor2')
|
||||||
else:
|
else:
|
||||||
await message.answer(message.text)
|
await message.answer(message.text)
|
||||||
|
@dp.message_handler()
|
||||||
|
|
||||||
|
async def echo_mesaage(message: types.Message):
|
||||||
|
"""
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
executor.start_polling(dp, skip_updates=True)
|
executor.start_polling(dp, skip_updates=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user