本文整理汇总了Python中Message.Message.from_line方法的典型用法代码示例。如果您正苦于以下问题:Python Message.from_line方法的具体用法?Python Message.from_line怎么用?Python Message.from_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message.Message
的用法示例。
在下文中一共展示了Message.from_line方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from Message import Message [as 别名]
# 或者: from Message.Message import from_line [as 别名]
def run(self):
while self.serverconnection.connected:
try:
readable, writable, ex = select([self.socket], [], [self.socket], 1)
if readable:
data = readable[0].recv(4096)
try:
data = data.decode()
lines = data.strip().split("\r\n")
for line in lines:
if line:
msg = Message.from_line(line, self.server_name)
if msg.command == "PRIVMSG" and msg.params == self.serverconnection.nick:
msg.params = msg.nick # account for prviate messages
self.in_queue.put(msg)
except Exception as e:
print("ERROR IN " + self.name + " INTHREAD, " + str(e))
if ex:
raise Exception("error in socket")
except Exception as e:
print("ERROR IN " + self.name + " INTHREAD, " + str(e))
if self.serverconnection.connected:
self.onError()
break