#Basic Pycord Help (Quick Questions Only)
1 messages · Page 55 of 1
on_message isn't a task tho it's just a function that runs every time a message is sent
So you can't rlly even stop on_message
I know. My question is. Is there a way to make a task that I can start and stop that does the same as the on_message function
Wait so a separate thing that parses messages temporarily?
Yup
Also, is this smthn that's on a per-server basis you want or on a global basis?
Atm. It would be per server. But eventually it would be across 30+ servers so global would may be better
Well anyway, I recommend using some var that is True or False based on whether messages should be parsed or not and then having an on_message listener that checks if the var is true, and if it is then it will parse the messages
And if you have multiple servers, use a dict that has each server's ID in it and a true or false to determine whether to parse messages for that server
Thank you for your help
You're welcome
can my bot see who joined a voice channel?
Confused by this. I normally send an empty response (it's hacky, but works), but unless I misunderstood something, Discord doesn't like this because you're not sending a response
class MyView(discord.ui.View):
...
@discord.ui.button(label='Add Notes', style=discord.ButtonStyle.primary, emoji='📝', row=2)
async def notes(self, button: discord.ui.Button, interaction: discord.Interaction):
modal = NoteModal(view=self)
await interaction.response.send_modal(modal)
await modal.wait()
class NoteModal(discord.ui.Modal):
...
async def callback(self, interaction: Interaction):
...
await self._view.message.edit(embeds=self._view.message.embeds, view=self._view)
self.stop()
# This is what I normally do:
# with contextlib.suppress(discord.HTTPException):
# await interaction.response.send_message()
.rtfm voicechannel.members
Oh yeah you would need to send a response to the modal
bump
Thank you, i needed the voice state update event
If i have a
async def on_message(message):
How could I find if the message is replying to a message and then what that message content is?
.rtfm Message.reference
Some classes are just there to be data containers, this lists them. Unlike models you are allowed to create most of these yourself, even if they can also be used to hold attributes. Nearly all clas...
.rtfm fetch_message
discord.abc.Messageable.fetch_message
discord.PartialMessageable.fetch_message
discord.TextChannel.fetch_message
discord.ext.commands.Context.fetch_message
discord.Member.fetch_message
discord.VoiceChannel.fetch_message
discord.ext.bridge.BridgeExtContext.fetch_message
discord.Thread.fetch_message
discord.Webhook.fetch_message
discord.ext.bridge.BridgeApplicationContext.fetch_message
discord.SyncWebhook.fetch_message
discord.ApplicationContext.fetch_message
discord.User.fetch_message
discord.DMChannel.fetch_message
discord.GroupChannel.fetch_message
Oh lol my bad
How should I add scheduled tasks to be run at certain times to a commands bot?
Use tasks.loop and pass the list of times
Error:
02.02 09:59:14 [Bot] Ignoring exception in command announce:
02.02 09:59:14 [Bot] Traceback (most recent call last):
02.02 09:59:14 [Bot] File "/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 181, in wrapped
02.02 09:59:14 [Bot] ret = await coro(*args, **kwargs)
02.02 09:59:14 [Bot] File "/cogs/miner_only.py", line 137, in announce
02.02 09:59:14 [Bot] db["lastID"] = ctx.channel.id
02.02 09:59:14 [Bot] AttributeError: 'Owner_Only' object has no attribute 'channel'
02.02 09:59:14 [Bot] The above exception was the direct cause of the following exception:
02.02 09:59:14 [Bot] Traceback (most recent call last):
02.02 09:59:14 [Bot] File "/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 360, in invoke
02.02 09:59:14 [Bot] await ctx.command.invoke(ctx)
02.02 09:59:14 [Bot] File "/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 927, in invoke
02.02 09:59:14 [Bot] await injected(*ctx.args, **ctx.kwargs)
02.02 09:59:14 [Bot] File "/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 190, in wrapped
02.02 09:59:14 [Bot] raise CommandInvokeError(exc) from exc
02.02 09:59:14 [Bot] discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Owner_Only' object has no attribute 'channel'```
```py
Code:
@commands.command(aliases=["notify"])
@commands.is_owner()
async def announce(ctx, ping, *, content):
db["lastID"] = ctx.channel.id
db["ancping"] = ping;db["ancContent"] = content
embed = discord.Embed(title=mpupdates,description=content,color=p84clr)
embed.add_field(name=mpfq,value=mpfqv,inline=False)
sent_message = await ctx.reply(f"{mppreview} {mppreview2}",embed=embed)
db["lastAnnouncement"] = sent_message.id```
Did the object change for normal cmds?
that is both not even the same?
Why is the role not removed from the user?
In role there is the role ID?
await interaction.user.remove_roles(role)```
is there any working ipc for pycord?
Last time I tried, better-ipc works
How to get the channel where the command was run?
You are supposed to pass a role object or a discord.Object with id set to role id
ctx.channel
okay, so not ctx.message.channel?
Is that in a cog? First parameter should be self
See the guide
.guide
It's the same
ok
yeah, but im getting a error while trying to put the channel in a var
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel'
c = ctx.message.channel
If that's a Slash cmd, you won't have anything in ctx.message
So use ctx.channel
This will work for prefix cmds
when were last time?
High-performance inter-process communication library designed to work with the latest version of discord.py - GitHub - MiroslavRosenov/better-ipc: High-performance inter-process communication libra...
Gosh it was long ago 💀
But it should work. I think you need to install with no dependencies in pip
Yeah
I do it like this:
role = discord.utils.get(interaction.guild.roles, id=1068538874378334228)```

What does channel.edit need for a Code if i want to write : and , ?
normal code like this does not work and give me
await channel.edit(name=f"Paypal:{totalamount} € / {total}")
ahhh thanks !
Use interaction.guild.get_role(id)
.rtfm guild.edit
Just as this guy said, read the docs
Nope. Its dont working
Ignoring exception in command close:
Traceback (most recent call last):
File "other_folders_here/core.py", line 178, in wrapped
ret = await coro(*args, **kwargs)
File other_folders_here/ScpBotDeg3teR\Main.py", line 247, in close
await ctx.channel.move(category=get(ctx.guild.categories, id=1070410818262417419))
File "other_folders_here/discord\abc.py", line 1149, in move
raise InvalidArgument("Could not resolve appropriate move position")
discord.errors.InvalidArgument: Could not resolve appropriate move position
You didn't do what they told you to do? Lmao?
You're still using utils.get
Should I?🥹
Oh, no, totally don't follow instructions you're given.
btw you can just pass discord.Object(id) instead of passing the category
Nope
also, i think you would need to set either of beginning, end, before, after
.rtfm channel.move
wdym nope 
this doesn't work either
@copper magnet did you try this?
oookayyy

this is why you should rtfm. Although ill spare you a bit because docs arent very clear on that
Does pycord have a setup_hook to do like this?
class Bot(commands.Bot):
def __init__(self):
super().__init__(command_prefix=commands.when_mentioned_or(botinformations().prefix), case_insensitive=True, intents=intents)
self.persistent_views_added = False
self.ipc = ipc.Server(self, secret_key=secrets['APP_SECRET_KEY'])
async def on_ready(self):
if not self.persistent_views_added:
self.persistent_views_added = True
self.loop.create_task(status_task())
print(f"▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ \nErfolgreich eingeloggt als {bot.user}\nID: {bot.user.id}")
print(f"Python: {sys.version[0:3]} pycord: {discord.__version__}")
print('▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬')
async def setup_hook(self) -> None:
await self.ipc.start()
ookay i can try it now
.rtfm channel.name
no pycord doesnt have setup_hook ||yet (hopefully soon)||
you can use asyncio.create_task
or asyncio.run along with bot.start instead of bot.run
nice. #883236900171816970 btw
so like
asyncio.create_task(bot.ipc)
bot.run("123")
Does anyone know why my time is still displayed offset by 1 hour despite converting to the "Europe/Berlin" time zone?
start_time_utc = datetime.datetime.strptime(notification['started_at'], "%Y-%m-%dT%H:%M:%SZ")
start_time_de = start_time_utc.astimezone(pytz.timezone("Europe/Berlin"))
start_time = start_time_de.strftime("%H:%M")```
asyncio.create_task(self.ipc.start) but that should go in the bot init
class CarlitoEmailBot(commands.Bot):
def __init__(self):
super().__init__(command_prefix=commands.when_mentioned_or(botinformations().prefix), case_insensitive=True, intents=intents)
self.persistent_views_added = False
self.ipc = ipc.Server(self, secret_key=secrets['APP_SECRET_KEY'])
asyncio.create_task(self.ipc.start)
async def on_ready(self):
if not self.persistent_views_added:
self.persistent_views_added = True
self.loop.create_task(status_task())
print(f"▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ \nErfolgreich eingeloggt als {bot.user}\nID: {bot.user.id}")
print(f"Python: {sys.version[0:3]} pycord: {discord.__version__}")
print('▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬')
smth related to DST ?
yeah try if that works. if not, you will need to use the second method
not working i am getting a runtime error:
RuntimeError: no running event loop
im not sure if it is asyncio.create_task(self.ipc.start) or self.loop.create_task(self.ipc.start)
but self.loop.create_task(self.ipc.start) have to be in on_ready then right?
not really iirc
TypeError: a coroutine was expected, got <bound method Server.start of <Server endpoints=0 started=False standard_port=1025 multicast_port=20000 do_multicast=True>>
starting now
so it works?
yes
cool
works fine but do you know why it takes so long for the redirect?`
@app.route("/verified/")
@async_action
@requires_authorization
async def verified():
user = discord.fetch_user()
print(user.email)
data = {
"UserID": int(user.id),
"UserEmail": user.email
}
await ipc.request("new_verify", data=data)
return redirect("https://discord.com/channels/899448915206746134/1069410863078981643/", code=302)
is the redirect only starting when the new_verify route in the bot is done?
no idea. what framework is that?
flask
hmm. nope. no idea
okay
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'invoke'
any idea why this is happening
I'm taking an input, adding 2 numbers from the input and trynna output the 2 commands using slash commands
Can I somehow call the get_fish function to load the fish from the database?
When I try to do this I always get "Function never awaited".
async def get_fish(gewaesser):
fische = await dab.get_fisch_in_water(gewaesser)
return [fische]
class Fisch(discord.ui.Select):
def __init__(self, bot: discord.Bot, selected_letter, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
fische = get_fish(gewaesser)
options = [discord.SelectOption(label=fish) for fish in fische if fish.startswith(selected_letter)]
super().__init__(
placeholder="Wähle deinen Fisch aus",
min_values=1,
max_values=1,
options=options,
)
async def callback(self, interaction: discord.Interaction):```
Because you're not awaiting it?
You either make the function sync
Or make the init async
Which makes more sense?
You're missing the important part, the code
Ok thanks 🙂
math = discord.SlashCommandGroup("math", "Academia's math functions")
@math.command(name="add",description="adds numbers")
async def add(ctx,num1,num2):
x = num1 + num2
await ctx.respond(x)
is this still an issue?
do you know basic python?
yeah, by the way you're asking looks like I made a mistake
you did.
indentation?
no
I was looking at the get started guide and came across this in the slash commands page
did you add the command group to the bot?
yes
I did
could you provide the full traceback for said error?
`Ignoring exception in command math:
Traceback (most recent call last):
File "/home/cyber/.local/lib/python3.10/site-packages/discord/commands/core.py", line 124, in wrapped
ret = await coro(arg)
File "/home/cyber/.local/lib/python3.10/site-packages/discord/commands/core.py", line 1310, in _invoke
await command.invoke(ctx)
AttributeError: 'NoneType' object has no attribute 'invoke'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/cyber/.local/lib/python3.10/site-packages/discord/bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "/home/cyber/.local/lib/python3.10/site-packages/discord/commands/core.py", line 375, in invoke
await injected(ctx)
File "/home/cyber/.local/lib/python3.10/site-packages/discord/commands/core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'invoke'`
i dont get what is being returned as nonetype
nonetype object has no attribute invoke
Where is this being added?
before the bot.run(token) line
could you try using bot.create_group instead?
does that mean I have to change the first command
wait, my bad
the error remains
the same code you provided works on my end. Could you type pip list and show output?
One message removed from a suspended account.
it is a very long list, but if you're wondering if I have discord.py or some other lib installed, I do not have anything else, this is my first time making a discord bot on a fresh install of linux
What am I doing wrong?
async def get_fish(gewaesser):
fische = []
fische = await dab.get_fisch_in_water(gewaesser)
return fische
class Fisch(discord.ui.Select):
async def __init__(self, bot: discord.Bot, selected_letter, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
fische = await get_fish(gewaesser)
options = [discord.SelectOption(label=fish) for fish in fische if fish.startswith(selected_letter)]
await super().__init__(
placeholder="Wähle deinen Fisch aus",
min_values=1,
max_values=1,
options=options,
)```
topggpy maybe?
if you could perhaps tell me what the error means, I could further try resolve it myself
checked, not there
basically, the command is not cached.
i see, also previously you said I made a logical mistake, could you tell me what the mistake was
but again, that is unrelated to your error.
One message removed from a suspended account.
at least, not from what I can see
.idw
Saying it doesn't work or asking what's wrong with this code is not helpful for yourself or others.
Describe what you expect and/or tried (with your code), and what isn't going right.
Please provide any errors you get for optimal assistance.
File "c:\Users\User\Documents\Coding\OnlyFrames\cogs\spot.py", line 70, in callback
self.attached_message = await interaction.response.send_message(view=FischView(self.bot, selected_letter, self.gewaesser))
File "c:\Users\User\Documents\Coding\OnlyFrames\cogs\spot.py", line 25, in __init__
super().__init__(Fisch(self.bot, self.selected_letter, gewaesser))
TypeError: __init__() should return None, not 'coroutine'```
you can make an async init with something like this:
class AsyncInit:
async def __new__(cls, *args, **kwds):
obj = super().__new__(cls)
await obj.__init__(*args, **kwargs)
return obj
async def __init__(self, *args, **kwargs):
await smth()
Is that how it works then?
class Fisch(discord.ui.Select):
async def __init__(self, bot: discord.Bot, selected_letter, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
fische = await get_fish(gewaesser)
options = [discord.SelectOption(label=fish) for fish in fische if fish.startswith(selected_letter)]
obj = super().__init__(self)
await obj.__init__(
placeholder="Wähle deinen Fisch aus",
min_values=1,
max_values=1,
options=options,
)
return obj```
Can anyone help me? I do not understand it so completely and find on the Internet also no Doku or explanation 😬
what is the difference between fetch_message() and get_message() ?
fetch_message makes an API call, get_message uses the bot's internal cache
get_message() will attempt to get the message from cache first Fetch Wont
get_message only uses the cache, fetch_message only makes an API call. Nothing is tried "first"
.rtfm get_or_fetch
discord.utils.get_or_fetch
discord.ext.bridge.AutoShardedBot.get_or_fetch_user
discord.Client.get_or_fetch_user
discord.ext.commands.Bot.get_or_fetch_user
discord.Bot.get_or_fetch_user
discord.ext.commands.AutoShardedBot.get_or_fetch_user
discord.AutoShardedBot.get_or_fetch_user
discord.AutoShardedClient.get_or_fetch_user
discord.ext.bridge.Bot.get_or_fetch_user
that's your best option ^
there is no get_or_fetch_message afaik
why can I get but not fetch from a Bot object?
because get uses the bot's internal cache
an API call requires a channel specified as well
ok thanks for the help 👍
so basically, you should always try get first since it's faster and doesn't make any calls to Discord's API. If get returns None, use fetch
If fetch returns none it does not exist
This does not work, can you explain this to me or do you have a link where I can read this in more detail? 🙂
class Fisch(discord.ui.Select):
async def __init__(self, bot: discord.Bot, selected_letter, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
fische = await get_fish(gewaesser)
options = [discord.SelectOption(label=fish) for fish in fische if fish.startswith(selected_letter)]
obj = super().__init__(self)
await obj.__init__(
placeholder="Wähle deinen Fisch aus",
min_values=1,
max_values=1,
options=options,
)
return obj```
just add this to your class
async def __new__(cls, *args, **kwds):
obj = super().__new__(cls)
await obj.__init__(*args, **kwargs)
return obj
you can also use class methods. thats not difficult either
Like this?
class Fisch(discord.ui.Select):
async def __new__(cls, bot: discord.Bot, selected_letter, gewaesser):
cls.bot = bot
cls.gewaesser = gewaesser
obj = super().__new__(cls)
fische =
options = [discord.SelectOption(label=fish) for fish in bot.fish if fish.startswith(selected_letter)]
await obj.__new__(
placeholder="Wähle deinen Fisch aus",
min_values=1,
max_values=1,
options=options,
)
return obj
async def __init__(self, gewaesser):
self.fische = await dab.get_fisch_in_water(self.gewaesser) ```

just add this. copy and paste
keep the rest like this
Although remove the await from super init
Like this?
class Fisch(discord.ui.Select):
async def __new__(cls, *args, **kwds):
obj = super().__new__(cls)
await obj.__init__(*args, **kwargs)
return obj
async def __init__(self, bot: discord.Bot, selected_letter, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
fische = await get_fish(gewaesser)
options = [discord.SelectOption(label=fish) for fish in fische if fish.startswith(selected_letter)]
super().__init__(
placeholder="Wähle deinen Fisch aus",
min_values=1,
max_values=1,
options=options,
) ```
yes that looks correct
you can now do smth = await Fisch(...)
What do I need to insert for this?
*args, **kwds
nothing. i think you can ignore that
"kwargs" is not defined 😄
oops. rename kwds to kwargs in the __new__ functions
Error 😄
raise TypeError(f"expected Item not {item.__class__!r}")
TypeError: expected Item not <class 'coroutine'>
C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py:416: RuntimeWarning: coroutine 'Fisch.__new__' was never awaited
return await self.on_error(e, item, interaction)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback```
did you await while creating the object?
like this
also, possible to get full traceback?
My Code:
async def get_fish(gewaesser):
print(gewaesser)
fische = []
fische = await dab.get_fisch_in_water(gewaesser)
return fische
class Fisch(discord.ui.Select):
async def __new__(cls, *args, **kwargs):
obj = super().__new__(cls)
await obj.__init__(*args, **kwargs)
return obj
async def __init__(self, bot: discord.Bot, selected_letter, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
fische = await get_fish(gewaesser)
options = [discord.SelectOption(label=fish) for fish in fische if fish.startswith(selected_letter)]
super().__init__(
placeholder="Wähle deinen Fisch aus",
min_values=1,
max_values=1,
options=options,
) ```
no i meant when creating the select menu. you create it inside a View right?
like show where you use it
The Error:
description=None emoji=None default=False>, <SelectOption label='S' value='S' description=None emoji=None default=False>, <SelectOption label='T' value='T' description=None emoji=None default=False>, <SelectOption label='U' value='U' description=None emoji=None default=False>, <SelectOption label='V' value='V' description=None emoji=None default=False>, <SelectOption label='W' value='W' description=None emoji=None
default=False>, <SelectOption label='Z' value='Z' description=None emoji=None default=False>] channel_types=[] disabled=False>:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
await item.callback(interaction)
File "c:\Users\User\Documents\Coding\Bot\cogs\spot.py", line 70, in callback
self.attached_message = await interaction.response.send_message(view=FischView(self.bot, selected_letter, self.gewaesser))
File "c:\Users\User\Documents\Coding\Bot\cogs\spot.py", line 25, in __init__
super().__init__(Fisch(self.bot, self.selected_letter, gewaesser))
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 181, in __init__
self.add_item(item)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 287, in add_item
raise TypeError(f"expected Item not {item.__class__!r}")
TypeError: expected Item not <class 'coroutine'>
C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py:416: RuntimeWarning: coroutine 'Fisch.__new__' was never awaited
return await self.on_error(e, item, interaction)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback```
class FischView(discord.ui.View):
def __init__(self, bot: discord.Bot, selected_letter: str, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
self.selected_letter = selected_letter
super().__init__(Fisch(self.bot, self.selected_letter, gewaesser))```
ok so you need to add the async stuff to this too
async def reload(ctx):
for extension in initial_extensions:
bot.reload_extension(extension)
await ctx.send("All cogs have been reloaded.")```
NameError: name 'bot' is not defined
Did you define bot?
you need the async def __new__ code, you need to define __init__ as async, and await Fisch(...) in the super init
you also need to change this line
self.attached_message = await interaction.response.send_message(view=FischView(self.bot, selected_letter, self.gewaesser))
to
self.attached_message = await interaction.response.send_message(view=await FischView(self.bot, selected_letter, self.gewaesser))
Ok like this?
class FischView(discord.ui.View):
async def __new__(cls, *args, **kwargs):
obj = super().__new__(cls)
await obj.__init__(*args, **kwargs)
return obj
async def __init__(self, bot: discord.Bot, selected_letter: str, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
self.selected_letter = selected_letter
super().__init__(await Fisch(self.bot, self.selected_letter, gewaesser))```
yepp
now you are getting it 
done now but now i have the error [Cog] Error loading music.py: Callback for reload command is missing "context" parameter.
Do you know basic Python?
Hello, how to change the label of another button?
Oh wow many many thanks!
oh, i got it
Is it possible to retrieve all the selections at the end to write them to the database without having to loop all the variables through each view?
sorry i didn’t understand
anyways i gtg sleep

I have a dropdown menu.
When I select something in this dropdown menu a new second dropdown menu is created.
If I select something there again, a third dropdown menu is created.
If I select something in the third dropdown menu a button is created. When I press the button I want to write the three selected contents from the dropdown menus into the database.
Can I then somehow access the contents in the callback of the button without always having to pass the values of the dropdown menus self.values as a variable into the next view of the next dropdown?
Because then I have later in the view of the third dropdown menu 2 variables that were passed where the values from the previous Drin stand and must then pass 3 variables to the button.
Is that somehow easier that I can access the values directly in the button? 🙂
Ig I'm not the only one here rewriting their code in order to migrate to v3. I created a v3 branch and use pycharm to switch back and forth. Unfortunately both branches use the same virtual environment, thus I can't install pycord v2 in one and v3 in the other. Is it possible to have different venvs/interpreters on different branches or do I have to create a seperat project?
Tbh migrating to v3 is not a very good idea unless you're doing it for test purposes
Hello! I have a question
Why don't slash commands appear for my bot on my sever? I tested several servers and edited the code in different ways, but there is no result
Initially, there were slash commands some time, but after some test now they simply do not appear (Could this be a discord rate limit?)
import discord
from config import settings
SubBot = discord.Bot(intents=discord.Intents.all())
print(f"::: Bot starts!")
@SubBot.event
async def on_connect():
print(f"::: {SubBot.user} connected to Discord!")
@SubBot.event
async def on_ready():
print(f"::: {SubBot.user} started successfully!!")
@SubBot.slash_command()
async def test(ctx):
await ctx.respond(f"{ctx.user}")
SubBot.run(settings['TOKEN'])
Just getting started and wanted to test the new syntax
You're overriding on_connect
.rtfm on_connect
Read the docs. 1st item.
Oh! Thank you! I've been struggling with this for 2 hours now and I've already lost all the time
Can you explain why it doesn't call Bot.sync_commands()?
Because you're overriding the method that calls it
And You're not calling it by yourself
Generic python question -- is there a way to have a master class that loads and returns an instance of a child class automatically?
Like I want to be able to load an instance of Fruit (contrived) but have subclasses,, e.g. Apple and Banana be returned based on some thing I pass into the Fruit constructor.
What's the best way of doing that? Or is that not something recommended? I need to abstract out some API calls but don't want my cog to have to care which class I'm actually interacting with, assuming they have the same methods
You could trigger the second and third Select and Button from the callback of the first select, then when the button is pressed you have access to all of the values and can write them to the DB.
What do you mean?
Question about bot capabilities.
I am working on a bot to track some game statistics as well as achievement completions. Only issue is that with players self-reporting I want a means of verifying the data. Is it possible to have the bot wait for a specific reaction like a thumbs up or green check mark from a specific player/group before it runs the rest of the code? And how long can I have it waiting for each instance? If 10 players were to submit within an hour, does the bot have the capacity to remember each instance separately and wait for the requested reaction? I don't currently want code on this, merely to know if the API and python would be able to accomplish this.
My assumption is something along the lines of a intents.reaction with on_raw_reaction_add tied to true/false statement to see if user.id equals someone with higher admin role/perms?
Yes. The event is the best approach.
or the event
Oh, I thought they only wanted one person to react
I guess you could tie it into a loop and wait for a specific number of reactions. But in that case it's probably just better to use the event
Generally, I would like it to either accept with one reaction from an admin or from 3-5 reactions from unique players
whichever occurs first
You could do something like
while number_of_reactions < 5 and number_of_admin_reactions < 1:
# wait for another reaction
# Do your stuff here
But the event listener might be cleaner
lol, noticed the edit and was about to comment on that
but yeah, that should probably work. I have a single command with 8 buttons for the options that each run their own code depending on which is pressed. Will play with this and see if I can get it to work properly
Thanks for the suggestions/help
Basic python question because I haven't ran into this yet:
What does the ellipses in this mean?
some_function(view: View = ...)
I'm used to the default being None. Wasn't sure if this acted the same way.
It's the default it'll run into if no argument is passed
And makes the argument non-required
Hmmm, interesting. So this is essentially the same as None?
If you do = None, then it'll be None when you don't pass an argument
Ah, I see. It allows the argument to not exist. Thanks!
You can probably Google it and get a better explanation.
I have an add faq command that store the faq in a separate file, however the faq isnt being written to the file. So when ever i restart the bot, it says the faq isnt there.
import dictionary
@commands.command()#addfaq command
@commands.has_permissions(administrator=True)
async def addfaq(self, ctx, question, *, answer):
dictionary.faq_dict[question.replace("'", "")] = answer.replace("'", "")
await ctx.send(f"FAQ added: {question} - {answer}")
Use an actual database
If i have an description of command, how can i get it as string to send somewhere?
Something like {bot.command.user.description}
😭
The embed = embed seems redundant, you already have it called.
Probably:
``await ctx.respond(str(embed))
or embed[1]
Thanks but i dont think thats what i want
could always just return embed.description if you want it somewhere else
.rtfm get_command
discord.ext.commands.Bot.get_command
discord.ext.commands.Cog.get_commands
discord.ext.commands.Group.get_command
discord.ext.commands.GroupMixin.get_command
discord.ext.commands.HelpCommand.get_command_signature
discord.ext.commands.AutoShardedBot.get_command
discord.ext.commands.DefaultHelpCommand.get_command_signature
discord.ext.commands.MinimalHelpCommand.get_command_signature
discord.Bot.get_command
discord.Cog.get_commands
discord.ext.bridge.AutoShardedBot.get_command
discord.AutoShardedBot.get_command
discord.ext.bridge.Bot.get_command
discord.ext.bridge.BridgeExtGroup.get_command
That will return a Command object, which has a description attribute. If this is what you're trying to ask lol
That's not how it works
Exactly!
But i think i did all wrong
Ill try to fix it
willing to be proven wrong, thats how you learn
Yeah. You need an actual bot object. Are you working on cogs or just your main file where you defined your bot instance?
For start, this is the main file for now.
bot = discord.Bot(intents=discord.Intents.all())
user = bot.create_group(name="user", ...
@user.command(name="info",
description="some description", ...
async def command(ctx):
...
Nice i did it
bot.get_application_command("user info").description
That's great.
One message removed from a suspended account.
One message removed from a suspended account.
if you are not in a cog, you do not use self.
One message removed from a suspended account.
Where is the function?..
One message removed from a suspended account.
Where's the get_pages function
please show more of your code.
One message removed from a suspended account.
while the example is correct, yours may not be.
One message removed from a suspended account.
ok, but your commands?
One message removed from a suspended account.
Hi
I cant understand why command options does not work
Ive tried to put option = [...] in @user.command
Put option into async def command
and tried to add @discord.command.option
And all does not works
bot = discord.Bot(intents=discord.Intents.all())
user = bot.create_group(name="user")
@user.command(name="info")
async def command(ctx: discord.ApplicationContext, test: discord.commands.Option(discord.Member, "Test")):
await ctx.respond("test")
It's discord.Option
This?
Yes
- You are using
selfoutside of a class. - Why did you make a cog for just the paginator?
- In this case,
selfis being assigned todiscord.ApplicationContext.
Why discord.Option(discord.SlashCommandOptionType.user)) shows only all who writed something in chat? How can i select from all members of server?
discord limitation. try restarting your discord app.
One message removed from a suspended account.
One message removed from a suspended account.
Here's the paginator example.
One message removed from a suspended account.
Why when im using more parameters in discord.Option members does not appears?
But when im using this all works fine
remove the input_type stuff and use discord.Member
discord.Member, name=""
hi please make a new thread because it is taking too much space.
the order in Python arguments goes: positional arguments then keyword arguments. type is a positional argument and therefore goes first.
One message removed from a suspended account.
How to set default parameter to member that executed command?
This code is sends nothing good 😔
Ive tried discord.ApplicationContext.author but it sends <discord.utils._cached_property object at 0x0000022B92A9C410>
you would usually set default to None and handle the logic in the callback itself
Are the 3 dropdowns and button in the same message? Or are they in different messages
If they are in different messages, you have to pass the values around
You can also do user = user or ctx.author

So you don't need an if condition
why does this keep happening?
I have
if not self.get_member_count.is_running():
self.get_member_count.start()
(the on_ready is getting run for the second time and cogs getting loaded for the 2nd time, i assume the bot got disconnected)
How should I fix it?
import os
import json
from discord.ext import commands
with open('config/config.json') as config:
data = json.load(config)
class deva(commands.Bot):
def __init__(self, *args, **kwargs):
self.token = data["token"]
super().__init__(command_prefix=data["prefix"], *args, **kwargs)
bot = deva(owner_id=901500429618274304, case_insensitive=True)
@bot.event
async def on_ready():
print(f'{bot.user} is Ready')
if __name__ == "__main__":
for file in os.listdir('./cogs'):
if file.endswith('.py'):
bot.load_extension(f'cogs.{file[:-3]}')
bot.run(bot.token)```
Your error doesn't even match the code you're showing
Really? and what should I do with the error?
wait a moment
its not doing the funny
I basically did everything in ?tag replit but pycord just wont install
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.
Why not just use git?
i have one personal computer, another is a chromebook
Why not just use git?
how would I run it on a school chromebook lmao
Why wouldn't you?
wdym
What's stopping you from using git on a chromebook?
just use gitpod for chromebooks
linux doesn't exist
cant
can confirm
not on our school-distributed ones
There's definitely a workaround
nope
wait
No one is going to download your bot and read it. Send your code or ask your question properly
was that the one you showed me last year
what did I show you last year
vscode
import os
import json
from discord.ext import commands
with open('config/config.json') as config:
data = json.load(config)
class deva(commands.Bot):
def __init__(self, *args, **kwargs):
self.token = data["token"]
super().__init__(command_prefix=data["prefix"], *args, **kwargs)
bot = deva(owner_id=901500429618274304, case_insensitive=True)
@bot.event
async def on_ready():
print(f'{bot.user} is Ready')
if __name__ == "__main__":
for file in os.listdir('./cogs'):
if file.endswith('.py'):
bot.load_extension(f'cogs.{file[:-3]}')
bot.run(bot.token)```
but on chromebook
here
or was that someoen else
That is not your code, because that is not what your error says
How am I supposed to know?
You're the one sending the wrong code
My bot currently want to look though reply chains. But I assume I will always be rate limited when trying to find the reply message to a reply and so on?
not wrong
it is wrong, read your error
if the "reply chain" is too long, maybe
That is literally a different error than you sent before
if you have message content intents you can increase your message cache and not deal with ratelimits
And the error explains exactly what's wrong
It fetches about 5 messages, then has to wait to fetch more
if you still need help, just talk to me tmrw
#998272089343668364 message
ye in person is better for this
how can i accept inputs along with a slash command?
You can set an argument by using discord.Option
In different messages
thanks
async def img(ctx):
generateCard()
#await ctx.respond(file = discord.File('newcard.png'))
print(ctx.message)```
why does it print a None?
shouldn't ctx.message be a Message object?
cause slash command didnt send any message
Then you dont have a better way than passing it around
Idk what too do?
The system works like this, that a user presses a start button, then a new text channel is created only for the user. There he clicks then gradually through the dropdown menus and at the end the data should be written into the DB. The whole thing can of course be done by several users at the same time.
Should I then perhaps create a Dict at the first dropdown and then always pass only the Dict and add the values there so that I do not have to pass so many variables through later or will that not work?
can you show the pip list pls
which py-cord version is that?
also uninstall this and py-cord and reinstall py-cord
restart vscode after that
How to display this user.created_at timestamp in <t:1675415220:D> style?
Same error
_description = f"> {user.created_at}\n" +\
f"> {user.joined_at}\n" +\
f"> {user.joined_at}"
Ive found it
discord.utils.format_dt(user.created_at, 'R')
why should it not support it?
How can I send a response without sending a message?
What options do I have there?
if self.attached_message:
await self.attached_message.edit_original_response(view=await FischView(self.bot, selected_letter, self.gewaesser))
await interaction.response.```
there are no docs for it
you have to send a message
But I don't want to send a message but only update my dropdown menu when I made another selection 😄
than edit the message with the response
interaction.response.edit_message
Use that
To edit
Yeah you can pass a dict. You can pass a list/tuple too
Do you mean like this?
async def callback(self, interaction: discord.Interaction):
selected_letter = self.values[0]
if self.attached_message:
await self.attached_message.interaction.response.edit_message(view=await FischView(self.bot, selected_letter, self.gewaesser))
else:
self.attached_message = await interaction.response.send_message(view=await FischView(self.bot, selected_letter, self.gewaesser))```
Depends on what you want
Not self.attached_message.interaction....
Just interaction.response.send_message
Use interaction you receive in the callback
If I create this in the view of the first dropdown menu then this is also for everyone separately and is not overwritten by other values if another user also selects something in his own room or?
I want my dropdown menu "Fish" to be updated (edited) when I select another letter. The message should not be deleted and posted again but at the point where it is simply edited because otherwise the sequence is no longer correct
class BuchstabeFisch(discord.ui.Select):
async def __new__(cls, *args, **kwargs):
obj = super().__new__(cls)
await obj.__init__(*args, **kwargs)
return obj
async def __init__(self, bot: discord.Bot, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
self.attached_message = None
fische = await get_fish(gewaesser)
buchstaben = set()
for fisch in fische:
buchstaben.add(fisch[0])
buchstaben_sortiert = sorted(list(buchstaben))
options = [discord.SelectOption(label=letter) for letter in buchstaben_sortiert]
super().__init__(
placeholder="Anfangsbuchstabe Fisch",
min_values=1,
max_values=1,
options=options,
)
async def callback(self, interaction: discord.Interaction):
selected_letter = self.values[0]
if self.attached_message:
await self.attached_message.interaction.response.edit_message(view=await FischView(self.bot, selected_letter, self.gewaesser))
else:
self.attached_message = await interaction.response.send_message(view=await FischView(self.bot, selected_letter, self.gewaesser))```
I cant understand whats wrong, there is TypeError: 'in <string>' requires string as left operand, not int in if id not in user_first_join:
Ive tried to str(id) and then another TypeError: 'str' object does not support item assignment in user_first_join[id]
Then ive added int(id) and there is still this error 
user_first_join = {}
f = open("user_first_join.txt", "r")
user_first_join = f.read()
f.close()
def save_user_first_join(id):
if id not in user_first_join:
user_first_join[id] = bot.get_guild(1069357003362807848).get_member(id).joined_at
f = open("user_first_join.txt", "w")
f.write(f"{user_first_join}")
f.close()
@bot.event
async def on_member_join(user):
save_user_first_join(user.id)
user_first_join = {}
with open("user_first_join.txt", "r") as f:
user_first_join = f.read()
async def save_user_first_join(id):
if str(id) not in user_first_join:
user_first_join[id] = bot.get_guild(1069357003362807848).get_member(id).joined_at
with open("user_first_join.txt", "w") as f:
f.write(f"{user_first_join}")
@bot.event
async def on_member_join(user):
await save_user_first_join(user.id)
I hope this is it
But
Also, good idea to not name your variables as id. It's a built in python function too
File.read returns a string
Don't use text files or json as database
Is it fraught with performance?
I need to write a simple code for my server for 50 people as soon as possible, I don't think it's worth turning to SQLITE for this
Or it is?
Json and text files used as dbs are extremely prone to breaking or getting corrupted. Especially text file
You could use python pickling but i feel you might as well use sqlite
Can you store emojis and long text in a db?
Yep
Heck you can even store the bytes of the emoji in sql
What does it do?
await interaction.response.defer()```
you use this if the response takes longer
Can I just use that or is that messy?
if self.attached_message:
await self.attached_message.edit_original_response(view=await FischView(self.bot, selected_letter, self.gewaesser))
await interaction.response.defer()
else:
self.attached_message = await interaction.response.send_message(view=await FischView(self.bot, selected_letter, self.gewaesser))```
you still have to send a message or you will get an error
If you create the dict in the first callback, it won't get overwritten by other users using it
Not for view components
Why not just use interaction.response.edit_message
Because I only overwrite the dropdown menu from the letters and this then becomes fish instead of editing the fish dropdown menu that comes after the letters.
Can you show what happens? Like a video if possible
Wait a moment
Where can I upload this?
OBS Format 😄
Here mp4
Code:
class BuchstabeFisch(discord.ui.Select):
async def __new__(cls, *args, **kwargs):
obj = super().__new__(cls)
await obj.__init__(*args, **kwargs)
return obj
async def __init__(self, bot: discord.Bot, gewaesser):
self.bot = bot
self.gewaesser = gewaesser
self.attached_message = None
fische = await get_fish(gewaesser)
buchstaben = set()
for fisch in fische:
buchstaben.add(fisch[0])
buchstaben_sortiert = sorted(list(buchstaben))
options = [discord.SelectOption(label=letter) for letter in buchstaben_sortiert]
super().__init__(
placeholder="Anfangsbuchstabe Fisch",
min_values=1,
max_values=1,
options=options,
)
async def callback(self, interaction: discord.Interaction):
selected_letter = self.values[0]
if self.attached_message:
await interaction.response.edit_message(view=await FischView(self.bot, selected_letter, self.gewaesser))
else:
self.attached_message = await interaction.response.send_message(view=await FischView(self.bot, selected_letter, self.gewaesser))```
So the selections are dependent on each other.
Depending on which water I choose, I get other letters and depending on the letter other fish.
And I would like to do it now so that if I select a body of water and then a letter, I then but notice the body of water was wrong, that the dropdown menus of the letter is adjusted and then that of the fish of course also 🤔
btw you can use ö, ä and ü but its fine if you use ae
How to get id of server on what i have used command?
Thanks
But how to get it from this event?
@bot.event
async def on_member_join(user):
...
Okay 🙂
I can change quickly. My current problem is already more difficult 😄
How can I "save" the attached_message so that my intention works?
Because if I change the water then the dropdown menu for the letters is created again and thus the attached_message again to None so that I can then no longer edit the fish dropdown menu but a new create 🤔
Ohh i understand now
I think your can use this
.itworks
Yes that works 😄
But do you also know a solution for my problem what I actually want to solve?
I will steal this one
I think you will have to delete the old one and send a new one
Wait that doesn't make sense
Hello. how would I be able to create a dropdown based on a list of arguments?
The list basically contains dataclasses.
But then the sequence no longer fits -.-
Otherwise, can I create a temporary JSON file with the username.json and store there the attached_messag of each dropdown and after I have run through everything and press the Ready button just delete the JSON file again?
Does this make sense?
Here's the slash options example.
I don't see why the dict way doesn't work. Don't use json please
Good idea for you to create a post in #969574202413838426 because this is getting big
Hello,
Is there away to set permissions in a private channel?
For example like this:
for channel in interaction.guild.channels:
await channel.set_permissions(muted, speak=False, send_messages=False, read_message_history=True, read_messages=True)
What's wrong with that? 🤔
.rtfm channel.set
Basically when I try that the private channels could be viewed too
Btw you will run into a ratelimit if you change perms for all channels like that
Yes I have now taken the dict variant that went quite well then it is always only one variable that I have to loop through and everywhere I just add the value 🙂
Cool 
It's for the mute role
So do you want to ignore private channels?
Why permissions dont works?
from discord import default_permissions
bot = discord.Bot(intents=discord.Intents.all())
dump = bot.create_group(name="dump")
@dump.command(name="first_join")
@default_permissions(administrator=True)
async def command(ctx: discord.ApplicationContext):
...
Everyone still can use this command
Check the permissions of the role for the channel before setting new ones
.rtfm channel.perm
discord.DMChannel.permissions_for
discord.TextChannel.permissions_for
discord.TextChannel.permissions_synced
discord.StageChannel.permissions_for
discord.StageChannel.permissions_synced
discord.ForumChannel.permissions_for
discord.ForumChannel.permissions_synced
discord.VoiceChannel.permissions_for
discord.VoiceChannel.permissions_synced
discord.GroupChannel.permissions_for
discord.CategoryChannel.permissions_for
discord.CategoryChannel.permissions_synced
discord.abc.GuildChannel.permissions_for
discord.abc.GuildChannel.permissions_synced
Use permissions.for
Could please provide an example
Default permissions can be changed by server admins from the server settings
Discord bots cant set this permissions by default?
You can. But as i said, server admins can chage these permissions if you use default_permissions
Uh. How can I provide an example. 
Check the docs
Why is mutedrole=discord.utils.get(ctx.guild.roles, id=int(role_id)) not working?
Yes I have created a post for my problem, maybe someone can look in and knows a solution for me 🙂
Discord limitation
Permissions can only be applied to the group not each individual command inside the group.
You can get around this by making the bot check but this does not allow for customization by server admins.
Didn't know that lol
Use guild.get_role(id)
Use channel.permissions_for(role) to get the Permissions
Then check if perms.view_channel: followed by set permissions
Thank you
Will it ignore private channels?
Thank you! I also thought about it
.tias
It's not working
Does anyone know a solution to my problem "Regenerate the following dropdown menus" ? That would be infinitely helpful.
What exactly happens ? Show the code you used
One message removed from a suspended account.
The error is self explanatory
One message removed from a suspended account.
"Missing 1 required positional argument"
How would I create a cooldown for a modal? At the moment I have it on the button to open the modal, but I need it to only set the cooldown if its submitted.
how do you currently have it on the button?
instead of updating time in button callback, update it in modal callback
you can also use self.stop in the modal and modal.wait in the button callback to keep updating the time in the button callback
new_message = interaction.message
new_message.author = interaction.user
bucket = self.cd_mapping.get_bucket(new_message)
retry_after = bucket.update_rate_limit()
if retry_after:
I tried just placing that in the modal callback, but it doesn't function
Rather than bucket.update_rate_limit, use bucket.get_retry_after
then pass the bucket to the modal. and at the end of the modal, use bucket.update_rate_limit
cooldown stuff is undocumented. so bear with me if my solutions are not working.
Still not working, seems like its not setting a cooldown
can you show the updated code
sure 1 sec
async def callback(self, interaction: discord.Interaction):
new_message = interaction.message
new_message.author = interaction.user
bucket = self.cd_mapping.get_bucket(new_message)
retry_after = bucket.get_retry_after()
if retry_after:
await interaction.response.send_message(f'cooldown')
#modal stuff
bucket.update_rate_limit()
await channel.send(embed=embed, delete_after=18000)
Is it possible to implement a system where when pressing a button, it sends a message asking you a question and then once you've answered it, it sends an embed with your answer to a specific person
yes
I'm sure I'm being fuckin stupid
For some reason this listener isn't working
custom_commands is a dict and is not empty
@commands.Cog.listener()
async def on_message(self, message):
for command, response in self.custom_comamnds.items():
if message.content.startswith(">" + command):
await message.channel.send(response)
i'm fucking special
commands != comamnds
anyone has an idea why button might not get disabled
for child in self.children:
child.disabled = True
await interaction.response.edit_message(view=self)```
.rtfm disable_all
Try this instead ^
It essentially does the same
Otherwise we will need more code
Is it okay? As a backup method, what if I'll post the .SQL file in a private Discord server channel?? As a backup of postgresql? In every 1minutes
There is no way you need a backup ever 1 min. Also discord only saves attachments for about a month iirc. And there are file size limits on discord.
So no not really a good option.
So how can I save my data? Because im using AWS free tire and they can stop their services any time
Is there any good way to do it ??
Databases save to a file if you can still access your files you will have your data.
If you don't have access to a way to store your files, you won't be able to store backups either. Simple as that
I know that, but I'm just scared of they stopped their services or disable my AWS account i lose all data
Then find another service or another place to store your files. This has nothing to do with pycord or python at all for that matter
My guess if they stop the service they will not delete the files
So, still i get time to download those files ?
Would be my guess, if you are super worried about it contact AWS support I'm sure they would be able to answer the question.
Okh thanks ❤️❤️
.rtfm cooldown
discord.ext.commands.Cooldown
discord.ext.commands.Cooldown.copy
discord.ext.commands.Cooldown.get_retry_after
discord.ext.commands.Cooldown.get_tokens
discord.ext.commands.Cooldown.per
discord.ext.commands.Cooldown.rate
discord.ext.commands.Cooldown.reset
discord.ext.commands.Cooldown.update_rate_limit
discord.ext.commands.CommandOnCooldown
discord.ext.commands.CommandOnCooldown.args
discord.ext.commands.CommandOnCooldown.with_traceback
discord.ext.commands.Command.cooldown
discord.ext.commands.Command.get_cooldown_retry_after
discord.ext.commands.Command.is_on_cooldown
discord.ext.commands.Command.reset_cooldown
discord.SlashCommandGroup.cooldown
discord.SlashCommandGroup.get_cooldown_retry_after
discord.SlashCommandGroup.is_on_cooldown
discord.SlashCommandGroup.reset_cooldown
discord.UserCommand.cooldown
The code below modal stuff comment is in the modal callback right?
Do you return in the if retry after block?
Yes
Any suggestions as to how?
button and wait_for?
I tried using a wait_for inside of a button which is inside of a view class but like it gives the error AttributeError: 'BuilderDecisionView' object has no attribute 'bot'
def check(m):
return m.author == interaction.user and m.channel == interaction.channel
reason = await self.bot.wait_for("message", check=check)
reason = reason.content```
await interaction.wait_for(...)?
interaction.client
you can use interaction.client inside of a cog?
i thought client and bot just always got replaced with self
Well thank you very much for the help 
It sets permission to all the channels
How do i solve this? (I am new to to pycord)
quick question can discord bot send a file?
yes?, why should it not be possible?
how can i add prefix on the bot but slash commands can still work?
you mean prefix and slash in one command?
nope, i mean can i make a prefix command and slash command
discord.Client # just for events
discord.Bot # events + slash/user/msg commands
commands.Bot # above + prefixed commands
bridge.Bot # above + bridge commands (application commands and text commands in one)
I'll add commands.Bot even if i have dsicord.Bot?
replace discord.Bot
aight
How do you make context menu in cogs?
?tag nojson
Why not to use json files for data storage
JSON files are commonly used to store data that is read by a program, however, they are unsuitable for storing dynamic data due to a number of reasons.
It is recommended to use a DBMS (Database Management System) as they come with optimized technologies for storing and retrieving information.
Advantages of using a database:
- Database tables can be related, making it easy to separate your information into multiple tables and only fetch what you need
- Databases allow you to use a query/data processing language to make complex data operations easier with less code
- One misplaced character will corrupt an entire file. A database very rarely experiences corruptions due to their automatic handling of data integrity
- Transactions in SQL databases allow you to revert unwanted changes and prevent data corruption in the case of an error
- Databases have support for indexes, allowing retrieval of some data to be extremely fast
- It is very easy to update existing data in a database, as opposed to re-writing a file
- Databases are reliable
Popular database management systems:
- SQLite3 (File based, no need for a server setup, SQLite is the most used database engine in the world)
- MongoDB (Stores data in documents a similar manner to JSON format, easy for beginners)
- PostgreSQL (Very popular and robust SQL based database management system)
- MySQL (Another popular SQL based system, good start for learning SQL)
Yes it's possible :
await ctx.send(file=discord.File("main.py"))
.rtfm discord.user_command
In cogs
Yes. Just run the bot 2 times?
no like
balls = discord.Bot(intents=intents)
bot = discord.Bot(intents=intents)
Here's the button roles example.
@fervent cradle use this one https://guide.pycord.dev/interactions/ui-components/buttons
Learn all about implementing buttons in your Discord Bot using Pycord.
Mhm possible. Use asyncio.run
With bot.start and balls.start in asyncio.gather
Yeah i use @discord.message_command in cogs and it works as intended. User cmds should work too
Thanks
import discord
from discord.ext import commands
intents = discord.Intents.all()
intents.members = True
client = commands.Bot(intents)
@client.event
async def on_ready():
print("hi")
await discord.ForumChannel.create_thread("1071432837229719613", "post name!")
token = load(open('./token.json'))
client.run(token["Token"])
Hey, any clue why this throws with
Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\Dek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 377, in _run_event
await coro(*args, **kwargs)
File "D:\GitHub\CTT\post.py", line 17, in on_ready
await discord.ForumChannel.create_thread("1071432837229719613", "woo")
File "C:\Users\Dek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\channel.py", line 1227, in create_thread
state = self._state
AttributeError: 'str' object has no attribute '_state'
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Dek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 298, in get_context
if message.content.startswith(tuple(prefix)):
TypeError: tuple for startswith must only contain str, not tuple
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Dek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 377, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Dek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 387, in on_message
await self.process_commands(message)
File "C:\Users\Dek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 383, in process_commands
ctx = await self.get_context(message)
File "C:\Users\Dek\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 313, in get_context
raise TypeError(
TypeError: Iterable command_prefix or list returned from get_prefix must contain only strings, not tuple
How to get bot launch time?
do you know basic python?
you can probably use
@client.event
async def on_ready():
and in that function use a python timer to see how much time has elapsed
implemented that in a program of mine to see how long it has ran for
when everything else has ran
https://github.com/couleur-tweak-tips/Smoothie/blob/fc39182023f9c39bf7d555d860f7a6b38262c9bb/src/main.py#L81
@fallow oracle ^
indeed, though I am not familiar with what @client.event is syntactly and am not familiar with pycord
what is with discord.py?
is there a way I could get ctx (or an alternative) in my on_ready function (or anything else that could be triggered on it's own at startup)
I'd like my bot creating a forum channel with an embed on the original message in the post when I run it (I don't want to deal with any manual functions on Discord and prefer using this as a CLI tool)
I meant I have no experience with putting @ signs before functions or the async traits
ctx is just extra data calculated based on underlying message or interaction. you dont get message or interaction on ready.
you can use bot.get_guild if you want
that gives you the guild
ah okay nice, do you have a clue of what is wrong with my code?
@fallow oracle
yeah I've read it but as I said I'm trying to create a forum on startup
yeah that's what i'm wondering about
oop doesnt work that way. you need an object of ForumChannel. which you can get using guild.get_channel(id_of_forum). for which you need a guild object, which you can get using bot.get_guild(guild_id)
yeah. intents is a kwarg @fallow oracle
.intents
https://docs.pycord.dev/en/master/intents.html
https://discord.com/developers/docs/topics/gateway#gateway-intents
import discord
from discord.ext import commands
# Get specific intents for fine control
intents = discord.Intents()
intents.emojis = True
intents.guilds = True
intents.messages = True # Required for prefix commands!
...
# Get all non-priveliged intents; this excludes presences, members and message_content
intents = discord.Intents.default()
# Set priveliged intents: these must be enabled on dev portal
intents.members = True
intents.presences = True
intents.message_content = True # Required for prefix commands >= 2.0.0b5
# Get all intents; all intents must be enabled on dev portal.
intents = discord.Intents.all()
# Apply intents when creating your bot
bot = commands.bot(prefix="?", intents=intents)
see the last line
alright, set it up like so:
intents = discord.Intents.default()
intents.members = True
intents.message_content = True
bot = commands.Bot(
command_prefix=commands.when_mentioned_or("$"),
description="",
intents=intents,
)
yea that should probably work
guild = bot.get_guild(1070184725580349440)
forum = guild.get_channel(1071432837229719613)
await forum.create_thread("1071432837229719613", "woo")
also see this.
worked 👍 now imma see if I can make an embed in that original post
mhm that looks right
ohh nice
so it seems there's no support to feed it an embeds.Embed object
maybe I could modify that message and edit it and potentially replace it with a message with features an embed?
How would I go about stripping the contents of an embed down into a format similar to that of an api response
.rtfm Embed.to_dict

Appreciated 🫶
Something's wrong with ephermal, how is it used?
Whenever I try to use it in a response the bot simply does not respond to the command anymore
and how do you send it?
await ctx.respond(":CrossMark: Command execution failed: You cannot ban an administrator!", ephermal = True)```
"ephermal"

minor spelling mistake
oh lol
I'm confused with the spelling
And it worked! Thanks @full basin and @atomic wolf
How to make an option like this? (not just bool)
Here's the slash options example.
Look at line 15 in that example @fervent cradle
👍
Hi, can a bot use multiple tasks.loop()?
yes
it seems that it dont execute more than one at the same time
like, my second tasks.loop is only
@tasks.loop(seconds = 10)
async def actual_embed(self):
print("test")
```but it dont even print test
did you start it
hm
how to? I dont start my first one, and its still working apparently
oh
im dumb
effectively
we all are
ty mate
command checks
class MyModal(discord.ui.Modal):
def __init__(self, *args, **kwargs) -> None:
super().__init__(
discord.ui.InputText(
label="Short Input",
placeholder="Placeholder Test",
),
discord.ui.InputText(
label="Longer Input",
value="Longer Value\nSuper Long Value",
style=discord.InputTextStyle.long,
),
*args,
**kwargs,
)
async def callback(self, interaction: discord.Interaction):
embed = discord.Embed(
title="Your Modal Results",
fields=[
discord.EmbedField(
name="First Input", value=self.children[0].value, inline=False
),
discord.EmbedField(
name="Second Input", value=self.children[1].value, inline=False
),
],
color=discord.Color.random(),
)
await interaction.response.send_message(embeds=[embed])
@bot.slash_command(name="modaltest")
async def modal_slash(ctx: discord.ApplicationContext):
"""Shows an example of a modal dialog being invoked from a slash command."""
modal = MyModal(title="Slash Command Modal")
await ctx.send_modal(modal)
I'm using the example to create a modal I get an error.
class MyModal(discord.ui.modal):
AttributeError: module 'discord.ui' has no attribute 'modal'
are you sure the m in modal is capitalized?
what pycord version?
py-cord==2.0.0b1
pip list and send output
ic, please update to 2.3.2
- Uninstall discord.py or any other forks of discord.py you might have with the namespace
discord.
python -m pip uninstall discord.py discord -y
2a. Install py-cord
python -m pip install py-cord
2b. Update py-cord
python pip install -U py-cord
Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.
Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord
?tag install
- Uninstall discord.py or any other forks of discord.py you might have with the namespace
discord.
python -m pip uninstall discord.py discord -y
2a. Install py-cord
python -m pip install py-cord
2b. Update py-cord
python pip install -U py-cord
Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.
Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord
how do i edit a response using interaction
interaction.edit_original_response
or interaction.response.edit_message
depends on what you are doing
TypeError: InteractionResponse.edit_message() takes 1 positional argument but 2 were given
wtf
what did you do 
you have to pass content as a kwarg btw
content="hello there"
create one
First time that problem appeared
now Im getting no module named discord
oh I see what I did
I deleted the history yesterday
I'm dumb
Need the packages again
ok
why are you using replit anyways?
Because it usually works and I'm more familiar with it
?tag norepl
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.
How?
No tag repl found.
okay?
?tag replit
Read this to find out how you can install Pycord in Replit
Old instructions: https://web.archive.org/web/20211128084858/https://namantech.me/pycord/installation/#replit
New instructions: #998272089343668364 message
I'm just saying, replit will not work in the long run. If you want to develop Discord bots you should also learn how to host them properly. Especially if you ever plan on your bot growing.
I currently do it for practice
My bot doesn't do anything crazy anyway
Except that you can make announcements with ease while the bot just asks you for inputs
Well if you're doing it for practice, why not also practice how to set it up?
That's a good point actually
I created a new repl
Fixed
Ooof
Dude
send the message using ctx.send and the modal normally
getenv no workie
it keeps on saying it doesn't exist
tried also adding dotenv_path = ".env" but it doesn't really help much
That is not a json...
changed it and it still doesnt work...
Your env file isn't supposed to be in json format lmao
still acts as it never exists
Also create a new token
So. Sorry but had to
what?
To clear the chat here
ok
Hello there! 🙂
Can autocompletion only be used with slash_commands or can I change the prefix somehow. So for example if i type in "cmd." as my prefix that the available commands with "cmd." as prefix are shown and described?
only slash commands
ok, I thought so. Thanks 🙂
can i know how to make this list to auto complete?
list = ["probablilty". "randomized", "history", "likelihood"]
@bot.slash_command()
async def method(ctx, discord.autocomplete(list)):
is that true?
what?
check this out:
https://github.com/Pycord-Development/pycord/blob/master/examples/app_commands/slash_autocomplete.py
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/slash_autocomplete.py at master · Pycord-Development/pycord
im having hard time understanding this examlpe
where is the command
why do we return and do a for loop
why do we have 2 lists
Autocomplete takes a function that returns a list
why cant it be exactly without like, a function why cant it just take a list
Because autocomplete is supposed to be dynamic
If you think making a function is hard, you might need to learn a bit more Python before making a bot
def list():
return ["probablilty". "randomized", "history", "likelihood"]
no its not hard kik
so what's the issue then?
im still confused how to link them
It literally tells you in the example. Look at line 138
i just thought it takes a list not a function.
@real compasstion("color", description="Pick a color!", autocomplete=get_colors)
@real compasstion("animal", description="Pick an animal!", autocomplete=get_animals)
?
just search for the given parameter and you see that it is a function in the example 😄
?tag codeblocks
No tag codeblocks found.
?tag codeblock
Please put your code in a code block:
```py
Here is your Code
```
That makes reading code in Discord a lot easier:
print("This is an example.")
understood thanks
How can I make it so that I can remove all the nicknames in my server?
is the hybrid_command decorator not implemented for pycord or how can I use it? 😮
hybrid command?
import discord
from discord.ext import commands
from discord import app_commands
class Bot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
super().__init__(command_prefix = "?", intents = intents)
async def setup_hook(self):
await self.tree.sync(guild = discord.Object(id = guild_id))
print(f"Synced slash commands for {self.user}.")
async def on_command_error(self, ctx, error):
await ctx.reply(error, ephemeral = True)
bot = Bot()
@bot.hybrid_command(name = "test", with_app_command = True, description = "Testing")
@app_commands.guilds(discord.Object(id = guild_id))
@commands.has_permissions(administrator = True)
async def test(ctx: commands.Context):
await ctx.defer(ephemeral = True)
await ctx.reply("hi!")
bot.run('TOKEN')
I want to register a command as a slash command but also on other prefixes like "?"
This is pycord, not discord.py
yeah, i know. That's why i was wondering on how to implement that on pycord 😮
Here's the bridge commands example.
ah thanks a lot, 😄
Hey, I'm making a bot to read data from a discord game bot and the embeds it sends. When it sends them normally (i.e. not a deferred message) the data can be captured fine. Some of the commands, it "thinks" about what it's doing (these are text prefix commands) and then responds (with the words (edited) appearing above the embed).
I would appreciate some help or direction on how to make it read "deferred" messages / embeds?
bot = discord.bot(intents=intents)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'module' object is not callable
import discord
from dhooks import Webhook
from Secrets import *
vike = Webhook(viking_status)
blox = Webhook(blox_status)
intents = discord.Intents.default()
intents.typing = True
intents.presences = True
intents = discord.Intents.default()
bot = discord.bot(intents=intents)
@bot.event
async def on_ready():
print(f'We have logged in as {bot.user}')
vike.send(status)
blox.send(status)
@bot.command
async def test(ctx):
await ctx.respond(desc)
bot.run(token)
oh
discord.Bot B caps
oh
i dont like them
Bot = discord.bot(intents=intents)

like this
i didnt tho
?
you didnt what?
block the event loop
not that. use discord.Bot not discord.bot
oh
fine but i will never use the built in webhooks
well dhooks is not an async library. it doesnt use the event loop. thats why using its functions will block your bot from connecting to the discord gateway
damn thats some lag
oh
Whatever. its your code
👍
@bot.slash.command
^^^^^^^^^
AttributeError: 'Bot' object has no attribute 'slash'
whats this
no
@bot.slash_command
nvm wait
@bot.command
^^^^^^^^^^^
TypeError: ApplicationCommandMixin.command() takes 1 positional argument but 2 were given
this alr i will read it
you forgot ()
do you know basic python?
I'm sure they don't and refrain to read the docs too.
so the usual 
in slash?
Option(str, "description", choices=["choice1", "choice2"], required=False)```
adapt as req
i.e. int not str
but then your choices=[] will need to be integers not strings so choices=[1,2,3]
to make a list of users, it should be like this, shouldn't it?
list_users = await ctx.guild.fetch_members(limit=None)
print(list_users)
any ideas? i'm stumped. I tried fetching the message by id and it says theres no embeds, when there clearly is... lol
you can use bot.wait_for
perhaps
seems more like the cache is making problems
guild.members has the members tbh. No need to fetch them
so the game has "guilds", theres a way for someone to prove they are the "leader" by using a certain command, so i'm making a bot that tracks how often they have to do guild commands, who does them, when they reset for the next cycle etc.
the "proof" command, it "thinks" (deferred message) and then sends the embed which contains the "id" of the leader in
other than that there is no "automatic" way of confirming the person trying to register the guild with the tracking bot is actually the leader
you can still use bot.wait_for to wait for an edited message.
i tried that and it came up blank.
Followup to a defer isn't actually a message edit iirc
Not sure but it would be cool if someone tested that
hi could you make a post about this, it would help to keep it more organized
in their original message, they stated the other bot they were listening to was using prefixed commands
Is there any examples of pages with buttons like this? If you know please show it to me i want to do same thing
Here's the paginator example.
Thanks!
i have done so.
Oh my bad.
when I use guild.members only I am the bot itself.
You need to turn on the members intent to see other members in the guild
And how is that done? @proud pagoda
The guide has a something on that: https://guide.pycord.dev/popular-topics/intents
All about intents in Discord.
Make sure you enable it in the dev portal and in your code
thxx
Maybe someone can help me further.
When I run my code on my PC everything works fine. But when I start the whole thing on my server and want to run my function I always get this error, maybe someone knows this and can tell me what the reason is?
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/ui/view.py", line 414, in _scheduled_task
await item.callback(interaction)
File "/home/Bot/Bot/cogs/spot.py", line 1537, in start_button
await interaction.channel.send(view=GewaesserView(self.bot))
File "/usr/local/lib/python3.8/dist-packages/discord/abc.py", line 1606, in send
data = await state.http.send_message(
File "/usr/local/lib/python3.8/dist-packages/discord/http.py", line 366, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.12: The specified option value is already used

I have also completely restarted the server and tried again
can you uninstall and reinstall pycord. just to ensure no package goof ups
i havent seen that happen before lol
Me neither 😄
I will reinstall pycord.
can you also show the code for GewaesserView
i think you have a select menu with duplicate option
You are not running them both with the same token at the same time are you?
How can I properly move my bot to a different voice channel? I was following what seems to be an older tutorial that uses the method await self.vc.move_to() but this function does not seem to exist, or at least is not for pycord.
Here's the basic voice example.
what even is self ? what class is this in?
How are you going to run a function on it if it's None?
maybe i should have created a thread instead 💀
No they are different bot tokens
Another warning. We suggest sticking to the newer tutorials as a lot has changed.
Then it's pretty obvious what the issue is. Your other bot as a duplicate value somewhere
This uses youtube_dl 💀
Newer tutorials are always hard to find for me. Thats why i came here. Figured someone knew of a better tutorial or an official doc like you sent
The funny thing is that it works on my PC locally and there are only problems on the server.
class GewaesserView(discord.ui.View):
def __init__(self, bot: discord.Bot):
self.bot = bot
super().__init__(Gewaesser(self.bot))
class Gewaesser(discord.ui.Select):
def __init__(self, bot: discord.Bot):
self.bot = bot
self.dictlist = []
for item in self.dictlist:
if 'messageid1' in item:
self.attached_message = item['messageid1']
break
else:
self.attached_message = None
options = [discord.SelectOption(label=water) for water in bot.waters]
super().__init__(
placeholder="Wähle das Gewässer aus",
min_values=1,
max_values=1,
options=options,
)
async def callback(self, interaction: discord.Interaction):
user_id = interaction.user.id
if self.attached_message:
updated = False
for item in self.dictlist:
if 'gewaesser' in item:
item['gewaesser'] = self.values[0]
updated = True
if 'buchstabefisch' in item:
del item['buchstabefisch']
if 'fisch' in item:
del item['fisch']
if not updated:
for dict in self.dictlist:
if dict['user_id'] == interaction.user.id:
dict['gewaesser'] = self.values[0]
break
await self.attached_message.edit(view=await BuchstabeFischView(self.bot, self.dictlist))
await self.dictlist[1]['messageid2'].edit(view=await FischView(self.bot, self.dictlist))
await interaction.response.defer()
else:
self.dictlist.append({'user_id': user_id,
'gewaesser': self.values[0]})
self.attached_message = await interaction.channel.send(view=await BuchstabeFischView(self.bot, self.dictlist))
await interaction.response.defer()
self.dictlist.append({'messageid1': self.attached_message})```
This will help too than
https://guide.pycord.dev/
https://docs.pycord.dev/en/stable/api/
Thanks a ton!
Why are you setting self.dictlist to an empty list and then looping over it?
oh wait its you. the fish guy 💀
I have used 1 to 1 the same .py file
So? You're using different tokens
dont name your variable dict
Yes
can you show what bot.waters is? also print options before super.init and see what you get
bot.waters:
['Achtuba', 'Alte Festung', 'Belaya', 'Bernstein See', 'Bärensee', 'Kuori', 'Ladoga Archipel', 'Ladogasee', 'Moskito See', 'Sewerskij Donez', 'Sura', 'The Cottage', 'Untere Tunguska', 'Windenbach', 'Wolchow', 'Yama River']
options:
[<SelectOption label='Achtuba' value='Achtuba' description=None emoji=None default=False>, <SelectOption label='Alte Festung' value='Alte Festung' description=None emoji=None default=False>, <SelectOption label='Belaya' value='Belaya' description=None emoji=None default=False>, <SelectOption label='Bernstein See' value='Bernstein See' description=None emoji=None default=False>, <SelectOption label='Bärensee' value='Bärensee' description=None emoji=None default=False>, <SelectOption label='Kuori' value='Kuori' description=None emoji=None default=False>, <SelectOption label='Ladoga Archipel' value='Ladoga Archipel' description=None emoji=None default=False>, <SelectOption label='Ladogasee' value='Ladogasee' description=None emoji=None default=False>, <SelectOption label='Moskito See' value='Moskito See' description=None emoji=None default=False>, <SelectOption label='Sewerskij Donez' value='Sewerskij Donez' description=None emoji=None default=False>, <SelectOption label='Sura' value='Sura' description=None emoji=None default=False>, <SelectOption label='The Cottage' value='The Cottage' description=None emoji=None default=False>, <SelectOption label='Untere Tunguska' value='Untere Tunguska' description=None emoji=None default=False>, <SelectOption label='Windenbach' value='Windenbach' description=None emoji=None default=False>, <SelectOption label='Wolchow' value='Wolchow' description=None emoji=None default=False>, <SelectOption label='Yama River' value='Yama River' description=None emoji=None default=False>]
Hey guys quick question: is there a way to reset a View when a button is clicked ? Thanks 😄
And what do you mean by reset view?
Sorry I wasn't clear just realised:
I have a few select, and one of them is disabled after the user made the choice (because next one depends on this first choice), I would like to provide a way to reset (i.e re-enable the first select) without having to retype the command
Create a new instance of the view, edit the message as response, pass such instance
I already tried (unless I didn't understood you) but I have this error:
The code in my button callback:
newView = TestView()
await interaction.response.edit_message(view=newView)
I've tried with enable_all_items() same error
Discord allegedly supports four images in an Embed if the URL is set.
I also do see that it appears to be based on separate embeds with the same destination URL. Does Pycord have any special way of handling this, or do I just create my own Embeds manually?
(Answer: Manually works fine)
it's not a real token
it's literally the rickroll url plus some jibberish
i know im very funny
it's so original
Ok mb I'm stupid it was because I was adding lists of options (now I make unions of sets it's working)
I have tested the whole thing several times now. With different bots, with the same bots, locally on my computer and on the server.
Locally on the computer everything works without problems. On the server not.
All my other bots also run without problems.
But the problem is also only with this one button. Other functions of the bot also work without problems. I really do not know what the whole thing should be 😬
It’s not officially documented so we don’t added support for it. (Like with many things)
ctx.voice_client.play(discord.FFmpegPCMAudio(queue[0]), **ffmpeg_options, after=self.qhandler(self, ctx))
``` this code calls qhandler about 5 seconds after the media starts not when it ends
server = await bot.fetch_guild(server_id)
streamer_member = await server.fetch_member(streamer_member_id)
streamer_member.voice
streamer_member.voice is always None, despite the user being in a voice channel.
Thanks in advanced!
Do you have intents?
Yes I have members and presence intents enabled in code and on the developer portal
@green hinge you are receiving the same error right
Strange is just that it works for me on the computer in VS without problems and makes problems on the server 🤔
what python and pycord versions on both?
Try to launch the bot on your computer and to launch the command 2 times
My problem was that I programatically changed the list of options from 1 select and I wasn’t checking if the option was already in (but it was a property of my view subclass so I still don’t understand why it was affecting another command since it’s suppose to start another instance of the view)
How can I make a discord.Option mandatory at the time of submitting a slash command?
I already have required=True but it still lets the user submit without filling in all the values
did you specify a default value for the option?
Its like this
remove the =
it should be :
You're supposed to type hint, not set the value
yea
Worked, thanks all
The same versions for both
On my computer everything works without problems
do you use anything like Replit?
What is Replit?
Is this the pip list for the sever? If no can I see that.
Yes is from server
Python 3.10
Have not done any update or anything else
How do I make a massban command?
the same like a normal one?
Models are classes that are received from Discord and are not meant to be created by the user of the library. Attributes key, url. Methods def is_animated, async read, def replace, async save, def ...
Could you provide an example?
You won't always find examples for everything. Sometimes you need to write your own code
I did write my own code it didn't work
If you share that here we can help you find the bug
That is much better for helping you learn rather than us just giving you the code
Then share that code and explain what "didn't work". We can't read your mind.
Anyone know if we can access the Sprout bool for Members? (if it even exists)
What is "the Sprout bool"?
that thing
Oh that's new member
yeah, aka "sprout"
I believe it appears if the member has joined in the last 1 week
You can just check the member's join date and compare to the current date
I want to know if we can access that in code, or if we need to do some mental gymnastics with the joined_at parameter
the latter i see 😛
Mhm. It's a one liner
everything with dates is complicated.
Not if you do it right
Not if you always use timezone aware datetime
And this
mental gymnastics it is! thanks for the answers 🙂
Timezone naive datetimes should be deleted from the universe 
All time should be based on UTC no time zones just know that where you live day is not 6am to 6 pm but like 12am to 12pm or something
alright, good luck then