本文整理汇总了Python中otp.chat.TalkMessage.TalkMessage类的典型用法代码示例。如果您正苦于以下问题:Python TalkMessage类的具体用法?Python TalkMessage怎么用?Python TalkMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TalkMessage类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: receiveOpenTalk
def receiveOpenTalk(self, senderAvId, avatarName, accountId, accountName, message, scrubbed = 0):
error = None
if not avatarName and senderAvId:
localAvatar.sendUpdate('logSuspiciousEvent', ['receiveOpenTalk: invalid avatar name (%s)' % senderAvId])
avatarName = self.findAvatarName(senderAvId)
if not accountName and accountId:
accountName = self.findPlayerName(accountId)
newMessage = TalkMessage(self.countMessage(), self.stampTime(), message, senderAvId, avatarName, accountId, accountName, None, None, None, None, TALK_OPEN, None)
if senderAvId != localAvatar.doId:
self.addHandle(senderAvId, newMessage)
reject = 0
if senderAvId:
reject = self.addToHistoryDoId(newMessage, senderAvId, scrubbed)
if accountId:
self.addToHistoryDISLId(newMessage, accountId)
if reject == 1:
newMessage.setBody(OTPLocalizer.AntiSpamInChat)
if reject != 2:
isSpam = self.spamDictByDoId.get(senderAvId) and reject
if not isSpam:
self.historyComplete.append(newMessage)
self.historyOpen.append(newMessage)
messenger.send('NewOpenMessage', [newMessage])
if newMessage.getBody() == OTPLocalizer.AntiSpamInChat:
self.spamDictByDoId[senderAvId] = 1
else:
self.spamDictByDoId[senderAvId] = 0
return error
示例2: receiveThought
def receiveThought(self, avatarId, avatarName, accountId, accountName, message, scrubbed=0):
error = None
if not avatarName and avatarId:
avatarName = self.findAvatarName(avatarId)
if not accountName and accountId:
accountName = self.findPlayerName(accountId)
newMessage = TalkMessage(
self.countMessage(),
self.stampTime(),
message,
avatarId,
avatarName,
accountId,
accountName,
None,
None,
None,
None,
AVATAR_THOUGHT,
None,
)
if avatarId != localAvatar.doId:
self.addHandle(avatarId, newMessage)
reject = 0
if avatarId:
reject = self.addToHistoryDoId(newMessage, avatarId, scrubbed)
if accountId:
self.addToHistoryDISLId(newMessage, accountId)
if reject == 1:
newMessage.setBody(OTPLocalizer.AntiSpamInChat)
if reject != 2:
self.historyComplete.append(newMessage)
self.historyOpen.append(newMessage)
messenger.send("NewOpenMessage", [newMessage])
return error
示例3: receiveGuildTalk
def receiveGuildTalk(self, senderAvId, fromAC, avatarName, message, scrubbed=0):
error = None
if not self.isThought(message):
accountName = self.findName(fromAC, 1)
newMessage = TalkMessage(
self.countMessage(),
self.stampTime(),
message,
senderAvId,
avatarName,
fromAC,
accountName,
None,
None,
None,
None,
TALK_GUILD,
None,
)
reject = self.addToHistoryDoId(newMessage, senderAvId)
if reject == 1:
newMessage.setBody(OTPLocalizer.AntiSpamInChat)
if reject != 2:
isSpam = self.spamDictByDoId.get(senderAvId) and reject
if not isSpam:
self.historyComplete.append(newMessage)
self.historyGuild.append(newMessage)
messenger.send("NewOpenMessage", [newMessage])
if newMessage.getBody() == OTPLocalizer.AntiSpamInChat:
self.spamDictByDoId[senderAvId] = 1
else:
self.spamDictByDoId[senderAvId] = 0
return error
示例4: receiveOpenSpeedChat
def receiveOpenSpeedChat(self, msgType, messageIndex, senderAvId, name=None):
error = None
if not name and senderAvId:
name = self.findName(senderAvId, 0)
messageType = TALK_OPEN
message = None
if msgType == SPEEDCHAT_NORMAL:
message = self.SCDecoder.decodeSCStaticTextMsg(messageIndex)
elif msgType == SPEEDCHAT_EMOTE:
message = self.SCDecoder.decodeSCEmoteWhisperMsg(messageIndex, name)
if not message:
if senderAvId == localAvatar.doId:
message = PLocalizer.EmoteMessagesSelf.get(messageIndex)
messageType = INFO_OPEN
else:
message = PLocalizer.EmoteMessagesThirdPerson.get(messageIndex)
messageType = INFO_OPEN
elif msgType == SPEEDCHAT_CUSTOM:
message = self.SCDecoder.decodeSCCustomMsg(messageIndex)
if message in (None, ""):
return None
newMessage = TalkMessage(
self.countMessage(),
self.stampTime(),
message,
senderAvId,
name,
None,
None,
None,
None,
None,
None,
messageType,
None,
)
reject = self.addToHistoryDoId(newMessage, senderAvId)
if reject == 1:
newMessage.setBody(OTPLocalizer.AntiSpamInChat)
if reject != 2:
if self.spamDictByDoId.get(senderAvId):
pass
isSpam = reject
if not isSpam:
self.historyComplete.append(newMessage)
self.historyOpen.append(newMessage)
messenger.send("NewOpenMessage", [newMessage])
if newMessage.getBody() == OTPLocalizer.AntiSpamInChat:
self.spamDictByDoId[senderAvId] = 1
else:
self.spamDictByDoId[senderAvId] = 0
return error
示例5: receivePartyMessage
def receivePartyMessage(self, message, senderAvId, senderName):
error = None
if not self.isThought(message):
newMessage = TalkMessage(
self.countMessage(),
self.stampTime(),
message,
senderAvId,
senderName,
None,
None,
None,
None,
None,
None,
TALK_PARTY,
None,
)
reject = self.addToHistoryDoId(newMessage, senderAvId)
if reject == 1:
newMessage.setBody(OTPLocalizer.AntiSpamInChat)
if reject != 2:
if self.spamDictByDoId.get(senderAvId):
pass
isSpam = reject
if not isSpam:
self.historyComplete.append(newMessage)
self.historyParty.append(newMessage)
messenger.send("NewOpenMessage", [newMessage])
if newMessage.getBody() == OTPLocalizer.AntiSpamInChat:
self.spamDictByDoId[senderAvId] = 1
else:
self.spamDictByDoId[senderAvId] = 0
return error