~mohab/fightlike

A Mastodon bot written in Python.
chore: edit instance name and link
fix: results reduced to 9 to avoid hitting Mastodon 500 character limit
chore: clean up unnecessary .capitalize() calls in database.py

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~mohab/fightlike
read/write
git@git.sr.ht:~mohab/fightlike

You can also use your local clone with git send-email.

#Fightlike

A free, open-source, keyword-based, fighting games' characters recommender, and Mastodon bot written in Python. Database hosted on MongoDB's Atlas.

#Install (Linux)

git clone https://git.sr.ht/~mohab/fightlike
cd fightlike
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

#Customize

Fightlike's default, MongoDB database and collection names are fightlike and character. To replace them, edit lines #30 and #33 in db.py:

# Get database.
db = client.fightlike

# Get collection.
collection = db["character"]

Default character document template in database:

{
    _id: 650060820a48eee8cba77d1c,
    name: "Eddie",
    game: {
        title: "Guilty Gear XX Accent Core Plus R",
        netcode: "rollback",
        franchise: "guilty gear",
        slug: "ggxxacpr"
    },
    slug: "zato",
    keywords: [
        "puppet",
        "summoner",
        "flight",
        "negative edge"
    ],
}

#Test

Accompanied pytest files test the following:

  1. Static string processing methods in util.py
  2. Correct information retrieval from MongoDB.
  3. Connection to Mastodon can be successfully established.

String literals inside test_util.py and test_db.py can be changed to suit custom configurations.

To run all tests:

pytest

#Run (Linux)

cat >> mastodon_api_token.secret
<YOUR_MASTODON_ACCESS_TOKEN>
cat >> .env
DB_URI="<YOUR_MONGODB_URI>"
API_BASE_URL="<YOUR_API_BASE_URL>"
python fighlike.py

API_BASE_URL is where your bot lives. Fightlike is hosted on botsin.space

To exit cat, press CTRL+D