Skip to content

BeastHunter19/Telegram-DMI-Bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram-DMI-Bot

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.
  • 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 (If you don't have a token, message Telegram's @BotFather to create a bot and get a token for it)
  • Now you can launch "main.py" with your Python3 interpreter

System requirements

  • Python 3
  • python-pip3
  • language-pack-it

To install with pip3

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

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

Build image dmibot with docker:

$ docker build ./ -t dmibot --build-arg TOKEN=<token_API>

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

License

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.

Credits

This project is made possible thanks to the contributions of:

About

A telegram bot for the DMI students (@DMI_Bot)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.8%
  • TSQL 2.5%
  • Dockerfile 0.7%