Giter Site home page Giter Site logo

yordy66 / telebot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jiklopo/telebot-template

0.0 0.0 0.0 18.23 MB

This is a template repository for creating Telegram Bot on Django that will be deployed to Heroku.

Python 99.08% Procfile 0.92%

telebot's Introduction

Django Telegram Bot

This repository is a template for creating Telegram bot and deploy it to Heroku. You have to follow a few simple steps to deploy it to Heroku. This bot is based on Django and DRF so you can modify it as a regular django app.

Heroku Deploy Guide

  1. Create your telegram bot and obtain token.
  2. Create your repo from this template.
  3. Go and register on https://www.heroku.com/
  4. Create an app
    • Go to settings, click reveal config vars
    • Add a variable with the key TOKEN and the value of your bot token
    • Go to deploy, in the deployment method section click GitHub, connect your account
    • Connect the repository you forked on step 2
    • Click "deploy branch" and enable Automatic Deploys
  5. Click open app in the top right corner, then change the URL to look like this: https://YOUR_APP.herokuapp.com/YOUR_TOKEN. It will set the webhook for your bot.
  6. Now, you can text your bot and it will echo your message if everything has been set up correctly
  7. Edit the bot/bot.py file to create your own bot.
  8. Push changes to your repo to update your bot.

Ubuntu setup guide

Tested on Ubuntu 20.04.02.
  1. Install PyCharm Community: sudo snap install pycharm-community --classic.
  2. Install packages: sudo apt install postgresql libpq-dev python3-pip.
  3. Create your own repository from this template if you have not done so already.
  4. Clone your repo using PyCharm.
  5. Create virtualenv in PyCharm.
  6. Install the requirements.
  7. Open botnet/settings.py and change the values of USER and PASSWORD ("jiklopo" and "kartop") in the database settings.
  8. Configure database (";" in the end is important):
    • Open terminal
    • Start psql: sudo -u postgres psql
    • Create database: CREATE DATABASE telebot;
    • Connect to the db: \c telebot
    • Create User: CREATE USER YOUR_USER WITH PASSWORD 'YOUR_PASSWORD'; Don't forget to replace YOUR_USER and YOUR_PASSWORD to the values from step 4
    • Exit: \q
  9. Create Configuration. Select manage.py file for the Script path, Parameters: runserver and create Environment variable TOKEN with the value of your bot token.
  10. Now you can start your project using the play button.

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.