move utils around
This commit is contained in:
parent
3e6844ed10
commit
9a5574f91e
|
@ -31,9 +31,10 @@
|
||||||
"~flags": "./flags.ts",
|
"~flags": "./flags.ts",
|
||||||
"artigen/": "./src/artigen/",
|
"artigen/": "./src/artigen/",
|
||||||
"commands/": "./src/commands/",
|
"commands/": "./src/commands/",
|
||||||
|
"db/": "./src/db/",
|
||||||
"embeds/": "./src/embeds/",
|
"embeds/": "./src/embeds/",
|
||||||
"endpoints/": "./src/endpoints/",
|
"endpoints/": "./src/endpoints/",
|
||||||
"db/": "./src/db/",
|
"utils/": "./src/utils/",
|
||||||
"src/": "./src/"
|
"src/api.ts": "./src/api.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
22
mod.ts
22
mod.ts
|
@ -3,7 +3,18 @@
|
||||||
*
|
*
|
||||||
* December 21, 2020
|
* December 21, 2020
|
||||||
*/
|
*/
|
||||||
import { botId, cache, DiscordActivityTypes, DiscordenoGuild, DiscordenoMessage, editBotNickname, editBotStatus, Intents, sendMessage, startBot } from '@discordeno';
|
import {
|
||||||
|
botId,
|
||||||
|
cache,
|
||||||
|
DiscordActivityTypes,
|
||||||
|
DiscordenoGuild,
|
||||||
|
DiscordenoMessage,
|
||||||
|
editBotNickname,
|
||||||
|
editBotStatus,
|
||||||
|
Intents,
|
||||||
|
sendMessage,
|
||||||
|
startBot,
|
||||||
|
} from '@discordeno';
|
||||||
import { initLog, log, LogTypes as LT } from '@Log4Deno';
|
import { initLog, log, LogTypes as LT } from '@Log4Deno';
|
||||||
|
|
||||||
import config from '~config';
|
import config from '~config';
|
||||||
|
@ -17,8 +28,9 @@ import { ignoreList } from 'db/common.ts';
|
||||||
import { successColor, warnColor } from 'embeds/colors.ts';
|
import { successColor, warnColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import api from 'src/api.ts';
|
import api from 'src/api.ts';
|
||||||
import intervals from 'src/intervals.ts';
|
|
||||||
import utils from 'src/utils.ts';
|
import intervals from 'utils/intervals.ts';
|
||||||
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
// Extend the BigInt prototype to support JSON.stringify
|
// Extend the BigInt prototype to support JSON.stringify
|
||||||
interface BigIntX extends BigInt {
|
interface BigIntX extends BigInt {
|
||||||
|
@ -71,7 +83,9 @@ startBot({
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
// Interval to update bot list stats every 24 hours
|
// Interval to update bot list stats every 24 hours
|
||||||
LOCALMODE ? log(LT.INFO, 'updateListStatistics not running') : setInterval(() => {
|
LOCALMODE
|
||||||
|
? log(LT.INFO, 'updateListStatistics not running')
|
||||||
|
: setInterval(() => {
|
||||||
log(LT.LOG, 'Updating all bot lists statistics');
|
log(LT.LOG, 'Updating all bot lists statistics');
|
||||||
intervals.updateListStatistics(botId, cache.guilds.size + cache.dispatchedGuildIds.size);
|
intervals.updateListStatistics(botId, cache.guilds.size + cache.dispatchedGuildIds.size);
|
||||||
}, 86400000);
|
}, 86400000);
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { generateCountDetailsEmbed, generateDMFailed, generateRollEmbed } from '
|
||||||
|
|
||||||
import stdResp from 'endpoints/stdResponses.ts';
|
import stdResp from 'endpoints/stdResponses.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const onWorkerComplete = async (workerMessage: MessageEvent<SolvedRoll>, workerTimeout: number, rollRequest: QueuedRoll) => {
|
export const onWorkerComplete = async (workerMessage: MessageEvent<SolvedRoll>, workerTimeout: number, rollRequest: QueuedRoll) => {
|
||||||
let apiErroredOut = false;
|
let apiErroredOut = false;
|
||||||
|
@ -32,7 +32,7 @@ export const onWorkerComplete = async (workerMessage: MessageEvent<SolvedRoll>,
|
||||||
const pubEmbedDetails = await generateRollEmbed(
|
const pubEmbedDetails = await generateRollEmbed(
|
||||||
rollRequest.apiRoll ? rollRequest.api.userId : rollRequest.dd.originalMessage.authorId,
|
rollRequest.apiRoll ? rollRequest.api.userId : rollRequest.dd.originalMessage.authorId,
|
||||||
returnMsg,
|
returnMsg,
|
||||||
rollRequest.modifiers,
|
rollRequest.modifiers
|
||||||
);
|
);
|
||||||
const gmEmbedDetails = await generateRollEmbed(rollRequest.apiRoll ? rollRequest.api.userId : rollRequest.dd.originalMessage.authorId, returnMsg, {
|
const gmEmbedDetails = await generateRollEmbed(rollRequest.apiRoll ? rollRequest.api.userId : rollRequest.dd.originalMessage.authorId, returnMsg, {
|
||||||
...rollRequest.modifiers,
|
...rollRequest.modifiers,
|
||||||
|
@ -148,9 +148,9 @@ export const onWorkerComplete = async (workerMessage: MessageEvent<SolvedRoll>,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
details: pubEmbedDetails,
|
details: pubEmbedDetails,
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { generateRollEmbed } from 'embeds/artigen.ts';
|
||||||
|
|
||||||
import stdResp from 'endpoints/stdResponses.ts';
|
import stdResp from 'endpoints/stdResponses.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const terminateWorker = async (rollWorker: Worker, rollRequest: QueuedRoll) => {
|
export const terminateWorker = async (rollWorker: Worker, rollRequest: QueuedRoll) => {
|
||||||
rollWorker.terminate();
|
rollWorker.terminate();
|
||||||
|
@ -29,7 +29,7 @@ export const terminateWorker = async (rollWorker: Worker, rollRequest: QueuedRol
|
||||||
errorCode: 'TooComplex',
|
errorCode: 'TooComplex',
|
||||||
errorMsg: 'Error: Roll took too long to process, try breaking roll down into simpler parts',
|
errorMsg: 'Error: Roll took too long to process, try breaking roll down into simpler parts',
|
||||||
},
|
},
|
||||||
<RollModifiers> {},
|
<RollModifiers>{}
|
||||||
)
|
)
|
||||||
).embed,
|
).embed,
|
||||||
],
|
],
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { handleRollRequest } from 'artigen/managers/workerManager.ts';
|
||||||
import { rollingEmbed } from 'embeds/artigen.ts';
|
import { rollingEmbed } from 'embeds/artigen.ts';
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
const rollQueue: Array<QueuedRoll> = [];
|
const rollQueue: Array<QueuedRoll> = [];
|
||||||
|
|
||||||
|
@ -41,7 +41,9 @@ The results for this roll will replace this message when it is done.`,
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
log(
|
log(
|
||||||
LT.LOG,
|
LT.LOG,
|
||||||
`Checking rollQueue for items, rollQueue length: ${rollQueue.length}, currentWorkers: ${getWorkerCnt()}, config.limits.maxWorkers: ${config.limits.maxWorkers}`,
|
`Checking rollQueue for items, rollQueue length: ${rollQueue.length}, currentWorkers: ${getWorkerCnt()}, config.limits.maxWorkers: ${
|
||||||
|
config.limits.maxWorkers
|
||||||
|
}`
|
||||||
);
|
);
|
||||||
if (rollQueue.length && getWorkerCnt() < config.limits.maxWorkers) {
|
if (rollQueue.length && getWorkerCnt() < config.limits.maxWorkers) {
|
||||||
const rollRequest = rollQueue.shift();
|
const rollRequest = rollQueue.shift();
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor } from 'embeds/colors.ts';
|
import { failColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const api = async (message: DiscordenoMessage, args: string[]) => {
|
export const api = async (message: DiscordenoMessage, args: string[]) => {
|
||||||
// Light telemetry to see how many times a command is being run
|
// Light telemetry to see how many times a command is being run
|
||||||
|
|
|
@ -4,7 +4,7 @@ import dbClient from 'db/client.ts';
|
||||||
|
|
||||||
import { generateApiFailed, generateApiSuccess } from 'embeds/api.ts';
|
import { generateApiFailed, generateApiSuccess } from 'embeds/api.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const allowBlock = async (message: DiscordenoMessage, apiArg: string) => {
|
export const allowBlock = async (message: DiscordenoMessage, apiArg: string) => {
|
||||||
let errorOutInitial = false;
|
let errorOutInitial = false;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import config from '~config';
|
||||||
|
|
||||||
import { infoColor1, infoColor2 } from 'embeds/colors.ts';
|
import { infoColor1, infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const help = (message: DiscordenoMessage) => {
|
export const help = (message: DiscordenoMessage) => {
|
||||||
message
|
message
|
||||||
|
@ -13,8 +13,7 @@ export const help = (message: DiscordenoMessage) => {
|
||||||
{
|
{
|
||||||
color: infoColor2,
|
color: infoColor2,
|
||||||
title: `${config.name}'s API Details:`,
|
title: `${config.name}'s API Details:`,
|
||||||
description:
|
description: `${config.name} has a built in API that allows user to roll dice into Discord using third party programs. By default, API rolls are blocked from being sent in your guild. The API warning is also enabled by default. These commands may only be used by the Owner or Admins of your guild.
|
||||||
`${config.name} has a built in API that allows user to roll dice into Discord using third party programs. By default, API rolls are blocked from being sent in your guild. The API warning is also enabled by default. These commands may only be used by the Owner or Admins of your guild.
|
|
||||||
|
|
||||||
For information on how to use the API, please check the GitHub README for more information [here](${config.links.sourceCode}).
|
For information on how to use the API, please check the GitHub README for more information [here](${config.links.sourceCode}).
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import dbClient from 'db/client.ts';
|
||||||
|
|
||||||
import { failColor, successColor } from 'embeds/colors.ts';
|
import { failColor, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const deleteGuild = async (message: DiscordenoMessage) => {
|
export const deleteGuild = async (message: DiscordenoMessage) => {
|
||||||
let errorOut = false;
|
let errorOut = false;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import dbClient from 'db/client.ts';
|
||||||
|
|
||||||
import { generateApiFailed, generateApiSuccess } from 'embeds/api.ts';
|
import { generateApiFailed, generateApiSuccess } from 'embeds/api.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const showHideWarn = async (message: DiscordenoMessage, apiArg: string) => {
|
export const showHideWarn = async (message: DiscordenoMessage, apiArg: string) => {
|
||||||
let errorOutInitial = false;
|
let errorOutInitial = false;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import dbClient from 'db/client.ts';
|
||||||
import { generateApiStatus } from 'embeds/api.ts';
|
import { generateApiStatus } from 'embeds/api.ts';
|
||||||
import { failColor } from 'embeds/colors.ts';
|
import { failColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const status = async (message: DiscordenoMessage) => {
|
export const status = async (message: DiscordenoMessage) => {
|
||||||
// Get status of guild from the db
|
// Get status of guild from the db
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor } from 'embeds/colors.ts';
|
import { failColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const audit = (message: DiscordenoMessage, args: string[]) => {
|
export const audit = (message: DiscordenoMessage, args: string[]) => {
|
||||||
// Light telemetry to see how many times a command is being run
|
// Light telemetry to see how many times a command is being run
|
||||||
|
|
|
@ -5,7 +5,7 @@ import dbClient from 'db/client.ts';
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
import { compilingStats } from 'embeds/common.ts';
|
import { compilingStats } from 'embeds/common.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
interface DBSizeData {
|
interface DBSizeData {
|
||||||
table: string;
|
table: string;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import config from '~config';
|
||||||
|
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
const sortGuildByMemberCount = (a: DiscordenoGuild, b: DiscordenoGuild) => {
|
const sortGuildByMemberCount = (a: DiscordenoGuild, b: DiscordenoGuild) => {
|
||||||
if (a.memberCount < b.memberCount) {
|
if (a.memberCount < b.memberCount) {
|
||||||
|
@ -120,19 +120,23 @@ Please see attached file for audit details on cached guilds and members.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Repeat Guild Owners:',
|
name: 'Repeat Guild Owners:',
|
||||||
value: repeatCounts
|
value:
|
||||||
|
repeatCounts
|
||||||
.map((ownerCnt, serverIdx) => `${ownerCnt} ${ownerCnt === 1 ? 'person has' : 'people have'} me in ${serverIdx + 1} of their guilds`)
|
.map((ownerCnt, serverIdx) => `${ownerCnt} ${ownerCnt === 1 ? 'person has' : 'people have'} me in ${serverIdx + 1} of their guilds`)
|
||||||
.filter((str) => str)
|
.filter((str) => str)
|
||||||
.join('\n') || 'No Repeat Guild Owners',
|
.join('\n') || 'No Repeat Guild Owners',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Guild Size Dist:',
|
name: 'Guild Size Dist:',
|
||||||
value: Array.from(guildSizeDist)
|
value:
|
||||||
|
Array.from(guildSizeDist)
|
||||||
.map(
|
.map(
|
||||||
([size, count], idx) =>
|
([size, count], idx) =>
|
||||||
`${count} Guild${count === 1 ? ' has' : 's have'} ${
|
`${count} Guild${count === 1 ? ' has' : 's have'} ${
|
||||||
guildSizeDist.has(sizeCats[idx - 1]) ? `${size.toLocaleString()} - ${(sizeCats[idx - 1] - 1).toLocaleString()}` : `at least ${size.toLocaleString()}`
|
guildSizeDist.has(sizeCats[idx - 1])
|
||||||
} Member${size === 1 ? '' : 's'}`,
|
? `${size.toLocaleString()} - ${(sizeCats[idx - 1] - 1).toLocaleString()}`
|
||||||
|
: `at least ${size.toLocaleString()}`
|
||||||
|
} Member${size === 1 ? '' : 's'}`
|
||||||
)
|
)
|
||||||
.join('\n') || 'Not available',
|
.join('\n') || 'Not available',
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@ import config from '~config';
|
||||||
|
|
||||||
import { infoColor1 } from 'embeds/colors.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const auditHelp = (message: DiscordenoMessage) => {
|
export const auditHelp = (message: DiscordenoMessage) => {
|
||||||
message
|
message
|
||||||
|
|
|
@ -6,7 +6,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 utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
interface EmojiConf {
|
interface EmojiConf {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1 } from 'embeds/colors.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const handleMentions = (message: DiscordenoMessage) => {
|
export const handleMentions = (message: DiscordenoMessage) => {
|
||||||
log(LT.LOG, `Handling @mention message: ${JSON.stringify(message)}`);
|
log(LT.LOG, `Handling @mention message: ${JSON.stringify(message)}`);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { queries } from 'db/common.ts';
|
||||||
import { failColor, infoColor2 } from 'embeds/colors.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 'utils/utils.ts';
|
||||||
|
|
||||||
export const heatmap = (message: DiscordenoMessage) => {
|
export const heatmap = (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
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const help = (message: DiscordenoMessage) => {
|
export const help = (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
|
||||||
|
@ -92,8 +92,7 @@ export const help = (message: DiscordenoMessage) => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `\`${config.prefix}xdydzracsq!${config.postfix}\` ...`,
|
name: `\`${config.prefix}xdydzracsq!${config.postfix}\` ...`,
|
||||||
value:
|
value: `Rolls all configs requested, you may repeat the command multiple times in the same message (just ensure you close each roll with \`${config.postfix}\`), run \`${config.prefix}??\` for more details`,
|
||||||
`Rolls all configs requested, you may repeat the command multiple times in the same message (just ensure you close each roll with \`${config.postfix}\`), run \`${config.prefix}??\` for more details`,
|
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const info = (message: DiscordenoMessage) => {
|
export const info = (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
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { ignoreList, queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor, successColor } from 'embeds/colors.ts';
|
import { failColor, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const optIn = async (message: DiscordenoMessage) => {
|
export const optIn = 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
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { ignoreList, queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor, successColor } from 'embeds/colors.ts';
|
import { failColor, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const optOut = async (message: DiscordenoMessage) => {
|
export const optOut = 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
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1 } from 'embeds/colors.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
const generatePing = (time: number) => ({
|
const generatePing = (time: number) => ({
|
||||||
embeds: [
|
embeds: [
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1 } from 'embeds/colors.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const privacy = (message: DiscordenoMessage) => {
|
export const privacy = (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
|
||||||
|
@ -22,8 +22,7 @@ export const privacy = (message: DiscordenoMessage) => {
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: `${config.name} does not track or collect user information via Discord.`,
|
name: `${config.name} does not track or collect user information via Discord.`,
|
||||||
value:
|
value: `The only user submitted information that is stored is submitted via the \`${config.prefix}report\` command. This information is only stored for a short period of time in a location that only the Developer of ${config.name} can see.
|
||||||
`The only user submitted information that is stored is submitted via the \`${config.prefix}report\` command. This information is only stored for a short period of time in a location that only the Developer of ${config.name} can see.
|
|
||||||
|
|
||||||
For more details, please check out the Privacy Policy on the GitHub [here](${config.links.privacyPolicy}).
|
For more details, please check out the Privacy Policy on the GitHub [here](${config.links.privacyPolicy}).
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor, infoColor2, successColor } from 'embeds/colors.ts';
|
import { failColor, infoColor2, successColor } from 'embeds/colors.ts';
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const report = (message: DiscordenoMessage, args: string[]) => {
|
export const report = (message: DiscordenoMessage, args: string[]) => {
|
||||||
// Light telemetry to see how many times a command is being run
|
// Light telemetry to see how many times a command is being run
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const rip = (message: DiscordenoMessage) => {
|
export const rip = (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
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { queries } from 'db/common.ts';
|
||||||
import { generateRollError, rollingEmbed } from 'embeds/artigen.ts';
|
import { generateRollError, rollingEmbed } from 'embeds/artigen.ts';
|
||||||
import { warnColor } from 'embeds/colors.ts';
|
import { warnColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const roll = async (message: DiscordenoMessage, args: string[], command: string) => {
|
export const roll = async (message: DiscordenoMessage, args: string[], command: string) => {
|
||||||
// Light telemetry to see how many times a command is being run
|
// Light telemetry to see how many times a command is being run
|
||||||
|
@ -48,7 +48,9 @@ export const roll = async (message: DiscordenoMessage, args: string[], command:
|
||||||
|
|
||||||
// Return early if the modifiers were invalid
|
// Return early if the modifiers were invalid
|
||||||
if (!modifiers.valid) {
|
if (!modifiers.valid) {
|
||||||
m.edit(generateRollError('Modifiers invalid:', modifiers.error.name, modifiers.error.message)).catch((e) => utils.commonLoggers.messageEditError('roll.ts:50', m, e));
|
m.edit(generateRollError('Modifiers invalid:', modifiers.error.name, modifiers.error.message)).catch((e) =>
|
||||||
|
utils.commonLoggers.messageEditError('roll.ts:50', m, e)
|
||||||
|
);
|
||||||
|
|
||||||
if (DEVMODE && config.logRolls) {
|
if (DEVMODE && config.logRolls) {
|
||||||
// If enabled, log rolls so we can verify the bots math
|
// If enabled, log rolls so we can verify the bots math
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const rollDecorators = (message: DiscordenoMessage) => {
|
export const rollDecorators = (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
|
||||||
|
@ -55,7 +55,8 @@ Examples: \`${config.prefix}d20${config.postfix} -nd\`, \`${config.prefix}d20${c
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`-gm @user1 @user2 @userN` - GM Roll',
|
name: '`-gm @user1 @user2 @userN` - GM Roll',
|
||||||
value: 'Rolls the requested roll in GM mode, suppressing all publicly shown results and details and sending the results directly to the specified GMs',
|
value:
|
||||||
|
'Rolls the requested roll in GM mode, suppressing all publicly shown results and details and sending the results directly to the specified GMs',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1, infoColor2, successColor } from 'embeds/colors.ts';
|
import { infoColor1, infoColor2, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const rollHelp = (message: DiscordenoMessage) => {
|
export const rollHelp = (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
|
||||||
|
@ -73,27 +73,32 @@ Additionally, replace \`x\` with \`F\` to roll Fate dice`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`r<q` [Optional]',
|
name: '`r<q` [Optional]',
|
||||||
value: 'Rerolls any rolls that are less than or equal to `a`, `r3` will reroll every die that land on 3, 2, or 1, throwing out old rolls, cannot be used with `ro`',
|
value:
|
||||||
|
'Rerolls any rolls that are less than or equal to `a`, `r3` will reroll every die that land on 3, 2, or 1, throwing out old rolls, cannot be used with `ro`',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`r>q` [Optional]',
|
name: '`r>q` [Optional]',
|
||||||
value: 'Rerolls any rolls that are greater than or equal to `a`, `r3` will reroll every die that land on 3 or greater, throwing out old rolls, cannot be used with `ro`',
|
value:
|
||||||
|
'Rerolls any rolls that are greater than or equal to `a`, `r3` will reroll every die that land on 3 or greater, throwing out old rolls, cannot be used with `ro`',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`roa` or `ro=q` [Optional]',
|
name: '`roa` or `ro=q` [Optional]',
|
||||||
value: 'Rerolls any rolls that match `a`, `ro3` will reroll each die that lands on 3 ONLY ONE TIME, throwing out old rolls, cannot be used with `r`',
|
value:
|
||||||
|
'Rerolls any rolls that match `a`, `ro3` will reroll each die that lands on 3 ONLY ONE TIME, throwing out old rolls, cannot be used with `r`',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`ro<q` [Optional]',
|
name: '`ro<q` [Optional]',
|
||||||
value: 'Rerolls any rolls that are less than or equal to `a`, `ro3` will reroll each die that lands on 3, 2, or 1 ONLY ONE TIME, throwing out old rolls, cannot be used with `r`',
|
value:
|
||||||
|
'Rerolls any rolls that are less than or equal to `a`, `ro3` will reroll each die that lands on 3, 2, or 1 ONLY ONE TIME, throwing out old rolls, cannot be used with `r`',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`ro>q` [Optional]',
|
name: '`ro>q` [Optional]',
|
||||||
value: 'Rerolls any rolls that are greater than or equal to `a`, `ro3` will reroll each die that lands on 3 or greater ONLY ONE TIME, throwing out old rolls, cannot be used with `r`',
|
value:
|
||||||
|
'Rerolls any rolls that are greater than or equal to `a`, `ro3` will reroll each die that lands on 3 or greater ONLY ONE TIME, throwing out old rolls, cannot be used with `r`',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -188,27 +193,32 @@ Additionally, replace \`x\` with \`F\` to roll Fate dice`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`!p>u` [Optional]',
|
name: '`!p>u` [Optional]',
|
||||||
value: 'Penetrating Explosion on `u` and greater, rolls one `dy` for each die that lands on `u` or greater, but subtracts one from each resulting explosion',
|
value:
|
||||||
|
'Penetrating Explosion on `u` and greater, rolls one `dy` for each die that lands on `u` or greater, but subtracts one from each resulting explosion',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`!p<u` [Optional]',
|
name: '`!p<u` [Optional]',
|
||||||
value: 'Penetrating Explosion on `u` and under, rolls one `dy` for each die that lands on `u` or under, but subtracts one from each resulting explosion',
|
value:
|
||||||
|
'Penetrating Explosion on `u` and under, rolls one `dy` for each die that lands on `u` or under, but subtracts one from each resulting explosion',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`!!=u` [Optional]',
|
name: '`!!=u` [Optional]',
|
||||||
value: 'Compounding Explosion on `u`, rolls one `dy` for each die that lands on `u`, but adds the resulting explosion to the die that caused this explosion',
|
value:
|
||||||
|
'Compounding Explosion on `u`, rolls one `dy` for each die that lands on `u`, but adds the resulting explosion to the die that caused this explosion',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`!!>u` [Optional]',
|
name: '`!!>u` [Optional]',
|
||||||
value: 'Compounding Explosion on `u` and greater, rolls one `dy` for each die that lands on `u` or greater, but adds the resulting explosion to the die that caused this explosion',
|
value:
|
||||||
|
'Compounding Explosion on `u` and greater, rolls one `dy` for each die that lands on `u` or greater, but adds the resulting explosion to the die that caused this explosion',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`!!<u` [Optional]',
|
name: '`!!<u` [Optional]',
|
||||||
value: 'Compounding Explosion on `u` and under, rolls one `dy` for each die that lands on `u` or under, but adds the resulting explosion to the die that caused this explosion',
|
value:
|
||||||
|
'Compounding Explosion on `u` and under, rolls one `dy` for each die that lands on `u` or under, but adds the resulting explosion to the die that caused this explosion',
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { queries } from 'db/common.ts';
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
import { infoColor2 } from 'embeds/colors.ts';
|
||||||
import { compilingStats } from 'embeds/common.ts';
|
import { compilingStats } from 'embeds/common.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const stats = async (message: DiscordenoMessage) => {
|
export const stats = 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
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor1 } from 'embeds/colors.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const version = (message: DiscordenoMessage) => {
|
export const version = (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
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { verifyQueryHasParams } from 'endpoints/utils.ts';
|
||||||
|
|
||||||
import { generateApiDeleteEmail } from 'embeds/api.ts';
|
import { generateApiDeleteEmail } from 'embeds/api.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/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> => {
|
||||||
if (verifyQueryHasParams(query, ['user', 'email'])) {
|
if (verifyQueryHasParams(query, ['user', 'email'])) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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 utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const apiChannel = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
|
export const apiChannel = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
|
||||||
if (verifyQueryHasParams(query, ['user'])) {
|
if (verifyQueryHasParams(query, ['user'])) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { verifyQueryHasParams } from 'endpoints/utils.ts';
|
||||||
|
|
||||||
import { generateApiKeyEmail } from 'embeds/api.ts';
|
import { generateApiKeyEmail } from 'embeds/api.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const apiKey = async (query: Map<string, string>): Promise<Response> => {
|
export const apiKey = async (query: Map<string, string>): Promise<Response> => {
|
||||||
if (verifyQueryHasParams(query, ['user', 'email'])) {
|
if (verifyQueryHasParams(query, ['user', 'email'])) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ 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 utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const apiKeyAdmin = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
|
export const apiKeyAdmin = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
|
||||||
if (verifyQueryHasParams(query, ['user', 'a'])) {
|
if (verifyQueryHasParams(query, ['user', 'a'])) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { queries } from 'db/common.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 utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
const apiWarning = `The following roll was conducted using my built in API. If someone in this channel did not request this roll, please report API abuse here: <${config.api.supportURL}>`;
|
const apiWarning = `The following roll was conducted using my built in API. If someone in this channel did not request this roll, please report API abuse here: <${config.api.supportURL}>`;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ export const apiRoll = async (query: Map<string, string>, apiUserid: bigint): Pr
|
||||||
} else {
|
} else {
|
||||||
// Alert API user that they messed up
|
// Alert API user that they messed up
|
||||||
return stdResp.Forbidden(
|
return stdResp.Forbidden(
|
||||||
`Verify you are a member of the guild you are sending this roll to. If you are, the ${config.name} may not have that registered, please send a message in the guild so ${config.name} can register this. This registration is temporary, so if you see this error again, just poke your server again.`,
|
`Verify you are a member of the guild you are sending this roll to. If you are, the ${config.name} may not have that registered, please send a message in the guild so ${config.name} can register this. This registration is temporary, so if you see this error again, just poke your server again.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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 utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const apiChannelAdd = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
|
export const apiChannelAdd = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
|
||||||
if (verifyQueryHasParams(query, ['user', 'channel'])) {
|
if (verifyQueryHasParams(query, ['user', 'channel'])) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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 utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const apiChannelManageActive = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
|
export const apiChannelManageActive = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
|
||||||
if (verifyQueryHasParams(query, ['user', 'channel'])) {
|
if (verifyQueryHasParams(query, ['user', 'channel'])) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ 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 utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const apiChannelManageBan = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
|
export const apiChannelManageBan = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
|
||||||
if (verifyQueryHasParams(query, ['user', 'channel', 'a'])) {
|
if (verifyQueryHasParams(query, ['user', 'channel', 'a'])) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ 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 utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const apiKeyManage = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
|
export const apiKeyManage = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
|
||||||
if (verifyQueryHasParams(query, ['user', 'a'])) {
|
if (verifyQueryHasParams(query, ['user', 'a'])) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import config from '~config';
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { weekDays } from 'db/common.ts';
|
import { weekDays } from 'db/common.ts';
|
||||||
|
|
||||||
import utils from 'src/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
interface PastCommandCount {
|
interface PastCommandCount {
|
||||||
command: string;
|
command: string;
|
Loading…
Reference in New Issue