Compare commits

..

No commits in common. "45103cec624a021e0c2f31dc68a8c4d4db3c72f5" and "3482c0c8e49b4fc91514b448ccb40902e4c82850" have entirely different histories.

6 changed files with 0 additions and 34 deletions

View File

@ -226,9 +226,6 @@ type Connector interface {
// SetRole toggles a role on/off for a user by ID // SetRole toggles a role on/off for a user by ID
SetRole(userID, roleID string) error SetRole(userID, roleID string) error
// Nick sets the username of the bot on the server
Nick(string) error
} }
// Plugin interface used for compatibility with the Plugin interface // Plugin interface used for compatibility with the Plugin interface

View File

@ -423,8 +423,3 @@ func (d *Discord) Shutdown() {
} }
} }
} }
func (d *Discord) Nick(nick string) error {
guildID := d.config.Get("discord.guildid", "")
return d.client.GuildMemberNickname(guildID, "@me", nick)
}

View File

@ -361,8 +361,3 @@ func (i Irc) SetRole(userID, roleID string) error {
} }
func (i Irc) Shutdown() {} func (i Irc) Shutdown() {}
func (i Irc) Nick(nick string) error {
// Yeah, I could figure this out, but I don't want to test/debug it
return fmt.Errorf("nick changes not supported on irc")
}

View File

@ -751,7 +751,3 @@ func (s *SlackApp) SetRole(userID, roleID string) error {
} }
func (s *SlackApp) Shutdown() {} func (s *SlackApp) Shutdown() {}
func (s *SlackApp) Nick(nick string) error {
return s.api.SetUserRealName(nick)
}

View File

@ -57,7 +57,6 @@ func New(b bot.Bot) *AdminPlugin {
b.RegisterRegexCmd(p, bot.Message, pushConfigRegex, p.isAdmin(p.pushConfigCmd)) b.RegisterRegexCmd(p, bot.Message, pushConfigRegex, p.isAdmin(p.pushConfigCmd))
b.RegisterRegexCmd(p, bot.Message, setKeyConfigRegex, p.isAdmin(p.setKeyConfigCmd)) b.RegisterRegexCmd(p, bot.Message, setKeyConfigRegex, p.isAdmin(p.setKeyConfigCmd))
b.RegisterRegexCmd(p, bot.Message, getConfigRegex, p.isAdmin(p.getConfigCmd)) b.RegisterRegexCmd(p, bot.Message, getConfigRegex, p.isAdmin(p.getConfigCmd))
b.RegisterRegexCmd(p, bot.Message, setNickRegex, p.setNick)
b.Register(p, bot.Help, p.help) b.Register(p, bot.Help, p.help)
p.registerWeb() p.registerWeb()
@ -107,7 +106,6 @@ var setConfigRegex = regexp.MustCompile(`(?i)^set (?P<key>\S+) (?P<value>.*)$`)
var pushConfigRegex = regexp.MustCompile(`(?i)^push (?P<key>\S+) (?P<value>.*)$`) var pushConfigRegex = regexp.MustCompile(`(?i)^push (?P<key>\S+) (?P<value>.*)$`)
var setKeyConfigRegex = regexp.MustCompile(`(?i)^setkey (?P<key>\S+) (?P<name>\S+) (?P<value>.*)$`) var setKeyConfigRegex = regexp.MustCompile(`(?i)^setkey (?P<key>\S+) (?P<name>\S+) (?P<value>.*)$`)
var getConfigRegex = regexp.MustCompile(`(?i)^get (?P<key>\S+)$`) var getConfigRegex = regexp.MustCompile(`(?i)^get (?P<key>\S+)$`)
var setNickRegex = regexp.MustCompile(`(?i)^nick (?P<nick>.+)$`)
func (p *AdminPlugin) isAdmin(rh bot.ResponseHandler) bot.ResponseHandler { func (p *AdminPlugin) isAdmin(rh bot.ResponseHandler) bot.ResponseHandler {
return func(r bot.Request) bool { return func(r bot.Request) bool {
@ -409,17 +407,3 @@ func (p *AdminPlugin) modList(query, channel, plugin string) error {
err := fmt.Errorf("unknown plugin named '%s'", plugin) err := fmt.Errorf("unknown plugin named '%s'", plugin)
return err return err
} }
func (p *AdminPlugin) setNick(r bot.Request) bool {
if needAdmin := p.cfg.GetInt("nick.needsadmin", 1); needAdmin == 1 && !p.bot.CheckAdmin(r.Msg.User.ID) {
return false
}
nick := r.Values["nick"]
if err := r.Conn.Nick(nick); err != nil {
log.Error().Err(err).Msg("set nick")
p.bot.Send(r.Conn, bot.Message, r.Msg.Channel, "I can't seem to set a new nick.")
return true
}
p.bot.Send(r.Conn, bot.Message, r.Msg.Channel, fmt.Sprintf("I shall now be known as %s.", nick))
return true
}

View File

@ -140,4 +140,3 @@ func (p *CliPlugin) GetChannelName(id string) string { return id }
func (p *CliPlugin) GetChannelID(name string) string { return name } func (p *CliPlugin) GetChannelID(name string) string { return name }
func (p *CliPlugin) GetRoles() ([]bot.Role, error) { return []bot.Role{}, nil } func (p *CliPlugin) GetRoles() ([]bot.Role, error) { return []bot.Role{}, nil }
func (p *CliPlugin) SetRole(userID, roleID string) error { return nil } func (p *CliPlugin) SetRole(userID, roleID string) error { return nil }
func (p *CliPlugin) Nick(string) error { return nil }