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] Guild is not passed to a message when using a Context menu #1536

Open
4 tasks done
mAxYoLo01 opened this issue Aug 19, 2023 · 1 comment
Open
4 tasks done

[BUG] Guild is not passed to a message when using a Context menu #1536

mAxYoLo01 opened this issue Aug 19, 2023 · 1 comment
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@mAxYoLo01
Copy link
Contributor

Library Version

latest

Describe the Bug

The guild that a message command is used on is not defined (i.e. ctx.target.guild is None). Most of the time, ctx.guild can be used instead for the user to work with but that means that some of the Message class features do NOT work as intended since the message acts as if it were written in DMs.
For example: #1535 returns users even when used in a guild if the message was not previously cached.

Steps to Reproduce

@interactions.context_menu(name="Test", context_type=interactions.CommandType.MESSAGE)
async def test(ctx: interactions.ContextMenuContext):
    print(ctx.target.guild)
    print(ctx.guild)

Results:

> None
> Guild(...)

Expected Results

Expected:

> Guild(...)
> Guild(...)

Minimal Reproducible Code

No response

Traceback

No response

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.
  • I have attempted to debug this myself, and I believe this issue is with the library

Additional Information

No response

@eightween eightween added help wanted Extra attention is needed question Further information is requested labels Dec 9, 2023
@eightween
Copy link
Member

I believe this is proper and expected behaviour. ctx.target is a property method for safely retrieving an object of Guild, Member or User through the interaction payload's resolved data – we're using .get() in our call site which can return None if the resolved object cannot be found.

Our current logic handles parsing the existing interaction data, not our cache. Do you mind explaining why you believe the expected result should be a guild?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants