#General Help
1 messages · Page 31 of 1
lul i used to be a discord.py dev but slashcommands in discord.py is like difficult 😔
None of them?
O ok
but i wasnt the one who sent those docs*
In the error ss it doesn't shows
https://docs.pycord.dev/en/master/api.html?highlight=on_member_join#discord.Guild.invites
There is that too. exactly the same
It returns a list of invites
I'm not too familiar with how to get who invited someone
So I don't think I'll be of much help sry
Does the traceback show where the error is occuring?
trying to update my music bot but i get this error discord.ext.commands.errors.CommandNotFound: Command "play" is not found
I suggest you use try except and print the tb with traceback module
So you see exactly where the error is
how do i get a role from an id :0
How can i get the invitecode that the joined person used
My question is a photo. Because the helper deleted it and I didn't wanna retype.
Basically I'm trying to fetch channel/delete it in on_raw_message_delete. Ain't working.
is it normal that the bot responds with "the application doesnt respond" after he did what he did
no
defer it
hmmm
await ctx.defer()
Do you know how to fix my issue?
idk let me see ur issue 1 sec
i used the slash command help...he responded as he should...aber in the chat there's the message from him "the application doesnt respond"
Probs simple
ohh
I'm tryna fetch channel Id in on_raw_message_delete
you are probably using ctx.send
use ctx.respond instead
yes
I looked in the docs it shows channel_id, I tried that but tossed a error saying it's not callable.
try channel.id
I looked in the cached_messages payload but there's no get_channel
And self.get_channel doesn't work
Tried that to
okay, so i'll try it again with respond
Lol tried like 100 diff things
rip
So you can't fetch channel ids on_raw_delete?
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'TextChannel' object has no attribute 'respond'
xDDD
can you show your code
await ctx.channel.respond("!Invite , will give you my Invitelink\n"
"!Vote will send you the Link to Vote for Thor\n"
"!Points shows you how many Points you have\n"
"!Report-user [(user-id or user-name) not the mention!!! \n"
"To report users to the Mod and receive Points "
"which are needed to reduce your Globalwarnings!\n"
"!Reduce to reduce your Globalwarnings\n"
"!My-Warning shows you how many Globalwarnings you have\n"
"Thor (or mention) hit (or other words for attack) [target.mention or "
"name with descriminator]\n"
"for example: @abstract tinsel hit @paper hawk\n"
"!Developer , will mention the Developer, so you can write him or what ever\n"
"!Get-AntiSpambot , will send you a DM with the Invitelink for the Bot\n"
"!Show_me [User-id or Mention] size(Optional) ,will send you the Avatar of that User in the wanted size\n")
What the hell
that the small part xDD
do just ctx.respond
not ctx.channel.respond
Do you know the issue lol?
ooh so the channel isnt needed...okay
for ur problem, no sorry

yes
the build up = agony
the testing part is fun
I'd never want to be a full time dev
full time dev would suck
horrible job in my opinion
sitting inside all day in pain
begging for it to work 😭
not worth
like i heard html developers make like hundreds of thousands a year
lawyer seems like a fitting job for me because i love talking back
Jeez. Meanwhile dude who hired the dev did 0 work and makes triple.

is the bot with respond still able to send files?
cant find the .respond in the docs
it's same as .reply
a pic
file=discord.File(Path + sep + "gifs" + sep + gifs[r])
Yeah sending files works in respond.
alright
I am 90% sure you still have to do .send_file tho
aah yes, the respond helped^^
@commands.Cog.listener()
async def on_presence_update(self, before, after):
if before.activity != after.activity:
print("runned this")
with open("setup.json", "r") as log:
db = json.load(log)
log_channel = bot.get_channel(db['bot']['modules']['log_system']['channel_id'])
if before.activity == None:
embed = discord.Embed(title="New Status",
description=f"{after.name} has created new status!\n`status`: {after.activity}")
embed.set_thumbnail(url=after.avatar.url)
embed.set_footer(text=f"user id: {after.id}")
await log_channel.send(embed=embed)
elif after.activity == None:
embed = discord.Embed(title="Status Update",
description=f"{after.name} has removed their status")
embed.set_thumbnail(url=after.avatar.url)
embed.set_footer(text=f"user id: {after.id}")
await log_channel.send(embed=embed)
else:
embed = discord.Embed(title="Status Update",
description=f"{after.name} has updated their status \nfrom:\n `{before.activity}`\nto:\n{after.activity}")
embed.set_thumbnail(url=after.avatar.url)
embed.set_footer(text=f"user id: {after.id}")
await log_channel.send(embed=embed)```
it is working fine as expected to send message on member status updates
but it is sending duplicate 2 messages with same content
i'm in `2.0.0b7`
So
It is running twice because the status is changing twice
once when the online changes
and a second time when the activity, or game changes
got the point thanks
😄
You are going to have to elaborate.
What do you already have?
Do you already have a button and a role? Or have you yet to start?
how can i check if the user executing a command has a lower or higher perm than the person mentioned
You can check their roles
Do I have to have to have message intents enabled in order to use bridge prefixed commands for any of the previous releases? A lot of people got confused when only slash commands worked and prefixed didnt on 2.0.0rc1
Or is there a version where I can use both without message intent?
does a users roles tell u which one is highest
which one is loweset
How can I make that a /command is only shown to people with admin rights?
ctx.author.top_role.position?
i dont think u can anymore
:/
i remember u could make them show as disabled
or somethin
i think they removed that
@bot.bridge_command()
async def ping(ctx:bridge.BridgeExtContext):
if isinstance(ctx, bridge.BridgeContext):
await ctx.send('Pong!')
if isinstance(ctx,bridge.BridgeApplicationContext):
await ctx.respond('Pong!')
it is the best way to write bridge commands
?
BridgeContext respond method will act on depending whether you invoke it with ApplicationCommand or PrefixCommand
So to reply a command you need not to worry about with what type do user using the command
Is there a way to use prefixed commands without having message intent enabled as atm I cannot enable it so my users can get used to slash commands?
Idk if it works in v2.0.0, but you should be able to tell py-cord to use the v9 API by adding this line to your code
http.API_VERSION = 9
any specific place to put it in?
Just above your bot = commands.Bot or whatever you are using
will try
is it possible to only show members in a voice channel for a slash command option
I tried this autocomplete but it raises Autocomplete cannot be configured for this type of option
async def kick_autocomplete(ctx: AutocompleteContext):
author = ctx.interaction.user
if not author.voice:
return []
id = author.voice.channel.id
if id not in rooms:
return []
members = []
for member in ctx.interaction.guild.members:
if member.voice:
if member.voice.channel.id == id:
members.append(member)
return members
If I were to do that, i would just show the usernames as a string, then it should work
I can't do that because the list of member that are in the voice channel may change
wait
actually no I can do that since I have somewhere to stock the members
thank you for the idea
whats is the name of the package? (pip install NAME)
Pretty sure that Option is just under discord
so from discord import Option
actually (x2) I can't do that since i'm making voice channels that are temporary
Jazper is right, what you need is from discord import Option
The autocomplete should update every time someone uses the command
i know but i would need to take the list of members that are in the same voc as the author
and i tried to access the author VoiceState using ctx.interaction.user.voice but pycord doesn't want that and raises Autocomplete cannot be configured for this type of option
I think you need to get a Member object of the user
nvm it does return both user and member
this is a problem
try installing pycord again maybe? py -m pip install py-cord
i have it
did you try installing it again?
are you using a virtual environment for your bot ?
Don’t ping users
No pycharm
Especially don’t ping devs
Wtf
How do you send a paginator as a button click response.
Interaction.response has only three methods named, send_message, send_view, send_modal.
This is my View Class
class myView(View):
reply_callback:callable = None
def __init__(self, get_paginator:callable):
super().__init__()
self.reply_callback = get_paginator
select_btn = Button(lable="CONFIRM")
select_btn.callback = self.main_callback
async def main_callback(self, interaction):
paginator = self.reply_callback()
# How to send this paginator received.
I can do paginator.send() but that will end the interactoin and it will cause Interaction Failed Error
Got it
its paginator.respond()
It's from discord import Option as i said earlier
Can you type pip show py-cord in your terminal and show the output?
Trying to enable message_content, but when I try intents = discord.Intents.all() or intents = discord.Intents.default() and then intents.message_content = True, my bot just never initializes? No error message, but the print statement in the on_ready function just never runs
Am I missing something?
Did you specify the intents in the bot constructor?
Does someone have a bot with cogs boilerplate?
Is not working
Do pip show py-cord in your terminal
Ignoring exception in on_ready
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/discord/client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "/home/bots/discord/python/Ruby Network/listeners/onReadyListener.py", line 12, in on_ready
await self.bot.change_presence(activity=discord.Game(name="lol"))
AttributeError: 'Bot' object has no attribute 'change_presence'
Which pycord version is installed?
how to pass arguments along to a buttons instance?
can you show the pip list?
?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 !git to find out how to install git.
Updating the module to Alpha (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord
hey I am trying to make a feature which sends a dm to the user who's user id has been send in a channel this is code
@bot.listen()
async def on_message(message):
if message.channel.id !=993199406469881967:
return
with open('image_urls.txt', 'r') as f:
lines = f.readlines()
g = random.choice(lines)
e = discord.Embed(title='Hello, G',
description='**test**', color=0xcf24ff)
e.set_image(url=f'{g}')
e.set_footer(text='')
user = await bot.fetch_user(message.content)
await user.send(embed=e)```
error:
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 0): 404: Not Found
help please
@bot.listen("on_message") I think?
still same error
can you give full traceback?
bcs i dont know what in the code to look for with the just the error "NotFound"
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\sauceyy\venv\lib\site-packages\discord\client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Admin\Desktop\sauceyy\main.py", line 157, in on_message
user = await bot.fetch_user(message.content)
File "C:\Users\Admin\Desktop\sauceyy\venv\lib\site-packages\discord\client.py", line 1570, in fetch_user
data = await self.http.get_user(user_id)
File "C:\Users\Admin\Desktop\sauceyy\venv\lib\site-packages\discord\http.py", line 355, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 0): 404: Not Found
int(message.content)
message.content is a string
i guess the code cannot identify the ID as user id?
so turn it into an integer
new error
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\sauceyy\venv\lib\site-packages\discord\client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Admin\Desktop\sauceyy\main.py", line 157, in on_message
user = await bot.fetch_user(int(message.content))
ValueError: invalid literal for int() with base 10: ''
@bot.event
you need the message content intent most likely
Can I get the guild the member just joined (on_member_join event)
member has a guild attribute
member.guild
thanks
i tried adding a cog:
but the commands dont register
no error nothing
what am i doing wrong
guild id?
985216083537575976, 938444786145325097
i want it to be global
does it work with the guild id?
no:
try
from discord.commands import slash_command
@slash_command()```
this apparently fixes it for some people
is the cog loaded in?
they are the exact same thing xout 💀
dude i tried this with someone else it worked
incorrect
yeah i think
Its @commands.slash_command()
DUDE THATS THE SAME THING
works for me fine
or bot.slash_command() xd
yup
did you override on_connect
what
did you make an on_connect event
no
load in as in
bot.load_extension("")
you just can't see the slash commands right
i suppose?
ok
can i see your whole file without the token
its on github
where
dms
dumb question, but do you have two functions with the same name? I've seen that here before. Naming the function of a slash command the same as another function. ANyway, I'll step back. Don't want to complicate things since you have someone assisting already. Too many cooks spoil the soup. lol
yeah you need to load in your cogs
i see it no where in your repository
i havent comitted the new thing yet ;-;
could you do that so we can review it
is it only the ones in the cog that don't appear?
go back to discord.slash_command and try using commands.Cog
you can remove the load_extension as well
alr
File "c:\Users\MRS\Desktop\DefenderBot\Commands.py", line 872, in <module> class PollCommand(discord.Cog): File "c:\Users\MRS\Desktop\DefenderBot\Commands.py", line 880, in PollCommand async def poll(self, ctx, minutes : int, title, *options): TypeError: 'Cog' object is not callable PS C:\Users\MRS\Desktop\DefenderBot>
i assume i should remove the discord.Cog thing
made a music play command, and it says Command "play" is not found
Could you show code please
full traceback?
no that doesnt work; it causes a bunch more errors
such as?
PS C:\Users\MRS\Desktop\DefenderBot> & C:/Users/MRS/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/Users/MRS/Desktop/DefenderBot/Commands.py Traceback (most recent call last): File "c:\Users\MRS\Desktop\DefenderBot\Commands.py", line 872, in <module> class PollCommand(): File "c:\Users\MRS\Desktop\DefenderBot\Commands.py", line 880, in PollCommand async def poll(self, ctx, minutes : int, title, *options): TypeError: 'Cog' object is not callable PS C:\Users\MRS\Desktop\DefenderBot>
thats the entire thing
well now i'm just confused
whats the updated code that you're using
`class PollCommand():
def init(self, bot):
self.bot = bot
self.numbers = ["1️⃣", "2️⃣", "3️⃣", "4️⃣ ", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]
self._last_member = None
@commands.Cog()
@default_permissions(manage_messages = True)
async def poll(self, ctx, minutes : int, title, *options):
if len(options) == 0:
pollEmbed = discord.Embed(title = title, description = f"There are **{minutes}** minutes remaining!")
await ctx.respond(f"Done! Created a poll with title: {title}!", ephemeral=True)
msg = await ctx.send(embed = pollEmbed)
await msg.add_reaction("👍")
await msg.add_reaction("👎")
else:
pollEmbed = discord.Embed(title = title, description = f"There are **{minutes}** minutes remaining!")
for number, option in enumerate(options):
pollEmbed.add_field(name = f"{self.numbers[number]}", value = f"**{option}**", inline = False)
await ctx.respond(f"Done! Created a poll with title: {title}, and your options!", ephemeral=True)
msg = await ctx.send(embed = pollEmbed)
for x in range(len(pollEmbed.fields)):
await msg.add_reaction(self.numbers[x])
@commands.Cog()
async def hello(self, ctx, *, member: discord.Member = None):
member = member or ctx.author
if self._last_member is None or self._last_member.id != member.id:
await ctx.send(f'Hello {member.name}~')
else:
await ctx.send(f'Hello {member.name}... This feels familiar.')
self._last_member = member
`
i meant commands.Cog for the class
ah
so it would replace discord.Cog
and use discord.slash_command instead of commands.slash_command
make sure you're loading the extension
Just for reference, this is how I load my extensions. I have them all in a subdirectory called "Cogs_cmd"
cogfilescmd = [
f"cogs_cmd.{filename[:-3]}" for filename in os.listdir("./cogs_cmd/") if filename.endswith(".py")
]
for cogfilecmd in cogfilescmd:
try:
client.load_extension(cogfilecmd)
print(f'Loaded {cogfilecmd}')
except Exception as err:
print(err)
extension like cogs?
Figured I'd share how I have it, and you can modify as needed
extensions are files with a setup function, cogs are classes that inherit from .Cog
most people think they are the same though. lol. Many inaccurately call extensions "cogs"
I know I did at first. lol
THANK YOU SO MUCH
should only be used with a discord.Bot anyways
gn
cyaa
loading extensions like this?
the music cog is the only cog that is not loading 😞
yeah
if I import a cog into another cog, I'd need to instantiate it, right?
does anyone knows how to make these fancy application shortcuts?
I believe its the UserCommand, MessageCommand, and ApplicationCommand options
thank you very much :D
also do you know if this UserCommand thing will also be usable as a slash command?
or do i have to make 2 specific functions?
or can i just put them both as decorators and it will work (like that)
@slash_command()
@user_command()
async def my_command():
i just tested this, and yes it's possible
this
the only problem is that the user command function can only have 2 parameters (ctx and user)
so the slash command will only have to have those two and cant have any more
ok thank you so much!
I've got an embed with a thumbnail that is suddenly not showing.
The URL for the image is still valid, as in I can navigate to it, and the image loads just fine.
The embed worked fine yesterday. I haven't made any code changes.
The image is hosted on S3 and is publicly available. Nothing has changed in my S3 configuration since yesterday.
Any ideas why this might be happening?
is the image not showing like there was no image?
There's no empty frame, if that's what you're asking
It looks like an embed that doesn't have a thumbnail set
have you tried with a different picture?
It works with different images, yeah (the URL is dynamically generated; this one in particular isn't working)
(The images are specified by users. Not all are on S3. I just know this one is because it's my own image, lol)
I suppose I should try:
A different S3-hosted (maybe smaller? different format?) image
The same image hosted elsewhere
Anyone having issues resetting their token for their bot?
I reset mine twice over 12 hours ago and its still only logging in with its original token 🙃
Hello
Hm. The same image saved to a Discord channel will load in the embed.
Slash command not working why?
Ah yes. Not working. Without providing any context, code and/or errors.
with this error discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
You didn't invite the bot with the application.commands scope
like this?
yes
Ok I'll try
From now on you can re-add a bot just with the bot scope.
Discord automatically adds the application command scope (See #discord-api-updates)
Its worked thank y'all
ok this is great
yes
but i don't know how to add role with button
@ripe pagoda
await member.send(file=discord.file("captcha.png"))
TypeError: 'module' object is not callable
what does that mean
capitalize discord.File
you're calling the module, not the class
thanks
how do i access a database that is in my window machine from my ubuntu VPS
ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 5432) it says this in the vps
because that points to localhost aka something in your local network
you cant use that in a different network and expect it to work
in pgadmin for the server connection i have the vps address and i modified my conf files and all
but it still wont work
As a followup on this: I've tried other images stored in AWS, and they won't show in embeds, either. They did work yesterday. No policy changes have happened, and I can view them in my web browser.
Is anyone else experiencing this?
listen_addresses = '*' this in postgresql.conf and
TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 md5
host all all ::/0 md5 in pg_hba
this on my window machine
was this was i was supposed to do
you need to give the script your public ip address
of the vps?
thats what you have to do if you want the vps to connect to a database that is hosted on your computer
is ipv6 local address what i need to put
local address? are you using ipconfig in the windows cmd?
Link-local
that shows you the computers local network ip address
something that isnt public
you need to use google or some other thing to get your public ip address
what is my ip on google wld work
and then theres the mess of having to port forward the desired port to point to your computer in the local network
TYPE DATABASE USER ADDRESS METHOD
host all all iplol md5
host all all iplol md5
like this
no, port forwarding is done on your router
you need to learn more about how networking stuff works
i was jst trynna make an economy bot 
if you dont want to go through the pain of this stuff then just use sqlite instead
but isnt postgresql better then sqlite
every database type has their cons and pros
kk
the pro of sqlite is that you dont need to deal with networking nonsense to make it work
do note that you may have to rewrite your sql queries
How to tempban?
u ban the user and unban after a certain time
do you have a database to store the unban timestamp in?
You have to handle that yourself, such as waiting after a certain time to unban them.
As Discord doesn’t support that with the ban coro.
and what i mentioned is the more persistent way of keeping track of when to unban
sure i can do that
i recommend putting the database on the vps, pretty sure if it's on the local network you don't have to deal with all this bullshit
ye was just looking for a doc lol
@slow dome so instead of using @commands..... i check inside the command if the user has roles?
take a look at this
use has_any_role
that seems intresting and im gonna use it later prob
this worked very nice so thanks
is there an event for on mention of a bot?
no, there's only on_message
kk, thanks
?tag example
No tag example found.
?tag ex
Bot examples: https://github.com/Pycord-Development/pycord/tree/master/examples
Slash command/context menu examples: https://github.com/Pycord-Development/pycord/tree/master/examples/app_commands
Buttons, dropdowns example: https://github.com/Pycord-Development/pycord/tree/master/examples/views
Hello can i get the source code of @supple ravine
How do I make a menu (select menu) active for an infinite amount of time
persistent views
Here's the persistent example.
search the guide
So I have a wait_for function and a check for that function, the problem is that its all being executed in a dm and for some reason this check doesnt work
return m.author == member and m.channel == interaction.channel
What is the error message?
So does it just return False?
yes
I believe so, the view message option under general, right?
print the ouput of m.author==member and also print the output of m.channel == interaction.channel
lemme switch to my alt account
Alright
Alright
it returned
False
True
like i thought
m.channel == interaction.channel
returned false
what
Note that due to a Discord limitation, DM channels are not resolved since there is no data to complete them. These are PartialMessageable instead.
compare the ids then
wait actually wait one sec
yeah compare the ids
do m.channel.id == interaction.channel.id
basically m.channel was returning a type DMChannel while interaciton.channel was returning a PartialMessageble which meant that they weren't equal
d:\Desktop\peer\app\cogs\event.py:85: RuntimeWarning: coroutine 'Messageable.send' was never awaited
member.send("Sucks to be you")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
👍
thanks
yw
await member.send("...")
yes i know
Alright
How come u sent this tho?
to show that it works
Ok so, what am i doing wrong
`Ignoring exception in command poll:
Traceback (most recent call last):
File "C:\Users\MRS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 127, in wrapped
ret = await coro(arg)
File "C:\Users\MRS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 877, in _invoke
await self.callback(self.cog, ctx, **kwargs)
TypeError: PollCommand.poll() got an unexpected keyword argument 'options'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\MRS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\bot.py", line 992, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\MRS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 358, in invoke
await injected(ctx)
File "C:\Users\MRS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\commands\core.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: PollCommand.poll() got an unexpected keyword argument 'options'
`
ping me if you can help C:
how to chat in voice channel 
can i have an array for has_any_role?
so
@commands.has_any_role([id1,id2,id3])
or does it have to be (id1,id2,id3)
?
just unpack the array
@commands.has_any_role(*[id1,id2,id3])
i just changed it to
for role in message.author.roles:
if role.id in allowed_roles:
other code here
there is a way to use an invite code to check if the invite exists or is valid?
i guess this would raise not found
hmm thanks lemme try
nice
its attached to bot
I have a ques! My buttons stop working after 10-25 mins? why
Why my Lavalink not find Videos?
how to get user.avatar in pycord?
Literally that
If u want the url then user.avatar.url
Is the view timeout set to None?
Do you stop the bot?
yes but i fixed it
i made it with on_interaction
i have problem using await interaction.followup.edit_message(message_id , embed = embed)
discord.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook
im getting the id with: message_id = interaction.id
U need to save the message you want to edit to a var and then use msg.id on it to get the id
so i must take the message from the interaction ?
is it possible to get the embed title from the current page (paginator)?
No, u should take the message that u have already sent that ur trying to edit
Yes
Buttons are under discord.ui.Button
Have u used views before @vast patrol
Button
ModuleNotFoundError: No module named 'discord.ui'
it doesn't
R u sure ur on 2.0?
is it part of the official 2.0 or a dev build?
It's on the stable 2.0
Do print (discord.__version__)
i dont have dpy tho
Try to uninstall dpy anyway
Why does replit keep installing discord.py after removing it and having py-cord already installed
I have import discord
Cuz it does import guessing
Successfully installed py-cord-2.0.0
Alright so does it work now?
??/
no
U can disable it
Does that make sense
Every new repl comes with a .replit and a replit.nix file that let you configure your repl to do just about anything in any language!
Hm do pip freeze and send everything here
idk why u want all but k
Just send it pls
aiohttp==3.7.4.post0
asgiref==3.5.2
async-timeout==3.0.1
attrs==21.4.0
cffi==1.15.1
chardet==4.0.0
Django==4.0.6
ffmpeg==1.4
idna==3.3
libnacl==1.8.0
multidict==6.0.2
py-cord==2.0.0
pycparser==2.21
pymongo==4.1.1
PyNaCl==1.4.0
six==1.16.0
sqlparse==0.4.2
typing_extensions==4.3.0
tzdata==2022.1
yarl==1.7.2
youtube-dl==2021.12.17
pardon?
Cuz then they might require dpy which is causing issues
none needs dpy tho
Although I think dpy would be in pip freeze then
Yeah so I'm not sure what's going on
Is this output still there?
Thx for help i got it
Go to idle
Yw
Import discord and check version
I'm trying to check if an user has access to view a channel, and using permissions_for(user), but it returns a bit field/bitwise value? how can I use this 
or is there another way to check this
nvm can just do permissions.view_channel
i had uninstalled anything discord related
and runned py -3 -m pip install -U py-cord[voice]
now i can't import discord XD
ok got it working
thanks
is it possible to get the embed title from the current page (paginator)?
Hey lads, is it possible to make the image of an embed an spoiler?
That's just regularly uploading a file tho. I meant in an embed
Or would this work in an embed as well
i think you have to save the file with BytesIo and then send it in the embed
ah no nevermind
in the embed mh i dont know
I'll try to figure out some things. Thanks!
https://docs.pycord.dev/en/master/search.html?q=spoiler
i think its not supported
That's what I was thinking. I'm pretty sure I've seen it done before with something like making a steam game link a spoiler
yeah
How can i do a array like this:
array = ["name": ["id": 3173714231, "status": True]]?
And how can i change eg the name an the status?
@misty glacier
array = {"name": {"id": 3173714231, "status": True}}
print(array["name"]["id"])
#Output: 3173714231
array["name"]["status"] = False
print(array["name"]["status"])
#Output: False
How?
Traceback (most recent call last):
File "C:\Users\tassa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "C:\Users\tassa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1042, in on_connect
await self.sync_commands()
File "C:\Users\tassa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 644, in sync_commands
registered_guild_commands[guild_id] = await self.register_commands(
File "C:\Users\tassa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 473, in register_commands
prefetched_commands = await self.http.get_guild_commands(self.user.id, guild_id)
File "C:\Users\tassa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 353, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
time#6296 has logged in```
import discord
from datetime import datetime
from discord.ext import commands
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
bot = discord.Bot(debug_guilds=['id here'])
@bot.event
async def on_ready():
print(f'{bot.user} has logged in')
@bot.command(description = ' is it working!')
async def ping(ctx):
await ctx.send(f"i am working: {bot.latency*1000} ms.")
bot.run('')```
did you invite your bot with application.commands?
youll have to invite it with applications.commands
^
?tag forbidden
do you know how to do that?
emm how i have never heard of it
uhm
?forbidden
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
dangit there is supposed to be a tag for this
lmao
and and go to your bot
and then
OAuth2
URL generator
You get a 403 Forbidden (error code: 50001): Missing Access as error?
You might've added your bot in the past without the applications.commands scope.
What to do?
Old way: Re-add the bot with the applications.commands scope.
New way: Since 11/07/2022 discord automatically includes the applications.commands scope in OAuth. You just need to re-add the bot with the bot scope. See [#discord-api-updates@996103073111998544](#discord-api-updates message) for more infos.
and check bot and applications.commands
this is actually automatic if it has the bot scope now.
oh wow
yes
it worked

ctx.send isn't ctx.respond
Do cog listeners override?
Like if I have a on reaction remove listener. will it not remove the reaction unless i do in the code?
no, unless they are in the same file
Do I need to add a decorator or anything?
just @commands.Cog.listener()
Ok
winners = []
count = 4
for winner in range(count):
user = random.choice(giveaways[giveawayID]["users"])
if user in winners:
continue
winners.append(user)
How can I make the for loop run once more when continue is reached?
use a while loop (probably easier)
True thx
How do I add buttons to a view in a for loop?
view.add_item(button)
👍
How do I create the item in the for loop?
what are you iterating?
?tag slash_command
No tag slash_command found.
slash_command
Learn all about Slash Commands and how to implement them into your Discord Bot with Pycord!
Tnx
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: startswith first arg must be str or a tuple of str, not bytes
Am weirdly getting this error, am trying to create a webhook.
No idea why 
show code?
with a View is it possible to disable the buttons for one user but not another?
@commands.command(name='setupLogging')
async def logging(self, ctx, channel: Union[discord.TextChannel], ):
await channel.create_webhook(avatar=self.client.user.avatar.url)```
no
where does startswith come in
show full traceback?
sigh
One sec
Ignoring exception in command setupLogging:
Traceback (most recent call last):
File "C:\Users\nicho\PycharmProjects\Rimuru\ve1nv\lib\site-packages\discord\ext\commands\core.py", line 184, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\nicho\PycharmProjects\Rimuru\cogs\logging\sub_logging.py", line 48, in logging2
await channel.create_webhook(name='example name', avatar=self.client.user.avatar.url,
File "C:\Users\nicho\PycharmProjects\Rimuru\ve1nv\lib\site-packages\discord\channel.py", line 566, in create_webhook
avatar = utils._bytes_to_base64_data(avatar) # type: ignore
File "C:\Users\nicho\PycharmProjects\Rimuru\ve1nv\lib\site-packages\discord\utils.py", line 523, in _bytes_to_base64_data
mime = _get_mime_type_for_image(data)
File "C:\Users\nicho\PycharmProjects\Rimuru\ve1nv\lib\site-packages\discord\utils.py", line 509, in _get_mime_type_for_image
if data.startswith(b"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"):
TypeError: startswith first arg must be str or a tuple of str, not bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\nicho\PycharmProjects\Rimuru\ve1nv\lib\site-packages\discord\ext\commands\bot.py", line 344, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\nicho\PycharmProjects\Rimuru\ve1nv\lib\site-packages\discord\ext\commands\core.py", line 951, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\nicho\PycharmProjects\Rimuru\ve1nv\lib\site-packages\discord\ext\commands\core.py", line 193, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: startswith first arg must be str or a tuple of str, not bytes
update to 2.0 stable may fix this issue
right, there's a 2.0.0
!install
Install pycord:
pip uninstall discord.py
pip install py-cord
Install pycord beta:
pip uninstall discord.py
pip install py-cord==2.0.0b7
Install pycord alpha from git:
pip uninstall discord.py
pip install git+https://github.com/Pycord-Development/pycord
?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 !git to find out how to install git.
Updating the module to Alpha (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord
this is like... 4 months behind
Uh
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: startswith first arg must be str or a tuple of str, not bytes
Still getting the same error
if there's still an error, open an issue on github
I'm just trying to create a webhook 😓
And I'm just trying to help
Alrighty just opened a github issue
THIS IS SO MUCH MORE CONVENIENT OH MY ABSOLUTE DUCKING WATER
Thanks to the Pycord team if your reading this for creating this :)
Is it possible to do bridge commands but prefix commands are done without replying to the original message?
do py if isinstance(ctx, BridgeExtContext): stuff here
Ohhh yup, so I can just do ctx.send?
yeah
Perfect, thanks. Glad the bridge module exists, I was literally having an internal breakdown of how I'm gonna make a duplicate of everything
it's why it exists
Is there a way to disable caching bot messages
not specifically messages from bots no
for message in ctx.channel.history(limit=100): <- Line 47
# do something
Ignoring exception in command clear:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/discord/commands/core.py", line 127, in wrapped
ret = await coro(arg)
File "/usr/local/lib/python3.9/dist-packages/discord/commands/core.py", line 877, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "/home/bots/discord/python/Ruby Network/commands/moderation/clearCommand.py", line 47, in clear
for message in ctx.channel.history(limit=amount):
TypeError: 'HistoryIterator' object is not iterable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/discord/bot.py", line 992, in invoke_application_command
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/discord/commands/core.py", line 358, in invoke
await injected(ctx)
File "/usr/local/lib/python3.9/dist-packages/discord/commands/core.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: 'HistoryIterator' object is not iterable
async for
lmao
Thank u :D
does anyone know how to calculate permissions
like if i give pycord a integer
or integers
can it tell me if i have admin
How can I actively listen to and process voice being captured?
https://finitereality.github.io/permissions-calculator/?v=0
https://discordapi.com/permissions.html#0
A permissions calculator for Discord.
A small calculator that generates Discord OAuth invite links
or you can read the docs https://discord.com/developers/docs/topics/permissions#permissions
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
im trying to calculate using automation
right it gives you a formula
kinda of
lmao
im too dumb
yes, kinda
im trying to make a dashboard
using the discord api
and i am really struggling with permissions
these calculators give you the formula ish
and the | is bitwise or, I think
yeah
but 8 doesnt always mean admin?
8 does
i currently have theese 2 objects
guild = client.get_guild(int(id))
user = await client.fetch_user(int(request.cookies.get("discord_id")))```
user object
and guild object
how can i figure out if the user has administrator
in the guild
do i fetch user from guild
and then use likek
guild_permissions.administrator
Yes
alright
AttributeError: 'Guild' object has no attribute 'fetch_user'
oh wait
i put user
not member
lol
mb
:)
thanks you
Sup guys, is it possible to update the guild id list on runtime, so the guild gets access to commands without restarting the bot?
does anyone know anything about this?
no idea
are u trying to make like a talking ben bot?
that detects when a user is speaking
How can i add a deactivated button to a embed?
You might be able to read the audio data from sink.audio_data[userid].file, idk if it can be done while it's writing though
could probably also subclass VoiceClient and override this: https://github.com/Pycord-Development/pycord/blob/master/discord/voice_client.py#L807-L819
discord/voice_client.py lines 807 to 819
def recv_decoded_audio(self, data):
if data.ssrc not in self.user_timestamps:
self.user_timestamps.update({data.ssrc: data.timestamp})
# Add silence when they were not being recorded.
silence = 0
else:
silence = data.timestamp - self.user_timestamps[data.ssrc] - 960
self.user_timestamps[data.ssrc] = data.timestamp
data.decoded_data = struct.pack("<h", 0) * silence * opus._OpusStruct.CHANNELS + data.decoded_data
while data.ssrc not in self.ws.ssrc_map:
time.sleep(0.05)
self.sink.write(data.decoded_data, self.ws.ssrc_map[data.ssrc]["user_id"])```
Button has a disabled= keyword which takes a boolean.
b!rtfm pyc discord.Button
How do you turn a message object into a dict?
i dont believe message has a to_dict() method
i don't think there is a way...
time to contribute
¯_(ツ)_/¯
hi, so ive just recently made a new bot app and when i put the new token in its giving me this error, i cant really figure anything out but i know for a fact the token is valid
heres what im using to load the token
with open('token.json', 'r') as f:
token = json.load(f)['token']
client.run(token["token"])
print() your token before running the bot
ive done that yeah
is it your token?
yes
then token isn't valid
recheck it
also, i suggest using .env instead of .json files, you can read about it on google
ill check it out
Ah I see. My goal was to make a bot that detects when a certain word is said and then records the last 30 or so seconds of audio
Sounds a bit complicated
this would probably work better
you could just stop it from recording anything until a word is said
then save timestamp and record
I see
I wonder how I could detect when a word is said anyway
pass the decoded voice data through a speech to text?
probably
That sounds complicated but cool
these buttons do what they are supposed to do but the text below the buttons shows up anyway how can I make it stop
if you disable them, they cannot be clicked
I just dont want "This interaction failed" to show up when it did actually work
respond somehow
can i use dynamic cd with slash command?
Yeah
Although it will be on the bot side of things so discord won't handle it
uh could you elaborate?
With cogs, How would I do something whenever a user joins?
def custom_cooldown(self, user: discord.Message.author.id):
if user == 92786442891169792:
return None
else:
return Cooldown(rate = 1, per = 60)
#
@commands.dynamic_cooldown(custom_cooldown, commands.BucketType.user)
would this be the correct way to implement a dynamic cooldown on a slash command?
i tried it and couldn't get id from author
Oh wait actually I don't think u can
Because I dont think u can get the message from the interaction
Though try to do message: discord.Messsge instead of discord.Message.author.id
Cuz I'm not sure if it will work or not
can anyone show me an example of using the create_custom_emoji method?
i can't figure out how to get an image in bytes that doesn't exceed the body max character count
Here's the create private emoji example.
that's what i've tried
the difference is
im pretty sure you can just open image via default methods
i'm getting my images from a saved file
not through a command
with open(number, "rb") as f:
await ctx.guild.create_custom_emoji(
name=ROLES.numbers_names[i], image=f.read())
and i get ```
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In name: Must be between 2 and 32 in length.
emoji names have to be however long the error says
you're welcome i guess
ty 😭
is it possible to track those who are interested in the event?
How would i get a button like that?
and for it to be active after i restart the bot?
Here's the persistent example.
Hello I've been making a minecraft server manager bot, and for some reason after I changed something this line of code is erroring await context.respond(embed=emb)
Code: ```py
@bot.command(description="Starts the server")
async def start(context, server: str):
if ownerid == context.author.id:
for folder in os.listdir("./minecraft"):
if server == folder:
try:
with r(host=ip,port=mcservers[server]["port"],password=mcservers[server]["pass"]) as mcr:
resp = mcr.command('list')
await context.respond("Server is already online!")
except:
await context.respond("Starting server...")
os.chdir(f"/home/admin/coalminecraftservers/manager/minecraft/{server}/")
subprocess.Popen(["sh","start.sh"])
os.chdir(f"/home/admin/coalminecraftservers/manager")
how can i set a limit to modal text amount
If the command takes longer than 3 seconds for your bot to respond (Because you are making a changes to a server for example.) you should put context.defer() at the very beginning of your command this will give your bot more time to think.
Yes
Thank you
Hi
I using my raspberry pi 4 to host but
When I close the Putty my bot is stop to work
I am using Windows 10
It's still not working, but now it just doesn't give me an error
The code you showed above was not the code for the error can you show that instead?
Here's the command I'm running
@bot.command(description="Gives list of servers")
async def servers(context):
await context.defer()
emb = discord.Embed(title="Servers")
for server in os.listdir("./minecraft"):
try:
with r(host=ip,port=mcservers[server]["port"],password=mcservers[server]["pass"]) as mcr:
resp = mcr.command('list')
emb.add_field(name=server, value="Online")
except:
emb.add_field(name=server, value="Offline")
await context.respond(embed=emb)
Bot's code:
in this line you are missing a " before the pass key
mcservers = {"Friend_Server":{"port":00000,"pass":"password"},"Galacticraft":{"port":00000,"pass":"password"},"copsnrobbers":{"port":00000,pass":"password"}}
Oops I made that error while editing it It doesn't have that in the code
you can use custom emoji is embed's field name
Is there a way to check what invite code somoene used to be invited?
yeah but is there a way to do something like
@bot.event
async def on_member_join(member):
print(f"Invited by {memeber.inviter}")
or something ?
because i didnt see anything like that in there
You might check out https://pypi.org/project/DiscordUtils/, it has a built-in invite tracker that you could try
oo ill check it out thanks
hmm
i got a
ImportError: cannot import name 'PartialMessageable' from 'discord.channel'
error after getting discordutils
hmmm
ooh
it installed discord.py
uninstalled discord.py now its from discord.ext import commands, tasks
ImportError: cannot import name 'tasks' from 'discord.ext' (unknown location)
hmmm
How can I make the bot sending what's it's sent to his dms In a channel
Np 🙂
What you mean
Could anyone help me out in #996783251186274324
does Webhook.from_url cant executed with threading?
always got RuntimeError: Task <Task pending name='Task-233' coro=<sendw() running at /app/bgtasks.py:21> cb=[_run_until_complete_cb() at /app/.heroku/python/lib/python3.9/asyncio/base_events.py:184]> got Future <Future pending cb=[shield.<locals>._outer_done_callback() at /app/.heroku/python/lib/python3.9/asyncio/tasks.py:910]> attached to a different loop
I used the get function from discord utils to get the emoji by name and sent that object in the field name + description
So does it works or not
slash command doesnt show up
@commands.slash_command(guild_ids=[972791561450573824], name="fish", description="Go fishing")
async def fish(self, ctx):
if await get_item(item_id="7fea4d63-c02a-4057-832a-ba460b8dedc2", by="uuid", inventory="Player", id=ctx.author.id) is not False:
chance = randint(1, 100)
for key, value in fish.items():
if value > chance and chance < value:
await add_item(item=key, id=ctx.author.id)
item = get_item(item_id=key, by="uuid")
ctx.respond(f'You caught **{item["icon"]} {item["name"]}**!')
else:
await ctx.respond("You don't have the fishing rod!")
i had that happen to me but thats because the class was the same name as a diffrent cog
did you invite the bot with the application.commands scope?
i have like 10 other slash commands that work
It can take some time
it took too much time
its not a global command
its in a cog but other command in the cog work
ah wait
i just noticed
my last command also didnt register
try importing slash_command from discord.commands (from discord.commands import slash_command) then use @slash_command for the slash command decorator instead of commands.slash_command.
there's also @discord.slash_command
that too
alright
maybe thats the problem
Alright it works now
I reset my token and now my environment variable isnt working
Its random not ranom
bro i know
is there a way to know when an audit log has been edited? for example when you delete a message by someone else, it creates a new audit log, but if you delete another one, it doesn't create a new audit log but edits the old one
i forgot completely how to use pycord, haven't used it in 2 years
tried to install it and got errors when running test code
/tag guide
?tag guide
well, installing makes the bot have many errors
Before you can start using Pycord, you need to install the library.
can you send the errors and the steps you followed to install?
Please send the full error.
to make an argument optional do u just give it a default value or?
in a slash command
?tag paste
Pass in required as False. required=False. Then it will default to None.
And you can still put a default
where would i do that :0 in Option()?
can i put ctx.author as default or is that not how python works i dont remember off the top of my head
it's keyword, anywhere
no, you can leave it as None and resolve it internally
wut u mean anywhere ? how do i make a specific argument optional
Yes
kk
a no securing token bot gets the same error but says TOKEN instead of my token
it says that the discord library does not exist too
import discord could not be resolved
Follow installation instructions: https://guide.pycord.dev/installation/
Before you can start using Pycord, you need to install the library.
Here's the slash cog example.
okay, now i don't have the discord library problem after installing all of the versions of pycord
but i still have this problem where the other things in the code won't say they are installed
for example
dotenv says its not installed
even though i uninstalled and then installed it 3 times
and i still get the discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized error
Here's the slash options example.
Having a little problem with bridge commands.
I want to be able to send a message, and then edit it.
But we're forced to use ctx.respond, which message.edit doesn't work with. Are there any options?
Error specifically: discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'Interaction' object has no attribute 'edit'
Nevermind!
.edit_original_message instead solved my query, someone else asked the question in the Discord, just found it.
Thanks :)
found out how to fix the not installed libraries, the code still gives an error tho
Send error please.
here
i've been trying to fix this like half of my day
i just want to run my bot which has untouched code since the time it worked
Hey @midnight horizon, I’ve looked out a little bit your problem and the error I’ve seen is that you probably sent an invalid token to Discord, most exactly an invalid token; and that is related to you dotenv problem; not pycord exactly. First, be sure that the token you are using is ok, next, Can you try to print what you get from your “os.getenv”
the token is correct, but i don't thing the getenv is working properly
i even copypasted the tutorial, didn't seem to help tho
also, i don't really know how to print it, but i can try
Try to do a
print(os.getenv(‘TOKEN’))
File "c:\Users\vinic\Documents\Yiffiy Pycord\dotenv.py", line 2, in <module>
from dotenv import load_dotenv
File "c:\Users\vinic\Documents\Yiffiy Pycord\dotenv.py", line 2, in <module>
from dotenv import load_dotenv
ImportError: cannot import name 'load_dotenv' from partially initialized module 'dotenv' (most likely due to a circular import) (c:\Users\vinic\Documents\Yiffiy Pycord\dotenv.py)```
Oh hey, Didn’t see that ^^
will a guild, that I add to a command in runtime, get access to the command and if not: how is it possible to add commands to a guild without restarting the bot everytime?
why do you need to add commands to a guild
i think i just broke my python installation
stonks
i am now uninstalling and reinstalling python
I don’t need it right now but there are monetized discord bots out there and I was wondering how they give you access to „premium“ commands once you donate something
okay, fixed my python instalation
I think actually registering them globally and then checking whether the guild is a "premium" guild would be better for marketing as you advertise the feature more.
my .env indeed returns none, even tho i copied and pasted the tutorial, only change is that i put in my token
Send your .env file but remove your bot’s token
And also send what you’re doing to load your .env
well, there are 2 kinds of token in there rn
that's all what's in it
Ok then don’t send that. Are you sure you’re doing from dotenv import load_dotenv then load_dotenv()?
yes
its literally copy pasted from the example
import discord
import os # default module
from dotenv import load_dotenv
load_dotenv() # load all the variables from the env file
bot = discord.Bot(debug_guilds=[881207955029110855])
@bot.event
async def on_ready():
print(f"{bot.user} is ready and online!")
@bot.slash_command(name = "hello", description = "Say hello to the bot")
async def hello(ctx):
await ctx.respond("Hey!")
bot.run(os.getenv('TOKEN')) # run the bot with the token```
Is both in the same folder?
the bottest is this one
the bot is my untouched code that stopped working
after 6 months of not opening it
so you also can just use a json file
well yes, but actually no cuz i don't know how to do that
you gotta understand that the example code isn't working
at least not for me
Tbh if you are hosting it locally there’s no point imo in using “.env” unless you have a Full Stack Developer lurking at your pc from time to time
^
its better for sending the error logs to people
most of the times i tested, the error logs showed the token
still, same thing, even with no env
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
and yes, i tried refreshing the code
no change
is the bot with applications.commands invited?
the bot has all possible permissions
and scopes
just to be sure
Eh
the code worked perfectly 6 months ago
Is this a Pycord specific issue. For example what if you used a different library
looks like so, the only difference from then and now is that i updated pycord to v2
what is your pip list?
------------------ -----------
aiohttp 3.7.4.post0
async-timeout 3.0.1
attrs 21.4.0
certifi 2022.6.15
cffi 1.15.1
chardet 4.0.0
charset-normalizer 2.1.0
colorama 0.4.5
discord.py 1.7.3
idna 3.3
multidict 6.0.2
pip 22.1.2
praw 7.6.0
prawcore 2.3.0
py-cord 2.0.0
pycparser 2.21
PyNaCl 1.5.0
python-dotenv 0.20.0
requests 2.28.1
typing_extensions 4.3.0
update-checker 0.18.0
urllib3 1.26.10
websocket-client 1.3.3
wheel 0.37.1
yarl 1.7.2
youtube-dl 2021.12.17```
yeah, i uninstalled it and it kept coming back
when i installed pycord
i can try uninstalling it again tho
same error happens, uninstalled discord.py and reinstalled pycord
------------------ -----------
aiohttp 3.7.4.post0
async-timeout 3.0.1
attrs 21.4.0
certifi 2022.6.15
cffi 1.15.1
chardet 4.0.0
charset-normalizer 2.1.0
colorama 0.4.5
idna 3.3
multidict 6.0.2
pip 22.1.2
praw 7.6.0
prawcore 2.3.0
py-cord 2.0.0
pycparser 2.21
PyNaCl 1.5.0
python-dotenv 0.20.0
requests 2.28.1
typing_extensions 4.3.0
update-checker 0.18.0
urllib3 1.26.10
websocket-client 1.3.3
wheel 0.37.1
yarl 1.7.2
youtube-dl 2021.12.17```
it is indeed gone
nothing changed tho
did it
