Skip to content

Commit

Permalink
Replace all uses of Nick with Identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
embolalia committed Dec 13, 2014
1 parent 4352277 commit 4c2d874
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
14 changes: 7 additions & 7 deletions adminchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import re
from willie import formatting
from willie.module import commands, priority, OP, HALFOP
from willie.tools import Nick
from willie.tools import Identifier


def default_mask(trigger):
Expand Down Expand Up @@ -107,7 +107,7 @@ def kick(bot, trigger):
argc = len(text)
if argc < 2:
return
opt = Nick(text[1])
opt = Identifier(text[1])
nick = opt
channel = trigger.sender
reasonidx = 2
Expand Down Expand Up @@ -159,7 +159,7 @@ def ban(bot, trigger):
argc = len(text)
if argc < 2:
return
opt = Nick(text[1])
opt = Identifier(text[1])
banmask = opt
channel = trigger.sender
if not opt.is_nick():
Expand Down Expand Up @@ -187,7 +187,7 @@ def unban(bot, trigger):
argc = len(text)
if argc < 2:
return
opt = Nick(text[1])
opt = Identifier(text[1])
banmask = opt
channel = trigger.sender
if not opt.is_nick():
Expand Down Expand Up @@ -215,7 +215,7 @@ def quiet(bot, trigger):
argc = len(text)
if argc < 2:
return
opt = Nick(text[1])
opt = Identifier(text[1])
quietmask = opt
channel = trigger.sender
if not opt.is_nick():
Expand Down Expand Up @@ -243,7 +243,7 @@ def unquiet(bot, trigger):
argc = len(text)
if argc < 2:
return
opt = Nick(text[1])
opt = Identifier(text[1])
quietmask = opt
channel = trigger.sender
if not opt.is_nick():
Expand Down Expand Up @@ -273,7 +273,7 @@ def kickban(bot, trigger):
argc = len(text)
if argc < 4:
return
opt = Nick(text[1])
opt = Identifier(text[1])
nick = opt
mask = text[2]
reasonidx = 3
Expand Down
14 changes: 7 additions & 7 deletions find.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from __future__ import unicode_literals

import re
from willie.tools import Nick, WillieMemory
from willie.tools import Identifier, WillieMemory
from willie.module import rule, priority
from willie.formatting import bold

Expand All @@ -35,11 +35,11 @@ def collectlines(bot, trigger):
# Add a log for the channel and nick, if there isn't already one
if trigger.sender not in bot.memory['find_lines']:
bot.memory['find_lines'][trigger.sender] = WillieMemory()
if Nick(trigger.nick) not in bot.memory['find_lines'][trigger.sender]:
bot.memory['find_lines'][trigger.sender][Nick(trigger.nick)] = list()
if Identifier(trigger.nick) not in bot.memory['find_lines'][trigger.sender]:
bot.memory['find_lines'][trigger.sender][Identifier(trigger.nick)] = list()

# Create a temporary list of the user's lines in a channel
templist = bot.memory['find_lines'][trigger.sender][Nick(trigger.nick)]
templist = bot.memory['find_lines'][trigger.sender][Identifier(trigger.nick)]
line = trigger.group()
if line.startswith("s/"): # Don't remember substitutions
return
Expand All @@ -51,7 +51,7 @@ def collectlines(bot, trigger):

del templist[:-10] # Keep the log to 10 lines per person

bot.memory['find_lines'][trigger.sender][Nick(trigger.nick)] = templist
bot.memory['find_lines'][trigger.sender][Identifier(trigger.nick)] = templist


#Match nick, s/find/replace/flags. Flags and nick are optional, nick can be
Expand All @@ -77,13 +77,13 @@ def findandreplace(bot, trigger):
return

# Correcting other person vs self.
rnick = Nick(trigger.group(1) or trigger.nick)
rnick = Identifier(trigger.group(1) or trigger.nick)

search_dict = bot.memory['find_lines']
# only do something if there is conversation to work with
if trigger.sender not in search_dict:
return
if Nick(rnick) not in search_dict[trigger.sender]:
if Identifier(rnick) not in search_dict[trigger.sender]:
return

#TODO rest[0] is find, rest[1] is replace. These should be made variables of
Expand Down
4 changes: 2 additions & 2 deletions meetbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from willie.web import quote
from willie.modules.url import find_title
from willie.module import example, commands, rule, priority
from willie.tools import Ddict, Nick
from willie.tools import Ddict, Identifier
import codecs


Expand Down Expand Up @@ -383,7 +383,7 @@ def take_comment(bot, trigger):
return

target, message = trigger.group(2).split(None, 1)
target = Nick(target)
target = Identifier(target)
if not ismeetingrunning(target):
bot.say("There's not currently a meeting in that channel.")
else:
Expand Down
6 changes: 3 additions & 3 deletions seen.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import time
import datetime
from willie.tools import Ddict, Nick, get_timezone, format_time
from willie.tools import Ddict, Identifier, get_timezone, format_time
from willie.module import commands, rule, priority

seen_dict = Ddict(dict)
Expand All @@ -23,7 +23,7 @@ def seen(bot, trigger):
if not trigger.group(2):
bot.say(".seen <nick> - Reports when <nick> was last seen.")
return
nick = Nick(trigger.group(2).strip())
nick = Identifier(trigger.group(2).strip())
if nick in seen_dict:
timestamp = seen_dict[nick]['timestamp']
channel = seen_dict[nick]['channel']
Expand All @@ -45,7 +45,7 @@ def seen(bot, trigger):
@priority('low')
def note(bot, trigger):
if not trigger.is_privmsg:
nick = Nick(trigger.nick)
nick = Identifier(trigger.nick)
seen_dict[nick]['timestamp'] = time.time()
seen_dict[nick]['channel'] = trigger.sender
seen_dict[nick]['message'] = trigger
8 changes: 4 additions & 4 deletions tell.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import willie.tools
import threading
import sys
from willie.tools import Nick, iterkeys
from willie.tools import Identifier, iterkeys
from willie.module import commands, nickname_commands, rule, priority, example

maximum = 4
Expand Down Expand Up @@ -98,7 +98,7 @@ def f_remind(bot, trigger):
bot.reply("%s %s what?" % (verb, tellee))
return

tellee = Nick(tellee)
tellee = Identifier(tellee)

if not os.path.exists(bot.tell_filename):
return
Expand All @@ -108,7 +108,7 @@ def f_remind(bot, trigger):
if tellee == bot.nick:
return bot.reply("I'm here now, you can tell me whatever you want!")

if not tellee in (Nick(teller), bot.nick, 'me'):
if not tellee in (Identifier(teller), bot.nick, 'me'):
tz = willie.tools.get_timezone(bot.db, bot.config, None, tellee)
timenow = willie.tools.format_time(bot.db, bot.config, tz, tellee)
bot.memory['tell_lock'].acquire()
Expand All @@ -123,7 +123,7 @@ def f_remind(bot, trigger):
response = "I'll pass that on when %s is around." % tellee

bot.reply(response)
elif Nick(teller) == tellee:
elif Identifier(teller) == tellee:
bot.say('You can %s yourself that.' % verb)
else:
bot.say("Hey, I'm not as stupid as Monty you know!")
Expand Down

0 comments on commit 4c2d874

Please sign in to comment.