iwatkot / py3xui

Sync and Async Object-oriented Python SDK for the 3x-ui API.
MIT License
38 stars 5 forks source link

change existing user #37

Open Spp595 opened 2 weeks ago

Spp595 commented 2 weeks ago

how can i change the expiration time of a link for an existing user?

github-actions[bot] commented 2 weeks ago

Thank you for opening an issue!
Please, first check our FAQ section in discussions to see if your question has already been answered.
You can also use Discussion if you have any questions or suggestions, while the Issues section is for bug reports and feature requests.
If you want to proceed with the issue, please provide the following information:
- Description of the issue
- Expected behavior
- Actual behavior
- Steps to reproduce the issue
- Python version
- OS
- py3xui version
- 3x-UI version
- Code snippet or a minimal example to reproduce the issue (if applicable)
- JSON representation of the request to the API (if applicable)

Thank you!

iwatkot commented 2 weeks ago

@Spp595, hello!

Please clarify what is the "link" of a user? Provide a screenshot of the feature in 3x-ui panel and it would be nice if you check the source API docs and point out on the exact parameter you need.

Sincerely

Spp595 commented 2 weeks ago

I'm talking about expiry_time, I already found how)))

Spp595 commented 2 weeks ago

I found the function, but it does not work correctly, when I use api.client.update(client.id, client) it replaces the client value with those that I specified in the client class object, but is it possible to somehow add, change only one value without changing all?

Spp595 commented 2 weeks ago

Example:

    api = Api.from_env()
    api.login()
    client = api.client.get_by_email(email)
    client.id = uuid
    client.expiry_time = int(new_dt.timestamp() * 1000)
    api.client.update(client.id, client)

when I run this code the user's tg_id and flow are deleted

iwatkot commented 2 weeks ago

@Spp595, please provide all the required information, which the bot suggested in the first comment.

‼️ Especially the payload of the request to the 3x-ui panel API.

Ensure that the payload has the required fields and they have the correct values. If they exist, and have correct values - then please report it as stated above.

Thank you Sincerely