X
X
Xpym4uk762021-01-18 14:42:06
Python
Xpym4uk76, 2021-01-18 14:42:06

Why is it impossible to issue a mute for a while using the Telegram bot python?

chat_id = (ID чата)
user_id = message.from_user.id
clock = datetime.now(timezone.utc).timestamp()+1000
print(clock)
req = f'https://api.telegram.org/bot(Токен)/restrictChatMember'
permissions = {'can_send_messages':False, 'can_invite_users': True, 'until_date':clock}
permissions_json = json.dumps(permissions)
params = {'chat_id': chat_id, 'user_id': user_id, 'permissions': permissions_json}
response = requests.post(req, json=params)
print(response.text)


For some reason it always bugs forever, although I set the time to more than 30 seconds and less than 366 days, what's the problem, why does it not count the time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Krostelev, 2021-01-18
@Xpym4uk76

Where did you even get until_date from ? This is not
in the UPD documentation
. Reviewed again. You're just inserting until_date in the wrong place. This is not an object to insert into JSON, but as a separate parameter. Insert in params, and remove from permissions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question