Skip to content

Repel context menu presets - #77

Open
Perp-dev-guy wants to merge 1 commit into
r-webdev:mainfrom
Perp-dev-guy:Feature
Open

Repel context menu presets#77
Perp-dev-guy wants to merge 1 commit into
r-webdev:mainfrom
Perp-dev-guy:Feature

Conversation

@Perp-dev-guy

Copy link
Copy Markdown

This adds a folder of markdown files containing dynamic presets for repels. it is shown to all users however it will deny access to users with improper permissions. These presets are then handled inside of the repel.ts file and handled the same as any other repel with the only difference being the preset options.

},
});

const presetCommands = presets.flatMap(({ frontmatter, content }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a normal map, and should return createMessageContextMenuCommand directly instead of [createMessageContextMenuCommand...]

Comment on lines +337 to +339
const commandName = interaction.isChatInputCommand()
? buildCommandString(interaction)
: `Repel: ${interaction.commandName}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be called commandInfo, and just return the commandName in case if it's a context menu command.

Suggested change
const commandName = interaction.isChatInputCommand()
? buildCommandString(interaction)
: `Repel: ${interaction.commandName}`;
const commandInfo = interaction.isChatInputCommand()
? buildCommandString(interaction)
: interaction.commandName;

.setDescription(
`Used \`repel\` command in ${channelInfo}.\n${buildCommandString(interaction)}`
)
.setDescription(`Used \`repel\` command in ${channelInfo}.\n${commandName}`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.setDescription(`Used \`repel\` command in ${channelInfo}.\n${commandName}`)
.setDescription(`Used \`repel\` command in ${channelInfo}.\n${commandInfo}`)

target,
lookBack: Number(frontmatter.lookBack ?? 10) * MINUTE,
});
const shouldDMUser = frontmatter.dmUser !== 'false';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should explicitly check for dmUser: true in the markdown files, otherwise everything other than false would be treated as true.

Suggested change
const shouldDMUser = frontmatter.dmUser !== 'false';
const shouldDMUser = frontmatter.dmUser === 'true'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants