当前位置: 首页>>代码示例>>Python>>正文


Python Plugin.load_all方法代码示例

本文整理汇总了Python中plugin.Plugin.load_all方法的典型用法代码示例。如果您正苦于以下问题:Python Plugin.load_all方法的具体用法?Python Plugin.load_all怎么用?Python Plugin.load_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plugin.Plugin的用法示例。


在下文中一共展示了Plugin.load_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from plugin import Plugin [as 别名]
# 或者: from plugin.Plugin import load_all [as 别名]
 def handle(self, client, msg):
   token = msg['body'].split(' ')
   
   try:
     if token[0] == '+':
       Channel.channels[token[1]].plugins.append(token[2])
       
       msg.reply("Plugin {0} in {1} has beend activated".format(token[2], token[1])).send()
   
     elif token[0] == '-':
       Channel.channels[token[1]].plugins.remove(token[2])
       
       msg.reply("Plugin {0} in {1} has beend deactivated".format(token[2], token[1])).send()
     
     elif token[0] == 'reload':
       Plugin.plugins = []
       Plugin.load_all()
       
       msg.reply("Plugins reloaded!").send()
       
     elif token[0] == 'list':
       plugins = []
       
       for p in Plugin.plugins:
         plugins.append(p.name)
       
       msg.reply("Plugins loaded: {0}".format(', '.join(plugins))).send()
       
     elif token[0] == 'active':
       msg.reply("Plugins active in {0}: {1}".format(Channel.channels[token[1]].jid, ', '.join(Channel.channels[token[1]].plugins))).send()
       
   except:
     pass
开发者ID:droptable,项目名称:pxmppbot,代码行数:35,代码来源:admin.py

示例2: run

# 需要导入模块: from plugin import Plugin [as 别名]
# 或者: from plugin.Plugin import load_all [as 别名]
    self.register_plugin('xep_0199')
    
  def run(self):
    if self.connect((Config.get('auth.server'), 5222)):
      self.process(block=True)   
      
  def start(self, event):
    self.send_presence()
    self.get_roster()
    
    for channel in Config.get('channels'):
      Channel.join(self, channel['jid'], channel['plugins'])
    
  def message_private(self, msg):
    Plugin().handle(self, msg)
    
  def message_muc(self, msg):
    pass

if __name__ == '__main__':
  config_fn = "default.conf" # Later: Pass as Argument to script 
  Config.load(config_fn)
  
  Plugin.load_all()
  
  bot = Bot()
  
  try:
    bot.run()
  except KeyboardInterrupt:
    quit()
开发者ID:droptable,项目名称:pxmppbot,代码行数:33,代码来源:bot.py


注:本文中的plugin.Plugin.load_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。