You need to get the user ID who uses the bot. How can this be done in Aiogram?
question@mail.ru
·
01.01.1970 03:00
How to get ID user Aiogram
answer@mail.ru
·
01.01.1970 03:00
The receipt of the ID of the user is carried out using
Import logging from aiogram Import but, dispatcher, dispatcher Executor, Types loging.basicconfig (level = logging.info) bot = Bot (token = ) DP = DISPATCHER (BOT) @dp.message_handler ( commander = [ 'start' ] ) Def alarm ( message: Types.message ): keyboard_markUp = Types.inlineboardmarkup () user_id_btn = types.inlineboardbututton ( '' get the ID of the ID from the Inline button ', callback_data = 'user_id' ) keyboard_markup.row (user_id_btn) await message.answer ( f "your id: {message.from_user. id } "" , reply_markup = keyboard_markup) @dp.callback_query_handler ( text = 'user_id' ) def user_id_inline_callback ( callback_query: types.callbackquery ): AWAIT CALLBACK_QUERY.ANSWER ( f "" Your id: {callback_query.from_user. id } "" , true ) if> __name__ == '__ mail __' : : Executor.Start_Polling (DP, SKIP_UPDATES = TRUE )
luck!