update common embed location, move some back into their own files
This commit is contained in:
parent
f6eb3b2b69
commit
f2797e6c33
|
@ -31,6 +31,7 @@
|
||||||
"~flags": "./flags.ts",
|
"~flags": "./flags.ts",
|
||||||
"artigen/": "./src/artigen/",
|
"artigen/": "./src/artigen/",
|
||||||
"commands/": "./src/commands/",
|
"commands/": "./src/commands/",
|
||||||
|
"embeds/": "./src/embeds/",
|
||||||
"endpoints/": "./src/endpoints/",
|
"endpoints/": "./src/endpoints/",
|
||||||
"db/": "./src/db/",
|
"db/": "./src/db/",
|
||||||
"src/": "./src/"
|
"src/": "./src/"
|
||||||
|
|
3
mod.ts
3
mod.ts
|
@ -14,8 +14,9 @@ import commands from 'commands/_index.ts';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { ignoreList } from 'db/common.ts';
|
import { ignoreList } from 'db/common.ts';
|
||||||
|
|
||||||
|
import { successColor, warnColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import api from 'src/api.ts';
|
import api from 'src/api.ts';
|
||||||
import { successColor, warnColor } from 'src/commandUtils.ts';
|
|
||||||
import intervals from 'src/intervals.ts';
|
import intervals from 'src/intervals.ts';
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,10 @@ import { loggingEnabled } from 'artigen/utils/logFlag.ts';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
|
import { generateCountDetailsEmbed, generateDMFailed, generateRollEmbed } from 'embeds/artigen.ts';
|
||||||
|
|
||||||
import stdResp from 'endpoints/stdResponses.ts';
|
import stdResp from 'endpoints/stdResponses.ts';
|
||||||
|
|
||||||
import { generateCountDetailsEmbed, generateDMFailed, generateRollEmbed } from 'src/commandUtils.ts';
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const onWorkerComplete = async (workerMessage: MessageEvent<SolvedRoll>, workerTimeout: number, rollRequest: QueuedRoll) => {
|
export const onWorkerComplete = async (workerMessage: MessageEvent<SolvedRoll>, workerTimeout: number, rollRequest: QueuedRoll) => {
|
||||||
|
|
|
@ -5,9 +5,10 @@ import { RollModifiers } from 'artigen/dice/dice.d.ts';
|
||||||
import { removeWorker } from 'artigen/managers/countManager.ts';
|
import { removeWorker } from 'artigen/managers/countManager.ts';
|
||||||
import { QueuedRoll } from 'artigen/managers/manager.d.ts';
|
import { QueuedRoll } from 'artigen/managers/manager.d.ts';
|
||||||
|
|
||||||
|
import { generateRollEmbed } from 'embeds/artigen.ts';
|
||||||
|
|
||||||
import stdResp from 'endpoints/stdResponses.ts';
|
import stdResp from 'endpoints/stdResponses.ts';
|
||||||
|
|
||||||
import { generateRollEmbed } from 'src/commandUtils.ts';
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const terminateWorker = async (rollWorker: Worker, rollRequest: QueuedRoll) => {
|
export const terminateWorker = async (rollWorker: Worker, rollRequest: QueuedRoll) => {
|
||||||
|
|
|
@ -6,7 +6,9 @@ import { getWorkerCnt } from 'artigen/managers/countManager.ts';
|
||||||
import { QueuedRoll } from 'artigen/managers/manager.d.ts';
|
import { QueuedRoll } from 'artigen/managers/manager.d.ts';
|
||||||
import { handleRollRequest } from 'artigen/managers/workerManager.ts';
|
import { handleRollRequest } from 'artigen/managers/workerManager.ts';
|
||||||
|
|
||||||
import { infoColor2, rollingEmbed } from 'src/commandUtils.ts';
|
import { rollingEmbed } from 'embeds/artigen.ts';
|
||||||
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
const rollQueue: Array<QueuedRoll> = [];
|
const rollQueue: Array<QueuedRoll> = [];
|
||||||
|
|
|
@ -7,7 +7,8 @@ import apiCommands from 'commands/apiCmd/_index.ts';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor } from 'src/commandUtils.ts';
|
import { failColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const api = async (message: DiscordenoMessage, args: string[]) => {
|
export const api = async (message: DiscordenoMessage, args: string[]) => {
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { DiscordenoMessage } from '@discordeno';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
|
|
||||||
import { generateApiFailed, generateApiSuccess } from 'src/commandUtils.ts';
|
import { generateApiFailed, generateApiSuccess } from 'embeds/api.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const allowBlock = async (message: DiscordenoMessage, apiArg: string) => {
|
export const allowBlock = async (message: DiscordenoMessage, apiArg: string) => {
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { DiscordenoMessage } from '@discordeno';
|
||||||
|
|
||||||
import config from '~config';
|
import config from '~config';
|
||||||
|
|
||||||
import { infoColor1, infoColor2 } from 'src/commandUtils.ts';
|
import { infoColor1, infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const help = (message: DiscordenoMessage) => {
|
export const help = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -4,7 +4,8 @@ import config from '~config';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
|
|
||||||
import { failColor, successColor } from 'src/commandUtils.ts';
|
import { failColor, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const deleteGuild = async (message: DiscordenoMessage) => {
|
export const deleteGuild = async (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { DiscordenoMessage } from '@discordeno';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
|
|
||||||
import { generateApiFailed, generateApiSuccess } from 'src/commandUtils.ts';
|
import { generateApiFailed, generateApiSuccess } from 'embeds/api.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const showHideWarn = async (message: DiscordenoMessage, apiArg: string) => {
|
export const showHideWarn = async (message: DiscordenoMessage, apiArg: string) => {
|
||||||
|
|
|
@ -2,7 +2,9 @@ import { DiscordenoMessage } from '@discordeno';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
|
|
||||||
import { failColor, generateApiStatus } from 'src/commandUtils.ts';
|
import { generateApiStatus } from 'embeds/api.ts';
|
||||||
|
import { failColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const status = async (message: DiscordenoMessage) => {
|
export const status = async (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -7,7 +7,8 @@ import auditCommands from 'commands/auditCmd/_index.ts';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor } from 'src/commandUtils.ts';
|
import { failColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const audit = (message: DiscordenoMessage, args: string[]) => {
|
export const audit = (message: DiscordenoMessage, args: string[]) => {
|
||||||
|
|
|
@ -2,8 +2,9 @@ import { DiscordenoMessage, EmbedField } from '@discordeno';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
|
|
||||||
import { compilingStats } from 'src/commonEmbeds.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
import { infoColor2 } from 'src/commandUtils.ts';
|
import { compilingStats } from 'embeds/common.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
interface DBSizeData {
|
interface DBSizeData {
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { cache, cacheHandlers, DiscordenoGuild, DiscordenoMessage } from '@disco
|
||||||
|
|
||||||
import config from '~config';
|
import config from '~config';
|
||||||
|
|
||||||
import { infoColor2 } from 'src/commandUtils.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
const sortGuildByMemberCount = (a: DiscordenoGuild, b: DiscordenoGuild) => {
|
const sortGuildByMemberCount = (a: DiscordenoGuild, b: DiscordenoGuild) => {
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { DiscordenoMessage } from '@discordeno';
|
||||||
|
|
||||||
import config from '~config';
|
import config from '~config';
|
||||||
|
|
||||||
import { infoColor1 } from 'src/commandUtils.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const auditHelp = (message: DiscordenoMessage) => {
|
export const auditHelp = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -6,7 +6,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1 } from 'src/commandUtils.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const handleMentions = (message: DiscordenoMessage) => {
|
export const handleMentions = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor, infoColor2 } from 'src/commandUtils.ts';
|
import { failColor, infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import intervals from 'src/intervals.ts';
|
import intervals from 'src/intervals.ts';
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'src/commandUtils.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const help = (message: DiscordenoMessage) => {
|
export const help = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'src/commandUtils.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const info = (message: DiscordenoMessage) => {
|
export const info = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { ignoreList, queries } from 'db/common.ts';
|
import { ignoreList, queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor, successColor } from 'src/commandUtils.ts';
|
import { failColor, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const optIn = async (message: DiscordenoMessage) => {
|
export const optIn = async (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { ignoreList, queries } from 'db/common.ts';
|
import { ignoreList, queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor, successColor } from 'src/commandUtils.ts';
|
import { failColor, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const optOut = async (message: DiscordenoMessage) => {
|
export const optOut = async (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -3,9 +3,19 @@ import { DiscordenoMessage } from '@discordeno';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { generatePing } from 'src/commandUtils.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
|
const generatePing = (time: number) => ({
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
color: infoColor1,
|
||||||
|
title: time === -1 ? 'Ping?' : `Pong! Latency is ${time}ms.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
export const ping = async (message: DiscordenoMessage) => {
|
export const ping = async (message: DiscordenoMessage) => {
|
||||||
// Light telemetry to see how many times a command is being run
|
// Light telemetry to see how many times a command is being run
|
||||||
dbClient.execute(queries.callIncCnt('ping')).catch((e) => utils.commonLoggers.dbError('ping.ts:14', 'call sproc INC_CNT on', e));
|
dbClient.execute(queries.callIncCnt('ping')).catch((e) => utils.commonLoggers.dbError('ping.ts:14', 'call sproc INC_CNT on', e));
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1 } from 'src/commandUtils.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const privacy = (message: DiscordenoMessage) => {
|
export const privacy = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor, generateReport, successColor } from 'src/commandUtils.ts';
|
import { failColor, infoColor2, successColor } from 'embeds/colors.ts';
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const report = (message: DiscordenoMessage, args: string[]) => {
|
export const report = (message: DiscordenoMessage, args: string[]) => {
|
||||||
|
@ -13,7 +13,15 @@ export const report = (message: DiscordenoMessage, args: string[]) => {
|
||||||
dbClient.execute(queries.callIncCnt('report')).catch((e) => utils.commonLoggers.dbError('report.ts:17', 'call sproc INC_CNT on', e));
|
dbClient.execute(queries.callIncCnt('report')).catch((e) => utils.commonLoggers.dbError('report.ts:17', 'call sproc INC_CNT on', e));
|
||||||
|
|
||||||
if (args.join(' ')) {
|
if (args.join(' ')) {
|
||||||
sendMessage(config.reportChannel, generateReport(args.join(' '))).catch((e: Error) => utils.commonLoggers.messageSendError('report.ts:22', message, e));
|
sendMessage(config.reportChannel, {
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
color: infoColor2,
|
||||||
|
title: 'USER REPORT:',
|
||||||
|
description: args.join(' ') || 'No message',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}).catch((e: Error) => utils.commonLoggers.messageSendError('report.ts:22', message, e));
|
||||||
message
|
message
|
||||||
.send({
|
.send({
|
||||||
embeds: [
|
embeds: [
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'src/commandUtils.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const rip = (message: DiscordenoMessage) => {
|
export const rip = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -11,7 +11,9 @@ import { sendRollRequest } from 'artigen/managers/queueManager.ts';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { generateRollError, rollingEmbed, warnColor } from 'src/commandUtils.ts';
|
import { generateRollError, rollingEmbed } from 'embeds/artigen.ts';
|
||||||
|
import { warnColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const roll = async (message: DiscordenoMessage, args: string[], command: string) => {
|
export const roll = async (message: DiscordenoMessage, args: string[], command: string) => {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'src/commandUtils.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const rollDecorators = (message: DiscordenoMessage) => {
|
export const rollDecorators = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1, infoColor2, successColor } from 'src/commandUtils.ts';
|
import { infoColor1, infoColor2, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const rollHelp = (message: DiscordenoMessage) => {
|
export const rollHelp = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import { cache, cacheHandlers, DiscordenoMessage } from '@discordeno';
|
import { cache, cacheHandlers, DiscordenoMessage } from '@discordeno';
|
||||||
|
|
||||||
|
import config from '~config';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { compilingStats } from 'src/commonEmbeds.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
import { generateStats } from 'src/commandUtils.ts';
|
import { compilingStats } from 'embeds/common.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const stats = async (message: DiscordenoMessage) => {
|
export const stats = async (message: DiscordenoMessage) => {
|
||||||
|
@ -33,18 +36,45 @@ export const stats = async (message: DiscordenoMessage) => {
|
||||||
|
|
||||||
const endTime = new Date().getTime();
|
const endTime = new Date().getTime();
|
||||||
|
|
||||||
m.edit(
|
m.edit({
|
||||||
generateStats(
|
embeds: [
|
||||||
cachedGuilds + cache.dispatchedGuildIds.size,
|
{
|
||||||
cachedChannels + cache.dispatchedChannelIds.size,
|
color: infoColor2,
|
||||||
cachedMembers,
|
title: `${config.name}'s Statistics:`,
|
||||||
rolls,
|
timestamp: new Date().toISOString(),
|
||||||
total - rolls,
|
fields: [
|
||||||
rollRate,
|
{
|
||||||
totalRate - rollRate,
|
name: 'Guilds:',
|
||||||
endTime - startTime,
|
value: `${(cachedGuilds + cache.dispatchedGuildIds.size).toLocaleString()}`,
|
||||||
),
|
inline: true,
|
||||||
).catch((e: Error) => utils.commonLoggers.messageEditError('stats.ts:38', m, e));
|
},
|
||||||
|
{
|
||||||
|
name: 'Channels:',
|
||||||
|
value: `${(cachedChannels + cache.dispatchedChannelIds.size).toLocaleString()}`,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Active Members:',
|
||||||
|
value: `${cachedMembers.toLocaleString()}`,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Roll Commands:',
|
||||||
|
value: `${rolls.toLocaleString()}\n(${Math.abs(rollRate).toFixed(2)} per hour)`,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Utility Commands:',
|
||||||
|
value: `${(total - rolls).toLocaleString()}\n(${Math.abs(totalRate - rollRate).toFixed(2)} per hour)`,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
footer: {
|
||||||
|
text: `Total query time: ${endTime - startTime}ms`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}).catch((e: Error) => utils.commonLoggers.messageEditError('stats.ts:38', m, e));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
utils.commonLoggers.messageSendError('stats.ts:41', message, e as Error);
|
utils.commonLoggers.messageSendError('stats.ts:41', message, e as Error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1 } from 'src/commandUtils.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const version = (message: DiscordenoMessage) => {
|
export const version = (message: DiscordenoMessage) => {
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
import config from '../../config.example.ts';
|
||||||
|
import { failColor, infoColor1, successColor } from 'src/embeds/colors.ts';
|
||||||
|
|
||||||
|
export const generateApiFailed = (args: string) => ({
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
color: failColor,
|
||||||
|
title: `Failed to ${args} API rolls for this guild.`,
|
||||||
|
description: 'If this issue persists, please report this to the developers.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
export const generateApiStatus = (banned: boolean, active: boolean) => {
|
||||||
|
const apiStatus = active ? 'allowed' : 'blocked from being used';
|
||||||
|
return {
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
color: infoColor1,
|
||||||
|
title: `${config.name}'s API is ${config.api.enable ? 'currently enabled' : 'currently disabled'}.`,
|
||||||
|
description: banned ? 'API rolls are banned from being used in this guild.\n\nThis will not be reversed.' : `API rolls are ${apiStatus} in this guild.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const generateApiSuccess = (args: string) => ({
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
color: successColor,
|
||||||
|
title: `API rolls have successfully been ${args} for this guild.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
export const generateApiKeyEmail = (email: string, key: string) => ({
|
||||||
|
content: `<@${config.api.admin}> A USER HAS REQUESTED AN API KEY`,
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
color: infoColor1,
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
name: 'Send to:',
|
||||||
|
value: email,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Subject:',
|
||||||
|
value: `${config.name} API Key`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Body:',
|
||||||
|
value: `Hello ${config.name} API User,
|
||||||
|
|
||||||
|
Welcome aboard ${config.name}'s API. You can find full details about the API on the GitHub: ${config.links.sourceCode}
|
||||||
|
|
||||||
|
Your API Key is: ${key}
|
||||||
|
|
||||||
|
Guard this well, as there is zero tolerance for API abuse.
|
||||||
|
|
||||||
|
Welcome aboard,
|
||||||
|
${config.name} Developer - Ean Milligan`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
export const generateApiDeleteEmail = (email: string, deleteCode: string) => ({
|
||||||
|
content: `<@${config.api.admin}> A USER HAS REQUESTED A DELETE CODE`,
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
color: infoColor1,
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
name: 'Send to:',
|
||||||
|
value: email,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Subject:',
|
||||||
|
value: `${config.name} API Delete Code`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Body:',
|
||||||
|
value: `Hello ${config.name} API User,
|
||||||
|
|
||||||
|
I am sorry to see you go. If you would like, please respond to this email detailing what I could have done better.
|
||||||
|
|
||||||
|
As requested, here is your delete code: ${deleteCode}
|
||||||
|
|
||||||
|
Sorry to see you go,
|
||||||
|
${config.name} Developer - Ean Milligan`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
|
@ -7,12 +7,7 @@ import { SolvedRoll } from 'artigen/artigen.d.ts';
|
||||||
import { CountDetails, RollModifiers } from 'artigen/dice/dice.d.ts';
|
import { CountDetails, RollModifiers } from 'artigen/dice/dice.d.ts';
|
||||||
|
|
||||||
import { loggingEnabled } from 'artigen/utils/logFlag.ts';
|
import { loggingEnabled } from 'artigen/utils/logFlag.ts';
|
||||||
|
import { failColor, infoColor1, infoColor2 } from 'embeds/colors.ts';
|
||||||
export const failColor = 0xe71212;
|
|
||||||
export const warnColor = 0xe38f28;
|
|
||||||
export const successColor = 0x0f8108;
|
|
||||||
export const infoColor1 = 0x313bf9;
|
|
||||||
export const infoColor2 = 0x6805e9;
|
|
||||||
|
|
||||||
export const rollingEmbed = {
|
export const rollingEmbed = {
|
||||||
embeds: [
|
embeds: [
|
||||||
|
@ -23,106 +18,6 @@ export const rollingEmbed = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const generatePing = (time: number) => ({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor1,
|
|
||||||
title: time === -1 ? 'Ping?' : `Pong! Latency is ${time}ms.`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const generateReport = (msg: string) => ({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor2,
|
|
||||||
title: 'USER REPORT:',
|
|
||||||
description: msg || 'No message',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const generateStats = (
|
|
||||||
guildCount: number,
|
|
||||||
channelCount: number,
|
|
||||||
memberCount: number,
|
|
||||||
rollCount: bigint,
|
|
||||||
utilityCount: bigint,
|
|
||||||
rollRate: number,
|
|
||||||
utilityRate: number,
|
|
||||||
queryTimeMs: number,
|
|
||||||
) => ({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor2,
|
|
||||||
title: `${config.name}'s Statistics:`,
|
|
||||||
timestamp: new Date().toISOString(),
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'Guilds:',
|
|
||||||
value: `${guildCount.toLocaleString()}`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Channels:',
|
|
||||||
value: `${channelCount.toLocaleString()}`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Active Members:',
|
|
||||||
value: `${memberCount.toLocaleString()}`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Roll Commands:',
|
|
||||||
value: `${rollCount.toLocaleString()}\n(${Math.abs(rollRate).toFixed(2)} per hour)`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Utility Commands:',
|
|
||||||
value: `${utilityCount.toLocaleString()}\n(${Math.abs(utilityRate).toFixed(2)} per hour)`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
footer: {
|
|
||||||
text: `Total query time: ${queryTimeMs}ms`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const generateApiFailed = (args: string) => ({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: failColor,
|
|
||||||
title: `Failed to ${args} API rolls for this guild.`,
|
|
||||||
description: 'If this issue persists, please report this to the developers.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const generateApiStatus = (banned: boolean, active: boolean) => {
|
|
||||||
const apiStatus = active ? 'allowed' : 'blocked from being used';
|
|
||||||
return {
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor1,
|
|
||||||
title: `${config.name}'s API is ${config.api.enable ? 'currently enabled' : 'currently disabled'}.`,
|
|
||||||
description: banned ? 'API rolls are banned from being used in this guild.\n\nThis will not be reversed.' : `API rolls are ${apiStatus} in this guild.`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const generateApiSuccess = (args: string) => ({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: successColor,
|
|
||||||
title: `API rolls have successfully been ${args} for this guild.`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const generateDMFailed = (user: bigint) => ({
|
export const generateDMFailed = (user: bigint) => ({
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
|
@ -133,68 +28,6 @@ export const generateDMFailed = (user: bigint) => ({
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
export const generateApiKeyEmail = (email: string, key: string) => ({
|
|
||||||
content: `<@${config.api.admin}> A USER HAS REQUESTED AN API KEY`,
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor1,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'Send to:',
|
|
||||||
value: email,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Subject:',
|
|
||||||
value: `${config.name} API Key`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Body:',
|
|
||||||
value: `Hello ${config.name} API User,
|
|
||||||
|
|
||||||
Welcome aboard ${config.name}'s API. You can find full details about the API on the GitHub: ${config.links.sourceCode}
|
|
||||||
|
|
||||||
Your API Key is: ${key}
|
|
||||||
|
|
||||||
Guard this well, as there is zero tolerance for API abuse.
|
|
||||||
|
|
||||||
Welcome aboard,
|
|
||||||
${config.name} Developer - Ean Milligan`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const generateApiDeleteEmail = (email: string, deleteCode: string) => ({
|
|
||||||
content: `<@${config.api.admin}> A USER HAS REQUESTED A DELETE CODE`,
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor1,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'Send to:',
|
|
||||||
value: email,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Subject:',
|
|
||||||
value: `${config.name} API Delete Code`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Body:',
|
|
||||||
value: `Hello ${config.name} API User,
|
|
||||||
|
|
||||||
I am sorry to see you go. If you would like, please respond to this email detailing what I could have done better.
|
|
||||||
|
|
||||||
As requested, here is your delete code: ${deleteCode}
|
|
||||||
|
|
||||||
Sorry to see you go,
|
|
||||||
${config.name} Developer - Ean Milligan`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const generateRollError = (errorType: string, errorName: string, errorMsg: string) => ({
|
export const generateRollError = (errorType: string, errorName: string, errorMsg: string) => ({
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
|
@ -0,0 +1,5 @@
|
||||||
|
export const failColor = 0xe71212;
|
||||||
|
export const warnColor = 0xe38f28;
|
||||||
|
export const successColor = 0x0f8108;
|
||||||
|
export const infoColor1 = 0x313bf9;
|
||||||
|
export const infoColor2 = 0x6805e9;
|
|
@ -1,4 +1,4 @@
|
||||||
import { warnColor } from 'src/commandUtils.ts';
|
import { warnColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
export const compilingStats = {
|
export const compilingStats = {
|
||||||
embeds: [
|
embeds: [
|
|
@ -8,7 +8,8 @@ import dbClient from 'db/client.ts';
|
||||||
import stdResp from 'endpoints/stdResponses.ts';
|
import stdResp from 'endpoints/stdResponses.ts';
|
||||||
import { verifyQueryHasParams } from 'endpoints/utils.ts';
|
import { verifyQueryHasParams } from 'endpoints/utils.ts';
|
||||||
|
|
||||||
import { generateApiDeleteEmail } from 'src/commandUtils.ts';
|
import { generateApiDeleteEmail } from 'embeds/api.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const apiKeyDelete = async (query: Map<string, string>, apiUserid: bigint, apiUserEmail: string, apiUserDelCode: string): Promise<Response> => {
|
export const apiKeyDelete = async (query: Map<string, string>, apiUserid: bigint, apiUserEmail: string, apiUserDelCode: string): Promise<Response> => {
|
||||||
|
|
|
@ -8,7 +8,8 @@ import dbClient from 'db/client.ts';
|
||||||
import stdResp from 'endpoints/stdResponses.ts';
|
import stdResp from 'endpoints/stdResponses.ts';
|
||||||
import { verifyQueryHasParams } from 'endpoints/utils.ts';
|
import { verifyQueryHasParams } from 'endpoints/utils.ts';
|
||||||
|
|
||||||
import { generateApiKeyEmail } from 'src/commandUtils.ts';
|
import { generateApiKeyEmail } from 'embeds/api.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'src/utils.ts';
|
||||||
|
|
||||||
export const apiKey = async (query: Map<string, string>): Promise<Response> => {
|
export const apiKey = async (query: Map<string, string>): Promise<Response> => {
|
||||||
|
|
Loading…
Reference in New Issue