which library for a selfhosted simple matrix bot?
from illusionist@lemmy.zip to selfhosted@lemmy.world on 03 Feb 21:44
https://lemmy.zip/post/58386424

Is simplematrixbotlib the way to go or are there other better alternatives?

MyBot

I want a bot that sends me one message per day. It shall be a message to kick off thoughts / reflection / meditation / contemplation. I already have lots of questions in a csv. It’s as simple as take a random note and send it to me at 06:00.

In a second step I could add commands like \question and \q to prompt a random question. I could add “users”, i.e. me, and vote on the questions with smileys to increase/decrease the likelihood of the question appearing the next time.

actual goal

I want to write a diary / journal every day and having a random question boosts my brain. I tried journiv and I love it but it is not open source, so I have to build something on my own. I am no kotlin dev, but I can use python. I already have a shell version but a UI would be great. Moreover, in a matrix room I can add pictures, videos, and voice memos. That sounds great. Maybe, I can search questions with hashtags.

advice

Is there another tool better suited to do this?

#selfhosted

threaded - newest

yaroto98@lemmy.world on 03 Feb 22:18 collapse

If you don’t shy away from python, I just use the requests library most of the time:

homeserver_url = “XXX”

access_token = “XXX”

room_id = “!XXX”

url = f{homeserver_url}/_matrix/client/r0/rooms/{room_id}/send/m.room.message"

headers = {“Authorization”: f"Bearer {access_token}",“Content-Type”: “application/json”,}

data = “msgtype”: “m.text”,“body”: “Question of the day!”,}

response = requests.post(url, headers=headers, data=json.dumps(data))

Alternatively I also have a bot I use in NodeRed connected to Home Assistant.

Double Alternatively, I’ve used AppRise successfully within various tools like ChangeDetection to notify me via matrix.