Ikabot-Collective / ikabot

A Python-based bot designed for automating tasks in the game Ikariam
https://discord.com/invite/3hyxPRj
MIT License
88 stars 62 forks source link

Telegram token #121

Closed Kiskadee-dev closed 1 month ago

Kiskadee-dev commented 1 year ago

Bug explanation

Currenlty the telegram token is saved with the session, the result is a frequent 'insert the telegram token' message as the session expires for any reason

would be great if the tokens could be inputted with env vars or config files to avoid this as an optional configuration

Operating System

win 10

Ikabot installation

I downloaded the pre-built Windows binary

Ikabot version

latest

Python version

No response

ikagod commented 1 year ago

The token is not saved with the session it's saved inside the .ikabot file and is encrypted with the users email / pass combo. This makes it unique for every lobby account. The way to solve the frequent "insert the telegram token" message is to insert the telegram token, or ignore the message.

Ikabot doesn't use any configuration files that are usually accessible by the user.

If you want, you can make ikabot use some environment variable as the telegram bot token, I think that could be interesting, but if you open a pull request, please make sure it doesn't override the usual configuration of the token and it doesn't break ikabot for users who do not have the environment variable set.

Kiskadee-dev commented 1 year ago

Since a perfectly valid token can turn invalid due to a mishap somewhere, i doesn't think ignoring the message is ok as there won't be reports later. should investigate why the token is vanishing from the .ikabot file then, as the token and chat id can't turn invalid unless something messes with it later.

Yea, the idea would be to detect some optional env var or config file, the goal is to set the token once and never again.

ikagod commented 1 year ago

I have been using ikabot for a very long time and I have literally never run into an issue with the telegram token invalidating itself or vanishing in any way. If this is happening then you might want to figure out why your OS is nuking the .ikabot file, because that is literally the only way I can think of that this can happen. Ikabot is already set up in such a way as to have the telegram token set only once and never again.

Kiskadee-dev commented 1 year ago

There are reports of other users and i've reproduced it on linux aswell

https://discord.com/channels/715980456780234823/715980456780234826/1003495467943993434

ikagod commented 1 year ago

The most likely cause of this is the deletion of the stored session data due to the user typing in the wrong password. If #131 doesn't solve this issue please feel free to reopen it.

ElieTaillard commented 1 month ago

Is the issue solved?

Kiskadee-dev commented 1 month ago

Didn't seen any more mentions of this issue on discord