deno fmt
This commit is contained in:
parent
76e007e2e4
commit
c7c974c395
|
@ -1,60 +1,70 @@
|
||||||
export const config = {
|
export const config = {
|
||||||
'name': 'The Artificer', // Name of the bot
|
name: 'The Artificer', // Name of the bot
|
||||||
'version': '2.1.3', // Version of the bot
|
version: '2.1.3', // Version of the bot
|
||||||
'token': 'the_bot_token', // Discord API Token for this bot
|
token: 'the_bot_token', // Discord API Token for this bot
|
||||||
'localtoken': 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
|
localtoken: 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
|
||||||
'prefix': '[[', // Prefix for all commands
|
prefix: '[[', // Prefix for all commands
|
||||||
'postfix': ']]', // Postfix for rolling command
|
postfix: ']]', // Postfix for rolling command
|
||||||
'limits': { // Limits for the bot functions
|
limits: {
|
||||||
'maxLoops': 5000000, // Determines how long the bot will attempt a roll, number of loops before it kills a roll. Increase this at your own risk, originally was set to 5 Million before rollWorkers were added, increased to 10 Million since multiple rolls can be handled concurrently
|
// Limits for the bot functions
|
||||||
'maxWorkers': 16, // Maximum number of worker threads to spawn at once (Set this to less than the number of threads your CPU has, Artificer will eat it all if too many rolls happen at once)
|
maxLoops: 5000000, // Determines how long the bot will attempt a roll, number of loops before it kills a roll. Increase this at your own risk, originally was set to 5 Million before rollWorkers were added, increased to 10 Million since multiple rolls can be handled concurrently
|
||||||
'workerTimeout': 300000, // Maximum time before the bot kills a worker thread in ms
|
maxWorkers: 16, // Maximum number of worker threads to spawn at once (Set this to less than the number of threads your CPU has, Artificer will eat it all if too many rolls happen at once)
|
||||||
|
workerTimeout: 300000, // Maximum time before the bot kills a worker thread in ms
|
||||||
},
|
},
|
||||||
'api': { // Setting for the built-in API
|
api: {
|
||||||
'enable': false, // Leave this off if you have no intention of using this/supporting it
|
// Setting for the built-in API
|
||||||
'publicDomain': 'http://example.com/', // Public domain that the API is behind, should end with a /
|
enable: false, // Leave this off if you have no intention of using this/supporting it
|
||||||
'port': 8080, // Port for the API to listen on
|
publicDomain: 'http://example.com/', // Public domain that the API is behind, should end with a /
|
||||||
'supportURL': 'your_support_url_for_api_abuse', // Fill this in with the way you wish to be contacted when somebody needs to report API key abuse
|
port: 8080, // Port for the API to listen on
|
||||||
'rateLimitTime': 10000, // Time range for how often the API rate limits will be lifted (time in ms)
|
supportURL: 'your_support_url_for_api_abuse', // Fill this in with the way you wish to be contacted when somebody needs to report API key abuse
|
||||||
'rateLimitCnt': 10, // Amount of requests that can be made (successful or not) during above time range before getting rate limited
|
rateLimitTime: 10000, // Time range for how often the API rate limits will be lifted (time in ms)
|
||||||
'admin': 0n, // Discord user ID of the bot admin, this user will be the user that can ban/unban user/channel combos and API keys
|
rateLimitCnt: 10, // Amount of requests that can be made (successful or not) during above time range before getting rate limited
|
||||||
'adminKey': 'your_25char_api_token', // API Key generated by nanoid that is 25 char long, this gets pre-populated into all_keys
|
admin: 0n, // Discord user ID of the bot admin, this user will be the user that can ban/unban user/channel combos and API keys
|
||||||
'email': 0n, // Temporary set up for email, this will be adjusted to an actual email using deno-smtp in the future.
|
adminKey: 'your_25char_api_token', // API Key generated by nanoid that is 25 char long, this gets pre-populated into all_keys
|
||||||
|
email: 0n, // Temporary set up for email, this will be adjusted to an actual email using deno-smtp in the future.
|
||||||
},
|
},
|
||||||
'db': { // Settings for the MySQL database, this is required for use with the API, if you do not want to set this up, you will need to rip all code relating to the DB out of the bot
|
db: {
|
||||||
'host': '', // IP address for the db, usually localhost
|
// Settings for the MySQL database, this is required for use with the API, if you do not want to set this up, you will need to rip all code relating to the DB out of the bot
|
||||||
'localhost': '', // IP address for a secondary OPTIONAL local testing DB, usually also is localhost, but depends on your dev environment
|
host: '', // IP address for the db, usually localhost
|
||||||
'port': 3306, // Port for the db
|
localhost: '', // IP address for a secondary OPTIONAL local testing DB, usually also is localhost, but depends on your dev environment
|
||||||
'username': '', // Username for the account that will access your DB, this account will need "DB Manager" admin rights and "REFERENCES" Global Privalages
|
port: 3306, // Port for the db
|
||||||
'password': '', // Password for the account, user account may need to be authenticated with the "Standard" Authentication Type if this does not work out of the box
|
username: '', // Username for the account that will access your DB, this account will need "DB Manager" admin rights and "REFERENCES" Global Privalages
|
||||||
'name': '', // Name of the database Schema to use for the bot
|
password: '', // Password for the account, user account may need to be authenticated with the "Standard" Authentication Type if this does not work out of the box
|
||||||
|
name: '', // Name of the database Schema to use for the bot
|
||||||
},
|
},
|
||||||
'logRolls': false, // Enables logging of roll commands, this should be left disabled for privacy, but exists to allow verification of rolls before deployment, all API rolls will always be logged no matter what this is set to
|
logRolls: false, // Enables logging of roll commands, this should be left disabled for privacy, but exists to allow verification of rolls before deployment, all API rolls will always be logged no matter what this is set to
|
||||||
'logChannel': 0n, // Discord channel ID where the bot should put startup messages and other error messages needed
|
logChannel: 0n, // Discord channel ID where the bot should put startup messages and other error messages needed
|
||||||
'reportChannel': 0n, // Discord channel ID where reports will be sent when using the built-in report command
|
reportChannel: 0n, // Discord channel ID where reports will be sent when using the built-in report command
|
||||||
'devServer': 0n, // Discord guild ID where testing of indev features/commands will be handled, used in conjuction with the DEVMODE bool in mod.ts
|
devServer: 0n, // Discord guild ID where testing of indev features/commands will be handled, used in conjuction with the DEVMODE bool in mod.ts
|
||||||
'emojis': [ // Array of objects containing all emojis that the bot can send on your behalf, empty this array if you don't want any of them
|
emojis: [
|
||||||
{ // Emoji object, duplicate for each emoji
|
// Array of objects containing all emojis that the bot can send on your behalf, empty this array if you don't want any of them
|
||||||
'name': 'emoji_name', // Name of emoji in discord
|
{
|
||||||
'aliases': ['alias_1', 'alias_2', 'alias_n'], // Commands that will activate this emoji
|
// Emoji object, duplicate for each emoji
|
||||||
'id': 'the_emoji_id', // Discord emoji ID for this emoji
|
name: 'emoji_name', // Name of emoji in discord
|
||||||
'animated': false, // Tells the bot this emoji is animated so it sends correctly
|
aliases: ['alias_1', 'alias_2', 'alias_n'], // Commands that will activate this emoji
|
||||||
'deleteSender': false, // Tells the bot to attempt to delete the sender's message after sending the emoji
|
id: 'the_emoji_id', // Discord emoji ID for this emoji
|
||||||
|
animated: false, // Tells the bot this emoji is animated so it sends correctly
|
||||||
|
deleteSender: false, // Tells the bot to attempt to delete the sender's message after sending the emoji
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'botLists': [ // Array of objects containing all bot lists that stats should be posted to
|
botLists: [
|
||||||
{ // Bot List object, duplicate for each bot list
|
// Array of objects containing all bot lists that stats should be posted to
|
||||||
'name': 'Bot List Name', // Name of bot list, not used
|
{
|
||||||
'enabled': true, // Should statistics be posted to this list?
|
// Bot List object, duplicate for each bot list
|
||||||
'apiUrl': 'https://example.com/api/bots/?{bot_id}/stats', // API URL, use ?{bot_id} in place of the bot id so that it can be dynamically replaced
|
name: 'Bot List Name', // Name of bot list, not used
|
||||||
'headers': [ // Array of headers that need to be added to the request
|
enabled: true, // Should statistics be posted to this list?
|
||||||
{ // Header Object, duplicate for every header needed
|
apiUrl: 'https://example.com/api/bots/?{bot_id}/stats', // API URL, use ?{bot_id} in place of the bot id so that it can be dynamically replaced
|
||||||
'header': 'header_name', // Name of header needed, usually Authorization is needed
|
headers: [
|
||||||
'value': 'header_value', // Value for the header
|
// Array of headers that need to be added to the request
|
||||||
|
{
|
||||||
|
// Header Object, duplicate for every header needed
|
||||||
|
header: 'header_name', // Name of header needed, usually Authorization is needed
|
||||||
|
value: 'header_value', // Value for the header
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'body': { // Data payload to send to the bot list, will be turned into a string and any ?{} will be replaced with the required value, currently only has ?{server_count}
|
body: {
|
||||||
'param_name': '?{param_value}', // Add more params as needed
|
// Data payload to send to the bot list, will be turned into a string and any ?{} will be replaced with the required value, currently only has ?{server_count}
|
||||||
|
param_name: '?{param_value}', // Add more params as needed
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
4
mod.ts
4
mod.ts
|
@ -74,9 +74,7 @@ startBot({
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
// Interval to update bot list stats every 24 hours
|
// Interval to update bot list stats every 24 hours
|
||||||
LOCALMODE
|
LOCALMODE ? log(LT.INFO, 'updateListStatistics not running') : setInterval(() => {
|
||||||
? 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);
|
||||||
|
|
|
@ -33,7 +33,7 @@ export const generateReport = (msg: string) => ({
|
||||||
export const generateStats = (guildCount: number, channelCount: number, memberCount: number, rollCount: bigint, utilityCount: bigint, rollRate: number, utilityRate: number) => ({
|
export const generateStats = (guildCount: number, channelCount: number, memberCount: number, rollCount: bigint, utilityCount: bigint, rollRate: number, utilityRate: number) => ({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
color: infoColor2,
|
color: infoColor2,
|
||||||
title: 'The Artificer\'s Statistics:',
|
title: "The Artificer's Statistics:",
|
||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString(),
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,8 +74,7 @@ export const api = async (message: DiscordenoMessage, args: string[]) => {
|
||||||
{
|
{
|
||||||
color: failColor,
|
color: failColor,
|
||||||
title: 'API commands are powerful and can only be used by guild Owners and Admins.',
|
title: 'API commands are powerful and can only be used by guild Owners and Admins.',
|
||||||
description:
|
description: 'For information on how to use the API, please check the GitHub README for more information [here](https://github.com/Burn-E99/TheArtificer).',
|
||||||
'For information on how to use the API, please check the GitHub README for more information [here](https://github.com/Burn-E99/TheArtificer).',
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,7 +11,7 @@ export const help = (message: DiscordenoMessage) => {
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
color: infoColor2,
|
color: infoColor2,
|
||||||
title: 'The Artificer\'s API Details:',
|
title: "The Artificer's API Details:",
|
||||||
description:
|
description:
|
||||||
`The Artificer 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.
|
`The Artificer 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.
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ You may enable and disable the API rolls for your guild as needed.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `\`${config.prefix}api delete\``,
|
name: `\`${config.prefix}api delete\``,
|
||||||
value: 'Deletes this channel\'s settings from The Artificer\'s database',
|
value: "Deletes this channel's settings from The Artificer's database",
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,7 +91,8 @@ export const help = (message: DiscordenoMessage) => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `\`${config.prefix}xdydzracsq!${config.postfix}\` ...`,
|
name: `\`${config.prefix}xdydzracsq!${config.postfix}\` ...`,
|
||||||
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`,
|
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`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import config from '../../config.ts';
|
import config from '../../config.ts';
|
||||||
import dbClient from '../db/client.ts';
|
import dbClient from '../db/client.ts';
|
||||||
import { queries, ignoreList } from '../db/common.ts';
|
import { ignoreList, queries } from '../db/common.ts';
|
||||||
import {
|
import {
|
||||||
// Discordeno deps
|
// Discordeno deps
|
||||||
DiscordenoMessage,
|
DiscordenoMessage,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import config from '../../config.ts';
|
import config from '../../config.ts';
|
||||||
import dbClient from '../db/client.ts';
|
import dbClient from '../db/client.ts';
|
||||||
import { queries, ignoreList } from '../db/common.ts';
|
import { ignoreList, queries } from '../db/common.ts';
|
||||||
import {
|
import {
|
||||||
// Discordeno deps
|
// Discordeno deps
|
||||||
DiscordenoMessage,
|
DiscordenoMessage,
|
||||||
|
|
|
@ -21,7 +21,8 @@ export const privacy = (message: DiscordenoMessage) => {
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'The Artificer does not track or collect user information via Discord.',
|
name: 'The Artificer does not track or collect user information via Discord.',
|
||||||
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 The Artificer can see.
|
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 The Artificer can see.
|
||||||
|
|
||||||
For more details, please check out the Privacy Policy on the GitHub [here](https://github.com/Burn-E99/TheArtificer/blob/master/PRIVACY.md).
|
For more details, please check out the Privacy Policy on the GitHub [here](https://github.com/Burn-E99/TheArtificer/blob/master/PRIVACY.md).
|
||||||
|
|
||||||
|
|
|
@ -53,13 +53,15 @@ export const roll = async (message: DiscordenoMessage, args: string[], command:
|
||||||
// Rejoin all of the args and send it into the solver, if solver returns a falsy item, an error object will be substituded in
|
// Rejoin all of the args and send it into the solver, if solver returns a falsy item, an error object will be substituded in
|
||||||
const rollCmd = message.content.substring(2);
|
const rollCmd = message.content.substring(2);
|
||||||
|
|
||||||
queueRoll(<QueuedRoll>{
|
queueRoll(
|
||||||
|
<QueuedRoll> {
|
||||||
apiRoll: false,
|
apiRoll: false,
|
||||||
dd: { m, message },
|
dd: { m, message },
|
||||||
rollCmd,
|
rollCmd,
|
||||||
modifiers,
|
modifiers,
|
||||||
originalCommand,
|
originalCommand,
|
||||||
});
|
},
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(LT.ERROR, `Undandled Error: ${JSON.stringify(e)}`);
|
log(LT.ERROR, `Undandled Error: ${JSON.stringify(e)}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,9 +64,7 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
|
||||||
}
|
}
|
||||||
if (modifiers.gms.length < 1) {
|
if (modifiers.gms.length < 1) {
|
||||||
// If -gm is on and none were found, throw an error
|
// If -gm is on and none were found, throw an error
|
||||||
m.edit(generateRollError(errorType, 'Must specifiy at least one GM by @mentioning them')).catch((e) =>
|
m.edit(generateRollError(errorType, 'Must specifiy at least one GM by @mentioning them')).catch((e) => utils.commonLoggers.messageEditError('getModifiers.ts:66', m, e));
|
||||||
utils.commonLoggers.messageEditError('getModifiers.ts:66', 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
|
||||||
|
@ -83,9 +81,7 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
|
||||||
|
|
||||||
if (!args[i] || (args[i].toLowerCase()[0] !== 'd' && args[i].toLowerCase()[0] !== 'a')) {
|
if (!args[i] || (args[i].toLowerCase()[0] !== 'd' && args[i].toLowerCase()[0] !== 'a')) {
|
||||||
// If -o is on and asc or desc was not specified, error out
|
// If -o is on and asc or desc was not specified, error out
|
||||||
m.edit(generateRollError(errorType, 'Must specifiy `a` or `d` to order the rolls ascending or descending')).catch((e) =>
|
m.edit(generateRollError(errorType, 'Must specifiy `a` or `d` to order the rolls ascending or descending')).catch((e) => utils.commonLoggers.messageEditError('getModifiers.ts:81', m, e));
|
||||||
utils.commonLoggers.messageEditError('getModifiers.ts:81', 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
|
||||||
|
@ -112,9 +108,7 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
|
||||||
|
|
||||||
// maxRoll and nominalRoll cannot both be on, throw an error
|
// maxRoll and nominalRoll cannot both be on, throw an error
|
||||||
if (modifiers.maxRoll && modifiers.nominalRoll) {
|
if (modifiers.maxRoll && modifiers.nominalRoll) {
|
||||||
m.edit(generateRollError(errorType, 'Cannot maximise and nominise the roll at the same time')).catch((e) =>
|
m.edit(generateRollError(errorType, 'Cannot maximise and nominise the roll at the same time')).catch((e) => utils.commonLoggers.messageEditError('getModifiers.ts:106', m, e));
|
||||||
utils.commonLoggers.messageEditError('getModifiers.ts:106', 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
|
||||||
|
|
|
@ -49,8 +49,7 @@ 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:
|
value: 'Rolls the requested roll in GM mode, suppressing all publicly shown results and details and sending the results directly to the specified GMs',
|
||||||
'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,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,32 +72,27 @@ Additionally, replace \`x\` with \`F\` to roll Fate dice`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`r<q` [Optional]',
|
name: '`r<q` [Optional]',
|
||||||
value:
|
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`',
|
||||||
'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:
|
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`',
|
||||||
'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:
|
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`',
|
||||||
'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:
|
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`',
|
||||||
'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:
|
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`',
|
||||||
'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,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -192,32 +187,27 @@ Additionally, replace \`x\` with \`F\` to roll Fate dice`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '`!p>u` [Optional]',
|
name: '`!p>u` [Optional]',
|
||||||
value:
|
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',
|
||||||
'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:
|
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',
|
||||||
'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:
|
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',
|
||||||
'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:
|
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',
|
||||||
'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:
|
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',
|
||||||
'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,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -40,8 +40,8 @@ export const stats = async (message: DiscordenoMessage) => {
|
||||||
rolls,
|
rolls,
|
||||||
total - rolls,
|
total - rolls,
|
||||||
rollRate,
|
rollRate,
|
||||||
totalRate - rollRate
|
totalRate - rollRate,
|
||||||
)
|
),
|
||||||
).catch((e: Error) => utils.commonLoggers.messageEditError('stats.ts:38', m, e));
|
).catch((e: Error) => utils.commonLoggers.messageEditError('stats.ts:38', m, e));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
utils.commonLoggers.messageSendError('stats.ts:41', message, e);
|
utils.commonLoggers.messageSendError('stats.ts:41', message, e);
|
||||||
|
|
|
@ -15,7 +15,7 @@ export const apiKeyDelete = async (
|
||||||
query: Map<string, string>,
|
query: Map<string, string>,
|
||||||
apiUserid: BigInt,
|
apiUserid: BigInt,
|
||||||
apiUserEmail: string,
|
apiUserEmail: string,
|
||||||
apiUserDelCode: string
|
apiUserDelCode: string,
|
||||||
) => {
|
) => {
|
||||||
if (query.has('user') && (query.get('user') || '').length > 0 && query.has('email') && (query.get('email') || '').length > 0) {
|
if (query.has('user') && (query.get('user') || '').length > 0 && query.has('email') && (query.get('email') || '').length > 0) {
|
||||||
if (apiUserid === BigInt(query.get('user') || '0') && apiUserEmail === query.get('email')) {
|
if (apiUserid === BigInt(query.get('user') || '0') && apiUserEmail === query.get('email')) {
|
||||||
|
|
|
@ -103,13 +103,15 @@ export const apiRoll = async (requestEvent: Deno.RequestEvent, query: Map<string
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parse the roll and get the return text
|
// Parse the roll and get the return text
|
||||||
await queueRoll(<QueuedRoll>{
|
await queueRoll(
|
||||||
|
<QueuedRoll> {
|
||||||
apiRoll: true,
|
apiRoll: true,
|
||||||
api: { requestEvent, channelId: BigInt(query.get('channel') || '0'), userId: BigInt(query.get('user') || '') },
|
api: { requestEvent, channelId: BigInt(query.get('channel') || '0'), userId: BigInt(query.get('user') || '') },
|
||||||
rollCmd,
|
rollCmd,
|
||||||
modifiers,
|
modifiers,
|
||||||
originalCommand,
|
originalCommand,
|
||||||
});
|
},
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Handle any errors we missed
|
// Handle any errors we missed
|
||||||
log(LT.ERROR, `Unhandled Error: ${JSON.stringify(err)}`);
|
log(LT.ERROR, `Unhandled Error: ${JSON.stringify(err)}`);
|
||||||
|
@ -119,8 +121,8 @@ export const apiRoll = async (requestEvent: Deno.RequestEvent, query: Map<string
|
||||||
// Alert API user that they messed up
|
// Alert API user that they messed up
|
||||||
requestEvent.respondWith(
|
requestEvent.respondWith(
|
||||||
stdResp.Forbidden(
|
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 {
|
||||||
|
|
|
@ -14,6 +14,6 @@ export const heatmapPng = async (requestEvent: Deno.RequestEvent) => {
|
||||||
status: STATUS_CODE.OK,
|
status: STATUS_CODE.OK,
|
||||||
statusText: STATUS_TEXT[STATUS_CODE.OK],
|
statusText: STATUS_TEXT[STATUS_CODE.OK],
|
||||||
headers: imageHeaders,
|
headers: imageHeaders,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import {
|
import {
|
||||||
// httpd deps
|
|
||||||
StatusCode,
|
|
||||||
STATUS_CODE,
|
STATUS_CODE,
|
||||||
STATUS_TEXT,
|
STATUS_TEXT,
|
||||||
|
// httpd deps
|
||||||
|
StatusCode,
|
||||||
} from '../../deps.ts';
|
} from '../../deps.ts';
|
||||||
|
|
||||||
const genericResponse = (customText: string, status: StatusCode) =>
|
const genericResponse = (customText: string, status: StatusCode) => new Response(customText || STATUS_TEXT[status], { status: status, statusText: STATUS_TEXT[status] });
|
||||||
new Response(customText || STATUS_TEXT[status], { status: status, statusText: STATUS_TEXT[status] });
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
BadRequest: (customText: string) => genericResponse(customText, STATUS_CODE.BadRequest),
|
BadRequest: (customText: string) => genericResponse(customText, STATUS_CODE.BadRequest),
|
||||||
|
|
|
@ -196,7 +196,7 @@ const updateHeatmapPng = async () => {
|
||||||
hourPixels[hour][0] + 1,
|
hourPixels[hour][0] + 1,
|
||||||
dayPixels[day][1] - dayPixels[day][0] + 1,
|
dayPixels[day][1] - dayPixels[day][0] + 1,
|
||||||
hourPixels[hour][1] - hourPixels[hour][0] + 1,
|
hourPixels[hour][1] - hourPixels[hour][0] + 1,
|
||||||
is.Image.rgbToColor(255 * (1 - percent), 255 * percent, 0)
|
is.Image.rgbToColor(255 * (1 - percent), 255 * percent, 0),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ const handleRollWorker = async (rq: QueuedRoll) => {
|
||||||
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,
|
||||||
],
|
],
|
||||||
|
@ -175,9 +175,9 @@ const handleRollWorker = async (rq: QueuedRoll) => {
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
details: pubEmbedDetails,
|
details: pubEmbedDetails,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ The results for this roll will replace this message when it is done.`,
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
log(
|
log(
|
||||||
LT.LOG,
|
LT.LOG,
|
||||||
`Checking rollQueue for items, rollQueue length: ${rollQueue.length}, currentWorkers: ${currentWorkers}, config.limits.maxWorkers: ${config.limits.maxWorkers}`
|
`Checking rollQueue for items, rollQueue length: ${rollQueue.length}, currentWorkers: ${currentWorkers}, config.limits.maxWorkers: ${config.limits.maxWorkers}`,
|
||||||
);
|
);
|
||||||
if (rollQueue.length && currentWorkers < config.limits.maxWorkers) {
|
if (rollQueue.length && currentWorkers < config.limits.maxWorkers) {
|
||||||
const temp = rollQueue.shift();
|
const temp = rollQueue.shift();
|
||||||
|
|
Loading…
Reference in New Issue