async def get_stats(after='1y', vote_type=None): stats = Stats() epoch = get_epoch(after) db = DB(DB_FILE) await db.connect() votes_stats = VotesStats() votes_stats.latest = await db.get_latest_vote(vote_type) votes_stats.count = await db.get_vote_count(epoch, vote_type) stats.votes = votes_stats bots_stats = BotsStats() bots_stats.count = await db.get_bot_count(epoch) stats.bots = bots_stats await db.close() return stats