本文整理汇总了Python中monitor.Monitor.create方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.create方法的具体用法?Python Monitor.create怎么用?Python Monitor.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitor.Monitor
的用法示例。
在下文中一共展示了Monitor.create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Bot
# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import create [as 别名]
class Bot(object):
def __init__(self):
self.settings = config.get()
self.skype = Skype4Py.Skype(Events=self)
self.skype.Attach()
logging.info("Skype Attached.")
self.monitor = Monitor(self.skype, config)
# start the monitor
self.monitor.create()
def generateHelp(self):
msgList = []
msgList.append("{:<15}{:<30}".format("Command", "Description"))
msgList.append("{:-<30}".format(""))
for c in commands.commands:
c = commands.commands[c]
if hasattr(c, 'permissions') and c.permissions == 'admin':
continue
msgList.append("{:<15} {:<30}".format(c.aliases[0], c.doc))
return msgList
def MessageStatus(self, msg, status):
if status in (Skype4Py.cmsSent, Skype4Py.cmsReceived) or len(msg.Body) < 2: return
# ignore itself
# if (msg.FromHandle == self.skype.CurrentUser.Handle): return
# check if it's a command
if msg.Body[0] not in self.settings['prefixes']: return
# get command
cmd = msg.Body.split()[0][1:].lower()
# split args into array
args = [] if len(msg.Body.split()) < 2 else msg.Body.split()[1:]
# generate help
if cmd == 'help':
help = self.generateHelp()
if help:
msg.Chat.SendMessage("\n".join(help))
elif cmd in commands.aliases:
thread = threading.Thread(target=commands.aliases[cmd].execute, args=(msg, self.settings, args))
thread.start()
return