requireChannel

suspend fun Message.requireChannel(context: CommandContext, channel: GuildMessageChannel, role: Role? = null, delay: Long = DELETE_DELAY, allowDm: Boolean = true, deleteOriginal: Boolean = true, deleteResponse: Boolean = true): Boolean

Check that this message happened in either the given channel or a DM, or that the author is at least a given role.

If none of those things are true, a response message will be created instructing the user to try again in the given channel.

Return

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

Parameters

channel

Channel to require the message to have been sent in

role

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

delay

How long (in milliseconds) to wait before deleting the response message (30 seconds by default)

allowDm

Whether to treat a DM as an acceptable context

deleteOriginal

Whether to delete the original message, using the given delay (true by default)

deleteResponse

Whether to delete the response, using the given delay (true by default)