#discord-bots
1 messages · Page 820 of 1
ye
alr
do you know how i can make a command where i can only use it?
or admin perms can only
i am new to this
where would i put that?
put it below bot.command
pls
A Python file
alrrrrrr
with the name sax lol
i know
Thank you
if ur the owner you can use bot.is_owner
i never coded or known a thing such as "sax"
If you didn’t make it be weary
?
could be a Trojan horse lmfao
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Anyone know how to fix discord.ext import commands not working
It's off topic
I doubt it’s like a Python source file or whatever
Can you import discord normally?
But ye ot
Disnake, made a type
But import disnake works fine
u serious
Go to an off topic channel
i got a virus from vscode?
Let's see the error
Then import it?
How would I make it so my bot capture s a live video feed from my then stream it to a voice channel?
Audio and video
I have from disnake.ext import commands
But it like doesn’t realize that file exists or smth, and won’t load it
wait whats the code to like whats the current member count
!d discord.Guild.members
property members: List[discord.member.Member]```
A list of members that belong to this guild.
!d discord.Guild.member_count
property member_count: int```
Returns the true member count regardless of it being loaded fully or not.
Warning
Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified.
Shouldn't my method also require member intents?
Can anyone help? Bot isn't responding to commands.
@bot.slash_command(guild_ids=[guild.id for guild in bot.guilds])
async def load(
ctx: discord.ApplicationContext,
cog: Option(str, "Cog to load", default="all"),
log: Option(bool, "Whether to log or not", default=True)
):
"""Load / reload bot cogs"""
await ctx.respond("Received")
yeah it does
Task was destroyed but it is pending!
task: <Task pending name='discord.py: on_message' coro=<Client._run_event() done, defined at C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py:349> wait_fod\client.py:349> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x0000027273AEEF70>()]>>
``` - this logged in the terminal and it said it was the cause of a wait_for but i did not even use it anywhere
Yo guys ik how to edit a channel's general perms, but how do I overwrite one to add a user be able to.. lets say send messages?
something like
perms = discord.Permissions()
channel.edit(member.perms.send_messages=True) 🤷♂️
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 1.4: The `type` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
you'd want to get the existing overwrites for that member, change the overwrite, and then update it through set_permissions(), e.g. py overwrites = channel.overwrites_for(member) overwrites.send_messages = True await channel.set_permissions(member, overwrite=overwrites)
How would I make it so my bot capture s a live video feed from my camera on my computer then stream it to a voice channel? With both audio and video?
I know it was suggested to learn more python, but I do know why my script wouldn't stop crashing.
Even though I keep getting told by pip that discord.py is installed. Trying to import the module through the Python command line app doesn't work saying ModuleNotFoundError: No module named 'discord.py'
how can i stroe message objects in my db?
chances are you installed discord.py in a different env
I don't believe I have any environments.
different python installs?
I do have 3.9, 3.8, and 3.10 installed, should I uninstall some of them.
Or just check the console apps for all of them?
how do you install discord.py?
It's imported as discord
i.e import discord
yeah that
Oh, that appears to work.
bruh
In command line.
Having different versions isn't an issue if you're using virtual environments
I am a moron.
how do i stroe message objects in my db?
Why?
who?
You're asking for help and moderators love keeping this chat peaceful. I suggest you think about what you're going to say before you say it.
mhm
???
Never said you did anything. Just saying that preemptively
i stand correct
i dont know what you mean by this
how do I stop bot after sending msg to specific channel
I really don't like using exit()
pyhton is the crying in the error log
how do i stroe message objects in my de beh
Why do you need to?
because why not
You can just store the message id and fetch it later
yeah how
Ehm
Well it's different for every data base
You can get the message id with:
im using post
The message ID.
!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.
I will see myself out
bot doesn't have a fetch_message , need to use a messageable

how do i fix
You have 2 bot instances running. Easiest way to fix it is to reset your token
theres 2 instances of your bot running
damn
Then what's the point of that huh?
point of what
why do you need to fetch a message from the channel you don't have acess of
okay what if i only has access to the message id, NOTHING else
you need a messageable object.
and if i dont have it?
Then you don't get the message
why not
Because you need a messageable object?
can you get inside your school's classroom without going to school?
But that's not your school's classroom
"get inside" , that's y u attend offline classes.
i said online learning
You're still not inside the classroom
i can still see it's contents /shrug
yea so cache the messages then.
okay
tho it resets everytime the bot restarts
How do i make a command where it goes like $pickup {url} me vs someone
Idk what does it take to save the channel id along with the message id for u
say im on a tight quota over here lel
@bot.command(aliases = ['bday', 'wish'])
async def birthday(message, user: discord.Member):
embed = discord.Embed(description = 'Happy Birthday {} :)'.format(user.mention), color = 0xFF5733)
if user.id == str(768393728163053619):
embed.set_image(url = 'https://cdn.quotesgram.com/small/40/18/770733425-NellaLlamaBD2012.gif')
else:
embed.set_image(url = 'https://media.giphy.com/media/SXPwY2Uvhd38Y/giphy.gif')
await message.channel.send(embed = embed)
tryna make it use one gif if a certain person in pinged
otherwise use the default one for everyone else
i keep getting the default gif tho
!e print (1=='1')
@slate swan :white_check_mark: Your eval job has completed with return code 0.
False
that's y
are you subclassing the Bot?
Yeah.
async def on_ready():
print('------')
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
async def on_member_join(self, member):
guild = member.guild
if guild.system_channel is not None:
to_send = f'Welcome {member.mention} to {guild.name}'
await guild.system_channel.send(to_send)```
Any other reason it may not work.
why subclass client and not use the Bot class which is a subclass of it already?
This is the New_member example script.
Just experimenting with it, but this part isn't working.
wut
how do I stop bot after sending msg to specific channel
I really don't like using exit() since
python is the crying in the error log
https://github.com/Rapptz/discord.py/blob/master/examples/new_member.py It's an official example.
you mean a member join?
it's just supposed to be status message after file encryption
Yeah.
How would I make it so my bot capture s a live video feed from my camera on my computer then stream it to a voice channel? With both audio and video?
any idea why get_cog is returning none, it was working before i updated the lib
i think theirs a disconnect coro
How do you run the bot?
I just double click the .py file.
Make sure it's like py client = MyClient() client.run(token)
async def on_ready():
print('------')
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
async def on_member_join(self, member):
guild = member.guild
if guild.system_channel is not None:
to_send = f'Welcome {member.mention} to {guild.name}'
await guild.system_channel.send(to_send)
intents = discord.Intents.default()
intents.members = True
client = MyClient(intents=intents)
client.run('token')``` is my whole script
It's an example script.
its so easy to do it with the Bot class🏃
what do you mean?
I think I have tried the one from the docs but it looks like it doesn't actually end the script
😦
^ need help
yeah it doesnt it disconnects the bot
But this part is where it keeps giving an error.
print(f'Logged in as {self.user} (ID: {self.user.id})')
and the error is
undefined name 'self'
What version of discord.py are you on?
Latest.
Oh nevermind
More specifically 1.7.3
You don't have self inside on_resdy
so should I run that?
because you didnt pass in self, every function in a class begins with self
and then possible run exit()
async def on_ready(self):
...```
Ahh.
and also you didnt call super().init
super init the super class
so self.user won't work
Any idea on my question?
Got it.
if you dont add the param the method wont access the class attrs
^ need help
Thanks.
Show code
hey nova👁️👁️
Hey
i have no wait_for that's why im asking here...
hyd👁️👁️
and the traceback didnt point towards my file
when did it start coming
like after i added await view.wait()
That's not necessary, atleast based on the examples on the docs
ah okay
I am assuming you don't have a clue on my question?
!d discord.ui.View.wait
await wait()```
Waits until the view has finished interacting.
A view is considered finished when [`stop()`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View.stop "discord.ui.View.stop") is called or it times out.
You can't have an empty name and empty value for add_field, at least not the way you are doing it. You can either use "\u200b" or ** ** inside of the name and value fields
🙏 started working on voice support for rin
we really bouta get voice before I do commands
you talking to me?
Yes I am
Oh wait
embed=discord.Embed(title="GFFL Assistant", color=0xffffff)
embed.add_field(name="", value="", inline=False)
embed.add_field(name="Status:", value="Bot Is Ready To Help!", inline=True)
embed.add_field(name=" Latest Updates", value="Added More Commands To Our Bot", inline=True)
await ctx.send(embed=embed)
bro.
you could have completed the basic objects first so the library would have been ready for development purposes
Uk, hikari has no voice support natively yet, and is still being used
still not work when i use the command -status
It's not scalable to do models right now! So I wanted to do all the easy stuff I can do such as backend, then hopefully make models scalable, then do them all in one big commit
Brandon is also hopping on core development so we gonna have two core developers!!
Maybe that will make things go faster
what is broken now?
And okimii will teach how to use rin
yes
You still haven't done what I told you to
Rin on top 
i got the embeds from gen thing
Read this
Sarthak you should contribute as well 😔
imma add rin to my nickname alongside hikari as my first contribution
sarthak is very smort with his stuff ngl

dont ask how i know😳

Free ad, I'll take it ig
😔
no
🙄
i am trying to make a serverinfo command
but i am new to coding so
also thanks for the help i fixed it
lemme tell that in an easier way, you cannot have an empty string "" as the embed field and value
you need to an invisible character , which is \u200b if you want to do that
If I do well enough on understanding, I can probably start working on voice receive could reference blankets half implementation from my older wrapper
I don't understand why people directly start writing discord bots without actually learning the language first
I Been coding for 2 days ik how to make a mute command and some other stuff
If you are a beginner, a discord bot is not the best project
Because you took code from stackoverflow and altered it
You cannot effectively create things with only 2 days of experience
This applies to most things in life
^
@bot.command()
@commands.has_permissions(manage_roles=True)
async def mute(ctx, member:discord.Member,*,reason='No reason provided'):
muted_role = ctx.guild.get_role(908917566523731968)
await member.add_roles(muted_role)
embed2 = discord.Embed(title='You got muted',description='You have been muted in the Chill Zone for '+reason,color=discord.Colour.dark_orange())
await member.send(embed=embed2)
string = str(member)+' has been muted for '+reason
embed = discord.Embed(title='Mute 🔇', description = string , color = discord.Colour.green())
await ctx.send(embed=embed)?
this is from stack over?
The concepts, probably
You cannot make something like this with 2 days of experience
I'm not saying you directly copy and pasted
why you mad? i use to code before
Okay calm down here
But you took the concept, applied it and made your modifications
i didnt take crap
@balmy ivy what's the issue?
mans mad that i can code a mute command in 2 days
of coding
Leave that
chill down, he is asking issue in your code
Are you having a problem with yr code?
no
I'm not? I'm just pointing out you didn't make this from scratch
Let's just leave it @final iron
...
???
can u guys stop
i didnt start anything
just dont reply.
@final iron @balmy ivy stop or I'll have to ping the mods
bro i didnt do anything
okay, now just dont reply so the convo doesn't go on
Unironically cringe
Stop replying to him. Simple
exactly, dont do anything
fr tho
Just tryna calm this channel down
Well yk just by saying calm down no one will actually calm down
Smh leave it. Let's drop the topic
lol
just saying guys that if you can do something it doesnt mean you can do it well
¯_(ツ)_/¯
okimii the topic very well ended
lets not spark it back up
just making a suggestion
sigh
¯_(ツ)_/¯
Lemme give you some suggestions real quick
First, after a comma in the parameters of a function there should be a space
the code works fine
PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.
More information:
• PEP 8 document
• Our PEP 8 song! :notes:
I have a feeling you're just going to ignore pep8 so:
Check out f strings
!f-strings
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
Makes your code a lot easier to write and a lot more readable
wait brb i gotta do sum
Also, consider using the timeout feature or using get() to get the role instead of hard coding it
Hard coding is usually bad (when you have the option to dynamically code something) and it is in this situation you should be using dynamic code
The whole command is hardcoded basically, it's safe to assume this bot is only for that specific guild
Plus, utils.get is a lot slower than get_role
Way, way slower
How much?
Well, don't need to time it to know it's slower
Imo even if it is for 1 guild you should dynamically code it
Wait O(n) means the time goes up everytime an element is added, right?
Or am I getting them mixed up
damn
If your code is exponential, either you are doing something that requires it, or you did something extremely bad
Why?
O(n**2)
Exponential time is like, one of the worst time complexities you could have bro
Can you show me an example of something that has an exponential time complexity?
😩
You do know this ain't the correct channel for that right?
^
Channel is dead rn
Andy you ain't getting helper this way bro
😔 what
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Is it possible for me to retrieve a list of all the instances of a certain View class? (Nextcord)
Google fibonacci numbers
recursive strategy doesn't even give exponential iirc for fibo
n = [1, 2, 3, 4, 5]
for i in n:
for y in n:
pass
I'm getting this error
AttributeError: 'NoneType' object has no attribute 'send'
the code is
@Client.command()
async def wow():
user = Client.get_user(userid)
await user.send('👀')
how do I fix it
Oh yeah, that's very bad
Hm, it looks like that file might've been a virus. Instead of cooking up trouble, try cooking up a Chicken Tikka Masala: https://www.epicurious.com/recipes/food/views/chicken-tikka-masala-51171400
user is None
Code?
Code
user is none ?
Oh mb
but I've used userid it still didn't work
Is the user in the bots cache?
@slate swan u forgot self
@Client.command()
async def wow():
user = Client.get_user(743866731839225958)
await user.send('👀')
it should work right ?
No. The user might not be in the bots cache
That's a very edge case tbh
but when I use a channel it works
That was his error above
Unless the id was wrong
the id is right though
User isn't in the bots cache then. Consider using fetch
File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs) \client.py", line 343, in _run_event
File "d:\Project learning AI\discordbot1.py", line 22, in on_ready
await command()
File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 374, in __call__ \ext\commands\core.py", line 374, in __call__
return await self.callback(*args, **kwargs)
File "discordbot1.py", line 48, in wow
await user.send('👀')
AttributeError: 'NoneType' object has no attribute 'send'
here's the full error
camelCase should never be used in python
?
Yup it is
how do I use fetch though..
U r specifying a string, not an int
any example ?
user = await.Client.fetch_user(...)
oh thanks
!d discord.ext.commands.Bot.fetch_user
await fetch_user(user_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.
Note
This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_user "discord.ext.commands.Bot.get_user") instead.
Anyone?
Use typing.Union so it doesn't throw an error
instances of the class?
Imma explain more
Then perform a check. If hostname is a string then do whatever you want i.e return the function
why not
?
PEP8
you cant make a number a word
pep8 ain't enforced, stop forcing people
It should be followed
yeah i did lmaooo
It's there for a reason
pep8 references it, and allows it for style consistency, also bringing to the point that coding style depends on who's repo you are contributing 2
still optional
Most people just aren't aware of it or are aware they're breaking it
Ok so, I have a View subclass for controling some embeds. They need a user parameter (not interaction.user), and I wanna find a way to make sure it has the user parameter given properly whenever I reset the bot (persistent view). I thought of just making a .db file with data of users, and loop through while I inserting the data. How do I go about getting a list of all the instances of the subclass I mentioned earlier? (So I can loop through it)
why loop through the instances if the class needs the user argument?
yes, most beginners don't even know what "pep" is
Um?
I said it doesn't need the interaction.user for user
It needs a separate user, hm
ik but why go through the instances of the class? to check the users orrr?????
Nonono
ah sorry
How do I explain this, um
Lemme give context, this for a Application command, and the view subclass I mentioned is the Accept Decline Buttons attached to each application.
ok
the class needs the user object of the person who sent the application
ok
I wanna find a way of inserting that exact user object to each instance of the Accept Decline button
So I can add persistent views to it
a user argument in the class?
I added a custom user parameter in the class' __init__ definition
The one who clicks the button? U can use inter.author for that
maybe he wants to make a ban command or something since he has Accept and Decline
No..
?
There's a separate user object for the person who wrote the application
No, it's for an application
ah for like a role of some sort?
Yessir
well you just pass the member in the class initiate
There's an issue with that
There'll be multiple application messages with multiple copies of that view
each will definitely be from a different user who wrote the application
@dreamy sluice have u looked into modals? If u wanna make an applications submission bot.
?
U making an application submission bot?
Yea
Using disnakw?
Nope
Then?
Nextcord
Ask about the discord modals support
Tis in a pr
If I had to guess it'd be a week or two
Oh ok
I contrib, but mainly just help out around the dc a lot
Ah
Hunter since you are here how do I get the master branch of disnake?
Directly install it from github
Could you elaborate please?
:O
Wdym?
pip install -U git+URI
``` `URI` being the repository link, this installs the main branch of a repository
pip install -U git https://github.com/DisnakeDev/disnake
isn't it pip install -U git+https://github.com/DisnakeDev/disnake@master?
Also, if it says git is not a command, all I have to do is add it to PATH right? Excuse my lack of knowledge on this though lol
i dont use git lol
Since that's the default branch
Yes, add git to path
Or
I got another way
Download the repo from the Download code button, then extract it to a folder, and in the root of the repo in yr pc, just run the command python setup.py install
and in the root of the repo in yr pc what does this mean?
The extracted code basically
So go to GitHub
Click on Download Code
the folder where the github files are located in
A zip file will start downloading
makes it easier if you have git tool
git clone URL would just make a new folder in that directory without any messing about
git bash right?
No
windows
Okay so seems like u r getting confused
then you'll probably have to download it
then run git clone URL which will make a directory with all the files from the repo
Or if u have git installed, just pip install it directly
it's not this right?
because I recall downloading git and then that coming up
okay thank you
Do you mind telling which one to click?
just the default
What does this error mean?
ERROR: Cannot unpack file C:\Users\tenuk\AppData\Local\Temp\pip-unpack-g958kowo\disnake (downloaded from C:\Users\tenuk\AppData\Local\Temp\pip-req-build-8h6lfx89, content-type: text/html; charset=utf-8); cannot detect archive format
ERROR: Cannot determine archive format of C:\Users\tenuk\AppData\Local\Temp\pip-req-build-8h6lfx89
I downloaded git and ran pip install -U git https://github.com/DisnakeDev/disnake in the command prompt
@maiden fable ?
They are in built forms discord added
a way for bots to create forms
docs: https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
rough example: https://gist.github.com/JeyyGit/2618ca611a2ac2955d2d193b68c214b7
Rough implementation of modal in discord.py 2. GitHub Gist: instantly share code, notes, and snippets.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
2.3.2 is the master branch version right?
Yea iirc
Oh, that's not the issue-
I am not having trouble with making the application command
I am having issues with trying to create a persistent view for the Buttons in the view which accept or deny the application.
@maiden fable ^
Hmm, well what I want to say is, instead of doing this with buttons, u should use modals since they provide a better interface for the same
I wanna stick with buttons tho
Oh, okay. So u want to make the view persistent, but with the user arg in it?
Exactly
ouuh are modals pushed publicly
Yea
Hmm, I don't really think that's possible, afaik tbh

hm
let's hope it isn't more than 1 day
oh
You add that and I add voice recv
this is actually easy as hell
Lmaoo
lmaooo, this basically has the same things as select menu
Guess I just gotta change the component type
Yes! Let me do the v recv work you do that!
no lol
A dapi wrapper

.. the link
!pip rin
?
how did he got a pic of andy?
🦅
What

LOL BRO
He got bozo's cat
BOZO CAT
From where did you get that
the drip tho????????
I'll add text modals 2morrow
no it's almost 0000
I will make a voice recv pr before that

No bitches

You will get no core pr!
😔
it's not like your opinion matter anyways, I will make pr before you wake up!
damn #nova'slifematters😔
Lmaoooo
Then Andy be like: Good work Nova! I love it
Anyone has a modal example for disnake?
i keep reading it as model and not modal
🤨
from disnake.enums import InputTextStyle this cannot be imported why?
Does modals even work properly
I get a invalid type error when passing 4, the component type for text modal lmao
Lmao
Yep, lmao getting an invalid type when the docs say it is 4
holy shit I'm dumb, I wasn't reading the error message right
It is supposed to be an interaction response
Who pinged me?
Seriously?!?
Idk, check yr mentions
Wait what
?
am back
was changed to TextInputStyle within that pr
hi arl
hi
hyd?
monky
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = prefix)
prefix = "!"
tok = "token"
@client.event
async def on_ready():
print(f"logged in as {client.user} and everything is ready")
client.run(tok)
so whats wrong with this code
Its probably an internal error, you can reinstall dpy again 
i did
Bots can’t send friend requests and self bots are not allowed
seems like its an internal error with dpy
Hello.
I have a question - how to add categories to the help command as in the screenshot?
By default, those are categorized as per their cog class
I'd suggest going for a custom help command, if you wanna make changes to that
check pins for a guide on making a help command
I have a doubt... Any idea on how to make discord bots verified? Like how you can make others invite it?
there's an option in the dev portal to make it a Private Bot, just turn it off
it's off by default though iirc
Nah, it is public
Like few of my friends have invited it
It is in like 18 servers
:(
It needs to be in 75 or more servers to get verified
This is my bot in case u want to see it... https://github.com/QwertyIsCoding/QwertyBot
And there is another issue where it does not send welcoming messages in dms
Idk why
Yeah it is, then what's the issue here?
on_member_join only takes a member argument, remove ctx and do member.send instead
!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") leaves or joins 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.
!d discord.Member.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=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.9)") 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.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
O-o
hey. I have this command but i want to make it into an ephemeral. I tried these two things, but both give errors. ```python
user = ctx.author
emb = nextcord.Embed(title=f"✅ Success", description=f"Άνοιξες με επιτυχία το ticket σου! {user.mention}", color=0x00ff00, timestamp=datetime.now(), ephemeral=True)
emb.set_author(name=j1mk0l.user.name, icon_url=j1mk0l.user.avatar.url)
await ctx.reply(embed=emb, mention_author=True)
```python
user = ctx.author
emb = nextcord.Embed(title=f"✅ Success", description=f"Άνοιξες με επιτυχία το ticket σου! {user.mention}", color=0x00ff00, timestamp=datetime.now())
emb.set_author(name=j1mk0l.user.name, icon_url=j1mk0l.user.avatar.url)
await ctx.reply(embed=emb, mention_author=True, ephemeral=True)
you can't make ephemeral messages like that
and that kwarg (ephemeral) is for buttons/slash commands only
i am facing an issue with google api v3
ohh okay i see. Thanks
❤️
Whats wrong?
the bot is not sending update embed whenever i update something on blogger
embed = discord.Embed(
title='Media/link Sent!',
thumbnail= message.author.avatar_url #this
color= random.choice([0xfc0303, 0x03d3fc, 0x03fc07, 0xd7fc03]),
description=(f"""
ID = {message.author.id}
User = {message.author.name}#{message.author.discriminator}
Display Name = {message.author.display_name}
channel = <#{message.channel.id}>
==============================================="""))```
does anyone know how to insert thumbnail in this embed? or just use separate embed.?
!d discord.Embed.set_thumbnail
set_thumbnail(*, url)```
Sets the thumbnail for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
"import requests"
?
Why do we need asynchronous programming?
Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.
What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:
import discord
# Bunch of bot code
async def ping(ctx):
await ctx.send("Pong!")
What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.
async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!
hey. I am trying to make a clear {x} slach command using nextcord. This is my current code. How can I make a sub command so i cant type the number of messages to be deleted? ```python
@j1mk0l.slash_command(name="clear", description="Clears {x} messages.", guild_ids=[serverID],)
@commands.has_permissions(administrator=True)
async def clear(interaction : Interaction, amount=2):
await interaction.channel.purge(limit = amount)
user = interaction.user
emb=nextcord.Embed(title="", description=f"O {user.mention} έσβησε {amount} μηνύματα.", color=color, timestamp=datetime.now())
emb.set_author(name=j1mk0l.user.name, icon_url=j1mk0l.user.avatar.url)
await interaction.response.send_message(embed=emb)
wow nextcord
you want to the amount to always be zero?
so it wont remove anything by default
no. For example in a regular command it would be {prefix}clear 10 and it would delete 10 messages
Also I don't recommend restricting commands to administrator for clear commands like that
Hello.
How to force a bot to delete a message after sending a command?
For example, you send the command ?hello to the chat, the bot deletes the command message and writes "hello" to the chat
How do I grey out all the buttons in a view?
disable?
discord.ext.commands.Context.message.delete() or Context.delete()
ash knows she can help you :))
Thanks
Do await <context>.message.delete()
Ik, some people started arguing with me about it
I tried button.disabled = True, but it didn't work
lolll
you need to edit the view
Oh-
view=self
And style to ButtonStyle.disabled
= Truwue
!d nextcord.ui.View.children
The list of children attached to this view.
Use isinstance
no?
And set the style to ButtonStyle.disabled
Its sometimes gonna fail the embed ig
Don't they wanna grey out the buttons?
it does it on default
Huh? Isn't the default one green?
somewhy this doesn't work thumbnail= {message.author.avatar_url},
message.author.avatar.url
??
no when it gets disabled it grays out on itself
Yea, ik
By greying out, I meant to disable them
lol
confusion
if isinstance:
for i in self.children:
i.button.disabled = True
This?
No
for child in self.children:
child.disabled = True
for child in children:
if isinstance(child, ui.Button):
child.disabled = True
o h
ButtonStyle.disable actually disables the button, or does it just give it that style?
Disables
import pycord
@pycord.uwu_command()
async def hunter_uwu(huwunter):
hunter_dedicated_uwu_embed = pycord.Embed(title="Hunter uwu")
if huwunter.author.avatar: embed.set_thumbnail(url=huwunter.author.avatar.url)```
huh?
Okeh, lemme try it
😐 Ash, don't tell me u write code like that
lol
Nah, i just wrote it so it looked handsome and uwu like you
@maiden fable AttributeError: type object 'ButtonStyle' has no attribute 'disable'
Okay, ig
disabled*
oof
My bad, sorry ;-;
ash do you actually use pycord🏃
Wait, I don't think ButtonStyle has a disabled attribute-
Yes, its the best
Only the button object has that attribute
@maiden fable
Oh hmm
property disabled: bool```
Whether the button is disabled or not.
Then disable that. My bad
ash change to disnake
Or whatever. I'm confused
Her wish haha
lol
make (slash) commands in disnake, embeds with pycord, bot constructor with dpy, typhint with nextcord, run the bot with hikari
Easy
👁️👁️
Uh, it didn't actually disable the buttons-
You need to edit
Actually I tried that once...
Same-
what do I put in msg.edit()?
No...edit the interaction
Huwunter will help
It worked for me. The reason being, I used the things which were common in all of them since they are all forks of dpy 2.0
view=self
like adding a view but it updates it
Lol my dunbass brain once import dpy and disnake together, and I made everything in disnake except embeds woth dpy
Lmao, yea that results in errors since disnake has added more stuff to the Embed class and how the internals handle embeds
🧑🦯
Welp, wait, does disnake have anything new for the embeds?
Yes
They have changed the internals too a bit
what new for embeds?
Nothing uhh
👁️
Little things, like, iirc, there's a special method to set local pics in embeds
And stuff like that ¯_(ツ)_/¯
thats cool ig
No need to do attachment:// anymore
Thankfully
lol
Am i weird or is it just fine?
disnake.Embed(title="uwu").add_field(name="Hunter", value="uwu").add_field()
you're weird
yeah i do it like that
Oh, hmm. Could be the behavior changed
Me who has done send(embed=Embed(...)....)
embed is just an instance so why not use the method in the instance of the class?
Same lol
same🏃
no that was not what I meant
i do both ways
sparing variables is good sometimes
yeah
and I doubt you'd use the same embed in a command twice
Ah yes, it allows chaining
:/ yeah, Shorten code, just less readability
it returns self
ey this is a rare moment
still saving memory
rush being here
Yeah lol
And @final iron screaming 👀
frrrrrrr
Yea, he's here once in a while now
I've not been doing much discord bot development these days 😅
Lol
Same
U r making a discord ripoff chat app
I can't... my raspberry... it's broken
the disrespect
Yeah, you spend 6 hours and 41 minutes a day chatting with HunAI
Actually, no
the app is copied inspired by discord
I haven't even opened its source since 2-3 months
cof cof
with an actual good api🏃
seems fair
don't start about something Sarthak used to say, please
identity theft is not a joke
your about me can be better
no need for when_mentioned_or(None) just use when_mentioned
discord.ext.commands.when_mentioned(bot, msg)```
A callable that implements a command prefix equivalent to being mentioned.
These are meant to be passed into the [`Bot.command_prefix`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.command_prefix "discord.ext.commands.Bot.command_prefix") attribute.
lol
what do I pass in it then
nothing
great
lol
I should call it shouldn't I
yes ofc

its not a property
Yea
Because it needs args
The bot and the message.
So the library automatically calls it in on_message
can't wait for discord to slam a banner for bots too
why cant you wait its just banners
hm nice
indeed
So true
Need help.
The bot code broke. I don't know why, because before that everything worked correctly.
P.s. I didn't edit the code.
def __init__(self, client):
self.client = client
@commands.command()
async def join(self,ctx):
if ctx.author.voice is None:
await ctx.send("Сперва зайди в голосовой канал")
voice_channel = ctx.author.voice.channel
if ctx.voice_client is None:
await voice_channel.connect()
else:
await ctx.voice_client.move_to(voice_channel)```
did you loaded the cog and added it?
Yes
@maiden fable all yours
client = commands.Bot(command_prefix = "?", intents=discord.Intents.all())
for i in range(len(cogs)):
cogs[i].setup(client)```
load_extension(name, *, package=None)```
Loads an extension.
An extension is a python module that contains commands, cogs, or listeners.
An extension must have a global function, `setup` defined as the entry point on what to do when the extension is loaded. This entry point must have a single argument, the `bot`.
so u gotta do client.load_extension(cogs[i])
Hey @shell wing!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
anyone willing to test out my bot and give soem tips and feedback for it?
https://paste.pythondiscord.com/bayaviniyi.xml
im getting this error whenever i start my bot
Hmm. Maybe this is due to the fact that I added a custom help command?
I told u the issue
^^^
anyone ?
U got ratelimited
Where to insert client.load_extension(cogs[i]) ?
how ? im not resttarting my bot again and again
and like only 3 bots of mine are up
replit uses shared IP. So if someone on yr IP is spamming the API, then yr bot will also get ratelimited
and i got the premium plan so its a feature
I don't think u get different IP Addresses, do u?
no i dont think so i got diff machines and cpu
Umm...
client = commands.Bot(command_prefix = "?", intents=discord.Intents.all())
for i in range(len(cogs)):
client.load_extension(cogs[i])```
Yea, so u cannot do anything
wait no
so theres no fix to that ?
nope. U should get a VPS if u r willing to pay
understand
hmm its better than replit right ?
i have never used any vps
Its easy actually
can u suggest some vids explaining it ?
replit is borderline useless for your coding journey and bot
Need to remove cogs = [music] ?
If u got a credit card, u can get a free Oracle VPS with Remote Desktop Protocol iirc, and 24 GB RAM
U know, ik u r importing youtubedl
i dont have a cc im still a minor...
also, u need to do "music"
Ah okay. Well VPS's are paid
yea ive been facing too many issues lately
ig i can still spend a little...
Well, u need only 1 USD which will be refunded. Its done to check the authenticity of the card
ooh
There will be no free trial a company offers that doesn't require you to put in a credit card to prevent bots and ensure users are humans.
Yea
i can use my dads card...
from discord.ext import commands
import music
cogs = [music]
client = commands.Bot(command_prefix = "?", intents=discord.Intents.all())
for i in range(len(cogs)):
client.load_extension(cogs[i])
class music(commands.Cog):
def __init__(self, client):
self.client = client```
it wont be a issue...
Ah cool
DON'T import music dude
just do "music"
any setup or guide videos ?
There is Azure
Nope, oracle is a worldwide recognized company
If I don't import music, an error appears.
DUDE ITS A STRING FFS
alr thanks
Not sure how good it is, I personally use Contabo because it has better value for more powerful VPS', but if you need smaller ones (as a beginner), Hetzner's first option should be way more than enough.
Yups
Oracle Cloud Free Tier
Always Free
2 Autonomous Databases, 20 GB each
Up to 4 instances of Arm Compute
200 GB block volume
10 GB object storage
``` is it good its always free..
yea
Oracle is also almost as popular as Microsoft in other fields
I am a beginner in programming and don't know what FFS is.
oh alr alr ty
ffs = "for fucks sake"
Ok I am out
lmao
yep tho I think u need to pay a dollar before u get the server and they refund it, to make sure the card is real
Same with AWS but they keep the 1 dollar since if they start refunding it, then Jeff would start to become poor
yes
Pretty sure.
I've seen people pass "self_bot=True, reconnect=True"
I'm not sure what reconnect is though.
in what cases would it be useful?
the self thing
because i can't see a single point
unless ur using a self bot
Hey guys. how can I use await ctx.channel.send to sent a message to specific channel?
i see
xd
"discord tos follower" kinda sus af
guys im trying to make a minigame where the bot sends a random emoji
and 4 seconds later the message gets edited and asks you what emojis that was
but how would i wait for player input
the player needs to type the emoji name
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
if you don't know means you just copy pasted the code from somewhere
hello guys. How can i set channels by id with database?
nah I did it all my self
My brain is just broken atm
So why don't you help? 
what does the error say?
move
!d discord init
In order 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.
#bot-commands
save the discord.Channel.id in the database
hi everyone thats a json file
"channel_name_template": "## [@@game_name@@]"
i want to replace game_name with username
why do use JSON as a database?
Because its not meant to be a db
mongo doesn't suck
Yea ik
Edited the message. Was talking with someone else, so wrote the wrong message
What's MongoDB?
An online NoSQL db which stores data in JSON-like format/dicts
!pypi pymongo can be used to use the db
Python driver for MongoDB http://www.mongodb.org
Dude, no, mongodb is local, mongodb atlas is not local (online)
Okay
Was talking about atlas tho. That's the one I use most of the times, since no need to host a db
i think you can
And yes, what sir andy said

