#discord-bots
1 messages Β· Page 534 of 1
I won't be getting an issues if I use display_avatar right
fair enough lol
I was making my Discord bot when I got this:
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being rate limited.
```I think that its because I have just been turning my bot on and off heaps when debugging. Is it anything to worry about?
discord is disconnecting you from the HTTP protocall
so contact discord about your bot
someone must of have reported it
π
How would I contact them?
orr if your using replit it change your replit name and use a vpn
or just use a vpn in general
I'm using VScode
i think trust and safety
async def send_log(self, webhook, embeds, bot):
print("Send logs", embeds)
to_send = discord.Webhook.from_url(webhook, session=bot.session, bot_token=bot.http.token)
await to_send.send(embeds=embeds, username=f"LogRack Logging", avatar_url=bot.user.avatar.url)
Send logs [<discord.embeds.Embed object at 0x0635D8E0>, <discord.embeds.Embed object at 0x0635DA00>]
but this is only sending first embed and not the second
What is the code for embeds
Im asking him
Not for documentation
I know how to make an embed
typed* but
embeds is defined. What is the code for it?
async def send_log(self, webhook, embeds, bot):
print("Send logs", embeds)
to_send = discord.Webhook.from_url(webhook, session=bot.session, bot_token=bot.http.token)
await to_send.send(embeds=embeds, username=f"LogRack Logging", avatar_url=bot.user.avatar.url)
@tasks.loop(seconds=5)
async def send_webhooks(self):
async with self.batch_lock:
if self.logging_batch:
for webhook, embeds in self.logging_batch.items():
if embeds:
first_ten = embeds[:10]
try:
self.bot.loop.create_task(self.send_log(webhook, first_ten, self.bot))
>>> Send logs [<discord.embeds.Embed object at 0x0635D8E0>, <discord.embeds.Embed object at 0x0635DA00>]
``` it prints this (2 embeds) but only send 1st one
Trolling is not funny
π€
How to add buttons like this
use a 3rd party lib (buggy) or use a dpy fork
!pypi dislash.py
3rd party libraries like that are allowed?
What do you mean "are allowed"?
who says you cant use them? and yes it's allowed
just heard that 3rd party software that alters discord is bannable from someone before
They are just extensions, but also their use is what decides whether they're okay to use. You cannot use a 3rd party library that supports self-botting and say it's just an extension so it's allowed, no.
broooo
do u get
what libraries are
an an application
3rd party library not a Discord modified client.
gotcha
^
didnt know libraries that allow alterations to the client didnt count for that
what client?
the discord client itself
your not altering anything
those buttons arent native to the client though right?
they are
oh mb
check the api
Btw you cant add things to discord without discord adding it to their api first
dpy supports that nateively
though it's in beta
works pretty well with minimal bugs, just my experience though yours might differ
help
badwords = ["thing", "Another]
i still get error
Is there any point of using ctx: commands.Context instead of using just ctx?
@bot.event
async def on_message(message):
badword = ["fuck", "shit"]
if badword in message.content:
await message.delete()
await bot.process_commands(message)
Don't think so commands.Context is already ctx
hmm
Its shown in the discord.py button documentation so im not sure
hmm
ok thanks guys
what is there wrong
after doing await message.delete() do return
not the error
What error
@patent surge
Do message.content in badword
should be working no? weird
Bad way.
yea that shouldnt work
Loop through the list and check for each item inside it if it's in the message.content.
for word in badword:
if word in message.content:
...
I did that and it works
Try to say a longer sentence that includes an item from badword list.
Say "this shit" and see if it does anything.
K yeah i had to do the other way
Use that.
Ye i did
how to add a cooldown to this slash command
@cog_ext.cog_slash(name="support", description="Gives you link for support server")
async def _support(self, ctx:SlashContext):
embed = discord.Embed(title="Support Server",
description="To visit our support server, click [here](link).\nNow you can see the latest updates!!",
color=discord.Color.random())
embed.set_footer(text=f"Support Server requested by {ctx.author.name}")
embed.set_thumbnail(url=ctx.author.avatar_url)
await ctx.send(embed=embed)```
also am i able to send emphereal messages
if a button is clicked
Hey @naive vine!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
β’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
β’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
how do you delete a message. I want to delete the users message
Current code:
async def ping_command(self, ctx):
start = d.timestamp(d.now())
msg = await ctx.send(content='Pinging')
await msg.edit(content=f'Ping: {(d.timestamp(d.now())-start) * 1000}ms.', delete_after=5)
return
!d discorrd.Message.delete
No documentation found for the requested symbol.
!d discord.Message.delete
await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the message.
Your own messages could be deleted without any proper permissions. However to delete other peopleβs messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.
Changed in version 1.1: Added the new `delay` keyword-only parameter.
just misspelled discord
oh cool
How to take a channel as an input?
args
Example please
def a(arg1: discord.TextChannel) ig
Oh thanks
could i add that to the origin code like this:
async def ping_command(self, ctx):
start = d.timestamp(d.now())
msg = await ctx.send(content='Pinging')
await delete(*, delay=None)
await msg.edit(content=f'Ping: {(d.timestamp(d.now())-start) * 1000}ms.', delete_after=5)
return
also does a variable replace the * or do you just keep it
await msg.delete() just do that
wouldnt that delete the message from the bot i want to delete the message from the user
await ctx.message.delete()then
that works thanks
no those are kwargs
if disnake.TextChannel is None:
try:
vc = ctx.author.voice.channel.id
link = await together_control.create_link(vc, 'chess')
await ctx.send(f"Click the link π\n{link}")
except:
await ctx.send("Please join a VC or tag a channel and try again:smile:")
else:
vc = disnake.TextChannel.id
link = await together_control.create_link(vc, 'chess')
await ctx.send(f"Click the link π\n{link}")```
Is that correct??
ye ig
its VoiceChannel
for vcs
async def testchess(ctx, disnake.TextChannel = None):
^
SyntaxError: invalid syntax```
what
shouldn't be invalid
IDE problem?
I don't think
what IDE u using
repls and VScode
repl
then its a replit problem
Ran on VScode still the same
idk then
π
channel:disnake.TextChannel
@commands.cooldown(1,900,commands.BucketType.user)
async def testchess(ctx, channel:disnake.VoiceChannel = None):
if disnake.VoiceChannel is None:
try:
vc = ctx.author.voice.channel.id
link = await together_control.create_link(vc, 'chess')
await ctx.send(f"Click the link π\n{link}")
except:
await ctx.send("Please join a VC or tag a channel and try again:smile:")
else:
vc = disnake.VoiceChannel.id
link = await together_control.create_link(vc, 'chess')
await ctx.send(f"Click the link π\n{link}")```
Huh?
Use channel not disnake.VoiceChannel.
I want a Voice Channel tho
@Yui.command()
@commands.cooldown(1,900,commands.BucketType.user)
async def testchess(ctx, channel:disnake.VoiceChannel = None):
if not channel:
try:
vc = ctx.author.voice.channel.id
link = await together_control.create_link(vc, 'chess')
await ctx.send(f"Click the link π\n{link}")
except:
await ctx.send("Please join a VC or tag a channel and try again:smile:")
else:
vc = disnake.VoiceChannel.id
link = await together_control.create_link(vc, 'chess')
await ctx.send(f"Click the link π\n{link}")
You are just setting channel as it's a disnake.VoiceChannel object.
But you cannot pass the object itself.
its channel.id
Can you show the full traceback?
or that ^
hm
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/client.py", line 483, in _run_event
await coro(*args, **kwargs)
File "main.py", line 58, in on_command_error
raise(error)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot_base.py", line 547, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/core.py", line 901, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/core.py", line 180, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'voiceChannelID' argument MUST be of type string or integer, not a "member_descriptor" type.```

@commands.cooldown(1,900,commands.BucketType.user)
async def testchess(ctx, channel:disnake.VoiceChannel = None):
if not channel:
try:
vc = ctx.author.voice.channel.id
link = await together_control.create_link(vc, 'chess')
await ctx.send(f"Click the link π\n{link}")
except:
await ctx.send("Please join a VC or tag a channel and try again:smile:")
else:
vc = channel.id
link = await together_control.create_link(vc, 'chess')
await ctx.send(f"Click the link π\n{link}")```
Huh?
@boreal ravine or @dapper cobalt ?
What?
Is that correct?
Try and see.
yes
!d discord.ext.commands.Bot.guilds
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
you can use the random module to randomize that ^
guilds = random.choice(client.guilds) !?
TYSM it works
yes
aight
How can i enter a token from the python shell and run the token?with input?
use an input function and set a variable to the function then put the variable into bot.run()
Thank you thats what i was thinking but i thought it would probably say the variable is not defined
nope
token = input()
bot.run(token)
How do I send a DM?
!d discord.User.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**.
its the same as ctx.send but just member.send
where member is an instance of discord.Member (can be found like ctx.author or guild.get_member)
yes but this is more likely to error with discord.Forbidden because the bot needs to share a guild with the user
any errors?
is message defined?
try getting the user by guild
@lilac latch
OFC
that means that the get_user returned None meaning a false id
no.
to use get_user the bot has to share a guild with the user - otherwise not in cache
and if you entered a valid ID, then there is no point trying to get the user, because you wont be able to send a message to them
Intents
presence intents?
Member intents and that too
hm
why did you say this instead of saying on_guild_join which is probably what they were looking for
I donβt get the idea youβre helping
They were defo looking for on_guild_channel_create
they didnt specify what event though
Looking at their code it's pretty obvious
I see, I didnβt look at his code lol
Β―\_(γ)_/Β―
It shares one
I am sorry my wifi died
then the only reasons are invalid id, or not enough intents
ID is valid
And I don't think you need any other intents instead of default ones
In[3438]: 2 discord.User
Out[3438]: ['__abstractmethods__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__weakref__', '_abc_impl', '_copy', '_get_channel', '_public_flags', '_state', '_to_minimal_user_json', '_update', 'avatar', 'avatar_url', 'avatar_url_as', 'block', 'bot', 'color', 'colour', 'create_dm', 'created_at', 'default_avatar', 'default_avatar_url', 'discriminator', 'display_name', 'dm_channel', 'fetch_message', 'history', 'id', 'is_avatar_animated', 'is_blocked', 'is_friend', 'mention', 'mentioned_in', 'mutual_friends', 'mutual_guilds', 'name', 'permissions_in', 'pins', 'profile', 'public_flags', 'relationship', 'remove_friend', 'send', 'send_friend_request', 'system', 'trigger_typing', 'typing', 'unblock']
??
its not failing on the send, its failing on the fact you have incorrectly used the get_user, and resulted in None.
a) your bot doesnt share a guild with the user
b) the user is not in your bots cache
c) the intents are incorrect
d) invalid id
you need member intents
to get a member
why dont you just use intents.all()
^ intents = discord.Intents.all()
is it?
what

bitly_key = config.get('bitly_key')
Yui = commands.Bot(command_prefix = prefix, test_guilds=[811634680302010449], intents = intents)```
What's wrong??
π
nothing is wrong I think
ok
.
Maybe provide your code?
We can't really guess
You probably didn't acknowledged the interaction
Hey @silk goblet!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
β’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
β’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Hey @silk goblet!
It looks like you tried to attach file type(s) that we do not allow (). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
why doesnt this work?
i know its erman, sry, but the parameter should be able to read for you
Can you tell what is being wrong?
And is it all for this code?
If you don't use event for it, then that is why
And please copy paste the code somewhere, as this is woudl be way easier for us to read your code
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
when i run my code locally, its working fine, but when i deploy it on heroku it throws a file not found error
why is that
@client.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.Member, *, reason = None):
await member.ban(reason = reason)
When i run that it show error
What is the problem?, I run at pycharm newest with discord.py newest version
whats the error
Well same like me, it shows error tho
hello guys, pls tale me how how to make sure that the person who registered the command could not press the buttons?
If you mean register the command as in the author who invoked the command then you can add a check to see if the user that clicked the button was the author
Show full error
how to register a new command programatically
You don't
how do I do it when I require it?
You use the library
nono
I mean
How do I fetch channels?
So I want to delete voice channels with certain name for example
if channel starts with voice, delete channel
I want to be able to let the user be able to make new commands
how do I do that
You can't register a command like you want
guild.fetch_channel()
what is the closest to doing that?
line 26, in <module> structure
tructure
Structure
@bot_has_permission (ban_members = True)
NameError:
name 'bot_has_permission' is not defined
'bot_has_permission' is not defined
'bot_has_permission' is not defined
read edited
I want to make it so that the person who wrote this command to the channel cannot press the buttons
A really impressive on_message command.
yes, add a check
how ?π
if statement
You will need to save them somewhere (name and answer), and then use the on_message event to check for command name and prefix
It's bot.has_permissions()
what?
Ok tq for answer, sorry for dumb text
Add a check to the command to see if the user who clicked the button is the author. I don't know how to do that though
okay
thx
Saying what module you are using helps quite a bit aswell.
How do I fetch channels?
So I want to delete voice channels with certain name for example
if channel starts with vc, delete that channel
dpy 2.0, anyone knows how to create a button, i dont understand how even after reading the docs
I think that if you'd use the docs you'd know this answer.
async def button(ctx):
await ctx.send("Buttons!", components=[Button(style=ButtonStyle.green,label="Button", custom_id="button1")])
interaction = await bot.wait_for(
"button_click", check=lambda inter: inter.custom_id == "button1"
)
await interaction.send(content="Button Clicked")
Well, I didn't...
using parameters and the right arguments I guess
Any suggestions?
oh
Divide your own questions into parts what do you need?
ah ty
What lib is this? They might not be using the same one..
discord_components
suggestions for?
Okay so my bot has a Auto Voice creation so if you join a voice, It will make another voice, And sometimes it doesn't delete it because the bot is offline, So when I turn on my bot I want to delete the left over voice channels, So the program should be like this,
for voice in guild:
if voice.startswith("VC"):
await voice.channel.delete
But I don't know how to do this...
π
i meant dpy 2.0 not components..
loop over the guild's voice channels
This is just a more detailed explanation, what you want firstly is all voice channels so,
First: discord.Guild.voice_channels
Then using the filter function we can easily filter out anything that does not start with 'vc'
Then at last we delete those channels in a good manner.
do u know how for dpy 2
nope, i'm using a dpy fork
ohh alright
man, install discord_components and all
why?
class MyView(discord.ui.View):
def __init__(self, *, timeout = 180.0):
super().__init__(timeout=timeout)
@discord.ui.button(label='Click Me')
async def click_me(self, button, inter):
await inter.response.send_message('You clicked me!', ephemeral=True)
self.stop()
@bot.command()
async def foo(ctx):
view = MyView()
await ctx.send(view=view)
fuck forgot the buttons
whats view
Easy and quick by dividing your question: ```py
print(list(filter(lambda x: x.lower().startswith('vc'), guild.voice_channels)))
there
voice = discord.Guild.voice_channels
guild = client.get_guild(756504534897000528)
for voice in guild:
if voice.startswith("π‘γ»Room #"):
await voice.channel.delete
I did this and it's not working...
a View is what stores your items
an Item can be a Button or a SelectMenu
discord.Guild.voice_channels is the full path you need to start at guild or get is somewhere.
you can either subclass on of those items and then add them to the view, or you can just add them in the view using the decorator
wait, for that button, if i wanna use it in a command?
or its basically a @bot.command()
guild = client.get_guild(756504534897000528)
voice = discord.Guild.voice_channels
for voice in guild:
if voice.startswith("π‘γ»Room #"):
await voice.channel.delete
So like this?
use disnake, dpy will eventually become outdated asf
WELL... DISCORD.PY WILL DIE.. SO CAN SOMEONE ELSE HELP WITH WHAT LIBRARY I SHOULD USE? ALSO MY CAPS LOCK IS BROKEN SOOO I DO NOT WANT TO TYPE IN CAPS BUT... IT IS STUCK...
disnake
OK THANKS A LOT!
yw
AND WHAT ABOUT HIKARI?
never tried hikari but it should be good too
although the syntax and everything is different from dpy or dpy forks
guild = client.get_guild(756504534897000528) or await client.fetch_guild(756504534897000528)
for vc_channel in list(filter(lambda x: x.lower().startswith('vc'), guild.voice_channels)):
await vc_channel.delete()
await asyncio.sleep(1) # Prevent rate limit
OOF. OK THANKS!
@bot.has_permission(ban_members = True)
AttributeError: 'Bot' object has no attribute 'has_permission'
any tips?
yw
it's @commands. not @bot.
@commands.has_permission(ban_members = True)
AttributeError: module 'discord.ext.commands' has no attribute 'has_permission'
that is what i got
{
"resource": "/d:/Desktop/MaxTheBot/bot.py",
"owner": "_generated_diagnostic_collection_name_#0",
"severity": 8,
"message": "\"await\" allowed only within async function",
"source": "Pylance",
"startLineNumber": 69,
"startColumn": 5,
"endLineNumber": 69,
"endColumn": 34
}
Await allowed only within async function...
Where are you coding this?
permissions
nah still using dpy for now, i'll use pycord in future
ends with a s
main.py...
popular != better
does @discord.ui.button() work as a normal @bot.command()?
yeah i know
No i mean where, you need an async function or loop.
no, you need a View if you want to attach buttons or whatever to a bot message
oh
for invalid_guilds in list(filter(lambda x: x.lower().startswith('vc'), guild.voice_channels)):
await invalid_guilds.delete()
import asyncio
await asyncio.sleep(1)
HERE ^
less popular == less support
>>> Optional[False]
just because it's less popular doesn't always mean less support
Optional is indeed a nice touch.
ikr
πΏ
okay thats work, thanks
the disnake devs are always helping people with their lib daily and so are some of the people that are in there and have some experience with the lib
I think it's best that you learn some python first before proceeding with discord bots.
^
You got the disnake repo?
disnake still .url right?
I already coded a big bot...
Thanks.
?
@slate swan whats the difference between dislash & disnake?
Doesn't mean you are good at it, look i even spoonfed you the whole answer i'm not going to implement it aswell.
dislash is a 3rd party lib while disnake isn't
wha..? They are all 3th party.
no?
a lib
first or third party?
nice
Does d.py work or is associated with discord?
So yeah not reall first
no 
alr alr i see where you're going
then lemme rephrase
Then how is it a first party 
First party would be that it's made by Discord
second party incomming
dislash is a 3rd party for dpy while disnake isn't
discord.py is a third party api wrapper for Discord
so dislash is a 4th party 
π
Β―_(γ)_/Β―
What's better, disnake or PyCord?
guys why does this not send anything?
@client.command(name="coinflip", aliases=["cf"])
# @commands.cooldown(1, 30, commands.BucketType.user)
async def coinflip(ctx, amount=None):
if amount is None:
await ctx.message.reply("Bet some money!")
return
else:
await open_account(ctx.author)
with open("mainbank.json", "r") as f:
users = json.load(f)
user = ctx.message.author
if users[str(user.id)]["wallet"] >= amount:
decide = random.randint(1, 2)
msg = await ctx.message.reply(f"flipping a coin for ye...")
if decide == 1:
await asyncio.sleep(2)
await msg.edit(content=f"ye lost the coin flip, better luck next time!")
user = ctx.message.author
users[str(user.id)]["wallet"] -= amount
with open("mainbank.json", "w") as f:
json.dump(users, f)
elif decide == 2:
await asyncio.sleep(2)
await msg.edit(content=f"ye won {amount} coins :coin:!")
user = ctx.message.author
users[str(user.id)]["wallet"] += amount
with open("mainbank.json", "w") as f:
json.dump(users, f)
else:
await ctx.message.reply(f"Ye don't have enough coins!")
it worked properly before but now it doesnt even respond or print any error
disnake has more potential at the moment.
@cloud dawn I did this
guild = guild = client.get_guild(756504534897000528)
@client.event
async def noob():
for invalid_guilds in list(filter(lambda x: x.lower().startswith('π‘γ»Room #'), guild.voice_channels)):
await invalid_guilds.delete()
import asyncio
await asyncio.sleep(1)
And it's not working...
Okay so
First things first
There is no event called noob
oh... xD
Second thing, your guild variable should be put in the method and not outside
Third thing, why do you do guild = guild = ...
https://github.com/EQUENOS/disnake/commit/ed4923b0890217ed356819008bfb97642d500d04#diff-9193cf57ab5b9cff2bcd207093171c901346772ab36b595b8f76481ca79a8134R839-R856
https://github.com/EQUENOS/disnake/commit/6fdb6ddd94ce08c8ae4ee341ece3f3af3445db50
https://github.com/EQUENOS/disnake/commit/a8c89739f82244dafc7798ee9e1db03f9dc7b8ba
https://github.com/EQUENOS/disnake/commit/52dab58a41bac1b7dfa13b13be3fa9971e89feef
https://github.com/EQUENOS/disnake/commit/df7167ac24399115aa76ae5fb040a4b399abb716
Lmao
why not?
Just do guild = ... 
Wait I did?
Fourth thing, you don't import things randomly in your code, you do it at the top of your file
I know that
Ik bruh that was copy pasted, discord removes those
forks will be forks, you should use a different wrapper instead
@client.event
async def on_ready():
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x.lower().startswith('π‘γ»Room #'), guild.voice_channels)):
await invalid_guilds.delete()
await asyncio.sleep(1)
Good enough?
Help please π₯²
Better now at least
Do you even know what a lambda does? Because with the apparent knowledge you show I don't think you do.
You made those circles really aggressively π
If you don't, don't just use copy paste code
Oh sorry, was just means to show x)
Someone else wrote that for me
Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "D:\Desktop\MaxTheBot\bot.py", line 23, in on_ready
for invalid_guilds in list(filter(lambda x: x.lower().startswith('π‘γ»Room #'), guild.voice_channels)):
File "D:\Desktop\MaxTheBot\bot.py", line 23, in <lambda>
for invalid_guilds in list(filter(lambda x: x.lower().startswith('π‘γ»Room #'), guild.voice_channels)):
AttributeError: 'VoiceChannel' object has no attribute 'lower'
Nice...
Is it because π‘γ»Room # is not lower?
Might want x.name.lower()
No, it's because you do .lower() on a VoiceChannel object
It didn't give me an error now
But the voice channel is still there...
And it ignored my other on_ready event
Don't have 2 events
Just one
Put the code together
It's still there (the vc)
Save your lambda thingy in a variable and print it
@client.event
async def on_ready():
change_status.start()
cog_status.start()
print("Bot Is Now Online!")
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x.name.lower().startswith('π‘γ»Room #'), guild.voice_channels)):
await invalid_guilds.delete()
await asyncio.sleep(1)
I did this
I don't know how to work with lambda's
Just copy paste your thingy after the in keyword
and
So copy list(filter(lambda x: x.name.lower().startswith('π‘γ»Room #'), guild.voice_channels)) and save in a variable
Then print it
So we can call it, Boop = list(filter(lambda x: x.name.lower().startswith('π‘γ»Room #'), guild.voice_channels))
Naming conventions, but yeah
@client.event
async def on_ready():
change_status.start()
cog_status.start()
print("Bot Is Now Online!")
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x.name.lower().startswith('π‘γ»Room #'), guild.voice_channels)):
await invalid_guilds.delete()
await asyncio.sleep(1)
boop = list(filter(lambda x: x.name.lower().startswith('π‘γ»Room #'), guild.voice_channels))
print(boop)
like this? or outside that event?
like that
boop
It's a []
dictionary ? it was called?
list
list yeah
So you have no channel in that guild that starts with this name
Well I do...
"prv rooms"
Can the bot see them 
That's a category
Yes
So no permissions misconfiguration
First: Everyone can see them
Second: The bot has administrator perms
Oh okay
So what's wrong?
can you print(guild.voice_channels)?
Sure
Yeah i got to eat
We need another thing for that
Interesting how the emotes are being displayed
Yeah that's prob why
afaik thats just the terminal doing it
Well, you compare an emote that looks 'normal' with a weird looking emote that is displayed for you
Mine shows it normally so I don't think so
Mabye it's UTF thing?
utf 8
Or mabye it's windows, idk
Can't we do
boop = list(filter(lambda x: x.name.lower().contains('π‘γ»Room #'), guild.voice_channels))
!charinfo π‘
\U0001f4e1: SATELLITE ANTENNA - π‘
this emoji doesn't match yours
-_-
Copy your channel emoji and do charinfo here
Umm ma guy discord uses twemoji rendering in chat
!charinfo π‘
\U0001f4e1: SATELLITE ANTENNA - π‘
IT'S THE SAME THING! (thanks python)
Its just twemoji rendering in chat and the channel is os dependent
^
Okay... I'm gonna remove the emoji
But wallahi if it doesn't work, I'm gonna mission abort
You can also do slicing and omit the emoji...
You just need to decode the emoji etc
@client.event
async def on_ready():
change_status.start()
cog_status.start()
print("Bot Is Now Online!")
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x.name.lower().startswith('π‘γ»Room #'), guild.voice_channels)):
await invalid_guilds.delete()
await asyncio.sleep(1)
boop = list(filter(lambda x: x.name.lower().startswith('Room #'), guild.voice_channels))
print(boop)
print(guild.voice_channels)
Let's see if this works
IT'S STILL THERE
Well you did not change to for loop
Like x.name.lower()[1:].startswith("Room #")
Wtf I did
oh
It still doesn't work
I'm still getting
@client.event
async def on_ready():
change_status.start()
cog_status.start()
print("Bot Is Now Online!")
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x.name.lower().startswith('Room #'), guild.voice_channels)):
await invalid_guilds.delete()
boop = list(filter(lambda x: x.name.lower().startswith('Room #'), guild.voice_channels))
print(boop)
Any other suggestions?
yeah since this will never work
Why it won't?
since x is the whole class
not class record mb
How u don't see the issue yet
@client.event
async def on_ready():
change_status.start()
cog_status.start()
print("Bot Is Now Online!")
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x["name"].lower().startswith('Room #'), guild.voice_channels)):
await invalid_guilds.delete()
boop = list(filter(lambda x: x.name.lower().startswith('Room #'), guild.voice_channels))
print(boop)
So like this?

You have a .lower which will convert the string to lower but you're checking if it starts with Room
R is uppercase, you converted the string to lowercase
nice
Yeah I told someone that AND THEY SAID IT WAS OK
I know that I'm not dumb
panic
Whoever they were must be dumb
Was it you Panda?
Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "D:\Desktop\MaxTheBot\bot.py", line 20, in on_ready
for invalid_guilds in list(filter(lambda x: x["name"].lower().startswith('room #'), guild.voice_channels)):
File "D:\Desktop\MaxTheBot\bot.py", line 20, in <lambda>
for invalid_guilds in list(filter(lambda x: x["name"].lower().startswith('room #'), guild.voice_channels)):
TypeError: 'VoiceChannel' object is not subscriptable
NEW ERROR!
breaking news
Please don't use ableist here Kraots
.name
You can't index a class
Oh so it was you π
BREAKING NEWS AGAIN
?
It worked.. π
No? But it doesnt matter.
Β―\_(γ)_/Β―
for invalid_guilds in list(filter(lambda x: x.name.upper().startswith('Room #'), guild.voice_channels)):
Please tell this will work
no
Urgh
It won't work
I want Room not room
Because you have Room
-_-
Then use .title
for invalid_guilds in list(filter(lambda x: x.name.lower().capitalize().startswith('Room #'), guild.voice_channels)): this will tough
Or that
@client.event
async def on_ready():
change_status.start()
cog_status.start()
print("Bot Is Now Online!")
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x.name.title().startswith('π‘γ»Room #'), guild.voice_channels)):
await invalid_guilds.delete()
And it works π
Thank you guys!
I really appreciate it
But do you know how filter works?
No. π?
sight
sighs
Is it so it only reads Room # ?
U forgot a colon
Also u need to call the method lol
Can someone send me an invite to the discord api server?
using repl.it, making commands in on_message indexing a string with a string, using format in python 3.9 using json in an async library.
Dont use replit, its the worst online ide to ever exist, and its not even good for discord bots
where?
Just use Visual Studio Man
not this on the official one
thats danny's server
It was handed over to Danny...
hm
tfw theres a difference discord api and discord devs
discord.gg/discord-developers
By Voltana if I remember the correct name
thanks
cool
Implemented cooldowns into my API wrapper yesterday what should the error have access to? Prob time till reset
Better ask in a server like ddevs or dapi
https://discord.gg/discord-api or the official (full with ppl asking for a badge lol) https://discord.gg/discord-developers
I don't see what cooldowns have to do with the API
Why are people so fixated by badges.
.....?
By cooldowns I mean command cooldowns, this is separate from the actual wrapper
U said "my api wrapper" in the dbots channel so i assume u made you own wrapper for the discord api
@client.event
async def on_ready():
change_status.start()
cog_status.start()
print("Bot Is Now Online!")
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x.name.title().startswith('π‘γ»Room #'), guild.voice_channels)):
await invalid_guilds.delete()
Can we do so if there are people in the voice channel, Don't delete it? or pass?
copying my idea
:'(
I'm joking
:)
@cloud dawn
Python 
if yes I might know how to do it π
Yeah i know how to do it
At the error
wait
Good for you u have contributors, i have to single handedly handle all the stuff like rate limits, ws connections, sharding, events .....
import discord
from discord import message
from discord import guild
from discord.ext import commands
import random
import os
from discord.member import Member
class helping(commands.Cog):
def __init__(self, client):
self.client=client
@commands.command()
async def utils(self, ctx):
embed = discord.Embed(title="Help Commands", description="These are the commands available on the Annoyed Power discord bot",color="#11806A")
embed.add_field(name=":judge: Moderation Commands", value="ban,kick,mute,unmute")
embed.add_field(name=":video_game: Game commands",value="8ball")
embed.set_footer(name="Annoyed Power")
await ctx.send(embed=embed)
def setup(client):
client.add_cog(helping(client))
Can anyone help me i dont know the problem w this code these is no display for the utils command
@client.event
async def on_ready():
change_status.start()
cog_status.start()
print("Bot Is Now Online!")
guild = client.get_guild(756504534897000528)
for invalid_guilds in list(filter(lambda x: x.name.title().startswith('π‘γ»Room #'), guild.voice_channels)):
if len(invalid_guilds.members) == 0:
await invalid_guilds.delete()
else:
pass
? π
I only have one other contributor, but I don't see how that matters. About 120+ commits on the repo are from me, not counting the ones in my open PR
get me
+1 pr
ποΈπ ποΈ
r u asking how to handle ratelimits ? 
No I have rate limits done
May I ask how many additions and deletions are at average in those 120 commits π
I'm talking about command cooldowns, for the error what attributes should I give it
Give me a second
TooFastForAndy
What error?
@cloud dawn IT WORKED π
u can check with .members attribute
.
I'm getting better π
Just read the docs lol
I can't understand it...
good question
question?
youre looking for a VoiceChannel object, then u look for it in the docs and u get all the attributes
for invalid_guilds in list(filter(lambda x: x.name.title().startswith('π‘γ»Room #') and x.members, guild.voice_channels)):
await invalid_guilds.delete()
``` is also valid
π
Kai do a PR for me
Ok
We need voice websocket
ποΈπ ποΈ
lemme do it
..
Well I did it in an another way
i dont think discord.member exists
The thing is
what shud i use instead?
I don't know what are (args, kwargs, classes, return type, pos arg)
its already in the discord module
you dont have to import anything after that
ok
Actually I prob wouldn't do that yet to early but I was gonna do sharing but you can do that if you want instead
Also @pliant gulch use create_task instead of gather imo that's better
For where?
Those are things you'd want to become familiar with before trying to delve too deep into discord.py, as you'll be utilising all of those things
Starting heartbeat and reading messages
I don't need create task there
"arguments" "keyword arguments" "classes, OOP" "return type" "positional arguments"
The problem is, I have school, And I love to be a developer, And I'm a self taught learner
Its used cause I like how it looks better and there's no point for create_task
Heartbeat is a loop already as well
Nice... I still don't understand
I don't see any reason why that would prevent you from learning those things, most people here are self taught
Myself included
Umm aight nvm
Nice.
@boreal ravine it still doesnt work
what doesnt
Yeah, I live in Kurdistan, And to the college you want to go you have to get an average of 90% to 100% on the last exam (It's not easy since the School System is trash π )
I want to go to IT (It's %95)
Why so high just use google and the docs and you can make anything
^
I'd recommend https://automatetheboringstuff.com/2e/chapter1/ to get started, it'll take you through the basics of Python. Including classes, returns, kwargs and args (I think) etc etc
could someone pls help im confused why the embed isnt sending
sorry for interrupting your conversation, but as a beginner what video/course would you recommend for learning discord.py from scratch
arguments are things you pass in a function like
def function(x):
return x
print(function(5)) #5 here is an arg.
I was using https://www.pythontutorial.net/
What do you mean from scratch?
you dont learn discord.py or any other modules
Can't say I've heard of it, but if it works then by all mean use it. It should cover classes and functions at some point
Yep, this'll have classes and other OOP concepts
It does, But I keep forgetting because of school
i know basic python stuff, but i don't anything about the discord.py library
Sounds like you need to change your learning strategy
YEP, I DON'T KNOW HOW TO LEARN STUFF BECAUSE MY TEACHERS DIDN'T TEACH ME WHEN I WAS A KID (AND I'M USING CAPS BECAUSE IM MAD)
Looks pretty good.
@slate swan cool
use sololearn app, u can learn while pooping, going to school, having a shower, peeing, fkng and all that shit bro
Well discord.py is already a wrapper so it's basically puzzeling.
π
this website isn't really loading
Yeah I remember learning that
Works fine for me, what do you see?
But I forgot
Pretty unfair to blame your teacher for that.
just a black page since 2 mins
Odd, it works fine for me
Got an insta load website is up.
what is that 800x600 monitor
lol
π
how do u forget tho
But if school is getting too heavy, don't feel too bad. I have done very little work on projects this year just due to it being the last year of highschool so I've had little time extra to work on things. @slate swan
Bad brain
hm
pls help me im hella confused
What is this?
his screen
Just flexing on a 800x600 monitor and w11
w11
i don't think w11 is a thing to be flexed
You can't flex on w11 lol
Well it was 2 weeks ago
your else:
pass isnt necessary tho
I've had win11 since 2 monthes
I just did
You could install w11 5/6 months ago
color="#11806A"
Yeah not 5/6 monthes tho
even if it was a fresh install, you can't flex it
the color is supposed to be an int not a string please change it @torpid latch
Or time passed so quickly idk
Code on phone its better
Okay it was just a joke xD
It was you could brick it someone leaked it.
Yeah I downloaded that one
nah leave me alone, too busy to switch to C++
Code on phone is better and you want to learn c++?
could anyone provide another discord.py tutorial link please?
I do code on phone ye
Lucas
I code on everything buddy
Hmmm
no.
I code on a pregnancy test.
this isn't loading for me
?
ur ip.
Also I do not learn, im getting better
Then i suggest the docs.
should i tor
hm
Lucas's videos sometiems doesn't work, idk why
y tor
it does
Use a VPN
It worked for me but, Not all the time
tor
if it doesnt work just patch it up lol
it opened with tor thanks
I learned Python by following Lucas's videos on how to make a Discord bot
oh ok
That's why I don't know args and kwargs
bad way to learn python honestly
Yes.
Cool.
args and kwargs are pretty op
I don't know much about em
read the docs OR watch a youtube video
@tasks.loop(seconds=10)
async def cog_status():
guild = client.get_guild(756504534897000528)
channel = guild.get_channel(877560418162343956)
message = await channel.fetch_message(879092447613972590)
embed = discord.Embed(title = 'Monitoring', description="Updates every 10 seconds", color=discord.Colour.random())
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
try:
client.load_extension(f"cogs.{filename[:-3]}")
except commands.ExtensionAlreadyLoaded:
status = 'π’ Working'
else:
status = 'π΄ Not Working'
client.unload_extension(f"cogs.{filename[:-3]}")
embed.add_field(name=f"{filename[:-3]}", value=f'{status}', inline=True)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text="Last updated: ")
await message.edit(embed=embed)
I have this on my bot
I didn't write it, But now I can understand how it's made
write it*
!e ```py
class Discord(object):
def init(self, needed: str, *args, optional: str = None):
self.needed = needed
self.optional = optional
def test(self) -> str:
return self.needed
obj = Discord('some needed arg')
print(obj.test())
obj2 = Discord()
@cloud dawn :x: Your eval job has completed with return code 1.
001 | some needed arg
002 | Traceback (most recent call last):
003 | File "<string>", line 13, in <module>
004 | TypeError: Discord.__init__() missing 1 required positional argument: 'needed'
We have (did) so the verb shouldn't be a past verb
obj2 = Discord() what for?
To crash the program.
oh
-_-
yes
It was meant for Sam so he could see what args and kwargs are.
i already explained
ye cuz python is cringe
I learned a bit of cpp
visuals never hurt
I STILL CAN'T UNDERSTAND
i gave him a visual
useful for cpython
No this is patrick
Guys I have an idea for my bot, Is there a way to turn off my bot with a command in the console?
Or if I press the X button it will do some stuff and then close?
are you talking about *args or just arguments? im confused lol
Ye I wanna bind some C code to my string parser for the commands ext. It runs at 640 nano seconds if the prefix isn't a tuple and with it runs at 1 microsecond
THERE IS A DIFFRENCE?
I could get it way lower
no
So why he is talking about *args and arguments
weird terminal...
Why do you want it that fast? Unless you got millions spammers at a time i dont think thats useful, regex?
No regex wouldn't be good for this
And I want it fast cause it is dependent on the users set prefix
Nah ure just bad at regex, so I am
If they have a tuple of 20 strings it would take longer
I find doing string slicing here more effective then regex
And more consistent
yes
I need answers
Why is he saying No then
regex is pretty slow and cpu bound
who
Panda
hm, idk python is fast enough imo, i use cpython for calculation such as my leveling system
Fast but it could be faster
is 640 nano seconds 0.64ms ?
no
6.4?
its 0.000064 ms
Yeah, But nano seconds are smaller
yeah?
So Andy is saying 0.000064ms is slow?
hmmmm
Well if you are trading stocks that is pretty slow
It could be way faster
have you tried to program anything in c or rust and then python?
That's what I'm saying
I Started with Python
idk but theres *args and it'll be a tuple but theres arguments for a variable
ok schumacher
imagine ppl loving java or js
Well it is a lot faster than python sometimes even faster than C

@odd pendant didnt u reply to me earlier
yeah I misread your message
oh cool
Answers?!
I thought you said there were no difference between milliseconds and nanoseconds
But you said there is a difference
oh ok
Sure
And? what it is
Nanosecond is smaller than ms
Just press ctrl+c
no
Why
you could create a separate thread and listen for console input
Depends 1000000 nano == 1ms
bot.close()
In console
oh
@slate swan
you could make it so it closes when the user presses a button instead of typing it in the console
Okay here's what I want to do
These are my cogs ok?
Andy stopping when run time is 1 femtosecond
And I have
@tasks.loop(seconds=10)
async def cog_status():
guild = client.get_guild(756504534897000528)
channel = guild.get_channel(877560418162343956)
message = await channel.fetch_message(879092447613972590)
embed = discord.Embed(title = 'Monitoring', description="Updates every 10 seconds", color=discord.Colour.random())
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
try:
client.load_extension(f"cogs.{filename[:-3]}")
except commands.ExtensionAlreadyLoaded:
status = 'π’ Working'
else:
status = 'π΄ Not Working'
client.unload_extension(f"cogs.{filename[:-3]}")
embed.add_field(name=f"{filename[:-3]}", value=f'{status}', inline=True)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text="Last updated: ")
await message.edit(embed=embed)
what on earth is the point of that
Wait
π©
Pretty sure if it does not work it crashesπ
an extension won't just unload itself during runtime
binary
So if the bot is offline, Before it's going offline it should edit the message and red mark all the cogs
on_disconnect maybe
I mean you could build an OS that only runs on the discord API
will it work tho?
How do I make the number go up by 1 every 5 minutes?
Should do, not 100% though, have a look at the docs and see if it's what you need
Own os is so much work tough..
import time
num = 0
while True:
time.sleep(300)
num += 1
@tasks.loop(seconds=10)
async def cog_status():
guild = client.get_guild(756504534897000528)
channel = guild.get_channel(877560418162343956)
message = await channel.fetch_message(879092447613972590)
embed = discord.Embed(title = 'Monitoring', description="Updates every 10 seconds", color=discord.Colour.random())
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
try:
client.load_extension(f"cogs.{filename[:-3]}")
except commands.ExtensionAlreadyLoaded:
status = 'π’ Working'
else:
status = 'π΄ Not Working'
client.unload_extension(f"cogs.{filename[:-3]}")
embed.add_field(name=f"{filename[:-3]}", value=f'{status}', inline=True)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text="Last updated: ")
await message.edit(embed=embed)
Can I do the on_disconnect event here?
Yeah just gave up and went back to my arch Linux rice
Its a separate event so you'll have to migrate some of the code
thank you
I was thinking about moving to linux since w11 is around the corner..
Doit
I had concerns though about some games not running, is wine good?
A bit off topic now but yeah, almost all the steam games are supported with proton and wine works
Hmm i might start off with a dual boot just to get the hang of it first. Not shy of the cmd so i should start off not to harsh.
π
My windows uses 5/6 gb ram on idle :)
LMAO
@odd pendant
@client.event
async def on_disconnect():
guild = client.get_guild(756504534897000528)
channel = guild.get_channel(877560418162343956)
message = await channel.fetch_message(879092447613972590)
embed = discord.Embed(title = 'Monitoring', description="Updates every 10 seconds", color=discord.Colour.random())
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
status = 'π΄ Not Working'
embed.add_field(name=f"{filename[:-3]}", value=f'{status}', inline=True)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text="Last updated: ")
await message.edit(embed=embed)
Will this work
reason why i shifted to linux
I know it absurd
My arch setup is 2gb idle
Try it and see
nope it doesn't work
how do you except the bot to do something after disconnecting? ( in discord)
Yeah I know but XD said it might work
there might be another event for it this probs not what you need
Doesn't SSL break on linux?
or just make your own event
I don't think so but you should prob ask in #unix
I'm not good at doing that
look it up, you have to do some research yourself
well , on_disconnect is meant for sharded bots afaik...
oh , no it works
wdym, how?
nah , i thought its meant only for sharded bots
-_-
What's the right limit for changing role color?
im sure you cannot edit the embed after the bot disconnects tho
Is there a way to turn off the bot with a command tho?
It's not possible because it's a local host right?
use bot.close
Could you please only ask one question at a time.
!d discord.Client.logout
No documentation found for the requested symbol.
its close in 2.0
logout was removed iirc
sorry
!d discord.Client.close
await close()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Closes the connection to Discord.
didnt i tell u this earlier tho
bot.close()
its a coro
yea u just need to await it
@client.command
async def close():
client.close()
?
await it
it returns a coroutine
await
also , you miss parantheses
@client.command()
^
@bot.command()
async def close_command(ctx: commands.Context) -> None:
await bot.close()```
its preferrable to add is_owner check too , just saying
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 690, in _parse_arguments
next(iterator)
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 979, in on_message
await self.process_commands(message)
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 976, in process_commands
await self.invoke(ctx)
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
await self.prepare(ctx)
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "C:\Users\samjo\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 693, in _parse_arguments
raise discord.ClientException(fmt.format(self))
obv add owner checks
Type hinting everything makes python look so much better π©
more "professional"
Esp when mypy doesn't scream at you
no its pain
agreed
mypy is shit
type hinting makes python actually look like a programming language
magic
It closed a window with a command In discord? (eksplain america)
what
what
Type hinting is fine but why typehint a None type.
thatβs the return type
honestly you should typehint everything
It doesnt return anything not even none
@client.command()
@commands.check(is_it_me)
async def close(ctx: commands.Context) -> None:
await client.close()
Hello?
the asyncio process is stopped ,so your interpreter will for sure close the program....
what do commands.is_owner() except if thats a custom check
a function returns None by default
How does that work
A function must return something because C is build like that.
!e
def foo(): pass
print(foo())
@hasty iron :white_check_mark: Your eval job has completed with return code 0.
None
nice
it checks if you are the owner of the bot

