remove now-unneeded perm checks

master
Marc 2021-06-01 01:47:27 +01:00
parent ba53353265
commit 81b44b2721
No known key found for this signature in database
GPG Key ID: 0657563F705ACAAE
4 changed files with 4 additions and 68 deletions

View File

@ -10,10 +10,6 @@ import (
)
func (c *Commands) handleSetStatus(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
stSplit := strings.SplitN(m.Content, " ", 2)
if len(stSplit) < 2 {
return errors.New("You did not specify a status.")
@ -36,10 +32,6 @@ func (c *Commands) handleSetStatus(s *discordgo.Session, m *discordgo.MessageCre
}
func (c *Commands) handleDisconnect(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("I'm sorry Dave, I'm afraid I can't do that.")
}
msg := c.CreateDefinedEmbed("Disconnect", "Attempting Disconnect...", "", m.Author)
_, err := s.ChannelMessageSendEmbed(m.ChannelID, msg)
if err != nil {
@ -57,10 +49,6 @@ func (c *Commands) handleDisconnect(s *discordgo.Session, m *discordgo.MessageCr
}
func (c *Commands) handleReconnect(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
t := time.Now()
err := s.Close()

View File

@ -120,10 +120,6 @@ func (c *Commands) handleLeaveCustomRole(s *discordgo.Session, m *discordgo.Mess
func (c *Commands) handleAddCustomRole(s *discordgo.Session, m *discordgo.MessageCreate) error {
var err error
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
userInput := strings.Split(m.Content, " ")
if len(userInput) < 3 {
return errors.New("Expected Arguments: short_name role_id")

View File

@ -17,10 +17,6 @@ import (
)
func (c *Commands) handleSetConfig(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
configArgs := strings.Split(m.Content, " ")
if len(configArgs) != 3 {
@ -84,10 +80,6 @@ func (c *Commands) handleSetConfig(s *discordgo.Session, m *discordgo.MessageCre
func (c *Commands) handleGetConfig(s *discordgo.Session, m *discordgo.MessageCreate) error {
//TODO: Handle printing of slices (check the Type, loop accordingly)
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
configArgs := strings.Split(m.Content, " ")
configKey := "all"
if len(configArgs) == 2 {
@ -153,10 +145,6 @@ func (c *Commands) handleGetConfig(s *discordgo.Session, m *discordgo.MessageCre
}
func (c *Commands) handleReloadConfig(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use this command.")
}
fBuf, err := ioutil.ReadFile(c.Config.ConfigPath)
if err != nil {
return err
@ -182,10 +170,6 @@ func (c *Commands) handleReloadConfig(s *discordgo.Session, m *discordgo.Message
}
func (c *Commands) handleSaveConfig(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use this command.")
}
j, err := json.Marshal(c.Config)
if err != nil {
return err
@ -223,15 +207,11 @@ func (c *Commands) handlePing(s *discordgo.Session, m *discordgo.MessageCreate)
var r *discordgo.Message
var err error
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
} else {
msg := c.CreateDefinedEmbed("Ping", "Pong", "success", m.Author)
r, err = s.ChannelMessageSendEmbed(m.ChannelID, msg)
if err != nil {
return err
}
}
time.Sleep(5 * time.Second)
@ -338,10 +318,6 @@ func (c *Commands) handleHelp(s *discordgo.Session, m *discordgo.MessageCreate)
}
func (c *Commands) handleRules(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
msg := c.Config.RulesText
embedTitle := "Rules (" + c.Config.GuildName + ")"
embed := c.CreateDefinedEmbed(embedTitle, msg, "success", m.Author)

View File

@ -9,10 +9,6 @@ import (
)
func (c *Commands) handleSetSlowmode(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
slowmodeSplit := strings.Split(m.Content, " ")
if len(slowmodeSplit) < 2 {
return errors.New("You must supply at least an amount of time")
@ -56,10 +52,6 @@ func (c *Commands) handleSetSlowmode(s *discordgo.Session, m *discordgo.MessageC
}
func (c *Commands) handleUnsetSlowmode(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
slowmodeSplit := strings.Split(m.Content, " ")
if len(slowmodeSplit) == 2 {
@ -94,10 +86,6 @@ func (c *Commands) handleUnsetSlowmode(s *discordgo.Session, m *discordgo.Messag
}
func (c *Commands) handlePurgeChannel(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use that command.")
}
purgeSplit := strings.SplitN(m.Content, " ", 2)
if len(purgeSplit) < 2 {
return errors.New("No message count supplied")
@ -194,10 +182,6 @@ func (c *Commands) handleKickUser(s *discordgo.Session, m *discordgo.MessageCrea
}
func (c *Commands) handleBanUser(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use this command.")
}
var (
mHandle *discordgo.User
banReason string
@ -241,10 +225,6 @@ func (c *Commands) handleBanUser(s *discordgo.Session, m *discordgo.MessageCreat
}
func (c *Commands) handleIgnoreUser(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use this command.")
}
ignArgs := strings.Split(m.Content, " ")
if len(ignArgs) < 2 {
return errors.New("You did not specify a user.")
@ -272,10 +252,6 @@ func (c *Commands) handleIgnoreUser(s *discordgo.Session, m *discordgo.MessageCr
}
func (c *Commands) handleUnIgnoreUser(s *discordgo.Session, m *discordgo.MessageCreate) error {
if !c.Permissions.CheckAdminRole(m.Member) {
return errors.New("You do not have permissions to use this command.")
}
ignArgs := strings.Split(m.Content, " ")
if len(ignArgs) < 2 {
return errors.New("You did not specify a user.")