本文整理汇总了Python中bot.Bot.run方法的典型用法代码示例。如果您正苦于以下问题:Python Bot.run方法的具体用法?Python Bot.run怎么用?Python Bot.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bot.Bot
的用法示例。
在下文中一共展示了Bot.run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import run [as 别名]
def main():
telegram_token = os.environ['TELEGRAM_TOKEN']
vk_client_id = os.environ['VK_CLIENT_ID']
args = sys.argv[1:]
if len(args) > 0:
print('Launched with arguments: ' + str(args))
if args[0] == 'reset-db':
print('Resetting db')
db.clear()
db.sync()
bot = Bot(token=telegram_token,
vk_client_id=vk_client_id)
bot.run()
示例2: main
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import run [as 别名]
def main():
global bot
bot = Bot("irc.freenode.net", "mydemobot")
bot.load_plugin("debug") # FIXME
bot.load_plugin("monitor")
monitor = bot.plugins["monitor"]
bot.run(stop_conditions=[lambda: monitor.welcome_received])
bot.load_plugin("seen")
# bot.load_plugin( "nickserv" )
# nickserv = bot.plugins["nickserv"].module
# nickserv.NICKSERV_ACCOUNTS[ ("irc.freenode.net","[email protected]") ] \
# = ("mydemobot","74cOpEtGN8")
bot.join("#mytestchannel")
bot.load_plugin("quiz")
quiz = bot.plugins["quiz"].module
quiz.QUIZ_CHANNELS.append("#mytestchannel")
quiz.reload_quizdata(".*\.de")
bot.load_plugin("fun")
bot.load_plugin("wikipedia")
while True:
bot.run(stop_conditions=[lambda: not bot.connection.connected])
bot.reconnect()
bot.run(stop_conditions=[lambda: monitor.welcome_received])
bot.rejoin()
bot.reinit_plugins()
示例3: Bot
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import run [as 别名]
from bot import Bot
from emailhandler import EmailHandler
Bot.validate()
EmailHandler.register()
bot = Bot()
bot.run()
示例4: open
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import run [as 别名]
import yaml
import asyncio
import logging
from bot import Bot
if __name__ == '__main__':
with open('config.yml', 'r') as yml_file:
config = yaml.load(yml_file)
# logging.basicConfig(level=logging.DEBUG)
event_loop = asyncio.get_event_loop()
bot = Bot(event_loop, config)
try:
event_loop.run_until_complete(bot.run())
except KeyboardInterrupt:
event_loop.run_until_complete(bot.stop())
示例5: Bot
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import run [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from bot import Bot
if __name__ == '__main__':
ClapTrap = Bot(sys.argv)
ClapTrap.run()
示例6: main
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import run [as 别名]
def main():
bot = Bot()
bot.run()