• Discord Bot Python Как вывести список участников по ролям?

    neredko1703
    @neredko1703
    embed = discord.Embed(title = 'Администраторы')
        for guild in bot.guilds:
            for member in guild.members:
                guild = bot.get_guild(ctx.guild.id)  
                verif = guild.get_role( айдишник роли которая нужга)
                if verif in member.roles:  
                    embed.add_field(value= f"member.mention}",inline = False)
        await ctx.send(embed = embed)


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

    neredko1703
    @neredko1703 Автор вопроса
    Vindicar, К сожалению, да
    Написано
  • Почему бот discord видит только себя?

    neredko1703
    @neredko1703 Автор вопроса
    С find_one тоже проблема, как можно None заменить, чтоб условие сработало наверняка? XD
    Я делала это по видео, т.к далека от Mongo, там вместо if collection.find_one стоит if collection.count_documents, но у меня же опять выдает ошибку,поэтому я решила заменить...
    Консоль:
    Ignoring exception in on_ready
    Traceback (most recent call last):
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 343, in _run_event
        await coro(*args, **kwargs)
      File "C:\Users\ekate\Desktop\botprob\bot1.py", line 49, in on_ready
        if collection.find_one({"_id": member.id}) == None:
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\collection.py", line 1328, in find_one
        for result in cursor.limit(-1):
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\cursor.py", line 1238, in next
        if len(self.__data) or self._refresh():
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\cursor.py", line 1130, in _refresh
        self.__session = self.__collection.database.client._ensure_session()
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\mongo_client.py", line 1935, in _ensure_session
        return self.__start_session(True, causal_consistency=False)
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\mongo_client.py", line 1883, in __start_session
        server_session = self._get_server_session()
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\mongo_client.py", line 1921, in _get_server_session
        return self._topology.get_server_session()
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\topology.py", line 520, in get_server_session
        session_timeout = self._check_session_support()
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\topology.py", line 504, in _check_session_support
        self._select_servers_loop(
      File "C:\Users\ekate\AppData\Roaming\Python\Python39\site-packages\pymongo\topology.py", line 218, in _select_servers_loop
        raise ServerSelectionTimeoutError(
    pymongo.errors.ServerSelectionTimeoutError: cluster0-shard-00-01.sbgr7.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1122),cluster0-shard-00-00.sbgr7.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1122),cluster0-shard-00-02.sbgr7.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1122), Timeout: 30s, Topology Description: <TopologyDescription id: 617e581b76196274b1d6b528, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('cluster0-shard-00-00.sbgr7.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-00.sbgr7.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1122)')>, <ServerDescription ('cluster0-shard-00-01.sbgr7.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-01.sbgr7.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1122)')>, <ServerDescription ('cluster0-shard-00-02.sbgr7.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-02.sbgr7.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1122)')>]>
    Написано