-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmanage_comment.go
45 lines (34 loc) · 1.29 KB
/
manage_comment.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
package main
import (
"net/url"
"github.com/bwmarrin/discordgo"
)
func handleCommentSetHiddenStatus(session *discordgo.Session, i *discordgo.InteractionCreate, UUID string) string {
if !(interactionHasRole(i, CommentManagerRoleID)) {
return ErrorMessageNeedRole
}
return getResultOfHTTPQuery("api/hide-comment", url.Values{"UUID": {UUID}})
}
func handleCensorComment(session *discordgo.Session, i *discordgo.InteractionCreate, UUID string) string {
if !(interactionHasRole(i, CommentManagerRoleID)) {
return ErrorMessageNeedRole
}
return getResultOfHTTPQuery("api/censor-comment", url.Values{"UUID": {UUID}})
}
func handleCommentListPending(session *discordgo.Session, i *discordgo.InteractionCreate) string {
if !(interactionHasRole(i, CommentManagerRoleID)) {
return ErrorMessageNeedRole
}
return getResultOfHTTPQuery("api/pending-comments", url.Values{})
}
func handleModerationActionOnAccount(session *discordgo.Session, i *discordgo.InteractionCreate, accountUUID string, action string, mod discordgo.User) string {
if !(interactionHasRole(i, CommentManagerRoleID)) {
return ErrorMessageNeedRole
}
params := url.Values{
"UUID": {accountUUID},
"action": {action},
"mID": {mod.ID},
"mName": {mod.Username}}
return getResultOfHTTPQuery("api/moderate-account", params)
}