|
|
@ -1,6 +1,7 @@
|
|
|
|
package main
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
@ -38,3 +39,44 @@ func editAs(s *discordgo.Session, m *discordgo.MessageCreate, command []string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s.ChannelMessageSend(m.ChannelID, "The message has been edited.")
|
|
|
|
s.ChannelMessageSend(m.ChannelID, "The message has been edited.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func viewTrustLevel(s *discordgo.Session, m *discordgo.MessageCreate, command []string) {
|
|
|
|
|
|
|
|
if m.Author.ID != adminID {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(command) > 1 {
|
|
|
|
|
|
|
|
value, err := getTrust(command[1])
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, err.Error())
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
total, err := getTotalTrust(s)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, err.Error())
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("Trust level is %.1f/%.1f (%.2f%%) for user <@%d>.", value, total, value/total*100, command[1]))
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
total, err := getTotalTrust(s)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, err.Error())
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message := ""
|
|
|
|
|
|
|
|
members, err := getAllMembers(s)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, err.Error())
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, v := range members {
|
|
|
|
|
|
|
|
value, err := getTrust(v.User.ID)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, err.Error())
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
message += fmt.Sprintf("%s#%s - %.1f/%.1f (%.2f%%)\n", v.User.Username, v.User.Discriminator, value, total, value/total*100)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, message)
|
|
|
|
|
|
|
|
}
|
|
|
|