本文整理汇总了Python中bot.Bot.respond方法的典型用法代码示例。如果您正苦于以下问题:Python Bot.respond方法的具体用法?Python Bot.respond怎么用?Python Bot.respond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bot.Bot
的用法示例。
在下文中一共展示了Bot.respond方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: callback
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import respond [as 别名]
def callback(bot_id):
req_bot = models.User.query.get(bot_id)
tmp_bot = Bot(req_bot.bot_id, req_bot.acc_tok, req_bot.group_id)
if request.method == 'POST':
mreq = json.loads(request.get_data())
msg = mreq['text']
if msg.split()[0][0] == '!': # Msg is a command
tmp_bot.respond(msg)
return flask.render_template('index.html')
示例2: iter
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import respond [as 别名]
"""
# print "Loading natural language processor..."
# from understand import *
from irc import irc
print "Deserializing people..."
import people
irc_servers = iter(irc_servers_list)
connected = False
while not connected:
try:
server = irc_servers.next()
print "Connecting to %s..." % (server)
irc.connect(server, irc_names_list[0], irc_desc)
irc.queuedMsg = ''.join([msg.raw + '\r\n' for msg in irc.waitForMsg()]) + irc.queuedMsg
connected = True
except socket.error:
print "Socket error, trying next server..."
del connected
from bot import Bot
XenoBot = Bot(server=server, names=irc_names_list, desc=irc_desc, channels=channels, nicknames=nicknames)
while True:
for msg in irc.waitForMsg():
XenoBot.respond(msg)