#Basic Pycord Help (Quick Questions Only)
1 messages · Page 80 of 1
you can use pillow to manipulate images
Kick the user by the user ID
yeah
user: discord.Object = discord.Object(id)
await guild.kick(user)
This might help for the context.
@bot.command()
async def self_kick(ctx):
await ctx.author.send("Why did you even kick yourself from the server?\n Well, here is the link to rejoin\n[SERVER INVITE HIDDEN FOR THIS CODE EXAMPLE]")
await discord.Member.kick(ctx.author.id) # Might work
^
?tag oop
https://www.digitalocean.com/community/tutorials/understanding-class-and-instance-variables-in-python-3
https://docs.python.org/3/tutorial/classes.html
There's a difference between a class and an instance. Think of it like this:
- A class is like a blueprint, or a concept. It defines what something should have, but it's not the same as actually having it.
- An instance is the 'realized' version of the class, it contains everything that the class defines should be on it, but you can actually access and interact with these features.
Let's consider the Cat. We know a Cat has a name and an age, but Cat.age won't work, because Cat isn't an actual cat, it just represents the concept of a cat. It's like asking "What is the age of a cat?" - it doesn't make sense, because we need to have an actual cat.
mimi on the other hand is an instance of a Cat - it has everything a Cat should have. Maybe mimi was constructed, like mimi = Cat("Mimi", age=4), or maybe mimi was retrieved from somewhere else, like house.cats[0], but in any case, it has everything we need, and mimi.age will rightfully give us 4.
There are many situations in Object Oriented Programming where you will need an instance instead of a class to perform an operation properly (in fact, you almost always need an instance instead of a class), and these cases will usually be documented.
You should learn a good amount about Object Oriented Programming before working extensively with Pycord.
discord.Member is the class, not the object
Then what is the single line of code to kick the user by the user ID
ctx.author.id
if you have the member object.
do you know basic object-oriented programming in python?
Yes I do
Let me reread that article
so if discord.Member classes have a method called kick, and you have an object referenced in ctx.author, how do you call it?
discord.Member.kick(ctx.author)
So just discord.Member.kick()?
no
you aren't arbitrarily kicking the class. you are kicking a specific object of that class.
I'm just trying to kick a single user form the server by the user ID
and you are displaying that you do not have the fundamental understandings of python
Never mind
?tag learnpython
To be clear:
When we tell you to learn Python before asking questions here, it is not meant in a derogatory way, we are not calling your dumb or incompetent. We are simply stating the fact that usage of PyCord requires a fair bit of knowledge with using OOP, Async/Await etc. in Python. If you are not comfortable with these concepts, chances are you will not understand the answers given to you in this channel.
We understand that everyone learns at a different pace, and your current knowledge with Python may have been enough so far. When we say "you need to learn Python", it is most likely a sign that we have given you an explanation that you could not understand and there is no way for us continue to help you without spoonfeeding.
I have an on_interaction and I am calling a modal, and once that modal is complete I am wanting to disable the button that triggered the on_interaction
Why do you use on_interaction?
I was thinking it may be easier, but maybe I should just stick with classes then?
slash commands also would trigger it
I have it ignoring slash commands atm
It would be the best to stick to the classes
bot.get message seems to only get messages from cache what method can i do to get any message
channel.fetch_message
Quick question, I need to retrieve members to display their informations in a paginator.
In my callback I have this piece of code:
guild = interaction.guild
# ...
pages = []
for id in results:
member = guild.get_member(id[0])
# Mainly for the dev server, because member of the DB aren't in it (bot is used on 1 server only)
if not member:
member = await bot.get_or_fetch_user(id[0])
if not member: continue # Account deleted ?
pages.append(await member2embed(member))
But for only 27 members it's super slow, i checked with a print and the guild.get_member() returns None so I guess it's slow because of the get_or_fetch_user().
Do you know why would the guild.get_member() return None even in the guild where everyone is (obviously the ids are correct) ?
The only member returned correctly is me
Thanks in advance 😄
how can i make personalized choices for @discord.option()?
like the choices are per-user?
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
ty! can i do this for max_value too? or no?
autocomplete is only for strings and choices
thats ok, thank you!
So are you saying that no member is found in cache?
anyone knows why entry.target is always None when banning a member (when i use the AuditLogEntry from the audit log event)?
haven't used pycord in a while - how do i send a message in a channel without needing to trigger a command (i'm trying to send updates when a file is uploaded to a folder on box.com)
get the channel and send the message
does it need to be within an async function or nah
yes, it has to be in a async func
👍
what's the function for when a bot is listening for user input
like how do i make a bot wait for the user to say smth and do stuff based on what they say
this doesn't seem to send anything
do you also start the func?
uhh in what way
with a task, event or command?
nope
...
that's where i'm stuck at lmao
That is basic python ;3
fr
idk what to trigger the function with in this case
@task.loop(seconds=10)?
wth it pinged some dude called @ta 💀
xd
hmm but that still does nothing
await newFile()
still nothing
it works when i use a slash command to trigger it but then that defeats the purpose of what i'm trying to do
xd
actually now that I think about it
would sending my message to a webhook make more sense?
actually nvm that would also require an async function
how do i use a gif i have on my computer in an embed?
i used the code in the docs but the gif went abode the embed and not in it
file = discord.File("path/to/my/image.png", filename="image.png") embed = discord.Embed() embed.set_image(url="attachment://image.png") await channel.send(file=file, embed=embed)
the same like a image?
i just changed the paths
upload it to catbox, fileditch or smth and use that url maybe
even discord could work
im tryna use images in my files to make adding/removing them rly easy
.gif?
yeye i used .gif
hang on could i just use @bot.command and then use a while loop to keep it alive 
what?
so like
admin has to trigger the command and then it would start posting updates
this sounds stupid 💀
file = discord.File("/Users/jade/Documents/DommyMommy/gifs/Slap.Slapped/gifff.gif", filename="gifff.gif") embed = discord.Embed(color=0xff0000, title="haiii", description="HIIIII") embed.set_image(url="attachment://gifff.gif") await ctx.channel.send(file=file, embed=embed)
thats my actual code
That should work
yea
also- this is gonna be a hard to explain problem but heres another one
so im tryna make the bot use folders on my pc as options for a select menu, but to do this i needed to get the server id, buttt where the options for the select menu are set is in a class but not in a function in that class, so it couldnt access the variable
Oh so it looks in the cache ?
Because on the doc there isn’t too much detail, but I think I’ll juste fetch when the user click the next button so it’ll be seamless
Is there a way I can pass variables into a callback function?
SelectMenu.callback = callback(x=7)
Sum like that
just start the loop before running??
eh fetching each member is a very bad idea. the cache was made specifically to avoid that
yes but idk another way to do it if they aren't in the cache :/
if no members are in the cache then it is a bigger issue
try printing len(guild.members)
ah alr
there is just me and the bot on my test server (there's a total of around 8 members on this one). Do you know how the cache is updated ?
cache is loaded on startup (before on_ready)
thats the default and recommended behaviour. can be turned off
hmmm weird, I'll try on a bigger serveur (around 120 members)
sure
Oh maybe I did that without wanting it, how do you achieve this ?
also, make sure you pass an int to get_member
you can turn it off by disabling member & guild intents. or setting chunk_guilds_at_startup to False
Oh maybe it's the intent, you need the moderate members ?
hmmm not really
?tag 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)
I'll try this thanks
Ooook it works, thanks a lot (I didn't know we had to manage them in the code, I thought the dev portal was enough as I never had any problem)
command choices works with ext.bridge?
?tag tias
tiz
npoe it does not work
discord.ext.commands.errors.BadArgument: Converting to "Option" failed for parameter "value".```
however it'll be work if the option passed as a decorator
commands.BadArgument
ok?
im tryna make a select menu to pick roles, but im using a database to remember what select menu is supposed to do what- how do i make this persistent? can someone just point me in the right direction pls-
It's hard to create persistent views when the view itself is fed dynamically.
I'd create a persistent button that then fetches your database to query the roles and send the select menu.
see the persistent example https://github.com/Pycord-Development/pycord/blob/master/examples/views/persistent.py
try:
await ctx.guild.create_role(
name = role["Name"],
permissions = role["Permissions"],
color = role["Color"],
hoist = role["Hoist"],
mentionable = role["Mentionable"],
icon = None if not r else None if not r.status_code != 200 else r.content,
unicode_emoji = role["UnicodeEmoji"],
reason = f"Restoration \"{backupid}\" initiated by {ctx.author}"
)
except Exception as e:
return await ctx.interaction.edit_original_response(embed=SetEmbed(ctx.guild,
"Restoration Failed",
f"{e}",
discord.Color.red()))```So I'm trying out this code, but whenever I run it, I get the error:```Guild.create_role() got an unexpected keyword argument 'icon'```From the documentation, edit is a valid argument.
Guild.create_role() don't have icon argument
As far as I know, you can't set icon for your role when you are creating a role, only by editing the role
Why you should not use the requests library for your bot
requests is a popular HTTP library for Python. It is however not a good option for Discord bots, since it is not async and blocking.
This essentially means that your bot will not be able to execute any code at all while a request is happening. Since requests usually take a few seconds to complete, this can have a detrimental effect on your bot's performance. E.g if a user executes a command that performs a request taking 5 seconds to complete, no one else will be able to use your bot for those 5 seconds.
Please look at using a HTTP library that has async support, such as aiohttp or httpx
Oh, and also...
I think you can just unpack role: **role
But you need to make your keys lower case
(icon has been added to create_role in the next version)
Oh cool
Does self.bot.users returns only unique users?
discord.errors.HTTPException: 400 Bad Request (error code: 30034): Max number of daily application command creates has been reached (200)
Getting this error on a brand new bot
tried switching bots too
You were rate limited by discord
is the limit by ip?
Idk?
As far as I know, per guild
Alright
So many got the problem and its not only py-cord
Its also at discord.net (C#)
Description Not sure if this is an API error but it's showing as "DiscordAPIError[30034]:" Myself and many other developers are running into with a common issue with existing bots and...
?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
im using glitch
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
WARNING: Skipping discord.py as it is not installed.
WARNING: Skipping discord as it is not installed.
I installed discord.py
can I use pip uninstall discord.py
yeah glitch doesn't have a supported python version, consider using something else
replit
No tag hosting found.
wat
Need to run your bot 24/7? Get a cheap VPS.
https://www.scaleway.com EU https://www.linode.com/ US/EU/Asia
https://www.digitalocean.com US https://www.vultr.com US
https://www.ovh.co.uk EU/Canada https://www.hetzner.com Germany/US
https://www.time4vps.eu Lithuania.
Self-hosting: Kinda free:
Any computer. GCP, AWS have one year free micros.
Good hosting sites (mostly free):
https://railway.app
https://oracle.com
https://render.com
Pycord
#883236900171816970
#883236900171816970 message
I asked bing:
glitch provides a virtual CPU that is shared among all the projects on the same host machine. The CPU utilization is limited to 100% of a single core, which means that if your bot needs more CPU power, it may not get it. glitch also puts your full-stack apps to sleep after 5 minutes of inactivity, which means that your bot may not be online all the time.
replit provides a virtual CPU that is allocated to your repl based on your plan. The free plan gives you 0.2 - 0.5 vCPUs, which means that you can use up to 50% of a single core. The hacker plan gives you 2 vCPUs, which means that you can use up to 200% of a single core. replit also allows you to keep your repls always on with the hacker plan, which means that your bot will be online 24/7.
Yeah no neither of them are good
but for free plan glitch is good ig
oracle cloud free tier is very good if you have a credit card
Not for discord bots
what do you mean
Im just trying to crash my discord bot as if many users use it but no one uses it
I will make a serious one after deciding where to host
Also, never pay for replit/glitch. Just get a VPS. They start at $3 a month
Or a Raspberry Pi
they are vps right?
Not really
no, they are shared hosts
oh
I tried render
but it says 'starting with python3 main.py' and then no response
A Raspberry pi is great for hosting bots
Yeah but they are very rare rn
depends on your location.
May 29 11:31:02 AM ==> Starting service with 'python3 main.py'
May 29 11:31:05 AM Traceback (most recent call last):
May 29 11:31:05 AM File "main.py", line 170, in <module>
May 29 11:31:05 AM bot.run(TOKEN)
May 29 11:31:05 AM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/discord/client.py", line 723, in run
May 29 11:31:05 AM return future.result()
May 29 11:31:05 AM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/discord/client.py", line 702, in runner
May 29 11:31:05 AM await self.start(*args, **kwargs)
May 29 11:31:05 AM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/discord/client.py", line 665, in start
May 29 11:31:05 AM await self.login(*args, bot=bot)
May 29 11:31:05 AM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/discord/client.py", line 511, in login
May 29 11:31:05 AM await self.http.static_login(token.strip(), bot=bot)
May 29 11:31:05 AM AttributeError: 'NoneType' object has no attribute 'strip'
*VPN
That is right
wait it worked
it is cuz I host it on another server
VPN will still be at most 2/3 of your already existing ping
TOKEN is not set in your env file then
Ig so
Im too stupidlmao
I signup on github for render
and then it tell me to create a repo
VPN can't fix your ping 
IP packets already take the shortest route to the destination. VPN will only slow that down
oh
Mhm so upload your code to a repo
Make sure it is a private repo
actually VPN can make it faster only if you're country has a firewall
somehow
The firewall adds 100 ms and VPNs bypass that
it is okay to be leaked even my bot token. cuz it is only in 7 servers and it is a gpt bot that noone uses
yall are vpn nerds
What
no, you should probably reset it
Bad actors could use it for illegal purposes and your own account could get banned
oh
Even IP ban, so you can't make new accounts too
Yeah not a good idea to leak your token
except if I usee multi account container and a vpn
discord doesnt lemme leak it
I accidently made a repo with token public and discord safety jim dm me
All resources for lol will stop working immediately. This action cannot be undone.
Are you sure you want to delete this Web Service?
Type sudo delete web service lol below to confirm.
Sudo Command
what is sudolmao
You should really have to remove something like that or you can have a lot of trouble with discord
oh
So like store it at a diff file or use an env for something like that
there are many options in render
i do that
stactic site?
web service?it says zero downtime
and where is region
wow
ohio is there
that will be insane
help
it is saying Unlike paid services, free services scale down when inactive. Learn more about free instance type limits. in a web service
we aren't render support
no?
so you are technically render support
@proud mason

WARNING:discord.client:PyNaCl is not installed, voice will NOT be supported
I wonder how you mean that
?
sorry
idk wat happened wrong picutre ig
wow
now it is double
3 replies for 1 message
yaaayayayya
problem has been fixeed. Now I can spam the bot and try to make it crash as it is now render
Wait so do I send basic pycord problems here?
So I watched many tutorials already, looked up on google, tried everything, but with no result
`@bot.command()
async def test(ctx):
buttona = Button(style=discord.ButtonStyle.red, emoji="🇦")
async def button_callback(interaction):
user_mention = interaction.user.mention
await interaction.response.send_message(f"{user_mention} pressed button A")
buttona.callback = button_callback
view = View()
view.add_item(buttona)
buttonb = Button(style=discord.ButtonStyle.green, emoji="🇧")
#--
async def button_callback(interaction):
user_mention = interaction.user.mention
await edit(content=f"{user_mention} got the answer correct. The answer was B", view=False)
buttonb.callback = button_callback
view.add_item(buttonb)
#--
buttonc = Button(style=discord.ButtonStyle.blurple, emoji="🇨")
async def button_callback(interaction):
user_mention = interaction.user.mention
await interaction.response.send_message(f"{user_mention} pressed button C")
buttonc.callback = button_callback
view.add_item(buttonc)
buttond = Button(style=discord.ButtonStyle.gray, emoji="🇩")
async def button_callback(interaction):
user_mention = interaction.user.mention
await interaction.response.send_message(f"{user_mention} pressed button D")
buttond.callback = button_callback
view.add_item(buttond)
await ctx.send("Wait there is a button? ", view=view) `
This is my code for now
Basic message, 4 buttons: A, B, C, D
When pressing a, c or d, it sends a message tagging you, and saying you pressed that button
But I want that when button B is pressed, the message edits
button B is marked inbetween #-- #--
I've tried await interaction.response.edit_message, just like in the tutorial
Sadly this did not work, and pressing the button would only give me errors 😦
All other buttons work though
"Did not work" how it didn't work? What was the error?
When I press the button
And you should subclass views instead of doing that.
It says Interaction failed
The error in the console
Uhh well I'm new to this 😂
I changed the code a bit: ```Traceback (most recent call last):
File "/home/runner/MoonBotREAL/venv/lib/python3.10/site-packages/discord/ui/view.py", line 427, in _scheduled_task
await item.callback(interaction)
File "main.py", line 140, in button_callback
await message.edit(content=f"{user_mention} got the answer correct. The answer was B", view=self)
NameError: name 'message' is not defined
It's interaction.response.edit_message
And that error was pretty much self explanatory, you have no message variable defined. That's why you don't copy stuff from examples without knowing what it does.
Wait, I'll send you the full code of that message:
async def test(ctx):
buttona = Button(style=discord.ButtonStyle.red, emoji="🇦")
async def button_callback(interaction):
user_mention = interaction.user.mention
await interaction.response.send_message(f"{user_mention} pressed button A")
buttona.callback = button_callback
view = View()
view.add_item(buttona)
buttonb = Button(style=discord.ButtonStyle.green, emoji="🇧")
#--
async def button_callback(interaction):
user_mention = interaction.user.mention
await interaction.response.edit_message(content=f"{user_mention} got the answer correct. The answer was B", view=self)
buttonb.callback = button_callback
view.add_item(buttonb)
#--
buttonc = Button(style=discord.ButtonStyle.blurple, emoji="🇨")
async def button_callback(interaction):
user_mention = interaction.user.mention
await interaction.response.send_message(f"{user_mention} pressed button C")
buttonc.callback = button_callback
view.add_item(buttonc)
buttond = Button(style=discord.ButtonStyle.gray, emoji="🇩")
async def button_callback(interaction):
user_mention = interaction.user.mention
await interaction.response.send_message(f"{user_mention} pressed button D")
buttond.callback = button_callback
view.add_item(buttond)
await ctx.send("Wait there is a button? ", view=view)
It should be ctx.respond not ctx.send
Send is for sending a normal message not responding to an interaction
this makes the command not working 😦
what is the py-cord version?
you should definitely subclass view
that is a very neat and simple approach
see this
Learn all about implementing buttons in your Discord Bot using Pycord.
@bot.event
async def on_error(event_method, *args, **kwargs):
print("on_error")
@bot.event
async def on_application_command_error(interaction: discord.Interaction, err: Exception) -> None:
print("on_application_command_error")
neither of these are firing when an error is raised from a button click, what do?
views have an on_error callback function thingy
I'm looking for a way to catch all errors in the bot
else I need to make a custom view class and subclass all of them since there are quite a few
ctx: discord.ApplicationContext @arctic jolt
yeah typehints are probably wrong, I copied the code from a nextcord project
but it's still not firing regardless
Well, that one is for slash commands
this is really easy to achieve in other libraries, is there no way of doing it here?
You could use on_interaction but that also would get trigger by slash_commands
Or you use try and except
show pip list
high chance you have dpy still installed
lol no
open the terminal
and type pip list
windows or unix?
ah
do os.system('pip freeze')
dont do it on ready, as that would not run
error is before the bot starts
you can run that line i said at the top of your code
discord.py and older py-cord Version
Also which topggpy is that?
Github or pip one?
Well first uninstall discord.py and py-cord and reinstall only py-cord
topggpy installs dpy from what i remember
You have to use the github one if Im right
you could use os.system for that too 😂
definitely not the best way, but it works
^
you might find startup cmd or smth in the settings tab of the panel. try fiddling with it
is there a way to read and edit embed attributes from a message
embed.attribute = newattr?
I'm getting discord.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook with the following code inside a button:
async def callback(self, interaction):
embed = discord.Embed(
title="testing..."
)
await interaction.edit_original_response(embed=embed)
await interaction.response.send_message("Upvoted.", ephemeral=True, )
Ohhh wait I see the issue... the edit_original_response thing is for the message sent
but how do I get the original message that the button is on?
pycord docs hella slow today or is it a problem on my end?
How can I edit an interaction message/response and then reply to said message? I keep getting the InteractionResponded error
Is there a way to check how much memory each shard is using when using AutoShardedBot? Or even just the pid?
render is broken.
it runs my same bot token 2 times
@proud mason
you recoment render
it is broken as hell
Where?
..
@young bone
also render only provides 0.1v cpu or whatever it is
repl provides 0.5v
and glitch provides 1.0v cpu
Is there a way to get a message without the channel by message id
If it's a slash command:
await ctx.respond("Hi!", ephemeral=True)
Note that you can only respond once. If you want to send another message in the same channel:
await ctx.channel.send("wowiee")```
I recommended vps... Render was the last choice
Try railway.app
ok w8
bro
End of The Line
You've been flagged for violations concerning the Railway ToS. The reason specified is "Multiple accounts".
If you believe this is in error; please reach out to us via email and we'll get you sorted!
This process is automated, new, and in constant evolution. Apologies for any inconvenience.
I didnt have github account when I login first to railway but now I have so I login with that and it banned me
any other? @proud mason
I dont wanna wait until I get unbanned
Ask in their discord server 
Not a py-cord issue
i have a quick question. Is it possible to retrieve a user using their username instead of id directly or do i just have to get all members on a guild and loop over to get a user with matching name? i read the docs but could not find anything that would directly solve this
bro
I saw there is support bout hosting in this server in the website
Hello
Im the new om non nom so give me respect the om nom noj has
oh wait he dont have any
no? where does it say that?
- dont call me using
she
- why tf are you trying to be toxic
bro I was kidding
v3 will be even faster
So.. pycord is currently a fork of discord.py
yeah ik but it is faster than discord.py
but faster and with a clean code
rip me
Well, v3 will be not a fork anymore of discord.py
even kick command take so many code
imagine making a fully working moderation bot
kick command first checks permission then role then error handle
etc etc
wow
how can I instlall it
They are working on it
it works the same as discord.py right?
ohk
eh
when I had discord.py , I import from discord import app_commands
if you want to use it at some point you would have to rewrite the bots
but turns out it didnt actually support app commands
then I wont update 😂
rip carl bot
bye
You mean username + discriminator (like Username#1234 ?)
If yes idk, but if you mean just with the username, even if there was a method that do it, it would have to loop over all the guild members to find the first matching username, so you can implement your own I think
There's a commands.MemberConverter
Tries to parse a user if you provide username or username and discrim
The following section outlines the API of Pycord’s prefixed command extension module. Bots: Bot: Attributes activity, allowed_mentions, application_flags, application_id, cached_messages, case_inse...
.rtfm get_member
one sec
Get_member only takes an ID tho?
@waxen whale who changed perms again 
commands was not defined
⚠ Warned Haruki#8003
ok?
@winter condor
well
@kindred sail can you add Nziie's Utilities#9415 as overwrite with read message perms to #969574202413838426

it was clone
oh 👀
Done
.rtfm user
discord.User
discord.User.accent_color
discord.User.accent_colour
discord.User.avatar
discord.User.banner
discord.User.bot
discord.User.can_send
discord.User.color
discord.User.colour
discord.User.create_dm
discord.User.created_at
discord.User.default_avatar
discord.User.discriminator
discord.User.display_avatar
discord.User.display_name
discord.User.dm_channel
discord.User.fetch_message
discord.User.history
discord.User.id
discord.User.jump_url
luv chu

-mute 920850442425102367 2d Toxic jokes
🔇 Muted Haruki#8003 for 2 days
anything or anyone else?
Yeah. There is this 1 person
A very bad cat i mean
User id - 856780995629154305
Probably due to topggpy
Try installing it with no deps
No dependencies is a flag in pip install
NGL try asking your host. They would help you
Is it possible to get a channel ID a command is sent in? For example if I had /getchannel I would want it to reply with the ID of the channel I did that command in?

We're gonna pretend like I didn't already do that, but forgot to actually setup a response so when I ran the command nothing came up so I thought that wasn't it. I should generally just read, might help.
hi
Hello :)
Im haruki alt. sorry for bypassing mute. this time I have a problem
so I join with alt
Ill leave as soon as problem fix
Traceback (most recent call last):
File "main.py", line 56, in <module>
discord.Option("member", "The member to kick", discord.OptionType.user, required=True),
AttributeError: module 'discord' has no attribute 'OptionType'
@bot.slash_command(name="kick", description="Kick a member from the server", guild_ids=[...], options=[
discord.Option("member", "The member to kick", discord.OptionType.user, required=True),
discord.Option("reason", "The reason for kicking", discord.OptionType.string)
])
@commands.has_permissions(kick_members=True)
this is my serious bot
@grizzled sentinel
It is just discord.User
Not discord.OptionType.user
ok wwait lemme try
Traceback (most recent call last):
File "main.py", line 56, in <module>
discord.Option("member", "The member to kick", discord.user, required=True),
TypeError: Option.init() takes from 1 to 3 positional arguments but 4 were given
@bot.slash_command(name="kick", description="Kick a member from the server", guild_ids=[...], options=[
discord.Option("member", "The member to kick", discord.user, required=True),
discord.Option("reason", "The reason for kicking", discord.string)
])
@commands.has_permissions(kick_members=True)
@grizzled sentinel
pls respond to this I gtg
Your arguments are out of order
they left the server 💀
Is it possible to run a task at every system clock minute?
Should be possible
How would it be done?
ext.tasks should do it
Yes, but how would I set the task to run at every system clock minute?
Pass minutes as 1, and wait until the next exact minute to start
File "C:\Python310\lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
await item.callback(interaction)
File "c:\Users\Sumit\Discord Bot Mystic\Test Bot\main.py", line 24, in select_callback
item = MyButton(self.ctx, f"{select.values[0]}")
File "c:\Users\Sumit\Discord Bot Mystic\Test Bot\main.py", line 46, in __init__
self.label = label
File "C:\Python310\lib\site-packages\discord\ui\button.py", line 194, in label
self._underlying.label = str(value) if value is not None else value
AttributeError: 'MyButton' object has no attribute '_underlying'
What is this error
class MyButton(discord.ui.Button):
def __init__(self, ctx, label):
self.ctx = ctx
self.label = label
super().__init__(style=discord.ButtonStyle.blurple, label=label)
async def callback(self, interaction: Interaction):
if interaction.user == self.ctx.author:
await interaction.response.send_message(f"{self.label} clicked ", ephemeral=True)
This is the button class where i get error
You forgot super init
Don't set label like that
Pass it to the super init
Ok
hello, I am doing translation for my bot and I would like to know if there is a way to access to user locale language. I tried to search in the docs but didn’t able to find anything lol
ok, I just find it, it’s ctx.locale
I think there is an error in the docs because it’s written the locale of the guild but it’s the user's one
Only for Interactions
i swear to ducking god i hate python sometimes
# Error
TypeError: register_config() got an unexpected keyword argument 'default_embed'```
```py
# Code
bot.config_class.register_config(key='ticket_created_embed', default_value=None, config_type='EMBED', add_to_help=True, description="Embed sent in the created ticket channel when a user creates a ticket", notes="Use the embed builder in the `config set` command to customize this embed.", default_embed={'description': 'Hey, {user.mention}! Welcome to your ticket. Support will be here soon to assist you. In the meantime, please explain what you need assistance with.', 'color': 5793266, 'footer': {'text': '{guild.name}', 'icon_url': '{guild.icon}'}, 'author': {'name': 'Created by {user.full_name}', 'icon_url': '{user.avatar}'}, 'fields': [], 'title': 'Ticket #{ticket.number}'})
# Function
# `bot.config_class` is a `Config` class, here is the function that I am using
def register_config(self, key: str, default_value, config_type: str, default_embed: dict=None, description: str=None, notes='', add_to_help: bool=False): # ^^^^^^^^^^^^^^^^^^^
# stuff that doesn't matter, since the error is in the function usage
It's weird because with one bot it works, and another it doesn't.
default_embed?
yeah
It seems normal...
that's so weird
Is it possible to reply to a message from a on_message event?
I believe so
message.reply or something
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 ...
Does this help
Beutiful thanks!
Welcome!
So I store usernames and descriminator in database is there a way I can migrate from that to new usernames like convert username and descriminator to username through oycord lib
If that makes sense
why do you store them to begin with
yo imagin you have account db with every single possible username
panic 
Alright, here we are.
I know how to query whether a message was sent from within a specific channel, but I understand that applying a listener for every message my bot receives (and then filtering via a MySQL lookup) is...impractical.
I want to spawn a listener function for on_message for threads, as determined at runtime.
Such a thing even possible?
That is to say, I'll have a list of threads that I want to be notified of every message sent within them.
I'm open to hacky solutions so long as they're optimized. Perhaps I could start listening with a /slash command, and for as long as that interaction token remains open (15 mins), the bot listens?
Oh, how about something recursive? Maybe a task that listens for a message and calls itself when it hears it.
@dense gorge what exactly the thing that you looking for or what you wanna achieve
I have a list of threads that will be extended and shortened throughout the use of my bot.
I want to listen for any messages sent from within these threads-- I don't want to listen for messages sent anywhere else.
I could just have an on_message() listener and then get the message details to determine if that message was sent from within a thread that I care about listening to.
But if it's triggering for every single message that my bot receives, then it'll be doing an incredible amount of calls for that function that checks whether it's from one of those important threads.
Way too taxing on my database.
look, the idea that is everything begin sent your bot will receive via the gateway, then if you want to get that specific data from the gateway calls you cann add an filters to that event so you can use the event specifically for a custom channel
Yeah, I'm with you.
Hence this.
Not a good solution for this reason.
Since the "filter" function is slow.
What I need is a selective listener.
you can cache the channels ids then use the cached channel to filter the calls
That requires the cache remain in memory, which isn't a guarantee.
I want my bot resistant to resets.
(I expect I'll be restarting it quite a bit while I improve it).
My current solution is to log it into a MySQL database.
no i mean you can set a listener for the database then load the channel data from the db, the listener function will detect if the database has beed edit, if so it will reload the channel data
if the bot in a great amount of guild so making a SQL calls like this will make the bot slow as hell
how do I identify if a slash command is used as a reply to a message? and how do I fetch the details about that message... such as the author of the message or the message content?
It'll be ctx.message.reference.
1 sec.
In the slash command, you're given a ctx: discord.ApplicationContext as an argument.
All you need to do is something like this:

ye..
awaited
so like
@discord.slash_command(name = "", description = "")
async def command(self, ctx: discord.ApplicationContext):
content = ctx.message.reference.content
.tias
:)
name = "example-command",
description = "shows you how to check for whether this command was used as a reply")
async def example(ctx: discord.ApplicationContext):
wasReply = ctx.message.reference
return```
exactly :)
so i am asking david b4 hand if it would mess things up
ooo yea gotcha, thanks
If there was a message that this Slash command is replying to, it'll return that message content into wasReply. Otherwise, it'll be None.
reply = ctx.message.reference.context or just message.reference
Just reference. I believe. Haven't texted.

So, you might be onto something, but I'm not sure that I understand. So you're suggesting a listener function for the database that determines if there's a change-- what, like a 10 second loop that compares the stored database thread IDs with maybe a SHA checksum?
Or I guess, I could just check the db file itself for the last modified time metadata.
this idea came up in my mind so it can be upgraded, also i was using with JSON before i switch to Postgre 
So then if/when it notices a change, loads those new channels and only those new channels into a list variable?
yup this can be and ideal
And then that is my efficient filter to apply to on_message?
so not exactly but my ideas are drowning underwater
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'reference'
i think something is missing
ctx.message gives None
slash commands are not an messages
Well, that blows.
(invoke)
👀
fr
Hm. If the "replied to" attribute (reference) is only visible to messages, and messages are None if it's a slash command, then... hmm...
yea
I'll do my own testing. Hold on.
🤔
👀
bro took the !tias
The what.
Target not found, try again and make sure to check your spelling.
alr
Haha wow.
Okay. So.
Turns out there's no easy way to do what you want to, but uh, there is a way. Reeally gross, though.
😔
- Get the channel that the command was invoked in using ctx.channel.
- Get the message history of that channel (requires the read_message_history permission as well as the proper Intent in your code and the correct scope in your Developer Portal app).
- Scan through those messages until you find the one with a reply to it.
Which, wait. Is there even a way to tell if a message has been replied to, based only on the message that's being replied to?
Or is that information only attached to the message that's actually doing the reply?
Hm.
Let me keep looking.
Nope, impossible. When you have a message pulled up to Reply to, slash commands bypass that. Slash commands can't be used as a reply.
So even if you could get the messages that refer to a message, it wouldn't show the slash command.
However, a bot itself can reply to another message.
Here's an idea:
- Some slash command that looks like
/bot facepalm @you(mentioning someone within a slash command doesn't ping them. It also doesn't even notify them at all if the command is ephemeral). - The bot then responds to your command by finding the latest message sent by
@youand reacts to it with thefacepalmoption.
i am using normal commands @dense gorge its oke
(Nearly done writing it anyhow)
look at this
i replied to their mssage and amari came up with the proile of ctx.message.author of the replied message
Dang. It works.
how about slash commands
I just typed like ten minutes for no reason LOL
So it would look something like...
name = 'reply',
description = 'reply to a user.')
async def replyToUser(
self,
ctx: discord.ApplicationContext,
replyTo: discord.Option(
discord.Member,
name = 'user',
description = 'Who to reply to?',
required = True
)):
responseContent = f'Could not find a message from {replyTo} in the last 10 messages in {ctx.channel.name}!'
channel = ctx.channel
async for message in channel.history(limit = 10, oldest_first = False):
if message.author == replyTo:
ctx.send(text = 'Replied.', reference = message)
responseContent = f'Reponded to {replyTo}!'
continue
ctx.respond(text = responseContent, ephemeral = True)
return```
🦊
i hate those errors tbh 
fire
but i dont want that sir
just this
What it would look like is /bot rank @ThatStupidDuck and you'd get the result you're looking for with slash commands.
?
wait lemme tell you what i am working on
@commands.Command()
async def mock(self, ctx: discord.MessageReference):
test_str = ctx.message.reference.content
res = ""
for idx in range(len(test_str)):
if not idx % 2:
res = res + test_str[idx].upper()
else:
res = res + test_str[idx].lower()
await ctx.respond(res)
see
for example
.mock
and the bot will mock the text
and send
FoR eXaMpLe
Are you going to be replying to messages as soon as the person sends them?
But you said that you wanted to use slash commands to reply?
What??
since i found out slash commands arent messages
i changed my mind
Did you now.
I thought that switching over to message based commands was a compromise.
I see.
I don't want to read the whole chat, but why not use message context menu commands
What's that?
Lol
What's that called?
context menu commands
You can have cmds for users or messages
Mhm
Thanks.
And if you want to get some input too, send a modal to it
How far we've come since !help...
i am not that literate
plus just like david
many people dont know thye exist
so it would be of no use
There are people who don't know slash cmds too...
Guild.create_role() got an unexpected keyword argument 'unicode_emoji'
I'm checking the documentation, and it is a parameter that you can pass
https://docs.pycord.dev/en/master/api/models.html#discord.Guild.create_role
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 ...
om bhai thats why
its for role emojis
Right
i think you can just put none to it
But, I would like to restore unicode_emojis like 💸 for example
Is it there in the docs for the stable version too?
I'm using 2.2.2
Yeah update to 2.4.1
What it's looking for is a string like U+1F600.
(Which is 😀 btw).
I just updated it, I'm still getting the same error
I did pass None as an argument, but I got the same error
Try passing unicode_emoji = 'U+1F600'.
And is ROLE_ICONS in guild.features?
I know that when you pass icon as a parameter in a server that does not have ROLE_ICON in guild.features, it would not actually show until it has been activated, which is what I want and does not throw any errors. Would the icon parameter act the same as unicode_emoji?
Since they both are tied to the same feature, I would assume so, but I've never worked on a bot in a boosted server before.
Looks like Nelo recently added unicode_emoji, but has not made it possible yet to have it act as icon. I might add that as a suggestion
Yeah, updating it to the latest version instead of the stable version worked
How do you add another input for slash command?
Add another Option parameter to the Slash cmd function
thanks
hi
bro I dont wanna look at odocs and wall of texts again. pls help me by saying what change I need to make
It would look something like this:
name = 'example',
description = 'does the thing you want')
async def exampleCommand(
self,
ctx: discord.ApplicationContext,
optionVar: discord.Option(
str, #or int or member or whatever
'User prompt explaining the option?',
required = True)):
ctx.respond(text = f'You just said {optionVar}.')
return
Hey, question.
discord.ui.role_select() == fucked??
thanks
Does anyone know how that works? It's throwing weird errors. I built a helper function that returns a view with a role_select component on it and it's saying this:
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: expected Item not <class 'function'>
I suspect only string_select works.
You didn't call the function?
Nope.
discord.ui.role_select() yields a bizarre 404 error when sending the component, and discord.ui.select(select_type = discord.ComponentType.role_select) yields the weird function error.
Here's the code:
I really fell for it.
I really thought it was a shortcut like it says.
Nope, you gotta specify the old fashioned way with discord.ui.Select(select_type = discord.ComponentType.role_select).
I guess.
But yes, that works now.
how do i make one of the choices a var?
would you just do it like
discord.app_commands.Choice(name={variable name}, value=1)
The choice is, by nature, a variable.
It would look something like this:
name = 'example',
description = 'does the thing you want')
async def exampleCommand(
self,
ctx: discord.ApplicationContext,
optionVar: discord.Option( ##The variable name of the choice here is optionVar
str,
name='detail',
description='How in-depth should it be?',
required=False,
choices=[
'simple',
'complete',
'comprehensive'
],
default='simple'
)):
ctx.respond(text = f'You just said {optionVar}.')
return
It looks like you want an integer, so you'd specify 'int' instead of 'str', and you might omit the 'choices' argument of the option so that they can enter in any integer they want.
Well it is a shortcut, but only for the decorator way 
Oh, I see. So it's me. I'm the weak link.
Aha.
That is good info to know.
and how do i add another one of these
Same deal.
just create new one?
name = 'example',
description = 'does the thing you want')
async def exampleCommand(
self,
ctx: discord.ApplicationContext,
optionVar: discord.Option( #First option here
str,
name='detail',
description='How in-depth should it be?',
required=False,
choices=[
'simple',
'complete',
'comprehensive'
],
default='simple'
),
otherOptionVar: discord.Option( #Second one
str,
name='Other',
description='Mhm',
required=True'
),):
ctx.respond(text = f'You just said {optionVar} and {otherOptionVar}.')
return```
ok
Hold on.
and how can i make it so you can choose more then one option
See my edit.
try pip3 install
no module named pip3
python3 -m pip3
Is it added to path?
I installed py-cord from dev branch
hm
pip install --upgrade pip?
let me try
oh it had pip 9.0.01
Try python3.9 -m pip ...
it's python 3.6
ahh
python3 points to 3.6
But python3.9 points to 3.9
So just use 3.9
This will work
Hmm
so should I uninstall python2 and python 3.16
3.6*
I uninsatlled py2 and py3
and installed pip latest and py 3.9
that should work right?
I would go for 3.11
@young bone I installed python 3.11 and uninstalled everything
but how should I install pip now
bcz if I use apt-get install python3-pip it also installed python 36
3.6
How did you install it?
@gray juniper what if you just do pip install py-cord without the requirement?
I literally linked the docs. All you had to do was click the link and look at the order of arguments. We are not going to spoon feed you. You need to learn how to do some things on your own.
it worked
For cross server leaderboard
I didn't wanna fetch thousands of usernames every time someone used leaderboard command
Well not really. People could choose completely different usernames. How your system works now is kinda bad. What is someone changed there user name now? You should only ever use user ID when trying to store a user.
Is there any way to convert username and descriminator the id
Find user by username?
Yeah you would have to loop through. Also you need to set up error handling for users it can't find. There will certainly be some.
Do I need server members intent for that
Most likely.
is there a way to assign a select menu option an id?
.rtfm get_member_named
@meager mica you could use this
Well there is a way 🤷♂️
.rtfm SelectOption
value is annoying- but oki
and is there a way to make persistent view without subclassing the view?
how to i use .add_item with a subclassed view?
SelectRoleView().add_item(SelectMenu) await ctx.channel.send(view=SelectRoleView()) ServerId = ctx.guild.id embed = discord.Embed( title="**Role Select Menu Created!**", description="**^-^**", color=GetColor(ServerId) ) await ctx.respond(embed=embed, ephemeral=True)
thats the code
and heres the code for the view
class SelectRoleView(View): def __init__(self): super().__init__(timeout=None)
im trying to add the select menu to it ant it gave this error message
"discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message"
the add_item just isnt working
you could use the discord integration thing in server settings to only be able to use it in one channel
could do
if ctx.channel.id != id:
return
np!
Your view is empty, so no content is sent. You need to add UI components to your view first
Oh, I did not see the SelectMenu thing.
Did you fix the issue by yourself?
nu
idk how, i think for some reason add_item isnt working with the subclassed view
wdym?
^^
i think if you set the argument to only accept one argument
Your argument must be *values (will get everything that's after your command) then to make that into one sentence you can do sentence = " ".join(values)
yea was abt to say
np
"\n" but I think this is just fields
Check guide
oh, bruh
Not this spaces
Bruh
lmao
Is there a way to use .add_field with a subclassed view? I'm tryna make it persistent
persistent views and embeds arent related tho
You can add_feild to a view-
Adding a field to a view is kinda related to persistent views
Ye
.rtfm view.add_field
Target not found, try again and make sure to check your spelling.
uh
To add a button orselect menu
oh you mean add_item
Omg- I'm dumb thank you 😭
lol so your issue is solved?
Nono
Im using add_item
But when I try to use it with a subclassed view it doesn't add it
Can't show rn but I'll explain
The view is its own class that all that's in it is the init function, then in the function for the command I do view().add_item(Select Menu)
When I did the same thing when view = View() and no problems
I just wanna do it like this bc using variables from one class in another is so annoying
And itneeds to be persistent but the select menu uses paramaters you set with 5he command
How can I make a persistent View in a cog? When I try, I get the error:
discord.errors.ExtensionFailed: Extension 'cogs.tickets' raised an error: RuntimeError: no running event loop
doesnt really matter if its in a cog or not?
How do I register it as persistent? Not in a cog I could put in on ready client.add_view(view())
But you know basic Python?
You can do the same in cogs
Use an event listener
oh yeh of course my bad
How would you mark an embed/embed image as a spoiler?
I doubt this is possible
It is possible
Make the image of an embed a spoiler?
Yeah
any idea to subclass the discord.SlashCommandGroup object?
why would you sublcass it
want to make a folder for the sub groups childs
and use the common parents between them in each file
@cyan quail there is a way to that 
see #creations message
uhm, sorry for disturbing, iam dumb
`
import discord
from discord.ext import commands
from BaseCommands import *
from discord.commands import Option
from discord.ui import View, Button, Select
from discord.utils import get
import discord.utils
global options
class SelectRoleView(View): # Create a class called MyView that subclasses discord.ui.View
def init(self):
super().init(timeout=None)
MenuOptions = options.split(",")
optionsss = []
for MenuOption in MenuOptions:
RoleId, Label, Description, Emoji = MenuOption.split()
option = discord.SelectOption(
label=Label,
description=Description,
emoji=Emoji,
value=RoleId
)
optionsss.append(option)
if multiple == "false":
MaxValues = 1
else:
MaxValues = len(MenuOptions)
SelectMenu = Select(# the decorator that lets you specify the properties of the select menu
placeholder = placeholder, # the placeholder text that will be displayed if nothing is selected
min_values = 0, # the minimum number of values that must be selected by the users
max_values = MaxValues, # the maximum number of values that can be selected by the users
options = optionsss,
custom_id= "RoleSelectMenu"
)
async def callback(self, interaction):
global SelectMenu
ServerId = interaction.guild.id
RoleIds = []
for x in SelectMenu.options:
RoleIds.append(x.value)
SelectedRoleIds = SelectMenu._selected_values
guild = interaction.guild
member = guild.get_member(interaction.user.id)
for RoleId in RoleIds:
if RoleId in SelectedRoleIds:
RoleIdss = RoleId.split("/")
for RoleIdd in RoleIdss:
role = get(guild.roles, id=int(RoleIdd))
if role not in interaction.user.roles:
await member.add_roles(role)
else:
RoleIdss = RoleId.split("/")
for RoleIdd in RoleIdss:
role = get(guild.roles, id=int(RoleIdd))
if role in interaction.user.roles:
await member.remove_roles(role)
try:
await interaction.response.send_message("")
except:
pass
class add_select_roles(discord.Cog):
def init(self, bot):
self.bot: commands.Bot = bot
@bot.slash_command(description="add a select role menu")
@commands.has_permissions(administrator=True)
async def add_select_roles(self, ctx, placeholder: Option(str, "what will show in the menu when you havent selected anything"),options: Option(str, "'RoleId/RoleId label description emoji' add multiple by seperating them with commas"), multiple: Option(str, "true or false, anything else will set it to true, default: false", required=False, default="false")):
if ctx.channel.type == discord.ChannelType.private:
await ctx.respond(embed=YouCantDoThatInDms_embed)
return
await ctx.channel.send(view=SelectRoleView)
ServerId = ctx.guild.id
embed = discord.Embed(
title="**Role Select Menu Created!**",
description="**^-^**",
color=GetColor(ServerId)
)
await ctx.respond(embed=embed, ephemeral=True)
def setup(bot):
bot.add_cog(add_select_roles(bot))
`
heres my code its not letting working because subclassing View makes it hard to get the commands paramaters, how do i get them?
im trying to make a persistent select menu, that you create with a command, how to i make it work? because the options are determined by paramaters in the command the persistence isnt working
please someone point me in the right direction
When I do that I usually try to store what I need in database
Is their another way probably but I couldn't find it for my use cases lol
lmao exactlyyy, thats my problemmm XD
any chance you could dm me so i could ask you some stuff?
I just worked around it with database
yea im tryna do that but adding a persistent view makes it weird
please be more specific
wut happens when you do it?
error?
try running your command and giving it this
1+1
wuts that mean
oki what is os.environ["BOT_OWNER"]?
try copying your id and put that in the code
i believe ids and int
oki
make surein the env
its an integer and not a string
that works too
You have to
You have to restart the bot
no- i use cogs and i can
Not with slash commands
i use slash commands and cogs work?
I wouldn’t recommend doing that but you could. If you have tasks with discord.ext.tasks you will run into problems.
I’m saying reloading cogs with slash commands causes problems
oh? how so?
Are you going to seriously argue with me?
im genuinely confused, bc ive literally been doing it and its been working fine
Under certain circumstances, it causes problems
plus they dont use slash commands so they so could use cogs-
I wasn’t referring to them, you asked me the question
oki- well idk wut these curcumstances are but ive used cogs for slash cmmands and have tested out reseting them a bunch and have found no problems then you respond like this to me asking a question- like bruh, wasnt arguing, i never heard it could cause problems
Reading challenge lmao
The error tells you exactly what to do
What error does it return
You just added a random loop to your file
It seems like you wanna load all cogs at start-up
But you'd need an on ready event for that
One sec, trying to figure out how the bot commands work
.rtfm on_ready
If you don't know what an event is, you'll have to read the docs
They're pretty intuitive
There's a get started guide somewhere as well as an FAQ
After that you'll just search for an event or whatever and find specific Information on what you wanna archive
Pycord is a modern, easy to use, feature-rich, and async ready API wrapper for Discord. Features: Modern Pythonic API using async/ await syntax, Sane rate limit handling that prevents 429s, Command...
Do you know any templates for discord bots? (with pycord)
Not fully built bots, just templates
Send your code
As I understand it, you have a text command that takes arguments, but when you call the command, you do not pass the argument, and therefore this error appears
For example: !load
You either need to add on_error or make arguments not required
And I also think your on_ready just don't work
Add @bot.event
? Return your async def on_ready():
And just add decorator
.
All about handling errors.
🐈
TypeError: object NoneType can't be used in 'await' expression Your tried to await None
Oh... Sorry
Uhm
Oh, not that
await setup(self)
I'm confused 💀
I think there are some problems in await bot.load_extension(f"cogs.{filename[:-3]}")
- add
@is_ownerinstead ofif ctx.author.id == int(os.environ["BOT_OWNER"])and add owners to yourcommands.Bot - I think your tried to load or unload cog that just don't exist
@coarse spire
hmm
Hey, what should I write in a webhook in order to get this little grey box with the time left in a message?
Thanks
You dont use await at that
@fervent cradle
Dont load the cogs at the on_ready event
If you get the await error you have something else installed and py-cord
Can you show the pip list?
Do you know basic python?
Then it's the same thing lol. Just replace install with list
discord, discord.py, pycord and py-cord
Uninstall all 4
After that install only py-cord
not pycord
He completed the collection lol
No
is there a way i can use @bot.event to run something whenever any select menu is used?
anything like async def on_raw_reaction_add(payload):
but for views..
smth like djs handlers
bc if i could do that then i wouldnt need a database to have a select menu persistent
why you would use a db for the persistent?
bc the way im creating select menus is with a command, that paramaters decude whats in the select manu, so i cant rly just add the view when the bot starts
uha
.rtfm discord.on_interaction
You have to create a view class to have it persistent?
^ this may help :)
on_interaction also triggers slash commands
on the event function he can filter out that
im tryna make a command to add a select menu for roles
so the contence of the select menu depends of the paramaters of the command
the slash command can use discord.Role as a parameter for its arg
this may fix all that pain
ive triied to make it persistent by subclassing view but it no work
that has nun to do with it-
can i dm you to explain it better without slowmode?
