leca cad71873f4 | ||
---|---|---|
deploy | ||
src | ||
translations | ||
.gitignore | ||
LICENSE | ||
README.md | ||
cities.sql | ||
csvtosql.js | ||
db.drawio | ||
docker-compose.yml | ||
meets.env | ||
output.csv | ||
package-lock.json | ||
package.json | ||
scheme.psql |
README.md
heart2heart
The heart2heart is a matrix bot that was created as a free and opensource alternative of russian bot daivinchik 'дайвинчик' that is used in similar manner to apps like Tinder. The original bot is fuctioning in Telegram, a messenger mostly known in Russia.
Installation
Bot acccount
Regeistration
To get this bot up and running, you have to register an account for it. I recommend doint it using this script from official SDK repository. Ensure that the homeserver you are about to use for your bot has open registration (no tokens or captchas), otherwise your bot will not be able to register using such method. In case if your homeserver forbids such method of registration, you can try registering an account in a traditional way, using web clients or apps, such as element web. You can extract token by going to settings->help&about->Access token. WARNING!! DO NOT SHOW ANYONE THAT TOKEN! Knowing that token makes you capable of fully controlling a bot! That is an unlikely way, because if you logout (or your session will expire), your token will stop functioning. Prefer method using the script.
Rate limit override (optional, but highly recommended) [Synapse]
Eventually, your bot will hit upon a rate limit. Even if there are only 2 users (beleive me, I tested!)
To solve this problem, you can override rate limits for your bot if you are an administrator of a homeserver that hosts your bot OR in good relationships with one! ;)
Anyway, you should login to your synape database and type
INSERT INTO ratelimit_override VALUES ('@name-of-your-bot:name-of-your-home.server', 0, 0);
That will do the trick.
Actual programm
Docker
First, you need to edit config.json
according to your needs. Fill in the homeserver you are using and the token. Also, take a fast look at some other options, maybe you'd like to adjust them!
Then, you need to edit meets.env
to your needs, i.e. database name and password. If you changed db name, you should also change it in docker-compose.yml
in postgresql's healthcheck.
Finally, to deploy this bot you can use docker. You can build a container using docker, launch postgresql container and freshly built, but why? I'd do it using docker-compose
:
docker-compose up --build
for the first run, wait for [LOG] [I] Bot started!
to appear, the ctrl + c, and then just:
docker-compose up -d
.
Update
git pull
docker-compose up --build -d
And then you can agan use just
docker-compose up -d
But who am I to teach you how to use docker?
Traditional
You can deploy this project without docker.
To do so, you first need a postgresql database.
Connect to it and execute the following (you can change the name meets
to whatever you'd like):
CREATE DATABASE meets;
ALTER DATABASE meets OWNER TO meets;
ALTER DATABASE meets OWNER TO meets;
ALTER USER meets WITH PASSWORD 'CH@NGME!';
(change CH@NGME
to you strong password.)
ALTER ROLE meets WITH LOGIN;
Assuming, that the database is running locally and on a port 5432, change the variables that you have changed in previous step and use the following command from the root of the project:
POSTGRES_USER=meets POSTGRES_PASSWORD=CH@NGME! POSTGRES_DB=meets POSTGRES_HOST=localhost POSTGRES_PORT=5432 node src/index.js
Update:
git pull
Thanks
Thanks to https://simplemaps.com/resources/free-country-cities for the free version of a database with cities!