Skip to main content

calculator

An Unique calculator which can be used inside Discord

Implementation

simplydjs.calculator(interaction, {
// options (optional)
})

Output

calculator

Types

simplydjs.calculator(
msgOrInt: ExtendedMessage | ExtendedInteraction,
options: calculatorOptions
): Promise<void>

Options

calculatorOptions

ParameterTypeRequiredDefaultDescription
strictbooleanfalseEnables strict mode in calculator
embedCustomizableEmbeddefault embedPass a CustomizableEmbed Object to customize the embed
buttonsCalculatorButtonsdefault buttonsPass a CalculatorButtons Object to customize the button
export type calculatorOptions = {
embed?: CustomizableEmbed;
buttons?: CalculatorButtons;
strict?: boolean;
};

CalculatorButtons

ParameterTypeDescription
numbersExtendedButtonStyleThe style of the button which has numbers in it
symbolsExtendedButtonStyleThe style of the button which has symbols in it
deleteExtendedButtonStyleThe style of the button which deletes the calculator
export interface CalculatorButtons {
numbers?: ExtendedButtonStyle;
symbols?: ExtendedButtonStyle;
delete?: ExtendedButtonStyle;
}

Example

  • Default settings

calculator.js
const simplydjs = require('simply-djs')

simplydjs.calculator(interaction)
  • Customized with options

calculator.js
const simplydjs = require('simply-djs')

simplydjs.calculator(interaction, {
strict: true,
embed: {
title: "Calculator",
color: simplydjs.toRgb("#406dbc")
},
buttons: {
numbers: ButtonStyle.Secondary,
symbols: ButtonStyle.Primary,
delete: ButtonStyle.Danger
}
})