mirror of https://github.com/hak5/scuzzy.git
i forgot what i was doing here
parent
81b44b2721
commit
16d76c716b
|
@ -0,0 +1,21 @@
|
||||||
|
package actions
|
||||||
|
|
||||||
|
import "github.com/bwmarrin/discordgo"
|
||||||
|
|
||||||
|
func KickUser(s *discordgo.Session, guild string, user string, reason string) error {
|
||||||
|
err := s.GuildMemberDeleteWithReason(guild, user, reason)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func BanUser(s *discordgo.Session, guild string, user string, reason string) error {
|
||||||
|
err := s.GuildBanCreateWithReason(guild, user, reason, 0)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -2,10 +2,12 @@ package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/bwmarrin/discordgo"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/bwmarrin/discordgo"
|
||||||
|
"github.com/foxtrot/scuzzy/actions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Commands) handleSetSlowmode(s *discordgo.Session, m *discordgo.MessageCreate) error {
|
func (c *Commands) handleSetSlowmode(s *discordgo.Session, m *discordgo.MessageCreate) error {
|
||||||
|
@ -150,7 +152,7 @@ func (c *Commands) handleKickUser(s *discordgo.Session, m *discordgo.MessageCrea
|
||||||
return errors.New("You must specify a user to kick.")
|
return errors.New("You must specify a user to kick.")
|
||||||
}
|
}
|
||||||
if len(args) == 3 {
|
if len(args) == 3 {
|
||||||
kickReason = args[2]
|
kickReason = strings.Join(args[2:], " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
member := args[1]
|
member := args[1]
|
||||||
|
@ -162,7 +164,7 @@ func (c *Commands) handleKickUser(s *discordgo.Session, m *discordgo.MessageCrea
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.GuildMemberDeleteWithReason(c.Config.GuildID, mHandle.User.ID, kickReason)
|
err = actions.KickUser(s, c.Config.GuildID, mHandle.User.ID, kickReason)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -193,7 +195,7 @@ func (c *Commands) handleBanUser(s *discordgo.Session, m *discordgo.MessageCreat
|
||||||
return errors.New("You must specify a user to ban.")
|
return errors.New("You must specify a user to ban.")
|
||||||
}
|
}
|
||||||
if len(args) == 3 {
|
if len(args) == 3 {
|
||||||
banReason = args[2]
|
banReason = strings.Join(args[2:], " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
member := args[1]
|
member := args[1]
|
||||||
|
@ -205,7 +207,7 @@ func (c *Commands) handleBanUser(s *discordgo.Session, m *discordgo.MessageCreat
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.GuildBanCreateWithReason(c.Config.GuildID, mHandle.ID, banReason, 0)
|
err = actions.BanUser(s, c.Config.GuildID, mHandle.ID, banReason, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ type UserMessageStat struct {
|
||||||
MessagesLastHour int
|
MessagesLastHour int
|
||||||
MessagesLastFiveMins int
|
MessagesLastFiveMins int
|
||||||
MessagesLastTenSecs int
|
MessagesLastTenSecs int
|
||||||
|
LastActiveChannel string
|
||||||
Warnings int
|
Warnings int
|
||||||
Kicks int
|
Kicks int
|
||||||
}
|
}
|
||||||
|
@ -89,6 +90,7 @@ func (o *Overwatch) handleUserStat(s *discordgo.Session, m *discordgo.MessageCre
|
||||||
user.MessagesLastHour++
|
user.MessagesLastHour++
|
||||||
user.MessagesLastFiveMins++
|
user.MessagesLastFiveMins++
|
||||||
user.MessagesLastTenSecs++
|
user.MessagesLastTenSecs++
|
||||||
|
user.LastActiveChannel = m.ChannelID
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue