Message Functions
After edit the string, you can send a message
Preface
There are many functions about the message, some of which are similar, while others are completely different. For instance, what is the difference between sendMessage
and sendMessageNoEscape
; what is the difference between addReactions
, addResponseReactions
, and addMessageReactions
?
sendMessage
and sendMessageNoEscape
are completely different, whereas addReactions
, addResponseReactions
, and addMessageReactions
are almost the same. In conclusion, you need to pay more attention to what features the specific function has and what conditions the specific function need, for once you use the wrong function, all of your codes may be an error, which is very annoying when you are writing complex codes.
Take sendMessage
and sendMessageNoEscape
for example, {{sendMessage nil "<@&694927266563620913>"}}
will not mention the "Teacher" role in the server but will show the mention of it, and {{sendMessage nil "<@&694927266563620913>"}}
will mention the Teacher role. If you don't want to be mentioned but you want to see the mention type of the role, consider {{sendMessage}}
; otherwise, consider {{sendMessageNoEscape}}
.
Function
Function
Description
addMessageReactions channel messageID reactions
addReactions "👍" "👎" ...
Adds each emoji as a reaction to the message that triggered the command (recognizes Unicode emojis and emojiName:emojiID
).
addResponseReactions "👍" "👎" ...
Adds each emoji as a reaction to the response message (recognizes Unicode emojis and emojiName:emojiID
).
complexMessage "content" args "embed" args "file" args
complexMessageEdit "content" args "embed" args
deleteAllMessageReactions channel messageID
Deletes all reactions pointed message has. channel
can be ID, "name" or nil
.
deleteMessageReaction channel messageID userID emojis
deleteMessage channel messageID (delay)
deleteResponse (delay)
Deletes the response after a certain time from optional delay
argument (max 86400 seconds = 1 day). Defaults to 10 seconds.
deleteTrigger (delay)
Deletes the trigger after a certain time from optional delay
argument (max 86400 seconds = 1 day). Defaults to 10 seconds.
editMessage channel messageID newMessageContent
editMessageNoEscape channel messageID newMessageContent
Edits the message in channel and has same logic in escaping characters as sendMessageNoEscape
.
getMessage channelID messageID
sendDM "message here"
Sends the user a direct message, only one DM can be sent per custom command (accepts embed objects). YAG will only DM triggering user.
sendMessage channel message
Sends message (string or embed)
in channel
, channel can be either nil
, the channel ID or the channel's "name".
sendMessageNoEscape channel message
Sends message (string or embed)
in channel
, channel can be either nil
, the channel ID or the channel "name". Doesn't escape mentions (e.g. role mentions or @here/@everyone).
sendMessageRetID channel message
sendMessageNoEscapeRetID channel message
Same as sendMessageNoEscape
, but also returns messageID to assigned variable for later use.
Example:
Sends message to current channel
nil
and gets messageID to variable$x
. Also adds reactions to this message. After 5 seconds, deletes that message. >{{$x := sendMessageRetID nil "Hello there!"}} {{addMessageReactions nil $x "👍" "👎"}} {{deleteMessage nil $x 5}}
To demonstrate
sleep
and slightly alsoeditMessage
functions. >{{$x := sendMessageRetID nil "Hello"}} {{sleep 3}} {{editMessage nil $x "There"}} {{sleep 3}} {{sendMessage nil "We all know, that"}} {{sleep 3}} YAGPDB rules!
To demonstrate usage of
complexMessage
withsendMessage
.{{sendMessage nil (complexMessage "content" "Who rules?" "embed" (cembed "description" "YAGPDB of course!" "color" 0x89aa00) "file" "Here we print something nice - you all are doing awesome!")}}
To demonstrate usage of
complexMessageEdit
witheditMessage
.{{$mID := sendMessageRetID nil (complexMessage "content" "You know what is..." "embed" (cembed "title" "FUN!?" "color" 0xaa8900))}} {{sleep 3}} {{editMessage nil $mID (complexMessageEdit "embed" (cembed "title" "YAGPDB!" "color" 0x89aa00) "content" "Yes, it's always working with...")}}{{sleep 3}}{{editMessage nil $mID (complexMessageEdit "embed" nil "content" "Embed deleted, goodbye YAG!")}}{{deleteMessage nil $mID 3}}
Last updated
Was this helpful?