#Basic Pycord Help (Quick Questions Only)

1 messages · Page 92 of 1

candid coral
#

I don't understand what is the problem, the code is very simple...

silver moat
#

why not just message.author.roles?

candid coral
#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\User \AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 399, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\User\Desktop\Projects\server\bot.py", line 45, in on_message
    message.author.roles and not "text" in message.content.lower():
AttributeError: 'User' object has no attribute 'roles'```
prisma flicker
#

Do is not None, not not is None
Or just do if message.guild, that already does is not None implicitly

silver moat
prisma flicker
#

Is the member not in the guild? Might want to check that first. Or change it to a fetch

prisma flicker
silver moat
prisma flicker
#

yes

candid coral
prisma flicker
#

Removing a role doesn't fire on_message

#

I don't understand what you're saying

candid coral
#

I don't understand, an error is thrown every time something happens on the server

prisma flicker
#

"something happens"?

candid coral
#

Someone enters and exits the voice channel, any role is removed and given

#

The error I posted above appears

#

All because of this part of the code

#

Without it, everything works as before

prisma flicker
#

Is that the up to date version of your code?

candid coral
#

Wdym?

prisma flicker
#

Is this the code that your bot's running or did you change it since then

candid coral
livid wolf
#

I don't think its Replits issue (Will be not using Replit soon)
But the command is not showing the limit option in the command

grizzled sentinel
winter condorBOT
# livid wolf I don't think its Replits issue (Will be not using Replit soon) But the command ...

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 sentinel
#

Also Ensure that you do not have multiple of the same bot running.
I think replit sometimes can glitch and keep an old program running

hushed lodge
#

I'm quite new to python in general, but have programmed a few basic commands into my bot. right now I'm having issues implementing a 1-day cooldown into a couple commands. I try to add a cooldown according to the pycord documentation, which only includes 2 parameters, but things I read elsewhere ( I think from last year's API redesign) refer to a third parameter that pycord docs do not. I also might be missing something completely basic... a nudge in the right direction would be much appreciated.

river summit
silver moat
silver moat
hushed lodge
#

I've added like 7 different slash commands this way... not saying you're wrong

silver moat
#

commands refers to discord.ext.commands

young bone
hushed lodge
river summit
young bone
#

^

river summit
#

add that ^^

silver moat
hushed lodge
#

before I continue diving down this rabbit hole of coding, I mean.

hushed lodge
#

Okay, just wanted to be sure... like I said very new to coding, didn't know if that was a best practice thing or something

#

Thank you very much for your help, I'm getting different errors now, so progress is happening, I'll be back if I need help

silver moat
candid coral
#

Says pip is not a command

trim cipher
#

add python folder to path variable

candid coral
grizzled sentinel
#

try pip3 list

candid coral
trim cipher
grizzled sentinel
#

^

iron halo
#

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/discord/client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/discord/bot.py", line 1164, in on_connect
    await self.sync_commands()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/discord/bot.py", line 738, in sync_commands
    app_cmds = await self.register_commands(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/discord/bot.py", line 531, in register_commands
    prefetched_commands = await self._bot.http.get_guild_commands(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/discord/http.py", line 365, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access


i made my bot use cogs and it worked on a smaller version but now i put it on the main version and it gives me this

#

google just says enable applications.commands but i already had slash commands so idk why it broke

trim cipher
iron halo
#

it already has it

#

it worked before i used cogs

#

with slash commands

trim cipher
#

🤔

grizzled sentinel
#

Ensure that the bot is in all guilds with the IDs in guild_ids and debug_guilds

iron halo
#

ah ty

#

i thought it was that

#

but clearly didnt upload the file again

candid coral
# grizzled sentinel Can you show your `pip list`
Package           Version
----------------- ---------------------
aiohttp           3.7.4.post0
async-timeout     3.0.1
attrs             22.1.0
chardet           4.0.0
idna              3.3
multidict         6.0.2
pip               23.2
py-cord           2.4.1.dev85+gd519e951
setuptools        57.4.0
style             1.1.0
typing_extensions 4.3.0
update            0.0.1
yarl              1.8.1```
grizzled sentinel
#

And you are sure that you are not in a DM?

prisma flicker
#
@client.event
async def on_message(message):
    member = await message.guild.fetch_member(message.author.id)
    if not member:
        return
    if message.guild and discord.utils.get(message.guild.roles, id=1131159247879680021) in member.roles and not "text" in message.content.lower():
        await message.delete()
        await message.channel.send("Wrong form.", delete_after=10.0)```
#

can you try this @candid coral

candid coral
# prisma flicker ```py @client.event async def on_message(message): member = await message.gu...
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 399, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\User\Desktop\Projects\server\bot.py", line 44, in on_message
    member = await message.guild.fetch_member(message.author.id)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\guild.py", line 2034, in fetch_member
    data = await self._state.http.get_member(self.id, member_id)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 367, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10013): Unknown User```
#

New error ✨

#

Appears under the same conditions as I described above

prisma flicker
#
@client.event
async def on_message(message):
    try:
        member = await message.guild.fetch_member(message.author.id)
    except:
        pass
    if not member:
        return
    if message.guild and discord.utils.get(message.guild.roles, id=1131159247879680021) in member.roles and not "text" in message.content.lower():
        await message.delete()
        await message.channel.send("Wrong form.", delete_after=10.0)```
@candid coral
candid coral
# prisma flicker ```py @client.event async def on_message(message): try: member = awa...
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 399, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\User\Desktop\Projects\server\bot.py", line 48, in on_message
    if not member:
UnboundLocalError: local variable 'member' referenced before assignment```
grizzled sentinel
candid coral
#

He has admin permission

grizzled sentinel
#

Nevermind then

candid coral
#

I'm confused...

grizzled sentinel
#

Do you mind creating a help thread and showing all of your code. minus commands

candid coral
#

Consider @client.event and Cogs?

grizzled sentinel
#

all events. Cogs minus the commands

#

so only if you have other stuff in the cog

candid coral
#

There are only commands

grizzled sentinel
#

ok then just the main file with all of the events and set up code

prisma flicker
elfin dagger
#

you could save a whole 2 lines by returning in the except instead of using an if statement 😎

prisma flicker
prisma flicker
# candid coral ```py Ignoring exception in on_message Traceback (most recent call last): File...
@client.event
async def on_message(message):
    member = None
    try:
        member = await message.guild.fetch_member(message.author.id)
    except:
        pass
    if not member:
        return
    if message.guild and discord.utils.get(message.guild.roles, id=1131159247879680021) in member.roles and not "text" in message.content.lower():
        await message.delete()
        await message.channel.send("Wrong form.", delete_after=10.0)```
@candid coral
silver moat
#

NoneType cannot be casted to Optional[Member]

prisma flicker
silver moat
#

oops I forgot the /j

whole adder
#

This might not be the right place to ask but.
Is there a way I can get the date someone left the server my bot is in?

prisma flicker
#

Oh you want a if message.guild above all of that actually

prisma flicker
whole adder
slender abyss
#

how does this work

#

i want to have a group of items

#

like a list of items with back button that gives me another set of items to add in my view

round rivet
#

use ui.Button or ui.Select instead

slender abyss
#

i use those as of now but i need a way to wrap up multiple ui.Item in one group so i can change/switch with a button which set of items i need

slender abyss
#

how can i achieve that?
i dont want to switch views everytime i want to go back to previous set of items?

gentle tundra
#

how would i check if a user (by id of user) has an role

real frost
#

Hi guys, if i pass parameters through the view like in the attachment will it cause some troubles like two peoples using this view with different param and it mixing it up?

grizzled sentinel
# slender abyss how can i achieve that? i dont want to switch views everytime i want to go back ...
grizzled sentinel
# gentle tundra how would i check if a user (by id of user) has an role

First, User refers to an entire discord account. Member refers to a profile per guild.
You would need to get the guild and then the member via https://docs.pycord.dev/en/master/api/models.html#discord.Guild.get_member
Then check https://docs.pycord.dev/en/master/api/models.html#discord.Member.roles

proud mason
#

.rtfm bot.get_guild

proud mason
#

To get the guild by id ^

grizzled sentinel
summer rock
#

Is there a way to add one more button in bot profile? Not just invite to server

grizzled sentinel
#

Possibly via the activity ("Now Playing: ...")
But no way to do it easily

summer rock
grizzled sentinel
summer rock
#

okay

grizzled sentinel
fervent cradle
#

How can I send a ephemeral message when someone click the button?

grizzled sentinel
#

Just set ephemeral = True in interaction.response.send_message

fervent cradle
#
await interaction.response.send_message("blank", view=MyView2(), ephemeral=True) 
#

this is my code but still not working

#

when i set ephemeral to False i see bot is responding to it self

grizzled sentinel
#

Sorry, I have to go. If you could post the entire callback to the button that would be great. Someone else should be here to help in a bit.

fervent cradle
#

Somehow my problem solved, but thanks anyway

whole adder
#

I'm using on_message to read every message, but it only can see my messages and its self

wet coral
whole adder
wet coral
#

and you do set the intent in you bot?
like discord.Intents.all() or something that includes messages?

whole adder
#

Yes discord.Intents.all()

wet coral
#

What happens when other users send a message? Do you get an error, or just nothing?

whole adder
#

Just nothing

proud mason
#

Also show the contents of your event

whole adder
#

Ok ill put it in a pastebin

rare ice
#

Why would user.mutual_guilds not be showing all the guilds I have in common with the bot?

whole adder
errant craneBOT
young bone
whole adder
#

Its becuase its passing in intents through the abot class to the discord.Bot class from a differnet file. The one in all caps is from another file

rare ice
rare ice
rare ice
# whole adder Where?

Line 44

await bot.get_channel(message.channel.id).send(f"Message by {message.author.name} translated\n{content}\n{translated}")

#

You’re getting the channel you already have

whole adder
#

I didnt notice that

#

I think I've fixed it, it wasnt an issue with my code. It was an issue with the config.json file im getting data from

naive remnant
#

button event handler ?

real frost
#

Wat

#

Like on click/??

naive remnant
#

yes

naive remnant
slender abyss
#

and im currently make it work by adding and removing items

grizzled sentinel
grizzled sentinel
slender abyss
#

somthing like this in pycord?

grizzled sentinel
#

This should cancel the timeout

slender abyss
#

like i have some view variables that i want to access can i still access them even after i stop it?

grizzled sentinel
#

You should still be able to. That way would only work for having 2 views though. Not changing the components of the original.

grizzled sentinel
slender abyss
grizzled sentinel
#

I meant 2+ views.

Changing the components of a view constantly just does not make a lot of sense. It makes more sense to create a new one than remove then add.

slender abyss
#

i will try it thank you

wet coral
#

Can the components of multiple active and persistent views have the same custom_id? As long as they refer to the same class it should be ok, right?

naive remnant
true pewter
#

I have seen that in the documentation you can set the default permissions when creating the group but I don't understand how it works. I only know how to do it in the method itself.

    ban = SlashCommandGroup("ban", "Commands for ban a user from the server",
                            guild_only=True,
                            permissions=["administrator", "ban_members"])

In def

    @guild_only()
    @ban.command(name="add", description="Ban a user from the server")
    @discord.default_permissions(
        administrator=True,
        ban_members=True
    )
def metod
naive remnant
#

.rtfm on_button_click

winter condorBOT
#

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

naive remnant
#

no events for buttons??

#

just a callback func ?

full basin
#

Everything goes through on_interaction

naive remnant
wet coral
#

Do I have to use discord.Option(int) or will a simple int also do the job?

wet coral
#

ok, but obviously Option should be used when passing a choice or autocomplete or description etc

naive remnant
silver moat
#

The intention of the component system is to use callbacks, not handle them through events

round sorrel
#

How to add options?

errant craneBOT
#

Here's the slash options example.

round sorrel
#

thanks

wet coral
#

Is it possible to have different command descriptions for dms and guilds?

wet coral
#

😢

grizzled sentinel
errant craneBOT
#

Here's the confirm example.

wet coral
#

what's the best way to add checks in a cog to all commands?

proud mason
wet coral
#

and how can I use the commands.checks in there?

proud mason
wet coral
proud mason
#

so basically

wet coral
#

ok thanks

proud mason
#

return await commands.has_role(...).predicate(ctx)

wet coral
#

I was looking for that

proud mason
#

smth on those lines

candid coral
#

So many problems from one call message.author.roles...

#

I think I'll create a support ticket

#

Because of this, the bot does not respond to commands. I'M ANGRY

#

😠

prisma flicker
candid coral
prisma flicker
#

.rtfm process_command

prisma flicker
candid coral
prisma flicker
#

.tias

winter condorBOT
candid coral
#

It works, thank you a lot

candid coral
#

What is the best way to store time information?

silver moat
ancient trench
#

someone worked with odm beania?

spring hare
quick temple
#

Is there a way to use a discord.Option with a bridge command?

quick temple
# young bone yes

how would I go about doing that? currently I have this

@bridge.bridge_command(name="test")
async def test_command(self,
                        ctx: CustomContext,
                        user: Option(
                            User,
                            description="Target User",
                            required=False,
                        ) = None):

This is currently not working when i use the non-slash command and I get this error Converting to "Option" failed for parameter "user"

young bone
#

And User?

quick temple
#

CustomContext is just

class CustomContext(BridgeExtContext):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.chain_id = uuid.uuid4().hex

and user is discord.User so "from discord import User"

grizzled sentinel
quick temple
frank lava
#

Can you use FlagConverters in slash commands to avoid duplicating sets of args across several commands?

#

When I try to do this, I encounter a...
TypeError: Flag.__init__() got an unexpected keyword argument 'name'

signal sandal
#

anyone ever done a on error, send webhook to channel?

rough roseBOT
#

This thread is meant for general help.

If you need deeper library help, please create an own thread.

Keep the #help-rules in mind, or you might not receive any help.

silver moat
#

not first

waxen whale
#

pff

#

@errant crane @finite timber @civic jay @obtuse junco

echo egret
#

is it possible to execute an async function in a cog (which is in an extension) when it is loaded?

fleet parcel
#

Is there any examples or anything of how to create options in cogs tried a couple examples and none are working

fleet parcel
#

thanks

echo egret
# silver moat `asyncio.run`?

thank you very much!
however I also have to wait for the bot to be ready and when I execute bot.wait_until_ready() I get an error RuntimeError: Task got Future <Future pending> attached to a different loop

#

this is an asyncio error and I can't manage to solve it

#

i think i will make a thread for this

wooden lodge
#

New General help huh

#

I want to make a terminal / console command but i do not know how i can manage to get this to work.
I want to make a simple terminal command that sends a message in a specific channel. Any solutions for this?

woeful spindle
wooden lodge
#

ocess_commands
if message.author.bot:
AttributeError: 'Command' object has no attribute 'author'

drowsy python
#

is there a way to manually raise a commands.CommandError? i forgot if it's possible or not and i'm not sure how to do so in the api docs, trying to make my error handlers rn

slender shuttle
#

Is there a way to access to a message's view?

silver moat
slender shuttle
silver moat
slender shuttle
fervent cradle
#

how can i format a date to be like " blank days ago"

slender shuttle
fervent cradle
#
duration = (dt.now() - author.joined_at).days
slender shuttle
fervent cradle
#

um ok

dim blade
rare ice
#

this isnt the place to ask that as that's not related to pycord.

dim blade
waxen whale
#

Something else

candid nexus
#

^

rare ice
#

^

grizzled sentinel
dim blade
#

like i have 25 choices for one option and multiple options, i dont want to create an Optionchoice object for every choice i have, it takes way too long and there must be an easier way, thats what i am asking for, if anyone has an example on it or knows a way to do it

grizzled sentinel
#

It is not required to make them into OptionChoice objects. You can just pass a list. Unless of course you need localization or alternate values.

#

Option(choices=["hi",])

grizzled sentinel
dim blade
woeful spindle
#

Where can I find info about subclasses & classes?

grizzled sentinel
#

I think you could do a simple for loop

choices=[]
for i in range(len(names)):
    choices.append(OptionChoice(name, value))
grizzled sentinel
grizzled sentinel
woeful spindle
grizzled sentinel
woeful spindle
#

Anyone know how I would go around trying to create top.gg vote logs?

fallen cove
#

is it possible for 1 option in a slash command to effect the content in a different option?
(i.e option 1 can give 3 different sets of options for option 2)

silver moat
fallen cove
errant craneBOT
#

examples/app_commands/slash_autocomplete.py line 110

async def get_animals(ctx: discord.AutocompleteContext):```
silver moat
#

that’s the related docs

fallen cove
#

thanks

echo egret
#

wat

#

anyway is it possible to compare 2 PermissionOverwrite?

#

I know it is possible with Permission but I tried with PermissionOverwrite and it didn't work

silver moat
echo egret
silver moat
#

read their docs

#

and join their server

fallen cove
#

in slash options can a option be coloured like a role option?

white wadi
#

I found a 7 month old question about listeners and the say, the limit of them is 25. I tried to find that information in the pycord docs and didnt find it, am I just blind or was the limit removed?

silver moat
river dove
#

Guys how do I show my bot is using pycord in #creations

white wadi
spiral sail
#

Little stuck, getting this error:

    async def airingsub(ctx, method, args):
  File "C:\Users\nicho\PycharmProjects\Rimuru\ve1nv\lib\site-packages\discord\commands\options.py", line 312, in decorator
    type = type or func.__annotations__.get(name, str)
AttributeError: 'BridgeCommand' object has no attribute '__annotations__'
white wadi
silver moat
spiral sail
river dove
white wadi
river dove
white wadi
#

well then ig you have to options, somewhere publish the code, so they can verify its made with pycord or dont use that channel

silver moat
#

read pins: #creations message

waxen whale
#

#help-rules §2

fervent cradle
silver moat
obtuse juncoBOT
waxen whale
loud holly
#

So I have heard that mongodb is slow on python, are there any alternates data base or should I stick to it?

The execution time for that is around 4 seconds which is a lot

silver moat
loud holly
silver moat
#

depends on your implementation

loud holly
#

If any of them are better in terms of speed I’ll take it

loud holly
#

And when I do say /work

#

It takes around 4 second to finish executing

#

First to run through the docs to check if the user id is stored in there

#

And then sends in F in the channel

silver moat
#

I used to use mongodb and never had that problem

loud holly
#

Imma try a different way and see if it’s fixed

silver moat
#

It shouldn’t take that long

candid nexus
#

Sometimes it’s also wherever the db is located

silver moat
#

what mongodb wrapper are you using

loud holly
#

Do you use with ....

#

With pymongo.ClientMongo(...) as Client

silver moat
silver moat
loud holly
loud holly
loud holly
silver moat
#

yes

full basin
#

I use motor and its not slow

silver moat
loud holly
silver moat
#

no

fervent cradle
#

how do i send an image through replit files?

candid nexus
fervent cradle
#

yeah

#

nt how it works in replit

#

i dont want link to be showing?

rare ice
#

That’s like that regardless of your IDE/host.

#

You either have to send it as a file or have no other content besides the link.

nova minnow
#

hello its 3:30am im at my last straw but want to get atleast something running, why arent the slash commands showing up when i try to post them in my server?

#

i know its probably shitcode but im very new

#

the top image is the main file

silver moat
nova minnow
#

It is

rare ice
nova minnow
#

Oh wait, I didn't even see the error, thanks

#

Huh wait why self.get_quote? That's the name of the command iirc

fervent cradle
nova minnow
#

yeah

fervent cradle
nova minnow
#

Nope

#

Imma get a good sleep and look at it tomorrow again. I think I'm missing something basic but I'm too tired too see it, thank you anyways though

night cargo
#

with modals, Can you specify input type? (eg. string, int)

fierce elm
uneven yoke
#

I seem to have a problem with persistent views. Below is my code and i think it should wprk but still when i restart the bot the buttons wont work. Can someone help me find the mistake as there isnt any error too.

class Myview(discord.ui.View):
    def __init__(self, timeout=None):
        super().__init__(timeout=timeout)

class testbot(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    
    @commands.Cog.listener()
    async def on_ready(self):
        self.bot.add_view(Myview())

    @commands.command(name="test")
    async def test(self, ctx):
        view = Myview()
        b1 = Button(label="test", style=discord.Buttonstyle.grey, custom_id="test1")
        view.add_item(b1)
        async def b1callback(interaction):
            await interaction.response.send_message("HI")
        b1.callback=b1callback
        await ctx.reply(content="Button test", view=view)
night cargo
#

with modals, Can you have the user choose from a list of prefined options

fleet parcel
#

how do i edit a interaction that has already been responded to?

trim cipher
#

What's this?

silent isle
#

AttributeError: 'Member' object has no attribute 'add_role'

#

can someone help?

#
async def on_member_join(member):
    guild = bot.get_guild(998188595372367913)
    channel = guild.get_channel(998218612848459877)
    embed = discord.Embed(
        color=0x3498db
    )
    embed.add_field(name=f"Someone Just Joined This Server !", value=f"**Welcome To Server {member.mention} !**")
    embed.set_image(url="https://media.giphy.com/media/AFdcYElkoNAUE/giphy.gif")
    await channel.send(embed=embed)
    role = get(member.guild.roles, id=998469564289536061)
    await member.add_role(role)```
echo egret
#

I want to make a restart command, does Client.close() also logs the bot out so I can Client.start() after that ?

lost lodge
#

Guys, is there a on command event?

#

So i mean to block it when it isn‘t aktivated

naive remnant
echo egret
#

how can I get the traceback in on_application_command_error ?

cold storm
#

Hi i was wondering if any one has any code or advice on the guilds.join endpoint in pycord/discord api and if any one had any packages that could help a user join a server when they add a bot

hardy rune
#

What is the best way to handle the "Not connected to voice" error, when the bot is connected to voice? Like how do I reconnect the best way?

grizzled sentinel
grizzled sentinel
echo egret
#

wdym?

grizzled sentinel
#

Dangit forgot to paste the code lol

""​.​join​(​traceback​.​format_exception​(​type​(​error​), ​error​, ​error​.​__traceback__​))​

echo egret
#

so if i use this inside an on_application_command_error event i can get the full traceback ?

grizzled sentinel
#

Full traceback including the error I belive.

echo egret
#

lemme try

#

yo why do you have unicode chars?

grizzled sentinel
grizzled sentinel
echo egret
#

ok

#

it worked perfectly thx!

#

this gonna help me so much for debugging

grizzled sentinel
loud holly
spiral sail
#

Uhhh, got a little problem. Is it just me or does command cooldowns not work at all (prefix commands and slash commands) when client = bridge.Bot?

loud holly
#

how are you using the command cooldown?

spiral sail
#

async def on_application_command_error and on_command_error

#

They worked originally when I didn't switch to the bridge system on the client

#

But no errors in the console are spouted, like its ignoring the cooldown completely for Bridge

fervent cradle
#

Im getting this JavaScript error when I run my bot

spiral sail
#

Doesn't look like I'm doing anything incorrectly

loud holly
#

are you using bridges?

spiral sail
loud holly
#

yeah bridge* lemme check the docks

spiral sail
#

lol autocorrect moment

#

Thanks, please let me know what you find, I've tried looking but ....kinda didn't find much

loud holly
#

I'm a bit confused what's the difference between bridge and commands

spiral sail
#

Bridge is prefix + slash

loud holly
#

isn't commands the same thing?

#

but you have to state it

spiral sail
#

So e.g. if I had a command called .hello, I could also do /hello

loud holly
#

ohh

loud holly
spiral sail
spiral sail
loud holly
#

wait no that won't work

fervent cradle
#

I keep getting a JavaScript error when I try to run my bot

loud holly
spiral sail
loud holly
#

try doing

#

do Bridge. and then scroll down onto the options until u see cooldown or something related to cooldown

spiral sail
#

For pycord, is there an async for ....a check before a command is executed?

spiral sail
#

WHAT

#

Cooldown works in my main.py file! But not in cogs

fervent cradle
#

I keep getting a java script error in my replit discord bot whenever I try to run it

spiral sail
fervent cradle
#

Idk

#

I’ll not at my computer

#

But it’s like <JavaScript> html error something with weird numbers

fervent cradle
#

?tag replit

obtuse juncoBOT
fervent cradle
#

oh oops

#

You should not use Repl.it to host your bot.

While this may seem like a nice and free service, it has a lot more caveats than you might think, such as:

  • The machines are super underpowered.

    • This means your bot will lag a lot as it gets bigger.
  • You need to run a webserver alongside your bot to prevent it from being shut off.

    • This isn't a trivial task, and eats more of the machines power.
  • Repl.it uses an ephemeral file system.

    • This means any file you saved via your bot will be overwritten when you next launch.
  • They use a shared IP for everything running on the service.
    This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you.

Please avoid using repl.it to host your bot. It's not worth the trouble.
See ?tag vps in testing if you want a list of decent hosts (there are no free hosts).

https://intuitiveexplanations.com/tech/replit/

#

easy fix tho just go into shell and type kill 1

loud holly
#

does anyone have knowledge in mongodb itself? I have been running in runtime error and that the insert_one does not have await when it does have await into it

#
@bot.slash_command()
async def work(ctx):
    Mongo_DB = Client["Folder"]
    Collection = Mongo_DB["Collection"]

    
    async def do_insert():
        document = {
            "__id": ctx.user.id,
            "Balance": 100
        }

        await Collection.insert_one(document)

    Loop = Client.get_io_loop()
    Loop.run_until_complete(do_insert())
   

    await ctx.respond("Hello")
#

I have defined Client (in case you were wondering)

#

This async function of do_insert() works when I remove the async def work and only keep that async function with no issue

loud holly
#

GRIEF
Tried to put it into a synchronous function, same error

fervent cradle
fervent cradle
fervent cradle
#

Install pycord fixes up bans?

fervent cradle
fervent cradle
fervent cradle
#

I’m on chrome book

#

So replit is the only one I can use

loud holly
#

press on the shell

fervent cradle
#

Ik how to kill the thing

#

I’ve been using replit for years and this has never happen

storm geode
#

can i use embed.set_image() with a file on my pc?

loud holly
#

@fervent cradle btw you have any idea on why I'm getting the error that I am?

loud holly
#

I used await since it is async but idk

#

i believe squid uses the same lib as I do, so he knows it better

fervent cradle
smoky forge
storm geode
#

oh im blind

loud holly
storm geode
#

embed.set_image(url=f"attachment://temp/1689945.png")
would work?

smoky forge
storm geode
smoky forge
#

and it has to be the same filename as the file you upload

loud holly
smoky forge
#
file = discord.File("path/to/my/image.png", filename="image.png")
embed = discord.Embed()
embed.set_image(url="attachment://image.png")
await channel.send(file=file, embed=embed)
storm geode
#

hmm

#

im guessing i have to save it to the main dir then

#

not into a folder

smoky forge
#

no?

#

like you see in the code one thing is creating the File and the other one is accessing the attachment

storm geode
#

oooh wait

#

i have to do discord.File and attachment://image.png?

smoky forge
#

create the file object

#

with the directory and the file

#

then in set_image you put attachment:// and the file name without the directory

#

and then in the message you send the embed and the file

storm geode
#

ooh ive got it working

#

thanks

#

i was just forgetting to put file=file

loud holly
loud holly
fervent cradle
#

I dont think so

#

maybe just use module name.Client

signal stratus
#

How can I make the output of fetchall a list?
It is so called a list but the content is in () which I don't want.
Can anyone help me?

loud holly
fervent cradle
#

nice

loud holly
#

I had to await the function

fervent cradle
#

oh

loud holly
#

yeah however there's still the error of runtime which it does add data to the db

#

but you can't do anything after the loop.run...

dim blade
#

the autocompletion example on github shows how to make option choices dependent on other options, is it possible to do that also if there is no autocompletion context because i dont want to use autocompletion?

rare ice
#

b!rtfm pyc discord.Option

rare ice
#

first one

dim blade
rare ice
#

try flipping the options in the example to your liking and seeing if that works

fervent cradle
#

guys im at my pc now

#
<script>(function(){window['__CF$cv$params']={r:'72cca4a41ca05fce',m:'74hOO.IvYVzl.0V8igG5_LF2EGBEpQavKHTsoNmHRKI-1658162258-0-AXrbXOJ9pCArUb2WO21FC3vxo2+9jhMC4bOEmWwYHtaQ+Xz1vI3iM7SOwikcpfjzid3geud4p0NIUINZfPGm3EffLuucc+mkcjh8TsUL8rN6DlR6opXS2G0aATs973TPKOegqSLW2LQDIbhFkvVnxEs=',s:[0xe2c0873413,0x4a0765fba0],}})();</script></body>
</html>
fervent cradle
#

i read up on it and i got banned somehow

fervent cradle
silver moat
#

what does that mean

fervent cradle
#

cause if i want it in multiple servers its gonna be dificult

silver moat
fervent cradle
#

i have it currently that it defines a channel by the id, but if its in a different server its gonna say that there isno channel with that id

#

a channel

#
channel = bot.get_channel("departures")
#

like that

fervent cradle
#

dude

#
@bot.event
async def on_member_join(member):
    channel = discord.utils.get(ctx.guild.channels, name=given_name)
    db[f"{member}"] = "none"
    await channel.send(f"{member.mention}, Take Off Granted, Happy Trails! ")
    await member.send(f"{member.mention}, please type your Sky Warriors In-Game Username - !SetUser (In Game Username)")
#

it says ctx is not defined

silver moat
#

member,guild

fervent cradle
#

oh ok

fervent cradle
silver moat
#

It should be a string :0

fervent cradle
#

it says departures is not defined

#

oh

#
    departures = "departures"
    channel = discord.utils.get(member.guild.channels, name=departures)
#

like that?

silver moat
#

yes

gilded niche
#

Hi, i would like to send an ephemeral message to someone who gives a reaction, but i can't seem to let it work. Can someone help me?

full basin
gilded niche
full basin
#

A reaction event is not an interaction

gilded niche
#

Ok thanks

white wadi
#

if my bot says this error , does it mean it got banned?

Traceback (most recent call last):
  File "D:\p-bot-2.0\venv\lib\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "D:\p-bot-2.0\venv\lib\site-packages\discord\bot.py", line 1041, in on_connect
    await self.sync_commands()
  File "D:\p-bot-2.0\venv\lib\site-packages\discord\bot.py", line 643, in sync_commands
    registered_guild_commands[guild_id] = await self.register_commands(
  File "D:\p-bot-2.0\venv\lib\site-packages\discord\bot.py", line 472, in register_commands
    prefetched_commands = await self.http.get_guild_commands(self.user.id, guild_id)
  File "D:\p-bot-2.0\venv\lib\site-packages\discord\http.py", line 354, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access```
silver moat
white wadi
silver moat
#

what did you do?

white wadi
#

well i created and deleted a bunch of channels

#

like in hunderts

#

on my testing server

silver moat
#

that's not a problem

white wadi
#

and created thousands of webhooks

silver moat
#

yeah that's fine

white wadi
#

one server started telling me internal server errors when i tried to edit a channel

#

one of the testing servers

crimson sundial
#

Is there a way to handle all button clicks in a function? like on_message or on_member_join but for interactions specifically buttons

crimson sundial
silver moat
white wadi
loud holly
#

are you using asyncio or the tornado one?

silver moat
#

but it's really just preference

loud holly
#

sick!

#

I got an issue where it says run time error

#

nothing happens or crashes

silver moat
#

I'm using asyncio because I've been used to it in other projects

silver moat
loud holly
#
@bot.slash_command()
async def work(ctx):
    Mongo_DB = Client_Link["Folder"]
    Collection = Mongo_DB["Collection"]
    await ctx.respond("Hello")
    
    async def do_insert():
        document = {
            "_id": ctx.user.id,
            "Balance": 100
        }

        await Collection.insert_one(document)
    


    
    Loop = Client_Link.get_io_loop()
    await Loop.run_until_complete(await do_insert())
silver moat
#

since you are in an async

#

so just

await do_insert()
loud holly
#

so I'd use that only if I want to add in more data?

silver moat
#

instead of ```py
Loop = Client_Link.get_io_loop()
await Loop.run_until_complete(await do_insert())

silver moat
loud holly
#

Hmmm, I think I understand???

white wadi
silver moat
#

because if one of your guild_ids were that guild

#

that error would happen

white wadi
#

how can i fix this? or will it fix automatically after some time?

loud holly
silver moat
#

If you are in a non-async environment and this still occurs, install nest_asyncio

fervent cradle
#
default 'except:' must be last
fervent cradle
silver moat
silver moat
#

read

fervent cradle
#

cant u just tell me?

silver moat
#

?tag nohelp

obtuse juncoBOT
#

Nobody helps you? See #help-rules §2, then you know why.

rare ice
fervent cradle
#

nvmd i figured it out

fervent cradle
#

Hello, I need someone to show me how to add simple button to a command in a normal file not a cogs file.

#

please and thanks

next coral
#

Hello, i am having an issue with getting the image to post in the embed, it posts them separately. ive looked it up everywhere and it all days to do this but it just doesnt seem to work

        embed = discord.Embed(title="Squad Maps", color=color)
        embed.set_footer(text=f'Created By {me} | [ {random.choice(embedQuotes)} ]', icon_url=f"{iconLink}")

        if select.values[0] == "AAS V1":
            file = discord.File("./assets/maps/Al Basrah AAS v1.png", filename="Al Basrah AAS v1.png")
            embed.set_image(url="attachment://Al Basrah AAS v1.png")
            await interaction.response.send_message(file=file, embed=embed)
errant craneBOT
#

Here's the confirm example.

full basin
#

@fervent cradle

fervent cradle
next coral
solid agate
#

I'm at a loss,

Why does this cog not load?
It doesnt give any errors on loading it, it just... doesn't do anything...

from discord.ext import commands
from utils import logger

log = logger.logger


class Flare(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.web_server.start()
        self.app = web.Application()
        self.routes = web.RouteTableDef()

        @self.routes.get("/")
        async def welcome(request):
            return web.Response(text=f"{self.bot.user.name} is Online!!")

        self.app.add_routes(self.routes)

    @tasks.loop()
    async def web_server(self):
        runner = web.AppRunner(self.app)
        await runner.setup()
        site = web.TCPSite(runner, host=None, port=self.bot.port)
        await site.start()

    @web_server.before_loop
    async def web_server_before_loop(self):
        await self.bot.wait_until_ready()


def setup(bot):
    log.info("Loading Flare Cog...")
    bot.add_cog(Flare(bot))
#

Like, it seems like it doesnt even trigger the setup(), as the info log is empty.

fervent cradle
#

Is there a limit for slash commands?

solid agate
#

100 global, 100 server specific

fervent cradle
#

Thanks

fervent cradle
#

as u have to tell it to load the cogs in the main file

solid agate
#
cu_cogs_extensions = ["flare"]
    cu_cogs_folder = "crawler_utilities.cogs"
for extension in cu_cogs_extensions :
  bot.load_extension(f"{cu_cogs_folder}.{extension}")
#

This is not my first rodeo. And all cogs work just fine. It's this specific one that fails to load.

#

or rather, isn't loading at all, as it's not failing.

fervent cradle
#

New slash commands are not showing. My old slash commands work

solid agate
#

global commands take roughly an hour to appear

fervent cradle
#

I use guilds_id = []

#

I did them the same as my old

storm geode
#

so in slash commands i have
editlater = await interaction.response.send_message("message here")

it waits ~10s due to processing then

await editlater.edit_original_message(content="Message 2")

And then waits for a response with a limit of 180s
if the user responds it manages to successfully edit the message again by using the same thing however when i try to delete the message when it fails it gives me a error saying unknown message

#

how would i delete the edited message?

#

ive tried

n = await editlater.edit_original_message(content="")

await n.delete()

And

await editlater.edit_original_message(content="")

await editlater.delete_original_message()
#

nvm

#

it stopped working on the succesfull part iswell

#

now its
AttributeError: 'NoneType' object has no attribute 'fp'

storm geode
#

how would i go about using py-cord in replit

#

ive installed it in the packages however it keeps trying to install discord.py when ran

south wolf
#

Does pycord still have support for selfbots?

shrewd dome
#

selfbots are against ToS

silver moat
#

then follow instructions from

rare ice
silver moat
#

?tag replit

obtuse juncoBOT
storm geode
silver moat
storm geode
#

oh

storm geode
rare ice
storm geode
#

i installed all the packages and then deleted poerty now it works. however. it doesnt load cogs 😭

guess ill have to find a old project

woeful spindle
#

or just don’t use replit

#

🤷‍♂️

silver moat
#

they could be on a chromebook

#

¯_(ツ)_/¯

woeful spindle
#

still could use other hosts

smoky forge
#

Is there a way to use ctx.reinvoke() with slash commands?

#

Like if you want to override a cooldown if you're the bots owner

storm geode
viscid hamlet
#

i ask for your help once again @storm geode

storm geode
#

hi

viscid hamlet
#

is it possible to pass information to a view

#

I have a bot that will generate a view with buttons

storm geode
#

ooh

viscid hamlet
#

before I even send this

#

a user fills a form with a link or something

#

I want to be able to pass the "link" or any piece of information specifically to that button

#

so if i press get points button

storm geode
#

tbh i have no clue

viscid hamlet
#

okay , ty tho

storm geode
#

i think it shoukd be possible

signal stratus
#

How can I do that things are suggested there that you can enter?

errant craneBOT
#

Here's the slash autocomplete example.

smoky forge
#

try this @signal stratus

signal stratus
#

thx

viscid hamlet
#

~can a view have a custom id?~

#

nvm they cant

smoky forge
#

nope but the items can

junior wedge
#

Can you add a modal in a slash command group? I'm having issues with it

full basin
#

Yes you can

junior wedge
#

Mine is just saying that the modal class is not reachable

full basin
#

Traceback?

junior wedge
#

Nah this is just from VSC

#

Imma run it to test

full basin
#

What does VSC say exactly

fervent cradle
#

I need to impress ppl

#

What can I add to a discord bot

junior wedge
#

if i put it in a regular slash command everything is fine

fervent cradle
#

Show full code my man

junior wedge
#
class DescriptionModal(discord.ui.Modal):
    def __init__(self, bot, *args, **kwargs) -> None:
        self.bot = bot
        super().__init__(*args, **kwargs)
        self.add_item(discord.ui.InputText(label="Server Description",value="Your server description\nGoes here",style=discord.InputTextStyle.long))

    async def callback(self, interaction: discord.Interaction):
        embed = discord.Embed(
            title="Your Server description is set",
            fields=[
                discord.EmbedField(name="Server Description", value=self.children[1].value, inline=False),
            ],
            color=discord.Color.random(),
        )
        await interaction.response.send_message(embeds=[embed])
                
    
class Test(commands.Cog,name='Test'):
    def __init__(self,bot):
        self.bot = bot```

```py
    test = SlashCommandGroup('test','Testing command')
    @test.command()
    @commands.has_permissions(manage_guild=True)
    async def desc(self,ctx: discord.ApplicationContext):
        """Sets the description of the server where the command is used"""
        async with aiomysql.connect(DATABASE INFO) as db:
            db_cur = await db.cursor()
            await db_cur.execute("""SELECT * FROM data WHERE serverId=%s""", (str(ctx.guild.id),))
            row = await db_cur.fetchone()
            if row is None:
                await db_cur.execute("""INSERT INTO bdata(serverid)VALUES(%s)""" , (str(ctx.guild.id),))
                await ctx.respond('Server added to database. Please rerun the command.')
                return
                modal = DescriptionModal(title="Slash Command Modal")
                await ctx.send_modal(DescriptionModal(self.bot))```
junior wedge
#

i found the error

#

identation on modal

#

I'm just blind

fervent cradle
#

Does anyone have ideas

#

I need to impress ppl

#

What can I add to my bot

night cargo
#

for the emoji parameter of a button, how to get a emoji? I tried :one: but it throws an error

viscid hamlet
#

can you add a drop down menuin a discord modal?

viscid hamlet
storm geode
#

i might be wrong

cyan quail
#

no you're right

cyan quail
full basin
#

You can get it just doing \:emoji: here on Discord.

viscid hamlet
cyan quail
#

technically yes

#

but support for it isn't complete yet

#

think it's broken on mobile

#

if you do want it you can look into applying ##1419; i wouldn't recommend it for now, but you might enjoy it anyway

errant craneBOT
sage galleon
#

I uninstalled Novus and installed Py-Cord for my python interpreter and yet it still thinks Novus is installed and throws errors as if it is:
TypeError: __init__() missing 1 required positional argument: 'command_prefix'

from discord.ext import commands
intents = discord.Intents(messages=True, guilds=True, bans=True, dm_messages=True, dm_reactions=True, dm_typing=True,
                          emojis=True, guild_messages=True, guild_reactions=True, guild_typing=True, invites=True,
                          members=True, reactions=True)
bot = commands.Bot(intents=intents)

Any idea why? I had this same issue on my desktop (currently doing the same on my laptop) and I think I just left everything open for a while and it went away...?

full basin
grizzled sentinel
smoky forge
#

actually slash commands work with commands.Bot since its a subclass of discord.Bot

#

its just in case you need to use prefixed commands e.g. developer only commands that won't get added to servers

full basin
#

Yes, but also uses prefixed commands that's why it needs a command_prefix

smoky forge
#

^ this

night cargo
#

Is there an event for when a button is clicked?

silver moat
rugged lantern
#

how do you get the button custom_id from an interaction?

full basin
#

button.custom_id (?

#

Depends on how you're working with the button

rugged lantern
#

i need it specifically from interaction

full basin
#

On a button callback

#

You also receive button

#

So you can do button.custom_id

#

As I said, depends on how you're working with it

rugged lantern
#

interaction.custom_id works the same as button.custom_id

#

i just suck at using it properly

full basin
#

Whatever you say chief

waxen skiff
#

RuntimeError: Task <Task pending name='pycord: on_ready' coro=<Client._run_event() running at /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py:382>> got Future <Future pending> attached to a different loop

asyncio.run(get_connection())```
#

heres some more code

#
    await c.execute("CREATE TABLE IF NOT EXISTS config (guildid INTEGER, mode INTEGER DEFAULT 1, premium BOOLEAN DEFAULT false, prefix TEXT DEFAULT null, droprate INTEGER DEFAULT 20, gambling BOOLEAN NOT NULL DEFAULT false, dropamount TEXT DEFAULT '10-15', UNIQUE (guildid))")
async def get_connection():
    pool = await aiomysql.connect(host='192.158.229.237', port=3306, user='bot', password=data['dbpass'], db='cratebot', autocommit=True)
    bot.pool = pool
    bot.db = pool```
night cargo
#

with on_interaction how do i get the view object?

signal stratus
#

How can I make it work without changing the command?

full basin
#

@commands.command(name="8ball")
async def eightball(self...)

waxen skiff
#

yeah, functions cant start with numbers

night cargo
#

with the on_interaction event, How do you get if the component was a button?

night cargo
marsh moth
#

How can I make it so when a new server is joined and the owner enables slashcommands for the bot, how can I add the slash commands without restarting the script? I tried a function but it said pylance couldnt access it or something

fallen cove
#

Would it ever be possible to have a dropdown menu in a modal

marsh moth
#

await ctx.respond(embed=embed)

cerulean drum
#

Because you havent respond to the command

marsh moth
#

how do u make the grey box around your code?

#

This errors with discord.errors.ClientException: Callback for levelingrewardremove command is missing "context" parameter.

    async def levelingRewardRemove(ctx):
        print('e')
enableSlashCommands(serverList)```
copper dew
#

use ctx.author.display_avatar.url

#

np

fading granite
#

why does this error appear?

loud holly
fading granite
#

oh i just figured that out

loud holly
#

the dev portal

fading granite
#

i have a guild only slash command, but my beta bot isn't in that guild

#

and i was accessing my beta bot

fading granite
#

why does my bot return "the application did not respond" but there is no error in the console

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.

grim canopy
#

How to get the check's name of the command

#

like has_permissions

#

is_owner

torpid bronze
torpid bronze
grim canopy
#

like @commands.is_owner

#

I want to get is_owner from the command

fervent cradle
#

How do I do that kind of welcome screen

torpid wharf
#

image processing

grizzled sentinel
fervent cradle
#

How do u do the image thing

pallid trench
#

a different library used for image manipulation

smoky forge
#

you can use pillow to create that

grizzled sentinel
#

I have never used it so i cant help

fervent cradle
#

Alr

#

Ty

#

All my game teamsters are I’m impressed by my discord bot I need them to be rly impressed what should I do

#

Teammate*

fallen cove
#

if i was to move some button classes to a cod do they go in the main class with the commands or are they kept separate
e.g.

class class1(commands.Cog):
  class Buttons(discord.ui.View):

or

class class1(commands.Cog):
class Buttons(discord.ui.View):
grizzled sentinel
fallen cove
#

do you have a recommendation to organise it better?

grizzled sentinel
#

Put the systems in different files. (You should only have 1 cog per file)

fallen cove
#

put each 1 into its own cog?

grizzled sentinel
#

yes

Project folder
 -> cogs
    -> cog1.py
    -> cog2.py
 -> main.py

that is a template for how your file structure should look like

fallen cove
#

would it be the same in the main file but use the listener on_ready to add the views?

grizzled sentinel
#

yes

fallen cove
#

perfect, last question sorry but what are the prc files in the pycache folder in my cogs folder for?

grizzled sentinel
#

Im sorry, but i could not tell you, they dont appear on my bot.

cyan quail
#

you can typically ignore the pycache folder

rare ice
cyan quail
#

it's already implemented, just not officially released yet

rare ice
#

Yeah

fallen cove
rare ice
#

Aren’t they adding the markdown syntax for role mentions in the fields as well?

cyan quail
#

there's a PR for it on the github if you wanna apply that, just be warned that it won't work on all platforms so i'd advise against using it for public commands

fallen cove
#

is there any reason why modals are caped at 5 input fields?

cyan quail
cyan quail
smoky forge
cyan quail
#

maybe if you want to reuse the view across multiple cogs? I personally wouldn't though

grizzled sentinel
#

I think that depends on if you are using the same view template in multiple places.

#

For example if you have a acept deny view you use in commands across multiple commands a view folder would seem right but if the view is used for 1 commands keep it local

smoky forge
#

alr alr

loud holly
#
@bot.slash_command()
@discord.Option(
    "discord_member",
    choices=[discord.member],
    required=False
)
async def balance(
    ctx: discord.ApplicationContext,
    member: str
):

I'm confused on what it means by TypeError: issubclass() arg 1 must be a class

#
async def balance(
    ctx: discord.ApplicationContext,
    member: discord.member, required=False
):

I tried to do this however the required gets blank and I get the same error

#

I'm trying to do it like this

#

nvm figured it out

signal stratus
#

How do I check if a message is from a follow channel like the one shown in the picture?

smoky forge
#
if message.webhook_id is not None:
    # do something
#

if you have other webhooks apart from follow channels you can get the webhook from that id and check the type

fervent cradle
#

What can I add to my bot to impress ppl

signal stratus
slow eagle
#

thats legitimately effective

fervent cradle
#

Nobody cares about that

slow eagle
#

well i do lol

#

thats jus me ig

fervent cradle
#

What else

slow eagle
#

idk

rugged lantern
#

nothing is impressive when your name is 0-zone57

slow eagle
#

personally i would never take that

smoky forge
#

if you really want to make something impressive, get out there and think about it. this is a help channel for the library

fervent cradle
#

I can’t find it

silver moat
smoky forge
#

check if the game has an api

#

or some documentation

fervent cradle
#

It’s private tho

smoky forge
#

i assume you want to get information from a game

fervent cradle
#

Yes

smoky forge
#

if the api is private, you'll have to pay to get access to it

fervent cradle
#

Pay who?

smoky forge
#

the developers

fervent cradle
#

Is there a way to get it

smoky forge
#

i can't help you much since i don't know what game you want to get the api from

fervent cradle
#

Sky warriors

#

It’s a mobile game

smoky forge
#

I'm not finding any documentation/api from the game nor the developer, so i suppose that they don't have one

fervent cradle
#

Is there a way to do it without an api?

silver moat
#

or swift

#

or some c++

#

anyways the language wouldn't be python

signal stratus
#

Is it possible that the bot executes a /command?

silver moat
smoky forge
#

if the stats were available somewhere on a page but without api, you can make a web scraper to get it for you

signal stratus
smoky forge
#

but if it's all inside a mobile game in a private database, you're not gonna get it easily

uneven yoke
#

Can i have buttons which do have timeout but they also work fine when bot restarts? In persistent view timeout is kept none but I want to disable the buttons after a specific time that being said they should work when bot restarts

silver moat
edgy jackal
#

hey everyone, super quick question, does slowmode affect users when using bot slash commands? (i.e. if I set a 10s slowmode, do users have to wait 10s in between using any form of slash command on that text channel)?

uneven yoke
silver moat
edgy jackal
edgy jackal
full basin
#

No

loud holly
signal stratus
edgy jackal
#

acc dw I'll get a friend to test it, thanks for ur help!

loud holly
smoky forge
viscid hamlet
#

hey guys , my other users are not seeing the /command

signal stratus
devout anvil
#

is there anyway to get the channel history using checks

devout anvil
#

examplepy channel = bot.get_channel(channelID) user = bot.get_user(userID) def check(message: discord.Message): return message.author == user messages = await channel.history(limit = 100, check = check)

smoky forge
signal stratus
smoky forge
#

yep

smoky forge
#

if you want to find the first occurrance, use channel.history().find(check)

#
async for m in channel.history(limit=100):
    if m.author == user:
        # do something
storm geode
#

if i put all my cogs into a folder would loading them be the same or will i have to add something?

silver moat
storm geode
#

thanks

wooden lodge
#

Hey, can you get the message history of a channel without using "await"? Like with a URL or something

smoky forge
silver moat
smoky forge
#

even the pycache dir?

silver moat
#

It’s not a .py file

stiff fiber
#

Is there a way to get my bot's integration role?

smoky forge
sly badge
#

is there a way to get total message count of a person without looping through all channels and all messages 1 by 1

loud holly
#

for tasks, will it run individually so let's say

User A runs a command and after 1 hour it pings them that they can run the command once again

Between the command Cooldown User B runs the command, will the task command get confused or will it ping User A and then after how many time left, it'll then ping User B

loud holly
#

yeah

#

from discord.ext

silver moat
#

I'm not sure if you can run the same task twice concurrently

loud holly
silver moat
fallen cove
#

Is discord planning to add date selector to slash commands?

silver moat
loud holly
silver moat
loud holly
#

yeah, apart from this

waxen skiff
#

so i have CREATE TABLE IF NOT EXISTS but then i get Warning: Table 'whatever' already exists

loud holly
#

not sure if I did it correct

silver moat
loud holly
#

it does save the data and pings, I only had to do was asyncio.sleep()

#

and then it'd ping

silver moat
#

but how are you calling the task?

loud holly
smoky forge
fallen cove
waxen skiff
#

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

smoky forge
waxen skiff
#

that’s because i don’t know the line…

smoky forge
#

¯\_(ツ)_/¯

grizzled sentinel
stiff fiber
waxen skiff
#

i have no idea where i use invoke

fallen cove
#
Traceback (most recent call last):
  File "c:\Users\philc\Desktop\Ticket bot WIP\working folder\ticket bot.py", line 81, in <module>
    for filename in os.listdir('./cogs'):
FileNotFoundError: [WinError 3] The system cannot find the path specified: './cogs' ```
```py
for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
        bot.load_extension(f'cogs.{filename[:-3]}')
        print(f'Loaded {filename[:-3]}')```
not to sure about this
sly badge
#

Application Command raised an exception: ClientOSError: [WinError 64] The specified network name is no longer available

#

what does this error mean

#

bot was running ok and then it just poped

waxen skiff
#

@grizzled sentinel @smoky forge sorry for the ping, but i have no "invoke" in my code

smoky forge
#

can you show the full traceback?

waxen skiff
#

yes

#
Loaded extension: cogs.startup
Loaded extension: cogs.general
Loaded extension: cogs.cratedrop
Loaded extension: cogs.economy
Failed loading extension:
Extension 'cogs.stats' raised an error: ModuleNotFoundError: No module named 'timeago'
Loaded extension: cogs.lottery
Loaded extension: cogs.gambling
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiomysql/cursors.py:239: Warning: Table 'config' already exists
  await self._query(query)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiomysql/cursors.py:239: Warning: Table 'channels' already exists
  await self._query(query)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiomysql/cursors.py:239: Warning: Table 'roles' already exists
  await self._query(query)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiomysql/cursors.py:239: Warning: Table 'users' already exists
  await self._query(query)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiomysql/cursors.py:239: Warning: Table 'lottery' already exists
  await self._query(query)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiomysql/cursors.py:239: Warning: Table 'tickets' already exists
  await self._query(query)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiomysql/cursors.py:239: Warning: Table 'rewards' already exists
  await self._query(query)
beta#7179 is ready with:
1 guilds
0 users
Ignoring exception in command config:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 127, in wrapped
    ret = await coro(arg)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 1171, in _invoke
    await command.invoke(ctx)
AttributeError: 'NoneType' object has no attribute 'invoke'

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

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/bot.py", line 992, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 358, in invoke
    await injected(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 135, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'invoke'
#

idk how to get rid of the warnings

honest spoke
#

configure the logger of aiomysql to exclude warnings

#

log level 40

#

enum is logging.ERROR

#

Or dont try to create tables when they already there

waxen skiff
#

ig it was intents

native gorge
#

What are the arguments that discord.ApplicationContext.respond admits?
Can I send a file through it?

#

I tried with ```py
await ctx.respond(file=file)

stiff fiber
#

How do I send a response to a slash command that only the issuer of the slash command can view?

#

Found it, it's ctx.send_response(message, ephemeral=True)

jovial shoal
#

is there a method for offering a context specific option list for a slash command argument?

stiff fiber
#

is the variable file of type discord.File?

stiff fiber
#

What is the difference between ctx.send_response and ctx.respond? From what I can tell, they do the exact same thing except ctx.respond will fallback to a followup

quiet tendon
errant craneBOT
quiet tendon
#

Found the problem, you can only do up to 5 inputs

stiff fiber
#

Is there a way to allow slash commands, but prevent users from sending normal messages?

night cargo
#

Is there an event for when someone nitro boosts the server?:

cold storm
halcyon helm
spiral sail
#
await ctx.respond(embed=content, ephemeral=True)```
Doesn't seem to be working
#

Well at least its returning the message, but not privately.

pallid trench
spiral sail
#

Oh! Does defer needs to be given it? Alright, will do now

pallid trench
#

yes, follow ups to a defer will inherit the ephemeral state of the defer

spiral sail
#

Is it the same with ctx.send?

#

Can I send ephemeral with normal messages?

pallid trench
spiral sail
#

Ah kk. Also another little problem.

#

Regarding cooldowns on Pycord, I'm using on_command_error for prefix commands, and on_application_command_error for slash

#

Is that fine?

pallid trench
#

yep

#

i believe there is a third one for bridge commands if youre using those

spiral sail
#

Oh!

#

What is it?

pallid trench
#

not sure

grizzled sentinel
tiny wagon
#

how to maximize performance when useing pillow/opencv in async?

#

also these libs support async?

#

or i need to use thraedpoolexecutors n all

grizzled sentinel
spiral sail
#

Little stuck, uhm, how do you do views in cogs?

fallen cove
#

somethings have to change tho

spiral sail
#

*Thought it was inside the commands.Cog class, which is what I meant, don't worry, did a tryitands.ee thing haha

fallen cove
#

how do you check if a button interaction is in a specific category?

lost lodge
#

hey

#

if status.favicon is not None:
b64_img = status.favicon.removeprefix("data:image/png;base64,")
img_bytes = b64decode(b64_img)
with open("images/status.png", "wb") as f:
f.write(img_bytes)
image_url = "attachment://images/status.png"
embed.set_image(url=image_url)
await ctx.send(embed=embed)

#

why my image isn't sending

#

only the embed with the text

#

but no image

round rivet
#

you need to pass a file to send to send

lost lodge
#

and how can i do that?

round rivet
#

create a discord.File with your attachment and pass that to the file kwarg

lost lodge
#

but how can i send it in the embed

round rivet
#

filename in your image url for your embed needs to be the same as the file you're sending