mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
rename utils._nicktoUid to utils.nickToUid
Consistency in function capitalization is a good thing!!
This commit is contained in:
parent
43a46d3d99
commit
4d763288e5
@ -38,10 +38,10 @@ def quitclient(irc, source, args):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
utils.msg(irc, source, "Error: not enough arguments. Needs 1: nick.")
|
utils.msg(irc, source, "Error: not enough arguments. Needs 1: nick.")
|
||||||
return
|
return
|
||||||
if irc.pseudoclient.uid == utils._nicktoUid(irc, nick):
|
if irc.pseudoclient.uid == utils.nickToUid(irc, nick):
|
||||||
utils.msg(irc, source, "Error: cannot quit the main PyLink PseudoClient!")
|
utils.msg(irc, source, "Error: cannot quit the main PyLink PseudoClient!")
|
||||||
return
|
return
|
||||||
u = utils._nicktoUid(irc, nick)
|
u = utils.nickToUid(irc, nick)
|
||||||
quitmsg = ' '.join(args[1:]) or 'Client quit'
|
quitmsg = ' '.join(args[1:]) or 'Client quit'
|
||||||
proto.quitClient(irc, u, quitmsg)
|
proto.quitClient(irc, u, quitmsg)
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ def joinclient(irc, source, args):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, comma separated list of channels.")
|
utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, comma separated list of channels.")
|
||||||
return
|
return
|
||||||
u = utils._nicktoUid(irc, nick)
|
u = utils.nickToUid(irc, nick)
|
||||||
for channel in clist:
|
for channel in clist:
|
||||||
if not channel.startswith('#'):
|
if not channel.startswith('#'):
|
||||||
utils.msg(irc, source, "Error: channel names must start with #.")
|
utils.msg(irc, source, "Error: channel names must start with #.")
|
||||||
@ -72,7 +72,7 @@ def nickclient(irc, source, args):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, newnick.")
|
utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, newnick.")
|
||||||
return
|
return
|
||||||
u = utils._nicktoUid(irc, nick)
|
u = utils.nickToUid(irc, nick)
|
||||||
proto.nickClient(irc, u, newnick)
|
proto.nickClient(irc, u, newnick)
|
||||||
|
|
||||||
@utils.add_cmd
|
@utils.add_cmd
|
||||||
@ -85,7 +85,7 @@ def partclient(irc, source, args):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, comma separated list of channels.")
|
utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, comma separated list of channels.")
|
||||||
return
|
return
|
||||||
u = utils._nicktoUid(irc, nick)
|
u = utils.nickToUid(irc, nick)
|
||||||
for channel in clist:
|
for channel in clist:
|
||||||
if not channel.startswith('#'):
|
if not channel.startswith('#'):
|
||||||
utils.msg(irc, source, "Error: channel names must start with #.")
|
utils.msg(irc, source, "Error: channel names must start with #.")
|
||||||
@ -103,8 +103,8 @@ def kickclient(irc, source, args):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
utils.msg(irc, source, "Error: not enough arguments. Needs 3-4: nick, channel, target, reason (optional).")
|
utils.msg(irc, source, "Error: not enough arguments. Needs 3-4: nick, channel, target, reason (optional).")
|
||||||
return
|
return
|
||||||
u = utils._nicktoUid(irc, nick)
|
u = utils.nickToUid(irc, nick)
|
||||||
targetu = utils._nicktoUid(irc, target)
|
targetu = utils.nickToUid(irc, target)
|
||||||
if not channel.startswith('#'):
|
if not channel.startswith('#'):
|
||||||
utils.msg(irc, source, "Error: channel names must start with #.")
|
utils.msg(irc, source, "Error: channel names must start with #.")
|
||||||
return
|
return
|
||||||
|
@ -12,7 +12,7 @@ def tell(irc, source, args):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
utils.msg(irc, source, 'Error: not enough arguments.')
|
utils.msg(irc, source, 'Error: not enough arguments.')
|
||||||
return
|
return
|
||||||
targetuid = proto._nicktoUid(irc, target)
|
targetuid = utils.nickToUid(irc, target)
|
||||||
if targetuid is None:
|
if targetuid is None:
|
||||||
utils.msg(irc, source, 'Error: unknown user %r' % target)
|
utils.msg(irc, source, 'Error: unknown user %r' % target)
|
||||||
return
|
return
|
||||||
|
2
utils.py
2
utils.py
@ -27,7 +27,7 @@ def add_cmd(func, name=None):
|
|||||||
name = name.lower()
|
name = name.lower()
|
||||||
bot_commands[name] = func
|
bot_commands[name] = func
|
||||||
|
|
||||||
def _nicktoUid(irc, nick):
|
def nickToUid(irc, nick):
|
||||||
for k, v in irc.users.items():
|
for k, v in irc.users.items():
|
||||||
if v.nick == nick:
|
if v.nick == nick:
|
||||||
return k
|
return k
|
||||||
|
Loading…
Reference in New Issue
Block a user