So, I have something that checks when a button is pressed from an embed in a DM.
Here is my code:
@listen()
async def on_component(event: Component, ctx: ComponentContext = None):
ctx = event.ctx
if ctx.custom_id.startswith("accept_application"):
...
elif ctx.custom_id.startswith("deny_application"):
...
match ctx.custom_id:
case "start_application":
...
case "accept_invitation":
guild_id = ctx.guild_id # Retrieve the guild ID from the interaction context
guild = bot.get_guild(guild_id)
member = guild.get_member(ctx.author.id)
print(member)
await accept_invitation(ctx, member, 1138837807255781386)
So, my problem is that I'm using ctx: ComponentContext = None at the top, and for some reason here it decides to be None. Here's my exact error:
member = guild.get_member(ctx.author.id)
^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_member'```