#discord-bots
1 messages Β· Page 789 of 1
"how", do this ctx: Context. Same with error
error type
actually error would return CommandError, you can get the original error with the .original attribute
ah yea, my bad, that's an attribute of CommandInvokeError which can often raised
should work
typehint it to Exception
error (CommandError derived) β The error that was raised.
One message removed from a suspended account.
doesnt await ctx.message.delete() delete the authors message
doesnt await ctx.message.delete() delete the authors message
What are you trying to do?
delete the message
Show the code
that the person sent when he runs the command
#suggest command
@client.command()
async def suggest(ctx, *, reason=None):
role = discord.utils.get(ctx.guild.roles, name='suggest')
embed = discord.Embed(title='Suggestion not sent.', description='You need to wait till your previous suggestion gets accepted or denied.')
if reason is None:
await ctx.reply("Please enter a suggestion.")
else:
if role in ctx.author.roles:
await ctx.author.send(embed=embed)
else:
embed = discord.Embed(title="",
description=f"**Suggestion** : {reason}",
colour=discord.Colour.orange())
embed.set_author(name=f'{ctx.author}s Suggestion.', icon_url=ctx.author.avatar_url)
channel = client.get_channel(928950254798258196)
await channel.send(embed=embed)
embed = discord.Embed(title="**Suggestion sent!**: ",
description=f"**{reason}** | You will be dmed once a decision is made.",
colour=0xFFFFFF)
await ctx.message.delete()
await ctx.author.send(embed=embed)
await ctx.author.add_roles(role)```
it deletes a msg
are you trying to delete the embed?
depends on placement
nop
if so do py ctx.author.send(embed=embed, delete_after=5)
yes its a method
i already know that
.send is a coro
ty tho
Anyone have a good github project link for a super basic discord bot?
Want to learn by reviewing an existing bots code.
you mean a subclass of the Bot class?
First setup your bot. and just get it to send a message. plenty of YouTube tutorials
@client.command()
async def ban(ctx, member : discord.Member, * ,reason=None):
await member.ban(reason=reason)
print(f' {member} was banned')
@client.command()
async def unban(ctx, *, member):
banned_users = await ctx.guild.bans()
member_name, member_discriminator = member.split('#')
for ban_entry in banned_users:
user = ban_entry.user
if (user.name, user.discriminator) == (member_name, member_discriminator):
await ctx.guild.unban(user)
await ctx.send(f'Unbanned {user.mention}!')```
ohhhh i read that wrong
Essentially yes. I guess youtube's probably the best place to start from scratch
Within 5 minutes youll have an active bot. then you can play around with the basics.
it doesnt work?
Ignoring exception in command unban:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 48, in unban
member_name, member_discriminator = member.split('#')
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: not enough values to unpack (expected 2, got 1)```
no yt has allot of outdated code use this
https://vcokltfre.dev/
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
await ctx.message.delete()```
Thanks, I'll take a look.
okimii said ctx.delete.message() and i already tried ctx.message.delete()
nvm i didnt save last time
when
lol
Hello chat
hi
hi water
hes my enemy
a dogποΈ ποΈ
cats are better tho
im trying to make a unban command
how do I check if the time is negative ```py
hours, remainder = divmod(int(war.end_time.seconds_until), 3600)
minutes, seconds = divmod(remainder, 60)
await CLIENT.get_channel(937229714098110504).edit(name=f'TG-WAR: {hours}h{minutes}m{seconds}s')
because if the time is negative I want to change the channel name to something else
>>> cats_are_better_than_dogs
True
>>>
π³
Why not use the ids?
So there is a mp4 file in my bot folder and I want my bot to send it to me on discord is it possible using jsk?
yes
wait
send?
why do you want your bot to send instead of play it
so just, py {user.id}?
I just want it to?
!d discord.abc.Messageable.send use this
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**.
I asked if it was possible using jsk
yeah
Ik how to send something
And how is it?
No direct method?
I don't think so
Oof
you always have to use discord.File to send files local or non-local
could be another way but idk
Oof
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.9/site-packages/jishaku/features/python.py", line 149, in jsk_python
async for send, result in AsyncSender(executor):
File "/app/.heroku/python/lib/python3.9/site-packages/jishaku/functools.py", line 109, in _internal
value = await base.asend(self.send_value)
File "/app/.heroku/python/lib/python3.9/site-packages/jishaku/repl/compilation.py", line 140, in traverse
async for send, result in AsyncSender(func(*self.args)):
File "/app/.heroku/python/lib/python3.9/site-packages/jishaku/functools.py", line 109, in _internal
value = await base.asend(self.send_value)
File "<repl>", line 1, in _repl_coroutine
file = disnake.File(fp, "videooftheday/images/video-bg.jpg")
NameError: name 'fp' is not definedβ
Β―\_(γ)_/Β―
fp means filepath
fp is an identifier here?
what it is saying is there is nothing with an 'fp' identifier
morning
morning
You know
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
Can anyone help me in dm with my discord bot. I am trying to add a feature to it but unable to do it. Your help would be appreciated.
I have this code
def __init__(self, client):
self.client = client
schedule.every().day.at("09:35").do(self.lrs_stats)
But when I run it I get this error
RuntimeWarning: coroutine 'levelroles.lrs_stats' was never awaited
But I dont get where I have to await this
you need to await self.lrs_stats
but you won't be able to do it since it's a normal function
is there any other solution to dot it?
when I do it like that
def __init__(self, client):
self.client = client
schedule.every().day.at("09:35").do(self.lrs_stats) ```
self is not defined
either use a function or do it in the init func
how to?
Everything I try ends in an error
def __init__(self, client):
self.client = client
schedule.every().day.at(...).do(self.lrs_stats)
Totally not spoonfeeding
i think this will end in a not awaited error
can I call this in another async method? ---- "async def on_member_update(before,after):"
atleast come up with something urself?
its basically this
ok but thanks for the help
can you help with it?
Yea, but u will need two member objects, before and after
yea, we can help
can you give me an example?
....?
This is also a support channel...?
im just saying theres better support there
you can use asyncio.create_task(), not really awaiting it, but still running the function
And who says
ok thanks
Just because it's the official support server doesn't mean it got better helpers all the time 
well not ALL the time
And then there's toxicity too. You can't ignore that Β―_(γ)_/Β―
Is it possible to use
schedule.every().day.at("09:35").do(self.lrs_stats)
In my main code but leave lrs_stats in the cog
So the thing from the main code activates the function in cog
The problem is when I try it lrs_stats is not defined
you dont say theres no toxicity too here
At least it's less (almost 0) here
first two lines of the function should not be in the function at all
and yea ik u meant it as a joke
but if its an actual user pls help him
good
yeh
im also kinda new
but hey everyone has to start somewher
also off topic but i like playing hypixel aswell
nope nothing
bridge main
im a bridge master
r u iron prestige orrr
oh cool
ahh i c
@commands.command()
async def verifynow(self, member : discord.Member=None):
print("--------------------- Working on it.")
role = "Verified"
guild = self.get_guild(756504534897000528)
for member in guild.members:
if role in member.roles:
print(f"{member} AVAILABLE")
pass
else:
print(f"{member} NONE")
Why this isn't working?
stay to topic please!
sorry
also i recommend using a different variable name
instead of commands use client or bot
oh
Does discord bot rate limiter reset after restarting the bot? Asking that because, returning guild.invites() stopped working after running for 30 minutes, but after restart it worked flawlessly for about 30 minutes.
hes asking if u got an error in the terminal
I was using the same class
and the class already exists
And I changed it to another class
And now it's still not working π€¦ββοΈ
@commands.command()
async def verifynow(self, member : discord.Member=None):
print("--------------------- Working on it.")
guild = self.get_guild(756504534897000528)
for member in guild.members:
print(member)
Does discord bot rate limiter reset after restarting the bot? Asking that because, returning guild.invites() stopped working after running for 30 minutes, but after restart it worked flawlessly for about 30 minutes.
It works for my other cogs
Probably, And I don't recommend
you miss the Context
You do not recommend what
Why do I need a context?!
Do not reset the time
thats how the library works...
doesnt change it.
what?
And it still doesn't work
@commands.command()
async def verifynow(ctx, self, member : discord.Member=None):
print("--------------------- Working on it.")
guild = self.get_guild(756504534897000528)
for member in guild.members:
print(member)
omfg
ctx goes infront self
OH NO!!!
self is always first param
member : discord.Member=None
omfg im so dumbbbbbbbbbbbbbbbbbb
Why nobody see that
bruh im so dumb π€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈπ€¦ββοΈ
and now it works?
it wont.
ctx is usually required
@command()
async def _command(self , ctx : Context):
...
``` is the basic syntax for a command in cog
@commands.command()
async def verifynow(self, member : discord.Member):
print("--------------------- Working on it.")
guild = self.get_guild(756504534897000528)
for member in guild.members:
print(member)
it still doesnt work
I will be back in 10 mins...
Because you do not have ctx inside bruh
@commands.command()
async def verifynow(self, member : discord.Member=None):
print("--------------------- Working on it.")
for member in self.guild.members:
print(member)
this?
@commands.command()
async def verifynow(self, ctx, member : discord.Member):
print("--------------------- Working on it.")
guild = self.get_guild(756504534897000528)
for member in guild.members:
print(member)```
yep^^
no, that doesnt matter.
it doesn't even print the working on it now
i gtg eat brb in 10 mins β€οΈ
do you have member intents?
None part doesn't matter
none means if the member arg isnt given it just resorts to the member being none (I think)
yes
it's not connected with guild.members
guild.members would just be an empty list [] if you dont have member intents
guild.members just returns list which your starting to iterate
ctx.guild returns the current guild , not the guild with the id they provided
guild = self.get_guild(756504534897000528)
they are trying to get it with an id
idk if its the id of same server or other
wait r u saying if i put in another guild i could get the list of all the channels even the private ones?
if the bot is in the server, yes
damn
I got ghost pinged?
this is the ID
oh, didnt know
cant read msgs from threads in current v. of discord.py π¦ anything ?
you need to update to the master branch, or use a fork
im using 3rd party components from discord-components, if i used master branch
buttons not gonna work
its says interaction failed
mm, have to change every single from now neh ?
if i upgraded
the button codes
ofcourse, thats why 3rd party libs are not recommended

and they will stop working with time
im rewriting my bot for the 4th time :)
nothing other than your bot's components code will get affected
and some basic things like user.avatar_url will be user.avatar.url
oh
yep, and you can always ask about the problems you face here
thanks for ur help, ill try thn n hve to check from first
Β―_(γ)_/Β―
γ
Why doesnt this add the image to the embed?
embed.set_image(url=f"attachment://./cogs/qr/qrcode{str(inter.author.id)}.png")
qrcode{str(inter.author.id)}.png
no need to specify the full path
Ikrrr, I tried with the shorter one too
attachment:// doesn't support absolute path
nice
y bot_token file
leaves
f"attachment://{str(inter.author.id)}.png" this doesnt work? you need to send it as discord.File too
oh wao
I forgot to do that
!local-image ez
rip
Β» functions-are-objects
Β» global
Β» guilds
Β» identity
Β» if-name-main
Β» indent
Β» inline
Β» intents
Β» iterate-dict
Β» kindling-projects
Β» listcomps
Β» local-file
Β» microsoft-build-tools
Β» modmail
Β» mutability
Nice pfp
!local-file
Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:
# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")
# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
file = discord.File(f)
When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.
discord.Embed instances have a set_image method which can be used to set an attachment as an image:
embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png") # Filename here must be exactly same as attachment filename.
After this, you can send an embed with an attachment to Discord:
await channel.send(file=file, embed=embed)
This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.
ah
yeah that..
Nice website as well
yeah
"bolb" spoils the fun
nextcord meme
Remove bolb
send pr
just put the hhhhhhh
what the fu
wut
@boreal ravine u should make ur website go forever
wait a repository??
doesnt allow files bigger than 25mb?
oh kk
use javascript to loop the h2 content
im no HTML master
embed = disnake.Embed(title="Qr Code", description=text, color=inter.author.color).set_image(url=f"attachment://./cogs/qr/qrcode{str(inter.author.id)}.png")
await inter.response.send_message(embed=embed, file=disnake.File(f"./cogs/qr/qrcode{str(inter.author.id)}.png", filename=f"qrcode{str(inter.author.id)}.png"), ephemeral=True)

why do you save the image
why not
.set_image(url=f"attachment://qrcode{str(inter.author.id)}.png")
umm....okay
the file after being uploaded on discord has nothing to do with its path
oh 1 sec
hm
Thanks
π
Is there a ratelimit on how many time a discord bot can publish an announcement per second ?
π¦
π
π
like
!command_name @winged charm1 @winged charm2 @winged charm3 ?
!d discord.ext.commands.Greedy
class discord.ext.commands.Greedy```
A special converter that greedily consumes arguments until it canβt. As a consequence of this behaviour, most input errors are silently discarded, since it is used as an indicator of when to stop parsing.
When a parser error is met the greedy converter stops converting, undoes the internal string parsing routine, and continues parsing regularly.
For example, in the following code:
```py
@commands.command()
async def test(ctx, numbers: Greedy[int], reason: str):
await ctx.send("numbers: {}, reason: {}".format(numbers, reason))
``` An invocation of `[p]test 1 2 3 4 5 6 hello` would pass `numbers` with `[1, 2, 3, 4, 5, 6]` and `reason` with `hello`...
use commands.Greedy or *
thanks
both do the same thing
No?
yes?
commands.Greedy consumes only one type of args, but * can consume args of any type
*member: discord.Member why wouldn't this work exactly
This will consume everything after the command, like !cmd abcdefg alphabets 123
But commands.Greedy[int] will only consume that 123
o
How greedy
not funny
Iβm sorry
any idea where i can host my discord.py bot?
VPS
ok
Your computer
Heroku
I cant run it 24/7
raspberry pi
use a vps
im making music bot i want library
As Mr. Hunter said
!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)
it will break youtube's TOS
NOT YOUTUBE
then
any other? what do you mean by "any other"
i want to make a discord music bot..
i want i library
and that library will use youtube_dl and youtube_dl breaks youtube's TOS
Well you can stil make your own without assistance
u mean i cannot make music bot
but it's still against ToS βοΈ
is the youtube only source available
kinda
..
You can, but it is against YouTube's ToS
download any song and play it from your computer then
yes
waste of resources
collecting more than 10000 music
use hydra π«
ya but
lmfao
make ur own hydra
Β―_(γ)_/Β―
or listened it
i mean common songs
Β―_(γ)_/Β―
too smart for this shit
suggest a command
opens spotify
opens discord to search for the song's link by the name of the song
cool command
cool..
Hey @silk lynx!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
umm
use a dictionary api π«
mhm
google translate api
do that !pypi
direct link..
!translate english bruh
!pypi google-cloud-translate
official library
alr
and keep this channel on topic now
F.U.N.
searching for reference..
is there a way i can change the cog while bot running ?
so that i don't have to run bot again and again
you can use reload/unload/load_extension anytime
unmanaged docs spotted
old style
so like will it work the changes i will do in my cog python files next time i reload it
Is there a ratelimit on how many time a discord bot can publish an announcement per second ?
It won't automatically do it, you can just save the file and make a command which reloads the extension
@slate swan i have a problem in getting user roles
A discord.py extension including useful tools for bot development and debugging.
okj thanks
hikari..
Users don't have roles, members do
huh Β―_(γ)_/Β―
whatever
i have a problem in getting member roles
Β―_(γ)_/Β―
Code/error?
no it gives an ugly something the id and something
i use member.roles
no
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.
was the command used in dms?
no
How do I check if a member has a certain role?
if Role in Member.roles
get_role(role_id, /)```
Returns a role with the given ID.
[<Role id=852911589061558332 name='@everyone'>]
using their api does not break their tos
it means that the member has no roles other than discord.py
Using that with an automated factor/bot does
yes
lol
How do i change my bots activity (Playing)
ctx.author.roles return [<Role id=852911589061558332 name='@everyone'>]
if there is not role
@tasks.loop(seconds=60)
async def verifynow():
guild = client.get_guild(756504534897000528)
roled = guild.get_role(936340927713259621)
for member in guild.members:
if roled in member.roles:
pass
else:
print(member)
!d discord.ext.commands.Bot.change_presence
await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the clientβs presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
``` Changed in version 2.0: Removed the `afk` keyword-only parameter.
will this work?!
Yea so you don't want them to have the everyone role?
i'll try
lol
if givenrole in member.roles
show*
Yes
ez
it should
it worked guys, Ty <3
use list slicing and remove the last element from the list
Ash, I read it
is hikari better than pycord 2.00?
hikari is not a fork. And yes it's better maintained and is faster
If you want to use a fork, go for Disnake or nextcord
why do you even compare pycord with others
why does it matter if it's forked :/
similar code structure and functions
If you use forks, you don't need to rewrite your bot
If you use hikari, welcome to the rewrite gang
π why wouldn't i use the one which is easier to use and learn with more features if it is so
lol you never know until you use
i never changed my code
so far atleast
Mhm so you may like to try hikari, for the command handler you might prefer hikari-lightbulb
!pip hikari
!pip hikari-lightbulb
yeah but i did read somewhere hikari is far less developed with community and features than discord.py so i ditched the idea of using it first
does it have UI support ?
it has always been faster than dpy with development , Except for when it was at an initial stage
i wanna ask this can you make a discord bot implementing two different languages ?
using a tool or smth . eg python + javascript
that too
buttons and views stuff i mean
yeah you can ig
kakashi/plugins/botmiscs.py lines 29 to 36
@botmisc.command
@add_cooldown(10, 2, bucket=UserBucket)
@command(name="ping", description="Sends bot's latency", aliases=["latency"])
@implements(PrefixCommand, SlashCommand)
async def ping(ctx: Context):
"""Bot's Latency"""
await ctx.respond(f"π Pong `β{round(ctx.bot.heartbeat_latency *1000 , 2)}`β ms !")```
Easier and better
but how do we do it
Use the same token for both langauges...
But why do you want to use 2 langauges
you just have to use wrapper of the tool in the primary language(which you will be using to run your bot) .
ah ok
too look cool
becuz my friend knows python and i know javascript better so we thought we could do parts of the project with our own language and then use them both together using some software or tool
but i cant find it anywhere
yes true
lmao i saw kakashi and im getting naruto vibes
It will not allow you to use many features like the command handler ,dynamic HelpCommand and more
ah ok
How do I make a command to send custom messages (e.g: ?msg @amber beaconrrrr Hello) [sorry for the mention it was accident]
just use the send method on the member/user object
and you pinged somebody
How do I use the member object tho?
And how do I tell the bot that my message is Hello?
!d discord.Member
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").
x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
hash(x) Returns the memberβs hash.
str(x) Returns the memberβs name with the discriminator.
use a message parameter
Hello
hi
@bot.command()
async def vouches(ctx, arg):
tag = arg
Tag = arg has indent block anyone know why
Eh?
!indent
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
and most importantly, learn python
I have decent grasp itβs just I canβt find reason for error
"decent"
Yes

πΏ
Haiiiii Pikaaaa
hi
C.O.O.L.
is there a button type to pick dates
like january 1st
or any kind of number picker button
use a menu?
yeah prolly
orait
do I have to add every number to the menu like this
options = [
disnake.SelectOption(
label="Red", description="Your favourite colour is red", emoji="π₯"
),
disnake.SelectOption(
label="Green", description="Your favourite colour is green", emoji="π©"
),
disnake.SelectOption(
label="Blue", description="Your favourite colour is blue", emoji="π¦"
),
]
use a for loop with range
if thats okay with you
genius
xD
different months different amount of days
yeah
nice
@client.command()
async def msg(ctx, member, message):
await member.send(message)
Why this isn't working?
make sure to add a * in the parameters
and provide more information the next time you bring an issue
I want to send custom messages to members as the bot
what isn't working?
it's not sending it
is there an error?
nope
@client.command()
async def msg(ctx, member, *, message):
await member.send(message)
Current code
does the command run?
print something to see if the command even works
so nothing printed then (if you did put a print)
@client.command()
async def msg(ctx, member, *, message):
print("It's working")
await member.send(message)
It didn't print, Yes
are you trying to send in dms
yes
open a dm channel lol
no...
no
^
the send method on the member/user object creates the dm for you
ah k
So can someone help plz :'(
hm?
issue
nope
the command doesn't even work in the first place
it won't print or send a message to the member
Typehint member to discord.Member
typehint
@client.command()
@commands.check(is_it_me)
async def msg(ctx, member : discord.Member, *, message):
print("It's working")
await member.send(message)
yes
personal preference: use lambda in commands.check
It's working... :)
wait what how does that work
I don't know how lambda works and the current one is working fine <3
they don't know what typehint is so I don't think Lambda would be a good suggestion got them
lmao
commands.check takes a function/method and lambda is a one line function
But lambda is confusing at times
everytime
lambda is not confusing for me
Cause you're a genius, unlike me

Its okay, huwunter will bless you with this Great Knowledge
πΏ
I wish
Only Hunter
Also Heroku can host only for 22 days every month, so that's a bummer
I know, I meant that sarcastically
make an alt
It's a pain switching to different accounts and stuff, according to me at least
Yea
How do I make my bot send an embed?
I already have the embed ready:
embed=discord.Embed(title="Commands", url="https://replit.com/@Albi2/Utilities", description="this shows all the Utilities bot commands!")
embed.set_author(name="Utilities")
embed.add_field(name="Best", value="u!bot", inline=False)
embed.set_footer(text="u!help, u!mute")
await ctx.send(embed=embed)
but it doesn't seem to work
send the whole command it is in
okay
if message.content.startswith('u!help'):
await message.channel.send('There are not much commands, but you can do these ones:')
embed=discord.Embed(title="Commands", url="https://replit.com/@Albi2/Utilities", description="this shows all the Utilities bot commands!")
embed.set_author(name="Utilities")
embed.add_field(name="Best", value="u!bot", inline=False)
embed.set_footer(text="u!help, u!mute")
await ctx.send(embed=embed)
at py @client.event async def on_message(message):
replace ctx.send to message.channel.send
okay thanks
np
I use disnake and only have application commands in my bot. How do I convert it to Interaction only bot instead of bot user?
how do I check if the time is negative ```py
hours, remainder = divmod(int(war.end_time.seconds_until), 3600)
minutes, seconds = divmod(remainder, 60)
await CLIENT.get_channel(937229714098110504).edit(name=f'TG-WAR: {hours}h{minutes}m{seconds}s')
Because if the time is negative I want to do something else
integer < 0 or integer <= -1
ooooooooh thanks I will try it
make your own library
you did ```
whatever you do with Pag
```py
Pag = ...
How do I change bot status (idle, online, do not disturb)?
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
has a status kwarg
okay i'll try
could someone help me, how do I make a select menu that waits for an option to be selected?
which lib
disnake
Hey guys I got an issue using py-cord
@CLIENT.event
async def on_member_join(ctx, member):
try:
connection = sqlite3.connect('clan_link.db')
cursor = connection.cursor()
try:
cursor.execute(
f"SELECT clan_welcome_message FROM '{ctx.guild.id}' WHERE clan_welcome_message IS NOT NULL")
msg = str(cursor.fetchall()[0][0]).encode(
'utf-8').decode('unicode_escape')
cursor.execute(
f"SELECT clan_welcome_channel FROM '{ctx.guild.id}' WHERE clan_welcome_message IS NOT NULL")
channel = cursor.fetchall()[0][0]
except Exception:
channel = CLIENT.get_channel(936133472311971861)
await channel.send(str(traceback.format_exc()))
template_base = Image.open("transparent.png").convert('RGBA')
template = Image.open("template.png").convert('RGBA')
asset = member.avatar_url_as(size=128)
data = BytesIO(await asset.read())
avatar = Image.open(data).convert('RGBA')
avatar = avatar.resize((256, 256))
template_base.paste(avatar, (425, 60), mask=avatar)
template_base.paste(template, (0, 0), mask=template)
template_base.save("welcome.png")
await CLIENT.get_channel(channel).send("".join(msg.encode('utf-8').decode('unicode_escape')).format(mention=ctx.author.mention, server=ctx.guild.name), file=discord.File('welcome.png'))
except Exception:
channel = CLIENT.get_channel(936133472311971861)
await channel.send(str(traceback.format_exc()))
finally:
connection.close()```
i get this error TypeError: on_member_join() missing 1 required positional argument: 'member'
ur missing definition of "Pag" still
You can read examples here https://github.com/DisnakeDev/disnake/blob/master/examples/views/select/dropdown.py
Try and learn what it's saying before copying
also pro tip: dont try to copy codes, try to write on ur own first
doesn't work the way I need it to
aanyone got any idea about my issue im lost ngl
elaborate
is this a cog
no
that does not wait for the option to be chosen, and it also doesn't return the value
How do I switch to InteractionBot from a bot user, I use disnake
is disnake the recommended fork rn?
wdym does not wait for an option
Yes
yeah
its good
thx^^
help please
so what could be the reason for an interaction failed error on discord?
what raises it
if I use the example code and send the message with said view/dropdown, it will continue running all the code below it before an option is chosen, that's why you use await view.wait()
I just am not sure what to make the callback or how to get the value
I send a dropdown menu with a command, the callback of that menu should remove itself from the view, set another view's options and add it to the view, then edit the message, tho all I get is "this interaction failed"
you just don't respond to it
k but I do
then I am not too sure, kinda in the same boat as you rn xD
there's a time limit on API, if bot needs more then that time to give out an output the interaction will be failed although there are many reasons
I read somewhere that I should use ctx.defer(), but that's not available in a dropdown menu, so I replaced it with await interaction.response.defer()
not sure if it's the same
yes
then I have no idea, sorry
How do I make my bot so it doesn't execute commands if on channels other than bot commands?
check the channel id
in on_message you can check the messages channel and if it's said channel ,you can proccess_commands()
it fails somewhere here
async def callback(self, interaction: disnake.MessageInteraction):
await interaction.response.defer()
if self.values[0] == "January" or self.values[0] == "March" or self.values[0] == "May" or self.values[0] == "July" or self.values[0] == "August" or self.values[0] == "October" or self.values[0] == "December":
days = 31
elif self.values[0] == "April" or self.values[0] == "June" or self.values[0] == "September" or self.values[0] == "November":
days = 30
else:
days = 28
Day.options = [
SelectOption(
label=str(day)
) for day in range(days)
]
View.add_item(Day(self.values[0]))
View.remove_item(Month())
interaction.edit_original_message("Your birthday is...", view=View())
wait
could an in-code error not raise an error but respond with this interaction failed?
maybe, but not sure
no, it's not because of the await at the end
I am sure that it would raise an error though
try to use print to debug
great
and do you have a error handler?
no
oh yeah, you need to await the edit thing
new bot, new start
that as well
since its a coro
so get_channel(id)?
no just check the channel id
sounds a bit extra xD
it didn't print a single number
it doesn't even call the callback function
MY CALLBACK IS IN INIT
View.add_item(Day(self.values[0]))
TypeError: add_item() missing 1 required positional argument: 'item'
makes total sense 
Anyone knows how to change bot's voice volume in just 1 guild?
which option should i choose and why?
def __init__(self, bot):
self.bot: commands.Bot = bot
or
def __init__(self, bot: commands.Bot):
self.bot = bot
Did you import Context , seems like you're using it
it doesn't matter
oh kk, thx
The second one just has better readability
its just a typehint
Oh it comes from the library internals. try asking in Disnake server maybe
it doesnt affect run time
ok
disnake.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options: Must be between 1 and 25 in length.
so like I can't make 31 days because of this
in a menu
wdym
yes
cuz I want 31 options
The second one or both at the same time. Thatβs considered the proper way to do it among type checkers
welp that sucks but if you do edit src code the fbi is coming for you
I'm gonna do it anyways
imagine changin src just to make your bot work lol
hecker
very
geeky
ikr
@commands.command()
@commands.has_permissions(manage_channels=True)
async def unlock(self,ctx):
if ctx.author.guild_permissions.manage_channels == True:
embed = discord.Embed(description = f'***:dinosuccess: {ctx.channel.mention} is unlocked***')
await ctx.channel.set_permissions(ctx.guild.default_role, send_messages=True)
await ctx.send(embed=embed)
else:
await ctx.send(ctx.message.author.mention + ", you don't have permission")```
thx
indents
<3
all good but it dunno send
await ctx.send(ctx.message.author.mention + ", you don't have permission")
ctx.author.mention
thats all
okay but now I can't find 25 in the source code from where the error comes, where does it get the 25 from 
mine too
lmaoooo
broποΈ ποΈ
lmfao
How do i keep using the wait_for function for my discord bot
bro what error in my code coz it dunno show any error
but in terminat
You don't use message.author
Ignoring exception in command unlock:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 855, in invoke
await self.prepare(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 777, in prepare
if not await self.can_run(ctx):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1087, in can_run
return await discord.utils.async_all(predicate(ctx) for predicate in predicates)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/utils.py", line 348, in async_all
for elem in gen:
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1087, in <genexpr>
return await discord.utils.async_all(predicate(ctx) for predicate in predicates)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1790, in predicate
raise MissingPermissions(missing)
discord.ext.commands.errors.MissingPermissions: You are missing Manage Channels permission(s) to run this command.
this show
You use message.author when you're using an on message event
here code
Try using ctx.author.mention
i changed but still
this come
your bot most likely is missing perms
oh
Yeah
sry i got it
yah i forget to remove this
Traceback (most recent call last):
File "c:\Users\sebas\OneDrive\Desktop\Alle Mapper\Sebastian\Python\Discord\Nyt projekt\Main.py", line 95, in <module>
Client.load_extension(f'Cogs.{filename[:-3]}')
why does it fail in my moderation cog?
full tb
?
!traceback
Please provide the full traceback for your exception in order to help us identify your issue.
A full traceback could look like:
Traceback (most recent call last):
File "tiny", line 3, in
do_something()
File "tiny", line 2, in do_something
a = 6 / b
ZeroDivisionError: division by zero
The best way to read your traceback is bottom to top.
β’ Identify the exception raised (in this case ZeroDivisionError)
β’ Make note of the line number (in this case 2), and navigate there in your program.
β’ Try to understand why the error occurred (in this case because b is 0).
To read more about exceptions and errors, please refer to the PyDis Wiki or the official Python tutorial.
thats not the full traceback
Traceback (most recent call last):
File "c:\Users\sebas\OneDrive\Desktop\Alle Mapper\Sebastian\Python\Discord\Nyt projekt\Main.py", line 95, in <module>
Client.load_extension(f'Cogs.{filename[:-3]}')
File "C:\Users\sebas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\sebas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 623, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'Cogs.Moderation' raised an error: TypeError: cogs must derive from Cog
show the cog
from discord import Client
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType
from discord.ext.commands import has_permissions, MissingPermissions
from nextcord import Interaction, SlashOption, ChannelType
from nextcord.abc import GuildChannel
from nextcord.ext import commands
import nextcord
import platform
import datetime
class Moderation(commands.Cog):
def __init__(self, Client):
self.Client = Client
def check_if_it_is_me(ctx):
return ctx.message.author.id == 458251225394184205
@commands.command(pass_context = 1)
@commands.check(check_if_it_is_me)
async def luk(self, ctx):
emb = discord.Embed(description = ':exclamation: Botten lukker ned...', color = 0xffffff)
emb.set_footer(text = 'Kommando spurgt af %s' % ctx.message.author.name)
await ctx.send(embed = emb)
await Client.logout()
"""""
@commands.command()
@has_permissions(manage_channels=True)
async def toggle(self, ctx, *, command):
command = Client.get_command(command)
if command == None:
await ctx.send('`Kunne ikke finde denne kommando`')
elif ctx.command == command:
await ctx.send('`Du kan ikke disable denne kommando.`')
else:
command.enabled = not command.enabled
ternary = "enabled" if command.enabled else "disabled"
await ctx.send(f'`Kommandoen {command.qualified_name} er blevet {ternary}`')
@commands.command()
@has_permissions(ban_members=True)
async def listban(self, ctx):
banned_users = await ctx.guild.bans()
await ctx.send('**Liste over folk, der er banned:**')
for ban_entry in banned_users:
user = ban_entry.user
await ctx.send(f'**- Navn: {user.name}#{user.discriminator} - Tag: {user.mention}**')
return
@commands.command()
@has_permissions(manage_channels=True)
async def slowmode(self, ctx, amount):
try:
await ctx.channel.edit(reason='Slowmode kommando.', slowmode_delay=int(amount))
await ctx.send(f'**Slowmode er nu slΓ₯et til {amount} sekunder.**')
except discord.Errors.Forbidden:
await ctx.send('**Jeg har ikke adgang til at kunne gΓΈre dette.**')
@commands.command()
@has_permissions(manage_permissions=True)
async def lock(self, ctx, channel : nextcord.TextChannel = None, setting = None):
if setting == '--server':
for channel in ctx.guild.channels:
await channel.set_permissions(ctx.guild.default_role, reason=f"**{ctx.author.name} lukkede {channel.name} med --server**", send_messages=False)
await ctx.send('**Lukkede lige serveren ned.**')
if channel is None:
channel = ctx.message.channel
await channel.set_permissions(ctx.guild.default_role, reason=f"**{ctx.author.name} lukkede {channel.name}, brug .unlock for at unlocke kanalen igen.**", send_messages=False)
await ctx.send('**Lukkede lige kanalen ned.**')
"""""
def setup(Client):
Client.add_cog(Moderation(Client))
This is the code
!code
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.
any idea of how i could improve the text so theres a tab when on new line
can you help
sure but you have to format it first
how to
.
check on top
wdym by tab?
like 3 spaces or something like that
done
you mean \t?
yes!
thats 4 lol
something like if songname is 20 characters long: add a \t
@slate swan could you help me after
i think ive figured it out
you have to add py so its formatted as a python code block
with len()
how?
yes you check the length of each sentence
like above so it will look like this
print("lol")
i have done
oh
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.
like that
import discord
from discord import Client
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType
from discord.ext.commands import has_permissions, MissingPermissions
from nextcord import Interaction, SlashOption, ChannelType
from nextcord.abc import GuildChannel
from nextcord.ext import commands
import nextcord
import platform
import datetime
class Moderation(commands.Cog):
def __init__(self, Client):
self.Client = Client
def check_if_it_is_me(ctx):
return ctx.message.author.id == 458251225394184205
@commands.command(pass_context = 1)
@commands.check(check_if_it_is_me)
async def luk(self, ctx):
emb = discord.Embed(description = ':exclamation: Botten lukker ned...', color = 0xffffff)
emb.set_footer(text = 'Kommando spurgt af %s' % ctx.message.author.name)
await ctx.send(embed = emb)
await Client.logout()
"""""
@commands.command()
@has_permissions(manage_channels=True)
async def toggle(self, ctx, *, command):
command = Client.get_command(command)
if command == None:
await ctx.send('`Kunne ikke finde denne kommando`')
elif ctx.command == command:
await ctx.send('`Du kan ikke disable denne kommando.`')
else:
command.enabled = not command.enabled
ternary = "enabled" if command.enabled else "disabled"
await ctx.send(f'`Kommandoen {command.qualified_name} er blevet {ternary}`')
@commands.command()
@has_permissions(ban_members=True)
async def listban(self, ctx):
banned_users = await ctx.guild.bans()
await ctx.send('**Liste over folk, der er banned:**')
for ban_entry in banned_users:
user = ban_entry.user
await ctx.send(f'**- Navn: {user.name}#{user.discriminator} - Tag: {user.mention}**')
return
@commands.command()
@has_permissions(manage_channels=True)
async def slowmode(self, ctx, amount):
try:
await ctx.channel.edit(reason='Slowmode kommando.', slowmode_delay=int(amount))
await ctx.send(f'**Slowmode er nu slΓ₯et til {amount} sekunder.**')
except discord.Errors.Forbidden:
await ctx.send('**Jeg har ikke adgang til at kunne gΓΈre dette.**')
@commands.command()
@has_permissions(manage_permissions=True)
async def lock(self, ctx, channel : nextcord.TextChannel = None, setting = None):
if setting == '--server':
for channel in ctx.guild.channels:
await channel.set_permissions(ctx.guild.default_role, reason=f"**{ctx.author.name} lukkede {channel.name} med --server**", send_messages=False)
await ctx.send('**Lukkede lige serveren ned.**')
if channel is None:
channel = ctx.message.channel
await channel.set_permissions(ctx.guild.default_role, reason=f"**{ctx.author.name} lukkede {channel.name}, brug .unlock for at unlocke kanalen igen.**", send_messages=False)
await ctx.send('**Lukkede lige kanalen ned.**')
"""""
def setup(Client):
Client.add_cog(Moderation(Client))
done, im sorry
wow!
youre importing commands from discord and nextcord wut
yes
you should stick with one
then its work?
@slate swan
seen this error before when someone tried to import a cog that was in discord to disnake
oh yes it does, thanks bro!
yw
but now i have this problem
C:\Users\sebas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py:85: DeprecationWarning: logout is deprecated, use Client.close instead.
ret = await coro(*args, **kwargs)
i have a command that close the bot
well youre using something thats been deprecated so use what has been suggested by the tb
Hello, I want to know how I can keep my discord bot online for the whole time my computer is on.
Currently it goes offline after every command.
For example when I run the code from Visual studio code
and I do the command I coded
After the command is executed by the bot it goes offline that instant.
I need to rerun the code for it to come online every time.
so what should i do, im not the best for english because im from denmark
show the commands
Do I send it here?
do what it says lol
!paste -- Sure
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.
Ok I will just cut of my token and send it
@wispy spade @slate swan
I have written the code with Python 3.10. and Visual Studio code
there doesn't seem to be anything that would cause it
Ok sure
i doubt that would do anything
My friend is having this exact same issue
Oh I see
can you show the code?
can anybody teach me python for making a discord bot?
oh u did
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
I don't know, there's nothing wrong with your code
just this line triggers me
await context.message.channel.send(embed=myEmbed)
use await context.send(embed=myEmbed)
Heβs grabbing a channel and sending a message. Nothing too bad about that. In theory itβs almost the same as printing. But just different locations. 
nah
Yeas sure
Yah
no
Ok will this maybe fix the issue?
no, it's just memory saving
I will do it just give me 2 minutes please
@muted quarry
By restarting my bot do you mean my computer @slate swan
Ok
dia you say Iβm wrong but you havenβt told me why.
just some prints
making api calls directly after making a lot of api calls will sometimes get you disconnected from the api
or maybe almost always
and the api hates it more than anything
It really doesnβt.
sources
People do that shit all day. People will send messages as soon as a shard connects to the gateway. Nothing bad happens.
In this case, it's likely something external
I dont have a vsc
Ohh i thought u meant
a cloud service
My bad
Yea I will restart it one sec
Yes will do
I mean thatβs whatever tho. Just because itβs possible doesnβt mean itβs not bad practice. Like okimii said tasks are nice π

@slate swan I restarted it and restarted my pc too
It still didn't seem to do the trick
Are you getting any errors to why your bot is dying
No errors
hmm, how does it disconnect? does it just exit out of the bot and that's it?
It just goes offline
thats it and when i run the code
it comes online and says the message
any idea how i can bypass every space getting deleted on \n (in embed)
One second I ran it again
I will just see if it does it again
It doesn't seem to be going offline now
After the restart
But i think I will give it a few minutes and get back to you
are you using replit
Visual Studio Code
@slate swan It doesn't seem to be going offline now
I think the restart fixed it
Thanks a lot!
I will let you know if anything happens again
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'discord' is not defined
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**.
how can i make the bot send a video without having the link at the top
a local file?
nope
can you edit a message and remove any existing attachments?
aka, edit message replacing the attached file with another
i think u can only do ur own or the bots
maybe inter.send doesn't return nothing
i don't think there's a need to type hint it...?
that's probably not causing your error though
you'll need the ID of the message, idk if there's any other way
async def vouch(ctx, *, reason=None):
user, vouchs = reason.split(':')
message = await ctx.send("sending..")
time.sleep(0.3)
await message.edit(content="**vouch received!!!**")
vouch = 0
name = ("vouches.txt")
o = open(str(name), 'a')
for i in range:
user = (f"{ctx.author.mention} vouched {user} reason: {vouchs} ")
vouchs += 1
print(f"{user} | {vouchs}")
o.write(f"{user + vouchs}\n")```
bro still stuck with intents
π
o = open(str(name), 'a')```this aswell
asyncio.sleep(0.3) > time.sleep(0.3)
Ok
LOL
!snipe
whats the point of aliasing slash commands, that would just create multiple slash commands with same function

is there a way to convert a discord.File to a discord.Attachment? Since the discord docs seem to say that you can only remove attachments from a file when editing by re-applying all the attachments (https://discord.com/developers/docs/reference#uploading-files).
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Since I want to have a message sent with one file, then edit it removing the first file and replacing it with a second
No payment, the project has started a few weeks ago
are you complaining or actually offering a job that requires three years of competent knowledge for no pay
!rule 9
What do you mean, discord.Attachment is the in discord version of of discord.File, you cant just turn a File into an Attachment locally
iirc
paid work of any kind = paid work of 0$
It is sort of for fun, I am offering to someone who likes the theme of economic games
its not a paid work bro
it's an offered job
so it's against rule 9
Nope, im not paying anyone
they really have to rewrite that
Sure
I think the linter is not smart enough for that
he has overwritten it as a keyword
Yeah I just think the linter has low IQ
tho why are you splitting the message's content?
The actual contents of the message.
@slate swan :white_check_mark: Your eval job has completed with return code 0.
True
!e
print("hi" in "abcd hi there")```
@cold sonnet :white_check_mark: Your eval job has completed with return code 0.
True
!e print("hi" in "abcdhi there")
@limber isle :white_check_mark: Your eval job has completed with return code 0.
True
guys gimme some codes to create a mute command with the bot
not really py if 'hi' in 'hie there' would be true , but py if 'hi' in 'hie there'.split() wont be
yes because str.split breaks the string into a list of strings , and in would work with the complete words only
!docs discord.Member.timeout
No documentation found for the requested symbol.
await timeout(*, duration=..., until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Times out the member from the guild; until then, the member will not be able to interact with the guild.
Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.
You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.
New in version 2.3.
It actually got realeased to beta yesterday

