• Проблемы с получение списка участников сервера, как исправить?

    @RDSKUser Автор вопроса
    soremix,
    Traceback (most recent call last):
      File "C:\Users\Asus\Desktop\GGDPS Manager\bot.py", line 37, in <module>
        client.run(token)
      File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 723, in run
        return future.result()
      File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 702, in runner
        await self.start(*args, **kwargs)
      File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 666, in start
        await self.connect(reconnect=reconnect)
      File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 601, in connect
        raise PrivilegedIntentsRequired(exc.shard_id) from None
    discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
    Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000029429DFAF70>
    Traceback (most recent call last):
      File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
        self.close()
      File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
        self._loop.call_soon(self._call_connection_lost, None)
      File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
        self._check_closed()
      File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
        raise RuntimeError('Event loop is closed')
    RuntimeError: Event loop is closed
  • Проблемы с получение списка участников сервера, как исправить?

    @RDSKUser Автор вопроса
    import discord
    from discord.ext import commands
    import time
    
    token = ""
    
    intents = discord.Intents.default()
    
    client = commands.Bot(command_prefix = '//', intents=intents)
    client.remove_command('help')
    
    @client.event
    async def on_ready():
        print("""login!""")
        await client.change_presence(status=discord.Status.online, activity=discord.Activity(type=discord.ActivityType.listening, name="ver. 0.1 βeta"))
    
    @client.command()
    async def setup_roles(ctx):
        channel_chat = client.get_channel(879035346015359023)
        message = await channel_chat.send(embed = discord.Embed(title="Внимание! Идёт установка ролей..", description="Ожидайте...", colour=discord.Colour.from_rgb(255, 0, 0)))
        getrole = discord.utils.get(ctx.guild.roles, id=879035345969217558)
        for guild in client.guilds:
            for member in guild.members:
                print(member)
                await member.add_roles(getrole)
        await message.edit(embed=discord.Embed(title="Установка завершилась!", description=f"Ролей выдано :: {ctx.guild.member_count}",colour=discord.Colour.from_rgb(0, 255, 0)))
        await message.add_reaction("✅")
        return
    
    @client.command()
    async def members(ctx):
        for guild in client.guilds:
            for member in guild.members:
                await ctx.send(member)
                break
    
    client.run(token)


    intents.members выдаёт ошибку как неизвестный класс
  • Проблемы с получение списка участников сервера, как исправить?

    @RDSKUser Автор вопроса
    Добавил intents.members = True, но начало спамить только ником и тегом бота.