|
|
@ -1,6 +1,9 @@
|
|
|
|
package modules
|
|
|
|
package modules
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"crypto/rand"
|
|
|
|
|
|
|
|
"crypto/sha512"
|
|
|
|
|
|
|
|
"encoding/hex"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
@ -50,7 +53,16 @@ var editAs = adminOnly(enforceArgumentCount(config.EditAsUsage, 4,
|
|
|
|
))
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
var viewTrustLevel = adminOnly(func(s *discordgo.Session, m *discordgo.MessageCreate, command []string) {
|
|
|
|
var viewTrustLevel = adminOnly(func(s *discordgo.Session, m *discordgo.MessageCreate, command []string) {
|
|
|
|
if len(command) > 1 {
|
|
|
|
if len(command) > 1 && command[1] != "unobf" {
|
|
|
|
|
|
|
|
user, err := backend.GetMemberFromUserFriendlyName(s, command[1])
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
message.InitNewEmbed(
|
|
|
|
|
|
|
|
config.ErrorVTLTitle,
|
|
|
|
|
|
|
|
config.ErrorVTLTargetNotFound,
|
|
|
|
|
|
|
|
config.ErrorColour,
|
|
|
|
|
|
|
|
).Send(s, m.ChannelID)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
value, err := backend.GetTrust(s, command[1])
|
|
|
|
value, err := backend.GetTrust(s, command[1])
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
message.AuditError(s, m.ChannelID, err)
|
|
|
|
message.AuditError(s, m.ChannelID, err)
|
|
|
@ -81,6 +93,9 @@ var viewTrustLevel = adminOnly(func(s *discordgo.Session, m *discordgo.MessageCr
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
salt := make([]byte, 16)
|
|
|
|
|
|
|
|
rand.Read(salt)
|
|
|
|
|
|
|
|
|
|
|
|
//Generate message
|
|
|
|
//Generate message
|
|
|
|
msg := message.NewEmbed().SetColour(config.VTLColour).SetTitle(config.VTLGlobalTitle)
|
|
|
|
msg := message.NewEmbed().SetColour(config.VTLColour).SetTitle(config.VTLGlobalTitle)
|
|
|
|
for _, v := range members {
|
|
|
|
for _, v := range members {
|
|
|
@ -92,12 +107,27 @@ var viewTrustLevel = adminOnly(func(s *discordgo.Session, m *discordgo.MessageCr
|
|
|
|
message.AuditError(s, m.ChannelID, err)
|
|
|
|
message.AuditError(s, m.ChannelID, err)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var username string
|
|
|
|
|
|
|
|
if len(command) > 1 {
|
|
|
|
|
|
|
|
username = v.User.Username + "#" + v.User.Discriminator
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
saltedUsername := []byte(v.User.Username + "#" + v.User.Discriminator)
|
|
|
|
|
|
|
|
saltedUsername = append(saltedUsername, salt...)
|
|
|
|
|
|
|
|
username = hex.EncodeToString(sha512.New().Sum(saltedUsername))[:64]
|
|
|
|
|
|
|
|
if username == "" {
|
|
|
|
|
|
|
|
username = "<cannot calculate hash>"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
msg.AddInlineField(
|
|
|
|
msg.AddInlineField(
|
|
|
|
v.User.Username+"#"+v.User.Discriminator,
|
|
|
|
username,
|
|
|
|
fmt.Sprintf(config.VTLGlobalFieldFormat, value, total, value/total*100),
|
|
|
|
fmt.Sprintf(config.VTLGlobalFieldFormat, value, total, value/total*100),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
msg.Send(s, m.ChannelID)
|
|
|
|
_, err = msg.Send(s, m.ChannelID)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
message.AuditError(s, m.ChannelID, err)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
var batchGiveRole = adminOnly(enforceDM(enforceArgumentCount(
|
|
|
|
var batchGiveRole = adminOnly(enforceDM(enforceArgumentCount(
|
|
|
|