Skip to main content

Fun Info

This command shows statistics connected to a user for the counting, qotd and x-word-story systems.

Trigger

Type: Command
Trigger: funinfo

Usage

  • -funinfo - Shows statistics for the triggering user.
  • -funinfo <user> - Shows statistics for the user provided.

Configuration

  • $cooldown
    Command cooldown in seconds. Set to 0 to disable cooldown.

  • $colour
    Colour of the embed, as a decimal.

tip

To use hex for the colour, simply append a 0x in front, e.g. 0xFF0FF.

Code

{{/*
Shows statistics connected to a user for the counting, qotd and x-word-story systems.
See <https://yagpdb-cc.github.io/fun/funinfo> for more information.

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

{{/* Configurable values */}}
{{ $cooldown := 20 }}
{{ $colour := 16734296 }}
{{/* End of configurable values */}}

{{/* CODE - Don't edit this part */}}
{{ if dbGet .User.ID "funinfo" }}
{{ addReactions "⏳" }}
{{ else }}
{{ $e := sdict "color" $colour }}
{{ $u := str .User.ID }}
{{ if eq (len .Args) 2 }}
{{ $u = index .Args 1 }}
{{ if .Message.Mentions }}{{ $u = str (index .Message.Mentions 0).ID }}{{ end }}
{{ end }}

{{ $c := sdict }}{{ with (dbGet 20 "counting").Value }}{{ $c = sdict . }}{{ end }}
{{ if $c }}
{{ $v := 0 }}{{ with ($c.Get $u) }}{{ $v = . }}{{ end }}
{{ $e.Set "description" (printf "🔢 Counts: `%d`" $v) }}
{{ end }}

{{ $q := sdict }}{{ with (dbGet 20 "qotd").Value }}{{ $q = sdict . }}{{ end }}
{{ if $q }}
{{ $v := 0 }}{{ with ($q.Get $u) }}{{ $v = .n }}{{ end }}
{{ $e.Set "description" (printf "%s\n❓ QOTD answers: `%d`" $e.description $v) }}
{{ end }}

{{ $s := sdict }}{{ with (dbGet 20 "story-channel").Value }}{{ $s = sdict . }}{{ end }}
{{ if $s }}
{{ $v := 0 }}{{ with ($s.Get $u) }}{{ $v = . }}{{ end }}
{{ $e.Set "description" (printf "%s\n📖 Story lines: `%d`" $e.description $v) }}
{{ end }}

{{ if not (or $c $q $s) }}
{{ $e.Set "title" "❌ No data found!"}}
{{ else if $n := getMember (toInt $u) }}
{{ $e.Set "title" (printf "💎 Funinfo for: *%s*" $n.User.String) }}
{{ $e.Set "color" 15344584 }}
{{ else }}
{{ $e.Set "title" "❌ Member not found!" }}
{{ $e.Del "description" }}
{{ end }}

{{ sendMessage nil (cembed $e) }}

{{ if $cooldown }}{{ dbSetExpire .User.ID "funinfo" 1 $cooldown }}{{ end }}
{{ end }}

Author

This custom command was written by @SpecialEliteSNP.