requireGuildChannel

suspend fun Message.requireGuildChannel(context: CommandContext, role: Role? = null): Boolean

Check that this message happened in a guild channel.

If it didn't, a response message will be created instructing the user that the current command can't be used via a private message.

Return

true if the message was posted in an appropriate context, false otherwise

Parameters

role

Minimum role required to bypass the channel requirement, or null to disallow any role bypass


suspend fun Message.requireGuildChannel(context: CommandContext, role: Role? = null, guild: Guild? = null): Boolean

Check that this message happened in a guild channel.

If it didn't, a response message will be created instructing the user that the current command can't be used via a private message.

As DMs do not provide access to members and roles, you'll need to provide a lambda that can be used to retrieve the user's top role if you wish to make use of the role bypass.

Return

true if the message was posted in an appropriate context, false otherwise

Parameters

role

Minimum role required to bypass the channel requirement, omit to disallow a role bypass

guild

Guild to check for the user's top role, omit to disallow a role bypass