Skip to main content

Reaction Logs

This command logs reactions.

Trigger

Type: Reaction
Additional options: Added + removed reactions

Configuration

  • 📌 $logging_channel_id
    ID of the channel to log reactions to.

Code

{{/*
Logs reactions in a channel.
See <https://yagpdb-cc.github.io/utilities/reaction-logs> for more information.

Author: Satty9361 <https://github.com/Satty9361>
*/}}


{{/* Configurable values */}}
{{$logging_channel_id := .Channel.ID}}
{{/* End of configurable values */}}

{{/* Actual CODE */}}
{{$reaction_url := ""}}

{{with .Reaction.Emoji.ID}}
{{$ext := ".png"}}{{if $.Reaction.Emoji.Animated}}{{$ext = ".gif"}}{{end}}
{{$reaction_url = printf "https://cdn.discordapp.com/emojis/%d%s" . $ext}}
{{else}}
{{$emoji_U := ""}}
{{- range toRune .Reaction.Emoji.Name }}
{{- $emoji_U = joinStr "-" $emoji_U (printf "%04x" .) }}
{{- end -}}
{{ $reaction_url = print "https://raw.githubusercontent.com/iamcal/emoji-data/master/img-google-136/" $emoji_U ".png" }}
{{end}}
{{$addrem := "`Removed`"}}{{if .ReactionAdded}}{{$addrem = "`Added`"}}{{end}}

{{sendMessage $logging_channel_id (cembed "description" (print "**Reaction:** " $addrem "\n**By:**[ " .User "](https://discord.com/users/" .User.ID ")") "color" 0xFF0000
"fields" (cslice (sdict "name" "Message location: " "value" (joinStr "" "[#" .Channel.Name "](https://discordapp.com/channels/" .Guild.ID "/" .Channel.ID "/" .ReactionMessage.ID ")") "inline" false))
"thumbnail" (sdict "url" $reaction_url)
)}}

Author

This custom command was written by @Satty9361.