Torom / BotLi

Lichess Bot
GNU Affero General Public License v3.0
44 stars 82 forks source link

Use BOTli on another site #139

Closed ttBOT-on-Lichess closed 1 year ago

ttBOT-on-Lichess commented 1 year ago

Hi! Is it possible to use BotLi on another site like playstrategy.org ? Ist is possible to change eg url or other things in order to have the ability to use it on PlayStrategy?

Torom commented 1 year ago

No. Currently the URL of lichess is hardcoded. But I should change that sometime.

If the API of PlayStrategy is compatible to the one of lichess, BotLi would theoretically work there too. But I have not dealt with any other site than lichess.

ttBOT-on-Lichess commented 1 year ago

Okay, so if i'd change that myself with a fork of your repository, which files must I change? And yes, PlayStrategy's API is compatible to Lichess' APi :)

Torom commented 1 year ago

Only api.py I guess

ttBOT-on-Lichess commented 1 year ago

Okay thx a lot!

Torom commented 1 year ago

But I'll make the URL configurable soon.

Torom commented 1 year ago

Now that I think about it, BotLi will probably crash if you try to play variants that are not also supported on Lichess.

Also python-chess, the library BotLi uses for pretty much everything, only supports the Lichess variants if I see it correctly.

ttBOT-on-Lichess commented 1 year ago

Oh okay but as there are many games but also lichess variants on PlayStrategy, we could use it at least for it

Torom commented 1 year ago

Since 2c7b968 you can set the URL in the config.yml. Please give feedback how good this works.

ttBOT-on-Lichess commented 1 year ago

Thx! Where should I write the URL on the config file?

Torom commented 1 year ago

Simply somewhere top level:

url: "https://playstrategy.org"
ttBOT-on-Lichess commented 1 year ago

Okay thank you very much I'll test it today :)

ttBOT-on-Lichess commented 1 year ago

I've got this error :

Traceback (most recent call last): File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 971, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\json__init__.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\emman\Documents\ttBOT\Echecs\BOT\PSBOT\BOT\user_interface.py", line 316, in ui.main() File "C:\Users\emman\Documents\ttBOT\Echecs\BOT\PSBOT\BOT\user_interface.py", line 53, in main self._handle_bot_status() File "C:\Users\emman\Documents\ttBOT\Echecs\BOT\PSBOT\BOT\user_interface.py", line 102, in _handle_bot_status if 'bot:play' not in self.api.get_token_scopes(self.config['token']): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\site-packages\tenacity__init.py", line 289, in wrapped_f return self(f, *args, **kw) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\site-packages\tenacity__init.py", line 379, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\site-packages\tenacity\init__.py", line 314, in iter return fut.result() ^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures_base.py", line 449, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures_base.py", line 401, in get_result raise self._exception File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\site-packages\tenacity\init.py", line 382, in call__ result = fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\emman\Documents\ttBOT\Echecs\BOT\PSBOT\BOT\api.py", line 168, in get_token_scopes return response.json()[token]['scopes'] ^^^^^^^^^^^^^^^ File "C:\Users\emman\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Torom commented 1 year ago

It looks like they are missing this endpoint: https://lichess.org/api#tag/OAuth/operation/tokenTest

ttBOT-on-Lichess commented 1 year ago

Oh yes PlayStrategy tokens are old lichess tokens : it doesn't comport the suffix "lip"....

Torom commented 1 year ago

That alone would not be a problem. But the API is too old. It simply lacks endpoints that BotLi needs to work correctly.

ttBOT-on-Lichess commented 1 year ago

Oh okay...

M-DinhHoangViet commented 1 year ago

playstrategy not have API Bots online