Skip to main content

Main CC

This command sends anonymous messages and maintains the sticky message with the anonymous message submit button.

For more information about the anonymous channel, see the overview page.

Trigger

Type: Regex
Trigger: \A

danger

This command should be set to only run in your anonymous channel in the channel restrictions.

Configuration

See the anonymous channel overview for more information regarding how to configure this command.

Code

{{/*
Sticky message with button to submit an anonymous message.
See <https://yagpdb-cc.github.io/fun/anon-channel/main-cc> for more information.

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

{{ $ALL_ANON := true }}

{{/* CONFIG ENDS */}}

{{ dbSet 0 "anon_main_cc_id" .CCID }}

{{ $msg := .ExecData }}

{{ if and ( not $msg ) ( or $ALL_ANON ( hasPrefix .Message.Content ( print .ServerPrefix "anon" ) ) ) }}
{{ deleteTrigger 0 }}
{{ $msg = reReplace ( printf `\A\s*\Q%s\Eanon(ymous)?\s*` .ServerPrefix ) .Message.Content "" }}
{{ end }}

{{ with $msg }}
{{ $anonymousIcon := "https://i.imgur.com/9slnZlV.jpeg" }}
{{ sendMessage nil ( cembed "author" ( sdict "name" "Anonymous" "icon_url" $anonymousIcon ) "description" . ) }}
{{ end }}

{{ $message := complexMessage "buttons" ( sdict "label" "Send an anonymous message" "custom_id" "anon_submit" "style" "grey" ) }}

{{ if $db := dbGet .Channel.ID "anon_stickymessage" }}
{{ deleteMessage nil ( toInt $db.Value ) 0 }}
{{ end }}
{{ $id := sendMessageRetID nil $message }}
{{ dbSet .Channel.ID "stickymessage" ( str $id ) }}

Author

This custom command was written by @soggysaussages.