Skip to content

fix: correct usage of user id in interaction metadata #1729

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

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

retr0-init
Copy link
Contributor

@retr0-init retr0-init commented Aug 6, 2024

Pull Request Type

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

Description

When trying to retrieve the user id of the response metadata of a message, it returns user_id is not the valid attribute of the object.

Changes

There is a valid user id attribute in the class already, which is _user_id. I suspect it was just a typo.

Related Issues

N/A

Test Scenarios

@interactions.slash_command(
    "test1", description="test channel command", scopes=[DEV_GUILD] if DEV_GUILD else None
)
@interactions.slash_option(
    name="integer",
    description="int",
    opt_type=interactions.OptionType.STRING,
    required=True
)
async def test_cmd1(self, ctx: interactions.SlashContext, integer: str):
    """Register as an extension command"""
    msg: interactions.Message = await ctx.channel.fetch_message(integer)
    msg_ref: interactions.Message = msg.interaction_metadata
    if msg_ref:
        print(msg_ref)
        await ctx.send(f"replied to {msg_ref.user}")
    else:
        await ctx.send("This message does not have a reference")

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

@AstreaTSS AstreaTSS mentioned this pull request Aug 12, 2024
@AstreaTSS AstreaTSS changed the title fixed: message response_metadata user id fix: message response_metadata user id Aug 12, 2024
@AstreaTSS AstreaTSS changed the title fix: message response_metadata user id fix: correct usage of user id in interaction metadata Aug 12, 2024
@AstreaTSS AstreaTSS merged commit e2becae into interactions-py:unstable Aug 12, 2024
2 checks passed
@retr0-init retr0-init deleted the pr-1729 branch August 12, 2024 16:41
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy