Skip to content

Commit

Permalink
feat: команда запроса локации 2
Browse files Browse the repository at this point in the history
  • Loading branch information
wandeder committed Oct 4, 2023
1 parent 0e9bafa commit 8116376
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spend_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ async def start(message: types.Message, state: FSMContext):
@dp.message_handler(commands='country', state='*')
async def country(message: types.Message, state: FSMContext):
await state.finish()
keyboard = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
await message.answer(
'Поделись своей локацией:',
reply_markup=types.ReplyKeyboardMarkup().add(types.KeyboardButton("Share location", request_location=True))
reply_markup=keyboard.add(types.KeyboardButton("Share location", request_location=True))
)


@dp.message_handler(content_types=['location'])
async def handle_location(message: types.Message):
lat = message.location.latitude
lon = message.location.longitude
reply = f"latitude: {lat}\nlongitude: {lon}\n{message.location}"
Expand Down

0 comments on commit 8116376

Please sign in to comment.