Python
- 6 ответов
- 0 вопросов
1
Вклад в тег
message_object = ...
def check(arg):
if ctx.author.id == arg.user_id:
return str(arg.emoji) == '✅' or str(arg.emoji) == '❌'
await message_object.add_reaction('✅')
await message_object.add_reaction('❌')
payload = await self.bot.wait_for('raw_reaction_add', timeout=60.0, check=check)
if str(payload.emoji) == '✅':
pass
elif str(payload.emoji) == '❌':
pass
import datetime
channels = {}
d = datetime.datetime.today() - datetime.timedelta(days=1)
for channel in ctx.guild.text_channels:
if channel.permissions_for(channel.guild.get_member(user_id)).view_channel:
messages = 0
async for message in channel.history(limit=100000, after=d):
messages += 1
channels[channel.id] = messages
c = 0
top_channels = ""
while c != 5:
h = max(channels, key=channels.get)
channel = discord.utils.get(guild.text_channels, id=h)
top_channels += f"`{c + 1}`. {channel.mention}: {channels[h]}\n"
channels.pop(h)
c += 1
yield top_channels