Giter Site home page Giter Site logo

mewmix / thedasbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jjaxu/thedasbot

1.0 1.0 0.0 560 KB

The "Do All Stuff" bot is a Telegram bot capable of telling jokes, facts, trivia and fetching trends from using the Google Trends

Shell 0.17% Python 99.83%

thedasbot's Introduction

The "Do All Stuff" (DAS) Telegram Bot

The DAS bot is a webhook-based Telegram bot that is written in Python 3.7 and deployed on AWS Lambda. It is capable of telling jokes, sharing fun facts, hosting trivia sessions, and fetching insights from Google Trends.

Usage

Interact with the bot @thedasbot on Telegram. It supports both private and group chats.

Commands

Help

Pulls up the list of available commands.

Syntax: /help

Trivia

Gets a random, interactable multiple choice question from Open Trivia Database.

Syntax: /trivia [ <category> | any | help ] [ <difficulty> | any ]

  • /trivia help brings up the list of available categories and difficulties. Categories support fuzzy matching. All arguments default to any, which selects a random category/difficulty.

Examples

  • /trivia - Question from random category and difficulty

  • /trivia history - Question from the "History" category at random difficulty

  • /trivia anime easy - Easy question from the "Entertainment: Japanese Anime & Manga" category

  • /trivia any hard - Hard question from a random category

Trends

Fetches insights from Google Trends. Features the ability to graph trends by keyword and list top / trending keywords by year / region. All communication is handled using pytrends.

Syntax: /trends <mode> [arguments]

  • mode is one of { help, graph, top, trending }
    • help - Brings up the syntax help text.
    • graph - Plots the trends of the given search terms for a specified time period and generates a graph. arguments is a list of up to 5 search terms to compare, followed by the optional argument [ --time <time> ] or [-t <time>] to specify a time range. time is in the format <number>< d | w | m | y > (See examples).
    • top - Gets the top searches for a given year. arguments is an optional argument to indicate the year (Default previous year).
    • trending - Gets the current trending searches for a specific country (Default US).

Examples

  • /trends graph BMO "Bank of America" RBC - Graphs the search trends of "BMO", "Bank of America" and "RBC" on the same plot for the past year.
  • /trends graph Honda Toyota --time 6w - Graphs the search trends of "Honda" and "Toyota" on the same plot in the past 6 weeks.
  • /trends graph GitHub -t 4m - Graphs the search trends of "GitHub" in the past 4 months.
  • /trends top - If the current year is 2020, then it gets the top searches for 2019.
  • /trends top 2012 - Lists the top searches for 2012.
  • /trends trending - Lists the real-time trending searches in the US (default region).
  • /trends trending canada - Lists the real-time trending searches in the Canada.
  • /trends trending "new zealand" - Lists the real-time trending searches in New Zealand.

Joke

Fetches a random joke from icanhazdadjoke.

Syntax: /joke

Fact

Fetches a random fun fact from Mental Floss.

Syntax: /fact

Contributing

New features and improvements are always welcome! Commands should inherit the BotCommand class, override the execute method, and be placed inside the commands/ directory. Also, the command must be added to the AVAILABLE_COMMANDS constant in command_parser.py to be recognized by the parser.

Local Testing

To test the project locally:

  1. Clone the repo
  2. Setup bottle and ngrok
  3. Run test/pytest in the root directory to check the unit tests
  4. Setup the local environment using the following guide
  5. Launch ngrok and update the webhook to the project
  6. In the root directory, run install_local followed by python3 local.py
  7. Start chatting with the bot! All data will be logged to the console

thedasbot's People

Contributors

jjaxu avatar george-lim avatar

Stargazers

 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.