forked from botlabs-gg/yagpdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reverse.go
46 lines (37 loc) · 1.07 KB
/
reverse.go
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
package reverse
import (
"github.com/jonas747/dcmd"
"github.com/jonas747/discordgo"
"github.com/jonas747/yagpdb/automod_legacy"
"github.com/jonas747/yagpdb/commands"
)
var Command = &commands.YAGCommand{
CmdCategory: commands.CategoryFun,
Name: "Reverse",
Aliases: []string{"r", "rev"},
Description: "Reverses the text given",
RunInDM: true,
RequiredArgs: 1,
Arguments: []*dcmd.ArgDef{
&dcmd.ArgDef{Name: "What", Type: dcmd.String},
},
RunFunc: func(data *dcmd.Data) (interface{}, error) {
toFlip := data.Args[0].Str()
out := ""
for _, r := range toFlip {
out = string(r) + out
}
cop := *data.Msg
cop.Content = out
if data.CS.Type == discordgo.ChannelTypeGuildText {
if automod_legacy.CheckMessageForBadInvites(out, data.CS.Guild.ID) {
return data.Msg.Author.Mention() + " tried to use the reverse command to send a invite to another server :(", nil
}
if automod_legacy.CheckMessage(&cop) {
return "", nil
}
out = automod_legacy.LinkRegex.ReplaceAllString(out, "")
}
return ":upside_down: " + out, nil
},
}