1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-26 11:45:37 -05:00

Allow power operator to regex

This commit is contained in:
toast-ts 2024-11-29 10:41:48 +11:00
parent 32d5dc27e0
commit e188c54b67

View File

@ -7,7 +7,7 @@ import * as math from 'mathjs';// I hate this, but it doesn't provide a default
export default class Calculator { export default class Calculator {
static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
const now = Date.now(); const now = Date.now();
const exp = interaction.options.getString('expression', true).replace(/[^-()\d/*+.]/g, ''); const exp = interaction.options.getString('expression', true).replace(/[^-()\d/*+.^]/g, '');
try { try {
let result:math.EvalFunction; let result:math.EvalFunction;
switch (exp) { switch (exp) {