moved the leaderboard text generation into RoboPage class

This commit is contained in:
2021-08-15 12:23:05 -05:00
parent 0f7c722d2b
commit b4bab8b9db
2 changed files with 16 additions and 12 deletions

View File

@@ -148,14 +148,10 @@ class MsgData:
.apply(lambda gdf: gdf['count'].sum())
.sort_values(ascending=False))
async def emoji_leaderboard(self, client: discord.Client, emoji_name: str, days: int):
async def emoji_user_counts(self, client: discord.Client, emoji_name: str, days: int):
counts: pd.Series = self.emoji_totals(emoji_name, days)
counts.index = pd.Index([(await client.fetch_user(user_id=uid)).display_name for uid in counts.index])
width = max([len(str(s)) for s in counts.index.values])
res = f'{emoji_name} totals, past {days} days\n'
res += '\n'.join(f"`{str(name).ljust(width + 1)}with {cnt:<2.0f} total`"
for name, cnt in counts.iteritems())
return res
return counts
def worst_offsenses(self, user: str, days: int):
cdf = self.emoji_messages('cancelled', days=days)