Code Monkey home page Code Monkey logo

telegrambot's Introduction

Bot for Yo-Mama Jokes

Introduction

This bot shares Yo-Mama jokes, inspired by this tutorial.

Requirements

  • Python 3.0
  • Ensure pip is installed (pip --version)
  • Install virtual environment: pip install virtualenv
  • Telegram messenger (or web version at web.telegram.org)

Setup Steps

Step 0: Clone the Repository

git clone https://github.com/hrushikesh009/TelegramBot.git

Step 1: Install Dependencies

pip install -r requirements.txt

Step 2: Database Setup

Utilized MySQL Database in this tutorial. Modify settings in Telegram_Bot.settings:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'Your Database Name',
        'HOST': 'localhost',
        'USER': 'Database Username',
        'PASSWORD': 'Database Password',
        'PORT': 'Database Port'
    }
}

Refer to this link for PostgreSQL setup.

Step 3: Run Migrations

python manage.py makemigrations
python manage.py migrate

Step 4: Start the Local Server

python manage.py runserver

Step 5: Download and Use Ngrok

For HTTPS URL during development, use ngrok:

ngrok http 8000

Add the URLs to ALLOWED_HOSTS in Telegram_Bot.settings.

Step 6: Set Your Bot Token

Talk to BotFather on Telegram (/newbot command) to create a bot and get a token. Copy and paste the token in FunBot/views.py.

Step 7: Set Webhook

Run the following command or use services like Postman:

curl -F “url=<ngrok_url>/chat/c817304a3d163ebd58b44dd446eba29572300724098cdbca1a/“ https://api.telegram.org/bot<bot_token>/setWebhook

Step 8: Talk to the Bot

Initiate a conversation and receive responses from the bot.

Step 9: Capture the ClickStream

Visit <ngrok_url>/chat/home/ to view user interactions and data captured in the database.

telegrambot's People

Contributors

hrushikesh009 avatar

Watchers

 avatar

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.