Skip to content

Instantly share code, notes, and snippets.

@fitwist
Created May 10, 2023 13:45
Show Gist options
  • Save fitwist/5d0eb1509976d52063633f10063f61b5 to your computer and use it in GitHub Desktop.
Save fitwist/5d0eb1509976d52063633f10063f61b5 to your computer and use it in GitHub Desktop.
Aiogram: хэндлер разметки
@dp.message_handler(commands=['start'], state=None)
async def start(message: types.Message, state: FSMContext):
'''Точка входа'''
tg_id = message.chat.id
name = message.from_user.first_name
full_name = message.from_user.full_name
reg = re.compile('[^\w 0-9 \.,]')
f_name = reg.sub('', full_name)
login = f'@{message.from_user.username}'
db.registration(tg_id, f_name, login)
# через regex
reg = re.compile('[^\w 0-9 \.,]')
f_name = reg.sub('', full_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment