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
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
@commands.command(name = 'on_member_update')
async def hueta123(before, after):
if before.roles != after.roles:
channel = client.get_channel(729733881129074768)
emb = discord.Embed(title = '', description = f'**Обновление ролей пользователя - {before.mention}**', colour = discord.Color.red())
emb.add_field(name = '**Роли до**', value = [r.mention for r in before.roles] )
emb.add_field(name = '**Роли после**', value = [r.mention for r in after.roles] )
await channel.send(embed = emb)