A telegram bot for the DMI students (@DMI_Bot)
Python Dockerfile
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 255 commits ahead, 47 commits behind Helias:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.



Telegram-DMI-Bot is the platform that powers @DMI_bot, a Telegram bot aided at helping students find informations about professors, classes' schedules, administration's office hours and more.

Using the live version

The bot is live on Telegram with the username @DMI_Bot. Send '/start' to start it, '/help' to see a list of commands.

Please note that the commands and their answers are in Italian.

Setting up a local istance

If you want to test the bot by creating your personal istance, follow this steps:

  • Clone this repository or download it as zip.
  • Copy config/token.conf.dist into "token.conf" and write your telegram bot token here. (If you don't have a token, message Telegram's @BotFather to create a bot and get a token for it)
  • Send a message to your bot on Telegram, even '/start' will do. If you don't, you could get an error
  • Copy the file data/DMI_DB.db.dist into data/DMI_DB.db to enable the database sqlite
  • Copy the file config/settings.yaml.dist into config/settings.yaml
  • Now you can launch "main.py" with your Python interpreter

System requirements

  • Python 3
  • python-pip
  • python-bs4
  • language-pack-it

To install with pip

  • python-telegram-bot
  • pydrive
  • requests
  • xlrd

Special functions

- /news /spamnews

You can enable these commands setting disable_chatid_logs = 0

These functions allow to send to all users that used at least once the bot and stored in logs/chatid.txt a message. /news with this command you write the message (example: /news "This is a news!"). With /spamnews the bot will send to all users the message.

Notes: only some users are allowed to use these commands indeed there is an if condition that check the chatid of the user that can use them

- /stats

You can enable these commands setting disable_db = 0 and copy data/DMI_DB.db.dist into data/DMI_DB.db

This command shows the statistics of the times where the commands are used in the last 30 days.

- /drive /request /adddb

You can enable these commands setting disable_drive = 0, configure the GoogleDrive credentials and copy data/DMI_DB.db.dist into data/DMI_DB.db.

/drive: command to get the GoogleDrive files /request allows the user to send the subscribe request to get the access for /drive /adddb allows some special users to give the access to /drive to another user

Configure Drive
  • open a project on the Google Console Developer
  • enable Drive API
  • download the drive_credentials.json and put it on config/
  • copy config/settings.yaml.dist into config/settings.yaml, then configure it

Docker container

How to use

First of all configure the file Dockerfile, add the API TOKEN in _TOKEN_ (line 6).

Build image dmibot with docker:

$ docker build -t dmibot .

Run the container dmibot:

$ docker run -it dmibot

Now you can go to the dmibot directory and run the bot:

$ cd /usr/local/dmibot/
$ python main.py


This open-source software is published under the GNU General Public License (GNU GPL) version 3. Please refer to the "LICENSE" file of this project for the full text.


This project is made possible thanks to the contributions of: