1.0.5 • Published 4 years ago

discord-math v1.0.5

Weekly downloads
176
License
ISC
Repository
-
Last release
4 years ago

Discord-Math

Discord-Math is a simple calculator for discord.js bots! It can both do math in commands, as well as to the console. This package is mainly used for discord.js math command in your bot!

Installing

Run npm i discord-math in a terminal!

Usage

Keep in mind that it can currently can only do 4 operations: +, -, *, /, **

Setup:

const math = require('discord-math');
 
module.exports = {
    name: "calculate",
    description: "The bot does math for you",
    run: async (client, message, args) => {
        try {
            let num1 = Number(args[0]);
            let operation = args[1];
            let num2 = Number(args[2]);
            
            if (!num1) return message.channel.send('Num1 needs to be specified!');
            if (!operation) return message.channel.send('An operation was not specified!');
            if (!num2) return message.channel.send('Num2 needs to be specified!');
 
            message.channel.send(`Answer: ${math.calculate(num1, operation, num2)}`);
        } catch (e) {
            console.log(e);
        }
    }
}
1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago