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

Button interaction internal builder misused #64

Closed
theskyblockman opened this issue Nov 1, 2022 · 2 comments
Closed

Button interaction internal builder misused #64

theskyblockman opened this issue Nov 1, 2022 · 2 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@theskyblockman
Copy link

theskyblockman commented Nov 1, 2022

Hello,
I recently started using the library and wanted to use the button interaction API but when I wanted to handle the button I got an error:

Unhandled exception:
type 'Null' is not a subtype of type 'String'
#0      new ButtonInteraction.from (package:mineral/src/api/interactions/button_interaction.dart:37:14)
#1      InteractionCreate._executeButtonInteraction (package:mineral/src/internal/websockets/packets/interaction_create.dart:141:61)
<asynchronous suspension>

So to address this issue I think that we should just change this constructor from

 return ButtonInteraction(
      payload['id'],
      payload['application_id'],
      payload['version'],
      payload['type'],
      payload['token'],
      payload['member']?['user']?['id'],
      payload['guild_id'],
      payload['message_id'],
      payload['data']['custom_id'],
      payload['channel_id'],
    );

to

 return ButtonInteraction(
      payload['id'],
      payload['application_id'],
      payload['version'],
      payload['type'],
      payload['token'],
      payload['member']?['user']?['id'],
      payload['guild_id'],
      payload['id'],
      payload['data']['custom_id'],
      payload['channel_id'],
    );
@LeadcodeDev LeadcodeDev added the help wanted Extra attention is needed label Nov 1, 2022
@vic256 vic256 added the bug Something isn't working label Nov 3, 2022
@vic256
Copy link
Member

vic256 commented Nov 3, 2022

Hello,
We fixed this some time ago, it will be available in a future release. Meanwhile, you can replace payload['message_id'] with payload['message']?['id'].

@theskyblockman
Copy link
Author

Thanks for the information !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants