Project allows you to create, manage and share virtual guided tours, viewable over Telegram.
At this moment you need to manually approve users for your tours using the admin-mode in the bot.
/start
— initialize the bot. It will greet you, ask for the phone number and check if you have any tours approved./tours
— list the available tours and start one of them./language
- change the interface language./admin
— switch to the admin mode.
/guest
— exit the admin mode./language
- change the interface language./configure
— change the bot's settings./tours
— manage your tours./approve
— allow somebody to access a tour./revoke
— revoke access to a tour.
First of all you need to register a bot with BotFather.
Have the received token ready and don't share it anywhere.
The easiest way to run the bot is by using a sqlite3 database, but it's not recommended if you expect multiple users at the same time. The example of how to run the bot with this DB is in the next section.
Keep in mind, that the database connection URL must be in the SQLAlchemy format see the documentation for further details. Also note that you need to provide an async dialect for the connection, e.g. aiosqlite or asyncpg.
docker run --restart=unless-stopped -d \
-v $(pwd)/persistent:/home/tg/app/persistent \
ghcr.io/andrey-yantsen/tourguidebot-tg:latest \
-g <telegram_bot_token> \
--db=sqlite+aiosqlite:////home/tg/app/persistent/tour_guide_bot.sqlite3
Do not forget to replace <telegram_bot_token>
with the correct token value.
This command will start a single process for both admin_bot and guide_bot. This may cause delays in processing requests on high load.
Copy included docker-compose.yml.example
into docker-compose.yml
, and
replace <telegram_bot_token>
with the correct token value.
After that, you should be able to start everything required with the following command:
docker-compose up
In order to run the tests you'll need to have:
- A telegram bot token
- A telegram app api_id and api_hash (from https://my.telegram.org/apps)
- A session string for the app; you can get one by executing the code below:
from telethon import TelegramClient
from telethon.sessions import StringSession
api_id = "YOUR API ID"
api_hash = "YOUR API HASH"
with TelegramClient(StringSession(), api_id, api_hash) as client:
print("Session string:", client.session.save())
Thanks to ShallowDepth for the instructions.