Repository: interactions-py/interactions.py

Issue:
[BUG] NoneType exception when using extension_autocomplete and disable_sync=True
### Describe the bug.

When attempting to register an autocomplete callback inside an extension with `disable_sync=True`, a NoneType exception occurs

### List the steps.

Define a command with autocomplete option and an autocomplete callback in an extension:
```py
@interactions.extension_command(
    name="testauto",
    description="test autocomplete",
    options=[
        Option(
            type=OptionType.STRING,
            name="message",
            description="test",
            autocomplete=True
        )
    ]
)
async def testauto_cmd(self, ctx: interactions.CommandContext, message: str = None):
    await ctx.send("You sent: {}".format(message))

@interactions.extension_autocomplete(command="test", name="message")
async def do_autocomplete(self, ctx):
    await ctx.populate([
        Choice(
            name="One",
            value="1"
        ),
        Choice(
            name="Two",
            value="2"
        )
    ])
```

### What you expected.

To register a callback successfully

### What you saw.

```py
Traceback (most recent call last):
  File "/Users/ventus/GitRepos/discord-py-interactions_boilerplate/main.py", line 75, in <module>
    client.load("cogs." + cog)
  File "/Users/ventus/GitRepos/discord-py-interactions_boilerplate/env/lib/python3.9/site-packages/interactions/client.py", line 937, in load
    raise error from error
  File "/Users/ventus/GitRepos/discord-py-interactions_boilerplate/env/lib/python3.9/site-packages/interactions/client.py", line 933, in load
    extension = setup(self, *args, **kwargs)
  File "/Users/ventus/GitRepos/discord-py-interactions_boilerplate/cogs/helloworld.py", line 188, in setup
    HelloWorld(client)
  File "/Users/ventus/GitRepos/discord-py-interactions_boilerplate/env/lib/python3.9/site-packages/interactions/client.py", line 1143, in __new__
    func = client.autocomplete(*args, **kwargs)(func)
  File "/Users/ventus/GitRepos/discord-py-interactions_boilerplate/env/lib/python3.9/site-packages/interactions/client.py", line 850, in autocomplete
    _command: Union[Snowflake, int] = int(_command_obj.id)
AttributeError: 'NoneType' object has no attribute 'id'
```

### What version of the library did you use?

stable

### Code of Conduct

- [X] I agree to follow the contribution requirements.


Discussion:
In #477, I implemented logic to append the scope whenever the `Client.command` decorator was called, to an internal set inside `Client`. This allows autocomplete to view if a command is limited to a scope and can fetch that command successfully. The `_scope` set does not seem to get populated in `extension_command`, therefore `_command_obj` never gets populated with ApplicationCommand data

Will try to submit a PR with fixes
Here: https://github.com/interactions-py/library/blob/6cc6333a26d9686a900c2119f94ef14f5e7503bc/interactions/client.py#L832

Inverting the `self._automate_sync` check fixes this
> Here:
> 
> https://github.com/interactions-py/library/blob/6cc6333a26d9686a900c2119f94ef14f5e7503bc/interactions/client.py#L832
> 
> Inverting the `self._automate_sync` check fixes this

As in `if not self._automate_sync or ...` ?
> As in `if not self._automate_sync or ...` ?

Yes, I'm pretty certain that was what I used to resolve in my testing

Resolving patch:
diff --git a/interactions/client.py b/interactions/client.py
--- a/interactions/client.py
+++ b/interactions/client.py
@@ -849,7 +849,7 @@ async def autocomplete_choice_list(ctx, user_input: str = ""):
         elif isinstance(command, str):
             _command_obj: ApplicationCommand = self._http.cache.interactions.get(command)
             if not _command_obj or not _command_obj.id:
-                if getattr(_command_obj, "guild_id", None) or self._automate_sync:
+                if getattr(_command_obj, "guild_id", None) or not self._automate_sync:
                     _application_commands = self._loop.run_until_complete(
                         self._http.get_application_commands(
                             application_id=self.me.id,


Test patch: