Giter Club home page Giter Club logo

math-genie's Introduction

Math Genie :octocat:

Simple slack slash command for solving math problems

Features πŸ”₯

  • Based on Wolfram|Alpha APIs
  • Simple to use
  • Python3 support
  • Can reply to any math problems

Requirements βš’οΈ

Installation πŸ”§

git clone https://github.com/TopKeingt/Math-Genie

or click here to download respository's zip file.

python -m pip install -r requirements.txt

Prerequisite πŸ”¨

Generate The Wolfram App Id

You need to create a wolfram app id (the core of the program to work)

  1. Create a wolfram alpha account or sign in here
  2. Create an App Id here (only when you signed in)
    1. Click Get an AppID and enter your Application Name and Description screenshot-1
    2. Copy the APPID and paste to WOLFRAM_APP_ID in config.ini screenshot-3

Generate The Slack Api Token

Because the program will run on Slack so you need to get slack api token to able to communicate.

What is Slack ? πŸ“

Slack is a collaboration hub for work, no matter what work you do. It’s a place where conversations happen, decisions are made, and information is always at your fingertips. With Slack, your team is better connected.

  1. Go to api.slack.com

  2. Create a new Slack Applications or use your old Slack App (this project only add one slash command to your bot).

  3. Copy Vertification Token and paste to SLACK_VERTIFICATION_TOKEN in config.ini screenshot-4

  4. Go to Slash Commands

    1. Click Create New Command and fill out the form then save. screenshot-7
  5. Go to OAuth & Permissions

    1. Select Send messages as [app's name] under Scopes and click Save Changes

    screenshot-5

    1. Click Install App to Workspace on the very top of the page and authorize your app to communicate with your slack's workspace.
    2. When successfully authorized, it will redirected back to your app page. Copy OAuth Access Token and paste to SLACK_BOT_TOKEN in config.ini.

    screenshot-6

Usage 🍽️

Now you will able to run the program with python

❗ Any missing value in config.ini will break the program. Please follow the instruction above to fill out the configuration.

The example of what config.ini should look like: code How to run ?

$ python main.py --help
usage: main.py [-h] [-p] [-d]

Run the program in [mode]

optional arguments:
  -h, --help         show this help message and exit
  -p, --production   Run the program in production mode
  -d, --development  Run the program in development mode

example:

$ python main.py --development
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 232-100-363
 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)

Notice ❗

since slack's app doesn't allow slash commands to use local url like http://127.0.0.1:3000 as Request Url please use ngrok to generate public url.

Example Usage

$ ngrok http 5000
ngrok by @inconshreveable                                                                               (Ctrl+C to quit)

Session Status                online
Account                       TopKeingt (Plan: Free)
Version                       2.2.8
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://30081a1a.ngrok.io -> localhost:3000
Forwarding                    https://30081a1a.ngrok.io -> localhost:3000

Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

and use http://[ngrok's id].ngrok.io as Request Url

Pull requests are welcome πŸ”Ž

Video demonstration coming soon

math-genie's People

Contributors

ntdkhiem avatar

Stargazers

 avatar  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.