#Basic Pycord Help (Quick Questions Only)
1 messages Β· Page 45 of 1
Unfortunately thatβs true
Even with 5 people telling them they're wrong, they're too delusional to realize their mindset is incorrect lol
There are many people of that 
Wut I missed here π
Just someone who thought that help = someone writing code for you
you have to send it with an interaction
so slash/buttons
thought so thanks 
Im not sure if it works with a dropdown
k
@bot.event
async def on_message(message):
if message.author.id in silencedids:
message.delete()
duration = timedelta(seconds=5)
await message.author.timeout_for(duration, reason="Member is silenced.")```
this code keeps saying no permissions
even though my bot has admin perms
i even tried giving it an admin perm role
lol
You did not await message.delete
that also throws an error
well
the same error
@bot.event
async def on_message(message):
if message.author.id in silencedids:
duration = timedelta(seconds=5)
await message.author.timeout_for(duration)
await message.delete()```
Are you going to tell us the error, or should we just guess?
throws invalid perms
hold up
then your bot doesn't have permission to delete the message, simple
it has all perms
literally admin perms
uwu + admin
and the error?
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Owner\PycharmProjects\nuttttttt\venv\lib\site-packages\discord\client.py", line 377, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Owner\PycharmProjects\nuttttttt\main.py", line 64, in on_message
await message.author.timeout_for(duration)
File "C:\Users\Owner\PycharmProjects\nuttttttt\venv\lib\site-packages\discord\member.py", line 881, in timeout_for
await self.timeout(
File "C:\Users\Owner\PycharmProjects\nuttttttt\venv\lib\site-packages\discord\member.py", line 854, in timeout
await self.edit(communication_disabled_until=until, reason=reason)
File "C:\Users\Owner\PycharmProjects\nuttttttt\venv\lib\site-packages\discord\member.py", line 828, in edit
data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
File "C:\Users\Owner\PycharmProjects\nuttttttt\venv\lib\site-packages\discord\http.py", line 360, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
Read the error, that's on the timeout
The member should have a role lower than the bot
you can't time someone out who has a higher role than you
shouldnt it ignore the error and delete the message tho?
or do i have to make an entire check for that
no? You don't handle the error anywhere
The library raises an error for you to handle, it wouldn't make sense for it to just ignore it
That is the way to ignore the error
do you know what could be causing this error ?
It does it when I try to add a cog:
You have some wrong option input type in one of your commands in that cog
I have only these 2:
These are the imports :
aiosignal==1.2.0
aiosqlite==0.17.0
async-timeout==4.0.2
attrs==22.1.0
charset-normalizer==2.1.0
frozenlist==1.3.1
idna==3.3
multidict==6.0.2
py-cord==2.3.2
PyMySQL==1.0.2
python-dotenv==0.20.0
pytz==2022.2.1
typing_extensions==4.4.0
yarl==1.8.1
No idea. Wait for someone else
I see thank you ! Should I start a thread ?
ooh when I remove the type hinting it is working 
these lines seems to be breaking the cog
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from bot import Bot # custom class subclassing from discord.ext.commands import Bot
from database.database import Database # custom class
Hi! Which is the correct way to avoid executing certain slash commands depending on the role of the Member who executed it? I was thinking of just adding and IF statement and check for their role but I don't know if there is a better way of doing this (Maybe there is a way to not even show this commads if you are "X" role)
.rtfm has_any_role
.rtfm has_permission
@spare haven
And you can hide the slash cmds from server settings > integration
π
THIS is perfect!!!!!! Thank you so much
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...
Is there a way to pop up a confirmation dialog when executing a slash command? Like (Are you sure you want to do this? You chose parameter1, parameter2)
what is happening? (it is my user as bot)
You took too long to respond
π
Show code of the cmd. Any errors in console? If your command takes too long to respond, defer at the 1st line of callback
check bot account
it is my account
Oh yeah I've heard that happens sometimes
So what I'm guessing is, you don't respond to the cmd before shutting down
no
You can send a message with 2 buttons saying confirm and cancel
idk it happens some time
Here's the confirm example.
@spare haven see this
Hmm
can you change about me/pfp using api
The bot's own about me and pfp? No
kk
Is it possible to determine who invited a bot? I'd like to PM the inviter when the bot joins a guild
view = discord.ui.View()
keep_button = discord.ui.Button(label="Keep", row=0, style=discord.ButtonStyle.green)
delete_button = discord.ui.Button(label="DELETE!", row=0, style=discord.ButtonStyle.red)
view.add_item(keep_button)
view.add_item(delete_button)
async def keep_button_callback():
await discord.interaction.respond.send_message("keep")
async def delete_button_callback():
await discord.interaction.respond.send_message("delete")
How do i link the callback functions to the buttons, so they respond as i press the button?
.rtfm discord.Integration
discord.Intents.integrations
discord.AuditLogAction.integration_create
discord.AuditLogAction.integration_update
discord.AuditLogAction.integration_delete
discord.Guild.integrations
discord.RoleTags.integration_id
discord.Integration
discord.Integration.account
discord.Integration.delete
discord.Integration.enabled
discord.Integration.guild
discord.Integration.id
discord.Integration.name
discord.Integration.type
discord.Integration.user
discord.IntegrationAccount
discord.IntegrationAccount.id
discord.IntegrationAccount.name
discord.IntegrationApplication
discord.IntegrationApplication.description
Use the button decorator
Here's the confirm example.
See that example
So is it possible to run a task manually with a command?
Yeah I was hoping there might be another solution. Granting manage_guild is a bit excessive for this. Thanks for the answer though
I recommend you to use classes https://guide.pycord.dev/interactions/ui-components/buttons#usage-syntax it is much more organized, simpler and you will understand your code better, now maybe you don't need it but when you have 4 buttons per command it will be a completely mess.
Learn all about implementing buttons in your Discord Bot using Pycord.
thx, i allready fixed the Problem, a class really did help
Sounds good.

shouldnt interaction.response.edit_message count as responding the interaction?
Yes, you are responding to the interaction by editing the message.
My view is timing out for some reason
When it in fact responds to the interaction by editing the message
@haughty wedge is that exactly whats in the code?
Like its that string
Or do you have bot.run(BOT_TOKEN)
wdym by run a task?
i figured it out π
π
How do i get infinite channels as an option in a slash command (/cmd #channel1 #channel2...)

a slash command that accepts N channels
You need to take it as a string input and parse it on your own. Discord currently does not support multiple channels in one option

Or do some workaround with a whole lot of optional options, but that's the ugly solution
N Channels?
you have to check for it if its and int
Hey all trying to set up Rich Presence for my bot. Anyone know an example I can see/read through or point me in the right direction
Bots cant use rich presences
How can I make a command that will make a channel to which the person who used the command has access, but other participants do not?
.rtfm Activity
discord.Bot.activity
discord.AutoShardedBot.activity
discord.Client.activity
discord.AutoShardedClient.activity
discord.Activity
discord.Activity.application_id
discord.Activity.assets
discord.Activity.buttons
discord.Activity.created_at
discord.Activity.details
discord.Activity.emoji
discord.Activity.end
discord.Activity.flags
discord.Activity.large_image_text
discord.Activity.large_image_url
discord.Activity.name
discord.Activity.party
discord.Activity.session_id
discord.Activity.small_image_text
discord.Activity.small_image_url
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 guild.create_text_channel
.rtfm discord.Permissions
discord.abc.GuildChannel.permissions_for
discord.abc.GuildChannel.permissions_synced
discord.TeamMember.permissions
discord.Permissions
discord.Permissions.DEFAULT_VALUE
discord.Permissions.VALID_FLAGS
discord.Permissions.add_reactions
discord.Permissions.administrator
discord.Permissions.advanced
discord.Permissions.all
discord.Permissions.all_channel
discord.Permissions.attach_files
discord.Permissions.ban_members
discord.Permissions.change_nickname
discord.Permissions.connect
discord.Permissions.create_instant_invite
discord.Permissions.create_private_threads
discord.Permissions.create_public_threads
discord.Permissions.deafen_members
discord.Permissions.embed_links
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...
from discord.ext.commands import slash_command
from discord.ext import commands
from discord.ext.commands import Cog
import datetime
class pollModal(discord.ui.Modal):
def __init__(self,bot,*args, **kwargs) -> None:
self.bot = bot
super().__init__(*args, **kwargs)
self.add_item(discord.ui.InputText(label="What are you asking?", style=discord.InputTextStyle.long))
async def callback(self,ctx, interaction: discord.Interaction):
m = await interaction.response.send_message("Poll sent!", ephemeral=True)
poll = discord.Embed(title=f"New Poll",color=discord.Color.blue())
poll.add_field(name="yes", value=self.children[0].value)
poll.timestamp = datetime.datetime.now()
poll.set_footer(text=f"Message id: {m.id} ")
embed = await ctx.send(embed=poll)
await embed.add_reaction('β')
await embed.add_reaction('β')
class pollCog(discord.Cog):
def __init__(self,bot):
self.bot = bot
@slash_command(name="poll", description="Creates a poll")
async def modal_slash(self,ctx: discord.ApplicationContext):
await ctx.send_modal(pollModal(self.bot, title="Poll"))
def setup(bot):
bot.add_cog(pollCog(bot))```
Ignoring exception in modal <Poll.create.pollModal object at 0x7f023f9f0a30>:
Traceback (most recent call last):
File "/home/jack/.local/lib/python3.10/site-packages/discord/ui/modal.py", line 341, in dispatch
await value.callback(interaction)
TypeError: pollModal.callback() missing 1 required positional argument: 'interaction'
No response after clicking sumbit in modal
Why the hell is ctx there
To respond
Oh i see now then]
embed = await interaction.response.send_message(embeds=poll)
await embed.add_reaction('β')
await embed.add_reaction('β')
same error
its not a message, its an interaction...
so send_interaction?

Can't. The only good way to do it other than string parsing is channel select menu
Thats why i have interaction, plus im following the guide
I'm getting certain users getting "interaction failed" when trying to use a button that seemingly works for everyone else, but there's no error being thrown on my side. I have no idea where to start with troubleshooting this, do you think it's possible they just have high latency or packet loss or something?
It's a "cancel the game" button that only works for a short period of time then is automatically removed, so I'm wondering if it's just them being slow to update on their end
Pretty sure you get that error after the bot hasnt been able to respond for 3 seconds, not sure if thatll help
hmm.. yeah I guess it could be something like that, but this code is pretty fast and not the kind of thing that ought to be deferred or given some kind of special treatment as far as the response goes
not sure what to tell this guy lmao, can't figure out what's going on here
Is it defently happening for more than 1 person?
or a lot of people?
this is literally the only guy I can confirm it happening with
everyone else plays this game happily all day
that's why I'm so confused
Probably connection issues, happens from time to time with me with any bot (and anyone it can happen to)
if its fine with everyone else, leave it and tell them to try again later
yeah.. maybe that's just what it is
"sorry kid it ate your money try again later :D" oh well
Lol
this is the entire callback, not really sure how it could be failing to respond in time, the first line is literally deferring the response
and where is the message?
elsewhere in the game logic, once that task is cancelled the game_end condition does some tallying and responds within a fraction of a second
but it's literally this interaction which is being said to fail
not .. y'know, the followup stuff
I just don't know how that happens, not like the box is even under heavy load
like doesn't that imply the code pycord runs to handle the callback between their click and this code saying "OK, defer the response" isn't happening fast enough to hit the .response window, that 3 seconds or whatever it is
I kinda doubt pycord is the issue here, given that every other button works great and only this single user has this issue
just not even sure where to start troubleshooting this lol
Hey! How do I get my bot to say *bot name* is thinking ...?
There anyway to only have the slash commands appear and work in a certain channel?
Slash cmds perms in server settings
Ah so base discord, is there anyway to automate this (if the bot was to be spread across many servers or no)
you can handle permissions on bot's end, but commands will still appear in / menu
Ah so create a json or variable to hold the channel ID then if it isnt in the appropriate channel send a response for example?
i believe permissions handler from .ext.commands also works with slash commands
you can set it up to work on per-channel basis
is anyone aware of why this doesnβt seem to work?
or use cooldowns from same .ext.commands module, they also work with channels iirc
try updating
Hey one more thing I am getting these errors when I am starting my bot:
File "", line 352, in _run_event
await coro(*args, **kwargs)
File "", line 793, in on_connect
await self.register_commands()
File "", line 460, in register_commands
await self.http.bulk_upsert_command_permissions(
File "", line 338, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed
Can someone tell me why these are happening?
how should we tell it you?
Text preferably
?tag 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.
Ah so, the errors appear to be coming from my installed package of pycord and appear when my bot runs. It doesn't crash my bot etc and it functions fine, however when I make my bot and libraries exes, my exe fails to launch. Presuming these errors are why
.tag application.commands
Tag not found.
?tag application.commands
No tag application.commands found.
?tag missing_access
If you get a Missing Access (50001) error, you probably forgot to add the applications.commands scope.
To fix that, just replace YOUR_BOT_ID with your bot id and visit this link: https://discord.com/oauth2/authorize?client_id=YOUR_BOT_ID&scope=applications.commands
Can you disable a button from the callback given button: discord.ui.Button as a callback parameter?
without.. y'know, having to fetch the response, do .edit(view=None) or whatever
there is also default permissions, but im not sure how that works
this error is from like 5 versions ago
update pycord
.rtfm default_permissions
Ta
Ta?
ta.

.slashcommandmention
</full name:ID>
this doesnt work for me
it just prints the command name in plaintext
does the command need to be global or smth?
</github:990412794551750682>
/github
thats what i get when doing </github:990412794551750682>
ik the bot isnt in this server but it happens in servers where the bot is too
what are you getting?
just plain text /github
update discord
oh

but it worked for other bots...
Β―_(γ)_/Β―
It's showing fine for me
Though I am on Android alpha
App: 160.1 (160201) canaryRelease; Manifest: N/A; Build Override: N/A; Device: barbet (Pixel 5a) OS 33;
whats the command that says "use /close to close the post"
shouldn't change anything though, that rolled out a long time ago
I have no idea
.close
Done with your help thread?
Please close your own help thread by using </close:1009144375709814897> with @errant crane.
weird
also i restarted discord and it didnt update anything lol
yeah it works perfectly on my phone
update: now on canary and it still doesnt work π€£
Canary 165559 (ee56d1a) Host 1.0.55 (28098) Windows 10 64-Bit (10.0.22621)

2022-10-31 23:18:10.764000+00:00 somone know how i can convert this into datetime formatter quickly.
How can I check if the bot has permissions to ping a given role in a given channel?
datetime has a fromisoformat method
datetime my beloved
>>> import datetime
>>> datetime.datetime.fromisoformat("2022-10-31 23:18:10.764000+00:00")
datetime.datetime(2022, 10, 31, 23, 18, 10, 764000, tzinfo=datetime.timezone.utc)
I was curious if there was some way to shard a bot without taking it offline since i really don't like putting it offline, and if there's no way what's the downsides to sharding before 1000 guilds? (besides just wasted resources)
Please ping when replying
if there was some way to shard a bot without taking it offline since i really don't like putting it offline,
You can run another instance of it being sharded and after that is online, you can take the non-sharded offline.
Oh true i didn't think of that
Updated still having the error
gnoring exception in on_connect
Traceback (most recent call last):
File "C:\Users\my_dir\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 352, in _run_event
await coro(*args, **kwargs)
File "C:\Users\my_dir\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\bot.py", line 793, in on_connect
await self.register_commands()
File "C:\Users\my_dir\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\bot.py", line 460, in register_commands
await self.http.bulk_upsert_command_permissions(
File "C:\Users\my_dir\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\http.py", line 338, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed
This is what my executable is saying
@knotty surge show pip list
how can i edit the message? I thought that was the command
content=""
thanks <3
I thought it was the same as interaction.response.edit_message
It already works <3
i love u
It is
I'm a little confused, this concept of guild.premium_tier is not the new new "Server Subscription" thing where you can buy four tiers, right? It's just Nitro?
they are the same
I guess it's confusing because it also mentions a premium "slider" which sounds a lot like the nitro bar, not the VIP subscriptions thing
eer progress bar
what would you say is the best way to run some code when someone buys tier 0, tier 1, etc of the VIP Subscription?
I don't see an event handler for it
Hey guys. I have an issue with my code and I hope you can help. When I run my slash command sometimes it does not work. Meaning, The application did not respond. It feels kinda unpredictable. What should I do about this? Why is this happening? Here is my error:
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/bot.py", line 992, in invoke_application_command
await ctx.command.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 358, in invoke
await injected(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction```
You're taking too long to respond aka taking too long to process the command
I'd do interaction.response.defer() so discord is satisfied then respond at your leisure
await interaction.response.defer()
... your long-running code here
await interaction.followup.send("Something")
If anyone's got an answer for this give me a poke, not sure where to start with it. Want to run some code that does stuff outside discord once the guild notices someone premium subscribed, depending on what tier they got
Do i need to import something for interaction?
await ctx.defer() might be more applicable if you're asking that
π³
I'm pretty new to discord bot stuff but most slash commands I've seen use either ctx or interaction to let you do stuff, both of those can be deferred
So i added await ctx.defer and I dont see my bot saying *bot name* is thinking... and i still sometimes get the error.
Show your code
or use ciso8601. but i would highly recommend the datetime.fromisoformat() method instead
Well first of all, you're deferring after you make the request, which does nothing
And don't use the requests library
?tag requests
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
Can I easily replace my code with aiohttp? I used it in a older bot.
Up to you π€·ββοΈ
It looks like I am doing it before. This is from the code I just sent.
await ctx.defer()
await ctx.respond(response["choices"][0]["text"])```
That is not where you make the request, read your own code
Like you were told, you need to defer before any code that can take more than 3 seconds
Now you're just deferring right before you respond to the command, which makes no sense
I thought you defer before a you respond. :/
Hey, I'm sorry but I don't appreciate being spoken to in a condescending or dismissive way. It's not helpful or respectful, and I expect to be treated with kindness and patience as I'm still learning.
I'm just stating the fact that someone told you how to solve your issue but you either didn't read it, or didn't understand it.
And if you're still at the learning stage of basic Python, a Discord bot is not a project fit for you yet
If you find that disrespectful, then I can't help you any further
We were all at some point a learner, but you shouldn't take on something like a discord bot when your just a basic learner, start out with small things and go for more and more ambitious projects and before you know it, your an expert, don't learn python through discord bots, i learned that the hard way.
Also, please read what people tell you, its kinda just common sense but yeah
its a string
does it print the statement you added?
any errors?
is the bot running?
send pip list
searching from this channel's previous messages, i diagnosed that- i deleted all discord related packages and re installed py-cord
then after that now i think i diagnosed the exact cause, i used commands.Bot
If I don't have my on_interaction event it works properly
Any idea how that can be fixed?
I use message commands as well
oh yeah the commands are processed on that event
why are you having that event?
I need that event
Is there a way i can do smth like await bot.process_commands in that event
thank you so much 
you must be one of the only few guys who do any self help
Similar to what we do traditionally in on_message event
yes there is bot.process_application_commands but i suggest you use an event listener instead
replace @bot.event with @bot.listen() if you have it in your main file if you want to use a listener. that way you wont need to add process_application_commands
no worries
Oh
yeah
or you know there is an on_application_command event too if you want to listen to app cmds only. that way you wont need the on_interaction event
That fixed it, tysm!
π π
How do I do that?
that is basic python
- 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
Hey mate thank you that sorted it. I thought I updated py cord last night. Still quite new to this level of python so trying to get used to it, so thanks so far
people still using beta 1 π
How can I send a message in text chat, in voice channel?
.rtfm voicechannel.send
just like you do in a normal text channel
oh, thanks
Here's the slash options example.
^
Finding this on my console when I run my exe, googled it and not sure why its happening, anyone ran into this before?
_distutils_hack\__init__.py:33: UserWarning: Setuptools is replacing distutils.
What libraries do you use?
I did a google search it says to update setuptools, did that and it is still appearing. Its not causing any issues with my bot though
Can you show the full error?
I think it's something related to python 3.11 preferring pyproject.toml over setup.py
But im not sure about those facts
So update python?
I'll update python and see if that is why
I am on Python 3.11.0
Maybe one of your library does
Should I install distutils?
I'm shooting in the dark here, so i don't know
Try π€·ββοΈ
How can I get author of message in myview (button) without ctx?
interaction.message.author
Is it possible to put all members in a drop down menu??
Target not found, try again and make sure to check your spelling.
.rtfm ComponentType
discord.ComponentType
discord.ComponentType.action_row
discord.ComponentType.button
discord.ComponentType.select
discord.ComponentType.string_select
discord.ComponentType.input_text
discord.ComponentType.user_select
discord.ComponentType.role_select
discord.ComponentType.mentionable_select
discord.ComponentType.channel_select
Provide it in the select_type kwarg of the select's init
Ye thats a problem do bot.run(BOT_TOKEN) since you stored your token into that variable at the beginning of your code
.rtfm user_select
@gilded niche you can also use the 2nd one here. That's easier
still does not work
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 801, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 744, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Admin\Downloads\premix\main.py", line 811, in <module>
bot.run(BOT_TOKEN)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 828, in run
asyncio.run(runner())
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 817, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 745, in start
await self.login(token)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 580, in login
data = await self.http.static_login(token)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 805, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
Print the content of token 1 line before the bot.run() line
To see what is the error and debug it
Read your own code? 
Hi, i have a Select Menu class in a file and i imported it in a cog file and used it in a command, the thing is, i want to put emojis to the options in the class, how can i put an emoji object (client.get_emoji(id) ) in a file that is not a cog or the main file?
If you have the id and the name then you can hardcode it
to gets dm message way i know is listen for messages and check if server is None
is there any other way?
Ok calm down. Are there any cmds to which you have passed a name in the decorator? Have you checked those
Also send pip list
i do, wdym by hardcode it?
Uh yeah the most used and logical way would be to check if message.guild is None
Other than that, there are weird ways like checking if message.author isinstance of discord.User . And this doesn't guarantee it to be a dm too
i guess there is some more above or below
ok, thanks
I don't think so. That looks like the whole error to me
Do bot.command and bot.slash_command do the same thing? Because I see them being user interchangeably.
Depends on the bot class you are using
If you are using commands.Bot then bot.command is a prefix cmd
If you are using discord.Bot then it is a Slash cmd
bot.slash_command is a Slash cmd in both (ofc)
.rtfm SelectOption
Pass the emoji string into the emoji parameter. Or you can create and pass a PartialEmoji too
Yeah i understood, thanks
why i cant import functions from the main file?
it gives me an error
That would mostly result in a circular import error
You should rather subclass bot and add the functions you need to your bot class
See this for subclassing
https://guide.pycord.dev/popular-topics/subclassing-bots
Subclassing is a popular way of creating Discord Bots. Explore how you can create a Discord bot by subclassing.
okay thanks again, i'll take a look
Define your function like a normal function inside the class. Just add the self parameter to the beginning.
Wherever you need to call it, do bot.your_function()
I am using discord.Bot. So if I where to switch from bot.slash_command to bot.command will it still be a slash command?
Yes
Thank you.
i have this in my main file:
def getEmoji(team):
guild = client.get_guild(852638659327950859)
for emoji in guild.emojis:
if emoji.name == team:
name = emoji.name.replace(' ', '')
return f'<:{name}:{emoji.id}>'```
i wanna use it in another file, non cog file
should i put it in class?
Uh
Well
client.get_guild will only return the guild after the bot has connected. Else it will return None
You will mostly be calling the non cog file before your bot has connected
Wdym interfere?
prefix is on_message, and you can use bot.process_commands
what
prefixed commands are processed in on message
Unless I misunderstood the question
Hello I'm getting this error while trying to turn on my bot: TypeError: Client.start() got an unexpected keyword argument 'bot'
sad
RIP account
You'll see :)
I'm really surprised.
I see you online @hollow brook
This fool was trying to self-bot π
People still use selfbots?
Go on
Apparently π
And this big brained fella decided to ask about it in a partnered server
what is happening here lul
I'm using a selfbot and they're raging or idk
No, you got it wrong. We're making fun of you
^ tbh

Sad.
Yeah π
You got me here π
WHY TF DID I ASK A PARTENERED DISCORD SERVER
FOR SMTH AGAINST DISCORD ToS
Because someone smart (dumb) enough to self-bot would do something like that
trying to make account checker
didn't ask
for something I want to do
u just edited ur msg
and said "why"
Fr people here are weird
Uh-huh, whatever you say buddy
@west vault congratulations, you have been pinged
since every other mod is asleep
π
Imma make it easy for ya
Imma just leave lmao
but I don't get why are you so mean ! And want me to get banned or "punished" for this even if I didn't bother you.
Cya
you don't need process commands in a listener
hi guys im trying to prevent a command to be running in an event. but i dont know how to do that. i tried return but it still executes the command
can you show the command and the event
import json
import discord
intents = discord.Intents.default()
intents.members = True
bot = discord.Bot(intents=intents)
config = json.load(open("config.json", "r"))
@bot.event
async def on_application_command(context:discord.ApplicationContext):
print(context.guild)
if context.guild_id != None:
await context.send("You can only use this command inside a DM!")
return
@bot.slash_command(name="hi")
async def global_command(
ctx: discord.ApplicationContext, num: int):
await ctx.respond(f"This is a global command, {num}!")
bot.run(config["token"])```
You can rather use checks
example?
Brb let me pull up docs
You can use a custom check
https://docs.pycord.dev/en/stable/ext/commands/api.html#checks
Or i suggest using a built in check as that's much easier
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 guild_only
1st one
And FYI, that event doesn't override command procession so that's why it still executes lol
Oh yeah
Not necessarily, on_message can stop any prefix commands from running without bot.process_commands.
What does that even have to do with on_application_command
I'm saying that event isn't the one that handles the slash command procession
i slept as well
can i use on_message with the example i sent? i dont want to use checks
yes
why do you even need to do it like that lol. that sounds overcomplicated
nvm checks are suitable for my usage
checks sound like the only correct way in that case tbh
everything else would be manual fuckery with core functions
Is there any difference between @bot.event and @bot.listen()?
If so, what are they?
event is called when a certain event is called, but could overwrite internal bot events (examples of this include syncing commands) listen is called when a certain event is called, but does not override internal bot events.
ohhh ok I'll use bot.listen() then π
I never knew the difference, so you can use @bot.listen() for on_message and not have to add await bot.process_commands(message) each time?
yes
listen is also what cog.listener uses
you can defer any interaction
how can i defer a select menu?
await interaction.response,defer()
I really like the ,
it was intentional

just anti-spoonfeed things

How can i get the users message
which one?
After the bot sent a command
/command
Reply with the msg
User: msgg
U replied with msg
slash commands are broken again why....
you mean something like this?
Yes
how do i check a modal if its sent by the user who sent it
if its sent by the user who sent it
wdym
.rtfm interaction.user
you mean this?
Hey! How can i add "Try my commands" to my Bot?
I have a serious question. Can I still use PycordV2?
You don't have to do anything! As long as your app is verified and has at least one global slash command, a max of 5 will be displayed in your bot profile automatically.
ping me then pls
How do I disconnect a user from a voice channel? Ping me
nvm figured it out
Wdym? π€
i dont want to use v3
It's currently in alpha as it's mentioned in #server-announcements so you can use still use v2
You will always be able to use any version
It's just maybe discord will update their API and some stuff won't work anymore
How can I timeout an author of message without commands? (on_message)
Idk about what Dev's of pycord have in mind 
Deleting older versions?
Even if they do idt it would be hard to migrate to v3 after it becomes stable 
True, it has some big breaking changes
message.author.timeout()
how to ctx.respond with mention but not ping the user?
how can i do mention command?
Wdym ?
when the bot is mentioned it replies something
how do i add cooldown
code please?
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/cooldown.py at master Β· Pycord-Development/pycord
okay
Add a listener for on message event. Then check if the bot's mention is in the message.content
With mention but not ping the user? Wdym by that?
Whom do you want to mention and whom do you not
like sending a mention without pinging
like @static juniper but not ping the user
Ah use AllowedMentions
.rtfm AllowedMention
Pass that to respond
like this?
await ctx.respond("@slate acorn", allowed_mentions=discord.AllowedMentions.none())
Yep
I got ratelimited error for doing defer() + 1 followup
I thought interactions didn't have ratelimits. Why is this happening?
This is a giveaway bot with many gaws
How can I get a name of user, that use interaction? (for example, send text in modal)
interaction.user
could be your host
If I remember correctly, followups count towards rate limits.
just delay the response till you're not rate limited? or try again after for shared limits?
I asked in discord devs server and they suggested me to do this. How can I do that
Yeah. Unlike interaction responses
But i can't directly respond with deferring because i have external api calls and it does sometimes take over 3 seconds
https://discord.com/channels/613425648685547541/1056631997407182890
Some extra details in there
what apis are you calling?
Amaribot. It's cached for 2 mins, but it takes a while especially if the server is over 4-5k members
ah
Yeah
async with aiohttp.ClientSession() as session: Would i need to change the aiohttp.ClientSession() if im using bot intents? by changing it i mean changing it to aiohttp.BotSession()
No lmao. That's a separate library
Okay thank you
ClientSession is not related to discord.Client or anything
Just wanted to make 100% sure before i complete the code.
Haha π
It's a dm
If message.guild is None then it means the message is a dm
Check that before doing the stuff
Oh, thanks
Sorry for pong but any idea?
Nope. Pong received

Ping 2. Any idea who could help?
||Waiting for ping ack||
List of people I know:
{}
π
{} Is a dict right
dict by default
i dont get the point of a set compared to a tuple
set is usually faster and more efficient. it doesnt have multiple entires of the same object (all items are unique). its actually works like the sets in maths. there is union intersection and all that stuff
set also doesn't have them ordered
Checking if a set contains something is O(1) which is a lot better than a list or tuple. And they're mostly used for the mathematical operations like intersection and all that.
This panel in voice channel. After triggering one button, no more respond (from other accounts)
There are no errors. What happened?
Are you disabling the view?
No
And timeout=none
no
Could you show the code for the view?
500 lines
Show here?
Send a pastebin or something
how about opening a new thread?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
And yeah, probably open a new thread.
OK
how do i get the id from the user who interacted with the button.
i dont want anyone to interact with my button, except the user who created the command.
.rtfm interaction.user
How do i read measage after a command is ran
Please be more specific, what is your use case?
https://github.com/Pycord-Development/pycord/blob/master/examples/wait_for_event.py
Look at this example, it's similar enough to what you're looking for
m.author == ctx.author and m.content.isdigit() how do i make this into like upper case and lowercase
Could make the v3 example more text realted
Huh
It's literally the same event, you just need to change the check to match your own use case
If you're unable to do that then you probably need to learn more Python before making bot
You can't expect there to be examples of everything you want to do, sometimes you need to use your own brain
How can I change the format of the page indicator button of a paginator ?
I have an activity on my bot, but when I call Bot.activity it returns None 
confusion?
yeah
it works perfectly and is also what the docs say...
you can avoid this warning by using discord.Intents(insert_intents_here)
Btw for SelectOption is there a way to call back a certain label
set the value as the label
the docs say that Bot.activity returns the activity that the bot started with. What if I want to know the current activity?
self.value["label"] like that
bot.user.activity
def init(self, bot_: discord.Bot):
i tried this and now can't read messages...
oh also add the default intents in there
which includes the messages intents (receive's on_messages)
How do i set the value as the label
What class is this in?
my IDE is telling me it doesn't exist
ClientUser doesn't have activity
hmm, I thought it did. Why do you need the current activity anyways?
dropdown
When I run messages = await member.history(limit=None, after=datetime.now()-timedelta(weeks=2), oldest_first=True).flatten(), messages is an empty list. What am I doing wrong with this function?
ctx.me.activity?
that works thanks
just simply self.value = self.label
to avoid updating the activity when it already is the activity it's supposed to be
ah ok
i have to add each one individually?
or you can just get the value of all the intents you have currently and plug it in as value.
but yes
.rtfm intents.value
or just use discord.Intents.default() and then add more to that
probably the most readable
How can i get a channel with the name
what do i do here?
what if you run it with no args?
await but yeah
what is self?
i still get an empty list
just checking, are you 100% sure the bot has messages with that member?
also confirming that you are looking for messages in direct messages?
The label
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
oh wait i realized
is it DMs or channel history?
i'm looking for a specific member, so should i put something in the check argument?
hmm history doesn't actually have a check argument so you'd have to filter it after
Anyone know how i could make the call backs better
sorry if this has been answered before/happened before but I haven't had a chance to dive deeper yet but wanted to ask a quick question if there's a simple solution:
I just switched from discord.py to pycord. I noticed there isn't much I have to change since they're similar. My code actually works as-is before going in and adjusting whatever needs to be adjusted,
(actual question -->) however, when using slash commands, the bot DOES respond but there is a slight delay and I get that "The application did not respond" message, anyone know why? Thanks
can you show one of these commands? responding might be handled differently
Some things should be different, for instance when responding to a slash commands you use ctx.respond instead of ctx.send. And yes, show your code please
async def inventory(ctx, member: discord.Member = None):
await open_account(ctx.author)
if member == None:
user = ctx.author
person = user.display_name
personid = user.id
else:
user = member.mention
person = member.display_name
personid = member.id
users = await get_bank_data()
try:
inventory = users[str(personid)]["inventory"]
except:
inventory = []
em = discord.Embed(title = f"{person}'s Inventory",color=baby_blue)
for item in inventory:
name = item["item"]
amount = item["amount"]
em.add_field(name=name,value=f"x{amount}")
await ctx.send(embed=em)```
That might be why - the ctx.send
sorry I tried to find a quick code example, most of them have a lot going on
yeah gotta use ctx.respond
thanks quick solution I'm sure lol
oh lol
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'response'
hahaha nvm I typed response, not respond. It's been a long day
rip
okay weirdly I actually do still get that same error even using ctx.respond hmmm
looking at documentation, it seems fine but guess I have some digging to do. maybe it's not using pycord like it's supposed to. but the results have definitely changed so idk
Make sure you don't have any conflicting libraries installed, and keep in mind that if your command takes more than 3 seconds to execute you need to run a ctx.defer before any long-running code to make sure the interaction doesn't time out.
If you don't see this when using the command, you're still using ctx.send
So I'm actually using a cloud service (Sparked) and it grabs what's needed from my requirements.txt before running so it's not using any additional libraries other than pycord and pillow
it doesn't do anything, just an error to the console
What error?
ctx doesn't have attr respond
is site package from discord.py? lol maybe I need to wipe it all and start over
In that case you probably still have discord.py installed
So yeah, do a wipe and make sure it only installs pycord
I'll see what I can do on the servers files
And it might be worth check which version of pycord it installs too
yep that's it, it does keep the old stuff. thanks.
Hey, feel like it is fairly simple but cant find it anywhere, how would i take an embed I have made through a modal and send it to another channel other than the one it was sent in?
use bot.get_channel (if it's in a callback, bot is interaction.client) then use channel.send
so like this?
bot.get_channel(channel_id)
await channel.send(embeds=[embed])
essentially yeah
alright, thanks will go try that out π
good lord, I'm so done with Sparked right now lol
I'm looking through the history in this server and lots of people come across the module 'discord' has no attribute 'Bot when switching over. (using sparked too it seems) I've gotten rid of anything discord.py and manually moved over the discord folder from the pycord github and yeah idk 
literally changed commands.Bot to discord.Bot just for stackoverflow to be like "change it to commands.Bot"
and then when you do that you have to change slash_command back to command. then finally the code runs ..until you try to use a command and it says context object has no attribute "respond"
yet when it's ctx.send it works, it just gives me an error next to it
I'm going to bed lol
oh okay weird, so change it back to ctx.send and it works. even after removing all discord.py with just py-cord left. except the console gives me an error that the command doesn't exist yet it works in discord just fine. I'm so lost but it works as-is and I will honestly sleep fine for now x.x
Show the pip list
ImportError: cannot import name 'PartialMessageable' from 'discord.channel'```
Can somebody help me?
what are you doing?
code?
i hav solved the prob
send pip list. you may have library conflicts
py -m pip install --upgrade --no-deps --force-reinstall git+https://github.com/Pycord-Development/pycord```
oh ok π
That helped 
But thanks 
if that solved your issue, it would be a good idea to check pip list for any other discord related libraries like dpy. Uninstall them and reinstall pycord. else you could still have issues down the road
π
hey guys
how can I add image to to embed? I've tried
@bot.slash_command()
async def test(ctx: discord.ApplicationContext):
embed = discord.Embed(image={'url': 'https://www.gannett-cdn.com/presto/2021/03/22/NRCD/9d9dd9e4-e84a-402e-ba8f-daa659e6e6c5-PhotoWord_003.JPG'})
await ctx.respond(embed=embed)
but I receive
TypeError: __init__() got an unexpected keyword argument 'image'
help pls
you cant set image like that
use the url attribute instead
.rtfm Embed.set_image
do this
But it works for me tho?
thanks
embed.set_thumbnail(url="your_url_here")
embed.set_image(url="image link")```
how can i ban/kick somebody with buttons?
class MyView1(discord.ui.View): # Create a class called MyView that subclasses discord.ui.View
@discord.ui.button(label="Kick!", style=discord.ButtonStyle.primary, emoji="π")
async def first_button_callback(self, button, interaction):
await guild.kick(member)
await interaction.response.send_message("Du hast {member.mention} gekickt!")
@discord.ui.button(label="Ban", style=discord.ButtonStyle.primary, emoji="π")
async def second_button_callback(self, button, interaction):
await ctx.guild.ban(member)
await interaction.response.send_message("Du hast {member.mention} gebannt!")
@bot.slash_command() # Create a slash command
async def memberverwaltung(ctx, member: discord.Member):
await ctx.respond("This is a button!", view=MyView1())
NameError: name 'guild' is not defined```
@proud mason
Man you shouldn't be pinging people to help you
sorrryyyy
Get the guild from interaction.guild
You also need a member
can you do a example?
Here's the button roles example.
See that
You need to do similar to that
But rather, subclass view and add a self variable to store the member
Here's the confirm example.
can a bot invoke a slash command of some other bot?
nope
I stored current datetime in postgresql and after 2 or 3 day i want to end the giveaway so i have a task loop so how can I check if the database_datetime < current_datetime ??
Any example??
When your bot starts, just read the date from your database and start a task that runs on that date
No i know that I'm asking how to check
Using If else
Check if a task is running?
You can specify a time that a task should run at
https://docs.pycord.dev/en/stable/ext/tasks/index.html#discord.ext.tasks.Loop.time
btw if you want to save yourself from death by stress, store the timestamps in a BIGINT rather than the postgres built in datetime datatype. Especially if you use an orm
Bruh.... Ig you aren't reading the question
Ohh so what's the difference between those timestamp and datetime ?? Because i just migrate timestamp to datetime
What is your question then? If you're just asking how to compare datetimes then you already answered your own question.
get the time from the database and check if database_datetime < now
No, it's in string and we can't use < iirc
Then parse it to a datetime object
from datetime import datetime
datetime_str = '09/19/22 13:55:26'
datetime_object = datetime.strptime(datetime_str, '%m/%d/%y %H:%M:%S')
So datetime.datetime obj can be checked with <&> ??
I appreciate...
No, < or > is an operator like in math 
Yes, they can
And a code example isn't spoonfeeding if that what's that reaction means
storing datetime in sql datetime datatypes has things like timezone come into play. It's good if multiple people access the db from different locations around the world, but they always make stuff buggy. and when you add orms into this, it becomes very very buggy
rather as only you would be accessing the db yourself, store the unix timestamp from datetime.timestamp(), which is a float and then convert save it as a bigint (or double)
then when you retrieve the data, run datetime.fromtimestamp and get the datetime object back
There is also the timestamp_tz datatype for postgres that ignores timezones
oh
What about if i use time.time() currently I'm using this
oh yeah that returns the current timestamp. yeah you can store that
Ohh i used it before.
time.time() will give you the current timestamp in milliseconds. datetime.now gives you a datetime object for the current time.
So what I'm using now it ok for production level i guess ? time.time()
Ik
yeah. time.time() will return current timestamp. store that in the db. you would need datetime.datetime.fromtimestamp when getting the data from the db
or you ca skip the last part and stick with timestamps throughout
but that depends on your code
I just want to check if the old time > current time so i can do it with only timestamp...
That's what I'm doing rn
yeah thats fine
also postgres does have filters that let you compare this while selecting. use that to make stuff easier for you
Ohh I'll look
Setting an embed field to inline=True means the field only takes up as much space as it needs to, instead of the entire width
it defaults to False, which means it will use the entire width, forcing the next field to use the next line
How would I do this?
I don't understand what you're looking for, but if you want everything on separate lines, just leave all fields as false
nevermind
π€·ββοΈ ok
Oh
elif view.value == False:
Somewhy this isnt working
Then view.value isn't False
Error?
No error just isnt calling back
Yoo
.tag 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.
It dosnt provide an error
You're not providing more relevant code
Nor describing what you're expecting and what's actually happening
async def purchase(ctx):
view = payment()
amount = DropdownView(bot)
msg = await ctx.send("Please select the payment", view=view)
await view.wait()
if view.value == True:
await msg.edit_orginal_response("Pick The Amount:", view=amount)
elif view.value == False:
await msg.edit_orginal_response("Pick The Amount:", view=amount)```
#help-rules
Im expecting it to send a message if the view. Is false
I was talking to dark
I know
is there such thing as bot.dispatch_event() in pycord?
I have this very very very simple code:
import discord
bot = discord.Bot()
@bot.command(description="Sends the bot's latency.")
async def ping(ctx):
await ctx.respond(f"Pong! Latency is {bot.latency}")
bot.run("TOKEN")
And I get this error:
AttributeError: module 'discord' has no attribute 'Bot'```
show the pip list
um
pip install git+https://github.com/Pycord-Development/pycord I reinstalled pycord with this command
and now get this error
Traceback (most recent call last):
File "c:\Users\intel\Desktop\NexShop\bot\main.py", line 1, in <module>
import discord
File "C:\Users\intel\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\__init__.py", line 33, in <module>
from .bot import *
File "C:\Users\intel\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 40, in <module>
from .cog import CogMixin
File "C:\Users\intel\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 38, in <module>
from .commands import (
File "C:\Users\intel\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\__init__.py", line 26, in <module>
from .context import *
File "C:\Users\intel\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\context.py", line 68, in <module>
class ApplicationContext(discord.abc.Messageable):
File "C:\Users\intel\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\context.py", line 347, in ApplicationContext
@discord.utils.copy_doc(Interaction.edit_original_response)
AttributeError: type object 'Interaction' has no attribute 'edit_original_response'. Did you mean: 'edit_original_message'?
PS C:\Users\intel\Desktop\NexShop\bot>
?
uninstall it and use py-cord==2.3.2
.
Package Version
------------------------ -------------------
aiohttp 3.8.1
aiosignal 1.2.0
aiosqlite 0.17.0
asttokens 2.2.1
async-timeout 4.0.2
asyncio 3.4.3
attrs 21.4.0
backcall 0.2.0
beautifulsoup4 4.11.1
Brotli 1.0.9
certifi 2022.6.15
cffi 1.15.0
chardet 4.0.0
charset-normalizer 2.0.12
colorama 0.4.6
databases 0.6.0
DateTime 4.5
decorator 5.1.1
discord-disnake 2.1.2
discord.py 2.1.0
discord-py-interactions 3.0.2
discord-py-slash-command 4.2.1
dislevel 2.0.3
disnake 2.5.1
disnake-ext-components 0.3.3
easy-pil 0.1.6
executing 1.2.0
ffmpeg-python 0.2.0
frozenlist 1.3.0
future 0.18.2
greenlet 1.1.2
humanfriendly 10.0
idna 3.3
imageio-ffmpeg 0.4.7
ipython 8.7.0
jedi 0.18.2
matplotlib-inline 0.1.6
multidict 6.0.2
mutagen 1.45.1
mysql-connector-python 8.0.29
nextcord 2.1.0a4055+g6774954
nextcord-ext-ipc 2.2.1
numerize 0.12
numpy 1.24.1
parso 0.8.3
pickleshare 0.7.5
Pillow 8.4.0
pip 22.3.1
prompt-toolkit 3.0.36
pure-eval 0.2.2
py-cord 2.3.2
pycparser 2.21
pycryptodomex 3.14.1
pygame 2.1.2
Pygments 2.13.0
PyNaCl 1.4.0
pyreadline3 3.4.1
python-dotenv 0.20.0
pytz 2022.1
requests 2.28.0
setuptools 58.1.0
six 1.16.0
soupsieve 2.3.2.post1
spotipy 2.19.0
SQLAlchemy 1.4.39
stack-data 0.6.2
traitlets 5.7.1
typing_extensions 4.2.0
urllib3 1.26.9
wcwidth 0.2.5
websockets 3.4
yarl 1.7.2
yt-dlp 2022.5.18
zope.interface 5.4.0
da hell
I promise I uninstalled all discord.pys
hmmmm... is there no event for a member joining/leaving a voice channel? Thought on_guild_channel_update is the right one.. but seems like not xD
disnake and dpy deleted
uninstall py-cord and reinstall it
ok..
deleted those
finally it works...
why do you had all 3 installed?
tried disnake about an year ago, and forgot about it
dislevel is just simple leveling module
Is there a way to check who used a slash command?
yes?
Yea, the context has the author
Is there anything special I need to do if I add my own loop to the bot Client? I get after a while a win10054 error: An existing connection was forcibly closed by the remote host
It doesn't make a new event loop if a loop is not provided?
do you see anything at the examples?
I don't think I can from this virtual situation? I can't even use the terminal outside of what it's doing for the bot.
how do I get that/where is it?
requirements.txt
oh gotcha.
this is what I have currently
it's been a while since I've touched my bots so I'm not even sure if I need all of them or not but haven't touched it other than pycord
The requests library shouldn't be used at all with a Discord bot
I know that isn't true
?tag requests
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
I haven't had any issues for what I used it for and it isn't related to my current issue
I know, I just noticed you had it and pointed it out. requests shouldn't be used in any async environment
and it comes by default with python anyways, so it doesn't need to be installed
thanks for the information. I might have changed something though because I am not even importing requests in my current code anyway
delete /.local/lib/python3.x/site-packages/discord (or rename it in case you want a backup) + related folders that have names like discord.py or py-cord and restart server
discord.py and any other discord folder was deleted. I deleted the existing discord folder and manually created one copying everything over from the py-cord repository because they use a discord folder and I'm assuming I kind of need it because it still wasn't recognizing things.
and installing py-cord I don't think placed one?
wait so what happens on startup now
it starts up. but that's because I put everything back to normal. my issue is I get an error saying the bot didn't respond when it did. then you guys said to change it from ctx.send to ctx.respond but then it says respond doesn't exist and so on. there's obviously some redundant discord.py or something but I can't figure it out
it would only exist in the site-packages/discord folder through .local, it won't be installed anywhere else
I spell out all that happened here and went to bed and gave up lol
yes it's there .local/lib etc
I didn't put it anywhere else
I have aiohttp, async, attr, chardet, dateutil, etc no more discord.py but
I guess I could request IT to like, somehow wipe everything from my cloud server so I can start with a clean plate
I already tried reinstalling the server itself
sorry in this case the error is completely gone except for now there's an error on the console I forgot. command not found but it worked fine π so that was the last thing I mentioned last night before taking a break
but I did have to switch back to commands bot and ctx.send for it to work at all
It looks like you're just using prefix commands and your prefix is /.
That is not how slash commands are made
I know, I can't use slash_command with discord.Bot as it doesn't work at all right now
Well yeah, of course ctx.respond won't work then. That's only for actual slash commands and interactions.
if I change to discord.Bot, use slash_command, and change to ctx.respond - everything breaks
so I'm not sure how to go from here to transition to py-cord because it's not letting me lmao
I'll show the example of what happens now that I've changed all those things.
In that case there's still something conflicting with py-cord, because that should work
could you change the git one to the pip Version?
yeah, I'm frustrated with Sparked right now
what if you just used a different host? It seems pretty wack tbh
because I kinda love it. I tried doing it through google and that was ..tedious and lame
this is really good but not for changing half way through the project I guess
And if you would use Oracle?
I would highly recommend just getting a proper VPS rather than some platform that abstractifies it all
before I change the entire host I guess I should at least attempt them to just reset what I have and try that
could you send the build logs?
see this is my first time dealing with something that requires a server so there's not a lot I know in this realm, I usually made games
well, learning how to deal with a linux server environment is always beneficial imo. But yeah, I get it
yeah that was what the google one was I believe. I don't mind learning these things I just wanted something simpler in this case I literally push a button and it works you know?
at the moment, I think this is a host issue. I think the best way to get this fixed is to contact your host's support
sounds like a skill issue for the host
I just submitted a ticket to the host service, thank you guys for taking the time to help when there was nothing to help anyway lol
no problem!
Hey there, looking for how to get allow a user to add a channel at the end of a slash command and then send a message into that channel.
For example,
User enters:
/poll #General
Bot messages embed that is made in modal into general?
Is there an event when a bot joins it msgs the owner
I have already figured out how to make a embed send into another channel by id just not sure how to get the id from a user entering it into a slash command
.rtfm discord.utils
discord.utils.find
discord.utils.get
discord.utils.get_or_fetch
discord.utils.oauth_url
discord.utils.remove_markdown
discord.utils.escape_markdown
discord.utils.escape_mentions
discord.utils.raw_mentions
discord.utils.raw_channel_mentions
discord.utils.raw_role_mentions
discord.utils.resolve_invite
discord.utils.resolve_template
discord.utils.sleep_until
discord.utils.utcnow
discord.utils.snowflake_time
discord.utils.parse_time
discord.utils.format_dt
discord.utils.time_snowflake
discord.utils.generate_snowflake
discord.utils.basic_autocomplete
.rtfm on_guild_join
What bout the owner bit
.rtfm guild.owner_id
.rtfm default_role
.rtfm has role
discord.ApplicationCommand.has_error_handler
discord.SlashCommand.has_error_handler
discord.SlashCommandGroup.has_error_handler
discord.UserCommand.has_error_handler
discord.MessageCommand.has_error_handler
discord.Cog.has_error_handler
discord.ApplicationFlags.rpc_has_connected
discord.MessageFlags.has_thread
discord.UserFlags.has_unread_urgent_messages
bridge.has_permissions
bridge.BridgeExtCommand.has_error_handler
bridge.BridgeExtGroup.has_error_handler
bridge.BridgeSlashCommand.has_error_handler
bridge.BridgeSlashGroup.has_error_handler
Command.has_error_handler
Group.has_error_handler
Cog.has_error_handler
has_role
has_permissions
has_guild_permissions
#883236900171816970
Is there a way to use break() to make the command stop working
Neither break or return is a function. They are keywords
I have an embed and I have 7 fields. I want to have it so that the first line has one field and the second, third and fourth lines have 2 fields each. I've been messing around with inline but I cant seem to get it. Can anyone help?
||Please ping me if you respond to my question||
Settings a field to inline=True means the next field will appear on the same line (if it has space to do so). There isn't really a way to absolutely guarantee that two fields will be on the same line, since one of them may take up too much space and push the others down one line.
s there such thing as bot.dispatch_event() in pycord?
why doesn't my on_some_event get triggered when bot.dispatch_event("some_event", smthing) is called
dispatch_event is not a thing in pycord
welp
the library (top.py) which im using currently uses that method
aren't there any alternative ways?
You can look around in the docs, never used anything like it
.rtfm dispatch_event
Target not found, try again and make sure to check your spelling.
.rtfm event
discord.Bot.event
discord.AutoShardedBot.event
discord.Client.event
discord.AutoShardedClient.event
discord.Intents.scheduled_events
discord.Permissions.manage_events
discord.PermissionOverwrite.manage_events
discord.AuditLogAction.scheduled_event_create
discord.AuditLogAction.scheduled_event_update
discord.AuditLogAction.scheduled_event_delete
discord.ScheduledEventStatus
discord.ScheduledEventStatus.scheduled
discord.ScheduledEventStatus.active
discord.ScheduledEventStatus.completed
discord.ScheduledEventStatus.canceled
discord.ScheduledEventStatus.cancelled
discord.ScheduledEventLocationType
discord.ScheduledEventLocationType.stage_instance
discord.ScheduledEventLocationType.external
discord.ScheduledEventPrivacyLevel
I'm trying to edit a message fairly quickly, maybe every .4 seconds, and I'm running the code that does so in a tasks.loop. Elsewhere in the bot I can get away with even quicker updates to certain games, but this one seems to get stuck for a second or two at a time and then continue the loop
Might it be something with how tasks.loop runs or is changing out ascii art that fast some kind of rate limit vs message size issue
I guess I'm asking if tasks.loop functions are somehow lower priority and message.edits or sleeps would behave weirdly
Does anyone know if pycord works with ironpython, and what is the minimum version of python needed to run pycord?
What Version is that?


