Compare commits

...
2 Commits
Author SHA1 Message Date
Dustin Pianalto 4236915c5b Add option to sanitize everyone mentions 2020-05-18 22:36:19 -08:00
Dustin Pianalto 4ad95f415f Change status default interval to 30s 2020-05-12 11:46:02 -08:00
3 changed files with 10 additions and 1 deletions
+7
View File
@@ -125,6 +125,13 @@ func (c *CommandManager) OnMessage(session *discordgo.Session, m *discordgo.Mess
return return
} }
if command.SanitizeEveryone {
for i := 1; i < len(cmd[1:]); i++ {
cmd[i] = strings.ReplaceAll(cmd[i], "@everyone", "@\ufff0everyone")
cmd[i] = strings.ReplaceAll(cmd[i], "@here", "@\ufff0here")
}
}
if !CheckPermissions(session, m.Author.ID, *channel, command.RequiredPermissions) { if !CheckPermissions(session, m.Author.ID, *channel, command.RequiredPermissions) {
ctx := Context{ ctx := Context{
Session: session, Session: session,
+2
View File
@@ -48,6 +48,8 @@ type Command struct {
Hidden bool Hidden bool
// Permissions that are required for the command to function // Permissions that are required for the command to function
RequiredPermissions Permission RequiredPermissions Permission
// Should the message content be sanitized before invoking the command
SanitizeEveryone bool
// Function to invoke when command is called // Function to invoke when command is called
Invoke CommandInvokeFunc Invoke CommandInvokeFunc
} }
+1 -1
View File
@@ -20,7 +20,7 @@ func GetDefaultStatusManager() StatusManager {
"Golang!", "Golang!",
"DiscordGo!", "DiscordGo!",
"Disgoman!", "Disgoman!",
}, "10s"} }, "30s"}
} }
// HasHigherRole checks if the caller has a higher role than the target in the given guild // HasHigherRole checks if the caller has a higher role than the target in the given guild