本文整理汇总了Python中otp.chat.TalkMessage.TalkMessage.setBody方法的典型用法代码示例。如果您正苦于以下问题:Python TalkMessage.setBody方法的具体用法?Python TalkMessage.setBody怎么用?Python TalkMessage.setBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类otp.chat.TalkMessage.TalkMessage
的用法示例。
在下文中一共展示了TalkMessage.setBody方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: receiveOpenTalk
# 需要导入模块: from otp.chat.TalkMessage import TalkMessage [as 别名]
# 或者: from otp.chat.TalkMessage.TalkMessage import setBody [as 别名]
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
# 需要导入模块: from otp.chat.TalkMessage import TalkMessage [as 别名]
# 或者: from otp.chat.TalkMessage.TalkMessage import setBody [as 别名]
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
# 需要导入模块: from otp.chat.TalkMessage import TalkMessage [as 别名]
# 或者: from otp.chat.TalkMessage.TalkMessage import setBody [as 别名]
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
# 需要导入模块: from otp.chat.TalkMessage import TalkMessage [as 别名]
# 或者: from otp.chat.TalkMessage.TalkMessage import setBody [as 别名]
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
# 需要导入模块: from otp.chat.TalkMessage import TalkMessage [as 别名]
# 或者: from otp.chat.TalkMessage.TalkMessage import setBody [as 别名]
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