def _format_get_escrow(self, escrow_group_id): response = None escrow = self.db.escrow.query( fields=['payee_id', 'amount', 'memo'], _filter={'escrow_group_id': escrow_group_id}, sort={ 'field': 'tx_timestamp', 'order': 'asc' }) if escrow: escrow = utils.jsearch( ('[].{payee_id: payee_id, amount: amount, memo: split_items' '(memo, `Mining`, `1`)}'), escrow) table = text.tabulate_data(escrow, { 'payee_id': 'User', 'amount': 'Amount', 'memo': 'Memo' }, fields=['payee_id', 'amount', 'memo'], user_id_field='payee_id', thread=self.botThread) response = f'Current Unpaid Escrow: {table}' return response
def _format_get_user_scores(self, name, user): if not user: return None scores = self._get_user_scores(name, user) if scores: response = tabulate_data(scores, {}) return f'Score History for <@{user}>:\n{response}'
def _format_get_scores(self, name): title = self.boards[name]['config'].get('title') response = None scores = self._get_scores(name) if scores: response = tabulate_data(scores, {}, user_id_field='user', thread=self.botThread) if title and response: response = f'*{title}*\n{response}' return response
def _format_get_balances(self): response = None balances = self._get_balances() balances = utils.jsearch('[?starts_with(user, `"U"`)]', balances) if balances: response = text.tabulate_data(balances, { 'user': '******', 'balance': 'Balance' }, fields=['user', 'balance'], user_id_field='user', thread=self.botThread) return response