def history(update: Update, context: CallbackContext): """Send a message when the command /logs is issued.""" logs = Logs() logslist = logs.getLastFiveLogs() # print(logslist) for log in logslist: response = "" for key, value in log.items(): response = response + f'{key}: {value}\n' update.message.reply_text(response)
def wrapper(*args, **kwargs): message = 'button' if args[0].message is None else args[0].message.text new_log = { "user": args[0].effective_user.username, "function": function.__name__, "message": message, "time": args[0].effective_message.date } logs = Logs() logs.addLog(new_log) return function(*args, **kwargs)
def test(update: Update, context: CallbackContext): new_log = { "user": update.effective_user.first_name, "function": "anonym", "message": "test", "time": update.message.date } logs = Logs() loglist = [] for _ in range(100000): loglist.append(new_log) logs.addLogs(loglist)
def setUp(self): self.logs = Logs('tests.db')