Converted 90% of bot messages into Embeds

Bot messages will now be pretty :3
This commit is contained in:
Ean Milligan (Bastion) 2021-11-22 01:11:10 -05:00
parent 60188ca5d8
commit b076751bf2
6 changed files with 482 additions and 126 deletions

View File

@ -1,87 +0,0 @@
export const longStrs = {
"help": [ // Array of strings that makes up the help command, placed here to keep source code cleaner
"```fix",
"The Artificer Help",
"```",
"__**Commands:**__",
"```",
"[[? - This command",
"[[rollhelp or [[?? - Details on how to use the roll command, listed as [[xdy...]] below",
"[[api [subcommand] - Administrative tools for the bots's API, run [[api help for more details",
"[[ping - Pings the bot to check connectivity",
"[[info - Prints some information and links relating to the bot",
"[[privacy - Prints some information about the Privacy Policy",
"[[version - Prints the bots version",
"[[popcat - Popcat",
"[[report [text] - Report a command that failed to run",
"[[stats - Statistics on the bot",
"[[xdydzracsq!]] ... - Rolls all configs requested, you may repeat the command multiple times in the same message (just ensure you close each roll with ]]), run [[?? for more details",
"```"
],
"rollhelp": [ // Array of strings that makes up the rollhelp command, placed here to keep source code cleaner
"```fix",
"The Artificer Roll Command Details",
"```",
"```",
"[[xdydzracsq!]] ... - Rolls all configs requested, you may repeat the command multiple times in the same message (just ensure you close each roll with ]])",
"* x [OPT] - number of dice to roll, if omitted, 1 is used",
"* dy [REQ] - size of dice to roll, d20 = 20 sided die",
"* dz or dlz [OPT] - drops the lowest z dice, cannot be used with kz",
"* kz or khz [OPT] - keeps the highest z dice, cannot be used with dz",
"* dhz [OPT] - drops the highest z dice, cannot be used with kz",
"* klz [OPT] - keeps the lowest z dice, cannot be used with dz",
"* ra [OPT] - rerolls any rolls that match a, r3 will reroll any dice that land on 3, throwing out old rolls",
"* csq or cs=q [OPT] - changes crit score to q",
"* cs<q [OPT] - changes crit score to be less than or equal to q",
"* cs>q [OPT] - changes crit score to be greater than or equal to q ",
"* cfq or cf=q [OPT] - changes crit fail to q",
"* cf<q [OPT] - changes crit fail to be less than or equal to q",
"* cf>q [OPT] - changes crit fail to be greater than or equal to q",
"* ! [OPT] - exploding, rolls another dy for every crit roll",
"*",
"* This command also can fully solve math equations with parenthesis",
"*",
"* This command also has some useful flags that can used. These flags simply need to be placed after all rolls in the message:",
" * -nd No Details - Suppresses all details of the requested roll",
" * -s Spoiler - Spoilers all details of the requested roll",
" * -m Maximize Roll - Rolls the theoretical maximum roll, cannot be used with -n",
" * -n Nominal Roll - Rolls the theoretical nominal roll, cannot be used with -m",
" * -gm @user1 @user2 @usern",
" * GM Roll - Rolls the requested roll in GM mode, suppressing all publicly shown results and details and sending the results directly to the specified GMs",
" * -o a or -o d",
" * Order Roll - Rolls the requested roll and orders the results in the requested direction",
"```"
],
"apihelp": [ // Array of strings making up the api help command, placed here to keep source code cleaner
"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. 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: <https://github.com/Burn-E99/TheArtificer>",
"",
"__**Available Subcommands:**__",
"```",
"[[api help - This command",
"[[api status - Shows the current status of the API for this guild",
"[[api allow/enable - Allows API Rolls to be sent to this guild",
"[[api block/disable - Blocks API Rolls from being sent to this guild",
"[[api delete - Deletes this guild from The Artificer's database",
"```",
"You may enable and disable the API rolls for your guild as needed."
],
"info": [ // Array of strings making up the info command, placed here to keep source code cleaner
"The Artificer is a Discord bot that specializes in rolling dice and calculating math.",
"",
"The Artificer is developed by Ean AKA Burn_E99.",
"",
"Additional information can be found on my website: <https://discord.burne99.com/TheArtificer/>",
"Want to check out my source code? Check it out here: <https://github.com/Burn-E99/TheArtificer>",
"Need help with this bot? Join my support server here: https://discord.gg/peHASXMZYv"
],
"privacy": [ // Array of strings making up the privacy command, placed here to keep source code cleaner
"The Artificer does not track or collect user information via Discord.",
"The only user submitted information that is stored is submitted via the `[[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: <https://github.com/Burn-E99/TheArtificer/blob/master/PRIVACY.md>"
]
};
export default longStrs;

75
mod.ts
View File

@ -9,7 +9,7 @@ import {
startBot, editBotStatus, editBotNickname,
Intents,
sendMessage, sendDirectMessage,
cache, botId,
cache, cacheHandlers, botId,
hasGuildPermissions,
DiscordActivityTypes, DiscordenoGuild, DiscordenoMessage,
@ -21,13 +21,16 @@ import api from "./src/api.ts";
import intervals from "./src/intervals.ts";
import utils from "./src/utils.ts";
import solver from "./src/solver.ts";
import {
constantCmds,
generatePing, generateReport, generateStats, generateApiFailed, generateApiStatus, generateApiSuccess, generateDMFailed
} from "./src/constantCmds.ts";
import { EmojiConf } from "./src/mod.d.ts";
import { LogTypes as LT } from "./src/utils.enums.ts";
import { DEVMODE, DEBUG, LOCALMODE } from "./flags.ts";
import config from "./config.ts";
import longStrs from "./longStrings.ts";
// Initialize DB client
const dbClient = await new Client().connect({
@ -136,8 +139,8 @@ startBot({
// Calculates ping between sending a message and editing it, giving a nice round-trip latency.
try {
const m = await message.send("Ping?");
m.edit(`Pong! Latency is ${m.timestamp - message.timestamp}ms.`);
const m = await message.send(generatePing(-1));
m.edit(generatePing(m.timestamp - message.timestamp));
} catch (e) {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
}
@ -151,7 +154,7 @@ startBot({
utils.log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
message.send("The Artificer was built in memory of my Grandmother, Babka\nWith much love, Ean\n\nDecember 21, 2020").catch(e => {
message.send(constantCmds.rip).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -164,7 +167,7 @@ startBot({
utils.log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
message.send(longStrs.rollhelp.join("\n")).catch(e => {
message.send(constantCmds.rollHelp).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -177,7 +180,7 @@ startBot({
utils.log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
message.send(longStrs.help.join("\n")).catch(e => {
message.send(constantCmds.help).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -190,7 +193,7 @@ startBot({
utils.log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
message.send(longStrs.info.join("\n")).catch(e => {
message.send(constantCmds.info).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -203,7 +206,7 @@ startBot({
utils.log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
message.send(longStrs.privacy.join("\n")).catch(e => {
message.send(constantCmds.privacy).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -216,7 +219,7 @@ startBot({
utils.log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
message.send(`My current version is ${config.version}.`).catch(e => {
message.send(constantCmds.version).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -229,10 +232,10 @@ startBot({
utils.log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
sendMessage(config.reportChannel, (`USER REPORT:\n${args.join(" ")}`)).catch(e => {
sendMessage(config.reportChannel, generateReport(args.join(" "))).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
message.send("Failed command has been reported to my developer.\n\nFor more in depth support, and information about planned maintenance, please join the support server here: https://discord.gg/peHASXMZYv").catch(e => {
message.send(constantCmds.report).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -255,25 +258,28 @@ startBot({
const rolls = BigInt(rollQuery[0].count);
const total = BigInt(totalQuery[0].count);
message.send(`${config.name} is rolling dice for ${cache.members.size} active users, in ${cache.channels.size} channels of ${cache.guilds.size} servers.\n\nSo far, ${rolls} dice have been rolled and ${total - rolls} utility commands have been run.`).catch(e => {
const cachedGuilds = await cacheHandlers.size("guilds");
const cachedChannels = await cacheHandlers.size("channels");
const cachedMembers = await cacheHandlers.size("members");
message.send(generateStats(cachedGuilds + cache.dispatchedGuildIds.size, cachedChannels + cache.dispatchedChannelIds.size, cachedMembers, rolls, total - rolls)).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
// [[api arg
// API sub commands
else if (command === "api" && args.length > 0) {
else if (command === "api") {
// Light telemetry to see how many times a command is being run
dbClient.execute(`CALL INC_CNT("api");`).catch(e => {
utils.log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
});
// Local apiArg in lowercase
const apiArg = args[0].toLowerCase();
const apiArg = (args[0] || "help").toLowerCase();
// Alert users who DM the bot that this command is for guilds only
if (message.guildId === 0n) {
message.send(`API commands are only available in guilds.`).catch(e => {
message.send(constantCmds.apiGuildOnly).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
return;
@ -284,7 +290,7 @@ startBot({
// [[api help
// Shows API help details
if (apiArg === "help") {
message.send(longStrs.apihelp.join("\n")).catch(e => {
message.send(constantCmds.apiHelp).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -294,7 +300,7 @@ startBot({
else if (apiArg === "allow" || apiArg === "block" || apiArg === "enable" || apiArg === "disable") {
const guildQuery = await dbClient.query(`SELECT guildid FROM allowed_guilds WHERE guildid = ?`, [message.guildId]).catch(e0 => {
utils.log(LT.ERROR, `Failed to query DB: ${JSON.stringify(e0)}`);
message.send(`Failed to ${apiArg} API rolls for this guild. If this issue persists, please report this to the developers.`).catch(e1 => {
message.send(generateApiFailed(apiArg)).catch(e1 => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e1)}`);
});
return;
@ -304,7 +310,7 @@ startBot({
// Since guild is not in our DB, add it in
await dbClient.execute(`INSERT INTO allowed_guilds(guildid,active) values(?,?)`, [BigInt(message.guildId), ((apiArg === "allow" || apiArg === "enable") ? 1 : 0)]).catch(e0 => {
utils.log(LT.ERROR, `Failed to insert into DB: ${JSON.stringify(e0)}`);
message.send(`Failed to ${apiArg} API rolls for this guild. If this issue persists, please report this to the developers.`).catch(e1 => {
message.send(generateApiFailed(apiArg)).catch(e1 => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e1)}`);
});
return;
@ -313,14 +319,14 @@ startBot({
// Since guild is in our DB, update it
await dbClient.execute(`UPDATE allowed_guilds SET active = ? WHERE guildid = ?`, [((apiArg === "allow" || apiArg === "enable") ? 1 : 0), BigInt(message.guildId)]).catch(e0 => {
utils.log(LT.ERROR, `Failed to update DB: ${JSON.stringify(e0)}`);
message.send(`Failed to ${apiArg} API rolls for this guild. If this issue persists, please report this to the developers.`).catch(e1 => {
message.send(generateApiFailed(apiArg)).catch(e1 => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e1)}`);
});
return;
});
}
// We won't get here if there's any errors, so we know it has bee successful, so report as such
message.send(`API rolls have successfully been ${apiArg}ed for this guild.`).catch(e => {
message.send(generateApiSuccess(apiArg)).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -330,14 +336,14 @@ startBot({
else if (apiArg === "delete") {
await dbClient.execute(`DELETE FROM allowed_guilds WHERE guildid = ?`, [message.guildId]).catch(e0 => {
utils.log(LT.ERROR, `Failed to query DB: ${JSON.stringify(e0)}`);
message.send(`Failed to delete this guild from the database. If this issue persists, please report this to the developers.`).catch(e1 => {
message.send(constantCmds.apiDeleteFail).catch(e1 => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e1)}`);
});
return;
});
// We won't get here if there's any errors, so we know it has bee successful, so report as such
message.send(`This guild's API setting has been removed from The Artifier's Database.`).catch(e => {
message.send(constantCmds.apiRemoveGuild).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -348,7 +354,7 @@ startBot({
// Get status of guild from the db
const guildQuery = await dbClient.query(`SELECT active, banned FROM allowed_guilds WHERE guildid = ?`, [message.guildId]).catch(e0 => {
utils.log(LT.ERROR, `Failed to query DB: ${JSON.stringify(e0)}`);
message.send(`Failed to check API rolls status for this guild. If this issue persists, please report this to the developers.`).catch(e1 => {
message.send(constantCmds.apiStatusFail).catch(e1 => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e1)}`);
});
return;
@ -358,23 +364,23 @@ startBot({
if (guildQuery.length > 0) {
// Check if guild is banned from using API and return appropriate message
if (guildQuery[0].banned) {
message.send(`The Artificer's API is ${config.api.enable ? "currently enabled" : "currently disabled"}.\n\nAPI rolls are banned from being used in this guild. This will not be reversed.`).catch(e => {
message.send(generateApiStatus(true, false)).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
} else {
message.send(`The Artificer's API is ${config.api.enable ? "currently enabled" : "currently disabled"}.\n\nAPI rolls are ${guildQuery[0].active ? "allowed" : "blocked from being used"} in this guild.`).catch(e => {
message.send(generateApiStatus(false, guildQuery[0].active)).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
} else {
// Guild is not in DB, therefore they are blocked
message.send(`The Artificer's API is ${config.api.enable ? "currently enabled" : "currently disabled"}.\n\nAPI rolls are blocked from being used in this guild.`).catch(e => {
message.send(generateApiStatus(false, false)).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
}
} else {
message.send(`API commands are powerful and can only be used by guild Owners and Admins.\n\nFor information on how to use the API, please check the GitHub README for more information: <https://github.com/Burn-E99/TheArtificer>`).catch(e => {
message.send(constantCmds.apiPermError).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
}
@ -390,7 +396,7 @@ startBot({
// If DEVMODE is on, only allow this command to be used in the devServer
if (DEVMODE && message.guildId !== config.devServer) {
message.send("Command is in development, please try again later.").catch(e => {
message.send(constantCmds.indev).catch(e => {
utils.log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`);
});
return;
@ -400,7 +406,7 @@ startBot({
try {
const originalCommand = `${config.prefix}${command} ${args.join(" ")}`;
const m = await message.send("Rolling...");
const m = await message.send(constantCmds.rolling);
const modifiers = {
noDetails: false,
@ -547,19 +553,21 @@ startBot({
if (b.size > 8388290) {
// Update return text
// todo: embedify
returnText = `<@${message.authorId}>${returnmsg.line1}\n${returnmsg.line2}\nFull details could not be attached to this messaged as a \`.txt\` file as the file would be too large for Discord to handle. If you would like to see the details of rolls, please send the rolls in multiple messages instead of bundled into one.`;
// Attempt to DM the GMs and send a warning if it could not DM a GM
await sendDirectMessage(BigInt(e.substr(2, (e.length - 3))), returnText).catch(() => {
message.send(`WARNING: ${e} could not be messaged. If this issue persists, make sure direct messages are allowed from this server.`);
message.send(generateDMFailed(e));
});
} else {
// Update return text
// Update return
// todo: embedify
returnText = `<@${message.authorId}>${returnmsg.line1}\n${returnmsg.line2}\nFull details have been attached to this messaged as a \`.txt\` file for verification purposes.`;
// Attempt to DM the GMs and send a warning if it could not DM a GM
await sendDirectMessage(BigInt(e.substr(2, (e.length - 3))), { "content": returnText, "file": { "blob": b, "name": "rollDetails.txt" } }).catch(() => {
message.send(`WARNING: ${e} could not be messaged. If this issue persists, make sure direct messages are allowed from this server.`);
message.send(generateDMFailed(e));
});
}
});
@ -592,6 +600,7 @@ startBot({
// Remove the original message to send new one with attachment
m.delete();
// todo: embedify
await message.send({ "content": returnText, "file": { "blob": b, "name": "rollDetails.txt" } });
}
} else {

View File

@ -22,10 +22,13 @@ import {
import solver from "./solver.ts";
import { LogTypes as LT } from "./utils.enums.ts";
import utils from "./utils.ts";
import {
generateApiKeyEmail, generateApiDeleteEmail, generateDMFailed
} from "./constantCmds.ts";
import config from "../config.ts";
// start(databaseClient, botCache, sendMessage, sendDirectMessage) returns nothing
// start(databaseClient) returns nothing
// start initializes and runs the entire API for the bot
const start = async (dbClient: Client): Promise<void> => {
const server = Deno.listen({ port: config.api.port });
@ -291,11 +294,13 @@ const start = async (dbClient: Client): Promise<void> => {
// Send the return message as a DM or normal message depening on if the channel is set
if ((query.get("channel") || "").length > 0) {
// todo: embedify
m = await sendMessage(BigInt(query.get("channel") || ""), normalText).catch(() => {
requestEvent.respondWith(new Response("Message 00 failed to send.", { status: Status.InternalServerError }));
errorOut = true;
});
} else {
// todo: embedify
m = await sendDirectMessage(BigInt(query.get("user") || ""), normalText).catch(() => {
requestEvent.respondWith(new Response("Message 01 failed to send.", { status: Status.InternalServerError }));
errorOut = true;
@ -320,7 +325,7 @@ const start = async (dbClient: Client): Promise<void> => {
utils.log(LT.LOG, `Messaging GM ${e} roll results`);
// Attempt to DM the GMs and send a warning if it could not DM a GM
await sendDirectMessage(BigInt(e), newMessage).catch(async () => {
const failedSend = `WARNING: <@${e}> could not be messaged. If this issue persists, make sure direct messages are allowed from this server.`
const failedSend = generateDMFailed(e);
// Send the return message as a DM or normal message depening on if the channel is set
if ((query.get("channel") || "").length > 0) {
m = await sendMessage(BigInt(query.get("channel") || ""), failedSend).catch(() => {
@ -349,6 +354,7 @@ const start = async (dbClient: Client): Promise<void> => {
break;
}
} else {
// todo: embedify
const newMessage: CreateMessage = {};
newMessage.content = returnText;
@ -644,7 +650,7 @@ const start = async (dbClient: Client): Promise<void> => {
}
// "Send" the email
await sendMessage(config.api.email, `<@${config.api.admin}> A USER HAS REQUESTED A DELETE CODE\n\nEmail Address: ${apiUserEmail}\n\nSubject: \`Artificer API Delete Code\`\n\n\`\`\`Hello Artificer API User,\n\nI am sorry to see you go. If you would like, please respond to this email detailing what I could have done better.\n\nAs requested, here is your delete code: ${deleteCode}\n\nSorry to see you go,\nThe Artificer Developer - Ean Milligan\`\`\``).catch(() => {
await sendMessage(config.api.email, generateApiDeleteEmail(apiUserEmail, deleteCode)).catch(() => {
requestEvent.respondWith(new Response("Message 30 failed to send.", { status: Status.InternalServerError }));
erroredOut = true;
});
@ -721,7 +727,7 @@ const start = async (dbClient: Client): Promise<void> => {
}
// "Send" the email
await sendMessage(config.api.email, `<@${config.api.admin}> A USER HAS REQUESTED AN API KEY\n\nEmail Address: ${query.get("email")}\n\nSubject: \`Artificer API Key\`\n\n\`\`\`Hello Artificer API User,\n\nWelcome aboard The Artificer's API. You can find full details about the API on the GitHub: https://github.com/Burn-E99/TheArtificer\n\nYour API Key is: ${newKey}\n\nGuard this well, as there is zero tolerance for API abuse.\n\nWelcome aboard,\nThe Artificer Developer - Ean Milligan\`\`\``).catch(() => {
await sendMessage(config.api.email, generateApiKeyEmail(query.get("email") || "no email", newKey)).catch(() => {
requestEvent.respondWith(new Response("Message 31 failed to send.", { status: Status.InternalServerError }));
erroredOut = true;
});

428
src/constantCmds.ts Normal file
View File

@ -0,0 +1,428 @@
import config from "../config.ts";
export const constantCmds = {
apiDeleteFail: {
embeds: [{
fields: [{
name: "Failed to delete this guild from the database.",
value: "If this issue persists, please report this to the developers."
}]
}]
},
apiGuildOnly: {
embeds: [{
title: "API commands are only available in guilds."
}]
},
apiHelp: {
embeds: [
{
fields: [
{
name: "The Artificer's API Details:",
value: `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.
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](https://github.com/Burn-E99/TheArtificer).
You may enable and disable the API rolls for your guild as needed.`
}
]
}, {
title: "Available API Commands:",
fields: [
{
name: "[[api help",
value: "This command",
inline: true
}, {
name: "[[api status",
value: "Shows the current status of the API for this guild",
inline: true
}, {
name: "[[api allow/enable",
value: "Allows API Rolls to be sent to this guild",
inline: true
}, {
name: "[[api block/disable",
value: "Blocks API Rolls from being sent to this guild",
inline: true
}, {
name: "[[api delete",
value: "Deletes this guild from The Artificer's database",
inline: true
}
]
}
]
},
apiPermError: {
embeds: [{
fields: [{
name: "API commands are powerful and can only be used by guild Owners and Admins.",
value: "For information on how to use the API, please check the GitHub README for more information [here](https://github.com/Burn-E99/TheArtificer)."
}]
}]
},
apiRemoveGuild: {
embeds: [{
title: "This guild's API setting has been removed from The Artifier's Database."
}]
},
apiStatusFail: {
embeds: [{
fields: [{
name: "Failed to check API rolls status for this guild.",
value: "If this issue persists, please report this to the developers."
}]
}]
},
help: {
embeds: [{
title: "The Artificer's Available Commands:",
fields: [
{
name: "[[?",
value: "This command",
inline: true
}, {
name: "[[rollhelp or [[??",
value: "Details on how to use the roll command, listed as `[[xdy...]]` below",
inline: true
}, {
name: "[[api [subcommand]",
value: "Administrative tools for the bots's API, run [[api help for more details",
inline: true
}, {
name: "[[ping",
value: "Pings the bot to check connectivity",
inline: true
}, {
name: "[[info",
value: "Prints some information and links relating to the bot",
inline: true
}, {
name: "[[privacy",
value: "Prints some information about the Privacy Policy",
inline: true
}, {
name: "[[version",
value: "Prints the bots version",
inline: true
}, {
name: "[[popcat",
value: "Popcat",
inline: true
}, {
name: "[[report [text]",
value: "Report a command that failed to run",
inline: true
}, {
name: "[[stats",
value: "Statistics on the bot",
inline: true
}, {
name: "[[xdydzracsq!]] ...",
value: "Rolls all configs requested, you may repeat the command multiple times in the same message (just ensure you close each roll with ]]), run [[?? for more details",
inline: true
}
]
}]
},
indev: {
embeds: [{
title: "Command is in development, please try again later."
}]
},
info: {
embeds: [{
fields: [{
name: "The Artificer, a Discord bot that specializing in rolling dice and calculating math",
value: `The Artificer is developed by Ean AKA Burn_E99.
Additional information can be found on my website [here](https://discord.burne99.com/TheArtificer/).
Want to check out my source code? Check it out [here](https://github.com/Burn-E99/TheArtificer).
Need help with this bot? Join my support server [here](https://discord.gg/peHASXMZYv).`
}]
}]
},
privacy: {
embeds: [{
title: "Privacy Policy",
fields: [{
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 \`[[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).
Terms of Service can also be found on GitHub [here](https://github.com/Burn-E99/TheArtificer/blob/master/TERMS.md).`
}]
}]
},
report: {
embeds: [{
fields: [{
name: "Failed command has been reported to my developer.",
value: `For more in depth support, and information about planned maintenance, please join the support server [here](https://discord.gg/peHASXMZYv).`
}]
}]
},
rip: {
embeds: [{
fields: [{
name: "The Artificer was built in memory of my Grandmother, Babka",
value: `With much love, Ean
December 21, 2020`
}]
}]
},
rollHelp: {
embeds: [
{
title: "The Artificer's Roll Command Details:",
fields: [
{
name: "Details:",
value: `You can chain as many of these options as you want, as long as the option does not disallow it.
This command also can fully solve math equations with parenthesis.`
}, {
name: "[[xdydzracsq!]] ...",
value: "Rolls all configs requested, you may repeat the command multiple times in the same message (just ensure you close each roll with ]])",
inline: true
}, {
name: "x [Optional]",
value: "Number of dice to roll, if omitted, 1 is used",
inline: true
}, {
name: "dy [Required]",
value: "Size of dice to roll, d20 = 20 sided die",
inline: true
}, {
name: "dz or dlz [Optional]",
value: "Drops the lowest z dice, cannot be used with kz",
inline: true
}, {
name: "kz or khz [Optional]",
value: "Keeps the highest z dice, cannot be used with dz",
inline: true
}, {
name: "dhz [Optional]",
value: "Drops the highest z dice, cannot be used with kz",
inline: true
}, {
name: "klz [Optional]",
value: "Keeps the lowest z dice, cannot be used with dz",
inline: true
}, {
name: "ra [Optional]",
value: "Rerolls any rolls that match a, r3 will reroll any dice that land on 3, throwing out old rolls",
inline: true
}, {
name: "csq or cs=q [Optional]",
value: "Changes crit score to q",
inline: true
}, {
name: "cs<q [Optional]",
value: "Changes crit score to be less than or equal to q",
inline: true
}, {
name: "cs>q [Optional]",
value: "Changes crit score to be greater than or equal to q",
inline: true
}, {
name: "cfq or cf=q [Optional]",
value: "Changes crit fail to q",
inline: true
}, {
name: "cf<q [Optional]",
value: "Changes crit fail to be less than or equal to q",
inline: true
}, {
name: "cf>q [Optional]",
value: "Changes crit fail to be greater than or equal to q",
inline: true
}, {
name: "! [Optional]",
value: "Exploding, rolls another dy for every crit roll",
inline: true
}
]
}, {
title: "Roll Command Flags:",
fields: [
{
name: "Details",
value: `This command also has some useful flags that can used. These flags simply need to be placed after all rolls in the message.
Examples: \`[[d20]] -nd\`, \`[[d20]] -nd -s\``
}, {
name: "-nd",
value: "No Details - Suppresses all details of the requested roll",
inline: true
}, {
name: "-s",
value: "Spoiler - Spoilers all details of the requested roll",
inline: true
}, {
name: "-m",
value: "Maximize Roll - Rolls the theoretical maximum roll, cannot be used with -n",
inline: true
}, {
name: "-n",
value: "Nominal Roll - Rolls the theoretical nominal roll, cannot be used with -m",
inline: true
}, {
name: "-gm @user1 @user2 @usern",
value: "GM Roll - 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
}, {
name: "-o a or -o d",
value: "Order Roll - Rolls the requested roll and orders the results in the requested direction",
inline: true
}
]
}
]
},
rolling: {
embeds: [{
title: "Rolling. . ."
}]
},
version: {
embeds: [{
title: `My current version is ${config.version}`
}]
}
};
export const generatePing = (time: number) => ({
embeds: [{
title: time === -1 ? "Ping?" : `Pong! Latency is ${time}ms.`
}]
});
export const generateReport = (msg: string) => ({
embeds: [{
fields: [{
name: "USER REPORT:",
value: msg || "No message"
}]
}]
});
export const generateStats = (guildCount: number, channelCount: number, memberCount: number, rollCount: bigint, utilityCount: bigint) => ({
embeds: [{
title: "The Artificer's Statistics:",
fields: [
{
name: "Guilds:",
value: `${guildCount}`,
inline: true
}, {
name: "Channels:",
value: `${channelCount}`,
inline: true
}, {
name: "Active Members:",
value: `${memberCount}`,
inline: true
}, {
name: "Roll Commands:",
value: `${rollCount}`,
inline: true
}, {
name: "Utility Commands:",
value: `${utilityCount}`,
inline: true
}
]
}]
});
export const generateApiFailed = (args: string) => ({
embeds: [{
fields: [{
name: `Failed to ${args} API rolls for this guild.`,
value: "If this issue persists, please report this to the developers."
}]
}]
});
export const generateApiStatus = (banned: boolean, active: boolean) => ({
embeds: [{
fields: [{
name: `The Artificer's API is ${config.api.enable ? "currently enabled" : "currently disabled"}.`,
value: banned ? "API rolls are banned from being used in this guild.\n\nThis will not be reversed." : `API rolls are ${active ? "allowed" : "blocked from being used"} in this guild.`
}]
}]
});
export const generateApiSuccess = (args: string) => ({
embeds: [{
title: `API rolls have successfully been ${args}ed for this guild.`
}]
});
export const generateDMFailed = (user: string) => ({
embeds: [{
fields: [{
name: `WARNING: ${user} could not be messaged.`,
value: "If this issue persists, make sure direct messages are allowed from this server."
}]
}]
});
export const generateApiKeyEmail = (email: string, key: string) => ({
content: `<@${config.api.admin}> A USER HAS REQUESTED AN API KEY`,
embeds: [{
fields: [
{
name: "Send to:",
value: email
}, {
name: "Subject:",
value: "Artificer API Key"
}, {
name: "Body:",
value: `Hello Artificer API User,
Welcome aboard The Artificer's API. You can find full details about the API on the GitHub: https://github.com/Burn-E99/TheArtificer
Your API Key is: ${key}
Guard this well, as there is zero tolerance for API abuse.
Welcome aboard,
The Artificer Developer - Ean Milligan`
}
]
}]
});
export const generateApiDeleteEmail = (email: string, deleteCode: string) => ({
content: `<@${config.api.admin}> A USER HAS REQUESTED A DELETE CODE`,
embeds: [{
fields: [
{
name: "Send to:",
value: email
}, {
name: "Subject:",
value: "Artificer API Delete Code"
}, {
name: "Body:",
value: `Hello Artificer 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,
The Artificer Developer - Ean Milligan`
}
]
}]
});

View File

@ -122,7 +122,7 @@
Built by <a href="https://github.com/Burn-E99/" target="_blank">Ean Milligan</a>
</div>
<div id="footer-right">
Version 1.4.3
Version 2.0.0
</div>
</div>
</div>

View File

@ -94,7 +94,7 @@
Built by <a href="https://github.com/Burn-E99/" target="_blank">Ean Milligan</a>
</div>
<div id="footer-right">
Version 1.4.3
Version 2.0.0
</div>
</div>
</div>