Closed SpiritFoxo closed 2 weeks ago
@SpiritFoxo, hello!
Thank you for reaching out. I would like to ask you if the following approach is working in your case:
Code reference for traffic limit:
async def some_other_function():
user_uuid = str(uuid.uuid4())
new_client = Client(id=user_uuid, email=str(telegram_id), enable=True)
await api.client.add(inbound.id, [new_client])
await set_traffic_limit(telegram_id, user_uuid)
async def set_traffic_limit(telegram_id: int, user_uuid: str) -> None:
client = await api.client.get_by_email(str(telegram_id))
client.id = user_uuid
client.total_gb = gigabytes_to_bytes(Settings().traffic_limit)
await api.client.update(user_uuid, client)
When working with 3x-ui API I found out that some of the fields may be ignored by the API on user create, even if they were passed (or maybe I'm doing something wrong). So I used this workaround to set the traffic limit, maybe it will help you too.
Sincerely
As an additional check, I also would like to ask for help to test if the simple POST request without SDK will work for this case, so we can check if the issue is in the SDK or on the API side.
Oh, yeah. Thats works. Thanks for fast response!
when i try to add new client with limited duration it doesnt work. It just creates new client with expiry_time=0