本文整理汇总了Python中interface.Interface.send_message方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.send_message方法的具体用法?Python Interface.send_message怎么用?Python Interface.send_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.Interface
的用法示例。
在下文中一共展示了Interface.send_message方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import send_message [as 别名]
while not done:
##print "ABC"
interface.parse_messages()
if interface.messages:
for mess in interface.messages:
if mess[1] and len(mess[1]) > 1: #Sometime is None - chuj knows why.
#print "Message: ", mess
if mess[0] == 'szx' and len(mess[1]) >= 5 and mess[1][:5] == '!exit':
interface.disconnect_room()
done = True
elif mess[0] == 'szx' and len(mess[1]) >= 6 and mess[1][:6] == '!clean':
words = {}
elif mess[0] == 'szx' and len(mess[1]) >= 9 and mess[1][:9] == '!autosave':
autosave = not autosave
if autosave:
interface.send_message("Autosave on.")
else:
interface.send_message("Autosave off.")
elif mess[0] == 'szx' and len(mess[1]) >= 6 and mess[1][:6] == '!words':
interface.send_message("I know %s words so far." % len(words.keys()))
elif mess[0] == 'szx' and len(mess[1]) >= 5 and mess[1][:5] == '!save':
s = mess[1].split()
if len(s) > 1 and s[1]:
with open(s[1], 'w') as f:
f.write(wordLog().replace('""', '"')) # Don't know why I need to replace, but too scared to delete.
#interface.send_message("Saved.")
else:
interface.send_message("Specify filename!")
elif mess[0] == 'szx' and len(mess[1]) >= 5 and mess[1][:5] == '!load':
s = mess[1].split()
if len(s) > 1 and s[1]: