Skip to main content

Repeat Phrase

This command repeats text provided.

Trigger

Type: Command
Trigger: repeat

Usage

  • -repeat <phrase> - Repeats phrase 5 times (you can change this in the code). If phrase has spaces in it, you should put quotes around it; for example, -repeat "hello world".
  • -repeat <amount> <phrase> - Repeats phrase the specified number of times.

Code

{{/*
Repeats a phrase.
See <https://yagpdb-cc.github.io/fun/repeat> for more information.

Author: jo3-l <https://github.com/jo3-l>
*/}}

{{ $msg := "" }}
{{ if eq (len .CmdArgs) 1 }}
{{ $phrase := index .CmdArgs 0 }}
{{ range seq 0 5 }}
{{- $msg = joinStr "\n" $msg $phrase -}}
{{ end }}
{{ sendMessage nil $msg }}
{{ else if .CmdArgs }}
{{ $count := index .CmdArgs 0 | toInt }}
{{ $phrase := slice .CmdArgs 1 | joinStr " " }}
{{ if and $count (le $count 2000) }}
{{ range seq 0 $count }}
{{- $msg = joinStr "\n" $msg $phrase -}}
{{ end }}
{{ if le (len $msg) 2000 }} {{ sendMessage nil $msg }}
{{ else }} That message was too long! {{ end }}
{{ else }}
**Syntax:** `-repeat <amount> <phrase>`
{{ end }}
{{ else }}
**Syntax:** `-repeat <amount> <phrase>`
{{ end }}

Author

This custom command was written by @jo3-l.