moan0s / matrix-registration-bot

A bot that is used to create and manage registration tokens for a matrix server
GNU Affero General Public License v3.0
64 stars 10 forks source link

Bot cannot be started #2

Closed Loxatan closed 2 years ago

Loxatan commented 2 years ago

Hi,

this is my first contact with Matrix, please bear with me. I am probably doing something fundamentally wrong.

I have installed the registration bot and configured it so far. Now when I want to start it, I get the following error:

(env) root@vmd76330:~/synapse# python -m matrix_registration_bot.bot
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/synapse/env/lib/python3.7/site-packages/matrix_registration_bot/bot.py", line 18, in <module>
    access_token=bot_access_token)
TypeError: __init__() got an unexpected keyword argument 'access_token'
(env) root@vmd76330:~/synapse#

I'm honestly not quite sure where to put the config file. To be on the safe side I have it here: /root/synapse/env/lib/python3.7/site-packages/matrix_registration_bot/ and once here: /root/synapse/

My Config.yml looks like this:
bot:
  server: "https://matrix.mydomain.de"
  username: "registration-bot"
  access_token: "syt_c_______________________________________________gw"
api:
  # API endpoint of the registration tokens
  base_url: 'https://matrix.mydomain.de'
  endpoint: '/_synapse/admin/v1/registration_tokens'
  # Access token of an administrator on the server
  token: "syt_Y_______________________________________eC"

I've already searched the whole internet and tried to solve it myself, but I just don't know where the problem is.

Can you maybe help me?

moan0s commented 2 years ago

Thanks for the report - could very well be a problem on my end. I will try to reproduce it myself. Did you install via pip? Your configuration looks fine and seems to be in the right place (the right place is the working directory, so the directory from which you start the bot).

moan0s commented 2 years ago

So from what I see, everything you do should be fine. Is it possible that you use a version of simple-matrix-bot-lib that is < 2.2.0 Only after that the access token option became available.

https://github.com/KrazyKirby99999/simple-matrix-bot-lib/commit/0f6a7ac445a307fa039aa8a0e3071281382dd87a

If you want to check the easiest way would be to try

$ pip install simplematrixbotlib
moan0s commented 2 years ago

I could reproduce the error with pip install simplematrixbotlib==2.1.0. so you would simply have to update to a newer version of simplematrixbotlib. To use a specific version you could use `pip install simplematrixbotlib==2.6.1``.

A little bit of context: this bot is based on simplematrixbotlib. The library handles everything regarding authentication, sending messages etc.. Therefore it needs a password or an access token for the bot account. I only implemented access token based authentication for the registration bot, this will change with the next version (0.0.3).

Hope I could help. If this does not solve your problem (or the solution was unclear), please tell me and we will find a solution :)

Loxatan commented 2 years ago

Hi,

thank you very much for your answer and your effort. I have now tried to install the version 2.6.1, however, he tells me he does not find the version. I can still install the 2.1.0 by command, but a higher no longer.

(env) root@vmd76330:~/synapse# pip install simplematrixbotlib==2.6.1
ERROR: Could not find a version that satisfies the requirement simplematrixbotlib==2.6.1 (from versions: 0.0.1, 0.0.2, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.6.0, 2.0.0, 2.1.0)
ERROR: No matching distribution found for simplematrixbotlib==2.6.1

I still use Debian 10.

$ pip install simplematrixbotlib

Unfortunately, there is only the version 2.1.0

As soon as I have a solution for this, I'll get back to you.

moan0s commented 2 years ago

Okay. If I have time I can try in an virtual machine. You could also ask in the simplematrixbot support channel, the people there are usually very helpful https://matrix.to/#/#simplematrixbotlib:matrix.org

I am going to close the issue here in some time as this is not a issue that can be solved by this project. But feel free to post any solution here to help others.

moan0s commented 2 years ago

So the problem seems to be that debian 10 uses python 3.7 and simplematrixbotlib does not support python 3.7 A suggestion from the developer was: "maybe one of the newer python appimages could be used? https://github.com/niess/python-appimage/releases"