#General Help

1 messages · Page 11 of 1

open bearBOT
rose stratus
#

b!rtfm pyc on_guild_join

open bearBOT
# rose stratus b!rtfm pyc on_guild_join

I couldn't find a documentation with the name on_guild_join! Maybe you used to command wrong? Correct Usage: <prefix>rtfm <docs> [<term>] (eg. b!rtfm py cool)
List of Documentations you can search:
python
pycord
discord.py
yarsaw
nextcord
disnake

rose stratus
#

b!rtfm pyc on_guild_join

open bearBOT
rose stratus
#

can someon help me

#

just resolved

clever lava
#

ty

potent rivet
#

can i make my bot check messages that have certain text in them then respond based on the text?

#

like if the message is a banned word it'll be deleted and maybe the bot will send a message

#

mightve gotten it

sudden path
#

if "word" in message.content

potent rivet
#

its almost working

#

hmm

wet heartBOT
#

@open bear was the 4041st person to join Pycord

#

@wet heart was the 1124th person to join Pycord

steady lotus
potent rivet
potent rivet
wet heartBOT
#

@potent rivet was the 6199th person to join Pycord

sudden path
#

on_message doesn't take ctx

potent rivet
#

ah

sudden path
#

Events dont have context

potent rivet
#

oh yeah

sudden path
#

You're looking for await message.channel.send()

potent rivet
#

ok thanks

potent rivet
sudden path
#

Do you have messages intent

potent rivet
#

uhhh

#

um now i do :)

#

ty'

slender lintel
#

Can someone help me pls?

ebon spruce
#

How can I edit an interaction more then once?

async def approve(interaction):
    await interaction.response.edit_message(
                    embed=embed, view=view.clear_items()
                )
                artists =await api.libary_artists(ctx, username)
                await interaction.response.edit_message(
                    embed=discord.Embed(
                        description=f"rawr",
                        color=0x7289DA,
                    )
                )
                
                await interaction.response.edit_message(
                    embed=discord.Embed(
                        description=f"awr",
                        color=0x7289DA,
                    )
                )```
**discord.errors.InteractionResponded: This interaction has already been responded to before**
desert dagger
rigid wave
#

Hi, How do I know the user who pressed a button is the same user who called the button?

desert dagger
#

hm

#

you'd grab the id of the person who called the interaction then compare it with the person that pressed it

rigid wave
desert dagger
#

is your setup like

#

slash command and it shows content with buttons?

desert dagger
#

ah i see

#

can i see the code you used?

#

you probs could try message.author == ctx.author

rigid wave
desert dagger
#

hm

rigid wave
#

@desert dagger

desert dagger
ebon spruce
desert dagger
#

Have you tried await asyncio.sleep()?

desert dagger
#

sweet

rigid wave
desert dagger
#

Maybe try explaining what the code does and show a bit more code in there and someone will help

rigid wave
desert dagger
#

you could try interaction.message.edit idk

rigid wave
desert dagger
rigid wave
desert dagger
#

lmao

slender lintel
desert dagger
#

is your workflow:

  • Create a category if it doesn't exist
  • Create ticket
  • Send welcome embed in ticket
  • let user know ticket has been created
  • send message.content after embed has been sent? @slender lintel
slender lintel
#

dss I have yes I have all only when a welcome message comes in the chat is sent again message.content.

desert dagger
#

so u want message.content to be sent in the ticket channel? too

slender lintel
#

He will yes I send later a screenshot what I mean

desert dagger
#

your code creates the channel, sends an embed and lets the person know their ticket has been created. but if channel already exists it just sends message.content in "channel" which is probs where the command was ran

rigid wave
#

Can I add buttons or a dropdown menu in Modal?

frank moon
proven plume
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'coroutine' object has no attribute 'purge'

#

someone know this pls?

desert dagger
desert dagger
proven plume
#
@bot.command()
@commands.is_owner()
async def supp_tout(ctx: commands.Context):

    await salon_auto_role.purge(limit=20)
    await salon_esgi_role.purge(limit=20)
    await salon_dev_role.purge(limit=20)
    await salon_reglement.purge(limit=20)
    await salon_tutoriel.purge(limit=20)
frank moon
proven plume
#
salon_auto_role = bot.fetch_channel(923316086483587085)
salon_esgi_role = bot.fetch_channel(974708754438303784)
salon_dev_role = bot.fetch_channel(975746758581846046)

salon_admin = bot.fetch_channel(923316087314067537)
salon_reglement = bot.fetch_channel(923316086483587083)
salon_tutoriel = bot.fetch_channel(976751453127454720)

frank moon
desert dagger
frank moon
#

oki

desert dagger
frank moon
#

no

desert dagger
#

when you get an interaction failed it means your code simply hasnt sent a response back or it errored somewhere

frank moon
#

it just say 'this interaction failed' but the whole things worked

#

have u watched the whole vid

desert dagger
#

yes?

frank moon
#

but button works fine

desert dagger
#

hm

frank moon
#

discord bug?

desert dagger
#

nah

#

its something to do with your code

gilded widget
frank moon
#

no errors at all + everything works fine

desert dagger
#

try adding ctx.defer() ?

frank moon
#

ohh yes

desert dagger
#

or interaction.response.defer()

frank moon
#

aight

desert dagger
#

you could also be needing to send it via interaction.response.send_message(message)
or ctx.respond

#

otherwise you get the failed thing even tho it worked

desert dagger
proven plume
#

ty

gilded widget
#

you need to await it

frank moon
#

like py async def callback(interaction): await interaction.response.defer()

desert dagger
#

mhm try

frank moon
#

oki

desert dagger
proven plume
desert dagger
#

mhm

#

Example
test= await bot.fetch_channel(969580926885580801)

proven plume
#

but my channels arn't on a def

desert dagger
#

hm

#

are they being used elsewhere?

proven plume
#

yep

#

this is the problem

frank moon
#

@desert dagger thx for telling me to try defer cuz it works :))

desert dagger
#

glad to see that worked 👍

desert dagger
#

cause maybe just put them in the function and call function?

proven plume
#
salon_auto_role = bot.fetch_channel(923316086483587085)
salon_esgi_role = bot.fetch_channel(974708754438303784)
salon_dev_role = bot.fetch_channel(975746758581846046)

salon_admin = bot.fetch_channel(923316087314067537)
salon_reglement = bot.fetch_channel(923316086483587083)
salon_tutoriel = bot.fetch_channel(976751453127454720)

@bot.command()
@commands.is_owner()
async def supp_tout(ctx: commands.Context):

    await salon_auto_role.purge(limit=20)
    await salon_esgi_role.purge(limit=20)
    await salon_dev_role.purge(limit=20)
    await salon_reglement.purge(limit=20)
    await salon_tutoriel.purge(limit=20)

@bot.command()
@commands.is_owner()
async def prepare(ctx: commands.Context):
    
    await salon_reglement.send(reglement1)
    await salon_reglement.send(reglement2, view=auto_role.bouton_rules())

    await salon_auto_role.send(embed=discord.Embed(title="Tu joues à quels jeux?", description="",color=0x00ff91), view=auto_role.bouton_jeu())
    await salon_auto_role.send(embed=discord.Embed(title="Tu veux avoir acces à quels channels?", description="",color=0x00ff91), view=auto_role.bouton_salon())
    await salon_auto_role.send(embed=discord.Embed(title="Es-tu à l'ESGI?", description="",color=0x00ff91), view=auto_role.bouton_esgi())

    await salon_dev_role.send(embed=discord.Embed(title="Tu utilise quels languages?", description="",color=0x00ff91), view=auto_role.bouton_dev())

    await salon_esgi_role.send(embed=discord.Embed(title="Tu es en Inital ou en Alternance?", description="⚠ Cette question ne concerne que les premières et deuxièmes années.",color=0x00ff91), view=auto_role.bouton_alt_ou_init())
    await salon_esgi_role.send(embed=discord.Embed(title="Tu es en quelle année?", description="",color=0x00ff91), view=auto_role.menu_annee())
    await salon_esgi_role.send(embed=discord.Embed(title="Tu es en quelle spé?", description="⚠ Cette question ne concerne que les troisièmes, quatrièmes et cinquièmes années.",color=0x00ff91), view=auto_role.menu_spe())

frank moon
#
discord.errors.InteractionResponded: This interaction has already been responded to before
``` btw what could be the cause of this?
desert dagger
#

response.edit_message(message) multiple times?

frank moon
#

seems like the error was caused by defer() when i add to my buttons callback lmao

#

ima remove it

desert dagger
#

mhm fair

frank moon
#

just added defer() to the select menu callback then it worked

desert dagger
#

did say to test. no clue about your code xd

frank moon
#

yes its unknown :))

#

you'll die when u read it

desert dagger
#

that's interesting

sick stirrup
#

Can't bots have custom activity?
{emoji} {name}

desert dagger
desert dagger
gilded widget
desert dagger
#

hm

#

nvm i think ik what i did wrong

#

😭 it wasnt updated to the latest

gilded widget
#

that version of the code probably doesn't function properly though due to the CommandPermission usage

desert dagger
#

yeah

#

i realised commandpermissions was removed in rc

gilded widget
#

the fixed version is on my pr

desert dagger
#

thankss

gilded widget
#

##1389

supple ravineBOT
desert dagger
#

i feel very dum :D

gilded widget
#

lmao ur good

desert dagger
#

same with trying bridge in cogs too. why do i keep on being stupid 😭

gilded widget
#

if I remember correctly I don't think bridge works correctly in cogs

desert dagger
#

yeah

gilded widget
#

bridge is a bit flawed rn, hopefully it'll get cleaned up before full 2.0.0 release

desert dagger
#

would it be better to just work in D.py or something

gilded widget
#

idk, depends on your use purposes

desert dagger
#

I went from a discord.js user to Pycord and i last used Python for just an AI chatbot project

stiff lotus
#

Hey all, does anybody know how to make a command that adds / removes roles from a user. I’ve looked far and wide & can’t find anything.

Any help would work,
Thanks

stiff lotus
gilded widget
#

imo dpy's new syntax for slash commands is weird but to each their own, their shouldn't be any significant differences

stiff lotus
#

and also let me know the things I’ll need to import as well

desert dagger
stiff lotus
desert dagger
desert dagger
gilded widget
#

this is a button but it works similar

stiff lotus
#

Thanks

desert dagger
#

^^

stiff lotus
#

ah not a reaction role

#

Like dynos ?role

#

Command

desert dagger
#

one sec

stiff lotus
#

ye

#

Alr

desert dagger
#

await ctx.guild.create_role(name=role_name, color=color, reason=f'reason_here')

#

theres a good example somewhere on the docs

stiff lotus
#

So will this give out a role of your choice?

desert dagger
#

alright letme just explain a few things

stiff lotus
#

Ok

#

Ye

#

Wait so it creates a role?

desert dagger
#

code creates role
gives it a color and audit logs will have reason

stiff lotus
#

I’m talking about giving a user an existing role in the server already

desert dagger
#

ahh

#

my bad

#

thats easier

stiff lotus
#

Oh ok

#

and then a remove role cmd as well

desert dagger
#

do you want it to be any user or author

#

await member.add_roles(role) is all you really need to add role

stiff lotus
#

Alright thank you!

desert dagger
#

well at least i explained how to create/remove roles , add and remove roles 😂 even tho the first two was useless

stiff lotus
#

thanks

slender lintel
delicate relic
#

Hello ppl, i have a question, when using slash_command to tag a role, although it gets the right role it doesn't ping the people with the role as shown in the image https://i.imgur.com/NvCp0FV.png

#

Anyone knows why?

desert dagger
delicate relic
#

Yes

desert dagger
#

application command responses are based on permissions for @ everyone iirc?

delicate relic
#

With a user it pings

#

Hmm

delicate relic
delicate relic
desert dagger
#

nice

delicate relic
# desert dagger nice

Quick update, it suddenly stopped pinging roles again, i guess there's a limit to how many times the bot can ping a role?

desert dagger
#

there shouldnt be any

delicate relic
#

Weird then HmmGe

desert dagger
delicate relic
#

test server

desert dagger
#

if its test server enable @ everyone to have perms to mention roles or have the role u want mentioned mentionable then try again

delicate relic
#

Ok, gonna test it

desert dagger
icy sluice
#

well wasn’t for me, I gave up on js 😂

desert dagger
#

then see if that works. i realised you might have not had that

delicate relic
delicate relic
#

I reverted all code till when i added the allowedmentions

#

And it's working again

#

Im so confused

#

Well it's working fine and dunno why rooPopcorn

sleek grove
#

help pls

keen root
#

slash command name must always be in lowercase ("ping" not "Ping")

sleek grove
#

thx

#

works

icy sluice
#

can i get a quick example of what an .env should look like exactly?

slender lintel
#

Can someone help me?..

frank moon
#

Is select in modal gonna be added soon?

sick stirrup
slender lintel
# sick stirrup I didn't get what you meant there

So my bot sends in the same twice, once once the channel is created to communicate with the player and then it sends in the reason for support again. But I want it to wait until the second message comes from the user means that it sends first only the confirmation and only after the second message sends message.content.

#

you know?

#

So here is my problem:

sick stirrup
slender lintel
slender lintel
#

No notlikethis

sick stirrup
#

oop-

slender lintel
#

message.content should only come after the second message from the user

sick stirrup
slender lintel
#

means first the welcome message comes and then when the user sends a second message only message.content should come

slender lintel
sick stirrup
#

Yeah, the user sends second message, and then you get the message.content from the bot, correct?

slender lintel
#

yes rooAww

sick stirrup
slender lintel
#

what should he be waiting for?

sick stirrup
#

From the example in the documentation, use the one where the bot waits for a "message" from the user, and then you send the message.content

#
msg = await client.wait_for('message', check=check)
sick stirrup
slender lintel
sick stirrup
#

in check, return m.author == message.author and m.channel == message.channel

slender lintel
#

Its working thanks! ❤️

slender lintel
sick stirrup
#

Show me your code

slender lintel
# sick stirrup Show me your code
        def check(m):
            return m.author == message.author and m.channel == message.channel

        await bot.wait_for('message', check=check)
        content_embeds = discord.Embed(description=f":HeartCute:› {message.content}", colour=0x51ff89)
        content_embeds.set_author(name=f"{message.author.name}#{message.author.discriminator}",
                                  icon_url=message.author.avatar.url)
        await channel.send(embed=content_embeds)
#

This?

pale crow
#

Is there any way to loop through all the options inside the application cmd(slash)?

sick stirrup
slender lintel
#

Wait i send a screen

slender lintel
delicate relic
sleek grove
#

when i enable intents that error comes Traceback (most recent call last):
File "/Users/janikschunemann/Development/Python/in-progress/Discord/main.py", line 12, in <module>
bot = discord.Bot(intents=discord.intents.all())
AttributeError: module 'discord' has no attribute 'intents'

desert dagger
#

hm

sleek grove
#

my code is bot = discord.Bot(intents=discord.intents.all())

desert dagger
#

make the i I

#

intents=discord.Intents.all()

slender lintel
humble sigil
#

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'

sudden path
#

How could I get the original message in a view, to edit it, on the on_timeout event

desert dagger
slender lintel
#

from discord.commands import SlashCommandGroup
ModuleNotFoundError: No module named 'discord.commands'

slender lintel
#

I installed py-cord using pycharm's python package installer

desert dagger
#

hm

humble sigil
desert dagger
#

oh

#

b!rtfm pyc User.avatar

desert dagger
#

and show me what py-cord version you're using

humble sigil
stiff lotus
#

could you somebody give me a full prewritten code on a slash command where you can give somebody roles

slender lintel
stiff lotus
#

because i'm still really confused

desert dagger
desert dagger
stiff lotus
desert dagger
humble sigil
desert dagger
#

do you want your own?

#

cause im pretty sure author.avatar.url works

humble sigil
desert dagger
#

ahh

#

is your rank command targetting the author?

#

or like a user it mentions

sudden path
#

in any way it is discord.Member.avatar.url

desert dagger
sudden path
#

author or targeted user

slender lintel
desert dagger
#

one sec yehe

desert dagger
humble sigil
#

you know

desert dagger
#

mhm

sick stirrup
desert dagger
#

you'd need one to check if you mention anyone or not then blocki

humble sigil
#

@desert dagger dm

sick stirrup
#

Did you mean this screenshot where the message.content appears to be able the random message sent?

sudden path
#

then you can simply do
user.avatar.url

humble sigil
#

ok

slender lintel
#

anyone has an idea for is_owner thing on slash commands

sick stirrup
# slender lintel

Seems like the bot did send the message.content after you (message.author), sent a message

slender lintel
sick stirrup
slender lintel
sick stirrup
stiff lotus
desert dagger
stiff lotus
#

Lol

desert dagger
#

Its kinda just simple but alright

stiff lotus
#

Ok

sick stirrup
# slender lintel Yes

Can you show me the code from the part where you create the first embed till you send it?

stiff lotus
#

Just send the role cmd when your available

sick stirrup
#

Is this on_message event?? @slender lintel

#

or is it a command?

slender lintel
desert dagger
#

There you go

#

Command gives the user running the command a role

stiff lotus
#

Tysm

pale crow
#

self._underlying.emoji = PartialEmoji.from_str(value)
AttributeError: 'Choice' object has no attribute '_underlying'

#

How do I add 🇦 as emoji for buttons

#

I get above error

#

I tried emoji=":regional_indicator_a:" and also emoji= \🇦

buoyant saddle
#

Question with Pycord, can we automatic sync?

stiff lotus
#

i want a moderator to use the command to give another user a role

#

so there is a list of members

#

you can pick from

#

& a list of roles you can pick from

#

@desert dagger

desert dagger
#

you asked for an example of how to give a role ¯_(ツ)_/¯

#

thats bare bones

stiff lotus
#

sorry

#

i need a role command exactly like dynos one

#

wait

#

one sec

#

something like this @desert dagger

desert dagger
#

Why not code it yourself?

#

documentation does exist

stiff lotus
#

im trying

#

but it's hard lmao

desert dagger
#

user: discord.Option(discord.Member, "Enter a Username")

stiff lotus
#

and you guys are proffesionals

#

alright

desert dagger
stiff lotus
#

but you still know what you're doing lol

#

getting this error now

#

anybody know why?

desert dagger
#

whats said in your console?

stiff lotus
#

has no attribute "member"

desert dagger
#

show code

stiff lotus
#

hm

ancient gazelle
#

How do I create a background task?

stiff lotus
#

One sec

#

@desert dagger

#

hey?

desert dagger
#

just do member.add_roles

stiff lotus
#

where?

#

oh ok

#

still getting the same error

#

@desert dagger

#

this is the code

desert dagger
#

confusion

#

what did u change

stiff lotus
#

ye lol

#

look at the discord.Option role line

desert dagger
#

still dont see a diff

#

oh wait nvm i see it

desert dagger
icy sluice
#
import discord
from discord.ext import commands
import os # default module
from dotenv import load_dotenv

load_dotenv() # load all the variables from the env file
bot = discord.Bot(debug_guilds=[976234277123539017])
bot = commands.Bot(command_prefix="!")

@bot.command()
async def ping(ctx):
    await ctx.send("Pong!")

@bot.command()
async def announce(ctx, title, *, message):
    await ctx.send("**{}**\n{}".format(title, message))

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        await ctx.send("Unknown command.")

@bot.event
async def on_ready():
    print(f"{bot.user} is ready and online!")

bot.run(os.getenv('TOKEN')) # run the bot with the token```

My bot isn’t responding to my ping or announce command?
icy sluice
desert dagger
icy sluice
#

I’m not sure but I’m assuming it’s something to do w the fact I’ve done bot = twice

desert dagger
#

😭 yes

#

why my friend why

icy sluice
#

idk what to change tho

icy sluice
desert dagger
#

can you print all of your code?

pale crow
#
Traceback (most recent call last):
  File "C:\Users\Mridul Negi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Mridul Negi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\bot.py", line 1038, in on_connect
    await self.sync_commands()
  File "C:\Users\Mridul Negi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\bot.py", line 685, in sync_commands
    await self.http.bulk_upsert_command_permissions(self.user.id, guild_id, guild_cmd_perms)
  File "C:\Users\Mridul Negi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\http.py", line 357, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed```
#

anyone pls help

icy sluice
# desert dagger can you print all of your code?
import discord
from discord.ext import commands
import os # default module
from dotenv import load_dotenv

load_dotenv() # load all the variables from the env file
bot = discord.Bot(debug_guilds=[976234277123539017],intents=discord.Intents.all())
bot = commands.Bot(command_prefix="!")

@bot.command()
async def ping(ctx):
    await ctx.send("Pong!")

@bot.command()
async def announce(ctx, title, *, message):
    await ctx.send("**{}**\n{}".format(title, message))

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        await ctx.send("Unknown command.")

@bot.event
async def on_ready():
    print(f"{bot.user} is ready and online!")

bot.run(os.getenv('TOKEN')) # run the bot with the token
desert dagger
#

bot = discord.Bot(debug_guilds=[976234277123539017],intents=discord.Intents.all(),command_prefix="!")

#

make it one line

desert dagger
icy sluice
#

1

desert dagger
#

remove the debug_guilds part for now

icy sluice
desert dagger
icy sluice
#

yep

desert dagger
#

hm

icy sluice
#

i fixed it now

#

ty tho

desert dagger
#

lmao what?

desert dagger
icy sluice
#

ty

icy sluice
#

and made it commands.Bot

desert dagger
#

ohh

icy sluice
#

ty for the help though

desert dagger
#

my bad lol

#

i thought bot.command worked like commands.command did 😸

fallen latch
#

one question

#

anybody can help me?

#

i want to make a easy bot just to clear messages

#

but i dont know how

slender lintel
sick stirrup
#

Maybe, you should add the channel to a db or something to show that it is not new and don't have to repost the embed

slender lintel
#

okay..

#

thanks anyway

icy sluice
#

which function fetch’s the bots ping?

sick stirrup
icy sluice
#

Could you give me an example of how to use it?

fallen latch
#

one question

#

a webhook can delete messages?

sick stirrup
fallen latch
#

like an "auto delete"

slender lintel
#

how do I send message to a specific channel using its Id?

wide cloak
#

how to get the message the user replyed to?

keen root
little isle
#

pycord.dev is down?

keen root
keen root
slender lintel
#

How would i allow my bot to work in every server for slash commands, Instead of adding ID every time?

slow dome
#

make it global

slender lintel
#
    suggestion_group = SlashCommandGroup(name="suggestion", guild_ids=guilds, description="Suggestion commands, for suggesting")


    class suggestion_modal(Modal):
        def __init__(self, *args, **kwargs) -> None:
            super().__init__(*args, **kwargs)
            self.add_item(InputText(label="Suggestion Topic", placeholder="Enter topic"))
            self.add_item(
            InputText(
                label="Suggestion Content",
                placeholder="Enter suggestion",
                style=discord.InputTextStyle.long,
            )
        )
            async def callback(self, interaction: discord.Interaction):
                print("Hello")
                await interaction.response.send_message(content="Suggestion was submitted.")
                data = fetch_settings()
                ch_id = data['settings']['suggestion-channel']
                channel = self.bot.get_channel(ch_id)
                embed = discord.Embed(title=f"{self.children[0].value}", description=f"{self.children[1].value}", color = discord.Color.green())
                await channel.send(embed=embed)
                
            
    @suggestion_group.command()
    async def create(self, ctx):
        data = fetch_settings()
        ch_id = data['settings']['suggestion-channel']

        isFound = utils.get(ctx.guild.channels, id=ch_id)

        if isFound == None:
            return await ctx.respond("Suggestion channel has not been setup correctly.")
        
        modal = self.suggestion_modal(title="Suggestion Panel")
        await ctx.send_modal(modal)
#

callback never gets called

#

for some reason

slow dome
slender lintel
#

oh

#

i see

#

its in the init

icy sluice
#
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.9/site-packages/discord/cog.py", line 715, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 846, in exec_module
  File "<frozen importlib._bootstrap_external>", line 983, in get_code
  File "<frozen importlib._bootstrap_external>", line 913, in source_to_code
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/container/cogs/moderation.py", line 9
    @commands.command() # create a command
IndentationError: unexpected indent
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/main.py", line 27, in <module>
    bot.load_extension(f'cogs.{cog}')
  File "/home/container/.local/lib/python3.9/site-packages/discord/cog.py", line 787, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/container/.local/lib/python3.9/site-packages/discord/cog.py", line 718, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.moderation' raised an error: IndentationError: unexpected indent (moderation.py, line 9)```

why am I getting this err?
gilded widget
#

self explanatory

icy sluice
#

not for me

gilded widget
#

it's an indentation error

#

you indented line 9 wrong

icy sluice
#

fixed it now, ty

obsidian garnet
#

One message removed from a suspended account.

#

One message removed from a suspended account.

slow dome
#

with something like from_timestamp()

#

or smt

obsidian garnet
slow dome
#

is it that bad if you make it an int

obsidian garnet
#

One message removed from a suspended account.

obsidian garnet
slow dome
#

well, time.time() gives you the unix time

obsidian garnet
#

One message removed from a suspended account.

potent rivet
#

i think so

obsidian garnet
#

One message removed from a suspended account.

potent rivet
#

uh

#

idk

#

i think either date or run_date is a float and thats no good

#

does anyone know why when I have something like this my bot only sends the message if the message is sent by the bot. Example, I send "test" and nothing happens, I make a command to make bot say "test" and it works

#

hmm might be because it doesnt have messages.read scope but I can't give it that

potent rivet
#

fixed it

potent rivet
#

Is there anyway to use an if state so that if the message is sent by my bot it won't send the message?

sudden path
#

message.author

#

Figure out the rest by yourself

potent rivet
#

ok thanks

#

ok got it, thanks much

potent rivet
#

can anyone help, im trying to make an embed and keep getting this

half marsh
potent rivet
#

oh ok

#

tutorial had it as name

#

title*

#

yep that worked, thank you

half marsh
#

Sip

late fjord
#

what would be the best way to get a member from thier id in a slash command?

#

i thought ctx.guild.get_member(id) would work but it seems not

#

ah fetch_member works.

rigid wave
#

Can I make this wait press a button?

await self.bot.wait_for(...)
frank moon
#

Is select in modal gonna be added soon?

gilded widget
frank moon
#

i mean in pycord

#

isnt it already working for pc users only

#

mobile broken

gilded widget
#

no?

#

select in modal doesnt exist yet

#

discord hasnt implemented it yet

#

it'll definitely be added once discord adds it

frank moon
#

its implemented...

gilded widget
#

where?

frank moon
#

.

#

dpy already has it i think

gilded widget
#

if you're talking about select menus inside of modals then no, it doesn't exist right now

gilded widget
#

yeah that's 100% just photoshop

#

tried sending the link to the discord devs server but link got deleted, you can go ask in there and they'll tell you its not implemented yet

frank moon
#

????

frank moon
#

how is this photoshop lmao

gilded widget
#

just checked their latest docs and it doesnt exist there either

#

and i have no idea tbh

#

id be shocked if discord just rolled it out with zero announcements

frank moon
#

someone even made it

gilded widget
#

well shit if it does exist its the first im hearing of it and havent heard anything from discord abt it

#

maybe its on canary

frank moon
#

idk prob

gilded widget
#

yeah seems like discord pulling some weird shit again

#

looks like it is on regular discord but unannounced, undocumented and potentially buggy according to one of the devs

#

it'll probably be implemented in pycord once the feature is actually documented

random kayak
#

Hi, are the VoiceChannel's class text methods for Voice Text Chat Channels? Like is the bot able to send messages in there too at the moment, or not yet?

inland acorn
#

how to invoke a slash subcommand in other command

plush lintel
#

hello this is my error: Ipy mportError: cannot import name 'PartialMessageable' from 'discord.channel' (/Users/luke/PycharmProjects/bot/venv/lib/python3.10/site-packages/discord/channel.py)
how can i fix it?

#

thx

keen root
cedar eagle
#

Quick question, is it possible to build a thread object by passing an ID of an existing thread? discord.Thread({id}) or do I need more information than that. The bot will already be in that thread and have the server permissions to see that thread, even if archived or private. just making sure I don't need anything other than the ID

keen root
plush lintel
#

ok thx

plush lintel
keen root
keen root
plush lintel
#

but it still shows

#
ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (/Users/luke/PycharmProjects/bot/venv/lib/python3.10/site-packages/discord/channel.py)
cedar eagle
#

python3.10/site-packages/discord/channel.py

#

it's trying to import from discord not py-cord

plush lintel
#

ok

cedar eagle
#

wait. belay that. discord is still the package name. my bad

ivory zenith
#
    @info_group.command(name='guilds', description = 'send a file with all the guild id\'s')
    async def show_guilds(self, ctx:ApplicationContext):
   
        if ctx.user.id not in dev_ids:
            await ctx.response.send_message("Sorry, only devs can do that!")
            return

        filee = open('guilds.txt', 'a+')

        for guild in self.bot.guilds:
            filee.write(f"{guild} - {guild.id} \n")
        await ctx.response.send_message("Here is the guilds list", file = discord.File(filee), ephemeral = True)
        filee.close()

Hi, i m trying to send a file, but it sends an empty file

ivory zenith
#

and my file is not empty

cedar eagle
plush lintel
#

ok

plush lintel
plush lintel
#
Traceback (most recent call last):
  File "/Users/luke/PycharmProjects/pythonProject4/main.py", line 5, in <module>
    from discord.ui import Button, View, Select
  File "/Users/luke/PycharmProjects/bot/venv/lib/python3.10/site-packages/discord/ui/__init__.py", line 12, in <module>
    from .button import *
  File "/Users/luke/PycharmProjects/bot/venv/lib/python3.10/site-packages/discord/ui/button.py", line 32, in <module>
    from ..components import Button as ButtonComponent
  File "/Users/luke/PycharmProjects/bot/venv/lib/python3.10/site-packages/discord/components.py", line 41, in <module>
    from .enums import ButtonStyle, ComponentType, InputTextStyle, try_enum
ModuleNotFoundError: No module named 'discord.enums'
ivory zenith
#

but i just used the path instead of the file var

#

and it worked

cedar eagle
plush lintel
#

ah ok sad sad sad

sick stirrup
#

yep

plush lintel
#

what module shall i use to import buttons and stuff?

rigid wave
#

Can I make this wait press a button?

await self.bot.wait_for(...)
plush lintel
#

couldnt y?

half marsh
plush lintel
#
Traceback (most recent call last):
  File "/Users/luke/PycharmProjects/pythonProject4/main.py", line 5, in <module>
    from discord.ui import Button, View, Select
ModuleNotFoundError: No module named 'discord.ui'
#

what is happening?

rigid wave
half marsh
plush lintel
#
Package            Version
------------------ -----------
aiohttp            3.7.4.post0
aiosignal          1.2.0
async-timeout      3.0.1
attrs              21.4.0
beautifulsoup4     4.11.1
certifi            2021.10.8
cffi               1.15.0
chardet            4.0.0
charset-normalizer 2.0.12
DateTime           4.4
ffmpeg             1.4
frozenlist         1.3.0
humanfriendly      10.0
idna               3.3
multidict          6.0.2
names              0.3.0
Pillow             9.1.1
pip                22.1.2
py-cord            1.7.3
pycparser          2.21
PyNaCl             1.5.0
pytz               2022.1
requests           2.27.1
setuptools         57.0.0
six                1.16.0
soupsieve          2.3.2
typing_extensions  4.1.1
urllib3            1.26.9
wheel              0.36.2
wikipedia          1.4.0
yarl               1.7.2
youtube-dl         2021.12.17
zope.interface     5.4.0
#

please tell me which of the packages are making confusion

half marsh
#

ui models are available in pycord 2.0

plush lintel
#

yea it worked!

ivory zenith
#

how do i check how many bots are in a guild?

half marsh
ivory zenith
ivory zenith
half marsh
open bearBOT
jolly belfry
#

can someone help?

half marsh
pale crow
#
  File "C:\Users\Mridul Negi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Mridul Negi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\bot.py", line 1038, in on_connect
    await self.sync_commands()
  File "C:\Users\Mridul Negi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\bot.py", line 685, in sync_commands
    await self.http.bulk_upsert_command_permissions(self.user.id, guild_id, guild_cmd_perms)
  File "C:\Users\Mridul Negi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\http.py", line 357, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed```

Somebody help, asking for 4th time TwT
#

nope

#

thats first time my bot is logging in

#

as per the error it seems happens when syncing commands

#

ig

worthy basin
#

First check your version. Is 2.0rc1

#

If it is send your code please

pale crow
worthy basin
#

Ok could you send your code. please

pale crow
#

sure

#
import discord
from discord.ext import commands
from discord.commands import permissions,Option
import psycopg2
intents = discord.Intents().all()
intents.members = True
intents.message_content=True
prefix = 'p!'
bot = commands.Bot(command_prefix=prefix,intents=intents,debug_guilds=[981533402429812746],activity=discord.Activity(type=discord.ActivityType.listening, name=f"voting"),status=discord.Status.dnd)
bot.remove_command("help")

con = psycopg2.connect('postgres://grunnwgnhjobes:441b8447e23c7b73b91140f7d6c5997a68da1ab6eb36016a7cbd5e6ef9101cae@ec2-35-169-188-58.compute-1.amazonaws.com:5432/d815dnp34od7j4', sslmode='require')
query = con.cursor()

@bot.event
async def on_ready():
    print('We have logged in as {0.user}'.format(bot))
bot.load_extension("cogs.voting")
#

oh wait

#

there is an unnecessary import

worthy basin
#

Sorry you will have to wait 10-20 min I'm not on PC so I can't see the whole file.

pale crow
#

ok

#

btw will interaction just failed if around 100 people uses the button together

#

whenever someone clicks, the label on button changes to number of times clicked

worthy basin
#

A few things I can input. It make sure all of your command names are valid and also make sure you invited your bot with the slash commands permission.
Can't remember what is is called rn

pale crow
#

any way to avoid that

worthy basin
#

Oops responded to the wrong message

pale crow
#

lol

worthy basin
pale crow
#

The error does no harm till now

#

code works just fine

worthy basin
pale crow
#

I am using defer, ig it shouldnt cause interaction error

worthy basin
#

Try reinstalling pycord if you have not as well

#

You might be on an old git version

worthy basin
pale crow
#

What specs for the server you prefer for that amount of traffic?

#

I always hosted free before for small projects 💀

pale crow
worthy basin
#

Ngl my bot is in 2 servers with like 5 people who have ever used cuz its in development. But there is some cheap hosing out there. I think the host I use charges $0.75 for the cheapest bot hosting.

cedar eagle
#

So I got another quick question, this one about Views. I'm seeing in the guide that you can update the view with something akin to await self.message.edit() but looking at the documentation, it doesn't look like a View has any property message. Is this the proper way to edit a View's message? the exact thing I'm trying to accomplish is a View that cleans itself via deletion upon timeout.

#

current implementation is

class MyView(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=10)
    async def on_timeout(self):
        await self.clean_up()
    async def clean_up(self):
        await self.message.delete()

that's the basics anyway. theres other stuff there but this is the part I really need help with

worthy basin
#

So a view is attached to a message. You will need to edit the message that contains the View. In your example clearing it would be Message.edit(view=None) let me find how to get the message from the view

cedar eagle
#

hmm. I would love to be able to send the message to the view but the message hasn't been created by that point 😅

worthy basin
#

There is always a message when a view is sent even if there is no text

#

You could pass the message as an argument to MyView

cedar eagle
#

that's the thing. If I use ctx.respond then the message hasn't been created when I'm trying to inject it

worthy basin
#

Im not getting what you mean, sorry?

half marsh
#

on your constructor

class MyView(discord.ui.View):
    def __init__(self, msg: discord.Message = None):
      self.message = msg
cedar eagle
#

ctx.respond can take in a string and a views parameter. if I use it like that then the message hasn't been created by the time I'm trying to pass it into the view. theres no reference to it yet

worthy basin
#

Ah ok, i see it now

cedar eagle
#

thing = await ctx.respond('mymessage' views=MyVew(thing)) just wont work

half marsh
#

the set your message attr to that message var

cedar eagle
#

I'd like to send the view clean without having to edit it to attach the view

half marsh
#
rsp = ctx.respond(view=view)
SubView.message = resp
cedar eagle
#

well, attaching the view isn't that bad actually. I could look into doing that

worthy basin
#

I will ask to see if there is a way to more easily get the message a view is attached to.

cedar eagle
#

there is the possibility of a race condition because more than one thing calls the clanup method. but it should be okay

#

the SubVew.message thing doesn't work because it's an instance variable I'd be changing. dangerous to make it and change a class variable. I'm going to have multiple of these views and if I pass it to ctx.respond(views=MyView) the view itself is an anonymous view. I guess I could instance it before hand

InstView = MyView()
resp = ctx.respond(views=InstView)
InstView.message = resp```
#

Actually that's probably clean enough for what I need done

worthy basin
#

Great, sorry I was not more help.

cedar eagle
#

My only worry is the race condition, but with the way it's programmed it will persist if the instance doesn't have a message when clean_up is called

worthy basin
#

First one try re-installing py-cord with 2.0rc1
Second it is ephemeral not hidden

#

From the breaking change log

Attributes that returned Asset are renamed, e.g. attributes ending with _url (i.e. avatar_url) are changed to avatar.url. User.avatar returns None in case the default avatar is used.

#

ctx.defer() still works

ivory zenith
#

how can i add options in a slash command? like the user has to select from to values in the command

craggy linden
#

How would I reload a file (Not a Cog)

Ex of what I've tried:

import randomFolder.FileName # Tried to reload it like this "reload(randomFolder.FileName)" and "reload(randomFolder)"

# Tried reloading the module thinking it would reload the folder in general or the file :/

@client.command()
async def reloadFile(ctx, ext: str):
  await reload(ext) # Tried using pythons reload function :/
  await ctx.send(f"Reload {ext}")

Didn't work, ofc.

What I'm trying to do:

Reload a file/ or folder without closing and reopening a new terminal.

craggy linden
jolly belfry
#

I have this bot written in replit and discord.py and i cant make the leaderboard work. Idk why. I followed CodeWithSwastik tutorial ep 4 link -> https://www.youtube.com/watch?v=dI3_DWhfT8U

What i want is to make a leaderboard which will show the top 5 people with the most money
I use json file as database (ik its not recomended but ik how to use it so i use it)
json example for one person ->

        "coins": 12253,
        "job": "none",
        "expirience": 0,
        "inventory": [],
        "bank": 10000
    }

The code for the leaderboard command ->

@bot.command(aliases=['lb'])
async def leaderboard(ctx, pepol_to_show = 5):
  data = await get_bank_data()
  
  lb = {}
  total = []

  for user in data:
    name = int(user)
    total_amount = data[user]["coins"] + data[user]["bank"]
    lb[total_amount] = name
    total.append(total_amount)

  total = sorted(total,reverse=True)

  em4 = discord.Embed(title = f"Top {pepol_to_show} Richest people", description = "Who has the most potatoes (Wallet + Bank)", color = discord.Colour.red())
  index = 1
  for amt in total:
    id_ = lb[amt]
    member = bot.get_usser(id_)
    name = member.name
    em4.add_field(name = f"{index}. {name}", value = f"{amt}", inline = False)
    if index == pepol_to_show:
      break
    else:
      index += 1

  await ctx.reply(embed=em4)
    
    
async def get_bank_data():
  with open("users.json", "r") as f:
    data = json.load(f)

  return data

When i run the lb command nothing is sent in discord and i get 0 errors. No idea why
Why doesnt this work? What do i need to do to fix it?

jolly belfry
#

no

craggy linden
#

If so could probably be miss indention

ivory zenith
slender lintel
#

i'm getting no module named discord i tried everything its not working 😢 my other bots work fine aswell

craggy linden
ivory zenith
#

do they work the same?

ivory zenith
#

oh oki

craggy linden
#

They look just alike so, I'm pretty sure they work the same.

slender lintel
#

ModuleNotFoundError: No module named 'discord'

craggy linden
#

kinda the same thing with d.py

craggy linden
#

if so remove it and see if the cmd returns an error

craggy linden
# ivory zenith i want it in pycord xD
import discord
from discord.ext import commands
from discord.ui import View
from discord.ui import Select


@client.slash_command(guild_ids = serverID)
async def test(self, ctx):

    view = discord.ui.View()

    TestButton = discord.ui.Button(
        label="Button",
        style=discord.ButtonStyle.red,
        emoji="❎"
    )

    async def se_callback(interation):
        await interation.send_message(view=view)

    TestButton.callback = se_callback
    view.add_item(TestButton)
    await ctx.interaction.response.send_message(view=view)
#

try sum like that.

#

could put an embed first if needed.

ivory zenith
#

@craggy linden

#

i m looking for something like this

craggy linden
#

I don't do slash commands so I wouldn't be much help :/ I prefer regular chat cmds 😭

slender lintel
craggy linden
#

np

craggy linden
ivory zenith
craggy linden
#

try uninstalling d.py and pycord then install pycord

slender lintel
craggy linden
#

I had the error once but forgot how I fixed it.

craggy linden
slender lintel
#

i had it too

craggy linden
#

try uninstalling d.py

#

then install it after a few seconds

craggy linden
craggy linden
ivory zenith
#

@craggy linden

@info_group.command(name='blacklist', description = 'blacklist commands')
    async def blacklist(self, ctx:ApplicationContext, action:discord.Option(str, 'test', choices = [discord.OptionChoice(name="+", value="+"),discord.OptionChoice(name="-", value="-")])):
        await ctx.send('test')
#

this worked, in case you want to use something similar

craggy linden
#

Eh, Ima stick to chat commands.

#

Instead of slash cmds

#

since I can just do async(ctx, value1, value2, value3=None): etc...

jolly belfry
#
Ignoring exception in command leaderboard:
Traceback (most recent call last):
  File "/home/runner/DiscordPotatoBot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "main.py", line 406, in leaderboard
    name = member.name
AttributeError: 'NoneType' object has no attribute 'name'

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

Traceback (most recent call last):
  File "/home/runner/DiscordPotatoBot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/DiscordPotatoBot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/runner/DiscordPotatoBot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'name'
craggy linden
#

member.name I'm guessing is the error

jolly belfry
#

yeah

#

what do i need to do?

craggy linden
#

give me a min

craggy linden
jolly belfry
#

replit import discord

#

thats what i did

craggy linden
#

Did you do pip install discord or pip install pycord

jolly belfry
sudden path
craggy linden
#

try member_name

jolly belfry
sudden path
jolly belfry
#

yeah

craggy linden
sudden path
sudden path
jolly belfry
#

what do i need to do then?

sudden path
#

This is pycord. So either install py-cord or go to d.py server

jolly belfry
#

kk

craggy linden
#

This is pycord server, but this channel is for helping in "general".

#

So it doesn't matter what he uses he can still receive help, since pycord and discord.py are very similar.

craggy linden
sudden path
#

You have no context on the command and you're telling him to use ctx.author.name?

craggy linden
#

Are your blind?

#

If I'm not mistaken async def leaderboard(ctx, pepol_to_show = 5): ctx does stand for Context

sudden path
#

What if he's getting users and then getting their name?... it is a leaderboard command

craggy linden
#

If so then he can simply get the names from the json file.

bronze wedge
#

anyone has an idea why the git ignore file is in my commit list?

sudden path
craggy linden
#

He could simply try and get the name from the ID or just start logging names.

#

He alr told me in dms he's gonna try logging usernames.

#

So problem solved.

sudden path
#

Logging names is completely inefficient.

craggy linden
#

I don't see how it's "inefficient"

sudden path
sudden path
craggy linden
#

Well then, like I said he could just use the users ID to get the Username.

#

<@ID> Since it would be more "efficient"

sudden path
#

You realise mention ≠ username.

craggy linden
#

I don't think a person would get mentioned/pinged if it was placed in an embed.

#

Which he is doing.

craggy rapids
worthy basin
craggy linden
#

Not really, most features are compatible.

slender lintel
#
  ModuleNotFoundError: No module named 'discord.utils'```
#

@worthy basin this forces me to install pip install discord

worthy basin
#

No, if you have pycord installed it should not. You might have to restart your IDE for it to recognize it.

slender lintel
#

okk

worthy basin
craggy linden
#

If you look at discord.py github and pycord github a lot of stuff is fairly the same.

half marsh
#

this guy smh

craggy linden
#

Take the examples section as an example.

#
# Pycord #
import asyncio

import discord


class MyClient(discord.Client):
    async def on_ready(self):
        print(f"Logged in as {self.user} (ID: {self.user.id})")
        print("------")

    async def on_message(self, message):
        if message.content.startswith("!editme"):
            msg = await message.channel.send("10")
            await asyncio.sleep(3.0)
            await msg.edit(content="40")

    async def on_message_edit(self, before, after):
        msg = f"**{before.author}** edited their message:\n{before.content} -> {after.content}"
        await before.channel.send(msg)


client = MyClient()
client.run("token")
#
# Discord.py #
# This example requires the 'message_content' privileged intent to function.

import discord
import asyncio


class MyClient(discord.Client):
    async def on_ready(self):
        print(f'Logged in as {self.user} (ID: {self.user.id})')
        print('------')

    async def on_message(self, message):
        if message.content.startswith('!editme'):
            msg = await message.channel.send('10')
            await asyncio.sleep(3.0)
            await msg.edit(content='40')

    async def on_message_edit(self, before, after):
        msg = f'**{before.author}** edited their message:\n{before.content} -> {after.content}'
        await before.channel.send(msg)


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

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

Completely the same.

#

I mean, I know it's just a fork, but they could try making it like nextcord.

half marsh
#

not when you *going into pages

craggy linden
#

And completely different.

#

"fairly" similar

#

Not completely.

worthy basin
#

If its only kind of the same we won't be able to help. We also don't want to mislead pycord users if they see a dpy user getting help for a similar issue and copy it.

#

They have there own support server and you will get better help for dpy there anyway

agile roost
#

How do a make a Server Roles list but with reaction pages?

worthy basin
agile roost
#

So I already know how to make pages but the problem is when I use ctx.guild.roles it sends the same embed 50 times instead of making pages

steep verge
frank moon
steep verge
frank moon
frank moon
steep verge
#

So they aren’t added to Pycord

#

Hope they add it soon tho

frank moon
#

mhm

#

it doesnt work in mobile

#

thats prob what they meant by 'not fully functional'

craggy linden
steep verge
#

Yes I know jeez

slender lintel
#

Whenever i start my bot i get a ton of errors,

DEBUG:discord.client:Dispatching event member_update
DEBUG:discord.gateway:Keeping shard ID None websocket alive with sequence 8.
DEBUG:discord.gateway:For Shard ID None: WebSocket Event: {'t': None, 's': None, 'op': 11, 'd': None}
DEBUG:discord.gateway:Keeping shard ID None websocket alive with sequence 8.
DEBUG:discord.gateway:For Shard ID None: WebSocket Event: {'t': None, 's': None, 'op': 11, 'd': None}
``` then its got a ton if infomation about this one server above it
#

like guild id, role info all that its really weird

rigid wave
lucid cove
#

why does import discord.ext not work?

#

cannot import name 'commands' from 'discord.ext'

#

I have pycord installed

slender lintel
half marsh
slender lintel
half marsh
slender lintel
#

Oh okay, Thanks

lucid cove
slender lintel
#

So i can have a command for myself only and admins

slender lintel
half marsh
slender lintel
#

alr

half marsh
slender lintel
half marsh
#

do you even know about logging?

half marsh
slender lintel
#

okay

slender lintel
lucid cove
#

god i fucking hate this

half marsh
#

!install

robust nebulaBOT
#

Install pycord:

pip uninstall discord.py
pip install py-cord

Install pycord beta:

pip uninstall discord.py
pip install py-cord==2.0.0b7

Install pycord alpha from git:

pip uninstall discord.py
pip install git+https://github.com/Pycord-Development/pycord
lucid cove
#
    if ctx.content.startswith("?joke"):
AttributeError: 'Context' object has no attribute 'content'
#

how to fix th is

#

when i was using dpy i used to have message.content.startswith

#

do i just do message.startswith?

half marsh
#

b!rtfm pyc context

lucid cove
#

so message is part of the context

#

i see

half marsh
#

b!rtfm pyc commands.context

jagged sand
#

how to do this (it is in dutch)

half marsh
#

and double quote

#

then add +

#
yourvar = var1 + var2
slender lintel
#
print(sys.version)
import discord
from discord.ui import Button
from discord.ext import commands
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)

bot = discord.Bot(debug_guilds=[965533467557371944,933803468815204372,964126154774679582])
bot = discord.Bot()
bot = commands.Bot(command_prefix='!')
async def stats(ctx):
     ctx = ', '.join(ctx)
     await ctx.send('My ping is {bot.latency}')```
#

My !stats command isnt doing anything

jagged sand
#

the thing is that i have to do 1 - 2

half marsh
lucid cove
#

how can make slash command lol

#

i currently have bot.command() but its not showing up when i type /

half marsh
slender lintel
#

theres a basic one

slender lintel
jagged sand
lucid cove
#

whats the difference

gilded widget
#

look over this

half marsh
lucid cove
#

bruh just tell me

#

difference between respond and send

#

u dont need to link to the docs for a simple question

half marsh
lucid cove
#

so respond is just send but with referenace = ctx.message

lucid cove
#

ok

slender lintel
lucid cove
#

dont think its rudea

#

and lets be real linking the docs doesnt help much

#

i could have just searched

#

either way

#

why are embeds not the same in pycord

#

TypeError: Expected discord.Colour, int, or Embed.Empty but received NoneType instead.

#

i get this error

#

for this

embedvar = discord.Embed(
                    colour = ctx.message.author.accent_color
                )
slender lintel
slender lintel
lucid cove
#

ok

slender lintel
half marsh
slender lintel
#

on discord dev portal right?

half marsh
slender lintel
#

How do i enable the intent outside of dev portal

half marsh
#

I mean on what is it called? Bot class?

slender lintel
half marsh
#

bot.intents = discord.intents.default()

slender lintel
half marsh
#

Yes i guess

lucid cove
#

? AttributeError: 'Context' object has no attribute 'respond'?

half marsh
#

b!rtfm pyc intents

lucid cove
#

ctx.respond aint working lol

slender lintel
#

Thanks

slender lintel
half marsh
#

Use reply for prefix comand

lucid cove
#

yea reply is fine

gilded widget
lucid cove
#

but i have one slashh command

#

but it aint showing up

#

at all

gilded widget
#

do you have application.commands permissions from the dev portal?

slender lintel
#

Make sure you invite your bot with the correct scopes as said above

#

It needs application.commands, once thats added re invite it

lucid cove
#

how do i enable application.commands?

slender lintel
lucid cove
#

i mean i have the bot as admin either way

#

shouldn't that give it all perms

slender lintel
slender lintel
half marsh
#

Eh

#

It should not matter ig?

#

Try use either one from discord or commands thonk

half marsh
#

use either

bot = commands.bot(...)

or

bot = discord.bot(...)
slender lintel
#

bot = commands.Bot(command_prefix='!') I already have this

#

is that the same?

gilded widget
#

if so you havent set intents and you need those

slender lintel
# gilded widget is your code that exact line?
print(sys.version)
import discord
from discord.ui import Button
from discord.ext import commands
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)

bot = discord.Bot(debug_guilds=[965533467557371944,933803468815204372,964126154774679582])
bot = discord.Bot()
bot = discord.Intents.all()
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
    await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name='Over The Felbcord'))
    
    print('Connected to bot: {}'.format(bot.user.name))
    print('Bot ID: {}'.format(bot.user.id))```
#
async def stats(ctx):
     await ctx.respond('My ping is {bot.latency}')
gilded widget
#

remove all this:

bot = discord.Bot(debug_guilds=[965533467557371944,933803468815204372,964126154774679582])
bot = discord.Bot()
bot = discord.Intents.all()
bot = commands.Bot(command_prefix='!')

and replace with this

bot = commands.Bot(command_prefix='!', intents=discord.Intents.all(), debug_guilds=[965533467557371944,933803468815204372,964126154774679582])
#

or

intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='!', debug_guilds=[965533467557371944,933803468815204372,964126154774679582], intents=intents)
slender lintel
gilded widget
#

yeah but you can define that inside of commands.Bot

slender lintel
#

okay

slender lintel
#

yeah i see

#

u edited

#

ty

gilded widget
#

anywhere really, doesn't matter as long as its in there

#

np

desert dagger
#

Is there an event emitter? like a way to test an event

lucid cove
#

alright

gilded widget
lucid cove
#

is there a way to let the bot reply to the slash command with a reference

#

ie it is highlited in yellow as if it was replying

#

normally

desert dagger
#

i found bot.Dispatch

sleek grove
#

can you make a menu in pycord slash commands? so that you make e.g. /role and there can say add or remove?

gilded widget
desert dagger
sleek grove
slender lintel
#

{bot.latency}, Where can i find all the infomation related to stuff related to bot latency ect, Its wrong but i dont know the right one

slender lintel
desert dagger
#

^^^

lucid cove
#

also why does this not work

color = ctx.message.author.accent_color
#

this is in an embed btw

slender lintel
desert dagger
#

uhh

lucid cove
#

no u told me how to fix it not why

slender lintel
#

Change it to Embed = discord.Embed(title="(Your Title)", Description="(Put your embed text here", Color=color=discord.Color.blue())

lucid cove
#

bruh

desert dagger
#

alright bruh

#

what are u trying to do?

slender lintel
gilded widget
#

it doesnt always return something

desert dagger
#

ah i see

gilded widget
#

read the docs pls

desert dagger
#

what baron said

#

not everyone has one

gilded widget
#

plus you have to fetch the user first to get it if it even exists

lucid cove
#

wait so whats an accent color

#

whats the accent

desert dagger
#

background color of a user

lucid cove
#

i see