Skip to content

Reconsider all commands to use a ctx.reply wrapper with pings disabled #42

@Arcensoth

Description

@Arcensoth

It is possible to have the bot send a message containing mentions, but without actually pinging the users or roles mentioned. It is also possible to disable at-everyone/at-here and reply-to-user pings.

This means there's no need to edit the mentions in after-the-fact, or use embeds specifically to avoid pings.

However, this requires an allowed_mentions parameter to be passed in with every Context.send() or Context.reply() call:

await ctx.send("Some message", allowed_mentions=AllowedMentions.none())

This behaviour can be configured globally for the bot by default, but it cannot be configured at the extension level.

A more succinct solution might be to wrap all send/reply calls in a method that supplies the allowed_mentions by default:

async def reply(self, ctx: GuildContext, content: str):
    """Wraps `Context.reply()` with some extension-default boilerplate."""
    await ctx.reply(
        content,
        allowed_mentions=AllowedMentions.none(),
    )

Such a method can be defined and adjusted per-extension.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions