def __isCooldown(self, actionID): if self.__cooldown.isInProcess(actionID): error = ChatCoolDownError(actionID, self.__cooldown.getDefaultCoolDown()) g_messengerEvents.onErrorReceived(error) return True return False
def sendChatMessage(self, jid, body): if self.__cooldown.isInProcess(CLIENT_ACTION_ID.SEND_MESSAGE): g_messengerEvents.onErrorReceived(ChatCoolDownError(CLIENT_ACTION_ID.SEND_MESSAGE, self.__limits.getBroadcastCoolDown())) return body = self.__msgFilters.chainOut(body, self.__limits) if not body: return self.__chatSessions.sendMessage(jid.getBareJID(), body, self.__msgFilters) self.__cooldown.process(CLIENT_ACTION_ID.SEND_MESSAGE)
def __checkCooldown(self, actionID): """ Check if cooldown was set for action :param actionID: action id :return: None, if cooldown was not set, else return ChatCoolDownError object """ error = None if self.__cooldown.isInProcess(actionID): error = ChatCoolDownError(actionID, self.__cooldown.getDefaultCoolDown()) return error
def _checkCooldown(self, actionID): error = None if self.__cooldown.isInProcess(actionID): error = ChatCoolDownError(actionID, self.__cooldown.getDefaultCoolDown()) return error