如果用户已经与 AIOgram 共享,如何获取 phone 号码

How to get phone number if user already shared with AIOgram

# keyboard
share_keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True)
share_button = types.KeyboardButton(text="Share", request_contact=True)
share_keyboard.add(share_button)


@dp.message_handler(ChatTypeFilter(chat_type=types.ChatType.PRIVATE))
async def understand_message_handler(message: types.message):

if message.text == "Register" and not await check_user(message.from_user.id):
    await message.answer("Enter phone number:",
                         reply_markup=share_keyboard)
    await Registration.registration_number.set()

@dp.message_handler(state=Registration.registration_number)
async def input_number(message: types.Message, state: FSMContext):
await state.finish()
telephone = message.contact.phone_number
connection = await get_connection()
sql = f"INSERT INTO users(id, number) VALUES ({message.from_user.id}, {telephone})"
cursor = connection.cursor()
cursor.execute(sql)
connection.commit()


# ERROR
'NoneType' object has no attribute 'phone_number'

我使用 AIOgram 但这行不通,但使用 telebot 就可以了。请告诉我如何获得 AIOgram 中的号码?

默认情况下,消息处理程序仅接受文本消息 - 需要通过添加过滤器来更改此行为 content_types=types.ContentType.CONTACT