#Basic Pycord Help (Quick Questions Only)

1 messages · Page 21 of 1

cyan quail
#

not possible, discord limitation

verbal gulch
#

make it like a normal slash command

worldly schooner
cyan quail
#

if a group has any subcommands then the group can't be used as a command

verbal gulch
#

hello. i get a error, but i do not know why. I'll appreciate if anyone tell me how to fix it!

#

code:

#

uhm

cyan quail
#

well first off, what's the full error

verbal gulch
# cyan quail well first off, what's the full error
Ignoring exception in on_interaction
Traceback (most recent call last):
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 127, in wrapped
    ret = await coro(arg)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 1201, in _invoke
    await command.invoke(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 356, in invoke
    await self.prepare(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 278, in prepare
    if not await self.can_run(ctx):
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 373, in can_run
    local_check = cog._get_overridden_method(cog.cog_check)
AttributeError: '_MissingSentinel' object has no attribute '_get_overridden_method'

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

Traceback (most recent call last):
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\bot.py", line 1009, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 359, in invoke
    await injected(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 135, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: '_MissingSentinel' object has no attribute '_get_overridden_method'
#
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\bot.py", line 1058, in on_interaction
    await self.process_application_commands(interaction)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\bot.py", line 756, in process_application_commands
    await self.invoke_application_command(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\bot.py", line 1013, in invoke_application_command
    await ctx.command.dispatch_error(ctx, exc)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 401, in dispatch_error
    local = cog.__class__._get_overridden_method(cog.cog_command_error)
AttributeError: type object '_MissingSentinel' has no attribute '_get_overridden_method'
Ignoring exception in command casoinfo hire:
Traceback (most recent call last):
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 127, in wrapped



#
    ret = await coro(arg)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 1201, in _invoke
    await command.invoke(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 356, in invoke
    await self.prepare(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 278, in prepare
    if not await self.can_run(ctx):
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 373, in can_run
    local_check = cog._get_overridden_method(cog.cog_check)
AttributeError: '_MissingSentinel' object has no attribute '_get_overridden_method'

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

Traceback (most recent call last):
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\bot.py", line 1009, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 359, in invoke
    await injected(ctx)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\commands\core.py", line 135, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: '_MissingSentinel' object has no attribute '_get_overridden_method'
cyan quail
#

pycord version?

verbal gulch
worldly schooner
verbal gulch
cyan quail
worldly schooner
#

im trying to run a slashgroup outside a cog

cyan quail
#

if that still doesn't work, then downgrade to 2.0.1

verbal gulch
#

Alr

#

pip install py-cord==2.1.3 right?

cyan quail
#

yeah

#

ah ==

#

i think

#

idk one of them

verbal gulch
#

Already, will do it later, i have to sleep

verbal gulch
worldly schooner
#

smh this error happens when I run this command

#

only this command

cyan quail
#

uhhhhh

#

well same advice i suppose

worldly schooner
verbal gulch
worldly schooner
#

alr i will try running here

verbal gulch
#

Alr

worldly schooner
#

on py-cord 2.0.1

#

@cyan quail thanks for the advice

cyan quail
#

allgood

verbal gulch
worldly schooner
#

@cyan quail now im having issue with on_timeout in the views after changing the version

cyan quail
#

ah i guess self.message wasn't fully implemented back then

#

hm

#

how are you sending the view initially?

worldly schooner
cyan quail
#

you could change it to view.interaction = await ctx.respond(...), then in the timeout do self.interaction.edit_original_message instead

worldly schooner
#

ok I will check it out

cyan quail
#

all good

harsh dust
#

apparently an error is raised for default avatars when I use member.avatar.url with the error NoneType has no attribute 'url'
how would i get the default avatar url ?

worldly schooner
#

is there a way to execute a function certain times in a day?
like i want to execute a function in every hour of the day, is that possible?

#

automatically ofc

rugged lantern
#

tasks

worldly schooner
#

thanks

silver moat
#

@livid juniper

#

?tag install-replit

obtuse juncoBOT
#

dynoError No tag install-replit found.

silver moat
#

?tag replit

obtuse juncoBOT
silver moat
#

if you have a replit.nix after showing hidden files then don’t do the above but instead use the one below

#

?tag replit-install

obtuse juncoBOT
#

Follow instructions from: #998272089343668364 message

naive remnant
#

My bot is not responding to any commands

#

And the code is correct

silver moat
obtuse juncoBOT
#

As of Pycord Beta 5, Discord API v10 requires message content intent to receive message content. This affects the traditional commands. Not enabling this intent will result in the messages' content, embeds, and components being empty.

You will need to enable the intent on the developer portal, as well as in your code:

intents = discord.Intents.default()
intents.message_content = True
bot = discord.Bot(intents=intents)

Docs: https://docs.pycord.dev/en/master/api.html#discord.Intents.message_content

naive remnant
#

And it's not working

silver moat
naive remnant
#

No but it works with my other projects

naive remnant
silver moat
naive remnant
#

Message based commands

silver moat
#

are there any errors?

rugged lantern
naive remnant
silver moat
#

did you override the on_message event?

naive remnant
#

No

#

Using commands.Bot()

silver moat
#

could you show your code

naive remnant
rugged lantern
#

ok so why ask for help

naive remnant
#

Okay okay

#

It's solved

#

I typed intent instead of intents

rugged lantern
naive remnant
naive remnant
silver moat
#

yw

worldly schooner
#

Is there a more efficient way to update a value for all the users in the database at the same time instead of using for loops?

#

e.g: I want to set the pickaxe value as 30 for all the users at once

#

instead of doing:

   for id in users['data']:
       users['data'][id]['pickaxes'] = 30
meager mica
#

Hey so I'm making a bot to host event that will have to give up to 300 member certain role, does pycord automaticly have anti rate limit or do I have to implement myself

#

Cuz rn testing it takes a while so I'm assuming it does but I don't want anything wrong to go at event

worldly schooner
#

😋

meager mica
#

floosh then probably not lol

worldly schooner
#

time to face off mongo db

meager mica
#

Mongo it's just update many

#

Built in func

worldly schooner
#

hmmm i see

#

interesting, i will implement that fast as possible

meager mica
#

Then for loop should be able to upload your json pretty easily

worldly schooner
#

thx for the advice

young bone
#

Mongo DB got a rate limit?

meager mica
#

No

#

I doubt since you can host urself

young bone
#

Oh?

near hollow
#

Never have ran into ratelimits on self host. I doubt they exist maybe for cloud hosting when they host but I would assume they are fairly high

young bone
sage galleon
#

Is there a message submission box that can appear under a message or am I imagining things? I thought I saw it was a feature somewhere but I might be confusing it for select menus

hybrid raft
#

How to send message like

silver moat
#

?tag timestamp

obtuse juncoBOT
#

dynoError No tag timestamp found.

silver moat
#

?tags timestamp

obtuse juncoBOT
#
Tags (1)

Timestamps

silver moat
#

?tag Timestamps

obtuse juncoBOT
#

To make a timestamp you need a unix timestamp. Then, put your time and date into the converter and copy the "Unix Timestamp" (https://www.unixtimestamp.com/) Then to use the timestamp, follow this syntax: <t:COPIED_TIMESTAMP_HERE:FORMAT>

Where it says FORMAT, you can put a few different things:

R: Relative, says "two weeks ago", or "in 5 years"

D: Date, says "July 4, 2021"

T: Time, "11:28:27 AM"

F: Full, "Monday, July 4, 2021 11:28:27 AM"

Example: (note: 1000190514 is Unix time for 11 September 2001)

<t:1000190514:R> -> says 20 years ago
<t:1000190514:D> -> says 11 September 2001
<t:1000190514:T> -> says 12:11:54
<t:1000190514:F> -> says Tuesday, 11 September 2001 12:11
silver moat
#

@hybrid raft

hybrid raft
#

thx

granite anvil
#

can anyone help me with this? when i try to run it, comes back with NameError: name 'bot' is not defined

from discord.ext import commands
import discord
from utils.utils import *
from utils.data import Data



class Admin(commands.Cog):



    def __init__(self, bot):
        self.bot = bot
        self.data = Data()  


    @commands.Cog.listener()
    async def on_ready(self):
        # bot startup tasks
        await logEvent("Bot has finished rebooting.", self.bot)
        activity = discord.Game(name=f"Crush Them All! | r.help")
        await self.bot.change_presence(activity=activity)



    @bot.slash_command(guild_ids=[749087266491727933])
    async def purge(self, ctx, num_messages: int):
        # purge n messages from current channel
        if await isMod(ctx):
            channel = ctx.message.channel

            def check(msg):
                return not msg.pinned

            try:
                await ctx.message.delete()
                await channel.purge(limit=num_messages, check=check, before=None)
            except:
                pass
            await logUsage(f"Purged {num_messages} messages in #{ctx.message.channel.name}, requested by @{ctx.author.name}.", self.bot) ```
spice oyster
granite anvil
#

do you want me to copy the whole error message?

spice oyster
#

Yes, at least the part saying the line.

granite anvil
#
  File "C:\Users\aonap\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\cog.py", line 731, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\aonap\Downloads\raider-bot-main (1)\raider-bot-main\cogs\admin.py", line 8, in <module>
    class Admin(commands.Cog):
  File "C:\Users\aonap\Downloads\raider-bot-main (1)\raider-bot-main\cogs\admin.py", line 26, in Admin
    @bot.slash_command(guild_ids=[749087266491727933])
NameError: name 'bot' is not defined

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

Traceback (most recent call last):
  File "C:\Users\aonap\Downloads\raider-bot-main (1)\raider-bot-main\bot.py", line 25, in <module>
    loadCogs()
  File "C:\Users\aonap\Downloads\raider-bot-main (1)\raider-bot-main\bot.py", line 21, in loadCogs
    bot.load_extension(f"cogs.{name}")
  File "C:\Users\aonap\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\cog.py", line 867, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\aonap\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\cog.py", line 734, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.admin' raised an error: NameError: name 'bot' is not defined```
spice oyster
#

Do you have other cogs? Do they work?

granite anvil
#

i do, let me see

spice oyster
#

Maybe there is a mistake at the end of the cog. Did you add the setup() method?

granite anvil
#

i tried another cog, didnt work

#

what is the setup method

spice oyster
#

You need to add this after the cog class, outside of it.

def setup(client):
    client.add_cog(Admin(client))

Use "client" or "bot" depending on how you declared it in your main file.

#

Actually, maybe you already have it, otherwise you wouldn't get this error.

#

Anyways, make sure everything is fine for the cog.

granite anvil
#

this bot has been working for over a year, just trying to change from r. prefix to slash commands

#
class Admin(commands.Cog):
    def setup(bot):
        bot.add_cog(Admin(bot))```
this is what you meant, correct?
#

if so, i still get the same message when i run it

spice oyster
granite anvil
#

ok ty, sorry i usually do this w a friend and she knows a lot more than i do w this

#

yea it is at the end

#

was already there, didnt see it

spice oyster
#

I've found the error. The decorator you are using is wrong.
You need @discord.slash_command, not @bot.slash_command.

granite anvil
#

thanks! now i guess i have to change my commands to all lowercase

granite anvil
#
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\aonap\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\aonap\Downloads\raider-bot-main (1)\raider-bot-main\cogs\admin.py", line 20, in on_ready
    await logEvent("Bot has finished rebooting.", self.bot)
  File "C:\Users\aonap\Downloads\raider-bot-main (1)\raider-bot-main\utils\utils.py", line 129, in logEvent
    await channel.send(embed=embed)
AttributeError: 'NoneType' object has no attribute 'send'```
#

ill figure it out no worries, probably just because im using a test version of the bot

rugged lantern
worldly schooner
fervent cradle
#

hey guys how do i connect to a secure lavalink connection with wss and not ws with wavelink, i have tried putting https parameter to true but i am still unable to connect to my lavalink with wss connection

wild socket
#

how can i make it so context menu commands are made only for bot's profile and not for any other member ?

#

so like, they will only appear if the user right click on the bot and won't appear on other right clicking other users

granite anvil
#

anyone know how to make this work? trying to edit the commands' embed from a button clickpy i = 0 async def left_callback(interaction): i -= 1 if i < 0: i = len(pages) - 1 await message.edit(embed=pages[i]) left.callback = left_callback async def right_callback(interaction): i += 1 if i > len(pages) - 1: i = 0 await message.edit(embed=pages[i]) right.callback = right_callback

spice oyster
granite anvil
#

here ill send more

#
@discord.slash_command(guild_ids=[749087266491727933])
    async def help(self, ctx):
        # help command
        await logUsage(f"Help command requested by @{ctx.author.name}.", self.bot) 
        left = Button(label="<<Previous", style=discord.ButtonStyle.primary)
        right = Button(label="Next>>", style=discord.ButtonStyle.primary)
        view = View()
        view.add_item(left)
        view.add_item(right)
        pages = [self.makeGeneralHelpEmbed(), self.makeRecruitHelpEmbed(), self.makeModHelpEmbed()]
        interaction = await ctx.respond(embed = pages[0], view=view, ephemeral = True)
        message = await interaction.original_message()


        i = 0
        async def left_callback(interaction):
            i -= 1
            if i < 0:
                i = len(pages) - 1
            await interaction.response.edit_message(embed=pages[i])
        left.callback = left_callback
        async def right_callback(interaction):
            i += 1
            if i > len(pages) - 1:
                i = 0
            await interaction.response.edit_message(embed=pages[i])
        right.callback = right_callback```
#

error message UnboundLocalError: local variable 'i' referenced before assignment

spice oyster
rugged lantern
worldly schooner
rugged lantern
#

even mongodb isn't that great, use sqlite instead; you can save everything in a dict format (ie, like json) there too if you so wish and it is much more simple to use

full basin
#

Why mongo isn't great lmao. It's just another db type

granite anvil
rugged lantern
#

cope however you want my friend. mongodb is not a db that anyone with a sense of scale would use and it is not very practical for data with relations. and on top of that, it is easier to corrupt data. there is literally no reason to choose it over mysql or sqlite. don't even get me started on the performance...

worn void
#

if interaction.author == x:
#do stuff
else:
#not correct person

finite flame
#

is there any way to fill in the command promt generated by input() from outer scope?

cunning falcon
worn void
#

Also I think it would be interaction.user or .member

#

Not author

finite flame
# worn void Wdym

external code is using input() or simething similar to get something from the user, but I wanna work around it since my application isn't using the console

errant craneBOT
#

Here's the basic voice example.

worn void
finite flame
#

not for my bot, but yeah, a package I'm using

worn void
#

So you want to get an input from a bot to use in the console?

#

I don’t think you can do that

#

I could be wrong, you’d have to edit the library or something

finite flame
#

to be more specific, I am using boto3 and am trying to insert the MFA token needed to edit resources from an outer scope

drifting birch
#

How do you get the ID of a slash command? I want to use it to display the command as </command:123> but cannot find anywhere how to get the ID or how to mention the command.

worn void
#

I just don’t really understand what your entirely trying to do

finite flame
#

yeah I also asked there, the chance of actually getting an answer is just a lot higher when asking at multiple places

cyan quail
fervent cradle
#

How can i connect bot to voice channel

cyan quail
errant craneBOT
#

Here's the basic voice example.

spice oyster
worn void
#

Never seen that before

worn void
#

You can only get a command ID from pc I’m pretty sure

cyan quail
#

</you can actually:9274> </put anything there:193847> </with random ids:92479>

finite flame
#

</test:187>

cyan quail
#

not that they'll function but it works

#

has to be a valid command name

drifting birch
fervent cradle
#

</hi:234243>

worn void
#

</words:123>

fervent cradle
#

LOL

#

</you can put:1>

#

</different numbers in:1>

#

</id:1>

spice oyster
spice oyster
cyan quail
#

by the api meaning by the library

#

are you getting the id of the current command being ran? or other commands

spice oyster
#

I can't find command.mention in the docs. Sometimes I need it for the same, sometimes for another.

cyan quail
#

for the current command, it'd be ctx.command.mention

#

for other commands, you can either iterate through bot.walk_application_commands() to get all command objects, or use bot.get_application_command to get a specific command by name

spice oyster
#

Thank you! I'll try using the name then.

#

For other commands, I can only get ApplicationCommand objects, that don't have the mention attribute. rooThink

cyan quail
#

? it'll return SlashCommand, not ApplicationCommand

#

ApplicationCommand is a generic type that SlashCommand inherits from

spice oyster
#

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

fervent cradle
#

How can I edit a channel's name ?

cyan quail
#

that means you didn't get the command

#

is it a group?

spice oyster
cyan quail
#

well it is but subcommands are a bit different

fervent cradle
cyan quail
drifting birch
cyan quail
#

basically you need </group_name subcommand_name:group_id>

#

because subcommands don't have IDs which was overlooked when adding mention

drifting birch
merry briar
#

is there some kind of "on_click_button"?

fervent cradle
#

Now,

await client.get_channel(discord.ChannelType.text, 1015850484545892352, name= f'{len(client.guilds)} Servers')
TypeError: Client.get_channel() got an unexpected keyword argument 'name'```
cyan quail
#

or something along those lines

cyan quail
#

get_channel only takes the channel id, i.e. client.get_channel(id)
then you use .edit on that object

cyan quail
#

allgood

merry briar
#

is there some kind of "on_click_button"?

cyan quail
#

there's on_interaction but it's recommended you don't use this, instead you should use button callbacks

silver moat
errant craneBOT
#

Here's the button roles example.

cyan quail
#

maybe there should be a simpler button example... oh well

errant craneBOT
#

Here's the confirm example.

silver moat
#

should be the easiest

cyan quail
#

wow that's such a descriptive name

silver moat
cyan quail
#

hmmmmmmmm

#

i wonder if dropdown should also be renamed since it's never referred to as such in the docs

cyan quail
#

i guess the example itself uses Dropdown for the class names but hmm

drifting birch
merry briar
cyan quail
silver moat
silver moat
cyan quail
#

oh true

granite anvil
cyan quail
#

fwiw pagination is a built in feature but uhhh

#

add a variable to the view itself

#

like view.page = 0

naive remnant
#

How can I mak my bot see if the dm of someone is closed

cyan quail
#

then refer to view.page instead of i

granite anvil
#

ill try that out

cyan quail
#

if it errors with discord.Forbidden, their DMs are off

spice oyster
# cyan quail it'd just be easier to form it yourself entirely ```py group_name = "..." comman...

Thank you very much! I made this function based on what you shared and it's working for both cases.

def get_command_mention(command_name: str, group_name: str = None):
    if group_name is not None:
        group = self.client.get_application_command(group_name, type = discord.SlashCommandGroup)
        command_mention = f"</{group_name} {command_name}:{group.id}>"
    else:
        command = self.client.get_application_command(command_name, type = discord.SlashCommand)
        command_mention = command.mention
    return command_mention
cyan quail
#

but if it's discord.HTTPException, their DMs are on

silver moat
cyan quail
#

that's an internal function that checks the message content itself

silver moat
#

ic

cyan quail
#

oh and channel permissions i guess

#

but it can't see privacy settings

granite anvil
#

seems like its working tyvm @cyan quail

cyan quail
#

all good

silver moat
cyan quail
#

i keep meaning to but i keep forgetting lol

#

i think it was discussed in #discussion over how it should be implemented

#

between qualified_id to return the root id or for some other logic

silver moat
#

I saw.

cyan quail
#

maybe i'll give it a go now but groups are supposedly part broken on 2.1.3 so not sure if i can even test

cyan quail
#

there was a fix on 2.1.3, but some threads popped up suggesting it was still broken in some scenarios

#

#discussion message

spice oyster
#

Is there a way to avoid this?

loud holly
#

You know how in slash commands, we can restrict guild_ids to a certain guild, can we manipulate the guild_ids so that if I use a command it'll add in a guild ID and get registered or do I need to do something like cogs (it's just that with cogs, I don't rlly get them so I choose to not implement them)

worldly schooner
#

any one knows how to use the $set properly in MongoDB? smh im doing it wrong but I dont understand how

#

Bro im freaking blind, messed up putting a comma there

#

it should be like this: {"name" : "Bot"}

shrewd roost
#

Is there any way to get a webhook link through the bot?

spice oyster
loud pier
#

I would like my bot to send a message when a schedule event is over, can I detect that with on_scheduled_event_update?

cyan quail
loud holly
cyan quail
#

don't think it can be modified while the bot is online

spice oyster
#

After restarting it, if you implement it correctly, the command will be loaded again by using the new guild_ids from the file, rather than the default one.

loud holly
#

the guild_ids

spice oyster
#

By using cogs, you can restart the cog instead of restarting the whole bot. I don't think you gain anything else from it.

loud holly
spice oyster
# loud holly I see, I'll see what I can do, probably will see some yt vids since they're pret...

You need this in your main file:

# Load all cogs.
for file in os.listdir("./cogs"):
    if file.endswith(".py"):
        client.load_extension(f"cogs.{file[:-3]}")

And then you write your cog like this:

import discord
from discord.ext import commands

class Artwork(commands.Cog):

    def __init__(
        self,
        client: commands.Bot
    ):
        self.client = client

    @commands.Cog.listener()
    async def on_ready(self):
        print("Artwork module loaded.")

    @discord.slash_command(
        name = "artwork",
        description = "Get a random artwork. Cooldown: 1 minute, per server."
    )
    @commands.cooldown(1, 60, commands.BucketType.guild)
    async def random_artwork(
        self,
        context: discord.ApplicationContext
    ):
        # What you want to do.

def setup(client):
    client.add_cog(Artwork(client))

As always, you can use "bot" instead of "client".

fervent cradle
#
my_pages = [
                Page(embeds=[discord.Embed(description='first page')]),
                Page(embeds=[discord.Embed(description='second page')])]
#

how do i set a thumbnail for these embeds?

#

like where do i even type embed.set_footer()?

cyan quail
#

just define the embeds beforehand

loud holly
cyan quail
#

i guess you can change .set_footer() etc. on the end but make sure it doesn't become unreadable

loud holly
#

oh I didn't see that lmao maybe I'll see

loud pier
#

Any idea why new_event = await bot.Guild.create_scheduled_event( don't do anything (no error message, no event created)?

cyan quail
loud pier
cyan quail
#

sounds like a ratelimit but let's see

cyan quail
#

then try to use it

loud pier
loud pier
cyan quail
#

what's your full command code?

#

...and i didn't see this before, but why bot.Guild?

#

yeah idk why you did bot.Guild

#

it's just Guild

loud pier
#

🤦‍♂️ it worked

#

Thanks a lot for your patience ...

quick temple
#

Is there a way I can have a method invoked before interaction with the bot

#

An intearction being a slash command or button clicked, etc

full basin
worldly schooner
#

what am I doing wrong?

#

TypeError: Loop.__init__() missing 7 required positional arguments: 'coro', 'seconds', 'hours', 'minutes', 'count', 'reconnect', and 'loop'

worldly schooner
#

thanks

warm grotto
full basin
#

Probably because no one knows. Try using Google as there's a 99% chance you find an answer.

warm grotto
#

Google does not have an answer

#

(Looking at the comments, and looks like the thread died)

median tinsel
#

Hey there, I was trying to use buttons in my bot but then I got this error

Heres my code:


key = 
TOKEN = 
bot = discord.Bot(debug_guilds= )

class ReportGuide(discord.ui.View):
    @discord.ui.button(label="Next Section",style=discord.ButtonStyle.primary,emoji="▶️")
    async def button_callback(self, button, interaction):
        await interaction.response.send_message('')

@bot.slash_command(description='')
async def academy(ctx, ign: discord.Option(str)):
    uuid = rq.get(f"https://api.mojang.com/user/profile/agent/minecraft/name/{ign}").json()
    weight = rq.get(f"https://hypixel-api.senither.com/v1/profiles/{uuid['id']}/we?key={key}").json()
    if round(weight['data']['weight']) >= 700: 
        embed = discord.Embed(title="",description="",color=discord.Color.blue())
        embed.add_field(name="",inline=False)
        embed.add_field(name="",value="",inline=False)
        embed.set_footer(text='')
        await ctx.respond(embed=embed, view=ReportGuide)


bot.run(TOKEN)
cyan quail
median tinsel
#

damn now I feel stupid

#

tysm

fervent cradle
#

hey

#

im super confused on one thing

#

basically im trying to make select menu role selector, but im super confused how i would make this a persistent view

#

i know how to make persistent views just am confused about this situation

full basin
#

Works the same as any other view

errant craneBOT
#

Here's the persistent example.

patent shale
#

How do you change the author name on a message the bot is sending

quick temple
#
@bot.event
async def on_interaction(interaction):
    print(type(interaction))

This works, and it prints when I use a slash command, but it stops there.
The command itself does not respond

tiny wagon
#

does pycord has automatic handling for spliting embeds in case the max char limit exceeds?

granite anvil
#
@discord.slash_command()
    @commands.cooldown(5, 30, commands.BucketType.user)
    async def givetreat(self, ctx, member: discord.Member):
        # gives a cookie to a user
        try:
            cookieData = self.data.getCookies()
            if not str(member.id) in cookieData:
                cookieData[str(member.id)] = 1
            else:
                cookieData[str(member.id)] += 1
            self.data.updateCookies(cookieData)
            cookie = await self.data.getCookiePicture()
            embed = discord.Embed(
                description=f"{ctx.author.mention} gave a treat to {member.mention}!" \
                    f"\n{member.mention} now has {cookieData[str(member.id)]} treats. " \
                    f"Check your treat count with `r.treatstats`."
            )
            embed.set_image(url=cookie["link"])
            generalData = self.data.getGeneral()
            embed.set_footer(text=generalData["footer"], icon_url=self.bot.user.avatar.url)
            await ctx.send(embed=embed)
            await logUsage(f"@{ctx.author.name} gave a treat to @{member.name}.", self.bot) 
        except Exception as e:
            await handleException(e, self.bot)
    
    @discord.Bot.event
    async def on_application_command_error(self, ctx, error):
        if isinstance(error, commands.CommandOnCooldown):
            await ctx.respond(error)
        else:
            raise error```
getting missing positional arg coro
fervent cradle
#

Example:

import textwrap
list_of_contents = textwrap.wrap(yourmsgcontent, 4000, break_long_words=False, replace_whitespace=False)```
silver moat
quick temple
#

Also is there a reason why when I click a button its not getting picked up in on_interaction

@bot.check
async def on_interaction(interaction: Interaction) -> bool:
    print('here')
    return True

@bot.slash_command(name="test_command", guild_ids=[constants.TESTING_SERVER_ID])
async def test_command(ctx):

    async def callback_func(interaction: Interaction): await interaction.response.defer()

    view = discord.ui.View()

    but = discord.ui.Button(label="test")
    but.callback = callback_func
    view.add_item(but)



    await ctx.respond(view=view, content="start")
granite anvil
#

i fixed it

#

thanks though! just had to change @blank.event to commands.cog.listener()

fervent cradle
#

cool

naive steppe
#

this has 100% been answered somewhere, but how do i go about making the message sent from a slash command private?

#

as the author is the only one who can view it

spice oyster
#

ephemeral = True

#

Don't ask the same question in two places. rooCop

naive steppe
#

my bad

#

thank you

spice oyster
#

~~I can't get to make the voice registration work. I get this error when using the stop command.

raise MP3SinkError("ffmpeg was not found.") from None
discord.sinks.errors.MP3SinkError: ffmpeg was not found.

I'm using the code that's in the example linked in the guide, but adapted to be in a cog.~~

Problem solved! rooDuck

fringe socket
#

Hey guys! How do I make a command require the user to have administrator permissions?

cunning falcon
#

put something like this @discord.default_permissions(administrator=True,) right above the function definition

#

or wait it might be @commands.has_permissions(administrator=True)

fringe socket
#

Do I apply it like this?

cunning falcon
#

yeah, id recommend testing it though lol

fringe socket
#

ok

#

will test

#

didn't work

naive steppe
#

yeah, you are going about perms incorrectly

fringe socket
#

also my internet is too bad to post the errors

#

guys can you join my thread when i create it'

spice oyster
naive steppe
#

@has_permissions() below @bot.commands

spice oyster
#

You can do that way if you import the rest.

fringe socket
naive steppe
#

aware

spice oyster
#

Permissions are pre 2.0, so they work the same way because Pycord is basically a fork of Discord.py.

naive steppe
#

but pycord was made to match very simular

#

i transfered from d.py to pycord personally smooth transition

spice oyster
#

Same, I only had to fix the part about Slash Commands because they are new and I was using a third library for them.

naive steppe
fierce elm
#

Could be a very simple answer, but i'm not grasping it at the moment,
Why am I getting this
AttributeError: 'SlashCommandGroup' object has no attribute '_callback'. Did you mean: 'callback'?

errant craneBOT
#

discord/commands/core.py lines 240 to 247

@property
def callback(
    self,
) -> Union[
    Callable[Concatenate[CogT, ApplicationContext, P], Coro[T]],
    Callable[Concatenate[ApplicationContext, P], Coro[T]],
]:
    return self._callback```
fierce elm
# naive steppe whats the context?
Traceback (most recent call last):
  File "/home/ken/PycharmProjects/ticket_man/venv/lib/python3.10/site-packages/discord/cog.py", line 731, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/ken/PycharmProjects/ticket_man/ticket_man/bot/cogs/tickets.py", line 16, in <module>
    class Tickets(Cog, command_attrs=dict(hidden=True)):
  File "/home/ken/PycharmProjects/ticket_man/venv/lib/python3.10/site-packages/discord/cog.py", line 238, in __new__
    new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) for c in new_cls.__cog_commands__)  # type: ignore
  File "/home/ken/PycharmProjects/ticket_man/venv/lib/python3.10/site-packages/discord/cog.py", line 238, in <genexpr>
    new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) for c in new_cls.__cog_commands__)  # type: ignore
  File "/home/ken/PycharmProjects/ticket_man/venv/lib/python3.10/site-packages/discord/commands/core.py", line 1259, in _update_copy
    copy = self.__class__(self.callback, **kw)
  File "/home/ken/PycharmProjects/ticket_man/venv/lib/python3.10/site-packages/discord/commands/core.py", line 247, in callback
    return self._callback
AttributeError: 'SlashCommandGroup' object has no attribute '_callback'. Did you mean: 'callback'?
spice oyster
loud pier
#

Could someone explain to me why my scheduled event supposed to start now (datetime.datetime.now()) are set to start one hour later when created in discord?
Here's an extract from the debug log: DEBUG:discord.gateway:For Shard ID None: WebSocket Event: {'t': 'GUILD_SCHEDULED_EVENT_DELETE', 's': 8, 'op': 0, 'd': {'status': 1, 'sku_ids': [], 'scheduled_start_time': '2022-09-16T12:41:19.616000+00:00', 'scheduled_end_time': '2022-09-16T13:00:00+00:00', 'privacy_level': 2, 'name': 'Test', 'image': None, 'id': '1020298336852520990', 'guild_id': '697837117643948082', 'entity_type': 3, 'entity_metadata': {'location': 'competition'}, 'entity_id': None, 'description': 'This is a test', 'creator_id': '1019326256677929051', 'channel_id': None}}

full basin
#

should be utcnow

#

As discord uses utc

boreal dust
#

anyine could check #general ? 💀

cunning falcon
#

how come discord says 265kb is the maximum role icon size, but when i try uploading something thats 285kb it still goes through? is it doing some compression/conversion in the back?

cunning falcon
#

ah youre right sorry notlikeduck it surprised me so i wasnt thinking

full basin
boreal dust
#

hm good idea

fervent cradle
#

can someone help me?

@option(
    "role",
    description="Enter your role id",
    min_value=1,
    max_value=99,
    # Passing the default value makes an argument optional.
    # You also can create optional arguments using:
    # age: Option(int, "Enter your age") = 18
)
@option(
    "logschannel",
    description="Enter your logs channel id",
    min_value=1,
    max_value=99,
    # Passing the default value makes an argument optional.
    # You also can create optional arguments using:
    # age: Option(int, "Enter your age") = 18
)
async def setup(
    ctx: discord.ApplicationContext,
    status: str,
    logschannel: int,
    role: int,
):```
#
    ctx: discord.ApplicationContext,
    status: str,
    logschannel: int,
    role: int,
):```
full basin
#

I'm pretty sure 1019983696... is higher than 99

#

But taking an int won't work either way. Take a string and then convert it.

cunning falcon
worldly schooner
#

Am I doing something wrong?
10 seconds have passed but it dont print it...

#

seems like tasks is not looping every 10 secs

cyan quail
#

did you start the task

worldly schooner
#

thanks PRAISE_THE_SUN2

cyan quail
young bone
#

Can I lock a button/menu only to the owner?

cyan quail
#

no, you'd have to check inside the callback

young bone
#

alright!

gleaming falcon
naive steppe
#

someone have the documentation on hand for how this is done?

full basin
#

Bot most used commands.

#

It's something discord does

naive steppe
#

oh

#

rip, cool feature tho

#

how would i add a description to the options provided (if possible)
like "nardoragon" - by xyz

#

would i have to do something different in the options area?

silver moat
naive steppe
#

aww man, would be a cool thing to see discord add

#

thank you squid

cyan quail
#

You just have to process it differently

naive steppe
#

Documentation on this?

naive steppe
#

Thank you

cyan quail
#

Name is what shows on the ui, while value is a hidden value

#

So let's say you do choices = [OptionChoice(name=, value=), ...], you'd access product.value and then name can be whatever you want

ebon pelican
#

command to install discord buttons?

cyan quail
#

Install?

#

There are some examples of button usage in the library

errant craneBOT
#

Here's the confirm example.

ebon pelican
#

normal buttons

#

cuz i have error: ModuleNotFoundError: No module named 'discord.ext.buttons'

full basin
#

Cause Buttons are part of discord.ui

ebon pelican
#

yea i fixed it but now the error is: ModuleNotFoundError: No module named 'utils.json_loader'

full basin
#

Then no such module exists lol

ebon pelican
#

no it exists but it dont find it ...

naive steppe
#

thanks again

gleaming falcon
cyan quail
#

you'd have to restart the bot

#

(maybe reloading the command would work? can't confirm)

gleaming falcon
naive steppe
#

What do you mean by this? @gleaming falcon

gleaming falcon
#

You can’t change choices after the bot starts. So if you wanted to add another “rank”/“store id” (your naming convention is a little confusing), you’d have to re-register the command.

In contrast, if you maintained a list externally and used an autocomplete to reference it, you should be able to make changes to the list

#

If you’re certain you won’t need to adjust anything over time, then of course my suggestion is useless.

naive steppe
#

Oh shit

errant craneBOT
#

Here's the slash autocomplete example.

naive steppe
#

Like have the list check a github repo each time its ran? And grabs any new ones

#

Nvm just looked at the .py

gleaming falcon
#

I would do it on a task to keep internally rather than on demand, but yes.

naive steppe
#

Ok thats sick

#

Yeah, hard code is yucky and i have not actually touched this method

#

Super useful

#

Thank you

#

Also threading is like in C# right? Where you can assign a task or function to a thread and still run the command without waiting for the result of said func

I may need to touch up on threads ;-;

worldly schooner
#

Does the function that is creating an embed have to be asynced and awaited to it work? Cuz im not getting anything when I print the embed object

copper dew
worldly schooner
#

thats the thing, when I print I dont get anything

#

its just blank

worldly schooner
#

in other cog its printing

#

not in this one

smoky forge
#

Does restarting the bot reset every command's id?

cyan quail
#

all commands will have the same ID assuming you didn't change their names or something

smoky forge
cyan quail
#

i don't THINK that resets them but i can't confirm, hold on

void fable
#

if i have a command that i want to have a "shared cooldown" how would i go abouts it? for example someone runs /poop and i want there to be 30s inbetween the next person who uses it?

cyan quail
#

but the moment the name is changed, the ID and its previously overridden permissions are lost forever (even if you use the same name again)

worldly schooner
#

Is there a way to make collections dont delete the info in the query after being readed?

#

PyMongo question ☝️

spice oyster
worldly schooner
full basin
#

Why are you running two for loops when you can just run one and do the checks inside

worldly schooner
full basin
#

Well, that doesn't look like a for loop in a for loop

worldly schooner
full basin
#

Works for me anyways

worldly schooner
#

it almost runs like twice

worldly schooner
full basin
#

Try wrapping it in a try except?

hushed ledge
#

One message removed from a suspended account.

hushed ledge
full basin
#

Oh

worldly schooner
#

the way i declare findCurrencies and findImages is:
findCurrencies = currencyCollection.find({})
findImages = imageCollection.find({})

full basin
#

Get it or fetch it, whatever it is. And tada you get a cool new message object

worldly schooner
full basin
#

Can you actually share your whole code

worldly schooner
#

yeah lemme copy it

full basin
#

?tag paste

obtuse juncoBOT
rough roseBOT
worldly schooner
#
        findCurrencies = currencyCollection.find({})
        findImages = imageCollection.find({})
        for coin in findCurrencies:
            currency = coin['currency']
            id = coin['_id']
            embed = Embed(
                title=f"example",
                color=embedColor
            )
            link = "https://imgur.com/IjZ67ok.jpg"
            for image in findImages:
                if image['_id'] == symbol:
                    link = f"{image[symbol]}"
#

basically the for loop

full basin
#

Whole code I said

worldly schooner
#

forgot the variable declaration

worldly schooner
full basin
#

?tag paste

obtuse juncoBOT
fleet tusk
#

Please, help:
I want to write a bot for ds, please help.
I am using the pycord library.
I run the code:

import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print(f'Logged on as {self.user}!')

    async def on_message(self, message):
        print(f'Message from {message.author}: {message.content}')

client = MyClient()
client.run('token')

And it gives me an error:

Traceback (most recent call last):
  File "C:\Users\Latmi\Desktop\ds bot\bot.py", line 3, in <module>
    class MyClient(discord.Client):
AttributeError: module 'discord' has no attribute 'Client'
worldly schooner
full basin
full basin
worldly schooner
#

oh sur

worldly schooner
full basin
#

And share the link

worldly schooner
fleet tusk
full basin
#

You have discord 2.0.0

fleet tusk
#

Should i download newer version?

full basin
#

No

#

You uninstall it

fleet tusk
#

I deleted it but it didn't help

full basin
full basin
#

Uninstall py-cord and install it again

worldly schooner
#

thanks for help

fleet tusk
round rivet
#

read the error

fleet tusk
#

Oh, sorry

hushed ledge
#

One message removed from a suspended account.

silver moat
void fable
#
for n in nateamids:
  await player.remove_roles(ctx.guild.get_role(n))

is there a better way of doing this? my goal was to if the member had a role in a list, get rid of that one in specific but the method i have now is removing all of them (32 roles) which is taking about 1 minute

void fable
#

oops sorry, if a member had one of the roles in the list

#

a role i wouldn't know beforehand

cyan quail
#

so instead you should make a list of roles and then expand it inside py roles = [ctx.guild.get_role(n) for n in natemids] await player.remove_roles(*roles)

#

it won't error or anything if the user doesn't have one of the roles either; it'll simply remove all possible roles from the list

fervent cradle
#

itnvmm im huge brain fart

gaunt flame
silver moat
gaunt flame
#

amazing, thanks for the reply 😄

fervent cradle
#

how can i fetch every param

#

i need a list

#

for a for loop

#

like for param in idk_what_to_put

naive steppe
#

Could someone direct me to example code on how this is done?

#

Also, i have a button that calls a slash command, how do i go about feeding that slash variables while its made with "view=MyView()"

spice oyster
naive steppe
#

Pages?

spice oyster
#

Yes, the buttons to edit the embed.

naive steppe
#

Sorry if i dont understand, i was stuck on 1.7.3 because of d.py

I have no idea about any of the new features

naive steppe
#

Ty for giving me the name

spice oyster
#

I'm not sure if you can do it that way by using Pages. I use a custom code for doing that.

naive steppe
#

Yeah, im currently using an array to store the params i need.
Only problem is if the command is called while someone is using it then it wipes the param list
Breaking the follow up

spice oyster
#

Do you really need to store it? Just read the custom_id of the button being pressed.

#

I think that by storing it you are only making it harder to implement.

naive steppe
#

Im currently not on pc, but ill try and explain what im trying to do

#

When i get on my pc

#

Say 20 mins, brb

spice oyster
#

For my help menu, I do it this way without using the Pages feature because I wrote the code before it was a thing.

  1. The slash command calls the method that creates the embed, without any page selected.
  2. The embed gets created, defaulting on the first page.
  3. The buttons are added right below the embed, by using a View.
  4. When clicked, the buttons call the same method that creates the embed, but this time with a page selected based on the custom_id and an array that has the button names to use as a reference.
naive steppe
#

oh so its sorta like recursion

#

you are calling the same slash command just parsing a different set embed/array

#

(i hard coded the channel and what not for testing purposes

spice oyster
#

To change page, you have to edit the message instead of sending a new one.

#

You have to rely on interaction.response.edit_message() in your View.

naive steppe
#

ohh, that makes sense

#

and how would i got about passing context? if at all possible

spice oyster
#

Do you need context if you have interaction?

naive steppe
#

so i can interaction.author.id?

spice oyster
#

To see who clicked, you can use interaction.user.

naive steppe
#

thank you :D

spice oyster
#

You are welcome. Well done!

naive steppe
#

im really liking the new way discords doing buttons and such
feels a lot more creative

spice oyster
#

Now you can make the button of the active page be disabled.

naive steppe
#

true

#

ill go read button doc

#

simple enough

#

disabled=true

spice oyster
#

You can enable them all and then disable the current one.

self.enable_all_items()
button.disabled = True
naive steppe
#

ok thanks, one last question before i stop bugging you
how do i make / set the default screen (this one)

#

since in order to call the slash i need to provide ctx, key, and product

#

how did you go about setting up the home one? since i think how im doing it is causing problems

#

(updated image)

spice oyster
#

From the slash command, I call craft_embed() without telling which page, defaulting to the first one.
From the buttons, I call craft_embed(page) instead.
I recommend creating a method to craft the embed, so you can call it twice as I did.

young bone
naive steppe
spice oyster
#

This is how I did it. It depends where you put the View in the code.

async def craft_embed(
    self,
    page: str = None
):
    pages = ["Utility", "Draft", "Creative"]
    if page is None:
        page = pages[0]
naive steppe
#

ok im basically there

#

i have all 3 buttons working now its just, when called it doesn't produce an initial embed

spice oyster
#

You have to check if you are calling the function when needed.

#

How is the code for your slash command now?

naive steppe
#

works :D

#

tho i basically hard coded basic view in, which feels slimy. ill work on it tomorrow

spice oyster
naive steppe
#

oh yeah i forgot to implement the disable button

spice oyster
#

Just make a function to create the embed, so you don't repeat code.

naive steppe
#

yeah

#

thanks again, i really appreciate the help you have provided

spice oyster
#

My pleasure! I like to help and to solve problems. rooAww

naive steppe
#

1 last thing
i have the disable in the def button, but the button doesnt get disabled?

spice oyster
#

To make it start with 1 button disabled, you have to disable it when creating the View.

#

To disable the button when clicked, you have to handle it on interaction.

naive steppe
#

ok got the first part down

#

now on interaction would be in here right?

spice oyster
#

If that's the callback you call when the button is clicked, yes.

#

You can make a function to call for every button callback.

#

A button gets clicked, the function gets called, check which button, change page.

naive steppe
#

ok i found my problem

#

in await interaction.response.edit_message()
i wasnt calling view again

#

so it wouldnt change

#

all i had to do was add view=self

#

sweet, well im going to call it at that, its 230am and ive had my fun :)

ebon pelican
#

yesterday it worked with my slash command but now im getting an error: ImportError: cannot import name 'Option' from 'discord' idk what to do, I installed many shit but, yea nthing worked

naive steppe
#

yeah this shit happened to me
i deleted both discord.py and pycord, then re-installed pycord and restarted my ide

#

shit worked for me after

sleek schooner
#

this error will come

sleek schooner
#

like discord.py, py-cord all together

#

I've a question can we use buttons and Select menus in ephemeral messages ??

fervent cradle
#

how do i use bridge commands in a cog?

ebon pelican
#

no wait

#

I uninstalled discord.py and there comes the same error

ebon pelican
# young bone can you show the pip list?

aiofiles==0.6.0
aiohttp==3.8.1
aiomysql==0.0.21
aiosignal==1.2.0
aiosqlite==0.17.0
altgraph==0.17
appdirs==1.4.4
asgiref==3.5.2
async==0.6.2
async-timeout==4.0.2
attrs==20.3.0
backports.entry-points-selectable==1.1.0
blinker==1.4
bottle==0.12.19
bottle-websocket==0.2.9
buttons==0.1.9
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0
charset-normalizer==2.1.1
click==7.1.2
clipboard==0.0.4
colorama==0.4.4
config==0.5.0.post0
dearpygui==0.8.64
discord-py-slash-command==4.2.1
distlib==0.3.3
django-model-utils==4.2.0
dnspython==2.1.0
docutils==0.17.1
Eel==0.12.4
filelock==3.3.0
frozenlist==1.3.1
future==0.18.2
gevent==21.1.2
gevent-websocket==0.10.1
gitdb==4.0.7
GitPython==3.1.18
greenlet==1.1.0
h11==0.12.0
h2==4.0.0
hpack==4.0.0
Hypercorn==0.11.2
hyperframe==6.0.1
idna==2.10
itsdangerous==2.0.1
Jinja2==3.0.1
kivy-deps.angle==0.3.0
kivy-deps.glew==0.3.0
kivy-deps.gstreamer==0.3.2
kivy-deps.sdl2==0.3.1
Kivy-examples==2.0.0
Kivy-Garden==0.1.4
MarkupSafe==2.0.1
MouseInfo==0.1.3
multidict==5.1.0
option==2.1.0
pefile==2021.5.24
Pillow==8.3.2
platformdirs==2.4.0
priority==1.3.0
py-cord==2.1.3
PyAutoGUI==0.9.53
pycparser==2.20
PyGetWindow==0.0.9
Pygments==2.9.0
pyinstaller==4.4
pyinstaller-hooks-contrib==2021.2
PyMsgBox==1.0.9
PyMySQL==0.9.3
PyNaCl==1.4.0
pyperclip==1.8.2
pypiwin32==223
PyRect==0.1.4
PyScreeze==0.1.27
PyTweening==1.0.3
pytz==2021.1
pywin32==301
pywin32-ctypes==0.2.0
Quart==0.14.1
requests==2.25.1
six==1.15.0
smmap==4.0.0
sqlparse==0.4.2
termcolor==1.1.0
toml==0.10.2
typing-extensions==3.7.4.3
tzdata==2022.2
uritools==3.0.2
urllib3==1.26.4
virtualenv==20.8.1
Werkzeug==2.0.1
whichcraft==0.6.1
wsproto==1.0.0
yarl==1.6.3
zope.event==4.5.0
zope.interface==5.4.0

young bone
#

discord-py-slash-command

#

Uninstall that one and py-cord and reinstall py-cord

ebon pelican
#

ok

ebon pelican
#

but now its not working, it shows a long error and says its ready but the slash command dont show up

naive steppe
#

seems like a code issue

#

show you def command

ebon pelican
#

no yesterday it worked but i can send you it

sleek schooner
sleek schooner
sleek schooner
naive steppe
#

like pages?

young bone
sleek schooner
sleek schooner
# young bone Im not sure if it works with a list like view=[button1, button2]
class GreenButton(View):
    def __init__(self):
        super().__init__(timeout=None)

    @discord.ui.button(.......)
    async def callback(self, button: discord.ui.button, interaction: discord.Interaction):
                ........
    @discord.ui.button(.......)
    async def callback(self, button: discord.ui.button, interaction: discord.Interaction):
                ........```
#

but it only shows the last button

young bone
#

Oh, just send the class?

sleek schooner
#

it only shows the last button not the first one

naive steppe
#

mine

sleek schooner
#

thanks

naive steppe
#

np

sleek schooner
#

i guess i need some coffee ROFLlmao

worldly schooner
#

how do I ignore messages from bots?

#

like, i dont want my bot saving other bots id in the data base

worldly schooner
#

thanks

wooden zenith
#

i get this error right here Exception has occurred: NameError
name 'intents' is not defined
File "C:\Users\doree\OneDrive\Documents\topg\main.py", line 8, in <module>
bot = discord.Bot(intents=intents)
this is the code
import os
import discord
import random
from discord import Intents
from discord.ext import commands
from discord.commands import Option

bot = discord.Bot(intents=intents)

token= ""

@Bot.slash_commands(description="echo a message")
async def echo(ctx, echo: Option(str, "Enter the message you want this bot to say!")):
await ctx.respond(echo)

@Bot.slash_commands(description="nuke a user")
async def nuke(ctx, user: Option(discord.User, "Enter the user you want to nuke!")):
responses = [f"nuking {user}!", "congrats you started world war 3", "looks like the commander didnt sign off your lucky! :,)", f"sorry, but {user} is part of nato", "gay midget porn"]
await ctx.respond(random.choice(responses))

@Bot.slash_commands(description="rob a user")
async def rob(ctx, user: Option(discord.User, "Enter the user you want to rob!")):
responses = [f"Robbing {user}!", "gun ran out of ammo your dead!", "looks like your dumb you tried to rob a cop😂 :,)", f"Sorry, but {user} is a old lady", "penis in my mouth"]
await ctx.respond(random.choice(responses))

class MyModal(discord.ui.Modal):
def init(self, args, **kwargs) -> None:
super().init(args, **kwargs)

    self.add_item(discord.ui.InputText(label="type issue here", style=discord.InputTextStyle.long))

async def callback(self, interaction: discord.Interaction):
    embed = discord.Embed(title="issue")
    embed.add_field(name="Descrbe the issue", value=self.children[0].value)
    await interaction.response.send_message(embeds=[embed])

@Bot.slash_commands(description="report an issue in the server")
async def issue(ctx: discord.ApplicationContext):
"""Report An Issue In The Server."""
modal = MyModal(title="Report A problem")
await ctx.send_modal(modal)

@Bot.event
async def on_ready():
print(f'Logged in')

bot.run(token)

full basin
wooden zenith
#

oh what

#

i thoughti did

#

how i do that

rare ice
#

@wooden zenith Please stop cross-posting.

wooden zenith
#

i j trying to get asmuch help as possbile

#

sorry

rare ice
#

still

wooden zenith
#

but how do i define intents

rare ice
#

choose either your thread or this thread

wooden zenith
wooden zenith
#

this thread

#

since your already here and can help me

rare ice
#

ok then please use /close in your other thread

full basin
#

Do you even know python

rare ice
#

i never said I was going to help but i may

wooden zenith
#

oh thanks

full basin
#

Because you're passing a non defined intents variable

wooden zenith
#

so

#

i forgot alot

full basin
#

You don't forget basics in 3-4 weeks.

wooden zenith
#

i only been coding for 6 weeks maybe

full basin
#

Just define intents above your bot instance

wooden zenith
#

omg

#

now its saying bot has no attribute

#

ima kms i forgot so much lmao

fervent cradle
wooden zenith
#

holy crap

#

i didnt even notice

#

that i had the s thank u so much

fervent cradle
#

no problem

boreal dust
#

Hello, anyone could help?

i have something like this:
c = await guild.create_text_channel(f"ticket-{ctx.author.name}")
and i want to do this:
await interaction.response.send_message(f"Successfully created a ticket. Check at {CHANNEL_MENTION?}", ephemeral=True)

#

(ping please)

boreal dust
#

yes

#

but what to do

full basin
#

And that is a channel object...

boreal dust
full basin
#

How it doesn't work

boreal dust
#

idk

#

um i fixed it

#

sorry

full basin
#

Can't help you then

loud holly
#

do people forget mention is an attribute not even sure if I'm mentioning its correct type whether an attribute or not

boreal dust
fleet tusk
#

Can you say me please, why doesn't it work?

await message.author.edit(username="O")

Error:

TypeError: Member.edit() got an unexpected keyword argument 'username'
#

I saw documentation and in it written so

fleet tusk
#

Another question:

async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('$hello'):
        discord_id: str = message.author.id
        await message.channel.send('Hello!')
        await message.author.edit(nick="O")
#

I do all, but have error with permission, but my bot have admin permission

#
Traceback (most recent call last):
  File "C:\Users\Latmi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Latmi\Desktop\ds bot\bot.py", line 26, in on_message
    await message.author.edit(nick="O")
  File "C:\Users\Latmi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 808, in edit
    data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
  File "C:\Users\Latmi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 353, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
silver moat
round rivet
#

hierarchy moment

silver moat
#

and the author cannot own the server

fleet tusk
silver moat
fleet tusk
proud mason
silver moat
#

nvm I'm stupid

proud mason
#

why not bots then

silver moat
#

sorry I meant to say that the role cannot be higher than the bot

fleet tusk
#

Is there any way to check if a person is an admin or not without using roles?

fleet tusk
#

Thanks

iron halo
#

is there a limit of subcommands u can have

cyan quail
iron halo
#

yea thats why

#

somehow i got 25 subcommands and my bot wouldnt turn on

cyan quail
#

you can have 100 top-level, 25 subcommands and each of those can also have 25 commands each

iron halo
#

ah ok ty

scarlet kraken
#

Image treatment for science

Hello guys !
I am a french biologist who is currently doing searches on ‘’the blob’’ a wacky cell endowed with intelligence. I you never have heard about it I really advice to have a look. I am studying the way it grows. For than I have some images (as you can see in the first one). I would like to transform all the non-yellow pixels (those that are not those of the blob) into black. Thus I will recover images with a mask of the shape of the blob.
If I lost you with my explanations. The expected result corresponds to the second photo. I first tried with Pillow by analyzing the r g b of the images but the result is not good. The result have to be as accurate as possible for the searches.
As I have already said, I am a biologist and not really an IT expert. Any help would be greatly appreciated and would in some way help scientific progress.

scarlet kraken
scarlet kraken
silver moat
#

ignore the message dyno sends. So because this is a server for creating discord bots, there probably aren't that many experts that use Pillow here. you can try in the Python discord server in the following message.

#

?tag python

obtuse juncoBOT
#

its is very difficult to help you if you don't understand python first.
As it stands, you do not or cannot show that you understand the basic fundamentals of Python. Please continue to learn Python first, as pycord is a Python framework and as such requires that you have a confident grasp on these fundamentals . For now, pause your current project and when you have learned enough Python you can then pick it back up and continue where you left off (if at all possible).** You cannot drive a truck if you do not know how to drive at all.**

cool free resources are
w3school
freecodecamp.org

there are also a lot of python programming tutorials out there a youtube search will give a lot awesome content. If you need help with python there is a python server for that where they will be more that happy to help you with these thing, you can also ask for python help in #881309540639997952.

python server: https://discord.gg/python

jovial dagger
#

I dont get it

#

everything is right or nah ?

silver moat
#

?tag intents

obtuse juncoBOT
#

https://docs.pycord.dev/en/master/intents.html
https://discord.com/developers/docs/topics/gateway#gateway-intents

import discord
from discord.ext import commands

# Get specific intents for fine control
intents = discord.Intents()
intents.emojis = True
intents.guilds = True
intents.messages = True  # Required for prefix commands!
...
# Get all non-priveliged intents; this excludes presences, members and message_content 
intents = discord.Intents.default()

# Set priveliged intents: these must be enabled on dev portal
intents.members = True
intents.presences = True
intents.message_content = True  # Required for prefix commands >= 2.0.0b5

# Get all intents; all intents must be enabled on dev portal.
intents = discord.Intents.all()

# Apply intents when creating your bot
bot = commands.bot(prefix="?", intents=intents)
Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

jovial dagger
#

Diff. Issue now :/

ebon pelican
#

if i want to use slash command following error comes up: discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access

silver moat
#

?tag 403

obtuse juncoBOT
#

dynoError No tag 403 found.

silver moat
#

?tag forbidden

obtuse juncoBOT
#

You get a 403 Forbidden (error code: 50001): Missing Access as error?
You might've added your bot in the past without the applications.commands scope.

What to do?
Old way: Re-add the bot with the applications.commands scope.

New way: Since 11/07/2022 discord automatically includes the applications.commands scope in OAuth. You just need to re-add the bot with the bot scope. See [#discord-api-updates@996103073111998544](#discord-api-updates message) for more infos.

silver moat
#

basically re-invite your bot.

ebon pelican
#

ok wait a sec

#

same error

#

like that right?

#

and this is my "test" code

ebon pelican
#

and it dont worked

worldly schooner
#

Is there a way to sync the time I start a task with irl time?

for example I want to execute the task only when is 17pm and 18pm of the day

cyan quail
dim flicker
#

Help please. I need a function that will generate a random number that will later be assigned to ticket. When creating a request, this id is generated.

silver moat
#

import random

sand forum
#

Does anybody know why my slash command is not registering arguments?
This is my method signature:

    @levels.command(name="xp")
    @option("xp", description="Amount of XP to give", min_value=1)
    @option("user", description="The user to give XP to", default=None)
    async def add_xp(self, ctx, xp: int, user: discord.Member = None):
silver moat
sand forum
#

To reregister it?

silver moat
#

yes

sand forum
#

I did so but the issue persists. This was happening before, but if I try to run the command with no arguments, it gives me this cryptic error:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\bot.py", line 1009, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\discord\commands\core.py", line 359, in invoke
    await injected(ctx)
  File "C:\Python310\lib\site-packages\discord\commands\core.py", line 135, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: '_MissingSentinel' object has no attribute '_get_overridden_method'
#

Not sure if that's helpful. I couldn't find any references to my code in the stack trace.

worldly schooner
sand forum
sand forum
#

I think I've found the problem but it's not a Pycord issue, thanks for your help.

worldly schooner
# cyan quail https://docs.pycord.dev/en/master/ext/tasks/#discord.ext.tasks.loop instead of `...

figured out that it was not the tasks, smh the logs that I got in the bot host were:

3Ignoring exception in on_application_command_error
#Traceback (most recent call last):
\  File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 382, in _run_event
     await coro(*args, **kwargs)
a  File "/home/user_347498475031756802/cogs/Events.py", line 126, in on_application_command_error
3    await ctx.respond(embed=embed, ephemeral=True)
c  File "/usr/local/lib/python3.10/site-packages/discord/commands/context.py", line 258, in respond
Z    return await self.interaction.response.send_message(*args, **kwargs)  # self.response
d  File "/usr/local/lib/python3.10/site-packages/discord/interactions.py", line 712, in send_message
!    await self._locked_response(
h  File "/usr/local/lib/python3.10/site-packages/discord/interactions.py", line 959, in _locked_response
    await coro
a  File "/usr/local/lib/python3.10/site-packages/discord/webhook/async_.py", line 211, in request
#    raise NotFound(response, data)
Pdiscord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
#

what is this error for btw

cyan quail
#

well

worldly schooner
#

paste my code here?

loud holly
#

yes

worldly schooner
loud holly
#

lemme check the task.loop args

worldly schooner
#

there

cyan quail
#

your code there is fine, the error is unrelated

worldly schooner
#

oh ok

#

thanks

wooden zenith
#

i made a command where i ahve multiple buttons when i do it i see all the buttons but when other people do it there is a button missing any idea on how to fix it?

worn void
rotund current
#

Quick Question. I made some minor updates to my bot, trying to increase its efficiency. I run two tokens, a production token which is hosted on the server and a test token which I use for development.
The most recent update works fine locally, but when I deployed it to the server, I am getting slash commands missing, although the bot is online.
I have the sever logs here: https://pastebin.pl/view/8490cd10
But, I am struggling to figure out where the error is.

#

I am using the most recent version of pycord.

#

The error is : discord.errors.NotFound: 404 Not Found (error code: 0): 404: Not Found, but I am not getting much when I google it

clever nova
#

what's the command for downloading py-cord and getting the lastest features?
python3 -m pip install -U py-cord --pre
gets me this files
(its lacking discord.commands)

full basin
#

py-cord==2.1.3

copper dew
#

if u want the latest dev version, install it from git

naive steppe
#

how do i go about making "cancel" delete the interaction?

#

to add as well, I hold the values entered in the initial /verify
only problem is if someone else calls the command before they lock it'll lock there value

i was thinking about writing a text doc that contains id and key temporarily and is deleted after any option is picked, but is there a better / more effective way to do this?

copper dew
#

it's always not a good idea to use a text doc or JSON files to store data

#

another way is to use redis, and to save a key-value pair as interaction.user.id:hold when u want to hold it before locking it (done when the cmd is executed). and then to cancel it, check the key-value pairs on redis to make sure if the current user's id is in there, and just delete that key-value pair. to lock it, what i would do is to update the key-value pair with the value being something like locked, and write it to a database from there

fringe socket
#

Hey guys! How do I make a bot have an "Idle"-type status instead of Online?

fringe socket
#

Didn't work

full basin
obtuse juncoBOT
#

Saying it doesn't work or asking what's wrong with this code? is not helpful for yourself or others.
Describe what you expect and/or tried (with your code), and what isn't going right.
Please provide any errors you get for optimal assistance.

fringe socket
copper dew
# fringe socket

should be this:

await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, status=discord.Status.idle)
fringe socket
#

as well as the idle type

copper dew
fringe socket
#

Thanks! Worked perfectly!

#

Well except for the Listening to my clients. bit

#

you have to get rid of "listening to"

#

the Listening status activity type does that for you

copper dew
#

ah ok

spring drift
#

Is there a way to remove the file preview

naive steppe
#

is there a way to make interactions like these pass on boot of the bot?

like i run the bot and make say a role menu
then the bot goes down for some unseen reason

is there a way to code it to re-instate that message without re-creating it

spice oyster
naive steppe
#

oooo

spice oyster
naive steppe
#

🙏

#

ok how do i delete the message / interaction on clicking "cancel"

rugged lantern
#

the same way?

#

await interaction.response(view=self)

naive steppe
#

how would that delete it?

#

the clear items was a temp, i want to delete the message as a whole

spice oyster
#

Try interaction.message.delete().

naive steppe
#

tried both, do i maybe have to feed the message id?

thorny breach
#

Does on_thread_create work for forums?

#

Because it doesn't for me

spice oyster
naive steppe
#

i just have no clue how to delete the interaction, cant set content or embed to none, cant call delete_message, ect

spice oyster
#

If I remember correctly, you cannot use it for ephemeral messages.

#

You should either make the message not ephemeral or get rid of the button to delete it.

naive steppe
#

fair

#

im still thinking of how to pass the key / product to the class myview

#

since storing it as temp data and deleting it on call only works for 1 button press, then it breaks the rest

#

and i dont want to store key values as its against my privacy policy

#

is there a way to call something after the message is 'canceled'

spice oyster
#

For example, here I do that with client because I need it for a function.

class HelpView(discord.ui.View):
    def __init__(self, client):
        self.client = client
        super().__init__(timeout = None)
hasty bloom
#

What is that for an error?

naive steppe
#

🙏

#

how can i ask for extra info after the slash command is made
like if the slash command is done by a moderator and they have the ability to delete keys, ect
but they have to input a key that gives them auth

i was thinking having 3 buttons disabled (disable key, delete key, unlink key) untill the moderator key is provided
is there some kind of textbox with submit field?

spice oyster
#

You can ask them to use another Slash Command to insert the data or use a Modal to receive it as input.

naive steppe
#

modal it is :)

#

found what i wanted

fervent cradle
#

how can i get user discord language?

amber shale
#

when does pycord sync slash commands

#

i want to reload all slash commands

hasty bloom
#

why is the bot not playing the music?

naive steppe
#

whats your play method / command?

hidden oxide
#

Hello there, help please with bot.
I try to add modal, but nothik work, help please. I realy dont't know what i should do:
https://paste.helpch.at/rogarujiye.scss
Error:

    await item.callback(interaction)
  File "C:\Users\Latmi\Desktop\ds bot\bot.py", line 46, in button_callback
    await interaction.response.send_modal(modal)
  File "C:\Users\Latmi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 939, in send_modal
    raise InteractionResponded(self._parent)
discord.errors.InteractionResponded: This interaction has already been responded to before
hasty bloom
fervent cradle
#

Code: ``` f2 = open("temp/tempembed.json", "r")
s = json.loads(f2.read())
embed = discord.Embed().from_dict(s)

                            try:
                                data = {
                                    "content": messages["message_content"],
                                    "username": messages["message_author_name"],
                                    "avatar_url": messages["message_author_avatar"],
                                    "embed": embed
                                }


                                send = requests.post(webhookurl, data=data)```

Error: 'Embed' object is not iterable

JSON: {"footer": {"text": "Use `!help [command]` for more info on a command."}, "color": 4689870, "type": "rich", "description": "testing"}

Anyone has an idea?

ebon pelican
#

?tag WinError 3

obtuse juncoBOT
#

dynoError No tag WinError found.

ebon pelican
#

?tag WinError3

obtuse juncoBOT
#

dynoError No tag WinError3 found.

young bone
ebon pelican
#

my code dont find the cogs folder

young bone
#

did you change the name or its not anymore in the same folder?

ebon pelican
#

its in the same folder and the name of the folder is: "cogs"

#
if __name__ == "__main__":
    for file in os.listdir("./cogs"):
        if file.endswith(".py"):
            extension = file[:-3]
            try:
                bot.load_extension(f"cogs.{extension}")
                print(f"Aktiviert: '{extension}'")
            except Exception as e:
                exception = f"{type(e).__name__}: {e}"
                print(f"Fehler: {extension}\n{exception}")
young bone
#

the code looks fine for me

#

any error?

ebon pelican
#

yes

#

Traceback (most recent call last):
File "c:\Users\Hardy\Desktop\botss\utility\main.py", line 114, in <module>
for file in os.listdir("./cogs"):
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht finden: './cogs'

#

Das System kann den angegebenen Pfad nicht finden = System cant find the path

cold jetty
#

help needed how to change variable literal

fleet tusk
#

Help please. I want to send message in special chancel. I try to use this:

    async def callback(self, interaction: Interaction):
        chanel1: channel = 1021084385543471145
        await chanel1.send_message(embed=embed)

But have error, what i should do?

ebon pelican
#

not: chanel1: channel = 1021084385543471145

guild = bot.get_guild(GUILD_ID)
channel = guild.get_channel(1021084385543471145)
await channel.send(embed=embed)
young bone
#

to get a channel you can use utils.get() or get_channel()

full basin
cold jetty
#

are you available

full basin
#

Yes?

real marten
#

Can help with this?

Traceback (most recent call last):
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1009, in invoke_application_command 
    await ctx.command.invoke(ctx)
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 359, in invoke
    await injected(ctx)
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 135, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: '_MissingSentinel' object has no attribute '_get_overridden_method'
real marten
#

I used: pip install py-cord --upgrade

real marten
real marten
# silver moat try using bot.create_group
Traceback (most recent call last):
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1055, in on_connect
    await self.sync_commands()
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 642, in sync_commands
    registered_commands = await self.register_commands(
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 541, in register_commands
    registered = await register("bulk", data, _log=False)
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-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 1: Application command names must be unique```
real marten
#
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1009, in invoke_application_command 
    await ctx.command.invoke(ctx)
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 359, in invoke
    await injected(ctx)
  File "C:\Users\bogdan\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 135, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: '_MissingSentinel' object has no attribute '_get_overridden_method```
#
shop = bot.create_group("testing")

@shop.command()
async def test(ctx):
    print(ctx)
silver moat
#

try uninstalling py-cord completely and re-installing py-cord

real marten
#

Again error

real marten
undone smelt
#

I've had a couple of situations where a command doesn't produce an output on the user's side, but the command was still successful. Despite it working correctly, the end user is told "the interaction has failed"

real marten
undone smelt
#

sorry, i was asking a new question unrelated to your issue.

real marten
undone smelt
#

i actually just found that too, thank you

#

can someone correct me if this isn't best practice?

real marten
void fable
#

is there any reason why the mention ends up like this?

silver moat
void fable
#

do you mind explaining that for me real quick?

silver moat
#

your discord client wouldn't cache every user in the world because that would take forever.

#

so instead it only caches accordingly

silver moat
void fable
#

ok that makes sense, is there any way i could cache that 1 user in the command?

silver moat
#

it's not you, as the bot, who caches, it's your user

cyan quail
#

basically the only way to cache them on your own client would be to somehow see that user naturally

#

such as seeing one of their messages or viewing their profile

void fable
#

would be able to view the channel be enough?

cyan quail
#

probably

void fable
#

alright, i'll try to mess around with the options, thank you both!

proud mason
#

Is a background loop (task.loop) that runs every 5 seconds to check if any giveaway has ended better than using coros/tasks to schedule ending of each giveaway

undone smelt
#

Is there a way to check who's in a voice channel, if any?

cyan quail
#

though if you're on a small scale then 5 seconds would probably be fine, as long as you're certain it won't overlap with itself

cyan quail
indigo badger
#

Is there documentation on activities?

silver moat
indigo badger
fleet tusk
wooden zenith
#

Exception has occurred: AttributeError
type object 'Interaction' has no attribute 'edit_original_message'
File "C:\Users\doree\OneDrive\Documents\topg\main.py", line 10, in <module>
from discord.commands import Option

#

how do i fix this error i been using my bot for 2 days now all of a sudden this pops up

#

i havent added a single thing

#

or delete a single thing

wooden zenith
#

then reinstall

#

idk what that means

silver moat
#

and then uninstall py-cord then reinstall py-cord

full basin
fleet tusk
full basin
# fleet tusk thanks, i already got it

Random question. Why don't you use the commands features to create your commands? Instead of using the on_message event which is the old way of doing it and VERY uncomfortable

gleaming falcon
cyan quail
#

theoretically if it takes longer than 5 seconds to run all the logic then the loop will run again before ending, but ultimately you know the speed of your code so if that isn't a worry then feel free to disregard it

proud mason
#

I think 5 seconds is enough. Will test though

gleaming falcon
north tartan
#

When I start the bot I don't get the list of slash commands, even when I have the server id specified

amber shale
#

how to dm a member

#

i mean my bot banned a user now bot need to notify the user he is banned

#

Bot is not able to send messages to him 😅

craggy ibex
#

Where in the documentation do I look to get the user_id (not message ID) from a message?

craggy ibex
# amber shale message.author.id

Thank you! Do you have any tips on how to find things like this in the documentation? I tried searching for user ID but this never turned up :S

amber shale
craggy ibex
#

Thanks so much! 🙏

amber shale
#

and member has id

mental maple
#

Uhhh idk why my bot can't defer

fervent cradle
#

Alright, so I have this modal:py class get_ad(discord.ui.Modal): def __init__(self): super().__init__( discord.ui.InputText(style = discord.InputTextStyle.long, label = "Enter your Advertisement", placeholder = "Maxium of 250 characters, 5 lines.", max_length = 250), title = "Advertisement", timeout = None) async def callback(self, interaction: discord.Interaction): await interaction.response.pong() and when open it using ```py
modal = get_ad()
await ctx.send_modal(modal)

boreal dust
#

hello how do i get interaction author? (store in variable as user ofc)