added the biggest_daddy function
This commit is contained in:
11
msg.py
11
msg.py
@@ -127,6 +127,17 @@ class MsgData:
|
||||
|
||||
return res
|
||||
|
||||
def biggest_daddy(self, days, top: int = None):
|
||||
df = self.emoji_totals('daddy', days)
|
||||
if top is not None:
|
||||
df = df.iloc[:top]
|
||||
width = max(list(map(lambda s: len(str(s)), df.index.values)))
|
||||
res = f'Daddy totals, past {days} days\n'
|
||||
res += '\n'.join(
|
||||
f"`{name.ljust(width + 1)}with {row['total']:<2.0f} total`"
|
||||
for name, row in df.iterrows()
|
||||
)
|
||||
return res
|
||||
|
||||
async def message_df(client: discord.Client, **kwargs):
|
||||
return pd.DataFrame(
|
||||
|
||||
@@ -52,6 +52,9 @@ class RoboPage(discord.Client):
|
||||
async with self.data.lock:
|
||||
await message.reply(self.data.worst_offsenses(user=m.group('name'), days=14))
|
||||
|
||||
elif 'biggest daddy' in message.content:
|
||||
await message.reply(self.data.biggest_daddy(days=14))
|
||||
|
||||
for joke in self.jokes:
|
||||
if (scan_res := joke.scan(message)):
|
||||
print(f'{joke.__class__.__name__} detected:\n{message.content}\n{scan_res}')
|
||||
@@ -68,7 +71,6 @@ if __name__ == '__main__':
|
||||
async def on_ready():
|
||||
# print(len(list(client.get_all_members())))
|
||||
await client.handle_ready()
|
||||
print(client.data.cancellation_totals(14))
|
||||
|
||||
|
||||
@client.event
|
||||
@@ -80,7 +82,6 @@ if __name__ == '__main__':
|
||||
async def on_raw_reaction_add(payload):
|
||||
LOGGER.info(payload)
|
||||
await client.data.update_reaction(payload=payload, client=client)
|
||||
LOGGER.info(f'Leaderboard:\n{str(client.data.cancellation_totals(14)["total"].apply(int))}')
|
||||
|
||||
|
||||
@client.event
|
||||
|
||||
Reference in New Issue
Block a user