add docs and delete option to inline command

This commit is contained in:
Ean Milligan 2025-07-09 15:11:54 -04:00
parent 66010047b5
commit ff9168e493
3 changed files with 63 additions and 2 deletions

View File

@ -61,6 +61,18 @@ The Artificer comes with a few supplemental commands to the main rolling command
* Adds you to an ignore list so the bot will never respond to you
* `[[opt-in` **Available via DM ONLY**
* Removes you from the ignore list
* `[[inline [subcommand]`
* Controls whether or not inline rolls can be done in a guild, defaults off. These commands may only be used by the Owner or Admins of your guild.
* An inline roll is a roll that does not immediately start with `[[`, such as `test [[d20]]`.
* Available subcommands:
* `[[api help`
* Provides a message similar to this subcommand description.
* `[[inline status`
* Shows the current status of inline rolls for this guild.
* `[[inline allow` or `[[inline enable`
* Allows inline rolls in the guild.
* `[[inline block` or `[[inline disable` or `[[inline delete`
* Blocks inline rolls in the guild.
* `[[xdydzracsq!]]`
* This is the command the bot was built specifically for.
* It looks a little complicated at first, but if you are familiar with the [Roll20 formatting](https://artificer.eanm.dev/roll20), this will no different.

View File

@ -85,6 +85,11 @@ export const help = (message: DiscordenoMessage) => {
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}xdydzracsq!${config.postfix}\` ...`,
value:

View File

@ -5,7 +5,7 @@ import config from '~config';
import dbClient from 'db/client.ts';
import { inlineList, queries } from 'db/common.ts';
import { failColor, infoColor1, successColor } from 'embeds/colors.ts';
import { failColor, infoColor1, infoColor2, successColor } from 'embeds/colors.ts';
import utils from 'utils/utils.ts';
@ -66,6 +66,7 @@ export const toggleInline = async (message: DiscordenoMessage, args: string[]) =
break;
case 'block':
case 'disable':
case 'delete':
await dbClient.execute('DELETE FROM allow_inline WHERE guildid = ?', [message.guildId]).catch((e) => {
utils.commonLoggers.dbError('toggleInline.ts:65', 'delete from allow_inline', e);
errorOut = true;
@ -75,7 +76,6 @@ export const toggleInline = async (message: DiscordenoMessage, args: string[]) =
}
break;
case 'status':
default:
message.send({
embeds: [
{
@ -86,6 +86,50 @@ export const toggleInline = async (message: DiscordenoMessage, args: string[]) =
],
});
return;
case 'h':
case 'help':
default:
message
.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;
}
if (errorOut) {
message.send({