#member vs. user (is that a bug or am I missing something?)

1 messages Β· Page 1 of 1 (latest)

vernal anvil
#

I had this line in a slash command:

    if ctx.member.guild_permissions.kick_members:

it worked as expected. pycharm however kept complaining about nof finding the attribute(s)

recently it was changed to

    if ctx.user.guild_permissions.kick_members:

both do the exact same thing, both work fine, but the latter doesn't raise any IDE complaints anymore.

Can someone explain why its behaving this way? I thought they were similar.

quick star
#

i dont think there is anything called ctx.member or ctx.user

there is just ctx.author

spare violet
#

^

quick star
#

are you using the wrong typehint or incorrect naming?

vernal anvil
quick star
vernal anvil
#

Ohhh

spare violet
vernal anvil
#

why?

quick star
#

Probably to reduce spam

spare violet
#

Maybe someone was using it alot

quick star
#

anyways thats out of context for this thread

vernal anvil
#

alright b2t

quick star
#

can you do print(type(ctx))

you might be naming Interaction as Context

#

interactions have interaction.user

#

context doesnt

spare violet
#

you think something else is installed? ;3

quick star
#

i doubt thats the case here

vernal anvil
spare violet
#

Can you also send the pip list? pip freeze > pip.txt

vernal anvil
quick star
#

one sec

#

.rtfm ApplicationContext

quick star
#

wow i never knew ctx.user is a thing

#

but i dont think ctx.member is a thing πŸ€”

#

unless it is smth undocumented

vernal anvil
#
# imports
import discord
from datetime import datetime
from discord.ext import commands
from discord.ext.pages import Paginator
import functools

import V2_functions
import database_access as dba
# slash command start lines
@booty.slash_command(name="testing", description="BLA!")
@booty_needs_to_be_ready
async def blabla(ctx: discord.ApplicationContext):
    print(type(ctx))
    await ctx.respond(booty.is_ready())

I used ctx.member and ctx.user a lot πŸ˜„
Should i change that?? πŸ˜… Its working pretty well

#

@quick star

quick star
#

booty kek

vernal anvil
#

It's logo is a boot, not a but!
It kicks people who are inactive πŸ˜„

quick star
#

yes ctx.member isnt suposed to work

i get ```py
AttributeError: 'ApplicationContext' object has no attribute 'member'

you can use either `ctx.user` or `ctx.author`
vernal anvil
#

i did change it to user, as stated in the first post. Was just confused cause both worked and one raised pycharm complaints.
so i wanted to learn why

quick star
#

πŸ€·β€β™‚οΈ

#

try print(ctx.member)

vernal anvil
#

alright, gimme a sec

#

thats even more confusing!
This:

    print(f"ctx.member: {ctx.member}\ntype, ctx.member:.{type(ctx.member)}")

does nothing but raise a butload of attribute errors

#

How could this code ever work the way it did before?

#

never mind, I just stay with ctx.user.
Was fun talking with you guys!
Thank you for your help

keen palmBOT
#

Done with your help thread?

Please close your own help thread by using </close:1009144375709814897> with @willow peak.

Backup bot: </solved:1109625445990793246> (or .solved) with @keen palm.