Message Command

Event triggerMessages

Triggers when a message command (like !help) is sent.

Needs message content intent in servers unless the only prefix is MENTION. Does not trigger for bot messages.

Options

PrefixesRequired

Comma-separated list of prefixes. Use `MENTION` for a mention of this bot.

Example: !,MENTION

Command NameRequired

The command name that follows the prefix (case-insensitive). Up to one space is allowed between the prefix and the name.

Example: help

Command Availability

Where the command can be used. Defaults to Servers if empty.

OptionsServersDirect MessagesBoth

Outputs

Message Content

The full content of the message

Example: !ban @user spamming

Prefix

The prefix that matched, as written in the Prefixes input (`MENTION` for a mention of this bot)

Example: !

Command Name

The command name from the Command Name input

Example: ban

Arguments

Everything after the command name and the space following it

Example: @user spamming

Message ID

The unique ID of the message

Example: 123456789012345678

Channel ID

The ID of the channel where the message was sent

Example: 123456789012345678

Author ID

The ID of the user who sent the message

Example: 123456789012345678

Server ID

The ID of the server where the message was sent, empty in DMs

Example: 123456789012345678

User Mentions

Comma-separated list of mentioned user IDs, including this bot when the MENTION prefix was used

Example: 123456789012345678,987654321098765432

Role Mentions

Comma-separated list of mentioned role IDs

Example: 123456789012345678,987654321098765432

Message Sent At (Unix)

Unix timestamp when the message was sent

Example: 1640995200

Build a bot using triggers like Message Command

Use this trigger in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.

Advanced Documentation

This documentation can be useful when using code mode. View as Markdown

ID: message_command

Options

FieldInventScript nameValue
Prefixesprefixese.g. "!,MENTION"
Command Namecommand_namee.g. "help"
Command Availabilitycommand_availability"Servers", "Direct Messages", "Both"

Outputs

FieldInventScript nameValue
Message Contentcontente.g. "!ban @user spamming"
Prefixprefixe.g. "!"
Command Namecommand_namee.g. "ban"
Argumentsargumentse.g. "@user spamming"
Message IDmessage_ide.g. "123456789012345678"
Channel IDchannel_ide.g. "123456789012345678"
Author IDauthor_ide.g. "123456789012345678"
Server IDserver_ide.g. "123456789012345678"
User Mentionsuser_mentionse.g. "123456789012345678,987654321098765432"
Role Mentionsrole_mentionse.g. "123456789012345678,987654321098765432"
Message Sent At (Unix)message_sent_ate.g. "1640995200"

Example InventScript

var trigger = message_command(Args{prefixes: "!,MENTION", command_name: "help"})

func main() {
	send_text_message(Args{
		channel_id:      trigger.channel_id,
		message_content: "Message Content: " + trigger.content,
	})
}

More messages triggers