cmd.message.content
Warning
cmd.message.content was created in one of the early test versions of syntx.js. It will not be removed, but it can be considered obsolete.
Returns the text content of a message, optionally including or excluding the first word (the command name).
JavaScript
const { cmd } = require("syntx.js");
cmd.message.content(message);
cmd.message.content(message, firstArgument);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message | discord.js Message | Yes | The message object from the event. |
firstArgument | boolean | No | If true, returns the full message content including the first word. Defaults to false, which skips it. |
Returns
string : The message content. Returns an empty string if the message has no text.
Examples
Get only the arguments (skip command name)
For a message !greet Hello World, this returns "Hello World":
JavaScript
client.command({
name: "greet",
content: (message) => {
const args = cmd.message.content(message);
message.reply(`You said: ${args}`);
},
});Get the full message content
For a message !greet Hello World, this returns "!greet Hello World":
JavaScript
client.command({
name: "greet",
content: (message) => {
const full = cmd.message.content(message, true);
message.reply(`Full message: ${full}`);
},
});