3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-11 20:52:42 +01:00

exttargets: add $realname target

This commit is contained in:
James Lu 2017-08-06 21:41:44 -07:00
parent 9e97dd0b75
commit 2ff0007e56

View File

@ -190,3 +190,15 @@ def exttarget_and(irc, host, uid):
# Wrap every subtarget into irc.match_host and return True if all subtargets return True.
return all(map(lambda sub_exttarget: irc.match_host(sub_exttarget, uid), targets))
world.exttarget_handlers['and'] = exttarget_and
@bind
def realname(irc, host, uid):
"""
$realname exttarget handler. This takes one argument: a glob, which is compared case-insensitively to the user's real name.
Examples:
$realname:*James*: matches anyone with "James" in their real name.
"""
groups = host.split(':')
if len(groups) >= 2:
return irc.match_host(groups[1], irc.users[uid].realname)