3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-23 18:54:05 +01:00

example, relay_cb: migrate to irc.is_channel

This commit is contained in:
James Lu 2017-08-30 21:22:19 -07:00
parent 36d6581bba
commit 85a7dd3dff
2 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ def hook_privmsg(irc, source, command, args):
# irc.pseudoclient stores the User object of the main PyLink client. # irc.pseudoclient stores the User object of the main PyLink client.
# (i.e. the user defined in the bot: section of the config) # (i.e. the user defined in the bot: section of the config)
if utils.isChannel(channel) and irc.pseudoclient.nick in text: if irc.is_channel(channel) and irc.pseudoclient.nick in text:
irc.msg(channel, 'hi there!') irc.msg(channel, 'hi there!')
# log.debug, log.info, log.warning, log.error, log.exception (within except: clauses) # log.debug, log.info, log.warning, log.error, log.exception (within except: clauses)
# and log.critical are supported here. # and log.critical are supported here.

View File

@ -60,7 +60,7 @@ def cb_relay_core(irc, source, command, args):
real_command = 'ACTION' real_command = 'ACTION'
elif not utils.isChannel(args['target']): elif not irc.is_channel(args['target']):
# Target is a user; handle this accordingly. # Target is a user; handle this accordingly.
if relay_conf.get('allow_clientbot_pms'): if relay_conf.get('allow_clientbot_pms'):
real_command = 'PNOTICE' if args.get('is_notice') else 'PM' real_command = 'PNOTICE' if args.get('is_notice') else 'PM'
@ -112,7 +112,7 @@ def cb_relay_core(irc, source, command, args):
# Figure out where the message is destined to. # Figure out where the message is destined to.
target = args.get('channel') or args.get('target') target = args.get('channel') or args.get('target')
if target is None or not (utils.isChannel(target) or private): if target is None or not (irc.is_channel(target) or private):
# Non-channel specific message (e.g. QUIT or NICK). If this isn't a PM, figure out # Non-channel specific message (e.g. QUIT or NICK). If this isn't a PM, figure out
# all channels that the sender shares over the relay, and relay them to those # all channels that the sender shares over the relay, and relay them to those
# channels. # channels.