Giter Site home page Giter Site logo

discord-calculator-bot's Introduction

discord-calculator-bot

This is a discord bot that allows you to quickly calculate and graph math.

Come and test on Discord!: https://discord.gg/Y8XPcj2Q

Start the bot

export DISCORD_BOT_TOKEN="Your token"

python3 /home/alarm/calculator.py

Usage

calc

The calc command is used for quick maths with most Python math functions available and floats are handled as Decimals:

calc 0.1 + 0.2 # exact decimals
> 0.3
- calc 12**23 # large integers
> 6624737266949237011120128
calc 1 | 2 # bitwize operations
> 6624737266949237011120128
calc sqrt(abs(sin(pi*e))) # python's math functions
> 0.8797401237108087

>>

This is a basic python execution, but you do not have access to loops. Yet, you can execute all string operators and use map, reduce, filter functions.

>> "hello".upper()
> HELLO
>> list(map(ord, "hello"))
> [104, 101, 108, 108, 111]

graph

The graph command uses pyplot to graph one or multiple functions. The functions will be of the type: y = x where you only write the right side of it.

graph x
> graphs the function y = x
graph [x, -x]
> graphs the functions y = x and y = -x

Beautiful (truly) of a graph

conic

Graphs a 2D conic of type y**2 + x**2 = 1. Due to limitations, you have to move all arguments on one side to make it = 0.

conic x**2 + y**2 - 3**2
> makes a circle of radius 3 (x² + y² = 3²)
conic (x**2 + y**2 -1)**3 - x**2 * y**3
> Surprise!

*Overwhelming image of a circle

discord-calculator-bot's People

Contributors

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