#Basic Pycord Help

1 messages · Page 5 of 1

lofty parcel
#

Read the attributes and learn how you can get the guild and then the role

rugged lodgeBOT
#

Here's the slash autocomplete example.

lofty parcel
#

Then it's just returning names

cyan violet
#

bro i need an teamlist = [""]

#

but idk what i should write in tehre

lofty parcel
#

You get the role

#

The role has a members attribute which returns a list of member objects

#

You just need the names you you create a new list with them

#

And then it's just returning them

shell radish
deft kestrel
#

and what is aiosqlite for then?

shell radish
cyan violet
#

i'm here rn:

guild = client.get_guild(int(get_config("Guild_ID")))
teamliste = [get(guild.roles, id=1138953881460674560)]

@client.slash_command(guild_ids = servers, name="team-uprank", description="👤 Upranke ein Teammitglied.")
async def team_uprank(ctx, member: discord.AutocompleteContext):```
lofty parcel
#

Yeah thats not how it works

#

Read the example

#

Get the basics first

little cobalt
#

At the end you have to get creative for it ;3

cyan violet
#

idk how to get on

#

bro wtf

lofty parcel
#

Just do ctx.interaction.guild.get_role

cyan violet
#

bro

#

wait

lofty parcel
#

You're over complicating it

cyan violet
#

its above the command

lofty parcel
#

The autocomplete function goes outside the slash command

#

Read the example

cyan violet
#

what did i wrong??ß

lofty parcel
#

Everything

deft kestrel
#

anyone know what should I put after : ? --> </help:>

shell radish
#

the command ID

deft kestrel
shell radish
#

assuming ctx is discord.ApplicationContext and ctx.command is help, then it is ctx.command.id

deft kestrel
shell radish
#

.rtfm bot.walk_application_command

deft kestrel
#

thanks for the help

fickle salmon
#

I don't see why that would make a difference but I'm glad it worked for you

cursive leaf
#

How can I get my bot to show up in the Apps menu when you hold down a message?

heavy sky
#

You can use message context menu commands

sweet gale
#

discord.Option doesn't work with bridge commands?

little cobalt
rugged lodgeBOT
#

Here's the slash options example.

sweet gale
little cobalt
fleet cedar
#

?tag install

limber wagonBOT
#

1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y

2a. Install py-cord
python -m pip install py-cord

2b. Update py-cord
python pip install -U py-cord

Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.

Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord

fleet cedar
#

last line

#

its actually pretty stable rn

sweet gale
#

ohhk

#

so I won't have to use the example tht Zervy mentioned then?

little cobalt
#

there are many ways to do it

fleet cedar
sweet gale
fleet cedar
sweet gale
#

lol, I was thinking the same

#

will on_command get triggered for bridge commands?

#

like even when user uses slash command nd even when he/she uses the prefix cmd

lofty parcel
#

.tias

sly karmaBOT
fleet cedar
#

it wont for slash version of bridge

#

master branch has on_bridge_command

#

it will trigger for both versions

#

master branch does have a few nice changes

sweet gale
#

more like a wavelink question, so I am pinging you @fleet cedar
Why the song doesn't start playing even after being added to queue? I did vc.autoplay = True tho

Code:- https://paste.zorino.in/xutaninelipabece.py

Ignore the command's name being command :)

fleet cedar
sweet gale
fleet cedar
sweet gale
lofty parcel
#

Asyncio queue is just .put()

fleet cedar
lofty parcel
#

Or that

fleet cedar
sweet gale
#

ohk, lemme try tht

lofty parcel
#

Well yeah makes no sense if you don't want a limit

fleet cedar
#

are your errors being boggled up?

#

.tag noerror

sly karmaBOT
#

Not getting an error, but definitely should be?

Do you also have an on_command_error set up?
Please make sure to look at, and implement,** the 3 or so lines starting with 'else'** in the example below. Without this code or similar, your error handler is eating all unhandled errors. As you can imagine, this is bad when you get an unexpected error.
https://gist.github.com/EvieePy/7822af90858ef65012ea500bcecf1612

Do you also use asyncio.run and/or bot.start?
Please make sure logging is setup correctly.
https://docs.pycord.dev/en/stable/logging.html

sweet gale
# fleet cedar then `vc.queue.put_nowait(track)` (without awaiting)
Ignoring exception in command command:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 178, in wrapped
    ret = await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Administrator\Documents\GitHub\Krishna\test.py", line 171, in command
    vc.queue.put_nowait(i)
    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'Queue' object has no attribute 'put_nowait'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\bot.py", line 347, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 950, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 187, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Queue' object has no attribute 'put_nowait'
#

;-;

sweet gale
#

put_nowait is not a valid attribute smh

fleet cedar
sweet gale
#

I sent u the code ;-;

fleet cedar
#

uh

#

oh does it have a built in queue?

#

sorry didnt know

#

you might need to refer wavelink docs yk

sweet gale
fleet cedar
#

🤔

strong rain
#

Is there anyway to get twitch details such as their username listed in their profile connections?

#

Other than while they are streaming

jade oxide
#

Is there a way where i can see what functions does a library offer with the meaning of them?

shell radish
kind olive
#

is pycord on pacman

shell radish
kind olive
#

getting this when remotely installing py-cord

lofty parcel
#

pipx install py-cord

kind olive
#

the server is linux btw

drifting turtle
#

if you are out of the loop, most distros made the default python3-pip package unable to install python packages system wide

drifting turtle
main latch
#
@bot.bridge_command(description="send user message")
async def say(ctx: discord.ApplicationContext, *, message: str = Option(description="your message", required=True)):
    await ctx.defer(ephemeral=True)
    if not ctx.author.guild_permissions.administrator and ctx.author.id != bot.owner_id:
        embed = discord.Embed(title="Error", description='You do not have permission to use this command.', color=discord.Color.red())
        await ctx.respond(embed=embed, ephemeral=True, delete_after=5)
        return
    await ctx.send(message)
    await ctx.message.delete()

When I don't set a value for the message, the bot sends this
<discord.commands.Option name=message>

fleet cedar
#

In a function parameter,
smth: Option is a typehint
smth = Option is a default value

#

Notice the difference

rugged lodgeBOT
#

Here's the slash options example.

fleet cedar
#

Check that out

edgy nest
main latch
fleet cedar
#

Vincent was thinking about it for V3 but I'm not sure what he settled on

tawdry falcon
#

why when i pick a gif in attachment (slash command) it is just stuck on sending command and then it says application did not respond? and then i cant chat for some reason.. i have to reload discord

in my command, png's work perfectly

fleet cedar
#

Seems like a discord issue

tawdry falcon
#

I KNEW THAT

#

DISCORD FAULT

sweet gale
#

discord has been buggy somewhat since last few days for me

#

infact if I am in a vc and a bot pings me, my discord client restarts automatically

#

idk whytf tht happens but it is what it is, re-installing too didn't fix it

#

anyways, I had a question (not help or py-cord related), can I somehow get a PDF or a few PDFs of pycord's documentation? 😅

opal hamlet
#

how can i conditionally add a SelectOption to a View class? i got a slash command with two select menus for adding/removing entries(an aboutme) but i don't want to have something thats already in there to appear in the add selection

#

i have tried a few things but i cant get it working

    @discord.ui.select(select_type=discord.ComponentType.string_select, placeholder='Add a Field', custom_id='add')
    async def addcallback(self, select, interaction):
        gid = interaction.guild.id
        mid = interaction.user.id
        fields, values, aboutme = Social.load_aboutme(self, gid, mid)
        vals = select.values
        file_path = os.path.join('data', 'guilds', f'{gid}', 'members', f'{mid}', 'aboutme.txt')
        if not 'Name' in fields:
            self.add_option(label='Name')
        if not 'Age' in fields:
            self.add_option(label='Age')
        if not 'Country' in fields:
            self.add_option(label='Country')
        if not 'Hobbies' in fields:
            self.add_option(label='Hobbies')
        with open(file_path, 'r') as f:
            lines = f.readlines()
        for val in vals:
            if val not in fields:
                lines.append('\n'+val+': ')
        with open(file_path, 'w') as f:
            f.writelines(lines)```
fleet cedar
#

clone the repo, navigate to the docs folder

#

it might be sphinc-builder -b latex . ./some_folder

#

followed by make latex

#

not sure

grim estuary
#

Hello. When bot creating a new channel, it copies the category rights. How can I disable this?

lofty parcel
#

Pass your custom permissions?

#

.rtfm guild.create_channel

sly karmaBOT
#

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

lofty parcel
grim estuary
tawny ether
#

is it possible to change permission of a discord bot without readding it?

little cobalt
tawny ether
ancient cosmos
#

Where can I find more information about how and when Pycord caches stuff? I know what the cache is, but I don't know which actions update the cache as a side effect, and I don't know what I can do to update the cache manually if I have a need to do that.

Basically, I know that the answer to "why doesn't Guild.get_member find this member that I know is in the guild?" is "because that member isn't cached", but I don't know what I can do to get the member cached for future use.

deft kestrel
#

what happens if 2 save processes run at the same time in sqlite?

little cobalt
ancient cosmos
maiden bloom
#

Does discord.Guild.premium_subscriber_role return a discord.Role object?

lofty parcel
#

.rtfm premium_subscriber_role

sly karmaBOT
lofty parcel
#

It does.

maiden bloom
#

I found it in the docs it just doesn't say what type of object it returns so I wanted to confirm

#

Because my poor self doesn't have any boosted servers to test lol

little cobalt
kind olive
#

how do i make a slash command have options?

#

im very confused from reading the docs

lofty parcel
#

Giving it parameters

rugged lodgeBOT
#

Here's the slash options example.

round heart
#

So uh, why do some Views have a self.message and others don't? I'm looking at some of my existing code, which uses self.message just fine. But in this new View I'm working with, it's None what1

shell radish
#

##1572 ##1600 ##1997

round heart
#

Okay, looks like they were fixed after the last release. Thanks

atomic fern
#
class ItemSelector(discord.ui.View):
    def read_data(self):
        with open("mylist.json" "r") as file:
            data = json.load(file)
        return data
        
    def __init__(self, dict_key):
        self.items = self.read_data()[dict_key]
        super().__init__(timeout=60.0)

    @discord.ui.select(
        placeholder="Select Items",
        max_values=1,
        options=[SelectOption(label=i) for i in self.items
    ])
    options=[SelectOption(label=i) for i in self.items
NameError: name 'self' is not defined

is it not possible to create menus using list comprehension for clean code?

drifting turtle
#

and also your select deco is out of scope

#

thus you can't access self

drifting turtle
#

?tag ?tag json is not a db

limber wagonBOT
#

dynoError No tag ?tag found.

drifting turtle
#

?tag json is not a db

limber wagonBOT
#

Why JSON is unsuitable as a data storage medium.

  1. JSON, quite simply, is not a database. It's not designed to be a data storage format, rather a way of transmitting data over a network. It's also often used as a way of doing configuration files for programs.

  2. There is no redundancy built in to JSON. JSON is just a format, and Python has libraries for it like json and ujson that let you load and dump it, sometimes to files, but that's all it does, write data to a file. There is no sort of DBMS (Database Management System), which means no sort of sophistication in how the data is stored, or built in ways to keep it safe and backed up, there's no built in encryption either - bear in mind in larger applications encryption may be necessary for GDPR/relevant data protection regulations compliance.

  3. JSON, unlike relational databases, has no way to store relational data, which is a very commonly needed way of storing data. Relational data, as the name may suggest, is data that relates to other data. For example if you have a table of users and a table of servers, the server table will probably have an owner field, where you'd reference a user from the users table. [This is only relevant for relational data]

  4. JSON is primarily a KV (key-value) format, for example {"a":"b"} where a is the key and b is the value, but what if you want to search not by that key but by a sub-key? Well, instead of being able to quickly use var[key], which in a Python dictionary has a constant return time (for more info look up hash tables), you now have to iterate through every object in the dictionary and compare to find what you're looking for. Most relational database systems, like MySQL, MariaDB, and PostgreSQL have ways of indexing secondary fields apart from the primary key so that you can easily search by multiple attributes.

For more info and resources about storing persistent data, please check out https://vcokltfre.dev/tips/storage/

atomic fern
#

I don't really understand what "persistent" is but i don't use json for db

drifting turtle
#

it's recommended to use a db such as Sqlite or postgres instead

halcyon zinc
#

hey guys I want to make a discord dashboard but I don't know which way should I follow or what should I need to learn? (if I made a mistake while writing sorry for that I'm not native english speaker)

drifting turtle
halcyon zinc
#

not for users

drifting turtle
#

i outlined the concept on how you can approach it, not whether admins are able to use it

#

if you want it for admins, then it's up to you to integrate that feature

halcyon zinc
#

how can i integrate?

#

what should i learn for this?

drifting turtle
halcyon zinc
#

I searched to many resource but i didn't find any resource

drifting turtle
#

to illustrate my point:

The web app way

bot <--ipc--> web server <- web client

Using an JS framework:

bot <--ipc--> rest api <-- http client (axios) <-- user
edgy nest
#

if you can make a website all id worry about is ipc

drifting turtle
#

fyi there are no good ipc libs for pycord so the ipc approach is basically screwed. ghoul's lib is just a fork of discord-ext-ipc (which has been archived so don't bother thinking of using it) and literally does nothing but switch the namespaces

edgy nest
#

i personally use redis pubsub channels for ipc

#

it works really well

drifting turtle
#

zeromq is kinda my choice when it comes to ipc

halcyon zinc
#

thanks guys

edgy nest
#

don't need to worry about causing problems by reconnecting or anything

fleet cedar
#

Might need to install without any deps

drifting turtle
#

better-ipc requires some tinkering to get working for pycord

fleet cedar
#

Oh 👀

tepid coyote
#

how do you send multiple views at once?

lofty parcel
little cobalt
lofty parcel
#

But you can only send 1 view

#

And a view contains up to 25 items (if Buttons only)

tepid coyote
lofty parcel
#

Then subclass the view

#

Or add both items to the same view manually

tepid coyote
#

thank you :)

cerulean sable
#

It's not adviced to put the .sync_commands() function on an on_ready event, right? And that I should just put plain on my main.py file?

little cobalt
cerulean sable
lapis dock
#

It is run automatically

cerulean sable
lapis dock
# cerulean sable I'm using cogs, so it's different.

It shouldn't be. If you load the cogs with load_extension (you should if you are not) you still do not need to use sync_commands.

The 2 reasons you would, is to add, edit, or remove a command without restarting the bot or if you override on_connect

cerulean sable
lapis dock
#

Ok then yes you are correct due to the fact that you are removing and adding commands while the bot is online. You would only need to call sync commands in your
/load_cog (and remove_cog) commands.

cerulean sable
#

yeah

lean jacinth
#

Mhmmm why does a view can make await ctx.send doesnt sended?

#

No errors were shown

lean jacinth
#

Fixed

mellow shell
#
Traceback (most recent call last):
  File "D:\Programming Stuff\Discord Stuff\Vistara Project\Vistara\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "D:\Programming Stuff\Discord Stuff\Vistara Project\Vistara\cogs\events\autmod_ev.py", line 42, in on_message
    await message.attachments[0].delete```

can any body help me out with this
hybrid fossil
#

Hi there!
I have a question, since the discord update, is there a way to retrieve the player's displayed name?

My profile has the name "teddou." and it's displayed as "TED."

Why does display_name, name all give me "teddou."?

Isn't Py-cord up to date yet?

heavy sky
#

And:

#

?tag pomelo

limber wagonBOT
#

Before Pomelo-

member.name          -> username
member.nick          -> guild nick name
member.display_name  -> member.nick OR member.name

After Pomelo-

member.name          -> username
member.global_name   -> global display name (global nick name)
member.nick          -> guild nick name
member.display_name  -> member.nick OR member.global_name OR member.name
heavy sky
#

The pomelo changes have only been applied to the master branch so far, no release for it has been made yet.

hybrid fossil
fleet cedar
#

#library-updates tho

hybrid fossil
# fleet cedar <#881224941809332274> tho

If I want to install this on my linux server on which the "requirements.txt" file is used to install py-cord, how do I go about it? I doubt the link can be used.

fleet cedar
#

?tag install

limber wagonBOT
#

1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y

2a. Install py-cord
python -m pip install py-cord

2b. Update py-cord
python pip install -U py-cord

Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.

Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord

fleet cedar
#
- py-cord
+ git+https://github.com/Pycord-Development/pycord
hybrid fossil
#

Thanks, I'll give it a try soon!

crystal violet
#

Hello there 🙂 Someone has an idea why slash commands of my bot are not showing on some servers? The bot has all permissions he needs and on most servers it works. Also other bots do not have the same problems. The roles the other bots have on the server are exactly the same as the roles of my bot. Any suggestions? 🙂 Using Bridgecommands instead of slash commands btw

heavy sky
#

Are you sure that the bot has the application.commands scope in all servers?

heavy sky
#

And that the commands are global and not are for certain guilds only?

lapis dock
#

.tag slashnoshow

sly karmaBOT
#

Application Commands Not Showing Up?

  • Uninstall libraries that conflict with the discord namespace (e.g. discord.py).
  • Invite your bot with the application.commands scope.
  • Load cogs before bot.run() (e.g. not in on_ready).
  • Do not override on_connect.
  • Update to the newest version of py-cord (see ?tag install).
  • Turn off User Settings > Accessibility > Chat Input > Use legacy chat input.
  • Share your code and errors.
grizzled imp
#

how do i add an emoji to a bot's custom activity?

wispy kite
#

Can I make a slash command that one can only use on themselves, unless they are an administrator, in which case they can use it on anyone? If so, how?

grim estuary
#

Hello! How can I check if a member is a bot?

lofty parcel
sly karmaBOT
lofty parcel
grim estuary
crystal violet
#

?tag install

limber wagonBOT
#

1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y

2a. Install py-cord
python -m pip install py-cord

2b. Update py-cord
python pip install -U py-cord

Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.

Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord

slow dock
#

Hi )
When I call my command, I see the following output (screenshot). But the bot worked correctly. The "Application not responding" message is unexpected.

fleet cedar
slow dock
fleet cedar
#

np

round heart
#

master has the interaction.edit shortcut, but what if I'm editing the original message from inside a Modal callback and need to (I'm passing in the parent view as self._view (which may be obsolete now?)) -- What's the most pycord-ish way to edit the original message while passing in the new View state?

cursive swallow
#

I recently had to do the same thing

summer scroll
#

Hi guys, do you have an Idea of how I can put on owner_ids all of the pepoles that have a certain role, and above pls?

cursive swallow
cursive swallow
round heart
#

e.g

class MyModal(discord.ui.Modal):
  def __init__(self, *args, view: MyView):
    self._view = view

  ...
  async def callback(self, interaction: Interaction):
    do_stuff_that_changes_the_view()
    original_embed = self._view.message.embeds[0]
    original_embed.fields[0].value = 'Dorukyum is cool'

    await interaction.edit(embeds=self._view.message.embeds, view=self._view)

Is this still the best way to accomplish? Or am I overcomplicating?

summer scroll
round heart
cursive swallow
cursive swallow
#

(member.top_role.position)

#

Check if it's higher than the bottom role you're looking for

round heart
cursive swallow
#

Yep, I would like the view to be removed from cache after it's been removed from a message

#

idk maybe I'll look into it when I have some time

#

or if bob returned and started acting like an actual maintainer he could do it...

round heart
#

Can you return error messages in a Modal when submitting? Like you click Submit, it does some verification, and without closing the Modal shows an error right in the Modal UI similar to the "Something went wrong" text (Don't see anything in the Discord docs, but was worth asking)

fleet cedar
#

you send a response and a button to send another modal

#

if you want

round heart
#

Sadly not helpful from a user standpoint but I gotcha. Currently building a second embed to show any error messages. The View is fairly complex

#

Appreciate the confirmation

fleet cedar
round heart
# fleet cedar you can do `interaction.message.edit` ?

Well I also need access to the View, because various UI state (name, enabled/disabled, selections, etc) may have changed in response to the callback. And this may also come from a helper method, so I don't want to mark it as responded yet.

fleet cedar
#

hmm

deep blaze
#
        await self.change_presence(
            activity=discord.CustomActivity(
                name="bot",
                emoji="🤖",
            )
        )

why is this not working ( no error )

fleet cedar
deep blaze
fleet cedar
#

latest commit?

deep blaze
#

wait i am updating to latest commit

#

done now working

fleet cedar
#

can you show a pic of how it looks 👀

#

i wanted to know lol

round heart
#

Oh that's cool that CustomActivity has an emoji; didn't even see that. I'm guessing that can't be a custom emoji(?)

fleet cedar
#

as it can be a PartialEmoji

fleet cedar
round heart
#

So here's a fun one.
I'm passing my view into Modals.
From a callback,interaction.message and self._view.message do not refer to the same object.

round heart
#

Moved that question to #discussion

stable jackal
#

Hi, is there a way to move a Slash Command Group into another file and use it in a cog to make a sub group? I have tried making it a variable in it's own file and importing it, but the command just doesn't show up on discord, but loads fine.

I basically want to use the Slash Command Group for multiple sub groups, that aren't in the same file.

class Example(commands.Cog):
    def __init__(self, bot_: discord.Bot):
        self.bot = bot_

    # Move this line to a seperate file
    greetings = SlashCommandGroup("greetings", "Various greeting from cogs!")

    international_greetings = greetings.create_subgroup(
        "international", "International greetings"
    )

    @international_greetings.command()
    async def aloha(self, ctx: discord.ApplicationContext):
        await ctx.respond("Aloha, a Hawaiian greeting")
little cobalt
#

1 sec.

#

@fleet cedar Do you know what the name was again for it? xd

stable jackal
#

lmao

little cobalt
stable jackal
tepid coyote
#

Any ideas for temporary storage(e.g. start time) for a timing system.

dusky ermine
tepid coyote
dusky ermine
#

Are you just trying to store when the bot starts up or it smthn else you're trying to store?

tepid coyote
# dusky ermine Are you just trying to store when the bot starts up or it smthn else you're tryi...

Got asked about it a few days ago. I’m still trying to get my head around it.
It’s an arma server and they want to record play time when they organise events
Scenario:
They group up> organiser runs X command <start> -> they play -> X <stop> works out the duration and updates a db with new play time for the month. But there may be multiple sessions starting and ending at different times so there may be overlap

#

That was my understanding of it

dusky ermine
#

Oh yeah then I'd recommend storing it in the database if you need the data to persist after the bot restarts

#

And that way you'll be able to handle multiple timers easily

#

You can probs just store the user id of who started the timer as well as the start and end timestamps

lofty parcel
#

if you dont want a db, just use a dict

tepid coyote
tepid coyote
lofty parcel
#

a db is always better

dusky ermine
#

Yeah

#

You could use sqlite for a simple db

little cobalt
shell radish
little cobalt
#

k

unkempt cipher
#

L

fickle salmon
#

M

edgy nest
#

that's an airline

unkempt cipher
#

Lmfao

atomic fern
#

is it possible respond to a select menu callback using send_modal?

valid panther
#

@fleet cedar Do you know if it is possible to join the paginator with a Dropdown?

slow dock
#

Hi, where can I find list of functions to override for event tracking? Such as on_member_join)

fleet cedar
#

You can pass a view to the custom view parameter

valid panther
fleet cedar
#

Smth like that

rugged lodgeBOT
#

Here's the paginator example.

fleet cedar
#

I think that covers this

#

Line 214

valid panther
#

more easy

#

hahaha doopyOK

cursive leaf
#

How do giveaway bots verify you've sent enough messages to enter? Is that literally by saving a record of every message sent by anyone in the server and then using COUNT()?

heavy sky
cursive leaf
fleet cedar
#

what ive tried is, save people's message counts after they have tried to enter once

#

this cuts down on a lot of needless data

#

but it becomes impractical at some cases

#

or actually no

cursive leaf
#

I mean giveawayboat must have terabytes of this stuff

fleet cedar
#

not the message itself

cursive leaf
#

Then how can you do the messages in the past 24 hours

fleet cedar
#

smth like

user1  5
user2  69
user3  420
cursive leaf
#

You can't timestamp them that way, or do you just have a decay of 5% of their messages each hour

fleet cedar
#

i dont really decay

#

i store the counts per-gaw

#

so the total messages after a gaw are counted

cursive leaf
#

per giveaway?

fleet cedar
#

yes

cursive leaf
#

Oh so they need X messages by the end to have a chance of being picked

fleet cedar
#

mhm

#

isnt that what you are doing too?

cursive leaf
#

I wonder how giveawayboat does it

cursive leaf
#

Giveawayboat checks when they join how many they've sent in the past 24 hours

#

I mean it must just be by saving messages, their database must be crazy

fleet cedar
#

huh damn

#

yea that might need a giant db

#

💀

grizzled loom
cursive leaf
#

What stochastics

#

For decay?

grizzled loom
# cursive leaf For decay?

i meant like:

user a made 10 messages. user b made 20
randint between 1 and 30. 1-10 a wins... expand as needed.

so no need to store massive amounts of data, a user id + an int will do.

cursive leaf
#

oh that's what you meant, I hadn't intended it to work like that but it's a cool idea

grizzled loom
#

why store more than that? 😄

grizzled loom
#

what was your plan/idea?

cursive leaf
#

nothing insane, was just user needs X number of messages in the past Y time to enter the giveaway

grizzled loom
#

Ahh a treshold for entry and equal chances for all that make it.

#

doesnt sound bad either! My way would encourage spam cause of the higher win chance

#

at least if participants are aware how it works

#

how can I check whether or not paginator is allowed to edit its own embed collection in the channel he wants to do so(the channel the slash command was used in)?

#

PS: Please ping me or use the respond function when you answer.

fickle salmon
#

Could partition it by day or something

deft kestrel
#

anyone know how to run lavalink.jar with bot.py in the same time? i mean, can i add in bot.py script that will run with it lavalink.jar? i hate to keep running it separately in cmd. I mean, i know it must be run in cmd, but i want to do it automatically when i run bot.py

deft kestrel
little cobalt
#

why lavalink.jar?

deft kestrel
#

because i want to use wavelink music

#

i need to have running lavalink to use wavelink

#

wavelink repo

#

without lavalink.jar i cant use wavelink youtube music

little cobalt
#

well, youtube music is against the TOS?

#

if you still gonna do it

#

Im not sure if this is working

deft kestrel
#

i think its not

#

even pycord have guides for this

#

without any warning

#

lavalink is not yt-dlp

#

yt-dlp is againt tos 100%

#

but lavalink i dont think

deft kestrel
#

i know how to make music bot

#

but i dont know how to run cmd lavalink.jar in python file

little cobalt
#

Jetzt kommt Lala x3

deft kestrel
#

what

unkempt cipher
#

everything involving music is grayzone or possible even against any existing tos.
lavalink would fall under tos as well bcs it straight up plays from youtube anyways.

deft kestrel
#

even really popular

unkempt cipher
#

because no one cares until someone makes money through it, see rythm or similar big bots

little cobalt
#

And they are not really using YT anymore

#

They use Spotify and other

#

But still against the TOS

unkempt cipher
#

ye

deft kestrel
#

oh

#

okay

#

but still

deft kestrel
unkempt cipher
deft kestrel
#

not hosting it on my own server?

#

is it even safe?

unkempt cipher
#

thats not what i'm saying facepalm

lofty parcel
#

Or use docker and make the file starts the processes

deft kestrel
#

for me

lofty parcel
#

Wdym too hard. You just gotta add the file and let docker do its things

deft kestrel
dusky ermine
#

How do I check if a member has a certain permission (ex: manage_channels) using their permissions integer (ex: 2147483647)?

#

Can I just check if the integer is greater than the value of the manage_channels permission?

shell radish
dusky ermine
#

I was hoping I could just write the code to do it myself after knowing how to deconstruct the integer

shell radish
#

basically bitshifts

dusky ermine
#

Yeah but how do I undo the bitshift

#

The docs just say what the individual bitshifts for the permissions are

#

I searched it up and it says their lossy so idk how I would go about doing it then

shell radish
#

check the pycord source code

dusky ermine
frail ocean
#

Is there a way to display, for example in an embed, how much RAM the bot uses or, even better, how much RAM is used per shard?

shell radish
frail ocean
shell radish
#

iirc no

elfin quarry
#

guys any idea why the modal shows an error although the value is sent in the channel?

elfin quarry
shell radish
#

send the related code

elfin quarry
#
import discord
from discord.ext import commands

class Echo(discord.ui.Modal):
    def __init__(self):
        super().__init__(
            title="What do you want to echo?",
            timeout=5 * 60,  # 5 minutes
        )


        self.description = discord.ui.InputText(
            label="Enter Your Text Here",
            style=discord.InputTextStyle.paragraph,
            placeholder="enter your message here",
            required=True,
            max_length=4000,
        )
        self.add_item(self.description)

    async def callback(self, interaction: discord.Interaction) -> None:
        response = self.description.value
    
        channel_id = interaction.channel_id
        channel = interaction.guild.get_channel(channel_id)
        await channel.send(response)

class EchoCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @discord.slash_command(name="echo",description="Echoes this message")
    async def send(self, interaction: discord.Interaction):
        modal = Echo()
        await interaction.response.send_modal(modal)

def setup(bot):
    bot.add_cog(EchoCog(bot))```
shell radish
#
    async def callback(self, interaction: discord.Interaction) -> None:
        response = self.description.value
    
-       channel_id = interaction.channel_id
-       channel = interaction.guild.get_channel(channel_id)
-       await channel.send(response)

+       await interaction.response.send_message(response)
fickle salmon
#

Mobile syntax highlights py but not diff?

unkempt cipher
#

mobile syntax highlight is very limited

shell radish
fickle salmon
#

I feel like diff would be easier to implement than py...

#

But what do I know

shell radish
unkempt cipher
#

proly never merged into code base

hollow venture
#

when I input a large input in my slash command it says "input a valid integer" is there any way for me to specify a larger bit integer as an input?

unkempt cipher
#

string and parse it yourself

hollow venture
#

that was the solution I was thinking of, but it was kinda janky so I just wanted to double check

#

thanks!

fiery stratus
#

how long does it take for an ephemeral message to disappear automatically

#

also is it possible to make an ephemeral message never disappear automatically?

unkempt cipher
#

30 mins or so
and no, that's not the reason ephemeral messages exists for

fiery stratus
#

it'd be cool if discord allowed us to send a message in a channel visible to a single client without having to send them a DM

unkempt cipher
#

no

#

that will never happen

#

use dms for that :p

#

stop reposting your question

#

and u don't answer here

upper drift
#

bruh

unkempt cipher
#

-to @upper drift 5m don't bruh me

lofty vaultBOT
#

⏱ Timed out saq1b for 5 minutes

unkempt cipher
#

maybe u are smug

fiery stratus
#

are changes to UI components client sided? like if I have a button whose callback changes the color of the button from green to red, does that replicate to everyone or just that specific user?

unkempt cipher
#

wanna be the next huh?

red mist
#

💀

echo wraith
#

for an element of bot.commands is it possible to get its subcommands (and sub subcommands) if present?

deft kestrel
#

Anyone know how to do this?

heavy sky
echo wraith
sly karmaBOT
#

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

hollow venture
#

what is the differance between the discord app_commands extention and the slash_command one

#

cause I've been using @app_command but I see a lot of documentation here that uses @slash_command

lapis dock
lapis dock
hollow venture
#

the difference I see is that @slash_commands use ctx and @app_commands use interactions?

lapis dock
#

Hmm, If that is the case I recommend use @slash_command for slash commands. discord.ApplicationContext is better to work with than discord.Interaction

#

I would have to see your command decoratoer plus function definition to understand more

deft kestrel
#

what is the difference between
intents = discord.Intents.all() and intents = discord.Intents().all()

#

i was using intents = discord.Intents().all()

#

but in pycord examples is intents = discord.Intents.all()

hollow venture
hollow venture
ancient cosmos
#

Is the discussion here about dynamic command options (#discussion message) and close reason given here ("Discord doesn't want you to do this; use autocomplete instead") still valid/up-to-date? (It's been two years, so I wanted to double-check.)

fleet cedar
#

That's a different library

#

This is py-cord

#

And application commands is the biggest difference between the two

hollow venture
#

turns out I must be running some sort of weird hyrid then

#

hybrid*

#

cause I have uninstalled discord.py on my local machine

little cobalt
limber wagonBOT
#

1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y

2a. Install py-cord
python -m pip install py-cord

2b. Update py-cord
python pip install -U py-cord

Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.

Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord

hollow venture
little cobalt
#

than you cannot do it

hollow venture
#

so I didn't notice anything

#

I mean... I can port the commands

hollow venture
hollow venture
#

intents = discord.Intents.all()

torpid ivy
#

Whats the recommended way to have server-specific settings (like for my game)? Like if individual servers want to adjust the round length, rules, permissions, etc. maybe just dump it all in some database?

lofty parcel
#

Yes

#

There's literally no other way for you to persist settings

lapis dock
lapis dock
hollow venture
#

that doesn't sound too bad.

lapis dock
hollow venture
#

I checked, the server runs dpy

#

it has pycord installed by dpy overrides it

lapis dock
hollow venture
#

cool cool

lapis dock
#

(specifically things before d.py 1.7.3)

slender surge
#

how can i check if, for example, both user1 and user2 have both clicked to a button?

lofty parcel
#

Use a variable with True or false?..

hollow venture
torpid ivy
opal hamlet
#

hey guys how exactly does discord.CustomActivity work? i cant get it to do anything

torpid ivy
#

and per-game settings wouldn't work, there's too many

lofty parcel
#

Use an actual database.

#

Json files are not dbs.

opal hamlet
#

sweats nervously in .txt

torpid ivy
#

i could probably just repurpose tinydb since I already use that in my bot currently

#

right now it's dictionaries of dictionaries. which are pretty, but not editable without actually editing the code

#

i like dictionaries

opal hamlet
#

dictionaries of dictionaries... do... do i want to see that?

shell radish
torpid ivy
#

hey dictionaries are pretty! though this isn't my bot, just another example of my dictionary abuse

shell radish
#

enums exist for this exact purpose

fickle salmon
torpid ivy
#

my score db gets treated a a dictionary of dictionaries! sort of
score["serverid"]["userid"]["total_accuracy"]

opal hamlet
#

hmhm aslong as i don't have to show what the fuck i am using to store user/server data

torpid ivy
#

but its actually a db file

opal hamlet
#

what would yall recommend for a complete db noob?

#

because there are things i HAVE to rewrite anyways, so why not do it (more) properly this time

fickle salmon
#

sqlite or mariadb

brittle herald
#

Anyone else know why I cannot use the {ctx.author.avatar.url} bit in the embed.thumbnail.url

fickle salmon
#

I like sqlalchemy

brittle herald
#
    embed.thumbnail.height = 128
    embed.thumbnail.width = 128```
#

omg 1 sec

fleet cedar
#

you cant really specify the height and width. discord determines it on its own

opal hamlet
#

may be a weird question, but when a user wants to sends a message above the char limit, it can be converted to a .txt but what if a bots message exceeds the limit? what would be the best way to display/send larger heaps of text as message or rather non-file

shell radish
opal hamlet
#

so its just that, makes sense

shell radish
#

If you want to send more text, try using embeds

opal hamlet
#

do embeds have infinite limit or what? or just a higher one?

shell radish
opal hamlet
#

whats the max number of fields an embed can have?

shell radish
#

Either it’s like 10. 15. or 25

#

but yeah probably more than enough

opal hamlet
#

tbf i'm unlikely to hit the cap anyways since the bot barely gets used by the server members but O.o

#

currently using google sheets but god that code is a mess

shell radish
#

💀

lofty parcel
opal hamlet
#

god, should i try to salvage parts of my funcs, completely scrap the bot and start anew, or rewrite them one by one?

#

so many hard coded things...

torpid ivy
#

hmm yeah, I have to figure out the char limit thing for my bot too lol

#

It does a round-end scorecard to show everyone's guesses, score earned, etc. But it's about to get a test of probably a few hundred users

#

so im gonna have to figure out some way to condense or only show X number

fickle salmon
#

Paginator!

lapis dock
lofty parcel
#

Don't think so

fleet cedar
daring grove
#

how would i get someones display name rather than username?

#

like my display name is 'wallie' but my username is 'sdttr'

#

member = discord.Member
print(member.___)

daring valve
#

?tag pomelo

limber wagonBOT
#

Before Pomelo-

member.name          -> username
member.nick          -> guild nick name
member.display_name  -> member.nick OR member.name

After Pomelo-

member.name          -> username
member.global_name   -> global display name (global nick name)
member.nick          -> guild nick name
member.display_name  -> member.nick OR member.global_name OR member.name
little cobalt
daring valve
#

¯_(ツ)_/¯

little cobalt
#

@daring grove you also have to install the master branch

little cobalt
#

?tag install

limber wagonBOT
#

1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y

2a. Install py-cord
python -m pip install py-cord

2b. Update py-cord
python pip install -U py-cord

Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.

Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord

little cobalt
#

the last line ^

daring grove
#

oh

#

sure

daring grove
little cobalt
daring grove
#

yeah but what is global display name

#

what would it display in my case

daring grove
#

what 'global display name' is

little cobalt
#

you also could create a command with all of them and see which one is the right one ;3

little cobalt
#

yea

drifting turtle
#

With asyncpg

ancient cosmos
#

SQLite because you don't have to also think about setting up and running the DB server while you're still learning other DB stuff

wind radish
#

“Scalable” mongodb users vs chad SQLite users

#

Who needs to scale

pseudo osprey
#

SQLite is a chad move

red mist
#

SQLite.

ancient cosmos
#

I mean like, as soon as your bot outgrows "bare bones hobby project" status, absolutely get onto something more solid and full-featured than SQLite (I'm a huge Postgres fan as well), but given that the question was for a DB noob, I really don't think you can beat SQLite at all in terms of "amount of stuff you don't need to learn before you're up and running"

torpid ivy
#

is there any way to catch/ignore these errors without wrapping every respond in a try/catch?

#

every once in a while it'll just randomly throw that and it'll lock the game up until i restart the bot

#

it's uncommon

shell radish
#

.rtfm on_application_command_error

daring grove
#

why am i still getting this error?

#

pip install -U git+https://github.com/Pycord-Development/pycord

#

I did this

torpid ivy
shell radish
daring grove
torpid ivy
#

i sorta see how using that would work, but the reaction would greatly depend on what /command failed

daring grove
#

py-cord is already installed

#

I already have one pycord thing running on it

#

just global_name doesnt work

shell radish
#

do you have a requirements.txt, docker, nixpacks, or similar?

daring grove
#

I dont really need a requirements.txt

#

this is all it uses

torpid ivy
shell radish
ancient cosmos
daring grove
shell radish
#

what type of server do you have?

torpid ivy
daring grove
ancient cosmos
#

Here's an example I've got:

import logging
logging.basicConfig(level=logging.INFO)
fcy_logger = logging.getLogger("full_course_yellow")
pycord_logger = logging.getLogger("discord")

class FCYBot(discord.Bot):
    ...
    async def on_application_command_error(
        self,
        context: discord.ApplicationContext,
        exception: commands.CommandError, # pylint: disable = unused-argument
    ) -> None:
        """This listener implements custom error handling for exceptions raised during the invocation
        of a Command. The primary goal is to clean up the exceptions that are printed out to the log."""

        try: # We need to intentially re-raise the exception so that the logger can pick up the traceback
            raise exception
        except commands.CommandError:
            fcy_logger.exception( # This only works inside an exception handler
                f"Exception raised during the invocation of {context.command.name} "
                f"by {self.pprint_actor_name(context.author)} "
                f"at {self.get_current_utc_iso_time_str()}"
            )
shell radish
daring grove
ancient cosmos
#

(wtf? Does Discord force line-wrapping in triple-backtick blocks now?)

shell radish
#

how do you start your bot?

daring grove
ancient cosmos
daring grove
#

pm2 start bot.py --name=blahblahlbah --interpreter=python3

shell radish
#

is python3 -m pip list the same as pip list?

junior spire
#

when someone has time, is there any way to send a paginator without context?

Like i want to send a paginator without the use of a command (have it send like every hour to a specific channel) is this possible or MUST it be generated from a command?

torpid ivy
shell radish
daring grove
#

getting this now

#

hm

shell radish
#

also could you also show your output?

junior spire
#

Unresolved attribute reference 'get_context' for class 'Bot'

daring grove
shell radish
#

could you show the output of pip list?

daring grove
junior spire
daring grove
#

yeah ive been uninstalling them

#

trying to fix it

shell radish
#

UNKNOWN 2.4.1.dev161+ga2611769
lol

daring grove
#

yeah thanks

junior spire
#

happen to know what version of pycord added bot.get_context?

shell radish
daring grove
#

1|PickupsM | ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)

shell radish
#

uninstall py-cord and re-install it

junior spire
#

just gives me Unresolved attribute reference 'get_context' for class 'Bot'

daring grove
#

right

#

thats fixed

daring grove
#

what do i do about this...

junior spire
#

I am on version like (don't scream) 2.1.3 so I may just need to update?

you don't know what that is? I would uninstall it LOL

junior spire
#

pycord

shell radish
#

py-cord 2.4.1 but this isn't 2.1.3?

junior spire
daring grove
#

:)

shell radish
#

hi I'm getting you guys mixed up, could you guys just create your own thread and then ping me into it?

junior spire
#

thats my bad sorry dude

daring grove
#

sorry

shell radish
#

no worries

tepid coyote
#

Any suggestions on tech stack for a pycord bot dashboard?

shell radish
#

too vague, more specifications. Thanks

wind radish
#

wanna learn web dev? React + django or omit the react

#

Wanna just make a dashboard? Flask

#

i would also learn react either way if you plan on doing more web dev

#

its not the best of libraries

#

but it is a lot faster than plain html

tepid coyote
wind radish
#

ive also seen people use svelt and angular and say its a lot better or something

tepid coyote
#

Was trying Django but the way Django uses ‘apps’ is confusing

wind radish
#

you make a template once and then you can scale and use it forecer

tepid coyote
unkempt cipher
#

Oh hi Ollie

tepid coyote
upper hearth
#

idk if this is pycord issue but using topggpy library don’t work with pycord but it works with discord py it says the port is already in use when it’s not so maybe pycord is not working with it

shell radish
#

use the github version of the lib

raven condor
#

I have pycord and discord.py-self installed but they both use the same import "import discord", how do I make sure the correct one is being used for the python script

unkempt cipher
#

use python environments

plucky ingot
#

can I ask what is inline

#

whats the different if its False or True

#

plaese analysis me a easy explanation

safe nest
#

Is there a way to make a command both slash and user in one function? Or is it pretty much just have 2 seperate decorators

safe nest
# plucky ingot can I ask what is `inline`

Inline decides whether an embed field will 100% get it's own line or if it can share a line on a large enough screen, setting it to false will make sure the field is for sure on it's own line

plucky ingot
#

so its something like \n

#

like

safe nest
#

kinda

plucky ingot
#
print("hello\n I'm here to meet you")
safe nest
#

lemme whip up a quick embed to show you

plucky ingot
#

ok thanks

#

py-cord is very hard to build a embed for me

safe nest
# plucky ingot py-cord is very hard to build a embed for me
    @commands.slash_command(name="test")
    async def test_t(self, ctx: discord.ApplicationContext, inline: discord.Option(bool, "Whether example should be inline")):
        embed = discord.Embed(title="Example", description=f"Inline: {inline}")
        embed.add_field(name = "1", value = "elk", inline = inline)
        embed.add_field(name = "2", value = "elk", inline = inline)
        embed.add_field(name = "3", value = "elk", inline = inline)
        await ctx.send(embed=embed)```
#

inline true would be the first embed in the ss, inline false would be the second embed

#

hope that helps!

plucky ingot
#

fully helped thanks

safe nest
#

no worries!

#

glad I could help someone else for once instead of asking for help kek

plucky ingot
safe nest
#

wdym same bracket?

#

like multiple values per field? no

plucky ingot
#

like

embed.add_field(name = "a", value = "yo", value = "hi",inline = True)
plucky ingot
safe nest
#

afaik you can only use value once in the function

#

so no, you can use \n\n or smth like that to make it kinda look like there is a second value

#

but you can't define the same variable 2 times in the function

plucky ingot
#

rip I have too do a bot for a server and its extremely hard for me

#

free to ask here?

#

becasue Its a bit big problem with it

safe nest
plucky ingot
#

if their are any incomprehensible mention me please

#
bot.command(description = "message as embed")

async def message(ctx,user,  date: discord.Option(str), Class: discord.Options(str), days: discord.Options(str), time: discord.Options(str)):
    embed = discord.Embed(
        title = "My message",
        color = discord.Colour.dark_purple(),
    )
    embed.add_firld(name = f"your Class", value = f"{date}",)
    embed.add_field(name = f"{time}", value = "User", inline = True)

here is my code Im working on now

plucky ingot
#

where is Mr Alex :< sorry I ask a hard question for you

safe nest
# plucky ingot where is Mr Alex :< sorry I ask a hard question for you

ngl, this is a more in depth question, and to answer it involves quite a bit of coverage of pycord, I'd suggest starting off with a smaller project and working your way up. this question also depends quite a bit on you figuring out exactly the way you want the onfo displayed and how you're going to implement it, before even getting to making an admin command to change the information on there, which is a whole task of it's own

plucky ingot
grizzled loom
#

if you need two line breaks (or one that just refuses to show up, use:

\n\u200B
safe nest
#

the point of the 2 line breaks was just to put a gap between the 2 paragraphs, but thanks for that i guess

grizzled loom
#

it depends on where it is used though. on some places double \n works fine

hasty cosmos
#

Hey, is it possible to use the @option decorator to change how a command's option looks in the UI? I'm trying to use name= parameter, but it's giving me a "TypeError: option() got multiple values for argument 'name'"

#
@option(
"group_category",
name="group category",
description="What type of category is this group (i.e. project)?",
required=True,
)```
where group_category is my option variable/parameter, and name="group category" is how I want it shown in discord UI.
lapis dock
#

name is the UI name. Try using parameter_name

slow dock
#

Is there something similar to discord.Option(int) but so that only emoji can be accepted?

slender surge
#

how do i check that 2 set users have interacted with a button? i want it to proceed when both users have reacted

lapis dock
slow dock
lapis dock
little cobalt
#

I also would be interested how to check if a string is a emoji

lapis dock
#

The main issue is that there is a bunch of different ranges unicodes for emojis. Its not like U140683-U141244 are emojis.

little cobalt
#

that one is a custome one

lapis dock
#

Those are easier to find but you would also have to verify if it is a real emoji.

slender surge
#

e.g. 1 user reacted to a button that say "Wizard", another reacts to a button that says "Knight" and once each button has been clicked once it proceeds?

little cobalt
#

you could disable it after pressing the button

lapis dock
#

Then you just have to flip the bools instead of having bools for the users have it for the button. You might also want to store what user clicked what button so that you know that 1 user did not press both.

slender surge
#

could i insert a users choice into a databse, and check if the 2 values are null or not? if both values have a value in them then it proceeds

lofty parcel
#

why not

slow dock
#

How to cast <:pepsi: 1101479961656819712> to discord.Emoji?

deft kestrel
#

how to divide a bot into shards?

lofty parcel
#

.rtfm Autoshardedbot

lofty parcel
#

You shouldn't need a shards until like 50k guilds

deft kestrel
lapis dock
deft kestrel
little cobalt
#

yea

fleet cedar
hasty cosmos
# lapis dock name is the UI name. Try using `parameter_name`

I tried, it keeps giving me a TypeError saying too many arguments for name=, I think it’s automatically referring to the first argument “group_category” as the name. I even tried doing parameter_name=, name= but it didn’t work I’ll try again rn

hasty cosmos
#

I actually came up with an idea for the emojis. Import an emoji dictionary and use it as your options list?

lapis dock
hasty cosmos
#

I see, I didn’t know I can’t have spaces. Thank you!

hasty cosmos
leaden raft
#

does this have support for logging in into user accounts?

shell radish
#

no

lapis dock
slow dock
slow dock
hasty cosmos
#

here's a better workaround:

hasty cosmos
#

And you can handle that error inside discord slash command possibly, that part I don't know how to.

#

ideally it would show this before the user sending the command

slow dock
hasty cosmos
#

@slow dock Yeah if you can make a similar error customized for an option, such as how the required=True does, then let me know 🙏

torpid ivy
#

i am about to make the most horrific command ever \o/

trying to figure out the best way to handle changing settings via a command. might just add a bunch of optional parameters in a slash command? like /dat set enabled False or /dat set option1 5

#

i'd rather have a nice little web dashboard for this but i have no idea how so

hasty cosmos
torpid ivy
#

hmm. so this will only match regular channels, right? I'm trying to find the right Option to use to match regular channels + threads

#

or will that do it

rugged lodgeBOT
#

Here's the slash options example.

torpid ivy
#

OH sweet

#

oh i see, it's using a different method than me to add options I guess

#

i was always doing them inline with the initial @command_group.command() decorator

torpid trench
#

If I have a View with some Buttons, one of which pops up a Modal, is there a way from that Modal's callback function to access the View, for example, to enable a Save button on that message that was previously disabled, if the form passes validation?

shell radish
#

yes

torpid trench
#

(and if so, what is that way?)

torpid ivy
#

something like this is the approach i'm going lol

#

(ignore the pass, that's just to keep pycharm from getting annoyed)

shell radish
#

you can use modal.wait() or use nested classes, but I prefer the first one

shell radish
torpid ivy
#

nah I figured out what i was looking for, was mostly just posting that so anyone could point out any immediate issues with the approach lol

#

my original question was just how to match channels + threads but that seems easy enough w/ Union

torpid ivy
#

what do you mean

#

this is how I currently have a command that requires the user doing the command to select a user specifically

torpid ivy
#

no I know what type hinting is, I just didn't know what you meant

shell radish
#

you don't get type-hinting on option'ed args

torpid ivy
shell radish
torpid ivy
#

you seem to be telling me that shouldn't work

shell radish
#

what?

torpid ivy
#

i think we have some confused communication lol

#

what do you mean here? because i think i'm interpreting this statement differently than you mean it

shell radish
torpid ivy
#

are you talking about within pycharm or something? i'm so confused what you're trying to tell me lol

torpid ivy
#

ahhhh okay

#

I thought you meant in general

shell radish
#

that's why I sent the article ;-;

torpid ivy
#

like you were saying that using type hinting in the async def command wouldn't work like that

shell radish
torpid ivy
#

next fun problem I have to figure out, when I switch over to this server-based settings format with user-based permissions and all that, the permissions list will be empty. so I gotta figure out how to somehow give admins/moderators permissions to begin with. There any sort of flag for that that I can check for?

#

like on a per server basis i could add the moderator role id to the role permissions list, but for defaults I gotta figure out an option

#

I guess one option would be to check if a role has a specific permission only moderators would have. like "Manage Channels" or something -- although I'm not sure if the bot would have the ability to check permissions of roles

torpid ivy
#

so if someone uses /dat settings user_elevation username 123 -- ctx.command.qualified_name would be "dat settings user_elevation" right?

#

given that username and 123 are args, rather than part of the command

hasty cosmos
#

@slow dock I got it to work by importing "emojis" python library 🙂

#

It's not too bad. I can teach you how

#

example:

torpid ivy
#

are role ids unique per role, across servers?

shell radish
#

?tag snowflake

hasty cosmos
# hasty cosmos example:

Can Discord API render custom guild emoji Markdown in the options UI for AutocompleteContext?

In this example, if I search a custom channel emoji it shows as ```:GComb:

torpid ivy
#

nice

hasty cosmos
# shell radish no

I see, thanks. I'll try making it so it doesn't represent the large emoji ID <emojiName: ID> and just show :GComb: instead

#

thanks

hasty cosmos
#

In discord slash commands, is it possible to customize your own warning based on specific requirements?

#

This one is from when you set an option's attribute required=True

hasty cosmos
hasty cosmos
#

like after invoking a command

shell radish
#

send an ephemeral message with a red-colored embed

hasty cosmos
#

And is there a way to add a UI button called "edit" with that message that recreates the command with previous inputs?

#

I've gotta learn pycord buttons still

shell radish
#

no

#

you can mention the message tho

#

or on desktop you can just click the up arrow

hasty cosmos
#

Well I noticed on discord when a command's invoked it says @user used /command and when you hover of it gives the entire command with options

hasty cosmos
hasty cosmos
shell radish
#

when you select a slash command, the discord client will try to parse the addition text as arguments

hasty cosmos
#

Yk what I'll just make it easier on everyone and add warning "use the up arrow to edit your command" 🤣

#

Thank you for your help 💯

shell radish
torpid ivy
#

damn. so close to having a pretty way to do this

#

oh well. I can just do the list comprehension elsewhere

hasty cosmos
# shell radish send an ephemeral message with a red-colored embed

Is it possible to delete a ctx.response from a bot after certain time instead of a message using ctx.send? My bot still expects a response, so I used

await ctx.respond("Warning: warning description !")

I was wondering if there was a way I could delete that message. Possibly with appropriate "manage messages" permission?

shell radish
#

There is a delete_after arg

hasty cosmos
#

bless you, I found it. delete_original_response is the arg for interaction object

        await warning_msg.delete_original_response(delay=10)
#

🙏

hasty cosmos
# shell radish no, there is literally

😮 woah. I didn't see this. How do I use send_response with BridgeContext?
Current Implementation:

 await warning_msg.delete_original_response(delay=10)```
when I try using ctx.send_response("") It warns "Unresolved attribute reference 'send_response' for class 'BridgeContext' "
shell radish
hasty cosmos
hasty cosmos
shell radish
#

yay

torpid ivy
#

guh this looks so ugly. Is this actually the right way to typehint with a default value >_>

torpid ivy
lofty parcel
#

discord.Option has a default= kwarg

torpid ivy
#

oo, that sounds less ugly

hasty cosmos
little cobalt
#

If not you dont need the "= None" stuff

torpid ivy
#

i actually have no idea \o/

#

ive not looked at any bridge documentation so i'm guessing not, but maybe accidentally

meager mantle
#

Kind, how to get from button(interaction) the author of slash command? If it is impossible, how to check that the button was clicked by the author of slash command?

desert goblet
#

Hi I'm just wondering, how would I disable the button that was made in buttonview from Modal callback?

shell radish
shell radish
meager mantle
shell radish
meager mantle
desert goblet
lofty parcel
#

your button should be

modal = Modal(...)
await interaction.response.send_ ...
await modal.wait()```
#

and your modal should be self.stop() self is your modal, thats how classes work

#

and you dont pass self to functions, that arg is given by python

#

basic oop

desert goblet
lofty parcel
#

You pass your title or whatever args you're using

#

It sounds like you have no idea what you're doing if you can't read your own code nor deduct code from a example which is 99% identic to your code

#

You're required to know basic python and OOP if you want to use pycord

#

Otherwise, you'll just get stuck at simple issues

desert goblet
#

You're right, sorry for wasting your time

lofty parcel
#

Its not about wasting my time, it's about yourself getting stuck at simple issues.

#

You won't get far without python basics.

ancient cosmos
#

Is there an argument I can pass to @commands.Cog.listener() that disables the listener? (I've got something that isn't ready for prime time, but I don't want to just comment it all out.)

Or should I just comment out the decorator?

lofty parcel
#

Add a return at the top

upper hearth
#

i have a command with a button that does the function of another command (which has a confirm button that will edit the message), and the other command should be editing the 2nd message but it's editing the first instead

#

and idk how to make it edit the other one

rose roost
#

how to send messages to a specific channel

daring valve
safe nest
daring valve
#

I also recommend you to check the guide to get basic understanding on how pycord works

rose roost
safe nest
#

huh

#

show how you used the code, cause idk why you'd have a string as a response

rose roost
safe nest
#

if you aren't using it in a cog, remove self.

rose roost
#

ok

safe nest
rose roost
safe nest
#

let's see some more of the code, hard to help properly without more context

#

it's also possible that it can't find the channel, hence why I included the fetch_channel part

rose roost
safe nest
#

try using await bot.fetch_channel() instead of bot.fetch_channel() and see how that works out for ya, and keep in mind that this requires a channel ID

rose roost
#

but I didn't use bot.fetch_channel() anywhere

safe nest
#

I meant instead of bot.get_channel() my b kek

#

reading and spelling are hard

rose roost
#

ok

#

like this?🤨

safe nest
#

yeah

rose roost
#

In channel_id: Value "#1132998889813848124" is not snowflake.

safe nest
#

so it looks like you're calling a channel like #how-to-get-help when running the command, try pasting the channel id instead of calling the channel like that

rose roost
#

ок

safe nest
#

with that it's far easier to take in parameters instead of separating the message yourself, or better yet, slash commands

rose roost
#

i know, but slash commands displayed to everyone

safe nest
safe nest
#

does your bot have permission to view and speak in all those channels that didn't work? I don't see anything code wise that would prevent it

safe nest
#

then I'm unsure of why it wouldn't work in some channels

rose roost
#

I think I'll try doing it by prefixed commands

safe nest
#

pls do, it's so much easier and far easier to do something like #how-to-get-help instead of a channel id

rose roost
#

can i use in my code prefixed commands and slash commans at the same time?

safe nest
#

yee

rose roost
#

thanks

rose roost
shell radish
#

Your bot isn’t online

plucky ingot
#

I want to ask how can I get users avatar

#

member.avatar_url

#

?

heavy sky
#

If you just want the avatar object you can do member.avatar but if you want the url for it, then do: member.avatar.url

plucky ingot
#
@bot.command(description = "message as embed")
async def makeannouncement(ctx, title:str, description:str):
    user = ctx.user.id
    embed = discord.Embed(
        title = f"{title}"
        description = f"{description}"
    )
    embed.set_author(name=f"{user}",icon_avatar = )
#

this is my progress right now

heavy sky
#

Ah, ok. First, you should change user=ctx.user.id to user=ctx.user. Then in the set_author set it to user.name and the icon to user.avatar.url

plucky ingot
#

ok let me try

plucky ingot
#

why it say Im. not work

fleet cedar
#

It is icon_url

#

Not icon_avatar

plucky ingot
#

oh

fleet cedar
#

Also, i suggest using user.display_avatar instead of user.avatar