DiscordGIR / Bloo

The best Discord bot, created for r/Jailbreak
MIT License
36 stars 10 forks source link

Ignoring exception in on_connect & Database errors #23

Closed newallin closed 2 years ago

newallin commented 2 years ago

Method: Without Docker Database: mongodb atlas

AttributeError: Database is not set up properly! Role 'role_memberplus' is missing. Please refer to README.md.

newallin commented 2 years ago

--nvm i am just stupid for anyone that wonders, do setup.py

newallin commented 2 years ago

What should I do? (Method: With docker)


  File "/workspaces/Bloo/./main.py", line 9, in <module>
    from utils.database import db
  File "/workspaces/Bloo/utils/database.py", line 22, in <module>
    db = Database()
  File "/workspaces/Bloo/utils/database.py", line 18, in __init__
    if not Guild.objects(_id=cfg.guild_id):
  File "/opt/venv/lib/python3.10/site-packages/mongoengine/queryset/manager.py", line 38, in __get__
    queryset = queryset_class(owner, owner._get_collection())
  File "/opt/venv/lib/python3.10/site-packages/mongoengine/document.py", line 223, in _get_collection
    if cls._meta.get("auto_create_index", True) and db.client.is_primary:
  File "/opt/venv/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1088, in is_primary
    return self._server_property('is_writable')
  File "/opt/venv/lib/python3.10/site-packages/pymongo/mongo_client.py", line 889, in _server_property
    server = self._topology.select_server(
  File "/opt/venv/lib/python3.10/site-packages/pymongo/topology.py", line 244, in select_server
    return random.choice(self.select_servers(selector,
  File "/opt/venv/lib/python3.10/site-packages/pymongo/topology.py", line 202, in select_servers
    server_descriptions = self._select_servers_loop(
  File "/opt/venv/lib/python3.10/site-packages/pymongo/topology.py", line 218, in _select_servers_loop
    raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: host.docker.internal:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 61c6c67ec4c24c5f3417e412, topology_type: Single, servers: [<ServerDescription ('host.docker.internal', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('host.docker.internal:27017: [Errno 111] Connection refused')>]>```
newallin commented 2 years ago

This too.


Ignoring exception in on_connect
Traceback (most recent call last):
  File "/opt/venv/lib/python3.10/site-packages/discord/client.py", line 352, in _run_event
    await coro(*args, **kwargs)
  File "/opt/venv/lib/python3.10/site-packages/discord/bot.py", line 716, in on_connect
    await self.register_commands()
  File "/opt/venv/lib/python3.10/site-packages/discord/bot.py", line 277, in register_commands
    cmds = await self.http.bulk_upsert_guild_commands(
  File "/opt/venv/lib/python3.10/site-packages/discord/http.py", line 332, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access

            88          88                          
            88          88                          
            88          88                          
            88,dPPYba,  88  ,adPPYba,   ,adPPYba,   
            88P'    "8a 88 a8"     "8a a8"     "8a  
            88       d8 88 8b       d8 8b       d8  
            88b,   ,a8" 88 "8a,   ,a8" "8a,   ,a8"  
            8Y"Ybbd8"'  88  `"YbbdP"'   `"YbbdP"'   

[*] Logged in as: Ghost (ID)
[*] Version: 2.0.0a
[*] Made with ❤️ by SlimShadyIAm#9999 and the Bloo development team. Enjoy!
Task exception was never retrieved
future: <Task finished name='Task-47' coro=<fetch_issue_cache() done, defined at /workspaces/Bloo/utils/misc.py:53> exception=AttributeError("'NoneType' object has no attribute 'history'")>
Traceback (most recent call last):
  File "/workspaces/Bloo/utils/misc.py", line 62, in fetch_issue_cache
    async for message in channel.history(limit=None, oldest_first=True):
AttributeError: 'NoneType' object has no attribute 'history'```
SlimShadyIAm commented 2 years ago

So you're using Atlas? Because according to the first error you posted, it's trying to connect to a local database, not Atlas. image Make sure you set the .env file up correctly. Read the README.

newallin commented 2 years ago

Yup, then I used atlas and received the second error, the missing acesss one.

SlimShadyIAm commented 2 years ago

discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access

This is because you need to invite the bot to your server with the application.commands scope set. See this: https://docs.pycord.dev/en/master/discord.html#inviting-your-bot

AttributeError: 'NoneType' object has no attribute 'history'

You haven't set up the channel_common_issues field in the database. If you don't want to use that feature you should comment out the code.

newallin commented 2 years ago

How can I comment out channel_common_issues?

SlimShadyIAm commented 2 years ago

Actually just comment out bot.issue_cache = IssueCache(bot) in main.py

newallin commented 2 years ago

Okay thank you.

newallin commented 2 years ago

image Its already set up though.

newallin commented 2 years ago

It gives me this now, I ran setup.py with my own guild ID Exception: The database has not been set up for guild 0! Please refer to README.md.

--nevermind

SlimShadyIAm commented 2 years ago

image Its already set up though.

Did you re-invite the bot after setting it? The invite URL needs to have the application.commands scope set.

newallin commented 2 years ago

Thank you, it works.