This repository has been archived by the owner on May 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
text.yag
54 lines (54 loc) · 1.8 KB
/
text.yag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{{$chan := reFind `\-chan` .Message.Content}}
{{$id := 0}}
{{$channel := "nil"}}
{{$champ := reFind `\-(footer|title|field(s?)|color|author)` .Message.Content }}
{{if $chan}}
{{$channel = (toInt (index .CmdArgs 1))}}
{{$id = (toInt (index .CmdArgs 2)) }}
{{else}}
{{$channel = .Channel.ID}}
{{$id = (toInt (index .CmdArgs 0))}}
{{end}}
{{$msg:= getMessage $channel $id}}
{{$rep := ""}}
{{if $msg.Embeds}}
{{with (index $msg.Embeds 0)}}
{{if eq $champ "-field" "-fields"}}
{{ range $i, $j := .Fields }}
{{ $rep = print $rep $j.Name " : \n ```\n" $j.Value "\n ```\n\n" }}
{{$i = add $i 1}}
{{ end }}
{{else if eq $champ "-footer"}}
{{$rep = print $rep .Footer.Text "\n"}}
{{else if eq $champ "-title"}}
{{$rep = print $rep .Title "\n"}}
{{else if eq $champ "-color"}}
{{$rep = print $rep .Color "\n"}}
{{else if eq $champ "-author"}}
{{$rep = print $rep .Author.Name "\n"}}
{{else}}
{{$rep = print $rep .Description "\n"}}
{{end}}
{{end}}
{{end}}
{{$content := ""}}
{{if $msg.Content}}
{{$content = print $msg.Content}}
{{end}}
{{deleteTrigger 1}}
{{if (reFind `-dl` .Message.Content)}}
{{$content = print "Voici le document demandé ! \n " $content}}
{{$idm := sendMessageRetID nil (complexMessage "content" $content "embed" nil "file" $rep)}}
{{deleteMessage nil $idm 180}}
{{else}}
{{if le (len $rep) 2000}}
{{$idm := sendMessageRetID nil (print "```" $rep "```")}}
{{$idc := sendMessageRetID nil (print "```" $content "```")}}
{{deleteMessage nil $idm 180}}
{{deleteMessage nil $idc 180}}
{{else}}
{{$content = print "Votre réponse est trop longue, donc voici le fichier le contenant. \n " $content}}
{{$idm := sendMessageRetID nil (complexMessage "content" $content "embed" nil "file" $rep)}}
{{deleteMessage nil $idm 180}}
{{end}}
{{end}}