def listening_for(self, message): if utils.is_delete_event(message): return False channel = utils.jsearch('metadata.source_channel || ""', message) if channel not in self.secret_word_channels: return False text = message.get('text') if not isinstance(text, str): return False splits = text.split(' ') if ( len(splits) > 1 and splits[0] in self.triggers and splits[1] == 'reset_secret_word' ): self._admin_reset_secret_word(message) return False match = re.search(f'\\W*{self.secret_word}\\W*', text.lower()) return match
def listening_for(self, message): if utils.is_delete_event(message): return False _handle = False text = message.get('text') if isinstance(text, str): _handle = any([text.startswith(t) for t in self.triggers]) return _handle
def listening_for(self, message): if utils.is_delete_event(message): return False _handle = False user = message.get('metadata', {}).get('source_user') if user and user in self.admins: text = message.get('text') if isinstance(text, str): _handle = any( [text.lower().startswith(t) for t in self.triggers]) return _handle
def listening_for(self, message): if utils.is_delete_event(message): return False text = message.get('text') if message.get('text') else '' if (utils.now() > getattr(self, 'next_pool', 0) and 'moin' not in text.lower()): self._update_pool() _handle = False if isinstance(text, str): params = re.split(r'\s+', text.lower()) if (len(params) > 1 and params[0] in self.triggers and params[1] == 'pool'): _handle = True return _handle
def listening_for(self, message): if utils.is_delete_event(message): return False if not self.secret_word and utils.now() - self.gsw_ts > 120: self.secret_word = self._get_secret_word() _handle = False text = message.get('text') user = message.get('metadata', {}).get('source_user') channel = message.get('metadata', {}).get('source_channel') if (isinstance(text, str) and user and user not in self.pool_excludes and channel): _handle = any([ self._listening_for_moin(text, user), self._listening_for_secret_word(text, user, channel) ]) if utils.now() > self.next_pool and not _handle: self._reset(message) return _handle
def listening_for(self, message): if is_delete_event(message): return False return 'moin' in str(message.get('text', '')).lower()