deno fmt + rework api subcommands to be a switch statement
This commit is contained in:
parent
7cf62d44aa
commit
6cfe98e954
|
@ -3,8 +3,8 @@ import {
|
|||
// Discordeno deps
|
||||
DiscordenoMessage,
|
||||
hasGuildPermissions,
|
||||
log,
|
||||
// Log4Deno deps
|
||||
log,
|
||||
LT,
|
||||
} from '../../deps.ts';
|
||||
import apiCommands from './apiCmd/_index.ts';
|
||||
|
@ -34,26 +34,39 @@ export const api = async (message: DiscordenoMessage, args: string[]) => {
|
|||
|
||||
// Makes sure the user is authenticated to run the API command
|
||||
if (await hasGuildPermissions(message.authorId, message.guildId, ['ADMINISTRATOR'])) {
|
||||
switch (apiArg) {
|
||||
case 'help':
|
||||
case 'h':
|
||||
// [[api help
|
||||
// Shows API help details
|
||||
if (apiArg === 'help' || apiArg === 'h') {
|
||||
apiCommands.help(message);
|
||||
} // [[api allow/block
|
||||
break;
|
||||
case 'allow':
|
||||
case 'block':
|
||||
case 'enable':
|
||||
case 'disable':
|
||||
// [[api allow/block
|
||||
// Lets a guild admin allow or ban API rolls from happening in said guild
|
||||
else if (apiArg === 'allow' || apiArg === 'block' || apiArg === 'enable' || apiArg === 'disable') {
|
||||
apiCommands.allowBlock(message, apiArg);
|
||||
} // [[api delete
|
||||
break;
|
||||
case 'delete':
|
||||
// [[api delete
|
||||
// Lets a guild admin delete their server from the database
|
||||
else if (apiArg === 'delete') {
|
||||
apiCommands.deleteGuild(message);
|
||||
} // [[api status
|
||||
break;
|
||||
case 'status':
|
||||
// [[api status
|
||||
// Lets a guild admin check the status of API rolling in said guild
|
||||
else if (apiArg === 'status') {
|
||||
apiCommands.status(message);
|
||||
} // [[api show-warn/hide-warn
|
||||
break;
|
||||
case 'show-warn':
|
||||
case 'hide-warn':
|
||||
// [[api show-warn/hide-warn
|
||||
// Lets a guild admin decide if the API warning should be shown on messages from the API
|
||||
else if (apiArg === 'show-warn' || apiArg === 'hide-warn') {
|
||||
apiCommands.showHideWarn(message, apiArg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
message.send({
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
LT,
|
||||
sendMessage,
|
||||
} from '../../deps.ts';
|
||||
import { successColor, failColor, generateReport } from '../commandUtils.ts';
|
||||
import { failColor, generateReport, successColor } from '../commandUtils.ts';
|
||||
|
||||
export const report = (message: DiscordenoMessage, args: string[]) => {
|
||||
// Light telemetry to see how many times a command is being run
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
} from '../../deps.ts';
|
||||
import solver from '../solver/_index.ts';
|
||||
import { SolvedRoll } from '../solver/solver.d.ts';
|
||||
import { warnColor, infoColor1, generateCountDetailsEmbed, generateDMFailed, generateRollEmbed } from '../commandUtils.ts';
|
||||
import { generateCountDetailsEmbed, generateDMFailed, generateRollEmbed, infoColor1, warnColor } from '../commandUtils.ts';
|
||||
import rollFuncs from './roll/_index.ts';
|
||||
|
||||
export const roll = async (message: DiscordenoMessage, args: string[], command: string) => {
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
// Log4Deno deps
|
||||
LT,
|
||||
} from '../../deps.ts';
|
||||
import { warnColor, generateStats } from '../commandUtils.ts';
|
||||
import { generateStats, warnColor } from '../commandUtils.ts';
|
||||
|
||||
export const stats = async (message: DiscordenoMessage) => {
|
||||
// Light telemetry to see how many times a command is being run
|
||||
|
|
Loading…
Reference in New Issue