#discord-bots
1 messages ยท Page 925 of 1
uh whats wrong with discord.py?
rn nothing
but it wasnt working for me personally when trying to learn slash commadns
something is wrong with discord.py
yesterday i tried the script it worked fine. but today when i tried it it shows alot of errors
like idk what wrong
it says - "The owner of this website (discord.com) has banned you temporarily from accessing this website"
Kek
i use replit so idk

Yea dpy slash commands are weird
maybe after few days it might work :P
why do i get this error?
i might use studio code for the period
Remove ()
kk
bot.event don't need ()
hmmm. ok
why do I subclass commands.Bot everytime I wanna make a discord bot
creating an instance of it doesn't feel good anymore
sounds like ya bot got banned
was it a bot or a userbot
no
you're rate limited, get rekt
D:
doesnt dpy have built in rate limit protections
it does
"Currently, this limit is 10,000 per 10 minutes."
but you can still get rate limited
i second their statement, get rekt
1k per 1m
you can even get rate limited if you're using a host
or like 15/s
but its fine now cuz i am using vscode
idk free?
preferrably free
i dont wanna always use my laptop once i get a releasable bot
if you noticed, i have premium monetixation listed as a wanted feature
What rpi
raspberry pi
I can say it is totally possible to host it there
haventused it in a year or two
"user = bot.get_user(user_id)"???
Don't have personal experience but I know persons that have done it on rpi 4
I host bots on VPS cause I don't have physical server
i only make an instance of it because its just better organized and you can run methods one time each time the bot gets ran
Hey a que how can I use the bot to delete a message from certain guild?
P.S. I have the message id , guild id and channel id and yea my bot has been authorized to do so
@slate swan ?
U have two ways
Once I get the message object I can delete it for sure but how to get that
Either use fetch message and delete it or use the raw HTTP method (preferred)
!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/master/api.html#discord.Message "discord.Message") from the destination.
use that
fetching is an overkill just to delete a message 
Bot only caches the second message after connection to the gateway soo
I would advice using the http methods
No no it wont be runned always ok so ill tell you why am gonna use it the thing is I have this bot which has button which do certain tasks so if I restart by bot the previous buttons become useless so am gonna run it only once so the buttons are resent
i mean you can but thats still a request compared to my suggestion
U can use persistent views
yeah theyre helpful
Fetching and deleting: 2 requests
Deleting directly with HTTP methods: 1 request
Oo....theres some way to handle that....let me checkout that
fair point
oh that sux for me
Thats a good idea btw thanks Ill checkout out the persistent views.....thanks @slate swan and @maiden fable again for the help!
Umm if you dont mind can you show me some example or maybe some link where I can check how exactly its done?
There's an example in the GitHub repo
apparently discord.py dying so does anyone know any good alternatives?
its not dying
it died a long time ago and was resurrected last month 
What does this error mean like Iโm pretty sure Iโve done it right
u have to do ctx.send
u can assign de sent msg to a variable so later u can edit or delete
The same error popped up when I did that
like message = ctx.send(...)
Ok
oh wait lemme check if i did smth else for my bot
ur using discord.py rite?
Yes.
did u take ctx as an argument in the function?
Yep
huh
oof good catch
idk what could be wrong, sry
Ok.
cant wait for a future where token regeneration is a privliged intent and requries approval every time
i mean, to regen a token u need to login to ur discord account
ig they figured thats enough security
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
@maiden fable Hey mind if I pm?
What happened?
The thing is I havent worked with classes yet so like for persistent view, is classes the only way?
:(
anyone want to help test my bot
you can create a new acc
You need the mark the on_member_join in a @bot.event, and the print("READY") should be in on_ready().
Yes
Just that......well no worries then ill fix my code
where is print("READY")
He meant >>Bot_is_online<<
oh
I meant the ```py
print("> Bot_is_online <")
discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.
Warning
This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
hello, i'd ike to add a profanity check filter but it doesn't seems to work:
@bot.event
async def on_message(msg, ctx):
if 'word' in msg.content:
await msg.delete()
await ctx.send("HUH??!?!/1")
else:
pass
I don't thing ctx can be passed in there.
oh but then how do the other bots do it then?
discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Warning
Your botโs own messages and private messages are sent through this event. This can lead cases of โrecursionโ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
Only message argument
D:
But like cmon look at the docs
ok then what about send it to the dm?
Message has channel attribute
nvm
How can i show the name in the [@member]
which?
?
i see
@client.event
async def on_member_join(member):
print(f'{member} Joined the server!')
there
same thing applies to leave
!d discord.Message.channel
The TextChannel or Thread that the message was sent from. Could be a DMChannel or GroupChannel if itโs a private message.
!d discord.TextChannel.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
!d help
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
idk!
?
idk python at all i actually want to make a discord bot so i joined this server
Well, before creating your first discord bot you should learn the basics of python.
You might find this usefull:
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
not first uk i used node.js btw
okie
@slate swan
This server doesn't support node.js.
ye ik
@slate swan copying features is fun but it's not fun when it doesn't work as intended 
xd
Is it fun copying features?
thats a discord feature
disable them here ig
its easy
Doesn't have anything with coding or discord bots to do, please read the channel topic. ๐คท
go here and click that system messages channel and click wot u want
ikr
lol sorry
hello everyone
what typically gets stored in the main file of a discord bot?
I used to restart my bot every time i ran new code, but im now learning about cogs and reloading them
so what should I have in my main file so I don't have to restart the bot
- some imports
- your bot instance
- the run/start method
and I can store everything else in cogs?
that's probably the most efficient way to do it, right?
having minimal stuff in the main file
Thank you
yea
To work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
you could send requests directly
question..
i have a recursive function in one of my cogs, and when I unload it, the recursive function continues to loop
how do I end it?
Use http methods
You should utilise one of the teardown methods of the Cog class, in this case cog_unload. What you can do is have a variable which your loop checks for, if it's False continue, else break. ```py
class Foo:
def init(self) -> None:
self.variable = False
def run(self) -> None:
for i in range(10000):
if self.variable is True:
break
# do stuff
``` Now all you need to do is define cog_unload in the namespace of your cog class, the signature would look like async def cog_unload(self) -> None, inside of this method you'd set self.variable to True
!d discord.ext.commands.Cog.cog_unload
await cog_unload()```
This function *could be a* [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A special method that is called when the cog gets removed.
Subclasses must replace this if they want special unloading behaviour.
Changed in version 2.0: This method can now be a [coroutine](https://docs.python.org/3/glossary.html#term-coroutine "(in Python v3.10)").
Ahhh i see
๐
Oh further question
Any way to start it back up? I current have the function set to start running on_ready
Any method that's called when the cog is loaded/reloaded?
You can assume setup to be called everytime the cog is loaded, or reloaded
Ohhhh!!!
Did someone know how to use discord API
Dang I'm still learning about all of this and finally understanding what certain parts of the code I've been writing fully do is amazing!
Before I had it calling the function on_ready, but now I won't even need that!
Congrats
how do i use threads?
Could anyone help me with my discord python bot project?
I am trying to make a bot that will react with emojis to a specific person only on my command.
No one asked + No one cares
nobody*
yes
@slate swan good thing ur here,help me
Explain in depth please
you forgot to put a colon after the closing bracket
Interaction):
Oo yea
you forgot a colon
I am using the new modals to make a application bot lol
<@&831776746206265384>
What lol
Yeah
this channels slowmode is gonna be 10seconds in 5 more days watch
Awh shit
Why do you think?
worth noting that emojis have very strict rate limits; might be better to use buttons instead. jus a thought
But rate limits help
To stop spam
Its their choice
Idc
it is indeed discords choice to add discord rate limits
Yes,but the thing is,it helps
Hey i am making a bot and want to know how to set a var with the response of the user ? thx !
uh.
Wdym duh
@commands.Cog.listener()
async def on_ready(self):
interaction = await self.bot.wait_for("button_click", check = lambda i: i.custom_id == "tictrigger")
await interaction.send(content = "Button clicked!")
print("testing...")
``` ;-;
You mean set the users message in a database?
no idea pls help
AttributeError: 'MessageInteraction' object has no attribute 'custom_id'
yes this
You know SQLite?
Learn it then waht this https://youtu.be/aBm8OVxpJno
Hey!
Thanks for watching todays video, todays video I really hope you enjoyed and join my discorddd :)
LINKS -
Join my Discord - https://discord.gg/twHW4UUJGq
Nextcord Server - https://discord.gg/Ucmae5Kbwb
Developer Portal - https://discord.com/developers/applications
Anyways Thanks if you read all of this and I hope you...
fork
*watch
doesn't look like you defined custom_id anywhere?
also that's not relaly something you should use on_ready for
discord ๐ด py
Its not a problem as its quite similar
thanks ^^
im trying to do on another cog .
Np man
is it just me or nexcord and discord.py is actually super almost desame
it's a fork of discord.py, only minimal changes
Bruh these tutorials suck big time
disnake.ui.Button(style=disnake.ButtonStyle.blurple, label="Create ticket",custom_id = "tictrigger"))
This tutorial is ass
..
There's no need for that.
Moderators are volunteers, too.
That on_ready will only run when the cog is loaded, I take it you want it to run whenever the button is clicked? @slate swan
also if the button is defined in cog x, cog y won't see it unless you import the button over.
yes
ok how do i import
from FILE import BUTTON_NAME
What does this mean?
await channel.send(embed=embed2,components=disnake.ui.Button(style=disnake.ButtonStyle.blurple, label="Create ticket",custom_id = "tictrigger"))
It means that the embed needs have the value set.
you made a invalid request, maybe you tried to sent an invalid embed?
But I have it? huh
Want my code?
Sure
@slate swan where is button name here
๐ถ
I think it needs to be inside a full class for it to be able to never timeout.
depends on your file structure and how the button is defined (you won't be able to import it if you're defining it into the .send like that, check out button classes)
but in either case, this won't work via on_ready. You need to find what your libraries event is called for button clicks (disnake uses on_button_click I think) or learn how button callbacks work.
commandList probably just returns an empty string.
Yeah, how do I fix that?
button clases docs pls
The continue makes it so that nothing after it runs, the commandList won't be set.
The help command just returns 1 command in it
How I can make a bot send message upon joining a guild?
hey hey, thats return not continue, continue lets the loop run forward
!d discord.on_member_join
discord.on_member_join(member)``````py
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
It still doesn't execute the next lines of code.
depends on your lib, but disnake has some decent examples here https://github.com/DisnakeDev/disnake/blob/master/examples/views/button/row_buttons.py
Not member
im disnake
it depends
It returnds 1 command in it
!e
for i in range(3):
print(i)
continue
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 1
003 | 2
7.10. The continue statement
continue_stmt ::= "continue"
``` [`continue`](https://docs.python.org/3/reference/simple_stmts.html#continue) may only occur syntactically nested in a [`for`](https://docs.python.org/3/reference/compound_stmts.html#for) or [`while`](https://docs.python.org/3/reference/compound_stmts.html#while) loop, but not nested in a function or class definition within that loop. It continues with the next cycle of the nearest enclosing loop.
When [`continue`](https://docs.python.org/3/reference/simple_stmts.html#continue) passes control out of a [`try`](https://docs.python.org/3/reference/compound_stmts.html#try) statement with a [`finally`](https://docs.python.org/3/reference/compound_stmts.html#finally) clause, that `finally` clause is executed before really starting the next loop cycle.
!d discord.on_user_join
No documentation found for the requested symbol.
!e ```py
while True:
print("a")
continue
print("b")
@slate swan :x: Your eval job has completed with return code 143 (SIGTERM).
001 | a
002 | a
003 | a
004 | a
005 | a
006 | a
007 | a
008 | a
009 | a
010 | a
011 | a
... (truncated - too many lines)
Full output: too long to upload
Will it make the bot send a message (can be anything) upon joining a guild?
useless keyword
So how do I fix my code though
oh if you want your bot to send the message, use the on_guild_join
Remove the continue, they make it so that your commandList isn't set.
!d discord.on_guild_join
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
What continue? 1st or 2nd
Well both.
Alright, let me try
Why do you even have them?
Wait so how do I fix the indentation
elif command.parent != None:
``` Remove that line then too?
Yes, why did you even have it in the first place?
a lesson in why you should always comment your code
for cog in neededCogs:
commandList = ""
for command in self.client.get_cog(cog).walk_commands():
if command.hidden:
commandList += f"**{command.name}** - *{command.description}*\n"
commandList += "\n"
helpEmbed.add_field(name=cog, value=commandList, inline=False)
``` like that
Why the if command.hidden:?
Also not sure xD
Do you have any hidden commands?
Yeah I had
it probably returns bools
I wanted it to remove the commands I did not want
Now you are doing the opposite.
for cog in neededCogs:
commandList = ""
for command in self.client.get_cog(cog).walk_commands():
commandList += f"**{command.name}** - *{command.description}*\n"
commandList += "\n"
helpEmbed.add_field(name=cog, value=commandList, inline=False)
await ctx.send(embed=helpEmbed)
``` so just that?
Seems better
Would that work?
Test it
I mean it works I guess, it sends only 4 though and .help 2 doesn't show a 2nd page
๐คท
!d discord.ext.commands.Bot.commands
property commands```
A unique set of commands without aliases that are registered.
Uh dunno
I am just confused why it only shows that it has 1 page
When it should have 2
Got any idea
I think it was a typo
Getting this error now when doing .help 2
@junior verge
embed = discord.Embed(title="My Commands", description="", color=inter.author.color)
for i in os.listdir("./cogs"):
if not i.endswith(".py"): continue
cog = self.bot.get_cog(i[:-3])
if not cog: continue
cog_commands = cog.get_commands()
if not cog_commands: continue
embed.description += f"**{i[:-3]}**\n"
for j in cog_commands: embed.description += f"`{j.name}` "
embed.description += "\n"
embed.add_field(name="Total Commands", value=len(self.bot.all_commands))
await ctx.send(embed=embed)
this is a simple help command though ๐ you could make it work if you want
do
read the error
the event if the button is event is clicked has a member arg?
Value cannot be an empty string, so set a default for cases where the value is an empty string
to show who the button is clicked by
it has a user property
docs
Where?
commandList?
i know, it has the user property
!d discord.Interaction.user
no i want the event
The user or member that sent the interaction.
ok
huh
Yea, you could do commandList or "default"
disnake.on_interaction(interaction)```
Called when an interaction happened.
This currently happens due to application command invocations or components being used.
Warning
This is a low level function that is not generally meant to be used.
New in version 2.0.
Where I don't get you sorry
Where you pass value
No, where you pass value to add_field
helpEmbed.add_field(name=cog, value=commandList, inline=False)
What do I change there?
Pass
This just ensures you donโt send the API an invalid payload
Why the lowerCamelCase in python
In your case, an empty string
value=default?
im trying to make the bot add role and ive seen the api reference but i still dont get it
how do i do it?
Are you using a library
what library
Because if you do you need library docs not the API reference
Discord.py or one of its forks or any other discord API wrapper
@pliant gulch this is probably not it, but I just don't get it>
helpEmbed.add_field(name=cog, value=default, inline=False)
nah im not using that
im using replit
Raw requests?
yes
Well that's interesting but why not use the lib
i am making a music but but i am getting an error when i try to get the voice channel id from mongodb and connect to the channel.
Code:
@commands.command()
async def play(self, ctx, url : str, *, channelIndex):
vc = col.find_one({"_id" : ctx.author.id}, {"_id":0, "voiceChannels":1})
voiceChannels = await discord.utils.get(ctx.guild.voice_channels, name = vc['voiceChannels'][channelIndex])
if (voiceChannels is None):
return await ctx.send("There is no vc set")
voice = await discord.utils.get(self.client.voice_clients, guild = ctx.guild)
await voiceChannels.connect()```
error:
```python
voiceChannels = await discord.utils.get(ctx.guild.voice_channels, name = vc['voiceChannels'][channelIndex])
TypeError: 'NoneType' object is not subscriptable
vc is None most likely
but it has data
_id:924633928919289946
voiceChannels: Array
0:955771351745069106
1:924633928919289950```
Print the vc
cuz im using chromebook and idk how to download it
ok
@vale wing Do you know?
You have py interpreter right?
You need to provide a title and description of embed field, they can't be empty
So what do I put in my string, ```py
helpEmbed.add_field(name=cog, value=commandList, inline=False)
do u mean the terminal
Your commandList is an empty string most likely and that's not allowed
from linux
Yeah that is so
The python IDLE
But i don't know what to put in it?
You can't have a value of empty string
Put anything but not empty
Like what
no i didnt download it
"word"
should i use it
uh okay
Download it and install, don't forget to put the checkmark on "add Python to PATH"
I will try
And you can develop locally
ok
what type of question is that
If you still would like to use replit, run pip install discord.py in its terminal
"are you using a library" ofc he is where else is he checking the libraries docs?
U were right. Its None
Turns out he didn't use a library
Bru
so how do i solve this?
My commandList is not empty
Then just provide it?
for cog in neededCogs:
commandList = ""
for command in self.client.get_cog(cog).walk_commands():
commandList += f"**{command.name}** - *{command.description}*\n"
commandList += "\n"
helpEmbed.add_field(name=cog, value=commandList, inline=False)
await ctx.send(embed=helpEmbed)
How?
You just gotta make sure you don't set an empty string
Guys, my bot is only online when I run. When I looked uptimerobot, it show this. someone pls help
Yeah but what do I put in it then?
It is saying it is blacklisted. pls someone help
Oh god replit hosting
Yea
Use VPS
oh god damn replit
Don't use replit
replit ๐ข
replit is blocked from uptimerobot now
what's that?
@vale wing
why not using replit
Virtual Private Server
virtual private server
Check pins
how can I use it?
Btw should I post a tutorial here of how to setup ubuntu server for hosting bots
make a server, push the files to the servers file system and run
yes pls
I can't?
vultr is a cheap and very good VPS
as simple as that
used it for my old bot
uhh which one
how much
I use amazon aws (free year xd)
there is some linux setup and commands but its not that much
I use heroku with git and github
You will understand, it is about hosting methods
ok
Bad as well
can u help me
i still need help for this
wsp
im getting error
me too
Can you help me fix my error?
Can I use heroku then instead of replit?
if you want
A vps would be better though
@junior verge@azure scroll
Heroku is bad for bots
Check these two messages everyone who uses heroku/replit
have u tryed
Yes
ah, you got a procfile and a requirements.txt?
not requirements.txt
you need one
oh whats inside it
It spins up a web server and it gets hairy from there on out
pip freeze and put it in a requirements.txt
what
go dms
๐ฟ
...
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโs robots.txt file; (b) with YouTubeโs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
as of now i am not dealing with this specifically
i want the bot to be able to enter and exit vcs only
Guys, I don't have money to buy a vps. What will I do?
get a job ig
I am 14
What do you mean "as of now"? Since we know you asked for help previously with a ToS breaking project, its safe to assume any help we give is also towards that project.
Ig u need a file named runtime.txt or Procfile
well you can still get a job ig
Use AWS, it has a free trial for a year although it requires you to have a CC to get the trial
you need a requirements.txt with all the packages specified
okay thanks :)
thats something unrelated to what i am working with right now
and which ToS breaking project are you talking about?
You're using youtube_dl?
not now
Insert data into your database?
i just want to bot to enter and exit a vc
!d discord.VoiceChannel.connect
await connect(*, timeout=60.0, reconnect=True, cls=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.
This requires [`voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
Ig you're looking for this
thanks
So you used ytdl to get your music for your music bot....and now you want help with that music bot.
no
i have no "ytdl"
then what do u use
In your own words "not now" implying that it was used previously.
no

@azure scroll you should just tell, in reagarding what you need help for
if it's against Tos, they'll say to stop ;-;

i have never used or dealt with it
in the past or present
and i won't be asking ytdl help here
no need of arguing with the mod?
and this is my first project. u r probably mistaking me for someone else
@slate swan how to get req for my current project
the what?
i have a folder
i am not arguing, i am just stating my point that there is no need of creating a big fuss over a small thing
Heroku and github or

bruh?
Lmao
Ashley, could I DM you?
just write the name of the packages you pip install them with, like
aiohttp
requests
tensorflow
if you want a specific version, do packagename==version
(or run your_venv_keyword freeze > requirements.txt if you are in a venv)
..
it isnโt hard to make a requirements.txt ๐ฟ
ok
literally do pip freeze requirements.txt
I wrote that
how do i download python on chromebook
i did
it show error
ERROR: No matching distribution found for pywin32==303
! Push rejected, failed to compile Python app.
but wont this list all the packages installed within pip 
ok
I wrote that
got ignored
huh/.
ok so tell the steps
pip freeze > requirements.txt
edited msg
==version*
that will list all the packages within pip ๐
yes see it again
really? in railway we just do ```py
discord.py==1.7.3
nah requirement files iirc need it
?
try it, it would probably raise a unknown module error or missing import
python3 -m venv env-env
try and except blocks always need to be a pair
I mean the version should be an int not a str
Idk
i am, my bot does that already
Unindent except
...
a fellow sublime user
lol
yall mad sublime takes 40mb of ram
we dont talk about it
If they used a good editor , the editor would have told them the solution itself
it works fine ๐คญ
same goes for you
the spacing
its not the editor
try except
- you can install pyright to sublime ;))
idk ask okimii, I'm gonna cry
good editors support syntax highlighting and debug right when writing the code you know
!try
Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.
A full traceback could look like:
Traceback (most recent call last):
File "my_file.py", line 5, in <module>
add_three("6")
File "my_file.py", line 2, in add_three
a = num + 3
TypeError: can only concatenate str (not "int") to str
If the traceback is long, use our pastebin.
so does sublime?
no
@slate swan
Indentation
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
it should be in the same level
doesnt seem like that in their case ( https://media.discordapp.net/attachments/343944376055103488/956165286095106078/unknown.png?width=698&height=393 )
It means from py try: ... except Exception: ... you do ```py
try:
...
except Exception:
...
sublime wont let you know the errors without extensions until the runtime
you do know thats the color theme right?
nope
im talking about the editor shouting when you make a dumb mistake
thanks for the token
delete this
VSC takes a GB of RAM
its not the editor but your linter?
like this
and pycharm takes 1.5gb
good
there's no way to check if a member has DM's closed without DMing him right?

no need of all that env i just removed the error causing requirement
nope
No it should be```py
try:
...
except:
...
nope
bruh
๐คฆโโ๏ธ i did it for a reason.
That if statement should be in the try block
again, read the chats above.

thats what even users do
try:
print("hi")
except:
print("hello")
what do you mean?
indents and await sent.delete()
intellisense*
nothing
try if except huh?
new syntax?
You can't have a if statement between the try and except.
https://forum.sublimetext.com/t/how-to-get-visual-studio-code-like-intellisense-in-sublime-text/42956 read this tho
Hi, weโve tried some of the sublime intellisense packages but none of them is working as good as the visual studio code built in intellisense, can anyone please have any directions or steps to take to get the same visual studio code like intellisense, at least for JavaScript, in sublime text. If thereโs no way to get vscode like intellisense in...
already have pyright lmao
did u say meh
What's that random \ฬ on line 26?
not targeted to the person named meh
meh
why wouldnt it?
Doesn't it give you an error?
its just not highlighted because of his color theme
deployed now how to run on heroku
What is it?
I just pointed it out!
@slate swan
bro how is it not defined
The token
youre trying to call a set obj
await send.delete() what's send
Do u have runtime.txt file?
Also @bot.commands wut
fair point it should be sent
no.
Oh k
what do i need to put in
U need it, it tells heroku to use "the language inside the file" whatever that is
doesn't heroku only need procfile
Nope
i hab
and requirements
Hey @slate swan! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
@slate swan i have deployed it but??
how to remove??
or somethnh
remove wut the rep?
ye
eh just click on diconnect?
alr
huh?
lemme show u
no
i know
Mmm
i was not telling "huh?" to u
Oh
a guy just camed
and doing "!await channel"
so i reacted

!await sparky.ban(reason="idk")
Failed to build backports.zoneinfo
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
hu
You need a library? Idk @slate swan anyidea?
bruh?
Are u usinf cogs?
huh?
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
tf
too late
what was that
no idea
ur were the last hope ๐ฅฒ
Can i see wut ur Procfile and requirements files look like?
@junior verge
why u added?
"anything happen"?
๐
hate to see it
Thats a good way to learn coding hehe just dont copy the whole code and paste it

thats what he's doing
ig
Ye wait nvm
@slate swan add backports to your requirements.txt
Hey @slate swan! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
it's not a good way for dpy
god zaidorox how many times
i mean he should learn py basics b4 learning modules
only "backports" ?
stack overflow exists
so why learn to code
yes lol
I mean, add it too
your prefix is +
what are they
not _
try +name
rip yt + stack overflow = ๐
such false naming
and it's member.add_roles, not role
add backports to your reqs.txt
@slate swan
ok

nah
def name(self, ctx)```
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
dont mind ik many useless
proc file = worker: python main.py
@slate swan
MASS PING
Wait lemme get my glasses i cant see ur codes
looking for my glasses
cap
..
@slate swan dont read that
i just copied whole github website
there
Oh thank god lmao
read this
It looks ight
i did this lmao
๐ญthats why i couldnt find my glasses
is that all your dependencies?
lol
you probably donโt even use 1/4 of those for the project
this is why you need a venv
yu
do this cause error?
?
You are basically saying those packages are required but they arenโt used in the project
you are going based off your globally installed packages
You need to isolate your dependencies to one encironment
ok
!pip pipenv
yeah
does requirements.txt support semantic versioning?
Itโs a versioning scheme/convention
yeah
ERROR: No matching distribution found for backports
๐ก
๐ฅฒ ๐
f
do some web search ๐
hm
What are you deploying on?
googling errors is very bad expe for me
HEROKU
Donโt host bots on herokuโฆ
?
does type hinting this, change the type?
async def func(ctx, member: discord.Member):
...
cool
ig*
no?
Type hints are just hints, it won't convert something
they are just for the readability
you need to use converters
for actual conversion of data types
;-;
so every arg already all attr of discord.Member?
ok
ash i cant find something
the ones where they tag
sadly
That is saying that func is expecting an input of a discord.Member
dpy converts the string to the obj
very sad
if a server doesnt have an avatar it returns None.. so how can i display another image in place of that in set_thumbnail
Check if it returns None, and if it does use another.
i cant use or ?
no
url = ctx.guild.icon.url or "link"
Like```py
if member.avatar:
embed.set_thumbnail()
else:
embed.set_thumbnail()
!d discord.Member.display_avatar
property display_avatar```
Returns the memberโs display avatar.
For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.
New in version 2.0.
if ctx.guild.icon.url is None:
em.set_thumbnail(url="https://logos-world.net/wp-content/uploads/2020/12/Discord-Logo.png")
else:
em.set_thumbnail(url=ctx.guild.icon.url)
``` this works too right?
Sure, test it.
I don't think ctx.guild.icon.url is a thing, but alright.
it is
Great
.
it is in v2.0 and above
@unkempt canyon's doc command uses master docs
icon_url was deprecated in 2.0
That's sad.
Well, then. How do I do it?
I have wrote a context.
But I am confused as to how to add the reaction or reply to the text with emoji.
It is but the problem is if the guild doesnt have the icon it will raise an error
what do you want to do? show your code till now
can I manipulate the size of the embedMaker?
for example I would like to make so the image is bigger and maybe accept .dds images
you can't
I haven't wrote anything to be honest.
D_D
I can't to neither? 
embeds are discord models pre created, you can only set their parameters
@client.command
async def emoji(ctx, arg):
"""
:param #Send some x emoji to y.:
"""
ok 
This is all I wrote lol.
What to do next?
You want to get the server's emotes?
!d discord.Guild.emojis
All emojis that the guild owns.
uhm there are some difference between custom roles and unicode emojis, what the args will be?
if it will be bot you'll need a lot of checks, you will need to use regex to check for custom emoji
I just need to send one emoji as of now.
Whenever I tell the bot to text, it will reply with emoji.
This is what I want to do.
Yeah but server emojis and unicode emojis are completely two different things
then make a list? And use random.choice? Idk what you really want
Traceback (most recent call last): line 2, in <module> from discord.ext import commands ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)
Suppose I tell the bot to reply to the other person's text with an emoji.
lol making a list of all unicode emoji will be a very long list
There are some package which implements unicode emoji, he could find one of them
I just want to send 1 emoji. ;-;
Didnt know that ๐คญ
Just tell me this, how do I make the bot to respond to someone with my command?
does anyone know why i keep having this error Traceback (most recent call last): line 2, in <module> from discord.ext import commands ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)
Do u have discord.py installed?

if you just want to send a specific emoji you can do like this:
@bot.command()
async def emoji(ctx: Context):
ctx.send(":smile:")
How do I send this to a specific person?
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
its a coro
anyways bye
Sorry master xD
@dull sorrel this will send a private message to an user
For example ```py
import random
array = [] #list that has emotes/or use an api/library to get 'emotes'
await ctx.reply(random.choice(array))#'random.choice chooses 1 element from the list ```
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="!")
@bot.command(name="hello")
async def hello_world(ctx: commands.Context):
await ctx.send("Hello, world!")
whats wrong with this code??
I want to send in the server not privately.
!d discord.Message.reply then this
await reply(content=None, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").
New in version 1.6.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") or [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") instead of `InvalidArgument`.


i wanna see what he will do with this so don't reply to him with the code please D_D
.
Also I want to match the author.id, where do I add this?
@fresh iron
Nope
hmmm
wonder what you installed
then wtf did i install instead
Lmao idk
!pypi discord
A mirror package for discord.py. Please install that instead.
C:\Users\ramzi>pip install discord.py
Requirement already satisfied: discord.py in c:\users\ramzi\appdata\local\programs\python\python310\lib\site-packages (1.7.3)
i believe i have that installed too
Uninstall both and install dpy again 

Traceback (most recent call last): File "c:\Users\ramzi\OneDrive\Desktop\Ramsaist.py", line 2, in <module> from discord.ext import commands ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)
okay
To reply with emoji to the specific person?
The problem might be ur ide and where it install dpy
do you know what that can be fixed through
not really a discord.py question but, can anybody suggest some nice math solving api's
and preferably, it should be free
Wolfram Alpha maybe

ping me if you need help
๐
