#๐ type annotation for member object
103 messages ยท Page 1 of 1 (latest)
@viral helm
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Be more detailed in your question
I want to allow only member to be passed on my slash command
@tree.command(description="Kick somebody")
async def kick(interaction: discord.Interaction, member: discord.Member) -> None:
await member.kick()
await interaction.response.send_message("done")```
So it's just the Member object bruh 
yeah
Bruh
that's how it works for most objects
if you wanted a user, you'd do user: discord.User
This make me wanna explode
What's the difference?
Of Member object and user object?
np
what is tree?
a CommandTree
Its the slash command of discord extension
!d discord.app_commands.CommandTree
class discord.app_commands.CommandTree(client, *, fallback_to_global=True)```
Represents a container that holds application command information.
Thank you!
Well I use discord.ext.commands.Bot.tree
Wait what frame work is this?
Am using discord.ext for slash command
That's a part of discord.py
Hmmmmm
client = discord.Client(intents=intents)
tree = discord.app_commands.CommandTree(client)
Bruh
So it don't use "Bot" object
it doesn't have to
you should only use commands.Bot if you're using prefix commands
otherwise, use discord.Client
(for the most part)
Why is this?
It will not ask for prefix
it just does a lot of extra unnecessary processing
it's more relevant to ask the question "why should I use the Bot class"
Y I never see this on anny tutorials bru
Well, why should I use the Bot class?
But mostly it's same as Bot.tree.command???
if you want to use prefix commands haha
Oh is that all LOL
Bot subclasses Client and adds prefix commands
Ah
and the default ?help command
Bot.tree is literally a CommandTree
it does self.tree = CommandTree(self)
Hmmmmm
so yes it's equivalent
So Bot.tree is. CommandTree subclass?
In the documentation it states that it is a CommandTree
Type:
CommandTree
!d discord.ext.commands.Bot.tree
Hmmm
@kind moss just a question
Why I can't use discord.ext
I have to install pycord to make it work
Idk why
you're probably just using it wrong
if you share some code and an error then we can tell you how to fix it
but I gtg so someone else can help
good luck
Open replit,create py project then create a simple Bot obj
It will trow a error
And it can't be fix
U don't have to run the bot
It will error on commands.Bot() part
Again, you're probably just using it wrong
If you show some code and an error we can tell you how to fix it
Repo?
Git
Its hard to paste code on git I have no pc
And what error do you get?
Can't remember
Just try it on replit
I cant use replit
Well the use is
I have to install pycord
Idk y
discord.ext has no module name commands
I'll delete my pycord
Before I got a error
But I can't replicate it now
Wierd
Not just prefix there are extensions too
Client doesn't have those
mhm that's why I said "for the most part"
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.