📚
YAGPDB
  • YAGPDB Coding System - Documentation
  • Getting Started
  • Useful Functions
  • Primary Level
    • The Dot and Variables
      • User
      • Guild / Server
      • Member
      • Channel
      • Message
      • Reaction
      • Time
    • Custom Types
    • Functions
      • Type Conversion
      • String Manipulation
      • Math Functions
      • Message Functions
      • Mentions
      • Role Functions
      • Current User
      • Miscellaneous
      • ExecCC
    • Conditional Branching
  • Intermediate Level
  • Database
  • Range Action
  • With Action
  • Custom Embeds
  • Advanced Level
    • Using RegEx
  • Custom Commands Examples
    • Texas Hold'em
Powered by GitBook
On this page
  • Field
  • More Info

Was this helpful?

  1. Primary Level
  2. The Dot and Variables

Message

All of the things you type and send will be messages

Field

Field

Description

.Message.ID

ID of the message.

.Message.ChannelID

Channel ID this message is in.

.Message.GuildID

Guild ID in which the message is.

.Message.Content

Text content on this message.

.Message.Timestamp

Timestamp of the message in type discordgo.Timestamp (use .Message.Timestamp.Parse to get type time.Time and .Parse.String method returns type string).

.Message.EditedTimestamp

The time at which the last edit of the message occurred, if it has been edited.

.Message.MentionRoles

The roles mentioned in the message.

.Message.MentionEveryone

Whether the message mentions everyone.

.Message.Author

.Message.Attachments

Attachments to this message (slice of attachment objects).

.Message.Embeds

Embeds on this message (slice of embed objects).

.Message.Mentions

Users this message mentions.

.Message.Reactions

Reactions on this message (only available from getMessage).

.Message.Type

.Message.Pinned

Whether this message is pinned.

.Args

.Cmd

.CmdArgs

.StrippedMsg

Example:

  • We will demonstrate .Args, .Cmd, .CmdArgs, and .StrippedMsg.

Now your whole trigger: -hello and you type in -hello the world.
.Args will returns: {{.Args}}, and it is of type {{printf "%T" .Args}}. Its length is {{len .Args}}.
.Cmd will returns: {{.Cmd}}, and it is of type {{printf "%T" .Cmd}}. Its length is {{len .Cmd}}.
.CmdArgs will returns: {{.CmdArgs}}, and it is of type {{printf "%T" .CmdArgs}}. Its length is {{len .CmdArgs}}.
.StrippedMsg will returns: {{.StrippedMsg}}, and it is of type {{printf "%T" .StrippedMsg}}. Its length is **{{len .StrippedMsg}}.
Index the .Args and .CmdArgs:
.Args: {{index .Args 0}} | {{index .Args 1}} | {{index .Args 2}}
.CmdArgs: {{index .CmdArgs 0}} | {{index .CmdArgs 1}}


More Info

Field

Type

.Message.ID

Int

.Message.ChannelID

Int

.Message.Author

.Message.Timestamp

String

.Message.Attachments

.Message.Embeds

Array of Embed

.Message.Mentions

.Message.Reactions

.Message.Content

String

Attachment

Either starts with (index .Message.Attachments 0). or a variable with the attachment type.

Field

Type

Description

ID

Int

The ID of the attachment

URL

String

cdn.discordapp.com URL

ProxyURL

String

media.discordapp.com URL

Filename

String

Filename of the attachment

Width

Int

Width of the attachment (if image) in pixels

Height

Int

Height of the attachment (if image) in pixels

Size

Int

Size of the attachment in bytes

Reaction

Either starts with (index .Message.Reactions 0) or a variable with the reaction type.

Field

Type

Description

Count

Int

Times this emoji has been used to react

Emoji

The emoji used in the reaction

Emoji

Either starts with (index .Message.Reactions 0).Emoji or a variable of the reaction type.

Field

Type

Description

ID

Int

ID of the emoji

Name

String

Name of the emoji (if Unicode emoji this will be the emote)

Animated

Boolean

Whether the emoji is animated or not

{{$message := getMessage nil (index .Args 1)}}
{{if $message}}
{{if $message.Reactions}}
Name of the first reaction: {{(index $message.Reactions 0).Emoji.Name}}
{{else}}No reactions on this message{{end}}
{{else}}Unknown message{{end}}

PreviousChannelNextReaction

Last updated 5 years ago

Was this helpful?

Author of the message ( object).

The of the message.

List of everything that is passed to .Message.Content. .Args is a slice of type string. Example .

.Cmd is of type string and shows all arguments that trigger custom command, part of .Args. Starting from {{index .Args 0}}. Example .

List of all the arguments passed after .Cmd (.Cmd is the actual trigger) .CmdArgs is a slice of type string. Example .

"Strips" or cuts off the triggering part of the message and prints out everything else after that. Bear in mind, when using regex as trigger, for example "day" and input message is "Have a nice day my dear YAG!" output will be "my dear YAG!" - rest is cut off. Example .

You can fetch a message by ID or use the and get some information about it. Message returns the following things that you can access with it:

Array of

Array of

Array of

There are which can be used, but they are either obsolete or only used with Global Emotes. Example to fetch the name of the first reaction on a message provided through the getMessage template:

Message object in Discord documentation (read it if you want to write complex codes).
more fields
trigger message
type
here
here
here
here
Attachments
Reactions
Emoji
The outputs of the command.
User
User Object
User Object