Reimplement the roll decorators help commands as a shortcut to the roll decorators help home page, migrate all old help pages to new help library
This commit is contained in:
parent
79d72654e2
commit
b0401809c4
|
@ -2,6 +2,8 @@ import { DiscordenoMessage } from '@discordeno';
|
||||||
|
|
||||||
import aliasCommands from 'commands/aliasCmd/_index.ts';
|
import aliasCommands from 'commands/aliasCmd/_index.ts';
|
||||||
|
|
||||||
|
import { generateHelpMessage } from 'commands/helpLibrary/generateHelpMessage.ts';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
|
@ -44,7 +46,7 @@ export const alias = (message: DiscordenoMessage, argSpaces: string[]) => {
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
case '':
|
case '':
|
||||||
aliasCommands.help(message, guildMode);
|
message.send(generateHelpMessage('alias')).catch((e: Error) => utils.commonLoggers.messageSendError('aliasCmd.ts:47', message, e));
|
||||||
break;
|
break;
|
||||||
case 'list':
|
case 'list':
|
||||||
case 'list-all':
|
case 'list-all':
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { add, update } from 'commands/aliasCmd/aliasAddUpdate.ts';
|
import { add, update } from 'commands/aliasCmd/aliasAddUpdate.ts';
|
||||||
import { clone } from 'commands/aliasCmd/clone.ts';
|
import { clone } from 'commands/aliasCmd/clone.ts';
|
||||||
import { deleteAll, deleteOne } from 'commands/aliasCmd/aliasDelete.ts';
|
import { deleteAll, deleteOne } from 'commands/aliasCmd/aliasDelete.ts';
|
||||||
import { help } from 'commands/aliasCmd/aliasHelp.ts';
|
|
||||||
import { list } from 'commands/aliasCmd/list.ts';
|
import { list } from 'commands/aliasCmd/list.ts';
|
||||||
import { rename } from 'commands/aliasCmd/rename.ts';
|
import { rename } from 'commands/aliasCmd/rename.ts';
|
||||||
import { run } from 'commands/aliasCmd/run.ts';
|
import { run } from 'commands/aliasCmd/run.ts';
|
||||||
|
@ -12,7 +11,6 @@ export default {
|
||||||
clone,
|
clone,
|
||||||
deleteAll,
|
deleteAll,
|
||||||
deleteOne,
|
deleteOne,
|
||||||
help,
|
|
||||||
list,
|
list,
|
||||||
rename,
|
rename,
|
||||||
run,
|
run,
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
import { DiscordenoMessage } from '@discordeno';
|
|
||||||
|
|
||||||
import config from '~config';
|
|
||||||
|
|
||||||
import { ReservedWords } from 'commands/aliasCmd/reservedWords.ts';
|
|
||||||
|
|
||||||
import { infoColor1, infoColor2 } from 'embeds/colors.ts';
|
|
||||||
|
|
||||||
export const help = (message: DiscordenoMessage, guildMode: boolean) => {
|
|
||||||
message.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor2,
|
|
||||||
title: `${config.name}'s Roll Alias System Details:`,
|
|
||||||
description: `This system allows you to save any roll string to a short, custom, memorable alias.
|
|
||||||
|
|
||||||
Currently, you may create up to \`${config.limits.alias.free.guild.toLocaleString()}\` per guild and \`${config.limits.alias.free.user.toLocaleString()}\` per user account. This limit may increase or decrease in the future.
|
|
||||||
|
|
||||||
Aliases are case-insensitive (\`tEsT\` is stored as \`test\`, but can still be called as \`tEsT\`), have a max allowed length of \`${config.limits.alias.maxNameLength}\`, cannot include any spaces, and are not allowed to be named any of the following: \`${
|
|
||||||
ReservedWords.join('`, `')
|
|
||||||
}\``,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
color: infoColor1,
|
|
||||||
title: 'Available Alias Commands:',
|
|
||||||
description: `- If a command has an option listed like \`help/h/?\`, this means \`help\`, \`h\`, and \`?\` are all valid options for the command.
|
|
||||||
- \`[alias]\` indicates where you should put the desired alias to add, update, delete, or run.
|
|
||||||
- \`[rollstr...]\` indicates where you should put the roll string for add/ing/updating an alias.
|
|
||||||
- \`[yVars...?]\` indicates where you should put any numeric parameters needed for running the desired alias, separated by spaces. If none are needed, omit this list.
|
|
||||||
|
|
||||||
All commands below are shown using the shorthand version of the Roll Alias command, but \`${config.prefix}rollalias\`, \`${config.prefix}ralias\`, \`${config.prefix}alias\`, and \`${config.prefix}rolla\` also work.
|
|
||||||
|
|
||||||
To view ${guildMode ? '' : 'non-'}guild mode commands, please run \`${config.prefix}ra ${guildMode ? '' : 'guild '}help\``,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}help/h/?\``,
|
|
||||||
value: 'This command.',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}add/create/set [alias] [rollstr...]\``,
|
|
||||||
value: `Creates a new alias with the specified roll string. This is saved for use ${guildMode ? 'in only this guild' : 'by your account'}.`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}list/list-all\``,
|
|
||||||
value: `Lists all aliases and their number of yVars created ${guildMode ? 'in this guild' : 'by you'}.`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}preview/view [alias]\``,
|
|
||||||
value: `Shows the saved roll string for the specified ${guildMode ? 'guild ' : ''}alias.`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}update/replace [alias] [rollstr...]\``,
|
|
||||||
value: `Updates the specified alias to the new roll string. This overwrites the alias saved ${guildMode ? 'in this guild' : 'to your account'}.`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}delete/remove [alias]\``,
|
|
||||||
value: `Deletes the specified alias from ${guildMode ? 'this guild' : 'your account'}. This is a permanent deletion and cannot be undone.`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}delete-all/remove-all\``,
|
|
||||||
value: `Deletes all aliases saved to ${guildMode ? 'this guild' : 'your account'}. This is a permanent deletion and cannot be undone.`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}clone/copy [alias]`,
|
|
||||||
value: `Copies the specified alias from ${guildMode ? 'this guild' : 'your account'} to ${guildMode ? 'your account' : 'this guild'}.`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}rename [oldAliasName] [newAliasName]`,
|
|
||||||
value: `Renames the specified alias in ${guildMode ? 'this guild' : 'your account'}.`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ra ${guildMode ? 'guild ' : ''}[alias] [yVars...?]\` or \`${config.prefix}ra ${guildMode ? 'guild ' : ''}run/execute [alias] [yVars...?]\``,
|
|
||||||
value: `Runs the specified ${guildMode ? 'guild ' : ''}alias with the provided yVars. yVars are only required if the alias specified requires them.`,
|
|
||||||
inline: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -4,6 +4,8 @@ import config from '~config';
|
||||||
|
|
||||||
import apiCommands from 'commands/apiCmd/_index.ts';
|
import apiCommands from 'commands/apiCmd/_index.ts';
|
||||||
|
|
||||||
|
import { generateHelpMessage } from 'commands/helpLibrary/generateHelpMessage.ts';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
|
@ -40,7 +42,7 @@ export const api = async (message: DiscordenoMessage, args: string[]) => {
|
||||||
case 'h':
|
case 'h':
|
||||||
// [[api help
|
// [[api help
|
||||||
// Shows API help details
|
// Shows API help details
|
||||||
apiCommands.help(message);
|
message.send(generateHelpMessage('api')).catch((e: Error) => utils.commonLoggers.messageSendError('apiCmd.ts:44', message, e));
|
||||||
break;
|
break;
|
||||||
case 'allow':
|
case 'allow':
|
||||||
case 'block':
|
case 'block':
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import { allowBlock } from 'commands/apiCmd/allowBlock.ts';
|
import { allowBlock } from 'commands/apiCmd/allowBlock.ts';
|
||||||
import { help } from 'commands/apiCmd/apiHelp.ts';
|
|
||||||
import { deleteGuild } from 'commands/apiCmd/deleteGuild.ts';
|
import { deleteGuild } from 'commands/apiCmd/deleteGuild.ts';
|
||||||
import { showHideWarn } from 'commands/apiCmd/showHideWarn.ts';
|
import { showHideWarn } from 'commands/apiCmd/showHideWarn.ts';
|
||||||
import { status } from 'commands/apiCmd/status.ts';
|
import { status } from 'commands/apiCmd/status.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
allowBlock,
|
allowBlock,
|
||||||
help,
|
|
||||||
deleteGuild,
|
deleteGuild,
|
||||||
showHideWarn,
|
showHideWarn,
|
||||||
status,
|
status,
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
import { DiscordenoMessage } from '@discordeno';
|
|
||||||
|
|
||||||
import config from '~config';
|
|
||||||
|
|
||||||
import { infoColor1, infoColor2 } from 'embeds/colors.ts';
|
|
||||||
|
|
||||||
import utils from 'utils/utils.ts';
|
|
||||||
|
|
||||||
export const help = (message: DiscordenoMessage) => {
|
|
||||||
message
|
|
||||||
.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor2,
|
|
||||||
title: `${config.name}'s API Details:`,
|
|
||||||
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.
|
|
||||||
|
|
||||||
For information on how to use the API, please check the GitHub README for more information [here](${config.links.sourceCode}).
|
|
||||||
|
|
||||||
You may enable and disable the API rolls for your guild as needed.`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
color: infoColor1,
|
|
||||||
title: 'Available API Commands:',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}api help\``,
|
|
||||||
value: 'This command',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}api status\``,
|
|
||||||
value: 'Shows the current status of the API for the channel this was run in',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}api allow/enable\``,
|
|
||||||
value: 'Allows API Rolls to be sent to the channel this was run in',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}api block/disable\``,
|
|
||||||
value: 'Blocks API Rolls from being sent to the channel this was run in',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}api delete\``,
|
|
||||||
value: `Deletes this channel's settings from ${config.name}'s database`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}api show-warn\``,
|
|
||||||
value: 'Shows the API warning on all rolls sent to the channel this was run in',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}api hide-warn\``,
|
|
||||||
value: 'Hides the API warning on all rolls sent to the channel this was run in',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
.catch((e: Error) => utils.commonLoggers.messageSendError('apiHelp.ts:67', message, e));
|
|
||||||
};
|
|
|
@ -1,109 +1,14 @@
|
||||||
import { DiscordenoMessage } from '@discordeno';
|
import { DiscordenoMessage } from '@discordeno';
|
||||||
|
|
||||||
import config from '~config';
|
import { generateHelpMessage } from 'commands/helpLibrary/generateHelpMessage.ts';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { infoColor2 } from 'embeds/colors.ts';
|
|
||||||
|
|
||||||
import utils from 'utils/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
|
||||||
dbClient.execute(queries.callIncCnt('help')).catch((e) => utils.commonLoggers.dbError('help.ts:15', 'call sproc INC_CNT on', e));
|
dbClient.execute(queries.callIncCnt('help')).catch((e) => utils.commonLoggers.dbError('help.ts:15', 'call sproc INC_CNT on', e));
|
||||||
|
message.send(generateHelpMessage()).catch((e: Error) => utils.commonLoggers.messageSendError('help.ts:16', message, e));
|
||||||
message
|
|
||||||
.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor2,
|
|
||||||
title: `${config.name}'s Available Commands:`,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}?\``,
|
|
||||||
value: 'This command',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}rollhelp\` or \`${config.prefix}??\``,
|
|
||||||
value: `Details on how to use the roll command, listed as \`${config.prefix}xdy...${config.postfix}\` below`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}api [subcommand]\``,
|
|
||||||
value: `Administrative tools for the bots's API, run \`${config.prefix}api help\` for more details`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}ping\``,
|
|
||||||
value: 'Pings the bot to check connectivity',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}info\``,
|
|
||||||
value: 'Prints some information and links relating to the bot',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}privacy\``,
|
|
||||||
value: 'Prints some information about the Privacy Policy',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}version\``,
|
|
||||||
value: 'Prints the bots version',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}popcat\``,
|
|
||||||
value: 'Popcat',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}report [text]\``,
|
|
||||||
value: 'Report a command that failed to run',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}stats\``,
|
|
||||||
value: 'Statistics on the bot',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}heatmap\``,
|
|
||||||
value: 'Heatmap of when the roll command is run the most',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}opt-out\` or \`${config.prefix}ignore-me\``,
|
|
||||||
value: 'Adds you to an ignore list so the bot will never respond to you',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}opt-in\` **Available via DM ONLY**`,
|
|
||||||
value: 'Removes you from the ignore list',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}inline [subcommand]\``,
|
|
||||||
value: `Controls whether or not inline rolls can be done in a guild, run \`${config.prefix}inline help\` for more details`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}rollalias [subcommand]\` or \`${config.prefix}ra [subcommand]\``,
|
|
||||||
value: `Custom Roll Alias System, run \`${config.prefix}ra help\` for more details`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
.catch((e: Error) => utils.commonLoggers.messageSendError('help.ts:82', message, e));
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
import config from '~config';
|
||||||
|
|
||||||
|
import { RollAliasHelpPages } from 'commands/helpLibrary/aliasHelp.ts';
|
||||||
|
import { ApiHelpPages } from 'commands/helpLibrary/apiHelp.ts';
|
||||||
|
import { HelpContents, HelpPage } from 'commands/helpLibrary/helpLibrary.d.ts';
|
||||||
|
import { InlineHelpPages } from 'commands/helpLibrary/inlineHelp.ts';
|
||||||
|
|
||||||
|
import { RootRollHelpPages } from 'commands/helpLibrary/rollHelp/_rootRollHelp.ts';
|
||||||
|
|
||||||
|
const name = `${config.name}'s Help Library`;
|
||||||
|
const description = 'Please use the dropdown menus below to get help on any commands you need assistance with.';
|
||||||
|
const dict = new Map<string, HelpPage | HelpContents>([
|
||||||
|
['roll-help', RootRollHelpPages],
|
||||||
|
['alias', RollAliasHelpPages],
|
||||||
|
['inline', InlineHelpPages],
|
||||||
|
[
|
||||||
|
'opt-out',
|
||||||
|
{
|
||||||
|
name: 'Opt Out',
|
||||||
|
description: `**Usage:** \`${config.prefix}opt-out\` or \`${config.prefix}ignore-me\`
|
||||||
|
|
||||||
|
Adds you to an ignore list so the bot will never respond to you.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'opt-in',
|
||||||
|
{
|
||||||
|
name: 'Opt In',
|
||||||
|
description: `**Usage:** \`${config.prefix}opt-in\`
|
||||||
|
|
||||||
|
Removes you from the ignore list.
|
||||||
|
|
||||||
|
**Notice:** This command is only available while Direct Messaging @$.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'info',
|
||||||
|
{
|
||||||
|
name: 'Info/About',
|
||||||
|
description: `**Usage:** \`${config.prefix}info\` or \`${config.prefix}i\`
|
||||||
|
|
||||||
|
Displays information about ${config.name} and its developer.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'report',
|
||||||
|
{
|
||||||
|
name: 'Report an Issue',
|
||||||
|
description: `**Usage:** \`${config.prefix}report [text]\` or \`${config.prefix}re [text]\`
|
||||||
|
|
||||||
|
Report an issue or feature request to ${config.name}'s developer.
|
||||||
|
|
||||||
|
**Notice:** \`[text]\` will be sent to a private Discord channel that only ${config.name} and its developer can see.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'stats',
|
||||||
|
{
|
||||||
|
name: 'Statistics',
|
||||||
|
description: `**Usage:** \`${config.prefix}stats\` or \`${config.prefix}s\`
|
||||||
|
|
||||||
|
Displays basic statistics on ${config.name}'s usage.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'heatmap',
|
||||||
|
{
|
||||||
|
name: 'Roll Heatmap',
|
||||||
|
description: `**Usage:** \`${config.prefix}heatmap\` or \`${config.prefix}hm\`
|
||||||
|
|
||||||
|
Displays a heatmap showing when rolls are happening across a week.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
['api', ApiHelpPages],
|
||||||
|
[
|
||||||
|
'version',
|
||||||
|
{
|
||||||
|
name: 'Version',
|
||||||
|
description: `**Usage:** \`${config.prefix}version\` or \`${config.prefix}v\`
|
||||||
|
|
||||||
|
Displays the current version of ${config.name}.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'privacy',
|
||||||
|
{
|
||||||
|
name: 'Privacy/Terms of Service',
|
||||||
|
description: `**Usage:** \`${config.prefix}privacy\` or \`${config.prefix}tos\`
|
||||||
|
|
||||||
|
Displays a summary of the Privacy Policy and Terms of Service, along with links to the full documents.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'ping',
|
||||||
|
{
|
||||||
|
name: 'Ping!',
|
||||||
|
description: `**Usage:** \`${config.prefix}ping\`
|
||||||
|
|
||||||
|
Pings ${config.name} to see if its online and how responsive its connection to Discord's API is.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'help',
|
||||||
|
{
|
||||||
|
name: 'Help',
|
||||||
|
description: `**Usage:** \`${config.prefix}help\` or \`${config.prefix}h\` or \`${config.prefix}?\`
|
||||||
|
|
||||||
|
This command, opens an interactive help library for all commands.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const RootHelpPages: HelpPage = {
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
isPage: true,
|
||||||
|
dict,
|
||||||
|
};
|
|
@ -0,0 +1,227 @@
|
||||||
|
import config from '~config';
|
||||||
|
|
||||||
|
import { ReservedWords } from 'commands/aliasCmd/reservedWords.ts';
|
||||||
|
|
||||||
|
import { HelpContents, HelpPage } from 'commands/helpLibrary/helpLibrary.d.ts';
|
||||||
|
|
||||||
|
const nameRestrictions = `Alias names are case-insensitive (\`tEsT\` is stored as \`test\`, but can still be called as \`tEsT\`).
|
||||||
|
|
||||||
|
Alias Naming Restrictions:
|
||||||
|
- Max allowed length:\`${config.limits.alias.maxNameLength}\`
|
||||||
|
- Cannot include any spaces/whitespace/newlines
|
||||||
|
- Cannot be named any of the following words:
|
||||||
|
\`${ReservedWords.join('`, `')}\``;
|
||||||
|
|
||||||
|
const name = 'Roll Alias System';
|
||||||
|
const description = `This system allows you to save any roll string to a short, custom, memorable alias.
|
||||||
|
|
||||||
|
Currently, you may create up to \`${config.limits.alias.free.guild.toLocaleString()}\` per guild and \`${config.limits.alias.free.user.toLocaleString()}\` per user account. This limit may increase or decrease in the future.
|
||||||
|
|
||||||
|
The following commands are all linked to the Roll Alias System:
|
||||||
|
\`${config.prefix}rollalias\`, \`${config.prefix}ralias\`, \`${config.prefix}alias\`, \`${config.prefix}rolla\`, \`${config.prefix}ra\`
|
||||||
|
For simplicity, all help documents use \`${config.prefix}ra\`, but any of the other commands listed above are valid.
|
||||||
|
|
||||||
|
${nameRestrictions}`;
|
||||||
|
const dict = new Map<string, HelpContents>([
|
||||||
|
[
|
||||||
|
'run',
|
||||||
|
{
|
||||||
|
name: 'Run Alias',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra [aliasName] [yVars...?]\`
|
||||||
|
- \`${config.prefix}ra run [aliasName] [yVars...?]\`
|
||||||
|
- \`${config.prefix}ra execute [aliasName] [yVars...?]\`
|
||||||
|
**Guild Mode Usage:**
|
||||||
|
- \`${config.prefix}ra guild [aliasName] [yVars...?]\`
|
||||||
|
- \`${config.prefix}ra guild run [aliasName] [yVars...?]\`
|
||||||
|
- \`${config.prefix}ra guild execute [aliasName] [yVars...?]\`
|
||||||
|
|
||||||
|
**Params:**
|
||||||
|
- \`[aliasName]\` - The name of the alias you wish to run.
|
||||||
|
- \`[yVars...?]\` - List of numbers to use for required y variables. If no y variables are required for the alias, no y variables need to be listed.
|
||||||
|
|
||||||
|
Runs the specified personal or guild alias with the provided yVars. If an alias is not found in Personal Mode, this will check and use a guild alias if one exists.`,
|
||||||
|
example: [
|
||||||
|
'`[[ra simpleAlias` => Runs the alias `simpleAlias`. Will first check for a personal alias named `simpleAlias`, and if one is not found, will check the guild for one.',
|
||||||
|
'`[[ra run simpleAlias` => Runs the alias `simpleAlias`. Will first check for a personal alias named `complexAlias`, and if one is not found, will check the guild for one.',
|
||||||
|
'`[[ra guild simpleTest` => Explicitly runs the guild alias `simpleTest`.',
|
||||||
|
'`[[ra guild run simpleTest` => Explicitly runs the guild alias `simpleTest`.',
|
||||||
|
'`[[ra complexAlias 10 4 7` => Runs the alias `complexAlias` with `y0=10`, `y1=4`, and `y2=7`. Check out the `Roll Alias System > Add New Alias` help page to see how this one was initially created. Will first check for a personal alias named `complexAlias`, and if one is not found, will check the guild for one.',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'add',
|
||||||
|
{
|
||||||
|
name: 'Add New Alias',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra add [aliasName] [rollString...]\`
|
||||||
|
- \`${config.prefix}ra set [aliasName] [rollString...]\`
|
||||||
|
- \`${config.prefix}ra create [aliasName] [rollString...]\`
|
||||||
|
**Guild Mode Usage:** [Can be only used by Guild Owners/Admins!]
|
||||||
|
- \`${config.prefix}ra guild add [aliasName] [rollString...]\`
|
||||||
|
- \`${config.prefix}ra guild set [aliasName] [rollString...]\`
|
||||||
|
- \`${config.prefix}ra guild create [aliasName] [rollString...]\`
|
||||||
|
|
||||||
|
**Params:**
|
||||||
|
- \`[aliasName]\` - The name of the alias you wish to create.
|
||||||
|
- \`[rollString]\` - The roll string to save. This can include any valid roll command, and allows the usage of y variables that will be required by the alias.
|
||||||
|
|
||||||
|
Creates a new alias with the specified roll string. This is saved for use either to your personal account or to the guild the command was run in.`,
|
||||||
|
example: [
|
||||||
|
'`[[ra add simpleAlias [[4d20+5]] Random Text! [[4d6d1]]` => Saves `[[4d20+5]] Random Text! [[4d6d1]]` as a personal alias named `simpleAlias`',
|
||||||
|
'`[[ra guild add simpleTest Random Text! [[4d6d1]] [[4d20+5]]` => Saves `Random Text! [[4d6d1]] [[4d20+5]]` as a guild alias named `simpleTest`',
|
||||||
|
'',
|
||||||
|
'`[[ra add complexAlias Attack Roll: [[4d20+5+y0]]\nDamage Roll: [[y1 * 4d8 + y2]]`\nSaves `[[4d20+5+y0]]\nDamage Roll: [[y1 * 4d8 + y2]]` as a personal alias named `complexAlias` with 3 y variables (`y0`, `y1`, and `y2`). Check out the `Roll Alias System > Run Alias` help page to see how this one is run.',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'update',
|
||||||
|
{
|
||||||
|
name: 'Update Existing Alias',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra update [aliasName] [rollString...]\`
|
||||||
|
- \`${config.prefix}ra replace [aliasName] [rollString...]\`
|
||||||
|
**Guild Mode Usage:** [Can be only used by Guild Owners/Admins!]
|
||||||
|
- \`${config.prefix}ra guild update [aliasName] [rollString...]\`
|
||||||
|
- \`${config.prefix}ra guild replace [aliasName] [rollString...]\`
|
||||||
|
|
||||||
|
**Params:**
|
||||||
|
- \`[aliasName]\` - The name of the alias you wish to update.
|
||||||
|
- \`[rollString]\` - New roll string to update to. This can include any valid roll command, and allows the usage of y variables that will be required by the alias.
|
||||||
|
|
||||||
|
Updates the specified alias to the new roll string. This overwrites the alias saved to your personal account or to the guild the command was run in.`,
|
||||||
|
example: [
|
||||||
|
'`[[ra update simpleAlias [[20d7r3!]] TEXT -snd` => Saves `[[20d7r3!]] TEXT -snd` over the existing personal alias `simpleAlias`.',
|
||||||
|
'`[[ra guild update simpleTest [[8d%! + 40]]` => Saves `[[8d%! + 40]]` over the existing guild alias `simpleTest`.',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'list',
|
||||||
|
{
|
||||||
|
name: 'List All Aliases',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra list\`
|
||||||
|
- \`${config.prefix}ra list-all\`
|
||||||
|
**Guild Mode Usage:**
|
||||||
|
- \`${config.prefix}ra guild list\`
|
||||||
|
- \`${config.prefix}ra guild list-all\`
|
||||||
|
|
||||||
|
Lists all aliases (and their number of yVars) that are saved to your personal account or to the guild the command was run in.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'view',
|
||||||
|
{
|
||||||
|
name: 'Preview One Alias',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra preview [aliasName]\`
|
||||||
|
- \`${config.prefix}ra view [aliasName]\`
|
||||||
|
**Guild Mode Usage:**
|
||||||
|
- \`${config.prefix}ra guild preview [aliasName]\`
|
||||||
|
- \`${config.prefix}ra guild view [aliasName]\`
|
||||||
|
|
||||||
|
**Params:**
|
||||||
|
- \`[aliasName]\` - The name of the alias you wish to preview.
|
||||||
|
|
||||||
|
Shows the saved roll string for the specified personal or guild alias.`,
|
||||||
|
example: ['`[[ra preview testAlias`', '`[[ra guild preview testGuildAlias`'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'rename',
|
||||||
|
{
|
||||||
|
name: 'Rename Alias',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra rename [oldAliasName] [newAliasName]\`
|
||||||
|
**Guild Mode Usage:** [Can be only used by Guild Owners/Admins!]
|
||||||
|
- \`${config.prefix}ra guild rename [oldAliasName] [newAliasName]\`
|
||||||
|
|
||||||
|
**Params:**
|
||||||
|
- \`[oldAliasName]\` - The name of the alias you wish to rename.
|
||||||
|
- \`[newAliasName]\` - The new name of the alias.
|
||||||
|
|
||||||
|
Renames the specified alias saved to your personal account or to the guild the command was run in.`,
|
||||||
|
example: ['`[[ra rename testAlias newName`', '`[[ra guild rename testGuildAlias newNameToo`'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'clone',
|
||||||
|
{
|
||||||
|
name: 'Copy Alias to/from Guild',
|
||||||
|
description: `**Copy to Guild Usage:** [Can be only used by Guild Owners/Admins!]
|
||||||
|
- \`${config.prefix}ra clone [aliasName]\`
|
||||||
|
- \`${config.prefix}ra copy [aliasName]\`
|
||||||
|
**Copy from Guild Usage:**
|
||||||
|
- \`${config.prefix}ra guild clone [aliasName]\`
|
||||||
|
- \`${config.prefix}ra guild copy [aliasName]\`
|
||||||
|
|
||||||
|
**Params:**
|
||||||
|
- \`[aliasName]\` - The name of the alias you wish to copy.
|
||||||
|
|
||||||
|
Copies the specified alias to/from the guild the command was run in.`,
|
||||||
|
example: ['`[[ra clone testAlias`', '`[[ra guild clone testGuildAlias`'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'delete',
|
||||||
|
{
|
||||||
|
name: 'Delete One Alias',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra delete [aliasName] [verificationCode?]\`
|
||||||
|
- \`${config.prefix}ra remove [aliasName] [verificationCode?]\`
|
||||||
|
**Guild Mode Usage:** [Can be only used by Guild Owners/Admins!]
|
||||||
|
- \`${config.prefix}ra guild delete [aliasName] [verificationCode?]\`
|
||||||
|
- \`${config.prefix}ra guild remove [aliasName] [verificationCode?]\`
|
||||||
|
|
||||||
|
**Params:**
|
||||||
|
- \`[aliasName]\` - The name of the alias you wish to delete.
|
||||||
|
- \`[verificationCode?]\` - The 4 digit code to confirm that you do want to delete the alias. If omitted, ${config.name} will request confirmation and provide a verification code to re-run the command with.
|
||||||
|
|
||||||
|
Deletes the specified alias from your personal account or to the guild the command was run in. This is a permanent deletion and cannot be undone.`,
|
||||||
|
example: ['`[[ra delete testAlias`', '`[[ra guild delete testGuildAlias`'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'delete-all',
|
||||||
|
{
|
||||||
|
name: 'Delete All Aliases',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra delete-all [verificationCode?]\`
|
||||||
|
- \`${config.prefix}ra remove-all [verificationCode?]\`
|
||||||
|
**Guild Mode Usage:** [Can be only used by Guild Owners/Admins!]
|
||||||
|
- \`${config.prefix}ra guild delete-all [verificationCode?]\`
|
||||||
|
- \`${config.prefix}ra guild remove-all [verificationCode?]\`
|
||||||
|
|
||||||
|
**Params:**
|
||||||
|
- \`[verificationCode?]\` - The 4 digit code to confirm that you do want to delete the alias. If omitted, ${config.name} will request confirmation and provide a verification code to re-run the command with.
|
||||||
|
|
||||||
|
Deletes all aliases saved to your personal account or to the guild the command was run in. This is a permanent deletion and cannot be undone.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'help',
|
||||||
|
{
|
||||||
|
name: 'Help',
|
||||||
|
description: `**Personal Mode Usage:**
|
||||||
|
- \`${config.prefix}ra help\`
|
||||||
|
- \`${config.prefix}ra h\`
|
||||||
|
- \`${config.prefix}ra ?\`
|
||||||
|
**Guild Mode Usage:**
|
||||||
|
- \`${config.prefix}ra guild help\`
|
||||||
|
- \`${config.prefix}ra guild h\`
|
||||||
|
- \`${config.prefix}ra guild ?\`
|
||||||
|
|
||||||
|
Opens the help library to the Roll Alias System section.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const RollAliasHelpPages: HelpPage = {
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
isPage: true,
|
||||||
|
dict,
|
||||||
|
};
|
|
@ -0,0 +1,83 @@
|
||||||
|
import config from '~config';
|
||||||
|
|
||||||
|
import { HelpContents, HelpPage } from 'commands/helpLibrary/helpLibrary.d.ts';
|
||||||
|
|
||||||
|
const name = 'API Rolling';
|
||||||
|
const 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. You may enable and disable the API rolls for channels in your guild as needed.
|
||||||
|
|
||||||
|
For information on how to use the API, please check the GitHub README for more information [here](${config.links.sourceCode}).`;
|
||||||
|
const dict = new Map<string, HelpContents>([
|
||||||
|
[
|
||||||
|
'status',
|
||||||
|
{
|
||||||
|
name: 'Status',
|
||||||
|
description: `**Usage:** \`${config.prefix}api status\`
|
||||||
|
|
||||||
|
Shows the current status of the API for the channel this was run in.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'allow',
|
||||||
|
{
|
||||||
|
name: 'Allow API Rolls',
|
||||||
|
description: `**Usage:** \`${config.prefix}api allow\` or \`${config.prefix}api enable\`
|
||||||
|
|
||||||
|
Allows API Rolls to be sent to the channel this command was run in.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'block',
|
||||||
|
{
|
||||||
|
name: 'Block API Rolls',
|
||||||
|
description: `**Usage:** \`${config.prefix}api block\` or \`${config.prefix}api disable\`
|
||||||
|
|
||||||
|
Blocks API Rolls from being sent to the channel this command was run in.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'hide-warn',
|
||||||
|
{
|
||||||
|
name: 'Hide API Warning',
|
||||||
|
description: `**Usage:** \`${config.prefix}api hide-warn\`
|
||||||
|
|
||||||
|
Hides the API warning on all rolls sent to the channel this command was run in.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'show-warn',
|
||||||
|
{
|
||||||
|
name: 'Show API Warning',
|
||||||
|
description: `**Usage:** \`${config.prefix}api show-warn\`
|
||||||
|
|
||||||
|
Shows the API warning on all rolls sent to the channel this command was run in`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'delete',
|
||||||
|
{
|
||||||
|
name: 'Delete API Settings',
|
||||||
|
description: `**Usage:** \`${config.prefix}api delete\`
|
||||||
|
|
||||||
|
Deletes this channel's settings from ${config.name}'s database.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'help',
|
||||||
|
{
|
||||||
|
name: 'Help',
|
||||||
|
description: `**Usage:** \`${config.prefix}api help\` or \`${config.prefix}api h\`
|
||||||
|
|
||||||
|
Opens the help library to the Api Help section.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const ApiHelpPages: HelpPage = {
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
isPage: true,
|
||||||
|
dict,
|
||||||
|
};
|
|
@ -4,13 +4,14 @@ import config from '~config';
|
||||||
|
|
||||||
import { HelpContents, HelpDict, HelpPage } from 'commands/helpLibrary/helpLibrary.d.ts';
|
import { HelpContents, HelpDict, HelpPage } from 'commands/helpLibrary/helpLibrary.d.ts';
|
||||||
|
|
||||||
import { RootHelpPages } from 'commands/helpLibrary/rollHelp/_rootRollHelp.ts';
|
import { RootHelpPages } from 'commands/helpLibrary/_rootHelp.ts';
|
||||||
|
|
||||||
import { infoColor1 } from 'embeds/colors.ts';
|
import { infoColor1 } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import { InteractionValueSeparator } from 'events/interactionCreate.ts';
|
import { InteractionValueSeparator } from 'events/interactionCreate.ts';
|
||||||
|
|
||||||
export const helpCustomId = 'help';
|
export const helpCustomId = 'help';
|
||||||
|
const homeId = 'home';
|
||||||
|
|
||||||
const generateActionRowWithSelectMenu = (selected: string, helpDict: HelpDict, parent?: string): ActionRow => ({
|
const generateActionRowWithSelectMenu = (selected: string, helpDict: HelpDict, parent?: string): ActionRow => ({
|
||||||
type: MessageComponentTypes.ActionRow,
|
type: MessageComponentTypes.ActionRow,
|
||||||
|
@ -18,16 +19,23 @@ const generateActionRowWithSelectMenu = (selected: string, helpDict: HelpDict, p
|
||||||
{
|
{
|
||||||
type: MessageComponentTypes.SelectMenu,
|
type: MessageComponentTypes.SelectMenu,
|
||||||
customId: `${helpCustomId}${InteractionValueSeparator}${selected}`,
|
customId: `${helpCustomId}${InteractionValueSeparator}${selected}`,
|
||||||
options: helpDict
|
options: [
|
||||||
.entries()
|
{
|
||||||
.toArray()
|
label: 'Home',
|
||||||
.map(
|
value: parent ? `${parent}${InteractionValueSeparator}${homeId}` : homeId,
|
||||||
(page): SelectOption => ({
|
default: selected === '',
|
||||||
label: page[1].name,
|
},
|
||||||
value: parent ? `${parent}${InteractionValueSeparator}${page[0]}` : page[0],
|
...helpDict
|
||||||
default: page[0] === selected,
|
.entries()
|
||||||
}),
|
.toArray()
|
||||||
),
|
.map(
|
||||||
|
(page): SelectOption => ({
|
||||||
|
label: page[1].name,
|
||||||
|
value: parent ? `${parent}${InteractionValueSeparator}${page[0]}` : page[0],
|
||||||
|
default: page[0] === selected,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
@ -35,10 +43,10 @@ const generateActionRowWithSelectMenu = (selected: string, helpDict: HelpDict, p
|
||||||
const makeHelpEmbed = (helpDict: HelpContents | HelpPage, parentTitle?: string): Embed => ({
|
const makeHelpEmbed = (helpDict: HelpContents | HelpPage, parentTitle?: string): Embed => ({
|
||||||
color: infoColor1,
|
color: infoColor1,
|
||||||
author: {
|
author: {
|
||||||
name: `Roll Command Help${parentTitle ? ' - ' : ''}${parentTitle}`,
|
name: parentTitle ? `Help > ${parentTitle}` : 'Help',
|
||||||
},
|
},
|
||||||
title: helpDict.name,
|
title: helpDict.name,
|
||||||
description: helpDict.description.replaceAll('[[', config.prefix).replaceAll(']]', config.postfix),
|
description: helpDict.description.replaceAll('@$', `<@${botId}>`).replaceAll('[[', config.prefix).replaceAll(']]', config.postfix),
|
||||||
fields: !helpDict.isPage && helpDict.example
|
fields: !helpDict.isPage && helpDict.example
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
|
@ -62,24 +70,68 @@ const defaultHelpMessage = (showError = ''): CreateMessage => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
export const generateHelpMessage = (helpPath?: string): CreateMessage => {
|
export const generateHelpMessage = (helpPath?: string): CreateMessage => {
|
||||||
if (helpPath) {
|
if (!helpPath) return defaultHelpMessage();
|
||||||
const [page, item] = helpPath.split(InteractionValueSeparator);
|
|
||||||
|
|
||||||
// Get the first layer dictionary
|
const path = helpPath
|
||||||
const rootHelpDict = RootHelpPages.dict.get(page);
|
.replaceAll(homeId, '')
|
||||||
if (!rootHelpDict || !rootHelpDict.isPage) return defaultHelpMessage('1');
|
.split(InteractionValueSeparator)
|
||||||
|
.filter((x) => x);
|
||||||
|
const page = path.shift();
|
||||||
|
const item = path.shift();
|
||||||
|
const subItem = path.shift();
|
||||||
|
|
||||||
// Get second layer dictionary
|
if (!page) return defaultHelpMessage();
|
||||||
const helpDict = item ? rootHelpDict.dict.get(item) : rootHelpDict;
|
|
||||||
if (!helpDict) return defaultHelpMessage('2');
|
// Get the first layer dictionary
|
||||||
|
const rootHelpDict = RootHelpPages.dict.get(page);
|
||||||
|
if (!rootHelpDict) return defaultHelpMessage('1');
|
||||||
|
|
||||||
|
if (!rootHelpDict.isPage) {
|
||||||
return {
|
return {
|
||||||
embeds: [makeHelpEmbed(helpDict, helpDict.isPage ? '' : rootHelpDict.name)],
|
embeds: [makeHelpEmbed(rootHelpDict)],
|
||||||
|
components: [generateActionRowWithSelectMenu(page, RootHelpPages.dict)],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!item) {
|
||||||
|
return {
|
||||||
|
embeds: [makeHelpEmbed(rootHelpDict)],
|
||||||
|
components: [generateActionRowWithSelectMenu(page, RootHelpPages.dict), generateActionRowWithSelectMenu('', rootHelpDict.dict, page)],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get second layer dictionary
|
||||||
|
const helpDict = rootHelpDict.dict.get(item);
|
||||||
|
if (!helpDict) return defaultHelpMessage('2');
|
||||||
|
|
||||||
|
if (!helpDict.isPage) {
|
||||||
|
return {
|
||||||
|
embeds: [makeHelpEmbed(helpDict, rootHelpDict.name)],
|
||||||
|
components: [generateActionRowWithSelectMenu(page, RootHelpPages.dict), generateActionRowWithSelectMenu(item, rootHelpDict.dict, page)],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!subItem) {
|
||||||
|
return {
|
||||||
|
embeds: [makeHelpEmbed(helpDict, rootHelpDict.name)],
|
||||||
components: [
|
components: [
|
||||||
generateActionRowWithSelectMenu(page, RootHelpPages.dict),
|
generateActionRowWithSelectMenu(page, RootHelpPages.dict),
|
||||||
helpDict.isPage ? generateActionRowWithSelectMenu('', helpDict.dict, page) : generateActionRowWithSelectMenu(item, rootHelpDict.dict, page),
|
generateActionRowWithSelectMenu(item, rootHelpDict.dict, page),
|
||||||
|
generateActionRowWithSelectMenu('', helpDict.dict, `${page}${InteractionValueSeparator}${item}`),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
return defaultHelpMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get third layer dictionary
|
||||||
|
const helpItem = helpDict.dict.get(subItem);
|
||||||
|
if (!helpItem) return defaultHelpMessage('3');
|
||||||
|
|
||||||
|
return {
|
||||||
|
embeds: [makeHelpEmbed(helpItem, `${rootHelpDict.name} > ${helpItem.isPage ? '' : helpDict.name}`)],
|
||||||
|
components: [
|
||||||
|
generateActionRowWithSelectMenu(page, RootHelpPages.dict),
|
||||||
|
generateActionRowWithSelectMenu(item, rootHelpDict.dict, page),
|
||||||
|
generateActionRowWithSelectMenu(subItem, helpDict.dict, `${page}${InteractionValueSeparator}${item}`),
|
||||||
|
],
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
import config from '~config';
|
||||||
|
|
||||||
|
import { HelpContents, HelpPage } from 'commands/helpLibrary/helpLibrary.d.ts';
|
||||||
|
|
||||||
|
const name = 'Inline Rolling';
|
||||||
|
const description =
|
||||||
|
`${config.name} has an option to allow inline rolls in your guild. An inline roll is a roll that does not immediately start with \`${config.prefix}\`, such as \`test ${config.prefix}d20${config.postfix}\`.
|
||||||
|
|
||||||
|
By default, Inline Rolls are blocked from being sent in your guild. These commands may only be used by the Owner or Admins of your guild.`;
|
||||||
|
const dict = new Map<string, HelpContents>([
|
||||||
|
[
|
||||||
|
'status',
|
||||||
|
{
|
||||||
|
name: 'Status',
|
||||||
|
description: `**Usage:** \`${config.prefix}inline status\`
|
||||||
|
|
||||||
|
Shows the current status of Inline Rolls for this guild.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'enable',
|
||||||
|
{
|
||||||
|
name: 'Allow Inline Rolls',
|
||||||
|
description: `**Usage:** \`${config.prefix}inline allow\` or \`${config.prefix}inline enable\`
|
||||||
|
|
||||||
|
Allows Inline Rolls for this guild.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'disable',
|
||||||
|
{
|
||||||
|
name: 'Block Inline Rolls',
|
||||||
|
description: `**Usage:** \`${config.prefix}inline block\` or \`${config.prefix}inline disable\` or \`${config.prefix}inline delete\`
|
||||||
|
|
||||||
|
Blocks inline rolls for this guild.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'help',
|
||||||
|
{
|
||||||
|
name: 'Help',
|
||||||
|
description: `**Usage:** \`${config.prefix}inline help\` or \`${config.prefix}inline h\`
|
||||||
|
|
||||||
|
Opens the help library to the Inline Help section.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const InlineHelpPages: HelpPage = {
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
isPage: true,
|
||||||
|
dict,
|
||||||
|
};
|
|
@ -14,7 +14,7 @@ import { LegalMathOperators } from 'commands/helpLibrary/rollHelp/legalMathOpera
|
||||||
import { LegalMathTrigFuncsHelpPages } from 'commands/helpLibrary/rollHelp/legalMathTrigFuncs.ts';
|
import { LegalMathTrigFuncsHelpPages } from 'commands/helpLibrary/rollHelp/legalMathTrigFuncs.ts';
|
||||||
import { MiscFeaturesHelpPages } from 'commands/helpLibrary/rollHelp/miscFeatures.ts';
|
import { MiscFeaturesHelpPages } from 'commands/helpLibrary/rollHelp/miscFeatures.ts';
|
||||||
|
|
||||||
const name = `${config.name}'s Roll Command Details`;
|
const name = 'Dice/Roll/Math Command';
|
||||||
const description = `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.
|
const description = `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.
|
||||||
|
|
||||||
The help options in this group use the notation \`xdy\` to indicate the basic/required dice notation for die count and size as detailed in the \`Dice Options>Basic Dice Options\` page.
|
The help options in this group use the notation \`xdy\` to indicate the basic/required dice notation for die count and size as detailed in the \`Dice Options>Basic Dice Options\` page.
|
||||||
|
@ -36,7 +36,7 @@ const dict = new Map<string, HelpPage>([
|
||||||
['legal-math-complex-funcs', LegalMathComplexFuncsHelpPages],
|
['legal-math-complex-funcs', LegalMathComplexFuncsHelpPages],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const RootHelpPages: HelpPage = {
|
export const RootRollHelpPages: HelpPage = {
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
isPage: true,
|
isPage: true,
|
||||||
|
|
|
@ -5,11 +5,15 @@ import { generateHelpMessage } from 'commands/helpLibrary/generateHelpMessage.ts
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { queries } from 'db/common.ts';
|
import { queries } from 'db/common.ts';
|
||||||
|
|
||||||
|
import { InteractionValueSeparator } from 'events/interactionCreate.ts';
|
||||||
|
|
||||||
import utils from 'utils/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
export const rollHelp = (message: DiscordenoMessage) => {
|
export const rollHelp = (message: DiscordenoMessage, subPage?: 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
|
||||||
dbClient.execute(queries.callIncCnt('rollhelp')).catch((e) => utils.commonLoggers.dbError('rollHelp.ts:15', 'call sproc INC_CNT on', e));
|
dbClient.execute(queries.callIncCnt('rollhelp')).catch((e) => utils.commonLoggers.dbError('rollHelp.ts:15', 'call sproc INC_CNT on', e));
|
||||||
|
|
||||||
message.send(generateHelpMessage()).catch((e: Error) => utils.commonLoggers.messageSendError('rollHelp.ts:247', message, e));
|
message
|
||||||
|
.send(generateHelpMessage(subPage ? `roll-help${InteractionValueSeparator}${subPage}` : 'roll-help'))
|
||||||
|
.catch((e: Error) => utils.commonLoggers.messageSendError('rollHelp.ts:247', message, e));
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,10 +2,12 @@ import { DiscordenoMessage, hasGuildPermissions } from '@discordeno';
|
||||||
|
|
||||||
import config from '~config';
|
import config from '~config';
|
||||||
|
|
||||||
|
import { generateHelpMessage } from 'commands/helpLibrary/generateHelpMessage.ts';
|
||||||
|
|
||||||
import dbClient from 'db/client.ts';
|
import dbClient from 'db/client.ts';
|
||||||
import { inlineList, queries } from 'db/common.ts';
|
import { inlineList, queries } from 'db/common.ts';
|
||||||
|
|
||||||
import { failColor, infoColor1, infoColor2, successColor } from 'embeds/colors.ts';
|
import { failColor, infoColor1, successColor } from 'embeds/colors.ts';
|
||||||
|
|
||||||
import utils from 'utils/utils.ts';
|
import utils from 'utils/utils.ts';
|
||||||
|
|
||||||
|
@ -89,46 +91,7 @@ export const toggleInline = async (message: DiscordenoMessage, args: string[]) =
|
||||||
case 'h':
|
case 'h':
|
||||||
case 'help':
|
case 'help':
|
||||||
default:
|
default:
|
||||||
message
|
message.send(generateHelpMessage('inline')).catch((e: Error) => utils.commonLoggers.messageSendError('apiHelp.ts:67', message, e));
|
||||||
.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
color: infoColor2,
|
|
||||||
title: `${config.name}'s Inline Roll Details:`,
|
|
||||||
description:
|
|
||||||
`${config.name} has an option to allow inline rolls in your guild. An inline roll is a roll that does not immediately start with \`${config.prefix}\`, such as \`test ${config.prefix}d20${config.postfix}\`.
|
|
||||||
|
|
||||||
By default, inline rolls are blocked from being sent in your guild. These commands may only be used by the Owner or Admins of your guild.`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
color: infoColor1,
|
|
||||||
title: 'Available Inline Commands:',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}inline help\``,
|
|
||||||
value: 'This command',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}inline status\``,
|
|
||||||
value: 'Shows the current status of inline rolls for this guild',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}inline allow/enable\``,
|
|
||||||
value: 'Allows inline rolls in the guild',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `\`${config.prefix}inline block/disable/delete\``,
|
|
||||||
value: 'Blocks inline rolls in the guild',
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
.catch((e: Error) => utils.commonLoggers.messageSendError('apiHelp.ts:67', message, e));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (errorOut) {
|
if (errorOut) {
|
||||||
|
|
|
@ -69,11 +69,14 @@ export const messageCreateHandler = (message: DiscordenoMessage) => {
|
||||||
case 'rd':
|
case 'rd':
|
||||||
case 'dr':
|
case 'dr':
|
||||||
case '???':
|
case '???':
|
||||||
|
// [[rollDecorators or [[rd or [[dr or [[???
|
||||||
|
// Opens help library specifically to decorators page for legacy command support
|
||||||
|
commands.rollHelp(message, 'decorators');
|
||||||
|
break;
|
||||||
case 'rollhelp':
|
case 'rollhelp':
|
||||||
case 'rh':
|
case 'rh':
|
||||||
case 'hr':
|
case 'hr':
|
||||||
case '??':
|
case '??':
|
||||||
// Legacy: [[rollDecorators or [[rd or [[dr or [[???
|
|
||||||
// [[rollhelp or [[rh or [[hr or [[??
|
// [[rollhelp or [[rh or [[hr or [[??
|
||||||
// Help command specifically for the roll command
|
// Help command specifically for the roll command
|
||||||
commands.rollHelp(message);
|
commands.rollHelp(message);
|
||||||
|
@ -92,6 +95,7 @@ export const messageCreateHandler = (message: DiscordenoMessage) => {
|
||||||
commands.info(message);
|
commands.info(message);
|
||||||
break;
|
break;
|
||||||
case 'privacy':
|
case 'privacy':
|
||||||
|
case 'tos':
|
||||||
// [[privacy
|
// [[privacy
|
||||||
// Privacy command, prints short desc on bot's privacy policy
|
// Privacy command, prints short desc on bot's privacy policy
|
||||||
commands.privacy(message);
|
commands.privacy(message);
|
||||||
|
|
Loading…
Reference in New Issue