Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions sopel/coretasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,19 +672,32 @@ def track_nicks(bot, trigger):

# Give debug message, and PM the owner, if the bot's own nick changes.
if old == bot.nick and new != bot.nick:
privmsg = (
"Hi, I'm your bot, %s. Something has made my nick change. This "
"can cause some problems for me, and make me do weird things. "
"You'll probably want to restart me, and figure out what made "
"that happen so you can stop it happening again. (Usually, it "
"means you tried to give me a nick that's protected by NickServ.)"
) % bot.nick
debug_msg = (
"Nick changed by server. This can cause unexpected behavior. "
"Please restart the bot."
)
LOGGER.critical(debug_msg)
bot.say(privmsg, bot.config.core.owner)
# Is this the original nick being regained?
# e.g. by ZNC's keepnick module running in front of Sopel
if old != bot.config.core.nick and new == bot.config.core.nick:
LOGGER.info(
"Regained configured nick. Restarting is still recommended.")
else:
privmsg = (
"Hi, I'm your bot, %s. Something has made my nick change. This "
"can cause some problems for me, and make me do weird things. "
"You'll probably want to restart me, and figure out what made "
"that happen so you can stop it happening again. (Usually, it "
"means you tried to give me a nick that's protected by NickServ.)"
) % bot.config.core.nick
debug_msg = (
"Nick changed by server. This can cause unexpected behavior. "
"Please restart the bot."
)
LOGGER.critical(debug_msg)
bot.say(privmsg, bot.config.core.owner)

# Always update bot.nick anyway so Sopel doesn't lose its self-identity.
# This should cut down the number of "weird things" that happen while
# the active nick doesn't match the config, but it's not a substitute
# for regaining the expected nickname.
LOGGER.info("Updating bot.nick property with server-changed nick.")
bot._nick = new
return

for channel in bot.channels.values():
Expand Down
8 changes: 6 additions & 2 deletions sopel/modules/adminchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,12 @@ def kick(bot, trigger):
channel = opt
reasonidx = 3
reason = ' '.join(text[reasonidx:])
if nick != bot.make_identifier(bot.config.core.nick):
bot.kick(nick, channel, reason)

if nick == bot.nick:
bot.reply("Hey! Don't kick me. :(")
return

bot.kick(nick, channel, reason)


def configureHostMask(mask):
Expand Down