forked from Pavel_Durov/python_bot
добавил список команд и реплай на фото
This commit is contained in:
parent
b2160eac83
commit
e1c6bc7cf7
10
bot.py
10
bot.py
@ -12,16 +12,22 @@ logging.basicConfig(level=logging.DEBUG)
|
|||||||
bot = Bot(token=API_TOKEN)
|
bot = Bot(token=API_TOKEN)
|
||||||
dp = Dispatcher(bot)
|
dp = Dispatcher(bot)
|
||||||
|
|
||||||
|
async def set_default_commands(dp):
|
||||||
|
await dp.bot.set_my_commands([
|
||||||
|
types.BotCommand("start", "Запустить бота"),
|
||||||
|
types.BotCommand("photo", "рандомная пикча"),
|
||||||
|
]) # отображает cписок команд
|
||||||
|
|
||||||
@dp.message_handler(commands=['start'])
|
@dp.message_handler(commands=['start'])
|
||||||
async def start_func(message: types.Message):
|
async def start_func(message: types.Message):
|
||||||
# user_id = message.from_user.id
|
# user_id = message.from_user.id
|
||||||
# user_full_name = message.from_user.full_name
|
# user_full_name = message.from_user.full_name
|
||||||
# logging.INFO(f'{user_id=} {user_full_name=}', {time.asctime()})
|
# logging.INFO(f'{user_id=} {user_full_name=}', {time.asctime()})
|
||||||
await message.reply('hello')
|
await message.reply('похуй')
|
||||||
|
|
||||||
@dp.message_handler(commands=['photo'])
|
@dp.message_handler(commands=['photo'])
|
||||||
async def send_image(message: types.Message):
|
async def send_image(message: types.Message):
|
||||||
await bot.send_photo(message.chat.id, photo='https://memepedia.ru/wp-content/uploads/2018/08/ya-pidoras.jpg')
|
await bot.send_photo(message.chat.id, photo='https://memepedia.ru/wp-content/uploads/2018/08/ya-pidoras.jpg', reply_to_message_id=message.message_id)
|
||||||
|
|
||||||
@dp.message_handler(content_types=types.ContentTypes.TEXT)
|
@dp.message_handler(content_types=types.ContentTypes.TEXT)
|
||||||
async def send_faggot(message: types.Message):
|
async def send_faggot(message: types.Message):
|
||||||
|
Loading…
Reference in New Issue
Block a user