async def stop(self): """Stop the bot and send a message to MESSAGE_DUMP telling that the bot has stopped.""" runtime = strftime("%Hh %Mm %Ss", gmtime(time() - UPTIME)) LOGGER.info("Uploading logs before stopping...!\n") # Send Logs to MESSAGE_DUMP and LOG_CHANNEL await self.send_document( MESSAGE_DUMP, document=LOGFILE, caption=("Bot Stopped!\n\n" f"Uptime: {runtime}\n" f"<code>{LOG_DATETIME}</code>"), ) if MESSAGE_DUMP: # LOG_CHANNEL is not necessary await self.send_document( MESSAGE_DUMP, document=LOGFILE, caption=f"Uptime: {runtime}", ) await super().stop() MongoDB.close() LOGGER.info( f"""Bot Stopped. Logs have been uploaded to the MESSAGE_DUMP Group! Runtime: {runtime}s\n """, )
async def stop(self): """Stop the bot and send a message to MESSAGE_DUMP telling that the bot has stopped.""" runtime = time() - UPTIME LOGGER.info("Uploading logs before stopping...!\n") with open(LOGFILE) as f: txt = f.read() neko, raw = await paste(txt) # Send Logs to MESSAGE-DUMP await self.send_document( MESSAGE_DUMP, document=LOGFILE, caption= (f"Bot Stopped!\n\nUptime: {runtime}Logs for last run, pasted to [NekoBin]({neko}) as " f"well as uploaded a file here.\n<code>{LOG_DATETIME}</code>"), reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton("Raw Logs", url=raw)]], ), ) await super().stop() MongoDB.close() LOGGER.info( f"""Bot Stopped. Logs have been uploaded to the MESSAGE_DUMP Group! Runtime: {runtime}""", )