A Telegram bot where you can play the Akinator Guessing game check out Akinator on Telegram. If the bot is offline, contact me on telegram, so that I can look into it.
Create a .env
file and fill up the following in it.
BOT_TOKEN=<your-bot-token>
# Mongo DB Username and Password
MONGO_ROOT_USER=admin
MONGO_ROOT_PASSWORD=admin
# Mongo Express Username and Password
MONGOEXPRESS_LOGIN=admin
MONGOEXPRESS_PASSWORD=admin
Change the username & password for MongoDB and MongoExpress as you like above.
Put the compose.yml
in the same directory where .env
file is present.
After that, run the following:
docker compose up -d
Akinator uses MongoDB by default to store the user stats such as number of games won, abandoned, played and their telegram provided info and also to facilitate for the leaderboard function. MongoDB is easy to set up and work with, noSQL is easy compared to SQL. MongoDB even offers free cloud database for small use. You can create a local mongoDB cluster or use the online mongoDB Atlas to start.. Here, the scope of the following steps is to follow on the footpath of the online setup using mongoDB Atlas.
-
Go to mongoDB official site and login/register.
-
On the Atlas tab, click
create
to create a new cluster. -
Now configure the cluster as you want such as the cloud service provider, region, cluster tier etc..
-
Now click on the cluster name which will take you to the Overview page.
-
Click
Collections
and create a database calledaki-db
. Insideaki-db
create a collection calledusers
-
Now on the left side, under the
Security
click theDatabase Access
and add a user. Don't forget to note down the username and password! -
Now go to
Network Access
right underDatabase Access
and check whether0.0.0.0/0
is in the IP Access List. If not, then clickAdd IP Address
and add0.0.0.0/0
. -
Now everything is set up! But there's still one step left, i.e to copy the mongoDB address to your database to be accessed by Akinator.
-
Now under the
Deployment
tab, clickDatabases
and you should see the cluster you created. Now click the button namedConnect
. ChooseConnect your application
. Selectpython
as Driver and appropriate version. -
It should now give you a template string and will give you instructions on what need to be changed/replaced with. It usually askes you to replace
<username>
,<password>
andmyFirstDatabase
. -
Do you now remember step 6 ? Where you should have noted down the username and password. yeah, now you have to replace the username, password. And for
myFirstDatabase
, replace it with yourcluster
name. -
Everything's done! Finally just copy the string and paste it in the appropriate environmenal variable.
/start
- Start the bot
/language
- Change language of the questions asked by Akinator ( This doesn't change the language of the bot interface! )
/childmode
- Enable/Disable NSFW Content
/play
- Start playing!
/me
- Shows stats about you.
/leaderboard
- Check leaderboard. It includes various categories!
- Infiniticity's Akinator.py (
akinator
on PyPI) - python-telegram-bot
- hellboi-atul for heroku deploy button.