本文整理汇总了Python中bot.Bot.setup方法的典型用法代码示例。如果您正苦于以下问题:Python Bot.setup方法的具体用法?Python Bot.setup怎么用?Python Bot.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bot.Bot
的用法示例。
在下文中一共展示了Bot.setup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: joined
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import setup [as 别名]
def joined(message):
"""Sent by clients when they enter a room.
A status message is broadcast to all people in the room."""
room = session.get('room')
with_bot = False
if room in bot_rooms.keys():
with_bot = True
# Store previous ID
bot_room = room
room = str(uuid.uuid4()) # Create private room
session["room"] = room # Update session
join_room(room)
emit('status', {'msg': session.get('name') + ' has entered the room.'}, room=room)
if with_bot:
# Reverse name for CopyCat bot
if bot_room == "60":
bot_name = session.get('name')[::-1]
# Keep instance of bot
else:
bot_name = bot_rooms[bot_room]
b = Bot(bot_name)
b.setup()
active_bots[room] = b
# Greet user
emit('status', {'msg': b.name() + ' [BOT] has entered the room.'}, room=room)
emit('message', {'msg': b.name() + ': ' + b.greet()}, room=room)