mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
Add $service exttarget for matching service bots
This commit is contained in:
parent
f27b179211
commit
d3892a85be
@ -206,3 +206,21 @@ def realname(irc, host, uid):
|
||||
groups = host.split(':')
|
||||
if len(groups) >= 2:
|
||||
return irc.match_host(groups[1], irc.users[uid].realname)
|
||||
|
||||
@bind
|
||||
def service(irc, host, uid):
|
||||
"""
|
||||
$service exttarget handler. This takes one optional argument: a glob, which is compared case-insensitively to the target user's service name (if present).
|
||||
|
||||
Examples:
|
||||
$service -> Matches any PyLink service bot.
|
||||
$service:automode -> Matches the Automode service bot.
|
||||
"""
|
||||
if not irc.users[uid].service:
|
||||
return False
|
||||
|
||||
groups = host.split(':')
|
||||
|
||||
if len(groups) >= 2:
|
||||
return irc.match_host(groups[1], irc.users[uid].service)
|
||||
return True # It *is* a service bot because of the check at the top.
|
||||
|
@ -64,3 +64,9 @@ Used to match users logged in to *PyLink* (i.e. via the `identify` command).
|
||||
Used to match users with certain realnames.
|
||||
|
||||
- `$realname:*James*`: matches anyone with "James" in their real name (case insensitive).
|
||||
|
||||
### The "$service" target (PyLink 2.0+)
|
||||
Used to match service bots. This exttarget takes one optional argument: a glob, which is compared case-insensitively to the target user's service name if present.
|
||||
|
||||
- `$service`: matches any PyLink service bot.
|
||||
- `$service:automode`: matches the Automode service bot.
|
||||
|
Loading…
Reference in New Issue
Block a user