#discord-bots
1 messages Β· Page 276 of 1
no homo
bruh askljdksaldjaslkdasdk
no homo
no homo
its ok just learn the basics of python
I mean I know the very rudimentary stuff, I just don't know anything about the discord library
or any library
ok
because you helped me I will upvote your bot
oh thanks
zagzag Do you think this logging event I created will do the job?
@Bot.event
async def on_message(message):
author_name = message.author.name
if isinstance(message.channel, nextcord.DMChannel):
log_folder = os.path.join("logs", "DM")
log_file = os.path.join(log_folder, f"{message.author.name}.txt")
else:
log_folder = os.path.join("logs", message.guild.name)
log_file = os.path.join(log_folder, "mesaj-log.txt")
if not os.path.exists(log_folder):
os.makedirs(log_folder)
with open(log_file, "a", encoding="utf-8") as f:
f.write(f"[{current_time}] {author_name}: {message.content}\n")
await Bot.process_commands(message)
thank you
should do
so you fixed the 1st one, 2nd one is, I want the recognised word to be isolated and not just part of another word, the key word is "ip" and it works if I say "nipple" for an example
which is not ideal
one second
π
ok back
wb
show your code
wdym
btw that file = file doesnt work for paginator lib π i can link up that lib if u wanna have a look
is that all the code in the on_message event?
Even a separate lib.. discord.py has it built-in
I can look later but idk if i will find something
!e
print("cat" in "cat")
print("cat" in "copycat")
print("cat" == "cat")
print("cat" == "copycat")
@naive briar :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | True
003 | True
004 | False
this code here will just do this: when you type "ip" its gonna send this "The server IP is: hello.com"
Just use == instead
yes
i know discord.py has it built in , this lib uses discord.py too , only makes it easier to make paginators and stuff
like its based on discord.oy2.0
thats what you want right?
yes
ok as @naive briar said just switch the in with ==
If it doesn't support send files, then that's its problem π€·
god yall are really making me feel like a dumbass but, where do I put the == π
What , how is that a solution to my issue
replace it with the in....
Making your own custom paginator might not be as hard as you'd think
If the lib doesn't support sending files, there's no solution
if message.content.lower() == "ip":
wait u dont know my orginial issue i guess
i am trying to send local images inside paginator embeds
standard solution is using .send(file=f , embed=) thing
but i cant use that
Already know it
oh how I adore you @formal basin and you too @naive briar
all fixed?
all fixed
thats good
I shall get reading on more python before I try to put my next feature in
but expect me to come back here soon :)
yeah I recommend
Can someone help me with this?
https://i.imgur.com/uH6bfUQ.png
i dont know if im being ratelimited
i am stating my orginal issue . i want to send images via embeds
Yes?
Send you code, then maybe someone can
Can anybody else tlel how to add local images to embed directly
It is a different issue.
For that answer from here https://discordpy.readthedocs.io/en/stable/faq.html#how-do-i-use-a-local-image-file-for-an-embed-image is enough
Well, it looks like internal library issues
What Discord library is this?
elaborate please
@formal basin help me
What Discord library are you using? Like discord.py, disnake, py-cord, nextcord, discord, ...
import discord
from discord.ext import commands, tasks
Well, I guess only libraries that uses the discord module name count
from nextcord.ext import commands
class SohbetCevaplama(commands.Cog):
def init(self, Bot):
self.Bot = Bot
@commands.command()
async def selam(self, ctx):
await ctx.send("Merhaba!")
def setup(Bot):
Bot.add_cog(SohbetCevaplama(Bot))
initial_extensions = ["commands.sohbet_cevaplama.py"]
if name == "main":
for extension in initial_extensions:
try:
Bot.load_extension(extension)
except Exception as e:
print(f"Failed to load extension {extension}: {e}")
error :
Failed to load extension commands.sohbet_cevaplama.py: path attribute not found on 'commands.sohbet_cevaplama' while trying to find 'commands.sohbet_cevaplama.py'
@formal basin
No, the library
Those are module names that py-cord also uses
So it's not clear enough
Im sorry for being slow, i just dont know what you mean right now sorry
yes i understand but like i said ,
i am passing embeds in start( ctx , pages = embeds) how am i supposed to add the file argument here
discord
vitness
Show that library
mhm?
help me :,)
what
.
A Python library to easily create embed paginators in discord.py or any fork that uses discord.py 2.0. - GitHub - soosBot-com/Pagination: A Python library to easily create embed paginators in disco...
can i add decorator to the commands.Cog.listener("on_message")
from discord.ext import commands
def validation():
async def predicate(message) -> bool:
return (
message.author.id in wishlisted,
message.guild.id in wishlisted_guilds,
message.channel.id in wishlisted_channels,
)
return commands.check(predicate)
class Test(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@commands.Cog.lister("on_message")
@validation
async def on_message(self, message: Message) -> None:
# if validation fails this will not be called
pass
async def setup(bot: commands.Bot):
await bot.add_cog(Test(bot))
Don't add .py in cog path
Try pip show discord
Cog.lister when the when
Cog checks are for commands
Well, try uninstalling it and install discord.py instead
any workaround
its already downloaded
Why do you need it in the first place
Did you uninstalled the discord module?
yeah'
Try to start the bot
The "workaround" is putting if condition into listener itself
I want to listen to msg send by my friends. in my server
Yeah it's simple if condition
some times they delete it
its the same
I just want to know they back bitch me or not.
Β―_(γ)_/Β―
That library isn't providing any way of giving file in the send
edited it.
Try pip freeze, you might have multiple Discord libraries
oki
Exactly π
wish discord would allow sending local files easily
aiohttp==3.7.4.post0
aiosignal==1.3.1
altgraph==0.17.3
async-timeout==3.0.1
attrs==22.2.0
beautifulsoup4==4.11.2
browser-cookie3==0.19.1
bs4==0.0.1
certifi==2022.12.7
chardet==4.0.0
charset-normalizer==3.0.1
colorama==0.4.6
discord-py-interactions==5.6.0
discord-py-slash-command==4.2.1
discord-typings==0.6.0
discord-ui==5.1.6
discord-webhook==1.1.0
discord.py==1.7.3
discordwebhook==1.0.3
emoji==2.4.0
frozenlist==1.3.3
idna==3.4
lz4==4.3.2
multidict==6.0.4
pefile==2023.2.7
Pillow==10.0.0
psutil==5.9.4
py-cord==2.0.0b1
pycryptodomex==3.18.0
pyinstaller==5.13.0
pyinstaller-hooks-contrib==2023.6
pystyle==2.9
pywin32-ctypes==0.2.2
requests==2.28.2
rgbprint==4.0.2
robloxpy==0.2.21
soupsieve==2.4
tomli==2.0.1
typing_extensions==4.6.3
urllib3==1.26.14
yarl==1.8.2
insted of
#@commands.Cog.cog_check(validation)
@validation
(sorry for the flood)
Don't worry about it
oki
i meant as image in embeds
That's still easy
@naive briar Thanks for your help, im not gonna continue with this because its currently nearly 5am and i need sleep. sorry but i thank you very very much
Try uninstalling
discord-py-interactions
discord-py-slash-command
discord-typings
discord-ui
discord-webhook
discordwebhook
py-cord
And update discord.py
What ? discord is requiring you to add url as args in embed.image
Is that hard? I don't think so
Ill be back in 4-5 days thanks @naive briar
hello, I have a simple question. Creating a bot is it a bad practice to extend the discord.py User class? Suppose you are creating a game and you have players inside. Is it a bad practice to extend the user class? class Player(discord.User)
No problem π
night night
then suggest how am i supposed to do it..
@frosty beacon there are two ways
Assume you have a function that checks condition
def check_friends(msg: discord.Message) -> bool:
return msg.guild.id == your_guild_id
You can do that without decorator:
@Cog.listener()
async def on_message(self, msg: discord.Message):
if not check_friends(msg):
return
... # the rest of code
And you can do that with decorator
def check_friends_deco(func: Awaitable):
async def pred(self: Cog, msg: discord.Message):
if not check_friends(msg):
return
await func(self, msg) # i'm not even sure if these are correct args bruh
return pred
@Cog.listener()
@check_friends_deco
async def on_message(self, msg: discord.Message):
... # rest of the code
Decide for yourself which method is better lol
i said multiple times it isnt useful here because i cant add it to pages π
thanks let me check if this work. i wasted 3 hours on chatgpt
Because the library you're using doesn't support it, what do you want us to do? π€·
Just fork that library or copy its source into your project lol
Or even better write your own paginator
Yeah, it doesn't seem too hard to add the support anyway
i was asking for alternate solution for help .
honestly i appreciate you replying but why are u so passive agressive? you havent been helping but just like repeating its easy etc , kinda different from others here
I mentioned couple of times the standard way to send an image with a single embed wasnt useful over here but u keep saying same
Literally ready paginator except it's for disnake https://github.com/BobuxBot/BobuxAdmin/blob/master/utils/pagination.py
i don't know how to.... anyways i am saying how do you add "pages" and files together? sorry if i am explaining it badly but i am saying
if page1 has image1
and page2 has image2 , how to add both images without causing issues as files
You said
Exactly π
wish discord would allow sending local files easily
And I just tell that it's easy π€·
Assuming pages are embeds this way
await send(embed=current_page, file=current_file)
yes pages are embeds . they are being passed as a collective list and not seperatly with send command
to make clicking next sort of thing
Have you looked at that?
Perfect solution for your case, you only need to add a field into EmbedPaginatorEntry and alter _get_current_embed function to return file as well to use in update
okay so @vale wing in this page like u said , copy the source
https://github.com/soosBot-com/Pagination/blob/main/src/Paginator.py
if i edit the .send commands and then add file tags there it should work ? π
and then just importing the files
A Python library to easily create embed paginators in discord.py or any fork that uses discord.py 2.0. - soosBot-com/Pagination
thank you so much for help , that makes sense now
in a message content im checking if any of the words from items are in the message. however if i type in small, it should send an error message but it continues. how do i make it check for the full string and not just the single word?
items = ["small-set", "phantom-set"]
found_items = [item for item in items if any(word in message.content.lower() for word in item.split("-"))]
if found_items:```
!e 
message_content = "small"
items = ["small-set", "phantom-set"]
found_items = [item for item in items if any(word in message_content.lower() for word in item.split("-"))]
print(found_items)
@naive briar :white_check_mark: Your 3.11 eval job has completed with return code 0.
['small-set']
how can i make a discord chatbot with python?
Which model are u using or u gonna train it yourself?
what do you mean?
Often you'd need to have a model to process inputs and predict the response
Do you have a basic knowledge of ai and machine learning?
I wanted to use the package: Chatterbot.
!pip chatterbot
hey so I'm running my python bot using pterodactyl
and it seems like whenever I try to hit the "restart" option it just doesn't do that, it says it's doing it but nothing happens, I always have to kill the process
anyone run into something similar before ?
I think that's not a discord issue it's related to the service you using
So i suggest asking them instead
worth a shot
I was thinking that maybe its because of the async processes ?
preventing it from restarting unless I kill the program
https://srcb.in/8fXzzWJI61
this is a ticket bot and i m trying to use dropdown menus and buttons to make it
the error which i got is:
Traceback (most recent call last):
File "/home/container/main.py", line 67, in <module>
class CreateSelect(View):
File "/home/container/main.py", line 80, in CreateSelect
@CreateSelect.ticket.select # Corrected decorator usage
NameError: name 'CreateSelect' is not defined```
how would i make it to where the mention member's balance is shown in the values and not the member who sent the command
code:
@client.command(aliases=['bal'])
async def balance(ctx,member:discord.Member=None):
await open_account(ctx.author)
user = ctx.author
users = await get_bank_data()
if member is None:
member = ctx.author
if member is not None:
member = member
wallet = users[str(user.id)]['Wallet']
bank = users[str(user.id)]['Bank']
total = wallet + bank
em = discord.Embed(title=f"{member.name}'s balance", color=discord.Color.random())
em.add_field(name=':wt: Wallet Balance', value=f' :cn: {wallet}', inline=False)
em.add_field(name=':bk: Bank Balance', value=f' :cn: {bank}', inline=False)
em.add_field(name=':co: Total Balance',value=f' :cn: {total}', inline=False)
await ctx.send(embed=em)
Your member variable is unused
Well, maybe not
But you're getting wallet, bank data from using the user variable, not the member
okok, I need help, I want to start making an economy type system, but idk how to start, I've not done anything for it yet
How do i do reference=original_message() in button interaction reply
how does User.global_name,
User.display_name and Member.display_name works? (discord.py version 2.3.0 update is pretty new and couldnt understand how it works)
Wdym by that? Exact code? Just look at source
button interaction "reply"?
Main part of it would be a database to store the money of each user, look into sqlite or postgresql
discord/user.py lines 271 to 281
@property
def display_name(self) -> str:
""":class:`βstr`β: Returns the user's display name.
For regular users this is just their global name or their username,
but if they have a guild specific nickname then that
is returned instead.
"""
if self.global_name:
return self.global_name
return self.name```
global_name is just an optional string variable
hmm
property name```
Equivalent to [`User.name`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.name "discord.User.name")
!d discord.Member.global_name
property global_name```
Equivalent to [`User.global_name`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.global_name "discord.User.global_name")
!d discord.Member.display_name
property display_name```
Returns the userβs display name.
For regular users this is just their global name or their username, but if they have a guild specific nickname then that is returned instead.
!d discord.Member.nick
The guild specific nickname of the user. Takes precedence over the global name.
Hey I'm working on a message purging feature for my bot
But there seems to be a problem, I followed a tutorial to get most of this down, checked and double checked, there's no errors or whatnot but I'm still running into issues
Have you tried reading the error\
I have
and..?
it quite clearly says "Missing Permissions"
Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
:/
Hey all -- I'm diving into discord bot development. One of the things I can't suss out if there's a meaningful difference between app_commands and just doing commands.Bot. What are the major differences between the two?
the ext.commands framework is for text commands,
app_commands is for application commands, including slash commands and context menus
It seems like app_commands are a superset of ext.commands functionality in that case?
no its just for a different sort of command
they arent exactly related in any way
from discord.ui import Select
!d discord.ui.Select
class discord.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu with a list of custom options. This is represented to the user as a dropdown menu.
New in version 2.0.
.ext.commands also got slash commands
no slash commands are under discord.app_commands
.ext.commands are only for prefixed commands
nope
proove me wrong
alr
if he means hybrid commands then thats funny
Stupid bot
no you just dont know how to access the docs
!d discord.ext.commands.Bot.hybrid_command
@hybrid_command(name=..., with_app_command=True, *args, **kwargs)```
A shortcut decorator that invokes [`hybrid_command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.hybrid_command "discord.ext.commands.hybrid_command") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.add_command "discord.ext.commands.Bot.add_command").
Does one always need the full qualified name?
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="$",intents=discord.Intents.all())
@bot.tree.command(name="test")
async def test(int: discord.Interaction):
await interaction.response.send_message("Test Message Submittes")
bot.run(":)")
hybrid commands are importing app_commands for making slashes
and case
yeah you created a Bot instance but you dont use its features
hi leo
if you only use app commands you can just use Client
its present under .ext
do you even read what im saying?
discord/ext/commands/bot.py line 176
self.__tree: app_commands.CommandTree[Self] = tree_cls(self) # type: ignore```
π
the difference between Client and Bot is that Bot can define prefixed commands
u said its not present there
cause its not
but I am saying its present
It uses app_commands for it

yeah but I meant its present in discord.ext.commands too
dam bros really not getting it
Where..?
..
I mean, ext.commands does expand on the app commands framework by allowing app commands to be defined in cogs, but the underlying handler is still the CommandTree
what about it
A hands-on guide to Discord.py
huh read it
discord.Client can create slash commands only
discord.ext.commands.Bot can create all that Client can + prefixed commands
wdym read it, thats MY message
how to send various buttons in 1 embed:
bot.add_view(CreateSelect())
bot.add_view(CloseButton())
bot.add_view(TrashButton())
bot.add_view(one_star())
bot.add_view(two_star())
bot.add_view(three_star())
bot.add_view(four_star())
bot.add_view(five_star())
#one star
class one_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("β Review!")
#two star
class two_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("ββ Review!")
#three star
class three_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("βββ Review!")
#four star
class four_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("ββββ Review!")
#five
class five_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("βββββ Review!")
#other code balh balh balh
#commands
@tree.command(name="review", description="review")
async def slash_command(interaction: discord.Interaction):
await ctx.send(
embed = discord.Embed(
desription="Please give us review"
),
view= one_star(), two_star(), three_star(), four_star(), five_star()
) ```
now i want to send those rating buttons in the embed... how can i?
yeah that's what I am sayin
no thats exactly what you are not saying
you said .ext.commands is responsible for slash commands
You add multiple buttons to one view
I never said its responsible I meant u can create it there too
create one view with 5 buttons?
Rather than making a bunch of views
can you send an exmaple if possible?
huge misunderstanding π
how??? any examples?
Huge unable to explain yourself properly
tha~ alright
in this example there are two buttons defined
But don't name them all "closed" you'd just be redefining the same button
wdym by "closed"?
I was saying we can create slash cmds in discord.ext.commands too
async def closed(...)
You can't have two things named the same you would just overwrite the first one
That doesn't even make sense π, discord.ext.commands is just a module
ah alright alright
.....
huh
oh thats not an answer
He answered to my question i was just confirming π
then no such method does not exist
!d discord.InteractionResponse
class discord.InteractionResponse```
Represents a Discord interaction response.
This type can be accessed through [`Interaction.response`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction.response "discord.Interaction.response").
New in version 2.0.
Hybrid commands? I don't like those at all
no
!d discord.TextChannel.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") from the destination.
Looks like only message id is not enough
Only messageable objects have fetch_message, you need a channel or smth like that too
!d discord.PartialMessage.edit
await edit(*, content=..., embed=..., embeds=..., attachments=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.11)") instead of `InvalidArgument`.
!d discord.TextChannel.get_partial_message
get_partial_message(message_id, /)```
Creates a [`PartialMessage`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PartialMessage "discord.PartialMessage") from the message ID.
This is useful if you want to work with a message and only have its ID without doing an unnecessary API call.
New in version 1.6.
Changed in version 2.0: `message_id` parameter is now positional-only.
Use this instead of fetch_message, uses one less api call
PartialMessage is better
i see
well i think i added the sync:
https://srcb.in/EEiKplgARV
Traceback (most recent call last):
File "/home/container/main.py", line 233, in <module>
async def slash_command(ctx, interaction: discord.Interaction):
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 290, in decorator
result = hybrid_command(name=name, *args, with_app_command=with_app_command, **kwargs)(func)
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/hybrid.py", line 893, in decorator
return HybridCommand(func, name=name, with_app_command=with_app_command, **attrs) # type: ignore # ???
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/hybrid.py", line 509, in __init__
HybridAppCommand(self) if self.with_app_command else None
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/hybrid.py", line 306, in __init__
super().__init__(
File "/home/container/.local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 666, in __init__
self._params: Dict[str, CommandParameter] = _extract_parameters_from_callback(callback, callback.__globals__)
File "/home/container/.local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 374, in _extract_parameters_from_callback
param = annotation_to_parameter(resolved, parameter)
File "/home/container/.local/lib/python3.10/site-packages/discord/app_commands/transformers.py", line 834, in annotation_to_parameter
(inner, default, validate_default) = get_supported_annotation(annotation)
File "/home/container/.local/lib/python3.10/site-packages/discord/app_commands/transformers.py", line 793, in get_supported_annotation
raise TypeError(f'unsupported type annotation {annotation!r}')
TypeError: unsupported type annotation <class 'discord.interactions.Interaction'>```
You are making function with 2 parameters
ctx and interaction
so that cant be done?
so first will be actually interaction
and second discord.py will try to use as input from user
nope
Hybrid only uses ctx
but if i dont add ctx, i get the error "ctx is undefined"
No need for interaction
oksy so everything works... except that the review cmd wont come on slash cmds and it only sends 1 buttons
U synced it?
yeah it think i did
Can u show the code where u syncing
I remember your question and someone's answer don't name button handlers with the same name
You have all of them with the same name on_rating_close
This too this overwrites the button
Give every button function a different name
on_bot_ready event doesn't exist i believe
Guy got me confused
so then how do i send all the buttons under 1 embed then?
Just change the function names
As you are sending the whole view i believe
Not just buttons individually
hmm alright
And don't sync in on_ready
okay so this is the code:
class one_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("β Review!")
#two star
class two_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("ββ Review!")
#three star
class three_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("βββ Review!")
#four star
class four_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("ββββ Review!")
#five
class five_star(View):
def __init__(self):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send("βββββ Review!")```
how do make it send under 1 embed?
oh
At least the setup_hook but preferably also when a command decorator/ function arg/kwarg has changed else don't resync.
You want all these to be sent in one embed?
This can be done way more efficiently.
Then why make different classes for each
yeah
i~
class Review(View):
def __init__(self, rating: int):
super().__init__(timeout=None)
@button(label="β")
async def close(self, interaction: discord.Interaction, button: Button):
await interaction.channel.send(f"{'β' * rating} Review!")
He wants 5 buttons
Just make them all under one class like
class star(View):
def __init__():
@discord.....
async def.....
@discord.....
async def.....
Do them like this
Then send this view
what comes in @discord?
That's the decorator you using
If it's just the rating that changes you can also just make a list comp of buttons.
oh
but with different names
not as you did it before
In your case it will @buttons
thanks dude it worked!!!!!!!!!!
What u thought i was trolling XD
but the slash cmd wont load? how to sync it properly
Just create a command
Can you show it
I mean for sync
i~ i never made a sync cmd?
uhhh... how? like what to add?
Same way u create any other command
U just need to put the sync line in there
shouldn't be that hard i think
@Bot.slash_command(description="KiΕiyi sunucudan banlar")
@commands.has_permissions(ban_members=True)
async def ban(ctx, member: nextcord.Member, *, reason=None):
if member == ctx.author:
await ctx.send("Kendinizi yasaklayamazsΔ±nΔ±z!")
else:
try:
await member.ban(reason=reason)
if reason:
await ctx.send(f"{member.mention} baΕarΔ±yla yasaklandΔ±! Sebep: {reason}")
else:
await ctx.send(f"{member.mention} baΕarΔ±yla yasaklandΔ±!")
except commands.MissingPermissions:
await ctx.send("Yeterli yetkiniz yok.")
except commands.BotMissingPermissions:
await ctx.send("Botun yeterli yetkisi yok.")
except nextcord.HTTPException as e:
await ctx.send(f"Hata oluΕtu: {e}")
@ban.error
async def ban_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
if ctx.author.id == 924899524860850186:
await ctx.reinvoke()
else:
await ctx.send("Bu komutu kullanma yetkiniz yok.")
elif isinstance(error, commands.MemberNotFound):
await ctx.send("LΓΌtfen bir ΓΌye etiketleyin.")
elif isinstance(error, commands.BadArgument):
await ctx.send("LΓΌtfen bir geΓ§erli ΓΌye etiketleyin.")
@wispy pasture
@turbid condor
I am running my code, but I am getting an unresponsive application error. Can you help
Any error in the terminal?
no
Ok try removing that error handler
That might be eating up the error
And then see what it prints
ctx on a slash command...?
Nextcord
U sure cuz i never worked with nexcord
Me too hence I checked
So welp we found the issue then i guess
my other commands are working.
Are they slash too
Yeah you can use whatever but it's just... different.
Welp then remove that error handler then and see
It might have the same function
For example in disnake send for interaction is implemented as response + followup
I see
You still need to respond using *.response.send_message
This why i like dpy since there is a clear difference in every argument
Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x0000026FE8066B10>:
Traceback (most recent call last):
File "C:\Users\Bayram\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\application_command.py", line 895, in invoke_callback_with_hooks
await self(interaction, *args, **kwargs)
File "c:\Users\Bayram\Desktop\Yongsun.py\yongsun.py", line 135, in ban
if member == ctx.author:
^^^^^^^^^^
AttributeError: 'Interaction' object has no attribute 'author'
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: AttributeError: 'Interaction' object has no attribute 'author'
bruuuuhhhhhh
I will solve this issue right away.
async def command(message)

Idk why ppl test there code with error handler enabled it's my fifth time today

Just use a global error handler, all you need.
tbh this makes it look like
@bot.listen('on_message')
async def command(message):
Slash commands don't have them
They do.
It was working before.
Afaik there is nothing as global slash command error handler in dpy
If you have no errors then it is working ofc
on_error on the CommandTree
Tree.on_error?
Yeah that's for a tree
which one is better dropdown menu roles or old reaction roles?
I believe you don't have multiple trees
You can but not many people do.
What is "better"? Everyone has his own opinion
So I won't call that global
Buttons XD
nah I means like which one is good according to u
Lol
Which ever u can work with
what about discord.on_error? looks like it's global for everything
Then use the Client one.
Nope it's for events and listeners i think
I can work with both but
just asking so that I can decide which one should I add
Then go with drop down or button
maybe
idk
Call it how you want it's more than enough for 99.9% of users.
You can say it that way
But still it's better to know the actual case
Rather than thinking about majority
A lot of people here don't care about the actual case. They just want their code to work lol
Facts
On_error only for event
discord.on_interaction(interaction)```
Called when an interaction happened.
This currently happens due to slash command invocations or components being used.
Warning
This is a low level function that is not generally meant to be used. If you are working with components, consider using the callbacks associated with the [`View`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View "discord.ui.View") instead as it provides a nicer user experience.
New in version 2.0.
So you could make a global error handler.
Can't say when it triggers incase after interaction is completed or same time the interaction happens
If it's after completion then u can't since incase of interaction fail there is no interaction that happened
Even though prefix and slash commands are called from event, on_error is not called. just checked
@bot.command() - drops error
@bot.tree.command() - drops error
@bot.listen("on_message") - goes in on_error
sure
Sure, but if you want to store it long term you'd need a database
can some1 help me with my code?
i can
remove guild_id
ok and i cant do / command?
def test(a = None):
print(a)
test(b="Hello")
it will return same error
can i get your code?
bot.add_command is a function, not decorator
but when i do @bot.slash_command it doesnt say its a attribute
and usually you don't use it
you want @bot.command() i believe
for slashes you need another thing
if it's a bot then @bot.tree.command() will be enough (+ you need to sync it)
and changing your command to use interaction methods, not context
you want to convert this code to JS?
no stick to py
You mean no, stick to py
What library are you using?
As it says, there is no Option in discord
Use what it has
I guess you want SelectOption
but you are typehinting with it... so i am not sure
yeah thats right π
thanks so much for the help btw
not sure i dont think i have one haha
wait im getting the same error π
No one appreciate this kind of reaction
ma fault
You must have one to use
oh
most common ones are discord.py nextcord disnake py-cord can you check if you have installed any of those
oh i use py-cord
and discord.py
You cant use two at once
oh so uninstall what one?
From those two i would recommend discord.py
ok
thats the line im getting a error on
yes i agree 
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
alr bet
the only answer i can give here
yo
nah i added that but changed it back to type π
how do i make logs
1.7.2 :p
yeah bookmarks a little dated it seems lol
also if you are interested this project is not bad https://pypi.org/project/python-logging-discord-handler/
alr im advancing now
did you check the accepted args for that? https://discordpy.readthedocs.io/en/stable/interactions/api.html?highlight=selectoption#discord.SelectOption
oh got it so what should i put instead of selectOption?
Choice?
what you expect it to do
examples/app_commands/basic.py lines 47 to 54
@client.tree.command()
@app_commands.describe(
first_value='The first value you want to add something to',
second_value='The value you want to add to the first value',
)
async def add(interaction: discord.Interaction, first_value: int, second_value: int):
"""Adds two numbers together."""
await interaction.response.send_message(f'{first_value} + {second_value} = {first_value + second_value}')```
if that's what you want
Yeah and choices are made with decorator too
to like when you do a /ban command it pops up with a user selection
that
Then annotate argument as discord.Member
but not a ban command
Then annotate it with anything else you want
use it as a integer like 1= one file in the popup and 2= another file
Use choices then
!d discord.app_commands.choices
@discord.app_commands.choices(**parameters)```
Instructs the given parameters by their name to use the given choices for their choices.
Example...
!d discord.app_commands.choices
looks pretty neat, but im a bit concerned about the fact they don't handle webhook posts in a separate thread
yeah i didn't notice that at first - although the source code for this project is so simple you probably could rewrite the posting part to use AsyncDiscordWebhook https://github.com/lovvskillz/python-discord-webhook#async-support
nah it doesnt have to use async/await, just doing the requests through a QueueHandler/QueueListener should be enough
image i have an account who is onwer of 10 servers is there a way to invite the same bots programaticly for these servers with oauth2? ( i mean bots that are not mine like music bots or m6 for example)
this choice thingy ma jig is gonna make my head explode
No
You need to do it manually
If you will make a bot that will open a link, choose server and solve discord antibot captcha for you...
Overkill
Very interesting challenge though
yea pretty interesting challenge, what is even more interesting is i never done a captcha solver so maybe is time to try ; )
y'all gonna have us solve the theory of everything as captcha
if it's so easy to make bots that solve captcha they're gonna make it harder
Hey... What's the method to edit a bots reply which was sent in an embed with buttons?? interaction.response.edit?
interaction.response.edit_message is what you are looking for
I am unfamiliar with the use of slash commands. Please can someone explain why my bot doesn't kick the user?
@bot.tree.command(name="kick", description="Kick a User")
@commands.has_permissions(kick_members=True)
@app_commands.describe(member = "user")
@app_commands.describe(reason = "reason")
async def kick(ctx: discord.Interaction, member: discord.Member, reason: str):
if member == ctx.user:
await ctx.response.send_message(f"{ctx.user.mention} you cannot kick yourself!")
else:
try:
await member.kick(reason=reason)
embed = discord.Embed(title="**User Kicked**", color=discord.Color.red())
embed.add_field(name="Offender", value=f"{member.Mention}", inline=True)
embed.add_field(name="Moderator", value=f"{ctx.user}", inline=True)
embed.add_field(name="Reason", value=f"{reason}")
await ctx.response.send_message(embed=embed)
except discord.Forbidden:
await ctx.response.send_message("I do not have permission to kick members.")
@kick.error
async def kick_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.response.send_message(f"{ctx.user.mention} You don't have permission to kick members.")
elif isinstance(error, commands.BadArgument):
await ctx.response.send_message(f"{ctx.user.mention} Invalid member provided.")
else:
await ctx.response.send_message(f"{ctx.user.mention} An error occurred while trying to kick the member.")```
Well for a start you're using a prefix command decorator on a slash command
Otherwise not really without a traceback or knowing what it's doing instead
he is not 
ahh, you meant the check
@commands.has_permissions(kick_members=True)
this ^ is decorator for prefix commands
not sure what it will do, but using the slash one will be better
and yeah an actual traceback would help
or at least what output you are getting
i made this simple calculator please somone rate it btw im a begginer
clone_input = input("put anything and i will clone it !")
def clone_machine():
print(clone_input)
clone_machine()
print("now for the calculator!")
first_number = int(input("type a number."))
second_number = int(input( "type a second number."))
print("i will give you the sum of the 2 numbers you typed")
question_ready = input("are you ready?")
if question_ready == "yes":
print(first_number + second_number)
else:
print("fuck you")
print("amazing right?")
print("now lets do a multiplication! ")
first_number = int(input("type a number."))
second_number = int(input( "type a second number."))
print("i will give you the multiplication of the 2 numbers you typed")
question_ready = input("are you ready?")
if question_ready == "yes":
print(first_number * second_number)
else:
print("fuck you")
print("bye")
Cool, but this channel is specifically for discord bots
That's a wrong channel for that
And also i don't like your answer for exiting the program
im sorry
wdym?
For "are you ready?" question i mean

how to download the python package on vscode?
im really struggling
everytime i want to code
i go to an online compiler
pip install package
for example, yes
what does it say
!repl
A REPL is an interactive language shell environment. It first reads one or more expressions entered by the user, evaluates it, yields the result, and prints it out to the user. It will then loop back to the read step.
To use Python's REPL, execute the interpreter with no arguments. This will drop you into the interactive interpreter shell, print out some relevant information, and then prompt you with the primary prompt >>>. At this point it is waiting for your input.
Firstly you can start typing in some valid Python expressions, pressing <return> to either bring you to the eval step, or prompting you with the secondary prompt ... (or no prompt at all depending on your environment), meaning your expression isn't yet terminated and it's waiting for more input. This is useful for code that requires multiple lines like loops, functions, and classes. If you reach the secondary prompt in a clause that can have an arbitrary amount of expressions, you can terminate it by pressing <return> on a blank line. In other words, for the last expression you write in the clause, <return> must be pressed twice in a row.
Alternatively, you can make use of the builtin help() function. help(thing) to get help on some thing object, or help() to start an interactive help session. This mode is extremely powerful, read the instructions when first entering the session to learn how to use it.
Lastly you can run your code with the -i flag to execute your code normally, but be dropped into the REPL once execution is finished, giving you access to all your global variables/functions in the REPL.
To exit either a help session, or normal REPL prompt, you must send an EOF signal to the prompt. In *nix systems, this is done with ctrl + D, and in windows systems it is ctrl + Z. You can also exit the normal REPL prompt with the dedicated functions exit() or quit().
you are in repl mode
i write it in terminal @buoyant quail
quit it
how?
read last paragraph of the embed
ok thanks
Hello, why can't I access Cog attrs when using app_commands? Could syncing tree in setup_hook be the reason?
...
class Cog(commands.Cog):
def __int__(self, bot: commands.Bot):
self.bot = bot
@app_commands.command(description="...")
async def cmd(self, interaction: Interaction):
self.bot # AttributeError: 'Cog' object has no attribute 'bot'
...
cause you have typo in the __init__ method
I
still @slate swan
blame pycharm for that
never blame pycharm
now we are getting somewhere
thank you.
what os?
you installed it from ms store?
no
or python.org
from python.org
!dashm
When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.
Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.
Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.
try this
i dont remember
since when there are so many optional features
I thought pip was automatically selected
but I cant remember
well now its getting interesting
so how did you get to repl mode without python
i had smth like this too, i installed it from the ms store and then it worked
repl doesnt enable u to import packages right?
idk
what command did you run so you got into the repl mode
works fine for me
but before i told you
yeah i know i told you how to quit it im asking how did you enter it
scroll up a bit and see
doesnt matter anyways because u told the command to exit from it
it matters a lot
i dont remember entering repl mode
if i knew how you enter it i would knew how toinstall package
with any commands in the terminal
maybe uninstall python and download it again?
and check the pip*
anyways if you dont know how you got into repl try reinstalling python and make sure you check pip and Add python to PATH or something like that
we have the same ideas π
pip checked
π
what you see?
maybe buy a windows license too π
done
π me have no moni
pip install discord right?
discord package is ,, pip install discord
I have different listeners for my bot and all seem to work fine. I did try to add an on_ready one and it doesn't trigger. This is my simple testing code:
@client.listen("on_ready")
async def test_fn():
print("test")
Am I doing something wrong?
@bot.event
async def on_ready():
print ("Booting up your system")
try it
can you show your full code
this is my full code
I don't see your on_ready method
It is working fine.
it's a listener
not an event
I don't get any output...
I do have a normal on_ready event
and that one prints fine
Check that file is saved
That function is executed (it is reachable)
That client is an actual thing you are using
idk what else
try making bots with disnake
client is usable, 3 other listeners in the same file for "on_member_join", "on_raw_member_remove" and "on_member_ban" all work fine
It works on my machine.

while already having a regular on_ready event?
where can I show my code to view ~.db files
when i run the python3 -m pip install -U discord.py
it makes an eror
try disnake
ok now I'm puzzled
show full code?
why the cross
wdym bro?
because installing disnake is 1) not going to fix his problem and 2)not helpful
I'm talking about using another library if possible
@client.listen("on_ready")
async def test_fn():
print("test")
@client.listen("on_member_join")
async def test_join(user):
print(2)
@client.listen("on_raw_member_remove")
async def test_leave(payload):
print(2)
@client.listen("on_member_ban")
async def test_ban(server, user):
print(3)
@client.event
async def on_ready():
print("test ready")
i'm not getting any errors
I just don't get the "test" printing output
all else print fine
my main on_ready is in another file and all the rest listeners are elsewhere. loading that file with load_extension()
wait so where are these listeners at?
the 4 top are in an external file which is loaded with a load_extension()
so they are in a cog?
no
an external file that contains a single app_command
the command works, the listeners work
except the on_ready one
this is my setup for that file:
async def setup(client):
client.tree.add_command(test_cmd)
it's added to the tree and synced fine
shows up in the server and returns a result upon call
I think you need to add the listeners in your extension
using the add_listener function
in the setup function?
client.add_listener(test_fn)```
you would add this in your extension
those listeners then get registered with the client once the extension is loaded
async def on_ready(): pass
async def my_message(message): pass
bot.add_listener(on_ready)
bot.add_listener(my_message, 'on_message')```
thanks for the help. Fixed. Your suggestion helped keeping my code cleaner. Main issue ended up being me loading the extention after the initial on_ready event, so the extra on_ready listener wouldn't trigger. I loaded it on_connect and it now triggers perfectly fine
guys
when i run the discord package command pip install discord
it doesnt work
@slate swan bro :c
What you get now?
Did you try python -m pip?
-m pip istall discord?
!dashm
When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.
Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.
Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.
u didn't install python properly ig its not in path
A hands-on guide to Discord.py
it is
follow this tutorial it goes through basics and good practices on how to make a bot
cmd says otherwise π
go to c > users > ur name on pc > app data > local > programs > python and remove whatever installations you have there and follow the tutorial above and do a fresh install
where did u download from btw?
aight
fr
go through the tutorial and lmk if u face any issues
yeah and a few other experienced devs contributed
most yt tutorials are outdated in comparison to version of libraries
As nice as the tutorial is, not many inexperienced devs will use linux. Blind ignore
@shrewd apex
hi
hi
well it's good to be inclusive i don't discriminate
yessir
Actually mac will use brew package manager.
now how to add the discord package in vscode @shrewd apex
i have never held a Mac in my laif
how do i know ;-;
i cowd on it its very gut
How to fix overlapping text
@shrewd apex
A hands-on guide to Discord.py
bro i did ur tutorial
Please help
@shrewd apex
oh i didnt see it
Bruh me neither dwdw
with?
@shrewd apex can u look my problem i scrapping answer from website but some text is overlapping
aight from what i see is the text has some specific characters for equations which is being rendered using css/js u might wanna filter those out
filter out unicode characters or of those sort use regex ig
i cant tell much without seeing code
Ok I send u code in dm
Ok
I mean just decode it differently.
Websites are annoying like that sometimes require extra decoding.
u could just escape those characters thats easier ig
ikr we just need plain html the rest all can go π³
somehow i just imagined discord without any css 
TS figured out flex boxes, they stopped there.
@slate swan you there buddy
My view class is not showing on message
I tried to trace error by
try:
await ctx.send(embed=embed, view=Buttons(ctx))
except Exception as e:
await ctx.send(e)
But didn't catch anything
Pastebin got a stroke
!indent
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
against tos
Makes sense lol
Show the view class
π₯² bro please
u might wanna look at it lmao
bro leaving aside it's against tos now way i am going through like 1k+ lines of code rn at 2:30am
!indent
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

Panda guessed your issue
Without the code lol
Ok
You have all buttons in the __init__
Lmao Asher it's against tos ||easy questions only||
They should be just in class
btw ur interactions check never returns true if it intended?
Sure
I think you mean TOS alert lmao
Wait what
return re.sub(r'src=\s*?"//(.*)?"', r'src="https://\1"', html_text)
You have only return False in there
here i usw regex?
Do i need true too?
meant that for denji
tbf I can't blame anyone making a music bot rn ads inside the activities.. lamee..
Yes. None means that check failed
up
But you aren't using it anyways
So idk
is wave link against tos?
@shrewd apex
never used it
the .env doesnt work
yes bro tell
wavelink yoinks everything from yt lol
oh gg
So that was the issue and not the indentation
No
did u install python-dotenv?
You don't even use it
It was dpy error anyway not some wavelink issue
@hasty pike ^
try pip3
whats the error
!pypi regex
and ur os
So i need to do view.init() in command
do i need to do the Venv folder @shrewd apex
what 

what?
Wait what
return re.sub(r'src=\s*?"//(.*)?"', r'src="https://\1"', html_text)
@foggy pine bro see
totally not me
You need to make your buttons just class methods. Now you are creating them inside __init__ function and just throwing away
u answer all people
Oh right
what about it
@shrewd apex
Buttons are inside inside init
yes
My bad
whats the error when u ran pip install
did the library install?
@shrewd apex
yes
@buoyant quail return re.sub(r'src=\s*?"//(.*)?"', r'src="https://\1"', html_text)
are u running that in repl
what>?
not in terminal?
what i do change here
all commands in tutorial need to be run in cmd
I have no idea what you are doing
And what you want to do
poetry run python -m pip install python-dotenv ||joke||
we'll docker it
dockerize*
ok done
remove extra space like /n showing when scrapping answer and some equation get overlap
Is /n a space? 
Working on a good environment and Hikari rn
@shrewd apex the library downloaded in the terminal normally
Newline on windows.
Lol
Not with /
\x
And not a space
\n is new line no?
what?
yeah carry on with tutorial then
Yes new line
.replace(r"\x", "")
replied to wrong guy
Ok
!e
something = r"abc\x asdasdas\x\x hello"
print(something)
print(something.replace(r"\x", ""))
@buoyant quail :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | abc\x asdasdas\x\x hello
002 | abc asdasdas hello
btw hopefully u ran the venv activate command before installing
return re.sub(r'src=\s?"//(.)?"', r'src="https://0.0.0.1/"', html_text) insert in these line
@shrewd apex not working for me
dont wanna court the global env
Do it by yourself
Poetry wouldn't have that issue.
clutter
Asking bro
cuz u either prefix with poetry to run all the commands so it knows the path or u run poetry shell
I also know these but not know where I write
Shell
fyi i did put in a snippet about poetry in the 
yo @shrewd apex
Why you don't know what and where are you doing?
whats not working be detailed smh
I just made poetry the entrypoint.
noice
Be nice now..
π¬
the command python main.py
what error do u get
I change these code from php to python
the same as .env one
But not know python well
.
Very sad
How do i update button emoji?
i posted it before @shrewd apex
On interaction
U also not know?
run those commands in cmd
Lmfaoo
People helping rn are killing me π€£
I know where to put it. I don't think that it's the actual issue
terminal power shell or whatever
@shrewd apex
Use vscode
iam using vscode
π¬
π’
I mean unless your file is in the root of your user folder this will never wokr.
How does Pyhton know where your main is lol
@shrewd apex bro look my problem u looking intelligent
look at ur cmd what file path is it showing c > users > ur folder name
where is ur python file
in a file
on my pc
open the terminal or move to that folder in the terminal


