Message Object
The message object is a global value passed into the custom command when it's run. It contains information about the message that triggered it such as the command or message containing the trigger word. Here is an example of the layout:
{
"guild": {
"id": "622757587489914880",
"name": "Operarting System",
"icon": "https://cdn.discordapp.com/icons/622757587489914880/4faeafcf30de330ce7b08b4dd40d616a.webp"
},
"channel": {
"id": "622761218532179968",
"name": "robit-commands",
"type": "text"
},
"author": {
"id": "139871249567318017",
"bot": false,
"avatar": "https://cdn.discordapp.com/avatars/139871249567318017/6c7e28a3cfa7d3fde9ffc66c8734e45c.png?size=32",
"nickname": "Peter",
"username": "Big P",
"colour": "#f1c40f",
"roles": [
{
"guild": "622757587489914880",
"id": "666984345055264799",
"name": "Big P",
"color": 15844367,
"hoist": true,
"rawPosition": 45,
"permissions": 104324808,
"managed": false,
"mentionable": false,
"deleted": false,
"createdTimestamp": 1579091859831
},
{
"guild": "622757587489914880",
"id": "622757587489914880",
"name": "@everyone",
"color": 0,
"hoist": false,
"rawPosition": 0,
"permissions": 104193728,
"managed": false,
"mentionable": false,
"deleted": false,
"createdTimestamp": 1568547379134
}
]
},
"content": "!test hello world https://www.youtube.com/watch?v=_htnaGN8eOs",
"reference": {
"channelID":"622761218532179968",
"guildID":"622757587489914880",
"messageID":"828587624310505513"
},
"id": "828587624310505513",
"timestamp": 1617621084049,
"attachments": ["https://media.discordapp.net/attachments/622761218532179968/828423074046017546/ahhh.jpg?width=576&height=544"],
"embeds": [{"title":"Spaghetti Again","type":"rich","description":null,"url":"https://www.youtube.com/watch?v=_htnaGN8eOs","timestamp":null,"color":16711680,"fields":[],"thumbnail":{"url":"https://i.ytimg.com/vi/_htnaGN8eOs/maxresdefault.jpg","proxyURL":"https://images-ext-1.discordapp.net/external/V4xQcbX77M7O021x0z7DCxaWXYxsoWlfLHZILZTcj8U/https/i.ytimg.com/vi/_htnaGN8eOs/maxresdefault.jpg","height":720,"width":1280},"image":null,"author":{"name":"Spaghetti Again","url":"https://www.youtube.com/channel/UC_F3TvFNvFkX5V8d3StkbLQ"},"footer":null}]
}
This is the Discord server that the message was executed in.
Field | Content |
id | The ID of the Guild |
name | The name of the Guild |
icon | The URL of the current Guild Icon |
The channel that the command was executed in.
Field | Content |
id | The ID of the Channel |
name | The name of the Channel |
type | The Type of the channel, technically can be one of these values: dm, text, voice, category, news, store, unknown |
The User that triggered the custom function
Field | Content |
id | The ID of the User |
bot | true if the user is a bot, as bots are unable to trigger custom functions this is always false |
avatar | The URL of the User's current avatar |
nickname | The Users nickname in this server, if it isn't set this is blank |
username | The Users username |
colour | The display colour of the users name, set by the hoist role |
roles | An array of roles the User has. Always contains at least one role which is @everyone |
content | The raw content of the message |
reference | If the message is a reply to another message, the guild, channel and message IDs of that message are here. |
id | The message ID |
timestamp | The timestamp that the message was sent at, in milliseconds |
attachments | An array of URLs attached to this message |
embeds | An array of embeds attached to this message |
Field | Content |
guild | The Guild ID that this role belongs to |
id | The ID of the role |
name | The name of the role |
color | The colour of the role, represented as an integer |
hoist | Whether or not this role is displayed separately in the user list |
rawPosition | The position of the role in the role list |
permissions | The bitfield of the role's permissions |
managed | Whether the role belongs to an integration |
mentionable | Whether or not you can mention the role |
deleted | Whether or not the role has been deleted |
createdTimestamp | The timestamp the role was created, in milliseconds |
Field | Content |
title | The title of the embed |
type | Embed type, usually "rich" |
description | The text body of the embed |
url | The URL that the embed title links to |
timestamp | Timestamp set in the embed |
color | The colour of the embed, as a decimal |
fields | An array of fields |
thumbnail | The thumbnail in the embed with direct URL and proxyURL |
image | Image attached to the embed |
author | The author specifying in the embed as name, url |
footer | Embed footer |
Last modified 1yr ago