Code Monkey home page Code Monkey logo

j4nn0 / j4nn0-b0t Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 13.0 65 KB

Python Telegram BOT ables to store and retrive data from database (create, delete and read items from your personal list) and set alarms

Home Page: https://telegram.me/J4NN0_Bot

License: GNU General Public License v3.0

Python 99.73% Procfile 0.27%
python-bot telegram telegram-bot telegram-bot-api telegram-api heroku herokuapp heroku-deployment heroku-apps python-script

j4nn0-b0t's Introduction

J4NN0 B0T

https://telegram.me/J4NN0_Bot https://pypi.org/project/python-telegram-bot/ https://www.gnu.org/licenses/lgpl-3.0.html

The BOT is hosted on Heroku and it has been tested using Python v3.9.7. Also, python-telegram-bot API and sqlite3 are needed.

J4NN0 BOT main features:

  1. Store and retrieve data from a database: you can save/delete/show items on your personal list.
  2. Set an alarm: when time is up the BOT will remind you what you asked for.

Check it out on telegram: @J4NN0_Bot

Demo

Watch the video

Table of Contents

Database

list.db

It is composed by a single table, REMINDERS:

  • CHATID: chat id for that user.
  • USRNAME: username of the user.
  • ITEM: the item added by the user.

Every time an user add/remove one or more item(s), these are added/removed to/from the db.

I also suggest you to download DB Browser for SQLite to easily manage (create, read, delete, modify, etc.) the database(s).

BOT usage

  • โญ• Developer

    • /about: to see info about developer
  • ๐Ÿ“ List

    • /addtolist <item>: to add one or several items to your personal list.
    • /rmfromlist <item>: to remove one or several items from your personal list.
    • /show_list: it shows all items in your personal list.
    • /clear_list: to delete all items from your personal list.
  • ๐Ÿ”€ Random value

    • /random <number>: it will return a random number between 0 and .
  • โฐ Alarm

    • /timer <seconds>: to set a timer and wait for your message.
  • ๐Ÿค– Info about bot

    • /help: to have info about all commands.

Easter egg

There are also a lot of Easter eggs (you can't find them in this code) that i wrote to have fun with my friends. Try to find them and enjoy!

How to host BOT on Heroku

  1. Register on Heroku.

  2. Download and install Heroku CLI and git.

  3. Create a project folder and put inside it the following files

    bot.py
    Procfile
    runtime.txt
    requirements.txt
    

    You can also have a app.json schema in order to declare environment variables, add-ons, and other information required to run an app on Heroku. More info here.

  4. Put inside Procfile

    worker: python script.py
    
  5. Put the python version you want to use in runtime.txt.

    For instance, if you want to use Python v3.6.6 just put inside the file:

    python-3.6.6
    
  6. Specify explicit dependencies versions inside requirements.txt.

    For instance, I'm using python-telegram-bot API. So my file requirements.txt will look like

    python-telegram-bot==8.1.1
    

    To update this file, you can use the pip freeze command in your active virtual environment:

    pip freeze > requirements.txt
    

    More info here.

  7. At this stage, if you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key

    heroku login
    
  8. Create git repository

    git init
    

    or clone this repo

    git clone https://github.com/J4NN0/j4nn0-b0t.git
    
  9. Create heroku app

    heroku create
    
  10. Push your code (or deploy changes) into heroku app

    git add .
    git commit -m 'message'
    git push heroku master
    
  11. Run your worker

    heroku ps:scale worker=1
    
  12. Check logs with and enjoy your bot

    heroku logs --tail
    

Official Heroku Guide

Checkout also the offical heroku guide: Getting Started on Heroku with Python.

Resources

j4nn0-b0t's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

j4nn0-b0t's Issues

Bot token

Hey Pls tell where to put the bot token to use the bot !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.