Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Slash command with "Attachment" option type gives an error #575

Closed
1 task done
UnlucksMcGee opened this issue Feb 25, 2022 · 1 comment · Fixed by #568
Closed
1 task done

[BUG] Slash command with "Attachment" option type gives an error #575

UnlucksMcGee opened this issue Feb 25, 2022 · 1 comment · Fixed by #568
Assignees
Labels
bug Something isn't working

Comments

@UnlucksMcGee
Copy link

Describe the bug.

When trying to accept an attachment argument in a slash command, the library gives an error:
AttributeError: 'Attachment' object has no attribute '_client'

List the steps.

Example test script

import interactions

if __name__ == "__main__":
    bot = interactions.Client(token="YOUR_TOKEN_HERE")
    
    @bot.command(
        name="attach",
        description="Some description",
        scope=YOUR_SCOPE_HERE,
        options= [
            interactions.Option(
                name="image",
                description="Attached image",
                type=interactions.OptionType.ATTACHMENT,
                required=True
            )
        ]
    )
    async def attach(ctx: interactions.CommandContext, image: interactions.Attachment):
        await ctx.send("Success")

    bot.start()

What you expected.

I expected the bot to reply with "Success".

What you saw.

Instead, I received this traceback error given from my Python terminal:

Traceback (most recent call last):
  File "................/test.py", line 23, in <module>
    bot.start()
  File "................/python3.9/site-packages/interactions/client.py", line 109, in start
    self._loop.run_until_complete(self._ready())
  File "................/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "................/python3.9/site-packages/interactions/client.py", line 307, in _ready
    await self._login()
  File "................/python3.9/site-packages/interactions/client.py", line 312, in _login
    await self._websocket._establish_connection(self._shard, self._presence)
  File "................/python3.9/site-packages/interactions/api/gateway.py", line 209, in _establish_connection
    await self._handle_connection(stream, shard, presence)
  File "................/python3.9/site-packages/interactions/api/gateway.py", line 277, in _handle_connection
    self._dispatch_event(event, data)
  File "................/python3.9/site-packages/interactions/api/gateway.py", line 340, in _dispatch_event
    _type[option.value]._client = self._http
AttributeError: 'Attachment' object has no attribute '_client'

What version of the library did you use?

release

Code of Conduct

  • I agree to follow the contribution requirements.
@i0bs
Copy link
Contributor

i0bs commented Feb 27, 2022

Closing in favour of #568 .

@i0bs i0bs closed this as completed Feb 27, 2022
@interactions-py interactions-py locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants