Skip to content

Conversation

@mAxYoLo01
Copy link
Contributor

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

From support server
Message.mention_users causes an error when fired from a DM channel, since the guild ID does not exist. This PR fallbacks to getting a user if the guild ID is not present.

Changes

Related Issues

Test Scenarios

@interactions.context_menu(name="Test", context_type=interactions.CommandType.MESSAGE)
async def test(ctx: interactions.ContextMenuContext):
    users = [user async for user in ctx.target.mention_users]
    print(users)

> [User(...)]

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

@LordOfPolls
Copy link
Contributor

This isn't really breaking

The current flow is request mentions -> error
You've made it request mentions -> get mentions

While you've changed the type hint, that only affects people who fit into the above situation. As such im removing the breaking flag on this

@LordOfPolls LordOfPolls changed the title fix!: Message.mention_users can return users if not in guild fix: Message.mention_users can return users if not in guild Aug 26, 2023
@mAxYoLo01
Copy link
Contributor Author

This isn't really breaking

The current flow is request mentions -> error You've made it request mentions -> get mentions

While you've changed the type hint, that only affects people who fit into the above situation. As such im removing the breaking flag on this

Alright, thanks for the explanation!

@silasary silasary merged commit c270804 into interactions-py:unstable Aug 26, 2023
@mAxYoLo01 mAxYoLo01 deleted the mention_users branch August 29, 2023 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants