revolt-bot/commands/evaloff.js

30 lines
991 B
JavaScript

const Revolt = require('revolt.js');
const { client, logger, config } = require('..');
const { OTP, evalEnabled, OTPTimer } = require('./eval');
module.exports.meta = {
name: 'evaloff',
aliases: [],
description: 'Disable eval functionality.',
devLevel: 99
}
/**
*
* @param { Revolt.Message } message
* @param { string[] } args
*/
module.exports.run = async (message, args) => new Promise(async (resolve, reject) => {
if (OTPTimer[message.author]) clearTimeout(OTPTimer[message.author]);
if (evalEnabled[message.author]) {
evalEnabled[message.author] = null;
OTP[message.author] = null;
return client.channels.sendMessage(message.channel, 'Access has been revoked.');
}
if (OTP[message.author]) {
OTP[message.author] = null;
return client.channels.sendMessage(message.channel, 'Existing OTP has been invalidated.');
}
return client.channels.sendMessage(message.channel, 'You were not authenticated.');
});