#Basic Pycord Help (Quick Questions Only)

1 messages · Page 40 of 1

sick quest
#

this freezes the bot as well -- basically when I try to run other commands while the task is running nothing happens

#

'the application did not respond'

pallid seal
#

Hey

#

When I do pip install py-cord it doesnt work

#

Can someone please help me out?

sick quest
pallid seal
#

Its in German

#

pip : Die Benennung "pip" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die
Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.
In Zeile:1 Zeichen:1

  • pip install py-cord
  •   + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
#

I can send it here

sick quest
pallid seal
#

It says that Phyton couldnt get finded

sick quest
pallid seal
#

I am not sure tbh

#

This comes when I want to open Python

sick quest
pallid seal
#

into the black console?

sick quest
pallid seal
#

Its says Syntax Error

#

I mean Invalid Syntax

loud holly
pallid seal
#

Okay

weak marlin
#

Not sure why I'm getting this error

versed fern
#

Any ideas why the if statement never get's triggered?

young bone
weak marlin
#

discord.Bot

young bone
#

change commands.Cog to discord.Cog

weak marlin
#

oh

#

same error

young bone
#

what is your py-cord version?

weak marlin
#

I don't remember the command to check

young bone
#

that is basic python...

weak marlin
#

💀

versed fern
weak marlin
#

I have the latest version now but it still gives me the same error

versed fern
#

show ur pip freeze

young bone
weak marlin
young bone
weak marlin
#

I thought I uninstalled that

versed fern
young bone
#

uninstall discord.py and py-cord and reinstall py-cord

weak marlin
#

alr

#

lol this just popped up

young bone
#

restart vs code

weak marlin
#

now nothing happens 💀

#

alr there

#

same thing again

full basin
#

The error clearly explains it lmao

woven gulch
#

So how does one add a slash command to a bot class?

#

Before instantiating it

limber urchin
#

Why do you want to do that?

woven gulch
#

Keep my code clean and have everything inside a class

limber urchin
#

Keeping everything inside of one class is not "clean". And it's not the intended way of using the library.

#

Just use cogs

woven gulch
#

Ok

glossy tusk
#

code?

round rivet
#

can you try installing git+https://github.com/Pycord-Development/pycord@fix-automod and seeing if that fix works

sick quest
sick quest
#

I'm trying to get a message by it's ID with this:

for channel in self.bot.get_all_channels():
            try:
                message = await channel.fetch_message(message_id)
            except NotFound:
                continue

But it's throwing an error every time I try it: Value "998272089343668364-1049395251992862830" is not snowflake.
I suspect this is due to the fact that I'm passing in a str to a function that (in the docs) needs an integer, but I can't exactly parse this string into an integer due to the hyphen. Does anyone know how to fix this?

limber urchin
#

A message ID never has a hyphen

sick quest
#

AH I see, if you hold shift and hit copy ID on a message, it copies <channel_id>-<message_id>

#

however if you use the three dots and hit copy ID, it copies only the message_id

zinc cloak
#

Question:
If I want to make a button persistent, but I already have a class for it, how would I go about it? I already looked at the documentation examples, but they are creating a class decorator and creating a new class. I already have a class. Is there a way to integrate it into the persistent view?

#

Ah idk should I make a thread

silver moat
silver moat
#

now excuse me, I will go back to studying

zinc cloak
zinc cloak
errant craneBOT
#

just a squid is AFK: study

#

Here's the persistent example.

undone falcon
#

Hi !, how it is possible to get this error ? It only appear sometimes, most time it work like normal. I don't get how the Member object can be a User and not a Member.
Error: add_timed_role_to_user with values [{'value': 'member id', 'type': 6, 'name': 'member'}, {'value': 'role id', 'type': 8, 'name': 'role'}, {'value': 0$
Error -> Application Command raised an exception: AttributeError: 'User' object has no attribute 'roles'

round rivet
#

If the user is not in the guild you will get a User

undone falcon
#

How can you @user that is not in your guild ?

#

I did not think it was possible

limber urchin
#

it is possible, but the mention will only show the ID

#

so it would look like @186427363909697536

#

and clients can have members of servers cached, despite them not being in the server anymore

undone falcon
#

I see thank you !! Could I just check if the object is of type User to return a error message or their is a better way to do it ?

limber urchin
#

I'd just do a try except

undone falcon
#

I see thank you 🙏

fringe socket
#

How do I make my bot have a streaming status? Whenever I try to do it, it just gives me a playing status or no status at all

limber urchin
#

show your code

fringe socket
#

hold on

proud mason
fringe socket
#

I know that it is possible to make an argument like a boolean that has choices other than True and False, but there isn't adequate documentation.
How would I go about doing this?

fringe socket
#

wdym?

#

can I have a docs page @proud mason

solemn idol
#

How would I be able to log images

limber urchin
#

log images?

fringe socket
#

Nevermind I was looking for discord.Option

proud mason
#

I thought you meant with python in general

#

Not pycord specifically

solemn idol
# limber urchin log images?

Yes, I'm making a bot with a moderation section, that section logs messages before edit after edit etc. (people know it does that dw.)
but I am trying to make it log files / images attached to a message.

#

it has to just hold for 3 days minimal since it auto deletes the log after 3 days.

amber shale
#

i have a slash command but it wont respond to user is there any way to hide/stop that "application didnt respond error"

amber shale
limber urchin
amber shale
quartz thunder
#

Hi all, hope you are fine, I'm creating a category and I need to set notifications OFF for this one, do you know how can I do that ?

limber urchin
#

what?

amber shale
#

i think it is client settings, so bot cant do anything

sand siren
#

is there a rich presence feature in pycord?

cobalt tangle
amber shale
#

😅

sick quest
cobalt tangle
#

so for some commands, I handle it via @command.error, but it gets passed on to on_command_error again. How do I prevent that

sand siren
#

is there a rich presence feature in pycord?

#

pls answer

silver moat
#

you can check out py presence for that

sand siren
silver moat
#

are you thinking of rich presence for the user or for the bot?

sand siren
#

bot

silver moat
#

bots can’t have rich presence

sand siren
#

so how do i make the "add to server" button

silver moat
#

you go to the developer portal and under oauth2 you can add it there

median ridge
#

How do I use the "Options" thing for the input on slash commands?

errant craneBOT
#

Here's the slash options example.

median ridge
#

something like

@bot.slash_command
async def hello(ctx,yeah: Options(str,"Hey")):
  await ctx.respond("Hello")
#

But I want the autocomplete function

#

And also input a list of stuff

cobalt tangle
#

how do I error handle per cmd for Bridge

sand siren
#

how do i give my bot "listening to x"?

cobalt tangle
sand siren
loud holly
loud holly
sand siren
#

thx

median ridge
cobalt tangle
#
activity = discord.Activity(type=discord.ActivityType.listening, name="commands")
bot = commands.Bot(activity=activity)
cobalt tangle
loud holly
#

choices=[]

median ridge
#

how do i give a list input

storm oyster
#

What are you trying to do?

#

interaction.guild should return the guild where the interaction is being used

fervent cradle
#

hey , how would i delete a previous view sent by the bot ?

storm oyster
#

Just edit the message and set view=None

fervent cradle
storm oyster
#

np

fervent cradle
#

hey uhm , how would i get the last sent message by the bot ?

#

i cant seem to find any infos about it on internet

full basin
loud holly
fervent cradle
#

never though it'd be that hard , ill find another way to remive my view then lol

#

thanks CLearMist anyways !

loud holly
opal kraken
#

how can i give bots a different role than that of normal members

median ridge
#

For some reason only the admins can use my bot?

fervent cradle
#
    @slash_command(description="Richte das Autoreact-System ein.")
    @commands.has_guild_permissions(administrator=True)
    async def autoreact_add(
        self,
        ctx: discord.ApplicationContext,
        textchannel: Option(discord.TextChannel, "Wähle einen Textkanal aus, wo automatisch reagiert werden soll.", required=True),
        emoji: Option(str, "Wähle ein Emoji aus, welches automatisch reagiert werden soll.", required=True),
        emoji2: Option(str, "Wähle ein Emoji aus, welches automatisch reagiert werden soll.", required=False),
    ):
        """Richtet das Feedback-System ein"""
        if textchannel not in ctx.guild.channels:
            await ctx.respond(
                content="Dieser Channel exestiert nicht",
                ephemeral=True
            )
        if emoji not in discord.Emojis:
            await ctx.respond(
                content="Dieses Emoji exestiert nicht",
                ephemeral=True
            )
        if emoji2 not in ctx.guild.emojis:
            await ctx.respond(
                content="Dieses Emoji exestiert nicht",
                ephemeral=True
            )
        if str(ctx.guild_id) in list(data.keys()):
            await ctx.respond(
                content="Das Autoreact System ist bereits laufend.",
                ephemeral=True
            )
            return
        if textchannel is None:
            textchannel = ctx.guild.get_channel(ctx.channel.id)

Why is it saying "Dieses Emoji exestiert nicht" (This emoji doesn't exist) when I select a regular emoji from Discord?

lost geyser
#

Is there a recommended way of adding a help to command to a slash command bot? If yes, how?

fervent cradle
lost geyser
#

maybe, or like a command /help. I know this is possible by just creating a command, but for the old commands there was a handy utilitiy

west vault
#

/help is the most common one

#

dunno actually what we do at pycord, but other libs even autogenerate the /help based on the code

proud mason
# sick quest what is the difference between using `asyncio.to_thread`, `asyncio.create_task`,...

asyncio.to_thread is the same as loop.run_in_executor . to_thread is a high level api call. Meaning it is simpler and easier to use. Both run a blocking function in a different thread so your event pool never gets blocked. This returns a coroutine https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread

Same analogy with asyncio.create_task and loop.create_task . asyncio one is higher level and easier. It submits a coroutine to the event loop to run in the background. This need not be awaited. Task execution starts the moment you call create_task .
See this question and accepted answer https://stackoverflow.com/q/62528272/13088701

||More details but this may confuse you. If yk python has a GIL so only 1 thread can be run at a time. So the switch between tasks happens when you await something inside it||

#

So basically use create_task if you have a coroutine you want to run in the background

Use to_thread if you have a blocking function you want to run in the background

#

||you can also use to_thread inside create_task but i don't think that does anything different||

#

All the above stuff is like intermediate level async python

sick quest
#

That mostly makes sense -- I solved my problem using loop.run_in_executor, however it's caused some problems that I'm trying to fix -- basically what I'm trying to do is run some code specified by the user (owner only command, I'm aware it's quite dangerous), and then capture the everything that went to stdout. However, if I run a more process-intensive task, it blocks the main event loop and effectively freezes the bot

#

so loop.run_in_executor works fine for now, but if I run one piece of code while another is running, sometimes the stdout goes to the wrong place for some reason

proud mason
#

Ah hmm

#

Try to_thread

sick quest
#

yeah I'm putting that in rn

proud mason
#

It saves the context vars and stuff

#

Maybe that's what causing the issue

sick quest
#

will just changing the function work? like result = await loop.run_in_executor(None, run_in_background, args) vs result = await asyncio.to_thread(None, run_in_background, args)

proud mason
#

No asyncio.to_thread has a different order of parameters

sick quest
#

oh ok

#

i'll look it up rq then

proud mason
#

First goes the func and then its args. It doesn't have the None part

sick quest
#

ah

#

thanks

sick quest
#

I was thinking maybe something like multiprocessing could solve this? idk how that would work though

#

context: the second one should return a message saying nothing went to stdout
my code is basically just:

with io.StringIO() as output, contextlib.redirect_stdout(output):
  exec(code, global_vars)
  output = output.getvalue()
``` (this runs in the to_thread, and `code` is a compiled code object)
solemn idol
#

is there anway I can close an option after using the other?

silver moat
#

you can use command groups tho

solemn idol
proud mason
potent tendon
#

I wanna make a poker game with pycord, but I want to add a dealer role so that only the dealer can do certain commands, is there a way to make only a certain role able to execute slash commands?

sick quest
still helm
#

hmmmm updated to the newest pycord version and got :

discord.errors.ExtensionFailed: Extension 'cogs.dcCommands' raised an error: AttributeError: 'MainBot' object has no attribute 'bridge_commands'

still helm
young bone
still helm
limber urchin
#

I'm not sure if the channel is made for that, but as long as it's not for personal gain I don't see why not. Probably better to ask in #general though

abstract raven
bright jetty
#

Hi, how i can fix this please ?

user = guild.get_member(int(id.group(1)))
AttributeError: 'NoneType' object has no attribute 'group'```

```php
@cog_ext.cog_slash(name="profile", description="User stats (mention, username)", guild_ids=None, options=[discord_slash.manage_commands.create_option(name="user",description="User profile", option_type=str, required=True)])
    async def profile(self, ctx, user:str):

        if "@" in user:
            id = re.search('<@!(.+?)>', user);
            guild = ctx.guild
            user = guild.get_member(int(id.group(1))) # LINE 84
bright jetty
#

but my question is how i can fix it

silver moat
#

consider using user options instead of strings

errant craneBOT
#

Here's the slash options example.

bright jetty
#

i using both options

#

string and @ping

silver moat
#

you can use the user option type

bright jetty
#

but i need both options..

silver moat
#

user also handles mentions

bright jetty
#

i dont understand

verbal marten
#

If you set the option type to discord.User it does the conversions for you, it can take an ID too @bright jetty

verbal marten
#

Oh yeah mb didn’t fully read what they were trying to do

bright jetty
#

but i need the user to be able to write something other than mention

#

and mention too

#

for 1 optin = 2 values (mention, nick)

young bone
#

you get both from discord.Member

bright jetty
#

so if i write /profil NICK (without @) so i can use this command ?

verbal marten
#

That option type allows them to search for the member within the server, so there’s no need to @ them in the command

#

The bot would make you select a member from a list before the command is run

solemn idol
#

How would I use discord.Slashcommand.mention ?
(To mention slash commands)

verbal marten
#

Do you want to be able to search for them by a nickname too? Cause you can do that by having one option with the type discord.Member

#

Just try it and see if it’s what you need

bright jetty
#

No, i need this for example:
/profile @bright jetty
/profile something_other_text

verbal marten
verbal marten
bright jetty
verbal marten
solemn idol
#

it would it give me the <property at Object...>

bright jetty
limber urchin
#

You can't have both member and text as an option type, if that's what you are asking

proud mason
#

You can implement something like that yourself using autocomplete

bright jetty
limber urchin
#

You can fix it by making sure id is not None

bright jetty
#

But id is always None

limber urchin
#

So why are you trying to do id.group then?

bright jetty
#

why is id none ?

limber urchin
#

Because you're trying to match a string with ! in it

#

and that doesn't have a ! in it

bright jetty
#

omg 😄

#

thanks

verbal marten
#

How can I make a custom cooldown apply per server, not globally? If its a global slash command. Would I have to store data on when the command was last run in a db?

simple canopy
#

you just need to use BucketType.guild

fervent cradle
#

Hi, on this line:

await msg.add_reaction('![dv_wCyanHeartOwO](https://cdn.discordapp.com/emojis/837700662192111617.webp?size=128 "dv_wCyanHeartOwO")')

I'm getting an error:

  File "/usr/local/lib/python3.8/dist-packages/discord/message.py", line 1487, in add_reaction
    await self._state.http.add_reaction(self.channel.id, self.id, emoji)
  File "/usr/local/lib/python3.8/dist-packages/discord/http.py", line 359, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In emoji_id: Value "dv_wCyanHeartOwO" is not snowflake.

The bot has been running for many days and it only started throwing this error the last hour. I'm not sure what's wrong

#

The msg is a discord.Message object

verbal marten
west vault
proud mason
#

.rtfm PartialEmoji

simple canopy
fervent cradle
# west vault it tells you exactly what the problem is

I can read errors, I just don’t understand

  • why it just stops working all of a sudden, considering my usage of a string for a custom emoji has worked for months

  • why it thinks the snowflake ID is the emoji name when I placed the whole emoji string in

proud mason
fervent cradle
verbal marten
west vault
#

hi giga

fervent cradle
simple canopy
fervent cradle
west vault
#

did you updated pycord recently?

fervent cradle
#

No, it’s on 2.1.1

proud mason
#

Update lol

west vault
simple canopy
proud mason
#

Yep

fervent cradle
#

Alright

verbal marten
simple canopy
#

you're welcome

fervent cradle
# west vault mhh first thing > update

I was only able to update up to 2.2.0, on >=2.3.0 I encounter this error on startup

  File "C:\Users\laiye\Desktop\Bots\dank-vibes-bot\cogs\mod\mod.py", line 287, in Mod
    class RoleFlags(commands.FlagConverter, case_insensitive=True, delimiter=' ', prefix='--'):
  File "C:\Users\laiye\miniconda3\envs\dank-vibes-bot\lib\site-packages\discord\ext\commands\flags.py", line 335, in __new__
    for flag_name, flag in get_flags(attrs, global_ns, local_ns).items():
  File "C:\Users\laiye\miniconda3\envs\dank-vibes-bot\lib\site-packages\discord\ext\commands\flags.py", line 168, in get_flags
    flag = Flag(name=name, annotation=annotation, default=flag)
TypeError: __init__() got an unexpected keyword argument 'name'
#

I have a simple FlagConverter that I use for a command

    class RoleFlags(commands.FlagConverter, case_insensitive=True, delimiter=' ', prefix='--'):
        roles: Optional[str]
west vault
#

mhh could you share that particular code?

proud mason
#

Aren't you supposed to pass the delimiter and all that stuff in the init ?

fervent cradle
simple canopy
#

not instance ones

proud mason
#

Well idk then

fervent cradle
#

not sure if this would be useful but this is how I pass the roleflags in the command

    @checks.has_permissions_or_role(manage_roles=True)
    @commands.command(name="self", aliases=["selfroles"], usage="--roles (role names separated by commas) (optional)")
    async def selfroles(self, ctx, channel:Optional[discord.TextChannel] = None, *, flags: RoleFlags):
proud mason
simple canopy
#

at least its what it seems to be?

proud mason
simple canopy
#

i gotta test smth

proud mason
#
class FlagConverter:
    delimiter="something"
    prefix="smth else"
    ...

These are class vars right

simple canopy
#

yea, i but i might've fuck'd up myself, one second

proud mason
#

👍

fervent cradle
#

I tried using the flagconverter in some simple code, it worked in 2.2.0 but failed past that version
Removing the delimiter and prefix did nothing too

token = ""

import discord
from discord.ext import commands

intents = discord.Intents.all()

bot = commands.Bot(command_prefix="!", intents=intents)

class TestFlags(commands.FlagConverter, delimiter=' ', prefix='--'):
    one: str
    two: str

@bot.command(name="testflag")
async def testflag(ctx: commands.Context, *, flags: TestFlags):
    await ctx.send(f"one: {flags.one} two: {flags.two}")

bot.run(token)
simple canopy
# proud mason 👍

well, dunder __init_subclass__ handles those sort of argument, i mistaken shit

#
class FlagConverter:
  def __init_subclass__(cls, delimiter=None):
    super().__init_subclass__()
    cls.delimiter=delimiter
    ...

class RoleFlags(FlagConverter, delimiter='A')
#

kind of like that

#

but you can set class variables using this

simple canopy
#

not sure

west vault
fervent cradle
west vault
dusk burrow
#

slash commands are not registering for me

#

is anyone else experiencing similar issues

proud mason
dusk burrow
#

yea I am

#

i should have read this lol

dusk burrow
#

do you think it may have something to do with the fact that im using AutoShardedBot?

#

wait i managed to fix it

#

thank you for your assistance

#

it probably would have helped if i loaded the cogs before i synced the commands 🤣

dusk burrow
#

ik sharding is only required when your bot reaches 2500 guilds, but i wanted to have it implemented from the start, as then if and when the bot reaches 2500 guilds then i have 1 less thing to worry about 😂

quartz thunder
#

Hey 🙂 Is there a way to get the guild creation date ?

quartz thunder
#

Thanks

fervent cradle
#

how do i add links to buttons

#

i keep getting an error saying

    @discord.ui.button(label="LC", row=0, style=discord.ButtonStyle.link, url='https://elevateservices.sell.app/product/lastcheat-rust')
TypeError: button() got an unexpected keyword argument 'url'```
fervent cradle
proud mason
proud mason
#

They don't have a callback

#

Create a button object using the Button class and add it to the view

fervent cradle
cobalt tangle
#

how do you handle bridge command errors

young bone
fervent cradle
young bone
fervent cradle
young bone
#
  1. that was not the pip list
  2. Om already told you what you have to do for the Url button
cobalt tangle
#

one for application and one for prefix?

young bone
cobalt tangle
simple canopy
simple canopy
#

well, there is on_error, but it will catch literally almost everything

#

i don't think on_command_error is universal either, so you need to manually assign the same coro method to all comands

#

or use on_error

simple canopy
full basin
solemn idol
# full basin Code?
elif command:
            cmd = client.get_application_command(command)
            if command == cmd.name:
                commands_desc = (f'{cmd.description}\n Usage : {discord.SlashCommand.mention}')
                em.title = (f'{cmd} - Help')
                em.description = commands_desc
                em.color = em_blue
                await ctx.respond(embed = em)
#

not entirely sure if I am using it correctly

cobalt tangle
#

huh

full basin
#

Do you realize you're trying to get a mention from a non intiated class

cobalt tangle
#

u need the object

#

not a property

#

its cmd.mention

solemn idol
#

wait hold up-

cobalt tangle
#

discord.SlashCommand is a property

solemn idol
#

facepalm thanks

#

it works

#

I am not sure why I didn't see this directly

pale scroll
#

is it possible to fetch the id of a reference message using a slash command?
as in: you reply to a message with a slash command, how do you get the id of the message that you replied to?

cobalt tangle
full basin
#

You can't reply to a message and use a slash command at the same time.

pale scroll
#

hm

full basin
#

When you execute the slash command the reply goes away

pale scroll
#

oh i see

full basin
#

You'd need to do it with prefixed commands

pale scroll
#

thanks

full basin
#

Np

amber shale
#

is there any way to limit commands to some server?
like only to those servers who has bought premium

simple canopy
#

you can define a check for a command via @commands.check decorator

#

and check for stuff here

amber shale
simple canopy
#

yes

amber shale
#

anyway to remove it from that

simple canopy
#

i don't think so

#

the thing is, command are registered on the bot's startup

#

and you can't really change them in the runtime, at least in a somewhat friendly way

amber shale
#

so discord api limitation?

simple canopy
#

i'm not sure, but i do not know the way to get it working

#

don't think it's possible

amber shale
#

am i explaining it correctly?

#

sorry if i am not

#
  • user checks available command using /, there is one command help
  • a user buys premium
  • user checks available command using /, there is two command now help and premium
simple canopy
#

well, you can set guilds on the command creation, so you can pass a data from db

#

but it's only on startup

amber shale
#

i think it is pycord's limitation?

simple canopy
#

no other way to handle this, manual command check is the best way i guess

amber shale
#

ok

simple canopy
#

i think it's discord's limitation afterall

amber shale
#

ok

#

thanks for spending time to clear my doubt

simple canopy
#

yeah, you're welcome

median ridge
#

How do I make a slash command only show for certain users?

#

Not based on permissions, but only for some users

young bone
#

only with permissions

median ridge
#

Aw

#

How do I make a command with prefixes then?

#

Like a message command instead of slash command?

young bone
#

the same like a slash command

errant craneBOT
#

Here's the basic bot example.

young bone
#

@median ridge

median ridge
errant craneBOT
#

Here's the audio recording example.

amber shale
#

is there any to change guilds in not global commands while bot is running?

solemn idol
#

Is there a way to check if a command has options?

#

and if it has, to print out those options

#

as plain text ig

cobalt tangle
twilit valley
#

Is there a way to modify an options list when executing a slash command based on previous options already selected

#

so for example if you run a slash command with 2 arguments is there a way to modify the options list for the second argument based on what you chose for the first argument

errant craneBOT
#

Here's the slash autocomplete example.

full basin
#

AutocompleteContext has a options attribute

toxic python
#

How to get the icon_url from the user in a cog?

#

This doesnt work anymore

full basin
#

It's author

#

You literally typed it in the footer text.

toxic python
#

yeahhh..

#

so ctx.author.display_avatar.url or user.display_avatar.url or something completly diffrent?

full basin
solemn idol
toxic python
#

because user is defined as a discord.Member or as the author

cobalt tangle
#

it returns a list of discord.Option's

#

get the discord.Option from docs

full basin
toxic python
#

thx for the help buddy

solemn idol
# cobalt tangle um

Yes I know how to get the Options, but it returns me this list:
[<discord.commands.Option name=member>, <discord.commands.Option name=reason>]

And I was wondering if I can just get the value of name=x out of the string, since doing it with .find() is a huge pain.

solemn idol
full basin
#

Then just get the attribute...

solemn idol
#

wdym

full basin
#

If you want the name, then just loop again and get the names

solemn idol
#

or that..

full basin
#
options = [option.name for option in cmd.options]```
fervent cradle
#

help
keko = Button("Joo") TypeError: Button.__init__() takes 1 positional argument but 2 were given

#

Code:

    @slash_command(description="Erhalte Hilfe zum Bot.")
    async def help(self, ctx):
        select = TutorialSelect()
        select.append_option(keks)
        keko = Button("Joo")
        view = discord.ui.View(timeout=None)
        view.add_item(select)
        view.add_item(keko)

        embed = discord.Embed(
            title=":Night_Bot: 𑁉 Hilfe | Fishy",
            description=f":NU_Text: Hey {ctx.author.mention},\n"
                        f":NU_Text: hier findest du alle Informationen zu Fishy.",
            color=0x545EE2
        )


        embed.add_field(name=":NU_Uhr: Bot-Wartungen:", value=":NU_Pfeil: Bis zum 20.11.2022 (geschätzt)", inline=False)

        embed.set_thumbnail(url=ctx.author.display_avatar.url)
        embed.set_image(url="https://media.discordapp.net/attachments/1018494599548915742/1018904011224645743/unknown.png")
        embed.set_footer(text="© Sian, 2022")

        await ctx.respond(embed=embed, view=view())
proud mason
fervent cradle
full basin
burnt fjord
#

Is there a way to change the thinking message? Like from [bot] is thinking... to something custom?

burnt fjord
#

Ah okay. Well, for one command that routinely takes around 40 seconds to generate something, I have it respond with message = await ctx.respond('please wait around 40-60 seconds'), and then after send the thing it generates (embed). Right now, it does await ctx.followup.send(file=file, embed=embed). How do I get it to delete the old message and reply the embed to the original command? or at least ping the user? Mainly having trouble with the deleting old message part as message.delete() doesn't work

burnt fjord
#

Oh yeah true, how would I do that

silver moat
#

.rtfm applicationcontext.edit

winter condorBOT
burnt fjord
#

Thanks! Works just like I wanted it to

amber shale
#

is ti possible to make our own activity in voice channels?

frail matrix
#

How can I print something to console whenever someone joins a voice channel?

frail matrix
#

Is there anywhere I can find examples on how to use that?

limber urchin
#

You use it like any other event listener

amber shale
#

discord dont allows it?

round rivet
#

Why would you be able to

amber shale
ruby yew
#

hey! when using attachments in slashcommands (SlashCommandOptionType.attachment, or equivalently 11), is it expected that the attachment is an actual image (like sending an image over a message) or is it the url to an image? ive been under the impression for some time that it was the former so i thought i'd get some clarification

edit: attachments as an input option / parameter

limber urchin
#

An attachment is a file, not a url

ruby yew
#

can it be attached through conventional copy pasting?

limber urchin
#

Why would the method you use to attach it matter?

ruby yew
#

at the moment, pasting an image doesnt seem to do anything, and i can only enter strings (which get accepted when i send the command, which is why i started thinking it might be a url).
Option(name="image", description="Image containing riven.", input_type=SlashCommandOptionType.attachment),
i can open a separate thread if this requires a deeper look

ruby yew
tired goblet
#

How can i send mesage to a specific channel in my server? The bot has admin rights

limber urchin
amber shale
#

is a slash command group counted as one command here?

west vault
# amber shale discord dont allows it?

Well.. not gonna go into detail

Discord limits creation of activities to selected partners of the company. There is an apply form for it but they don’t accept normal users

amber shale
#

thanks

chilly silo
#

How do I use the discord.Build() class?
I don't know what to put in the arguments.

limber urchin
#

There is no such thing as discord.Build in pycord

chilly silo
#

Oh,sorry

#

discord.Guild() class

limber urchin
#

Why do you want to manually create an instance of a guild?

chilly silo
#

To automate the creation of roles using the bot's slash command.

limber urchin
#

There is no reason to create a new instance of a guild class for that

#

Just access the guild from the commands ctx

chilly silo
#

So how do you use the create_role() method?

limber urchin
#

read the docs

chilly silo
#

From what I saw, I thought it would use the create_role() method of the discord.Guild() class.

limber urchin
#

yes?

chilly silo
#

I'll try again.
Thanks.

frail matrix
#

Is there a limit to how many options you can have in a select menu?

limber urchin
#

25

frail matrix
#

Cool, thanks

cobalt tangle
#

My bot's ping is very bad even though the network speed is fine

#

any clue why?

#
class Bot(bridge.Bot):
    def __init__(self, command_prefix="c!", help_command=MyNewHelp()):
        super().__init__(command_prefix, help_command, intents=intents, owner_id=871024566472966175)
    async def on_ready(self):
        setattr(bot, "db", await aiosqlite.connect("databases/bot.sqlite"))
        bot.db = await aiosqlite.connect("databases/bot.sqlite")
        await asyncio.sleep(3)
        async with bot.db.cursor() as cur:
            await cur.execute("CREATE TABLE IF NOT EXISTS member (health INTEGER, id TEXT, status TEXT)")
            await cur.execute("CREATE TABLE IF NOT EXISTS memberstats (attacks INTEGER, sword TEXT, defense INTEGER, id INTEGER)")

            #Deaths (Instant revive)
            await cur.execute("SELECT * FROM member WHERE status = ?", ("Dead",))
            r = await cur.fetchall()
            for x in r:
                await cur.execute("UPDATE member SET status = ? WHERE id = ?", ("Alive", x[1],))
                await cur.execute("UPDATE member SET health = ? WHERE id = ?", (1, x[1],))
        await bot.db.commit()
limber urchin
#

Where is your bot hosted?

cobalt tangle
#

i have another question

limber urchin
#

?

cobalt tangle
#

so i use

#
async def kill(bot, user, time):
    async with bot.db.cursor() as cur:
        await cur.execute("UPDATE member SET status = ? WHERE id = ?", ("Unconcious", str(user.id),))
        await cur.execute("UPDATE member SET health = ? WHERE id = ?", (0, str(user.id),))
    await bot.db.commit()
    await asyncio.sleep(time)
    async with bot.db.cursor() as cur:
        await cur.execute("UPDATE member SET status = ? WHERE id = ?", ("Alive", str(user.id),))
        await cur.execute("UPDATE member SET health = ? WHERE id = ?", (100, str(user.id),))
    await bot.db.commit()
``` this
#

when someone's health is 0

#

but this stops my stab command for 60 seconds as this sleeps for 60s

#

how do I let the stab cmd go through and as well as do this in the background?

limber urchin
#

don't ping me

cobalt tangle
#

ok

#

sorry

cobalt tangle
#

nvm fixed guys

worn void
#

How can I find which invite a person joined with and then find who made that invite

tired goblet
#

how do i get a channel object? i have the channel id

winged zephyr
#

second is my code

#

why does it give this eror

limber urchin
#

Don't name the parameter message, it's not a message it's an ApplicationContext object.

#

And use .respond

limber urchin
winged zephyr
limber urchin
tired goblet
limber urchin
#

I do not see any .respond here...

winged zephyr
#

wait i add and show u

tired goblet
#

is that wrong?

limber urchin
#

Try it and see

tired goblet
#

i give it a valid channel id from my server and it prints None

limber urchin
tired goblet
#

means it cant find the channel?

dapper flare
#
message = "asfasfsad"
    await message.channel.send("you passed ", user)```
#

why does this not work?

limber urchin
#

"not work" is useless, show errors or explain how it doesn't work

dapper flare
#

oo

#

discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'str' object has no attribute 'channel'

limber urchin
#

Wait, you're actually trying to use .channel on a string?

dapper flare
#
@client.slash_command(name="pass")
async def testt(ctx, user:Option(discord.Member, "who passed in the forum o-o"), channel: discord.TextChannel):
    #channel = client.get_channel(1050359690384638043)
    message = "asfasfsad"
    await message.channel.send("you passed ", user)```
limber urchin
#

why?

dapper flare
limber urchin
dapper flare
#

yea im dumb

#

discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given

#
@client.slash_command(name="pass")
async def testt(ctx, user:Option(discord.Member, "who passed in the forum o-o"), channel: discord.TextChannel):
    channel = client.get_channel(1050359690384638043)
    await channel.send("you passed ", user)```
#

i also tried this

limber urchin
#

because send only takes one positional argument, the others are keyword only

limber urchin
#

Read the docs

vale heath
#

And why are you pre defining channel when you taking channel in cmd 🤔

dapper flare
#

i tried it ends here i cant seem to find how it works

winged zephyr
limber urchin
vale heath
#

Through error handling 🤔

agile minnow
#

how to play another song after the previous song ends?
Just a reference or a hint is fine for me

tired goblet
#

how do i send message in a channel without an event? like i don't want the message to be sent when a command is invoked or when a member joins, i just want it sent

tired goblet
cobalt tangle
cobalt tangle
tired goblet
#

one quick question, if the documentation says that a function is a coroutine, what does that mean?

cobalt tangle
#

not def

tired goblet
#

oh

#

okay maybe i should learn asyncio first

cobalt tangle
#

yep

tired goblet
#

thanks

cobalt tangle
#

np

tired goblet
#

hi, the pycord introduction lists these topics to be learnt before building discord bots. i think i know up till loops. i would like to start with classes. any good tutorial online for that? thanks

young bone
tired goblet
storm geode
#

How would i take a image file as a input in a slash command?

errant craneBOT
#

examples/app_commands/slash_options.py lines 51 to 67

@bot.slash_command(name="attach_file")
@option(
    "attachment",
    discord.Attachment,
    description="A file to attach to the message",
    required=False,  # The default value will be None if the user doesn't provide a file.
)
async def say(
    ctx: discord.ApplicationContext,
    attachment: discord.Attachment,
):
    """This demonstrates how to attach a file with a slash command."""
    if attachment:
        file = await attachment.to_file()
        await ctx.respond("Here's your file!", file=file)
    else:
        await ctx.respond("You didn't give me a file to reply with! :sob:")```
obtuse juncoBOT
#
tired goblet
#

thanks

pallid seal
#

Hey

#

I need help

#

const config = require('./setttings.json')
const token = config.token
const { Client } = require('discord.js')
const client = new Client({intents:[]})

client.once("ready", () => {

console.log('ich bin online')
client.user.setActivity({name: "ich bin kuhl", type: "PLAYING"})

})

client.login(token)

#

Is there something false?

#

if I do index.js it doesnt work

pallid seal
#

no js?

woeful spindle
atomic wolf
#

Is there a way to disable a select menu after it was used?

full basin
atomic wolf
full basin
#

Yes

#

That's what you do lol

atomic wolf
#

Without editing the message

full basin
#

You must edit the message

#

It's like trying to get Cash from the ATM without putting your card in it.

weak marlin
#

Can I run multiple bots on one vps, like ovh?

undone falcon
#

I was just wandering if there is any downside of using py-cord[speed] instead of the regular version ?

limber urchin
#

what?

west vault
#

then you would work with a stream instead

fervent cradle
#

How to edit a respond?

west vault
undone falcon
#

If I am getting a lot of OperationalError: database is locked, does it mean I should switch database away from SQlite ?

proud pagoda
#

Is it possible to access a user's roles from interaction.user?

#

Or do I need the member intent

limber urchin
undone falcon
limber urchin
#

Then you should find a way to decrease the load on your database

undone falcon
#

I see, I heard some database supports parallel access much better than SQLite, maybe I will need to change databases

limber urchin
#

To me it sounds like you need to find a better way to handle your data, switching to another database is just ignoring the root problem

undone falcon
#

I see, I am pretty new to databases in general, it is possible I am doing thing hte wrong ways to

#

You are rigth, I should try to see if it is possible to fix it first !

limber urchin
#

What is the reason you're accessing it so often?

undone falcon
#

I have a loop in the background removing roles. My bot is timed roles. But at the same time I get user that want to had new roles

rare ice
#

i recommend MongoDB

limber urchin
#

And how often does this loop run?

undone falcon
#

But I am doing remot operation to discord in the database, maybe it is that

limber urchin
#

Querying your database once per minute is not even close to being too often

undone falcon
limber urchin
#

and what do you mean by "remot operation to discord in the database"?

undone falcon
#

because it takes a long time removing all the roles

#

20 ms per remove call to discord

limber urchin
#

It takes more than a minute to remove roles from a user? Why?

undone falcon
#

it will take more than 1 minutes

limber urchin
#

It is literally impossible for a member to have 1000 roles

undone falcon
#

roles on differents members

#

not the same

limber urchin
#

Well in that case you shouldn't be reading or writing to your database until you're sure your bot is done removing the roles

undone falcon
#

Here is the remove exemple:

#

The remove is after

#

I try to remove all the expired role, If it succeed I had it to a list. After the get I do a delete on all the deleted roles

#

But yeah thank you for your help ! I will try to find the place that is using to much write operation, it is probably somewhere

fervent cradle
#

Hey, how i can get the main channel from a server?
i can't find in the docs to this

rare ice
young bone
rare ice
#

If you mean a general chat like #general, you can’t since that’s a Discord limitation.

fervent cradle
#

Too bad.. but thanks for you answer

burnt fjord
#

So I went ahead and got rid of the guilds=... paramater on all of my slash commands because I want to make them global, but now im getting the All application names must be unique error, and ive triple checked all of the commands. Ive noticed that only the bot.py commands are loaded, and theres two of every one??

#

Is it because they are still guild-specific commands? If so, I thought the bot.sync_commands() fixed that

silver moat
burnt fjord
#

what is going on

I just ran the empty bot and now

#

I would also like to point out that none of these fake ghost commands do anything and just time out

#

(I commented out them all in the code)

silver moat
#

Refresh your discord app

#

command/control + R

burnt fjord
#

Okay the ghost commands are gone ill try the full code again (without cogs loaded)

#

okay it seems that two commands somewhere in the cogs are conflicting so ill reload the bot one cog at a time added to see

burnt fjord
#

oh my god i think i found it
i did actually have two commands named the same in a cog im so sorry I hope you have a good rest of your day mr. squid

burnt fjord
#

Also, I thought global commands take like an hour to update, these came on immediately

fringe socket
#

awwwww this is amazing! for once people are being nice in #969574202413838426

fringe socket
#

lol

burnt fjord
#

so this whole time i could have not been importing a list of guilds the bot is in and passing that through the slash command

midnight torrent
#

can paginators not respond to interactions that have been defered ephemerally?

#

with ephemeral=True

#

paginator forms but is un useable

#

with ephemeral=False it works fine no errors paginator works as intended

verbal marten
#

Not sure why the view isn't functioning but once you make a response ephemeral it cannot change to be a normal response, which is why it errored.

midnight torrent
#

ahhh i see

#

so i guess i just ephermal the final response if possible

verbal marten
#

Yeah, or if you don't pass the ephemeral arg it will default to true iirc

#

Do you get interaction failed hen you try to interact with the paginator?

midnight torrent
#

yeah

#

also got one when i moved ephermal to the paginator respond

verbal marten
#

Strange, the other errors regarding this is when people pass ctx into .respond() but you've already got it as an interaction

midnight torrent
#

yeah, im not sure

#

and the fact its not throwing an error is even weirder

#

my error handler catches everything

viscid rapids
#

member.roles returns a list of objects I think, is there a way to get only a list of the role names? is there a method for that, or is there something I can do with code.

#
[<Role id=1047755837541720115 name='@everyone'>, <Role id=1050590117363974267 name='b'>, <Role id=1050590093825544233 name='t'>]
viscid rapids
fast badger
#

this code can't iterate through any members but the bot itself
any idea why?
for g in bot.guilds: print(f"Checking {g.name}...") for member in g.members: if member.bot == True: break else: print(f'Checking {member.name}...') await writeuserdata(member.id)

fast badger
cobalt tangle
#

members

#

also use async for lol

fast badger
# cobalt tangle members

no i don't, is there anyway i can add it alongside discord.Intents.default() without getting an error?

cobalt tangle
#
i = discord.Intents.default()
i.members = True
#

@fast badger make sure to enable it in discord dev portal

fast badger
cobalt tangle
#

ok did the intents work?

fast badger
cobalt tangle
#

alr

verbal gulch
#

Hello! May i ask why my code is not working? It should send a message every 5 seconds to every channel registered. ```py
@tasks.loop(seconds=5)
async def autoad():
try:
all_configs = configguilds.find()
for config in all_configs:
all_ads = autoads.find()
for ad in all_ads:
try:
await bot.get_channel(config['bumpcid']).send(ad['advertisement'])
except:
pass
except:
pass

@bot.event
async def on_ready():
autoad.start()

#

(I don't get any error)

quartz thunder
#

Hey is there a way to make a multiselect discord.Option ?

#

(from a command)

full basin
full basin
quartz thunder
verbal gulch
full basin
quartz thunder
#

Dirty but efficient ahah ok thanks

full basin
#

Why don't you use a select menu

quartz thunder
#

Have you an example pls ?

errant craneBOT
#

Here's the dropdown example.

full basin
#

@quartz thunder

quartz thunder
#

Thanks dark, checking it 🙂

true pewter
#

Has anyone tried returning a .json? I'm trying to get the message to return a .json and I can't get it to return a .json.

#
    @commands.slash_command(name="dict")
    async def return_json_test(self, ctx):
        dict_test = {
            "10": "test"
        }

        dict_to_str = json.dumps(dict_test)
        await ctx.respond(dict_to_str)

        return_file = discord.File(filename="test.json", description="test", fp=dict_to_str)
        print(type(return_file))

        await ctx.respond("Here's your file!", file=return_file)
proud mason
true pewter
#

thx

#

@proud mason

proud mason
#

Send the code

true pewter
#
    @commands.slash_command(name="dict")
    async def return_json_test(self, ctx):
        dict_test = {
            "10": "test"
        }

        await ctx.respond(json.dumps(dict_test))
        json_bytes = json.dumps(dict_test).encode("utf-8")

        await ctx.respond(file=discord.File(fp=json_bytes, filename="test.json"))
proud mason
#

And pass that to fp

#

Cuz discord.File runs open on it

true pewter
#

bytes_io = io.BytesIO(json.dumps(dict_test).encode())

#

okay okay

#

work perfect

young bone
true pewter
dapper flare
#

how can i edit vc role permissions

full basin
#

.rtfm VoiceChannel.edit

winter condorBOT
cobalt tangle
#

Why can't we get the nitro badges? Is this a library limitation or discord one?

full basin
#

I think discords

#

You have premium_since iirc

#

But I think it's for server boosting, not nitro

#

.rtfm premium_since

winter condorBOT
west vault
verbal gulch
west vault
#

even for testing that's too much

#

.rtfm premium_type

winter condorBOT
#

Target not found, try again and make sure to check your spelling.

west vault
#

hmm

west vault
dapper flare
#
@commands.has_permissions(administrator=True)
@client.slash_command(name="fjoin")
async def fjoin(ctx):
    channelid = 1050359690384638044
    channel = client.get_channel(channelid)
    overwrite = discord.PermissionOverwrite(connect=False)
    role = discord.utils.get(ctx.guild.roles, name=c.forum_role_name)
    print("Aaaa")
    await channel.edit(overwrites=[role, overwrite]) # issue is here
    print("got here")
    await ctx.respond("done")```
#

i don't get an error

#

but the command dosen't work aswell

west vault
#

where tf is c definied
why tf don't you defer the command on such a long operation (channel get, role get, channel edit)

You should read the docs a bit more and see the examples in our repo.
That might help

dapper flare
west vault
#

sigh.. we're lazy huh?

dapper flare
#

oh alright lol

errant craneBOT
#

Here's the slash basic example.

west vault
cobalt tangle
#

It's a bot

#

Popular one

west vault
#

then they're probably self botting for that

cobalt tangle
#

No

west vault
#

yes, that's all info bots get from discord

cobalt tangle
#

It's an actual bot, which has shards and is very popular

west vault
#

yeah they still could make an seperate api call with a self bot to get the info

cobalt tangle
#

Oh

#

Is self bot even allowed

#

In discord

west vault
#

not at all

cobalt tangle
#

I would suspect then how tf Wick got into App Directory and got verified

#

Alr thanks for the info

west vault
#

they would've to get this data part and bots don't have access to that route

west vault
cobalt tangle
west vault
#

look into the prs/issues/changelog
idk

cobalt tangle
#

Degraded to 2.3.0 rn

cobalt tangle
severe storm
#

hey, how can i calculate how much time passed since there was a message in a channel?

west vault
#

I give you two hints:
1: Look into the docs of the util functions
2: The image

severe storm
#

update: there is

west vault
#

It’s a helper method :D

#

Actually I didn’t knew myselfdoggolul

cobalt tangle
#

Sometimes, devs don't look at changelogs

west vault
#

I’m just doing Management WeebBlush

cobalt tangle
west vault
#

I have my own lib to maintain. Can’t remember the whole pycord lib doggokek

cobalt tangle
#

lol

#

I ❤ dog

cobalt tangle
west vault
cobalt tangle
#

Nowadays searching things in the new docs is difficult tbh, if I search discord.Member, i have to scroll down for ages

cobalt tangle
west vault
#

Yeah. We know that and we’re trying to rework that. But it isn’t easy

cobalt tangle
#

Others are lovely

young bone
cobalt tangle
#

We r discussing in help channel

#

Lol

west vault
young bone
cobalt tangle
#

I no have nitro rip

west vault
cobalt tangle
#

Dogs better

young bone
#

no

west vault
#

sushiparrot sushi

cobalt tangle
#

I have too many images in my keyboard

west vault
#

That’s too much omegalul

cobalt tangle
#

Lol

west vault
#

Anyways

cobalt tangle
#

Members who don't have nitro :

west vault
#

L

cobalt tangle
#

Yeah let's either move to general or yeah

silent meadow
#

heyo

#

how do we get the avtar of a user?

young bone
silent meadow
#

i get an error

young bone
#

show the code where you want to use the avatar

silent meadow
#

one sec

#
i = await self.bot.application_info()
        member = i.owner
embed.set_thumbnail(url=member.avatar_url)`
young bone
#

avatar.url

silent meadow
#

it says

#

no attribute

#

so

young bone
silent meadow
glossy sand
#
            await ctx.respond(embed=my_embed, view=my_view, ephemeral=True)

doesn't send an ephemeral response but a normal one, why?

silent meadow
glossy sand
#

I though you only needed to pass ephemeral argument to ctx.respond()?

silent meadow
west vault
#

nope

#

that has nothing to do with it

silent meadow
#

oh

#

okayyy

#

i am just a learner lol

#

please dont mind me 😬

glossy sand
#

is okay

cobalt tangle
west vault
#

isn't it throwing any errors or something?
u sure that the code is correct?

Did you looked at the docs / examples

bcs i don't know it myself.
i just can say how it's handled at discords end

cobalt tangle
#

Oh wait

#

You have the intents enabled?

#

I'm pretty sure u don't and .owner is returning None

silent meadow
cobalt tangle
#

Ohhh

#

User doesn't have avatar

silent meadow
#

oh

west vault
cobalt tangle
west vault
#

maybe, but maybe not

silent meadow
#

thats not the part of code

cobalt tangle
#

That would've raised a whole new error

#

Lmfao

silent meadow
#

yeah

west vault
#

welp

cobalt tangle
#

Or ur getting a partial member

#

Just make sure .owner is a discord.Member type and user has an avatar

cobalt tangle
#

And if .owner isn't discord.Member or .User, make sure u have intents

silent meadow
#

and i have an avtar

cobalt tangle
#

Of .owner

silent meadow
#

i am checking if intents are on

west vault
cobalt tangle
#

Who knows

#

I'm a guy that is dumb

#

Maybe

#

I.owner gets a member so...? I'm not sure

silent meadow
#

all intents are on

#

and owner is user type

cobalt tangle
#

Hm

west vault
#

nyaw!eval ```cs
return Client.CurrentApplication.Owners.First().AvatarUrl;

silent meadow
#

mhmmmmmmm

cobalt tangle
#

member.avatar.url

#

It should work

west vault
#

it isn't a member

#

it's a user

#

they just named it member

cobalt tangle
#

He just named it that

west vault
cobalt tangle
silent meadow
cobalt tangle
#

That is no where close to py

west vault
silent meadow
errant craneBOT
#
Returns an :class:`Asset` for the avatar the user has.

If the user does not have a traditional avatar, ``None`` is returned.
If you want the avatar that a user has displayed, consider :attr:`display_avatar`.```
west vault
#

ah wait i see

#

owner is a discord.User object in pycord

cobalt tangle
#

Yes

west vault
#

but discord returns owner as a list of users

silent meadow
#

oof

#

my bot is in a team app

west vault
#

so basically, if you have a team, you can't get the single owner like that i think

silent meadow
#

but only i am the owner

cobalt tangle
#

He got a discord.User though

silent meadow
#

like only 1 guy in a team

cobalt tangle
#

@silent meadow does .id work

silent meadow
cobalt tangle
#

Try it

silent meadow
#

lemme tias

cobalt tangle
#

If so just fetch a user

west vault
#

if it doesn't work:

call discord.AppInfo.team
there the first discord.Team.members
and from that discord.TeamMember.avatar

that might work

silent meadow
#

imma just move it outta the team

cobalt tangle
#

Just see if the .id works

west vault
#

seems like pycord does something weird for owner

        self.owner: User = state.create_user(data["owner"])
cobalt tangle
#

My brain hurts a bit

errant craneBOT
#

discord/appinfo.py line 147

self.owner: User = state.create_user(data["owner"])```
silent meadow
cobalt tangle
#

Then fetch a user

errant craneBOT
#

discord/state.py lines 364 to 365

def create_user(self, data: UserPayload) -> User:
    return User(state=self, data=data)```
west vault
#

oh it worked?

#

lol

cobalt tangle
#

await bot.fetch_user(id)

silent meadow
#

it does not

west vault
#

o

cobalt tangle
#

man just switched the tables

silent meadow
#

ikr

west vault
#

its so weird

silent meadow
#

but it does not :(

cobalt tangle
#

I feel like this is a bug

silent meadow
cobalt tangle
#

@silent meadow are u sure the type is discord.User

silent meadow
#

yep

#

uk what imma rewrite the code once

#

just to mkae sure

cobalt tangle
#

R u gonna be the only owner

silent meadow
#

yessir

cobalt tangle
#

If so, just input ur freaking id and fetch it

#

await bot.fetch_user(urid)

silent meadow
#

okay wtaf

#

AttributeError: 'NoneType' object has no attribute 'url'

#

this is way to dumb

cobalt tangle
#

GOD

#

Is there a guild where u will never leave

silent meadow
#

yea

#

a lot of em

cobalt tangle
#

Do await guild.fetch_member(urid)

#

Make sure the bot is inside it

silent meadow
#

yea

#

one sec

west vault
errant craneBOT
#

DisCatSharp/Clients/BaseDiscordClient.cs lines 197 to 220

if (tapp.Team == null)
{
	app.Owners = new List<DiscordUser>(new[] { new DiscordUser(tapp.Owner) });
	app.Team = null;
	app.TeamName = null;
}
else
{
	app.Team = new DiscordTeam(tapp.Team);

	var members = tapp.Team.Members
		.Select(x => new DiscordTeamMember(x) { TeamId = app.Team.Id, TeamName = app.Team.Name, User = new DiscordUser(x.User) })
		.ToArray();

	var owners = members
		.Where(x => x.MembershipStatus == DiscordTeamMembershipStatus.Accepted)
		.Select(x => x.User)
		.ToArray();

	app.Owners = new List<DiscordUser>(owners);
	app.Team.Owner = owners.FirstOrDefault(x => x.Id == tapp.Team.OwnerId);
	app.Team.Members = new List<DiscordTeamMember>(members);
	app.TeamName = app.Team.Name;
}```
cobalt tangle
#

Please explain

#

That code means nothing to me

silent meadow
#

bruh.

#

bruhhhhhhhhhhhhhhh

young bone
silent meadow
#

imma die

#

i-

rare ice
#

c# in a python library server sippy

silent meadow
#

bro

cobalt tangle
#

Ykw just set ur ID in the bot

silent meadow
#

no

#

it worked

#

⚰️

west vault
#

1: working with a list or array of owners in any case
-> if we have no team detected (team = None), init new list of owners with just the raw owner
-> if we have a team, build the list of the owners from the team members object

cobalt tangle
#

Don't turn the tables again

young bone
silent meadow
cobalt tangle
#

Ok

west vault
west vault
#

seems like i brainfucked everyone here

#

nice

silent meadow
silent meadow
#

the language

young bone
west vault
#

bf is fun as lang

cobalt tangle
#

How about QBasic

silent meadow
silent meadow
#

lets go to #general. lets not get a ban

west vault
#

i'm the only one banning for that doggokek and i won't ban if i take part in this shit

cobalt tangle
#

Uhhh that's not possible to get a ban