本文整理汇总了Python中subscriber.Subscriber.available_modes方法的典型用法代码示例。如果您正苦于以下问题:Python Subscriber.available_modes方法的具体用法?Python Subscriber.available_modes怎么用?Python Subscriber.available_modes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscriber.Subscriber
的用法示例。
在下文中一共展示了Subscriber.available_modes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: subscribe_mode
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import available_modes [as 别名]
def subscribe_mode(self, server, source, target, command):
target_nick = self.plugin.nick_extract(source)
available = Subscriber.available_modes()
parts = [p.strip() for p in command.split(' ')]
error_msg = 'invalid command'
if not parts:
subscriber = self.wrapper.find_subscriber_with_nick(target_nick)
if subscriber:
self.plugin.privmsg(server, target_nick, 'current modes: ' + str(subscriber.modes))
else:
self.plugin.privmsg(server, target_nick, 'no subscription')
elif len(parts) == 2:
[op, mode] = parts
if mode in available and op in ['add', 'remove']:
subscriber = self.wrapper.subscribe_mode(target_nick, op, mode)
self.plugin.privmsg(server, target_nick, 'updated modes, now: ' + str(subscriber.modes))
else:
self.plugin.privmsg(server, target_nick, error_msg)
else:
self.plugin.privmsg(server, target_nick, error_msg)