So the Telegram Bot can do different actions, depending on who activated the command. This concerns aiogram, a framework for Telegram Bot API
Advertisement
Answer
You could use a simple filtering system:
- Create a dict/database with user_id’s and their roles
- Get the role from that dict/db by id and do the action
This solution in code:
JavaScript
x
13
13
1
roles={1234:'Admin', 1243:'User', 1223:'Moderator'}
2
3
@dp.message_handler()
4
async def handler(message: types.Message) -> None:
5
role=roles[message.from_user.id]
6
7
if role=='Admin': do_action()
8
elif role=='User': do_another_action()
9
elif role=='Moderator': do_yet_another_action()
10
11
#you can add a check at start, to see if person even has a role
12
#if message.from_user.id in roles:
13