#General Help

1 messages · Page 19 of 1

vagrant mortar
#

Hmmm Nelo, discord.Thread works now. It didn't a week ago, when I started to ask this question...

#

But.. it works, so I'm happy. 🙂

slender lintel
#
  @commands.cooldown(1,20, commands.BucketType.user)
  async def say(self, ctx, message):
     if ctx.author.guild_permissions.read_messages:
        await ctx.respond(message)
        await ctx.respond('I have sent this.', ephemeral=True)``` Why do i get command not found? I am moving to normal commands
crimson coral
#

oh that's odd

slender lintel
#

Have a database that stores prefixes per guild and run a function that returns the prefix

crimson coral
vagrant mortar
slender lintel
vagrant mortar
#

ephemerals only work with interactions (application or otherwise)

slender lintel
crimson coral
#

and just using discord.Thread will only list public threads, not private or news threads

vagrant mortar
slender lintel
#

Well ye for bridge

vagrant mortar
crimson coral
#

ehh to each their own, slash commands are pretty good now and i usually opt for them but people still have their preferences

vagrant mortar
#

I can't think of a reason to go for prefixed, now that we have permissions and backend v2.

#

now if your server has neither of those (which should be a very tiny amount of servers atm) I would say sure, go for prefixed. But otherwise I can't think of a reason why 🤔

slender lintel
#

Prefixed commands look way cooler

slow dome
#

What javascript lib is the most similar to pycord/d.py/d.py forks?

idle wagon
#

Is it possible to make embed field copy?

slender lintel
slender lintel
vagrant mortar
#

The cool extra features?

slow dome
vagrant mortar
#

Like ephemerals, modals, user commands, message commands

slow dome
crimson coral
vagrant mortar
#

people can do a / and see all your commands.

slender lintel
brittle sundial
#

#986310307146264636

#

#986310307146264636 someone come please

crimson coral
#

they still have some ways to go but they're certainly much better than when they were first introduced and received with disdain

vagrant mortar
#

And the slash command suggestion thing they added recently is also helping a great deal.

#

where it will suggest a slash command, with pretty much any known commonly used prefix.

#

so !monster, on my server would say:

#

Which is helping people to transition too 🙂

idle wagon
#

how can add to it embed field in this list? I will be grateful.

keen root
slender lintel
#
     if filename.endswith('.py'):
        bot.load_extension(F'commands.{filename[:-3]}')
        for filename in os.listdir('Embeds'):
            if filename.endswith('.py'):
              bot.load_extension(F'Events.{filename[:-3]}')``` Trying to connect some folders with my main file, Its the correct names but i get 'No module named Events'
#

Nevermind i just named it wrong (another one i was going to add) but now i get extenstion.rules is already loaded

#

How would i unload it?

crimson coral
#

guess

slender lintel
#

bot.unload_extension(f"Embeds.{Embeds}")?

crimson coral
#

congratulations

#

or well, whatever the name is

slender lintel
#

yeah

#

lol

slender lintel
slender lintel
crimson coral
#

reread your code

slender lintel
#

bot.unload_extension(F"Embeds.{filename[:-3]}") changed to this, no errors

#

i re read xD

slender lintel
#

@crimson coral

#

Ive unloaded the cog, I dont see the issue

sleek grove
#

how to send message when the bot gets pinged

slender lintel
# sleek grove how to send message when the bot gets pinged
async def on_message(message):
    if bot.user in message.mentions:
        Welcome=discord.Embed(title="Felbot",url="https://github.com/VividBlue1/Felbcord-Py/tree/discord",description="Hello! I am a personal slave bot who helps around moderating and providing fun into the felbcord! \n If you have any questions about me feel free to ask @ignfoolish#0396 - my creator \n Join Felbcord here!",color=discord.Color.blue())
        Welcome.set_author(name="FelBot", url="https://github.com/VividBlue1/Felbcord-Py/tree/discord", icon_url="https://i.ibb.co/tz7VQJw/felb.jpg")
        await message.channel.send(embed=Welcome)```
#

Heres an example of mine :)

slender lintel
#

its already loaded

#

yeah, but ive unloaded it

#

try again

#

Its unloaded, Loaded again and same errror

#

hm

#

I have tried multiple times

slender lintel
#

and you are unloading it again

#

even though it isnt loaded

#

bot.unload_extension(F"Embeds.{filename[:-3]}") to unload right? (when runnign this i get told, its not loaded but when i load same error as before)

slender lintel
#

you never loaded it before

#

and then you are telling it to unload it

#

even though it isnt even loaded

#

Yeah but when i try to load it i get the error

#

saying i have loaded it

slender lintel
#

or is it just to store variables

slender lintel
#

You want me to update my github and you can see it there?

slender lintel
#

you are unloading the cog

#

every single

#

time

#

you load a cog in your commands directory

#

Yeah but ive now got a seperate folder called Embeds and Rules.py inside it

slender lintel
#

wym?

#

or do something like

directories = ["./commands", "./Embeds"]

for directory in directories:
   for filename in os.listdir(directory):
      bot.load_extension(f"{directory[2:]}.{filename[:-3]}")```
#

Thanks

#

I don't see a point in unloading something that is already unloaded just keep it loaded

slender lintel
# slender lintel I don't see a point in unloading something that is already unloaded just keep it...
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\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 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\jackd\Documents\Felbcord Py\commands\say.py", line 2, in <module>
    from discord.ext import slash_command
ImportError: cannot import name 'slash_command' from 'discord.ext' (unknown location)

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

Traceback (most recent call last):
  File "C:\Users\jackd\Documents\Felbcord Py\main.py", line 12, in <module>
    bot.load_extension(f"{directory[2:]}.{filename[:-3]}")
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 787, in load_extension    self._load_from_module_spec(spec, name)
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 718, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'commands.say' raised an error: ImportError: cannot import name 'slash_command' from 'discord.ext' (unknown location)``` (It worked before i changed this)
#

uh no

#

from discord.commands import slash_command

#

or from discord import slash_command im pretty sure

slender lintel
#

Say cog was loaded, Has been for ages

#
AttributeError: module 'discord.commands' has no attribute 'Bot'```
#

...

#

from discord.ext import commands

#

bru im dumb, I had that but changed it to from discord for some reason

#
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\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 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\jackd\Documents\Felbcord Py\commands\say.py", line 2, in <module>
    from discord.ext import slash_command
ImportError: cannot import name 'slash_command' from 'discord.ext' (unknown location)

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

Traceback (most recent call last):
  File "C:\Users\jackd\Documents\Felbcord Py\main.py", line 13, in <module>
    bot.load_extension(f"{directory[2:]}.{filename[:-3]}")
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 787, in load_extension    self._load_from_module_spec(spec, name)
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 718, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'commands.say' raised an error: ImportError: cannot import name 'slash_command' from 'discord.ext' (unknown location)```
graceful robin
#

I wanted to organize my code with cogs but...
discord.errors.ExtensionFailed: Extension 'cogs.events' raised an error: ClientException: Cog named 'events' already loaded

slender lintel
slender lintel
slender lintel
graceful robin
#
cogs = []

for filename in os.listdir("./cogs"):
    if filename.endswith(".py"):
        cogs.append("cogs." + filename[:-3])

print(cogs)

if __name__ == "__main__":
    for cog in cogs:
        client.load_extension(cog)

slender lintel
# slender lintel look at which file it tells you to change

I changed from discord.ext to from discord but got this

  File "C:\Users\jackd\Documents\Felbcord Py\main.py", line 13, in <module>
    bot.load_extension(f"{directory[2:]}.{filename[:-3]}")
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 785, in load_extension    raise errors.ExtensionNotFound(name)
discord.errors.ExtensionNotFound: Extension 'commands.__pycach' could not be found.```
slender lintel
#

cause i might have my indexing wrong

#

so print(f"{directory[2:]}.{filename[:-3]}")

#

or am i being stupid

#

mhm

#

Yay it started

slender lintel
#

cause you have it as print rn

#

Ima check if they work

slender lintel
slender lintel
graceful robin
#

it worked

#

but how

#

lemme check if everything loaded correctly

#

it didnt work

slender lintel
graceful robin
#

dont ping

slender lintel
slender lintel
#

Also did you guys jsut load them somewhere else and then loaded them again or something?

slender lintel
slender lintel
#

As i have commands folder w my cogs that used to work and my embeds folder

#

w a cog

slender lintel
slender lintel
#

like push to a github or something

#

yeah

#

or send in file

#

Sure, Ive got one just need to update it

#

gimme a sec

#

@graceful robin can you send full code in a file please i want to see what you guys did.

#

its ok i can read it

#

upload to github

#

he deleted his msg lol

graceful robin
#

i already did

#

its outdated tho

slender lintel
#

update it then?

#

e

#

use git add -A btw

graceful robin
#

it will take too much time

#

ima just upload a zip file

slender lintel
graceful robin
#

i didnt connect to github

#

and stuff

#

i didnt set that up

slender lintel
#

Oh okay, I thought you said you had one already lol

graceful robin
#

I used the website 😳

slender lintel
graceful robin
#

i get the same one

#

oh god discord reset my bot's token

slender lintel
#

Lol

slender lintel
#

ok i didnt full read it

#

?

#

Oh

#

well ik what went wrong

graceful robin
slender lintel
#
for directory in directories:
   for filename in os.listdir(directory):
      if filename.endswith(".py"):
         bot.load_extension(f"{directory[2:]}.{filename[:-3]}")```
#

forgot to check if it was an actual python file

#

Oh yeah

graceful robin
slender lintel
#

I'll add that in a min

slender lintel
slender lintel
# slender lintel ```py for directory in directories: for filename in os.listdir(directory): ...
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 382, in _run_event 
    await coro(*args, **kwargs)
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1042, in on_connect   
    await self.sync_commands()
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 629, in sync_commands 
    registered_commands = await self.register_commands(
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 529, in register_commands
    registered = await register("bulk", data, _log=False)
  File "C:\Users\jackd\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 359, in request      
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 7: Application command names must be unique``` seperate issue now, It wont even tell me what file has the same name
#

you didn't delete it...

slender lintel
slender lintel
slender lintel
#

just saying he didnt delete his token frmo the files

graceful robin
slender lintel
#

oh sorry

graceful robin
#

i reset it

slender lintel
#

k

slender lintel
#

idk how to fix that

slender lintel
#

¯_(ツ)_/¯

#

Do any others know, as of now i cant even use commands

graceful robin
slender lintel
#

unless you do client.sync_commands() twice maybe?

slender lintel
graceful robin
#

Same

slender lintel
#

i have 0 clue then

#

:( might make a seperate thread

slender lintel
graceful robin
#

I think that I have a different one

slender lintel
graceful robin
#

I'll wait

paper schooner
#

what is the button click event? on_button_click(payload)?

slow dome
#

except for on_interaction(interaction)

paper schooner
# slow dome except for `on_interaction(interaction)`

Hmm the docs say that

This is a low level function that is not generally meant to be used. If you are working with components, consider using the callbacks associated with the View instead as it provides a nicer user experience

but do callbacks work after restarting the bot? for example 1) user uses a command $menu to show menu, 2) bot saves the menu id to database, 3) bot restarts and loads id from database, 4) user clicks the button

slender lintel
#

#986332926616678410 pls anyone

paper schooner
#

can there exist two exactly same message ids on discord? if yes, how to differentiate between them in my database?

past gate
#

discord ids are generated from a timestamp so I doubt that

#

(I think they're generated from a timestamp)

paper schooner
#

hmm, then what if two people on two unrelated servers post message on the exact same time

sleek grove
#

help pls after i used a slash command twice the command doesn't works anymore

sleek grove
#

wait a min

worthy basin
slender lintel
sleek grove
#
Traceback (most recent call last):
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 126, in wrapped
    ret = await coro(arg)
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 852, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "Desktop/public-main/cogs/fun/coinflip-fun.py", line 13, in coinflip
    await ctx.respond(random.choice(coinflip))
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/context.py", line 227, in respond
    return await self.interaction.response.send_message(*args, **kwargs)  # self.response
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/interactions.py", line 686, in send_message
    await self._locked_response(
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/interactions.py", line 933, in _locked_response
    await coro
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/webhook/async_.py", line 211, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

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

Traceback (most recent call last):
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/bot.py", line 993, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 357, in invoke
    await injected(ctx)
  File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 134, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction```
slender lintel
#

code?

sleek grove
#
import discord
from discord import Embed
from discord.ext import commands

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

    @discord.command()
    async def coinflip(self,ctx):
        coinflip = ["Head", "Number"]
        await ctx.respond(random.choice(coinflip))

def setup(bot):
    bot.add_cog(Coinflip(bot))```
past gate
#

please format your code

#

and errors

sleek grove
#

i dont know hwo to type it cause im a mac user

slender lintel
#

#986332926616678410

#

pls

past gate
#

to make it into a code block

sleek grove
#

done.

#

?

sleek grove
mild hatch
#

```like this```

mild hatch
#

Use ctx.send or ctx.reply instead

earnest rampart
#

hey guys

#

whenever i make a command

#

they never work in my discord

#

so even if its 100% correct the bot doesnt respond

crimson gale
#

prefixed command?

earnest rampart
mild hatch
#

What's your pycord version?

crimson gale
#

are you providing your bot the required intents for prefixed commands to function?

earnest rampart
#

only just got back into discord dev

crimson gale
#

you need messages and message_content intents

earnest rampart
#

so forgot most things

mild hatch
#

Do you have the message_content intent set to true?

earnest rampart
#

one sec i deleted all my code

#

Need to make a new file

earnest rampart
crimson gale
#

you need to acquire a Intents object either by just instantiating it normally or by using one of the three factory methods

earnest rampart
#

when you say using a prefixed command

#

u mean this

#

dont you?

crimson gale
#

yes

earnest rampart
#
@client.command()
@commands.has_permissions(ban_members=True) 
async def ban(ctx, member : discord.Member, *,reason=None):
    await member.ban(reason=reason)
    await ctx.send(f'Banned {member.mention}')```
#

this command is correct yes?

mild hatch
#
intents = discord.Intents(messages=True,message_content=True)
bot = commands.Bot(command_prefix="!",intents=intents)
earnest rampart
#

Ik it wont work cause ive got bot

#

not client

#

but

mild hatch
earnest rampart
crimson gale
#

theres one more intent you should always have turned on

#

guilds

earnest rampart
#

isnt it

crimson gale
#

it is

earnest rampart
#

yeah nice

mild hatch
#

you're gonna have to add them depending on events or listeners you have

#

for example, on_raw_reaction_add would require the reactions intent

slender lintel
#

Hey @worthy basin My thread randomly closed, whys that

#

do i need to change the inactivity

crimson gale
#

auto archival

slender lintel
#

oh alr

#

Why he`s give me 1 Online Member?

    count = len([m for m in guild.members if not m.bot if m.status != discord.Status.offline])
past gate
desert dagger
#

that too

#

gimme a sec

slender lintel
desert dagger
#

yeah was gonna say

languid hollow
#

Btw when the Bot sends in DM
is it

user.send(content)
#

and what does the user have to be?

#

as in User ID

slender lintel
#

i have a next problem i have read the docs but i dont know whats wrong ?

@bot.slash_command()
async def choice_test(ctx, reason: OptionChoice(name="Reason")):
    await ctx.respond(f"Test {reason}")

Error:

Traceback (most recent call last):
  File "C:\Users\zReaxrYT\PycharmProjects\Discord Bots\main.py", line 70, in <module>
    async def choice_test(ctx, reason: OptionChoice(name="Reason")):
  File "C:\Users\zReaxrYT\PycharmProjects\Discord Bots\venv\lib\site-packages\discord\bot.py", line 914, in decorator
    result = command(**kwargs)(func)
  File "C:\Users\zReaxrYT\PycharmProjects\Discord Bots\venv\lib\site-packages\discord\commands\core.py", line 1551, in decorator
    return cls(func, **attrs)
  File "C:\Users\zReaxrYT\PycharmProjects\Discord Bots\venv\lib\site-packages\discord\commands\core.py", line 628, in __init__
    self.options: List[Option] = self._parse_options(params)
  File "C:\Users\zReaxrYT\PycharmProjects\Discord Bots\venv\lib\site-packages\discord\commands\core.py", line 676, in _parse_options
    option = Option(option, "No description provided")
  File "C:\Users\zReaxrYT\PycharmProjects\Discord Bots\venv\lib\site-packages\discord\commands\options.py", line 132, in __init__
    _type = SlashCommandOptionType.from_datatype(input_type)
  File "C:\Users\zReaxrYT\PycharmProjects\Discord Bots\venv\lib\site-packages\discord\enums.py", line 660, in from_datatype
    if datatype.__name__ in ["Member", "User"]:
AttributeError: 'OptionChoice' object has no attribute '__name__'
crimson coral
#

you should be using Option, not OptionChoice

slender lintel
crimson coral
#

you use OptionChoices inside of Options

slender lintel
crimson coral
#

(these use the decorators, but the arguments work the same as using discord.Option)

slender lintel
#

AHh now i know

#

yep its works thanks

languid hollow
#

nvm figured it out

desert dagger
#

@slender lintel

@bot.slash_command()
opt = [discord.OptionChoice(name='name of the option', value='option_value'),discord.OptionChoice(name='name of the option2', value='option_value2')]
async def choice_test(ctx, reason: Option(str, "reason", options=opt):
  if reason == "option_value"
    await ctx.respond(f"Test {reason}")
#

discord.OptionChoice can be OptionChoice if you import it

slender lintel
#

I have already thanks

desert dagger
#

yeah just showing you that way if you find it easier

upbeat hill
#

just updated pycord and now my bot has completly stopped responding to connands

#

any fixes?
or a way to revert back?

pale igloo
#

Hmmm, When making a bot with replit, Do i delete all thats already in .replit folder? Or just paste

language="python3"
run = """
pip install py-cord
python main.py
"""

[packager]
ignoredPackages=["discord.py", "discord"]
slow dome
pale igloo
#

I dont have an older replit that actually worked

slow dome
#

there are other people's

#

projects that you can also fork

pale igloo
#

How can i find them?

slow dome
#

any older python one will do

#

you can try mine

pale igloo
#

Thanks!

#

L, Phone is dead so i cant get the bot token 🤣

desert dagger
#

?tag replit

hearty rainBOT
desert dagger
#

?tag norepl

hearty rainBOT
#

Why NOT to use Repl as a hosting platform

You should not use Repl.it to host your bot.
It may be a nice option as its "free" but you should use something else considering the major flaws.

  • The machines are super underpowered.
    • This means your bot will lag a lot as it gets bigger.
  • You'll need a web server 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.

IMPORTATNT

  • 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.

If you're looking for free options, consider using AWS/Google Cloud Platform/Azure and its respective free tiers or just pay for an actual VPS.

desert dagger
#

@pale igloo just some stuff

pale igloo
#

Got it 👍 Im gonna attempt to use google cloud but if that does not work then ill have to go back to replit.

#

Thanks alot!

#

:/ Looks like im using replit, Google cloud, AWS and azure all are just free trials

desert dagger
#

I had my VM for 6 months and no issues beyond the fact its annoying to open ports

desert dagger
#

Scenario:

  • I have an embed variable
  • This embed variable has 25 fields using .add_field()
    -```py
    """ kinda some pseudo code"""
    x = discord.Embed(title='example')
    for i in range(0,25):
    x.add_field(name=i,value=i)
    b = x
- B should be first half of first embed
- X should be the 2nd half of first embed


How would i split this embed into two separate embeds?
errant verge
#

how can i make a vertical list in an embed?

desert dagger
desert dagger
errant verge
#

just the value part i mean

desert dagger
desert dagger
half marsh
#

Yea

#

You'll have 2 loop

desert dagger
#

i was hoping someone would say something like x.fields[:n] which was what i tried but i'll go with loops

half marsh
#

Idk

desert dagger
#

i was looking for an "efficient" way but looping works

half marsh
#

Yea 2 for loops are bad

#

Idk if there's other way

languid hollow
#

For link buttons I presume you can’t use class right?

#

So how would you use it without class

#

Since there’s no callback for link button I think? From what I read in the docs

sudden path
#

Add it to the view with add_item

languid hollow
#

Ok!

slender lintel
#

Hey how can I create an authorize link and once authorized do you get a specific role?

desert dagger
slender lintel
desert dagger
#

my understanding is you make a request

slender lintel
#

Anyone know how i can add block discord invites?

outer valley
slender lintel
#

For a automod

outer valley
#

U can look at his git repo to see how to do that

slender lintel
#

whos

#

@outer valley

#

?

outer valley
slender lintel
#

no

#

like dyno if u send a discord link it delets it

#

Auto Modderation

#

?

#

why react?

outer valley
#

So u r sending links to someone elses server?

slender lintel
#

NO

#

my server

#

for my bot for my server

#

like message.content?

outer valley
#

Ahh i see

slender lintel
#

but i need to check anything after the invite

#

link

outer valley
#

Message.content_startswith

#

It is something like that

slender lintel
#

LMAO!

#

yes but no

#

startswith

#

is very bad to use

gilded widget
#

not really lmao

slender lintel
#

i have so far

#

but i wanna have it check invite links

#

for discord

outer valley
slender lintel
#

ok

outer valley
#

And then u can do
If in[]

slender lintel
#

ya

outer valley
#

But y not use use startwith?

slender lintel
#

anything

#

after it

outer valley
slender lintel
#

ok

#

ill try it

outer valley
#

Unless someone just posts the end

slender lintel
#

ill let u know if u have issues

brave lagoon
#

can someone tell me why now >endDate return false ?

outer valley
outer valley
brave lagoon
slender lintel
#

datetime is SOOO useful

outer valley
#

Ahh i see

brave lagoon
#

nowTimezone: America/New_York
endTimeZone: America/New_York
now: 2022-06-14 22:11:39.011281-04:00
end: 2022-06-14 22:00:00-04:56
now >= self.endDate: False

outer valley
#

I am half blind lol😂

brave lagoon
#

I mean it should return true

outer valley
#

Damn no idea with this 1 man not on pc rn

brave lagoon
#

the only thing I see is the -04:00 and -04:56

#

at the end

#

but I have no idea what those are

outer valley
#

Not sure what endtime is or u r getting it but y not just convert it to epoch time

#

Would be easy

#

Or try defining date and time formate!

#

Maybe there is some issue

brave lagoon
#

I see thank you !

slow dome
#

so it’s only seconds from epoch

brave lagoon
#

now.strftime("%Y-%m-%d %H:%M:%S") >= self.endDate.strftime("%Y-%m-%d %H:%M:%S")

desert dagger
#

People can easily just use a link shortener tho

desert dagger
slow dome
#

but then, you can always just have 2 embeds

desert dagger
#

i dont mind the idea of splitting

slow dome
#

either group them by topic, or make them split even

desert dagger
#
x = discord.Embed()
x.fields # returns a list of fields
x.fields = #how i split array?
#

so something like this? gotcha

desert dagger
desert dagger
#

i kinda meant

#

like read the fields stored

slow dome
#

oh, then to_dict

desert dagger
#

gotcha :/
thanks for the help

winter wasp
#

is it possible to stop global variables being used across different users in a command

winter wasp
desert dagger
desert dagger
#

and is this data seperate to each user?

#

or is it just a variable used in that "session" once then changed

winter wasp
#

i cant pass arguments in callbacks so thats why i used global

#

then it brought problems as well

desert dagger
#

i see

#

idk why you really need a global var tbh

winter wasp
#

with buttons

#

and i cant pass shit in callbacks

#

so like

#
bruh = "asdhiasgdasd"

async def ChangeCategory(interaction):
  #without using global
  await Message.edit(bruh)
```how tf am i suppose to do this
half marsh
#

i believe we can

Member.data1 = shits
winter wasp
#

WHY DIDNT I THINK OF THAT

idle linden
#

So I'm using the stdlib logging module, but I only want the D, I, W, E, C rather than DEBUG, INFO, ...etc. Is there a way to do this? as %(levelname[0])s does not do that, and raises an exception

Edit:
So I ended up using logging.Filter and using this

class LevelFilter(logging.Filter):
    """
    This is a filter which changes the levelname to that of its Initial letter
    """
    def filter(self, record):
        record.levelname = record.levelname[0]
        return True
# ...
f = LevelFilter()
logger.addFilter(f)
outer valley
#

where can more parameters like these ctx.invoked_subcommand , member.joined_at

#

or whatever they r called pain

terse plinth
#

?

#

Are you talking about whete they can be found? Check out the API docs

sleek grove
outer valley
terse plinth
terse plinth
#

Theres a search bar up top

outer valley
terse plinth
#

If you want all attributes of client. Search up Client

#

Or Message, guild whatever

outer valley
#

i see thanks alot

terse plinth
#

If i was at my computer, I'd send you a screenshot of where you can find those

#

I'll send it if i remember

slender lintel
#

how do i send images?

#

embed.set_image ?

outer valley
#

.send(embed=embed)

#

and while defining embeds u can add a url!

slender lintel
drifting spindle
outer valley
slender lintel
#

it was just working

outer valley
#

what is partialmessage?

slender lintel
#

idk

#

it just started happening

#

and i did nothing'

outer valley
#

post code

slender lintel
#
import os
from discord.ext import commands

intents = discord.Intents.all()
intents.members = True

client = commands.Bot(
  activity=discord.Game(command_prefix='~', name='Watching for / commands'),
  intents=intents
)

@client.event
async def on_ready():
    print(f"{client.user}Bot is loaded")

for file in os.listdir("./cogs"):
    if file.endswith(".py"):
        print("Loaded successfully")
        print(file[:-3])
        client.load_extension("cogs." + file[:-3])
#

py import isnt actually there

slender lintel
#

its just import

#

iloveu :

outer valley
#

nope no idea

drifting spindle
#

Guys how to print Hello world in python

#

Pls help i gettin error

slender lintel
#

exit()?

#

idk

#

im noob lol

drifting spindle
slender lintel
#

ya np

drifting spindle
#

exit('Hello World')

#

?

slender lintel
#

yes

drifting spindle
#

It's correct?

slender lintel
#

exactly

drifting spindle
#

Thanksssssss

slender lintel
#

np FalseFacePalmLaugh

drifting spindle
#

And how to run it ?

slender lintel
#

python kms

drifting spindle
#

python edit()?

slender lintel
#

yup

#

^^

drifting spindle
drifting spindle
slender lintel
#

python edit()

drifting spindle
slender lintel
drifting spindle
drifting spindle
slender lintel
drifting spindle
#

I made a lib for py

slender lintel
#

😲1

#

2

#

3

#

4

#

5

#

6

#

7

#

889

drifting spindle
#

Lmao 🤣

#

You girl ?

gilded widget
#

🤨

half marsh
#

helo admin?

slender lintel
#

SLAAYYY

drifting spindle
slender lintel
#

OMG

#

visco girls for life

#

OMG

drifting spindle
slender lintel
#

IDK!!

drifting spindle
#

Lmao

#

Be my firend

slender lintel
#

ok

drifting spindle
slender lintel
drifting spindle
viscid plume
#

how do I restrict slash commands to roles in the v2 perms update? previously i used discord.commands.permissions.has_any_role() but that seems to have been removed, and discord.default_permissions() just is what a user has not roles, am I missing something or did v2 perms remove restricting slash commands via roles?

#

in the discord docs it shows you can, unless im reading it wrong

lilac jewel
#

is it possible to send multiple modals

supple ravineBOT
#

Here's the slash perms example.

viscid plume
#

not sure why your sending that... all that shows is how to restrict it to specific perms, not roles

gilded widget
desert dagger
#

was looking for it but

desert dagger
gilded widget
#

might be a good idea to showcase some utilization of checks outside of discord.default_permissions tbh

desert dagger
#

mhm

viscid plume
#

those checks are after the slash is sent right? i dont want them to show up at all

gilded widget
#

yeah, those checks will only raise an error that you can handle.

#

currently there is no way to gray out commands or hide them but that should come with backend/slate v2

desert dagger
#

yeah that was one of the things i searched for

viscid plume
#

ok so no it isnt possible, thanks

#

why was v1 perms discarded when all of the features from it were not added in v2?

gilded widget
#

as far as i can remember there was never a way to hide/gray out commands in v1

#

and I'm not entirely sure as to why, likely just because the first implementation may've been messy

viscid plume
#

guess im gonna downgrade then, it definitely let me gray them out in v1

drifting spindle
#

How to make custom slash commands?

#

That user can make commands for their server

zinc saffron
#

how can I add a delete button like this?

brittle sundial
#

#986310307146264636

#

help

winter wasp
#

anyways how the fuck do i send requests to rule34.xxx api without it being blocked im using replit

#
import json, requests, random

Search = "himiko toga" # input
Image = random.choice(json.loads(requests.get(f"https://api.rule34.xxx//index.php?page=dapi&s=post&q=index&json=1&limit=500&tags={Search.replace(' ', '_')}", headers = {"Content-Type": "application/json"}).text))["file_url"] # find image
print(Image) #return

# works perfectly fine on my internet
# does not work in replit
# do i need a port or nah?
gilded widget
#

tbh you can probably just use a different host like oracle or railway

#

replit really isnt a good host to use

winter wasp
outer valley
#
async def on_message(message):
        if message.content.startswith("!hello"):
            await message.reply("Hello!", mention_author=True)```
#

if i change the function name it doesn't work!

inland acorn
#

!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
outer valley
#

i have already uninstalled d.py

#

v=2.0

#

not sure what pycord alpha is!

toxic bluff
#

can anyone help me with why me choices arent showing up in py async def status(ctx, player: discord.Option(str, choices=gmembers)):

#

I just get this

toxic bluff
keen root
toxic bluff
#

Ohh, is there an easy way to do it for every item in an array?

crimson coral
#

no a standard array should work fine there

toxic bluff
crimson coral
#

yeah

#

can you show the whole command definition?

toxic bluff
#
@bot.slash_command(guild_ids=server_ids, name='status', description='Gets the status of a player in the guild')
async def status(ctx, player: discord.Option(str, choices=gmembers)):
    await ctx.defer()
    getuuid = g(f'https://api.mojang.com/users/profiles/minecraft/{player}').json()
    statusinfo = g(f'https://api.hypixel.net/status?key={hypixel_key}&uuid={getuuid["id"]}').json()
    playername = ''
    for letter in range(len(player)):
        if player[letter] in formatchars:
            playername += '\\'
        playername += player[letter]
    if statusinfo['success'] == False:
        await ctx.respond(f'There was an error getting the status of {playername}')
    else:
        if statusinfo['session']['online'] == False:
            statusEmbed = discord.Embed(title=f'{playername} status', description="Offline", color=0x00ff00)
            statusEmbed.set_author(name=player, icon_url=f'https://mc-heads.net/avatar/{player}')
            await ctx.respond(embed=statusEmbed)

        elif statusinfo['session']['online'] == True:
                if statusinfo['session']['gametype'] == 'SKYBLOCK':
                    statusEmbed = discord.Embed(title=f'{playername} status', description=f"Online\n playing Skyblock\n{sbareas[statusinfo['session']['mode']]}", color=0x00ff00)
                    statusEmbed.set_author(name=player, icon_url=f'https://mc-heads.net/avatar/{player}')
                    await ctx.respond(embed=statusEmbed)
                else:
                    statusEmbed = discord.Embed(title=f'{playername} status', description=f"Online\n playing {statusinfo['session']['gametype']}", color=0x00ff00)
                    statusEmbed.set_author(name=player, icon_url=f'https://mc-heads.net/avatar/{player}')
                    await ctx.respond(embed=statusEmbed)```
#

Thats the entire command

crimson coral
#

hmmmm

#

can you change the Option a bit? Add a random string as a description between str and choices=...

#

like (str, "Choose Player", choices=...), no description=

toxic bluff
#

Okay added it in, ill see if it works now

#

nope still not getting any of the items showing

zinc saffron
#

why am I getting:
discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed

toxic bluff
zinc saffron
#

is that an issue?

toxic bluff
zinc saffron
#

py-cord: 2.0.0b1

toxic bluff
#

Ah you need to be on rc1

toxic bluff
zinc saffron
#

oh ok, will do that. thanks man

toxic bluff
#

No problem, happy to help

zinc saffron
#

where to I set PrivilegedIntentsRequired tho? I checked the dev portal but can not find it...

slender lintel
#

!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
toxic bluff
#

@zinc saffron ^

#

Its under Bot on the developer portal

zinc saffron
#

I do see that, thats also checked but I am still getting:

discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.```
toxic bluff
#

Is message content intent enabled as well?

zinc saffron
toxic bluff
languid hollow
#

What does this mean like, is it the ID of the webhook or??

sleek grove
#

Ignoring exception in command coinflip:
Traceback (most recent call last):
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 126, in wrapped
ret = await coro(arg)
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 852, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "Desktop/public-main/cogs/fun/coinflip-fun.py", line 13, in coinflip
await ctx.respond(random.choice(coinflip))
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/context.py", line 227, in respond
return await self.interaction.response.send_message(*args, **kwargs) # self.response
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/interactions.py", line 686, in send_message
await self._locked_response(
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/interactions.py", line 933, in locked_response
await coro
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/webhook/async
.py", line 211, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

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

Traceback (most recent call last):
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/bot.py", line 993, in invoke_application_command
await ctx.command.invoke(ctx)
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 357, in invoke
await injected(ctx)
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 134, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

past gate
#

Code?

sleek grove
#

import random
import discord
from discord import Embed
from discord.ext import commands

class Coinflip(commands.Cog):
def init(self, bot):
self.bot = bot

@discord.slash_command()
async def coinflip(self,ctx):
    coinflip = ["Head", "Number"]
    await ctx.respond(random.choice(coinflip))

def setup(bot):
bot.add_cog(Coinflip(bot))

#

HELP PLS

mild hatch
sleek grove
#

wait

#

same error

sleek grove
past gate
#

could you please format your code and errors when you want help

#

try deferring the context at the start of the coinflip function

toxic bluff
#

wouldnt it be @bot.slash_command()

languid hollow
past gate
#

i just use slash_command

#

ofc from discord import slash_command is in there too

languid hollow
#

btw guys, for webhooks do you use the web-hook or pycord supported one?

craggy rapids
#

Pycord can make the webhooks, but i send it with aiohttp

#

idk if pycord can send it

languid hollow
#

or normal def

craggy rapids
#

async def

#

Oh ye i should make it into a seprated def mybe

languid hollow
#

so you wouldn't use class for webhooks?

craggy rapids
#

Hmmm idk, i just use it like at 9 async def

mild hatch
upbeat hill
#

i updated pycord now my bot wont send messages
is there a way to revert back to the version i was using before?

languid hollow
#

Hmm, since I'm trying to use it with Class and uhh hidk what exactly I'm doing??

languid hollow
#

also enable intents

past gate
craggy rapids
mild hatch
craggy rapids
past gate
#

psychos

#

🚎

craggy rapids
#

oh no

languid hollow
past gate
#

f

craggy rapids
#

@dull skiff

languid hollow
#

yh

craggy rapids
languid hollow
#

started learning pycord like a week ago

craggy rapids
#

cogs is meant like a class

dull skiff
#

help me

past gate
#

code?

craggy rapids
dull skiff
past gate
#

bruh.

#

reset your token now

languid hollow
#

^^

dull skiff
#

ok

#

lupa sori

languid hollow
#

use env file for token

dull skiff
#

gapap juga sih itu cuma ada di server ngetes

#

oo ok

past gate
#

please keep the channel in english

dull skiff
languid hollow
craggy rapids
past gate
#

if you want to speak in other langs use #international-chat

craggy rapids
dull skiff
#

sorry sorry

craggy rapids
#

remove the id part

past gate
#

its ok we all get carried away sometimes

sleek grove
languid hollow
past gate
languid hollow
#

and then

upbeat hill
# languid hollow what version you using?

used pip install -U git+https://github.com/Pycord-Development/pycord in January.
used this to develop the bot
then pip install -U py-cord==2.0.0b7 yesterday
then the bot just broke

craggy rapids
sleek grove
#

2.0.0RC

craggy rapids
#

ctx.send?

#

not the pycord ver

sleek grove
languid hollow
craggy rapids
#

Not neeeded 100%

languid hollow
upbeat hill
sleek grove
past gate
#

hmm

#

could you make a thread in #969574202413838426 , so your issue doesn't get lost in this channel @upbeat hill

languid hollow
#

wait nvm

dull skiff
#

stack overflow have dark mode?

craggy rapids
dull skiff
#

ok

craggy rapids
#

you should ask more here, cuz im like to see ya gtranslated all things here xD

upbeat hill
languid hollow
#

Install that version that you want to revert to

#

I believe that should fix it

frigid lark
upbeat hill
#

uninstall then reinstall?

craggy rapids
# dull skiff help me

If u read the error u will see "discord.errors.LoginFailure: Improper token has been passed.", So i assumed you dont read the logs

languid hollow
#

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

#

type this in your terminal

frigid lark
#

you can use the git link or "pip install py-cord==2.0.0rc1

languid hollow
#

and it should switch over

craggy rapids
#

my laptop still on dpy xD

languid hollow
#

you'll have to add a few more things

frigid lark
craggy rapids
languid hollow
#

you'll have to install discord.ui

frigid lark
#

wait

craggy rapids
languid hollow
craggy rapids
past gate
frigid lark
#

you will get anything with
pip install py-cord==2.0.0rc1

past gate
#

pycord handles modals & views

frigid lark
#

^

languid hollow
#

for me I had to install them specifically

craggy rapids
#

bruh. A simple question but effective to make a event

frigid lark
#

xd

languid hollow
#

unless I'm using different lib

craggy rapids
dull skiff
#

i need to write the token file location in the load_dotenv parameter?

languid hollow
#

since keywords

craggy rapids
frigid lark
craggy rapids
#

but remember dont copy/screenshot that part

upbeat hill
dull skiff
#

oh ok

past gate
craggy rapids
dull skiff
#
  File "c:\Users\Teddy\Documents\dcbot\bot.py", line 10, in <module>
    intents.message_content = True
AttributeError: 'Intents' object has no attribute 'message_content'```
now i got this
frigid lark
frigid lark
upbeat hill
craggy rapids
craggy rapids
frigid lark
#

^

craggy rapids
#

im the real friend arent me? XD

dull skiff
#

just tell me pls 🙂

craggy rapids
#

the docs really tell it better than me im sure

dull skiff
craggy rapids
#

developers making the docs for the nerds to read @dull skiff

crystal verge
#

GUYS I CANT ADD MY BOT

past gate
#

??

craggy rapids
crystal verge
craggy rapids
#

refresh page?

crystal verge
#

i did

languid hollow
#

url generator

upbeat hill
crystal verge
#

wym

past gate
crystal verge
#

???

languid hollow
frigid lark
#

why is my Internet so slow now...

crystal verge
languid hollow
#

choose url generator

crystal verge
#

i am on url gen

languid hollow
#

this one?

#

then it should give in the link

past gate
frigid lark
frigid lark
crystal verge
dull skiff
crystal verge
#

see

dull skiff
#

no eror code but my bot still offline

crystal verge
#

zoomed out

zinc saffron
#

I am trying to add a delete button to my message that once a user clicks it the posted message from the bot will be removed. I tried:

b3 = Button(emoji="🗑", style=discord.ButtonStyle.gray)

async def b_delete_callback(interaction):
    await interaction.delete_original_message()

But that seems to not do the trick...

dull skiff
languid hollow
#

would it clear_item()

#

I'm not sure

toxic bluff
dull skiff
#
import os
from dotenv import load_dotenv 

load_dotenv()

TOKEN = os.getenv("DISCORD_TOKEN")

intents = discord.Intents.all()

client = discord.Client(intents=intents)

@client.event
async def on_ready():
    print(f'We have logged in as {client.user}')

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

    if message.content.startswith('$hello'):
        await message.channel.send('Hello!')```
toxic bluff
#

is that all your code?

dull skiff
#

yes:v

crystal verge
toxic bluff
#

well your issue is that you need bot.run(TOKEN) at the bottom of your file

dull skiff
#

ok thanks you

languid hollow
#

client.run(TOKEN)

toxic bluff
past gate
toxic bluff
languid hollow
toxic bluff
#

in terms of variable

past gate
#

mhm

#

I do super().run() troll

#

mainly because I subclass commands.Bot but thats not the point 😅

dull skiff
#

i got this eror

past gate
#

clearly the variable TOKEN is empty

languid hollow
#

Did the add in value

#

in the env file for

#

DISCORD_TOKEN ?

mild hatch
#

did you load the env?

#

with load_dotenv()

dull skiff
languid hollow
#

Did you put strings around the Token in the env file

dull skiff
#

yes

languid hollow
#

E.g.
DISCORD_TOKEN = "DJFSFHOFLDSFDAF"

dull skiff
#

{"my token"}

languid hollow
#

it should be in the env file

dull skiff
languid hollow
#

DISCORD_TOKEN = AFLFHLSDFHSFASF

#

no strings

dull skiff
languid hollow
ornate creek
#

NEKOT_DROCSID

craggy rapids
ornate creek
#

lollipops

#

*lol

languid hollow
ornate creek
#

i got a token.txt file

dull skiff
ornate creek
#

and then ofc a config.toml and config.json

#

smart naming

craggy rapids
languid hollow
dull skiff
languid hollow
past gate
craggy rapids
#

node

idle linden
#

ew web first

upbeat hill
#

any reason why this wouldnt work?

dull skiff
#

what happen now🥲

idle linden
upbeat hill
ornate creek
#

ghost ping?

languid hollow
dull skiff
#

but i only remove the loadenv

crystal verge
#

can i use slash and prefix at the sam e time

worthy basin
#

Yes check out bridge commands.

#

?tag bridge

hearty rainBOT
#
import discord
from discord.ext import bridge

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

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

@bot.bridge_command()
async def hello(ctx):
  await ctx.respond("Hello!")

https://guide.pycord.dev/extensions/bridge/

worthy basin
#

They are a little bit buggy sometimes, just be warned. still useable tho

crystal verge
#

ok

#
Ignoring exception in on_connect
Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\discord\bot.py", line 1147, in on_connect
    await self.sync_commands()
  File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\discord\bot.py", line 643, in sync_commands
    registered_guild_commands[guild_id] = await self.register_commands(
  File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\discord\bot.py", line 473, in register_commands
    prefetched_commands = await self.http.get_guild_commands(self.user.id, guild_id)
  File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\discord\http.py", line 353, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
We have logged in as Tailgater#3934
#
import discord

bot = discord.Bot()

@bot.event
async def on_ready():
    print(f"We have logged in as {bot.user}")

@bot.slash_command(guild_ids=[880742966606577704])
async def hello(ctx):
    await ctx.respond("Hello!")

bot.run("token")
#

sooo ummm

#

whats the problem

mild hatch
#

you might have to reinvite your bot with the application commands scope turned on

crystal verge
#

ok

dull skiff
#

why i cant acces discord?

mild hatch
#

like so

#

no need to kick the bot, just using the url again refreshes its permissions

crystal verge
#

ok

mild hatch
crystal verge
#

it shows the error

#

but the command works

#

idk why'

dull skiff
slender lintel
#

not that you cant access it

dull skiff
#

how to use it

slender lintel
#

you didnt even define client

#

client = discord.ext.commands.Bot()

mild hatch
#

might just be that, not sure

mild hatch
dull skiff
#

is something wrong with my folder?

slender lintel
#

this could happen :P

dull skiff
#

look different

dull skiff
slender lintel
slender lintel
#

Also

#

so basically go back to waht I first said

#

you aren't using discord.

dull skiff
slender lintel
#

cause it says it isnt being acessed

dull skiff
#

so what i need to do?

slender lintel
#

use it

#

ill give an example

#
import discord
from discord.ext import commands

client = commands.Bot(
  command_prefix="!",
  intents=discord.Intents.all()
)

@client.event
async def on_ready():
   print(f"{client.user} is now online")```
dull skiff
#

thanks i can acces discord again

dull skiff
slender lintel
#

you just werent even using the library

dull skiff
#

owh ok

slender lintel
#

"discord" is not accessed means you were not using the library

dull skiff
#

sorry because im so stupid

slender lintel
#

its ok

dull skiff
slender lintel
#

then have it be named as
bot = commands.Bot()

slender lintel
dull skiff
#

it says has no atribute event

slender lintel
dull skiff
#
from discord.ext import commands
from discord.ext.commands import bot

client = commands.Bot(
  command_prefix="!",
  intents=discord.Intents.all()
)

@bot.event
async def on_ready():
   print(f"{client.user} is now online")
bot = commands.Bot("token")```
slender lintel
#

no no

#
import discord
from discord.ext import commands

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

@bot.event
async def on_ready():
   print(f"{client.user} is now online")
bot.run("token")
dull skiff
#

owh:v

#

sorry

#

I didn't read the code correctly

slender lintel
#

also dont import bot from discord.ext.commands

dull skiff
#

ah i finally know whats wrong

#

and my bot finally online

#

i didnt enabled the privileged intents

crystal verge
#

Soo what's could be the problem

upbeat hill
#

how do you send a embed from a interaction to a specific channel?

slender lintel
upbeat hill
slender lintel
#

you have the channel object already why not just await channel.send?

frigid lark
#

remove the
self.channel = channel

slender lintel
frigid lark
#

use
self.bot.get_channel()
await channel.send(message)

#

change the 2 to 1

upbeat hill
frigid lark
#

show me how you have it

upbeat hill
frigid lark
#

remove the channel in
async def callback(self, channel, interaction)

#

do you use client or bot?

upbeat hill
#

bot

slender lintel
#

you arent setting this to a channel variable

upbeat hill
frigid lark
#

wait

upbeat hill
frigid lark
#

you need
await interaction.response.send_message(embeds=[embed])

#

you cannot do it without it

upbeat hill
#

so i cant send the modal results embed to a specific channel

frigid lark
upbeat hill
#

okie

glass dawn
#

im using the development version:
pip install -U git+https://github.com/Pycord-Development/pycord

worthy basin
worthy basin
#

oop, will responde there lol

slender lintel
#

lol

little isle
#

How can I use a SlashCommandGroup across multiple cogs?

#

If I try making a group by the same name in multiple cogs, I get a "command names must be unique" error. If I try instantiating the group outside of the cog, then it seems to work, but the commands don't actually register

#

I get the same "command names must be unique" error if I try to use inheritance to get it

carmine portal
#

Hello !
How to make that a dropdown menu can be used by the user who use the command only ?
If you need my code dm me !

sleek grove
#

just help me pls

#

Ignoring exception in command coinflip:
Traceback (most recent call last):
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 126, in wrapped
ret = await coro(arg)
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 852, in _invoke
await self.callback(self.cog, ctx, kwargs)
File "Desktop/public-main/cogs/fun/coinflip-fun.py", line 13, in coinflip
await ctx.respond(random.choice(coinflip))
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/context.py", line 227, in respond
return await self.interaction.response.send_message(*args, kwargs) # self.response
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/interactions.py", line 686, in send_message
await self._locked_response(
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/interactions.py", line 933, in _lockedresponse
await coro
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/webhook/async.py", line 211, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

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

Traceback (most recent call last):
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/bot.py", line 993, in invoke_application_command
await ctx.command.invoke(ctx)
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 357, in invoke
await injected(ctx)
File "Desktop/public-main/venv/lib/python3.10/site-packages/discord/commands/core.py", line 134, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

sleek grove
#

import random
import discord
from discord import Embed
from discord.ext import commands
from discord import slash_command

class Coinflip(commands.Cog):
def init(self, bot):
self.bot = bot

@commands.slash_command()
async def coinflip(self,ctx):
    coinflip = ["Head", "Number"]
    await ctx.respond(random.choice(coinflip))

def setup(bot):
bot.add_cog(Coinflip(bot))

half marsh
# upbeat hill

Seeing your code you no need self.bot, just bot.get_chanel(id)

sleek grove
worthy basin
#

@sleek grove can you open your own thread in #969574202413838426
also when sending code use
```py
code...
```
this will format your code

sleek grove
#

but i will copy it

sleek grove
#

now it works

carmine portal
#

Hello !
How to make that a dropdown menu can be used by the user who use the command only ?
If you need my code dm me ! wowcry

worthy basin
#

An easy way is to send it to the user with ctx.respond(..., empherial=True) this will make it so only the user who ran the command can see the message. (It is not a permanent message and will go away if the user restarts discord)

slow dome
carmine portal
#

Ho yes but the menu is IN the message and i want that the message Can be view by everyone