#discord-bots
1 messages · Page 667 of 1
ill try, ive already got random imported
awesome :)
ty
discord.py v2 cant?
I believe not, 1 sec
ok
Could you elaborate?
elucidate
what do you mean by "add images in a discord bot"
Elaborate means explain briefly.
The discord botttt
You mean send images? Or do you want to save them in a directory?
Finally
!d discord.TextChannel.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**.
!d discord.abc.Messageable.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**.
;-;
What's this
@bot.command()
async def userinfo(ctx, member: discord.Member):
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.set_footer(text=f"requested by {ctx.author}", icon_url=ctx.author.avatar_url)
embed.add_field(name="ID:", value=member.id)
embed.add_field(name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name="joined at:", value=member.joined_at("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name=f"roles ({len(roles)})", value=" ".join([role.mention for role in Roles]))
embed.add_field(name="top role:", value=member.top_role.mention)
embed.add_field(name="bot?", value=member.bot)
await ctx.send(embed=embed)```
can anybody think of a reason why this wouldnt work?
damn another problem with my dadjokes bot
;-;
error?
Whatâs the problem
Just saying it wonât work doesnât help
Is there an error? Is the bot sending something it shouldnât?
Hmmmm
Is the bot not responding?
Ignoring exception in command userinfo:
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 789, in prepare
await self._parse_arguments(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 542, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.
use the file or files if you wanna send multiple argument
I am a noob at phyton idk this stuff
you didnt give the member argument
You missed an argument
u missed smth, cuz thats the internal stuff
You say what I used to say đ
!resources Then learn python before jumping into discord.py as it's a pretty advanced library.
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
This tho
then, learn the basics of python before doing these đ
Is what I try to say to beginners
i didnt?
They donât listen
Aa
You clearly did
I don't like to learn tho
it should be ctx.author I think
oh
My mobile đ
,..
đ€Šââïž
;-;
Bruh
STOP thatâs what I do ;-;
learning is useful

I did not write the line which returns if author is the bot itself and set 5 seconds delay, I wanted a random dadjoke every 5 seconds and I get this
@client.event
async def on_message(message):
if message.content.startswith('ă
€'):
await message.channel.send(dadjoke)
time.sleep(5)```
help?
code
@unban.error
async def unban_error(ctx, error):
if isinstance(error, MissingPermissions):
await ctx.send("You don't have permission to unban members.")
if isinstance(error, MemberNotFound):
await ctx.send("test")
Error
File "/app/main.py", line 100
if isinstance(error, MemberNotFound): ^
IndentationError: unindent does not match any outer indentation level
``` the error is after :
wait where? sorry im dehydrated and it's 3am
It would be really cool if coding was easy
Like u can just tell a bot what to make and the bot will make it for u
You did ctx
đ€Šââïž
That's a you issue that we are not responsible for. We will not spoonfeed you. You can't do something without knowing at leasts the basics of it.
Ok
unless its school
I learn more in this discord server
same
?
self.agree = True
+99999 social credift
I got kicked out of maths class because I didnât hand in homework but thatâs because I was coding
bing chilling
i need help. i cannot live without this 
No
Can I copy this
no
how do i handle buttons?
you need to make an if statement
Oke
Coding is easy, but you haven't learnt the basics of it. You think English is easy, because you were taught English when you were young; however, it's hard for others who never learnt it. Learn the basics of Python first, then complain about how hard programming is.
yeah but you wont learn anything
True
Goodluck figuring out how to define bot.
Hh dad jokes đ
lmao
I bet they donât even know classes
yeah school just teaches things not explaining why and how its usefull
I just learn the advanced stuff first then the basics
đ
đ
help?
@unban.error
async def unban_error(ctx, error):
if isinstance(error, MissingPermissions):
await ctx.send("You don't have permission to unban members.")
if isinstance(error, MemberNotFound):
await ctx.send("test")
there are literally 44 dad jokes but it gives out same outcome
bruh đ
I only used on message once but that is a weird tbh
It shouldnât do that
I have mobile so idk whatâs going on
why dont you just use commands?
There's an issue with your indentation. You most likely missed a space.
!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
ty
bro how do i handle button clicks đ
I checked YouTube I found a video
But they showed how to make a image discord bot but idk what is class in phyton so I was looking for a easy tutorial
Oh yeah good idea
well, i want to troll my friend you see, its just, if the message starts with a hangul filler, it sends dad joke, all jokes start with hangul filler so it do be yeeting dad jokes (no self-activation prevention :))
omg thx

i am so blind
waait so what abt this? whatd i miss
I mean itâs trolling and being annoying
:C

Replace ctx with ctx.author maybe
you didnt ping a member
is there a discord server for discord bot stuff
Idk but there is a channel in this server
....how add button click handler đ
discord py server itâs in the docs
K I will first learn what if class in phyton
give link
well if you typehint an arg to a discord.Member yes you have to ping
Disnake đ
Uhhhhhh itâs in the docs I am on phone so itâs really hard
Like above the thing
In the API
dpy2 doesnt support click handler??
ah ok
ppl have their own preferences
Goddammit acey
wut
am asking the question and i am using dpy
i have the same error
Read the error
đŠ
async def userinfo(ctx, member: discord.Member):
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.set_footer(text=f"requested by {ctx.author}", icon_url=ctx.author.avatar_url)
embed.add_field(name="ID:", value=member.id)
embed.add_field(name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name="joined at:", value=member.joined_at("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name=f"roles ({len(roles)})", value="".join([role.mention for role in Roles]))
embed.add_field(name="top role:", value=member.top_role.mention)
embed.add_field(name="bot?", value=member.bot)
await ctx.send(embed=embed)```
where
Wherever await transform or something is
that was an error i dont even know why that happened
Await self.transform
You put ctx when you were supposed to pass a member
Maybe you meant ctx.author 
Or a mention

hehehe
:]
yeah ig
Read the error
It says await self.transform
Wherever it is thatâs probably the error
Oh
and some reason it's saying i do
Show full error
Ignoring exception in command userinfo:
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 789, in prepare
await self._parse_arguments(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 542, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.
Again
Weird
ikr
F itâs on dpy
sad
member is a required argument that is missing.
I was wondering why it was all dpy packages
you have to pass a member
yo
!command @weary gale
A member
like that
yes
also i basically said that half an hour ago
nothing is happening
i said it first đ
It wasnât half an hour
Cap

me first

else message sends
show code
.
shows the else part
@bot.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.User = None , *, reason = None ):
if member == None or member == ctx.author:
await ctx.send("Kendini Mi Banlayacaksın Aptal?")
cvp = await bot.wait_for("message", timeout = 20)
#cvpp = cvp.upper()
if cvp == "evet" or "ewt":
await ctx.author.ban()
await ctx.channel.send("Sen KaĆındın... **Banlandın Dostummmm**")
return
if reason == None:
dmmsj = f"{ctx.guild.name} Sunucusundan Banlandın GeçmiĆ olsun\n\n Sebep = {reason}"
await ctx.member.send(dmmsj)
await ctx.channel.send(f"{member} BaĆarılı Bir Ćekilde Banlandı")
if isinstance(MissingPermissions):
await ctx.channel.send(f"Bu Komutu ,Kullanmak İçin Gerekli Yetkiye Sahip DeÄilsin!")
else:
await ctx.channel.send(f"EÄer Bu Hata Mesajını Alıyorsan Muhtemelen Yetkin Yok demektir... EÄer Sorun BaĆka BirĆeyden Kaynaklanıyorsa LĂŒtfen {bot.is_owner} iletiĆime geç")
Stop taking the words out of my head
then type faster :]
how do i make it so i dont have to pass myself? so i can just run the command and it just uses me instead of having to ping myself
or keyword
if its None then member = ctx.author
member = member or context.author
or that
@bot.command()
async def userinfo(ctx, member: discord.Member):
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"user info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.set_footer(text=f"requested by {ctx.author}", icon_url=ctx.author.avatar_url)
embed.add_field(name="ID:", value=member.id)
embed.add_field(name="guild name:", value=member.display_name)
embed.add_field(name="created at:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name="joined at:", value=member.joined_at("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name=f"roles ({len(roles)})", value="".join([role.mention for role in Roles]))
embed.add_field(name="top role:", value=member.top_role.mention)
embed.add_field(name="bot?", value=member.bot)
await ctx.send(embed=embed)```
do i have to import anything weird for this?
still not working
error?
its ur code? u should know which part isnt working and you havent given an error
its roles not Roles
Ignoring exception in command userinfo:
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 228, in userinfo
embed.add_field(name="joined at:", value=member.joined_at("%a, %#d %B %Y, %I:%M %p UTC"))
TypeError: 'datetime.datetime' object is not callable
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: TypeError: 'datetime.datetime' object is not callable
ues strftime
your welcome
đ
Huh, i did py from datetime import datetime datetime.now()
i wasnt talking to you
how can i list everything underneath one another?
yes
can i put it before name="blablabla"
yes
ok thx
why not use timestamps? they r way cooler
!d datetime.datetime.timestamp imagine still using strftime
datetime.timestamp()```
Return POSIX timestamp corresponding to the [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instance. The return value is a [`float`](https://docs.python.org/3/library/functions.html#float "float") similar to that returned by [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time").
Naive [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances are assumed to represent local time and this method relies on the platform C `mktime()` function to perform the conversion. Since [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") supports wider range of values than `mktime()` on many platforms, this method may raise [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") for times far in the past or far in the future.
For aware [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances, the return value is computed as:
```py
(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()
``` New in version 3.3.
Changed in version 3.6: The [`timestamp()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp "datetime.datetime.timestamp") method uses the [`fold`](https://docs.python.org/3/library/datetime.html#datetime.datetime.fold "datetime.datetime.fold") attribute to disambiguate the times during a repeated interval.
looks good because you can hover it imo
<t:round(the datetime.datetime.timestamp thing):>
something like that
theres different formats
F is my favourite
<t:1639148229:F> -> <t:1639148229:F>
i used someone elses code
but you dont know how to use timestamp function
same thing, discord.Member.created_at returns a datetime.datetime object, learn how to use it lol
teach me
no
i already told you how to do it
u mean this
yes
this too ^^
so
datetime.timestamp()
interaction.response.send_message("Text", ephemeral=True)```
So I get this error
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 201
172.18.0.1 - - [10/Dec/2021
``` I need to know how to fix it, it only occurs when I run !w leaderboard and this it shows, and it keeps the leaderboard from working...
discord.Member.created_at returns a datetime.datetime object, datetime.datetime.timestamp() returns a timestamp for a datetime.datetime object
guess
^^
print ("Hello World!")
nice
damn no need to shout it
đ
???
How do I get the id's of members in a vc
!d discord.VoiceChannel.members ?
property members: List[Member]```
Returns all members that are currently inside this voice channel.
U need to use list comp
Ok, so I have this function here,
async def init_bot(self, bot: commands.Bot, get_locale_func: Callable[..., Coroutine[Any, Any, Any]] = None):
self._bot = bot
if get_locale_func is None:
# Just use the fallback
get_locale_func = lambda *_: self._fallback
async def pre(ctx):
await self.set_current_locale(await get_locale_func)
self._bot.before_invoke(pre)```
And the issue is that i need to pass `ctx` to `await get_locale_func`, but either removing/keeping it gives me:
passing `ctx` (calling it):
```py
TypeError: 'coroutine' object is not callable```
, but removing `ctx` gives me
```py
return preferences[ctx.author.id]
AttributeError: 'cached_property' object has no attribute 'id'```
Yea member objects
A list of member objects
U didn't call locale_func
I know, I can't call it
Why
TypeError: 'coroutine' object is not callable
do we need to import something for ctx.purge?
when I do that AttributeError: 'cached_property' object has no attribute 'id'
Am I allowed to ping my help channel in this chat??
because get_locale_func requires ctx but I can't pass ctx for some reason
what is the error
.
Weird
nope, purge is a method of commands.Context you could use it as long as you have the commands.Context object
ohh oke
would this return their id's?
members_ids = []
for x in voicechannel.members:
members_ids.append(x.id)
well put them in the list
u can also do member_ids = [x.id for x in vc.members]
Why is it not responding to message edits?
async def on_message_edit(before, after):
await before.channel.send(f'{after.content}\n \n Editado por: {before.author}')```
is it possible to set different cooldown for users with different roles ?
!d discord.ext.commands.dynamic_cooldown
@discord.ext.commands.dynamic_cooldown(cooldown, type=BucketType.default)```
A decorator that adds a dynamic cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
This differs from [`cooldown()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.cooldown "discord.ext.commands.cooldown") in that it takes a function that accepts a single parameter of type [`discord.Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") and must return a [`Cooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Cooldown "discord.ext.commands.Cooldown") or `None`. If `None` is returned then that cooldown is effectively bypassed.
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.
A command can only have a single cooldown.
New in version 2.0.
@sick talon
Hunt could you get it to build?
PyQT?
Yeah
Well I asked in the official IRC channel and found aqtinstall, a module to package Python QT apps đ
!pypi aqtinstall
Ah yeah IRC are all the big brains
Slow response time though
But worth it as you can see
Well yea, but I got the reply almost instantly. Lucky me
Impossible
It was in under 10 min

The pypi?
Same but sadly some modules like tensorflow don't support 3.10 so I have to use 3.9 with py -3.9 -m pip install tensorflow to install them ;-;
(I know its a total pain)
is it also possible to have different cooldowns for users in a specific list ?
tb?
sure, that is what dynamic cooldown does
different cooldowns for different people
Haha its fine
It's almost fully blue in there lol
damn QTDesigner do be cute đ
2010 would like their design back
Really need to find dark mode tho
Still this is the only module with a GUI Designer out there
C#
Python
why is it not acepting the channels?
async def on_message_edit(before, after):
channel1 = [":page_with_curl:ă»central"]
if str({before.channel}) == channel1:
channel = client.get_channel(918425787420508170)
await channel.send(f"{after.content}\n \n Editado por: {before.author}")```
like its not responing rn
@commands.command(name='cooldown')
if not user in high_cooldown_users:
#cooldown set to 3000s
else:
#no cooldown
async def cdown(self, ctx):
await ctx.send("Executed")
i want to make something like this đ i am not able to do it
oh wait i have found a github gist on this same thing :D, btw thanks tho for letting me know about dynamic cooldown
Is there any event like on_guild_join but for when the bot leaves a server(if it's kicked for example)?
Check if member is bot?
to be more precise, i want to clear some data from database if the bot is kicked from a server
on_guild_remove()
!d discord.on_guild_remove
discord.on_guild_remove(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is removed from the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
This happens through, but not limited to, these circumstances...
That's it, thanks â€ïž
how can i make a command disabled for a user for a specific user??
the command which i want to disable have cooldown, so if the user uses that disabled command then he would get the cooldown after the command gets enabled
how to fix this issue ?
the bot doesn't stops sending the embeds
@bot.listen()
async def on_message(message):
if message.channel.id !=872071584175779871:
return
with open('image_urls.txt', 'r') as f:
lines = f.readlines()
g = random.choice(lines)
embed = discord.Embed(title='hm', description='hmm')
embed.set_image(url=f'{g}')
await message.channel.send(embed=embed)
how do I make it to send just 1 time?
I'm creating a review command, only I can't load the user's image
code:
async def test (ctx, product, stars, *, message, member: discord.Member):
embed = discord.Embed (
title = f '** New review **',
description = f '** Product: ** {product} \ n \ n ** Stars: ** {stars} \ n \ n **
Description: ** {message}')
embed.set_thumbnail (url = member.avatar_url)
embed.set_footer (text = f "Server: {ctx.message.guild.name}")
await ctx.send(embed=embed)```
The wrong part is embed.set_thumbnail (url = member.avatar_url) await for ctx.send (embed = embed) and the error is The command raised an exception: AttributeError: object 'NoneType' has no attribute 'avatar_url but I don't know how to fix
member is none somehow
:0 really?
check 4 something, it'll keep sending it everytime you say something lol
do you mean stars, member:discord.Member, *, message?
@bot.command(name='pf')
@commands.is_owner()
async def profile(ctx, username):
async with bot.session.get(f"https://api.mojang.com/users/profiles/minecraft/{username}") as mc_ign:
mc_info = await mc_ign.json()
async with bot.session.get(f'https://api.hypixel.net/skyblock/profiles?key={API_KEY}&uuid={mc_info["id"]}') \
as profile_req:
profile_info = await profile_req.json()
prof_string = f"**Name:** {mc_info['name']} - **UUID:** {mc_info['id']}\n---\n"
for i in profile_info["profiles"]:
prof_string += f"**Profile ID:** {i['profile_id']} - **Cute Name:** {i['cute_name']}\n"
await ctx.send(prof_string)
can this be improved or nah
1 line doesnt necessarily make it faster lol
i have a command that logs (f'{ctx.guild.id} {channel.id} {str(role.id)}\n') all in 1 text file, how can i search for a line that has ctx.guild.id and remove it?
without doing it manually, and without clearing the file
use append mode
how would i append to delete a line?
wait nvm
890306563565305866 917289006335680592 917284127701598250
821722608767598663 864368495952396309 863016275613319209
``` this is whats currently in the text file
i need to make a function that searches for the guild id (being the first statement) and remove it
just use the split function after reading the file
then iterate through the generated list
the question is, can you store the file in a better way? who is giving you the file
with open("file.txt") as f:
content = f.read()
lst = content.split(" ") #generates a list
'''Now iterate through the list to check if the guild id exists and pop it and write the remaining content back to the file'''```
otherwise, you may use splitlines and split function
one moment
!e print(list(map(lambda x: x.split(" "), "hi hi hi\nhi hi hi".splitlines())))
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
[['hi', 'hi', 'hi'], ['hi', 'hi', 'hi']]
.....
file = open("verification/info.txt" , 'r')
for line in file:
if str(ctx.guild.id) in line:
embed = discord.Embed(title=f'Verification Configuration', description=f'Verification is already configurated for this server, would you like to reset it? `Y/N`', color=clr)
await ctx.send(embed=embed)
msg = await bot.wait_for('message', check=check, timeout = 30)
if msg.content == 'Y':
with open('verification/info.txt','a') as file:
file.write(f'{ctx.guild.id} {channel.id} {str(role.id)}\n')
embed = discord.Embed(title=f'Verification Configuration', description=f'You have successfully setup a verification system', color=clr)
await ctx.send(embed=embed)
return
if msg.content == 'N':
return``` this is what i have currently. under the `if msg.content == 'Y':` statement, its adding a new line based on their response. whilst adding the new line to 'replace the old verification configuration', i want it to delete the original line where `ctx.guild.id` is located
does that make sense or
dirtiest code i've ever seen
ik im kinda lazy to indent it
why to imagine when its not necessary @maiden fable
idk I keep imagining things for some reason
tbh i wasnt expecting it to work without fixing some EOF errors
dms
anyone know how i can do that? lol
use the split function, that would make the iteration easier
@eager sorrel
i'm sorry for the ping but i wanted to tell you that the new banner looks sick!
nice ping my guy
lol
and the most right channel for this kind of thing
cuz why not
weird channel but yeah, I agree. that's a nice banner.
oops-, my bad đ
pretty sure I helped make that banner, though it's been a few years now
!ot thank me later
Off-topic channels
There are three off-topic channels:
âą #ot2-never-nesterâs-nightmare
âą #ot1-perplexing-regexing
âą #ot0-psvmâs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
I have a message ID in a string. How can I get the channel of the message if I only have the ID?
I think you're the first non-mod to try to moderate me. that's fun.
I have a discord bot that has been working great with no problems for a couple months but today it says 'latin-1' codec can't encode character '\u1edd' in position 3667: ordinal not in range(256) Any ideas
Lol
even admins can make mistakes
I don't mind. you're all right.
Haha thankfully
the character \u1edd is á»
SMALL LETTER O WITH HORN AND GRAVE
Something somewhere in your code doesn't support that character
no way hello lemon!
Lemon was here thats cool lol
The message is not sent after specifying the category, why?
Its
datetime.datetime.now()
I guess
Ohhh, thanks you so much
Better if you do datetime.datetime.utcnow()
Differ
one gives local time other gives UTC time
Yes
Is this for European time?
utc time
Idk im not from eu
!d datetime.datetime
class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)```
The *year*, *month* and *day* arguments are required. *tzinfo* may be `None`, or an instance of a [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass. The remaining arguments must be integers in the following ranges...
U can see all the methods here
A instance of the error
UTC full form
universal time coordinator something idk
Utc is spain and france and a bit of Norway and africa
!d discord.HTTPException
exception discord.HTTPException(response, message)```
Exception thatâs raised when an HTTP request operation fails.
there is nothing like missing perms lol
istg errors are documented weirdly
!d discord.ext.commands.MissingPermissions
exception discord.ext.commands.MissingPermissions(missing_permissions, *args)```
Exception raised when the command invoker lacks permissions to run a command.
This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
There
mhm
nice
Haha
defo posted 'great bot tysm'
Well it was a bug where I was able to review my own bot but was not able to delete it
ÂŻ_(ă)_/ÂŻ
what would you do if someone made a script to one star it
Find himđ¶
KMS
is that a challenge?
Sure
the only hard part would be making it in c++
đ€·ââïž
How is it possible to register an event wrongđ¶
my c++ skills are ... in progress
Me having no clue about the conversation
U can also scrape the website and get banned
Eh he is just asking if I'mma KMS seriously if someone does that and challanges me for that
ÂŻ_(ă)_/ÂŻ
Use full forms
!ot 
Off-topic channels
There are three off-topic channels:
âą #ot2-never-nesterâs-nightmare
âą #ot1-perplexing-regexing
âą #ot0-psvmâs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
ot1
@client.event()
async def on_message(msg): ...```
đ¶
Who would do that lol
i love how discord.py discourages lazy coders
Im not talking about a typo but just the event not being registered properly
Lmao
I use _ smh

Me who uses the alpha part of my token đ
đ¶
since its gonna error with numerical part
I just use everything with their name
say "simple" if you use client to define your commands.Bot() and say "fast" if you use bot to define your commands.Bot()
fast
I should really start getting serious about my life my coding
no
wait what
i call bot no
If seen people do:
msg = commands.Bot()
@msg.event
async def on_ready():
....
```đ¶
me who uses hunai: In which category do I fall?!?
đ
Im just a normal person and i type botđ¶
you fall in the bru cateogry
Pepe should rest a bit ngl
Yay I am weirdly unique
same for me
Pepe is an eternal entity, dont be ungrateful
i implemeneted a report member system in 3 lines of code
I use bot since it looks cleaner and understandable đ¶
:pepe:
freaking bot.get_channel understandable now for me dude
LMAO
Whats hard about it?
can someone help me with my bot
idgaf about it before but i tried implementing a system because i thought so but forgor then i realized bot.get_channel exists from nowhere then i used it
I hate it when Flake8 screams at me just cz bot.get_channel() can also return a DMChannel and it doesn't have a guild attr, even after casting the type to Guild Channel ;-;
sure, what's the issue
What's up
I present a masterpiece ```py
import discord as notdiscord
from discord import *
no = notdiscord.Ext.Commands.bot(command_prefix=typing.Union[0], intents=notdiscord.intents.none)
no.start if false is False```
that took longer than it should of
đ
ext not Ext
async def report(ctx, member, *, reason):
mod = client.get_user(00000)
wait mod.send(reason name etc)
```i did it in 2 lines pog
out of all the errors you chose that one?
YESSSSSSSSSSSSSSSs
So I am trying to create a bot that is a calculator but has much more advanced functions rather than + or -, more like sin, cos, etc.
hey uhh, get_user? nahh seems kinda off
cz I am noob
i wrote some basic script for a basic calc
okay
@shadow wraith dont tell me you await get_channel đ¶
!d math
This module provides access to the mathematical functions defined by the C standard.
These functions cannot be used with complex numbers; use the functions of the same name from the cmath module if you require support for complex numbers. The distinction between functions which support complex numbers and those which donât is made since most users do not want to learn quite as much mathematics as required to understand complex numbers. Receiving an exception instead of a complex result allows earlier detection of the unexpected complex number used as a parameter, so that the programmer can determine how and why it was generated in the first place.
u can use this, ig
dw, i do var_name = bot.get_channel(id)
would sympy be good tho
!d cmath or this
This module provides access to mathematical functions for complex numbers. The functions in this module accept integers, floating-point numbers or complex numbers as arguments. They will also accept any Python object that has either a __complex__() or a __float__() method: these methods are used to convert the object to a complex or floating-point number, respectively, and the function is then applied to the result of the conversion.
Ok goodđ¶
sympy?
who uses await bot.get_channel(id) if it works
i mean, i define my channel i want to get as a variable
so its not normal text
Idk but bot.get_channel is already asyncđ¶
class Bot(commands.Bot):
async def get_channel(id, /):
return self.get_channel(id)
đ„sactly.
Me who uses try and exceptions for get_channel
Lol
đ
wait a second, my brain can't understand why tf you used your own function inside of defining what the function is meant to do
đ¶ im leaving
me who doesn't use an error handler or try except
lmao I could have just done return super().get_channel(id)
oh, so you use if and else statement for errors
yo
Why use error handler
what a complicated chad
im not here to be toxic
:no:
why not
but I wrote some basic script
you used those 2 words in the wrongfully way possible
Lllllooooooo
I want my console to be full of errors just cz someone forgot to give my bot Read Message History perms
you are going to explode my brain, since my brain is a bomb which is defusable
đ my guy wtf is this #funny-discord-bot-jokes or #discord-bots
the channel doesn't exist nvm
LMAO
No pep8
try:
await ctx.send("")
except:
pass
```đ¶
Me who uses, a function to clear my terminal every 15 seconds
to be honest i can do this
just use sys.exit()
I use replit.clear()
đ§ą
imo i dont use try and except statements, i use @cmd_name.error
how do u do the think in discord where it makes ur code look like not and not plain text
it simplifies error handling for stupid coders like me
I do more
liek this
đ§ą
just make a cog handler lmao
well ```py
not
Use ```
and why did u make that command đ
!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.
alr
Backticks
thanks
hey where's the cring on_message event
cring peeps dont use cogs
h
me
does anyone here know the lib discord-components?
people who make seperate cogs only to add cleaner categorization is a chad
best events that can be used
@bot.event
async def on_message(m):
await m.delete()
@bot.event
async def on_member_join(m):
await m.kick("Have a good day/night!")
@bot.event
async def on_ready():
sys.exit()
@bot.event
async def on_command_error(e, c):
pass
@bot.event
async def on_error(*params):
pass
Yeah
do u know if it works on mac
oh đ
cause it works on my pc just fine
Idk
read github
but not on my mac
read github
An unofficial third-party library of discord.py for discord components. - GitHub - kiki7000/discord.py-components: An unofficial third-party library of discord.py for discord components.
Someone should really try those ngl
github doesmt jave info
and make discord verify the bot đ
sure.
try:
@bot.event
async def on_ready():
sys.exit()
thank me later
Thanx for the idea
i dont think its a channel for trolling
it's related to discord bots and stuff
and this is funny discord bots
it's just crapped discord bot events which nobody should use at all
Flakes8 screaming on u a try block must have a finally or except block
why bother sending it ?
asking @maiden fable because :troll:
I am out bye
ok no seriously read the channel topic
it didn't say ppl only came here for discord bot issues
it was for discussions (never said it had to be unfunny) and questions
we discussing about crap bot evetns

aw
wait i just realized where the insult in my text was đ i am sorry for the offense
wait which insult
i said "you only came here for discord bot issues"
o
and changed it to "ppl"
your capping if you use among_us for defining commands.Bot()
actually.... I did that once
đ§ą
Uhhh I was trolled by some peeps in the dpy server, so uhhh we don't talk about it
it, is a word, what are your opinions on it- ok ill stop trolling unless its related to discord bots
which discord
been like 21 days but no response
the python module or the
Bot Verification LMAO
ik you didn't but you meet the reqs to
its been sent for verification since 3 weeks
what if potential malware
imo there's something slower than that called starting your bot with over 194 billion lines of code
Yea its a nuked bot disguised as a chat bot ik
wait what?
BTW Fun Fact: My bot is in 85 servers with members intent enabled but it only takes 140 MB RAM
That was sarcastic
I know my sense of humor sucks
your nonsense of humor doesn't :troll:
I love that information
not more than me
I'm not even worried anymore about my raspberry exploding
but the first HunAI took more than 500 MB RAM even with about 50 servers
I'm even worried about my bot's cpu reaching 62% (the limit is 65% since i use a discord bot host) becuase i git cloned discord.py
I'm still not worried
The bot would be blocked as soon as I ran a small eval
all my bots are private
cz my bot's allocated RAM was only 500 MB
chatbot be like talking to an imaginary friend living inside my own world of make-believe
HunAI uses only 0..16% CPU tho
Same
Hahaha
a raspberry only has 1gb ram
it would use the half of it...
tho I don't know what kind of brutal b that bot was
how can i ping message author?
as f string
does someone mind helping me with discord-components
like f"{ctx.message.author.mention}" ???
No need for message
neither for an f string
If its only the mention you are correct
@shadow wraith
tho its 150 now since it joined a new server
YEAHH EPIKHOST POGGERS
You need context
not epikhost but okay
pterodactyl host
ah
bru ctx.author.mention simple
So I get this error
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 201
172.18.0.1 - - [10/Dec/2021
I need to know how to fix it, it only occurs when I run !w leaderboard and this it shows, and it keeps the leaderboard from working...
code? (idk how to help though)
Haha!
sorry tysm
đ
Cough coughđŽïž
indents are ok?
@bot.command(aliases = ["lb"])
async def leaderboard(ctx,x = 1):
users = await get_bank_data()
leader_board = {}
total = []
for user in users:
name = int(user)
total_amount = users[user]["wallet"] + users[user]["bank"]
leader_board[total_amount]
total.append(total_amount)
total = sorted(total,reverse=True)
em = discord.Embed(title = f"Top {x} Richest People" , description = "This is decided on the basis of raw money in the bank and wallet",color = discord.Color.blue)
index = 1
for amt in total:
id_ = leader_board[amt]
member = bot.get_user(id_)
name = member.name
em.add_field(name = f"{index}. {name}" , value = f"{amt}", inline = False)
if index == x:
break
else:
index += 1
await ctx.send(embed = em)
Else and if should have the same indentation
last if or first if?
Ping me when you help
I need those colors
Depends where you want it
If you want it in the first if you are correct
yeah then it's correct i guess
extentions
Now give me color theme nowđŽïž
YES
Or else
đ¶ its obvious
wait i'll say all extentions for colorful codes
we love u
ty đŽïž
cry about this code
people like you make programming a better place
i have the worst programming standards đ
You can send a msg when you get it since your getting a channel object
didn't i just get_channel and then send a msg in the channel???
yea im pretty stupid ngl
msg = await bot.get_channel(int).send("str")
Efficiency 
Extentions For Colorful codes
1-) Indents-Rainbow
2-)Bracket Pair Colorizer
zamn, thanks for making my bot's report system 2 line of code
i found x2
i love you mateđŽïž
normally i'm using a few more
imo one monokai is better but this isn't #editors-ides
but when i was delete vsc, i lost all
ty too
AnytimeđŽïž
YwđŽïž
@commands.Cog.listener()
async def on_guild_role_create(self, role):
async with aiohttp.ClientSession() as session:
async with self.db.execute(
f"SELECT webhook, guild_id from 'logging' where guild_id = {role.guild.id}",
) as cursor:
config = await cursor.fetchone()
if config is not None:
webhook = Webhook.from_url(config[0], adapter=AsyncWebhookAdapter(session))
if role.guild.id == int(config[1]):
guild = self.bot.get_guild(int(config[1]))
embed = discord.Embed(
description="A role was created",
color=discord.Color.dark_theme()
)
embed.add_field(name='Name', value=role.name, inline=False)
embed.add_field(name="Type", value="User", inline=False)
embed.add_field(name="ID", value=f'Role = {role.id}\n'
f'Perpetrator = ? IDK', inline=False)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text=f'{self.bot.user}', icon_url=self.bot.user.avatar_url)
await webhook.send(embed=embed)
break``` does anyone know how i can get the role creator?
i was gonna await since variable was unused but i realized bot.get_channel is async alr
my realization is better than my skill imo
Await is for .sendđŽïž
what about await ctx.channel.edit đ€
Idk đŽïž
you can do many discord bot things with await
Not only bot thingsđŽïž
@bot.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.Member = None , *, reason = None ):
if member is None or member == ctx.author:
await ctx.send("Geçerli Bir Kullanıcı Girilmedi... İĆlem İptal Edildi!", delete_after = 6)
if reason == None:
dmmsj = f"{ctx.guild.name} Sunucusundan Banlandın GeçmiĆ olsun\n\n Sebep = {reason}"
await ctx.ban()
await ctx.member.send(dmmsj)
await ctx.channel.send(f"{member} BaĆarılı Bir Ćekilde Banlandı")
else:
await ctx.channel.send(f"EÄer Bu Hata Mesajını Alıyorsan LĂŒtfen @devout iris ile iletiĆime geç")
@ban.error
async def ban_error(ctx, error):
if isinstance(error,MissingPermissions):
await ctx.send(f"Bu İĆlemi Yapmak İçin Yeterli Yetkiye Sahip DeÄilsin {ctx.author.mention}!")
i really need help for this code
it's not banning (always else is working
i got tracemalloc error when i did bot.get_channel(id).send(f"{member} was reported for {reason}")
its await member.ban() ^^
Does it have awaitđŽïž
Try using elif (condition):
.send is a corođŽïž
@commands.Cog.listener()
async def on_guild_role_create(self, role):
async with aiohttp.ClientSession() as session:
async with self.db.execute(
f"SELECT webhook, guild_id from 'logging' where guild_id = {role.guild.id}",
) as cursor:
config = await cursor.fetchone()
if config is not None:
webhook = Webhook.from_url(config[0], adapter=AsyncWebhookAdapter(session))
if role.guild.id == int(config[1]):
guild = self.bot.get_guild(int(config[1]))
embed = discord.Embed(
description="A role was created",
color=discord.Color.dark_theme()
)
embed.add_field(name='Name', value=role.name, inline=False)
embed.add_field(name="Type", value="User", inline=False)
embed.add_field(name="ID", value=f'Role = {role.id}\n'
f'Perpetrator = ? IDK', inline=False)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text=f'{self.bot.user}', icon_url=self.bot.user.avatar_url)
await webhook.send(embed=embed)
break``` does anyone know how i can get the role creator?
madlad for having the dedication to code logs
when you can check audit logs
i moved back to my deffiency and got this madlad code whilst using copilot for no reason
đŽïž
now i realized
how to make my report system more complicated
what other args can you specify in bot.get_channel
!d discord.ext.commands.Bot.get_channel
the id only
now this is banning but only sends if's message
@bot.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.Member = None , *, reason = None ):
if member is None or member == ctx.author:
await ctx.send("Geçerli Bir Kullanıcı Girilmedi... İĆlem İptal Edildi!", delete_after = 6)
elif reason == None:
dmmsj = f"{ctx.guild.name} Sunucusundan Banlandın GeçmiĆ olsun\n\n Sebep = {reason}"
await member.ban()
await ctx.member.send(dmmsj)
await ctx.send(f"{member} BaĆarılı Bir Ćekilde Banlandı")
else:
await ctx.channel.send(f"EÄer Bu Hata Mesajını Alıyorsan LĂŒtfen @devout iris ile iletiĆime geç")
@ban.error
async def ban_error(ctx, error):
if isinstance(error,MissingPermissions):
await ctx.send(f"Bu İĆlemi Yapmak İçin Yeterli Yetkiye Sahip DeÄilsin {ctx.author.mention}!")
i was thinking maybe it was reason: None
should i remove reason = None ?
Your just expecting reason to be None
And if something is given it will probably give a error or do nothing as its expecting reason to be None
No leave the kwarg
no because okimii is right
ahh
Send the dm to the member before banning since the bot would probably not have any mutual guilds and will raise an error
in your ban error handler, it should be commands.MissingPermissions
wait i think the error your trying to achieve is if the arguments don't exist
but your doing a seperate error msg for each missing argument
@bot.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.Member = None,*, reason = None):
if member is None or member == ctx.author:
await ctx.send("Geçerli Bir Kullanıcı Girilmedi... İĆlem İptal Edildi!", delete_after = 6)
elif reason == None:
dmmsj = f"{ctx.guild.name} Sunucusundan Banlandın GeçmiĆ olsun\n\n Sebep = {reason}"
await ctx.member.send(dmmsj)
await member.ban()
await ctx.send(f"{member} BaĆarılı Bir Ćekilde Banlandı")
else:
await ctx.channel.send(f"EÄer Bu Hata Mesajını Alıyorsan LĂŒtfen @devout iris ile iletiĆime geç")
@ban.error
async def ban_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.send(f"Bu İĆlemi Yapmak İçin Yeterli Yetkiye Sahip DeÄilsin {ctx.author.mention}!")
you fixed it, but what are you trying to fix, are you checking if the member or reason is not there?
if so, use the error handler to do that
i dont support giving people copypastable code but the errors with commands. are MissingRequiredArgument but if they are optional tell me
if i use ban command, bot is banning member but no sends any message when banned
i'll try new code a sec
everything still same btw
@devout iris heres my ban error handler
â@âbanhammerâ.âerror
âasyncâ âdefâ âexample_error1â(âctxâ,âerrorâ: âcommandsâ.âCommandErrorâ):
â    âifâ âisinstanceâ(âerrorâ, âcommandsâ.âMissingPermissionsâ):
â        âembed7â â=â âdisnakeâ.âEmbedâ(âtitleâ=â"Error!!!"â,
â        âdescriptionâ=âf"â{âctxâ.âauthorâ.âmentionâ}âYou do not have permissions to ban members."â,
â        âcolorâ=â0xe74c3câ,
â        âtimestampâ=âdatetimeâ.âdatetimeâ.âutcnowâ())Â
â        âawaitâ âctxâ.âsendâ(âembedâ=âembed7â,âephemeralâ=âTrueâ)
Straight from git
Probably not detecting it since it thinks error is a nonetypeđŽïž
So typehint it
As shown above
the only difference between my code and yours == you are using embed
anything else
And i type hinted error
And you should to
Since it thinks error is a nonetype
may be but what should i do for reason idk
errorâ:Â âcommandsâ.âCommandErrorâ
â    â
Nothing if it goes to the audit log it will say nothing
In your params
Show?
Read the error
Thats weird
What version of python are you using
3.8.8
3.10 is kinda buggy with type hints
...
but... will you lost all modules?
No
You can create a requirements.txt and reinstall it
I dont think so
Not sure how upgrading to python 3.9 would fix
^
The typehint stuff should work past 3.5
can i reinstall all in one command?
yep
idk how can i make this
You never knowđŽïž
pip freeze -r > requirements.txt should work iirc
Not sure, can't remember the exact command. You could Google it up though.
only i should wirte module names? or i should write pip install discord etc. in all lines?
i didn't create this... is this creating auto?
Is this how I change a channels permission for a specific role?
member_role = ctx.channel.overwrites_for(918955830810923049)
member_role.send_messages = False
SolverProblemError
Because no versions of discord match >1.7.3,<2.0.0
and discord (1.7.3) depends on discord.py (>=1.7.3), discord (>=1.7.3,<2.0.0) requires discord.py (>=1.7.3).
Because discord.py (1.7.3) depends on aiohttp (>=3.6.0,<3.8.0)
and no versions of discord.py match >1.7.3, discord.py (>=1.7.3) requires aiohttp (>=3.6.0,<3.8.0).
Thus, discord (>=1.7.3,<2.0.0) requires aiohttp (>=3.6.0,<3.8.0).
So, because repl-python3-incomparablecraftytoolbox depends on both aiohttp (^3.8.1) and discord (^1.7.3), version solving failed.
at /opt/virtualenvs/python3/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
237â packages = result.packages
238â except OverrideNeeded as e:
239â return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240â except SolveFailure as e:
â 241â raise SolverProblemError(e)
242â
243â results = dict(
244â depth_first_search(
245â PackageNode(self._package, packages), aggregate_package_nodes
?
Are you using a virtual environment?
im using replit.
i could use visual studio code if i need to?
@final iron
Yeah use vsc
Is it a local file or a module?
How to get username and id of bot that is running
And addet to path
im pretty sure. but how do i check?
Type into the console
python --version
You need the actual python software
"bash: python: command not found"
how to install that in vsc?
Code
@bot.command()
async def sus(ctx, message):
a = random.randint(1, 3)
if not message.content == ".sus":
return
if message.content == ".sus":
message.delete()
print(a)
if a == 1:
await ctx.send("https://tenor.com/view/suspicious-suspicious-person-dangerous-gif-13070288")
elif a == 2:
await ctx.send("""
:red_square::red_square::red_square:
:white_large_square::white_large_square::red_square::red_square:
:red_square::red_square::red_square::red_square:
:red_square: :red_square:
""")
elif a == 3:
await ctx.send("https://tenor.com/view/amogus-gif-21498845")
elif(a != 1,2,3):
print("somehow you broke this, now fix it")
Error
RuntimeWarning: coroutine 'Message.delete' was never awaited
Says it in the error
bruh
you need to install it on you pc
here -> https://www.python.org/downloads/
i don't know how to await Message.delete
You don't. https://python.org/downloads/
that's the main problem
im using linux
sudo apt install python3
Just await it
how
Await itâŠ
and to get pip:
sudo apt install python3-pip
it's the same as telling a sad person to not be sad
i have no idea how
that's why i ask
You should really learn async/python before learning dpy. It's not a beginner project
Read the error, and have a basic understanding of python
it's for fun honestly
@young flower await message.delete(kwarg)
Youâve awaited other commands
So await this one
yeah
You would still need to learn basics to make any command that's not extremely basic
it's old code that i don't understand bc i made it months ago
The tb even says it the coro 'coro' was never awaited
You need to understand it before asking for help
i just forgot basically all python in 8 months
Your not gonna learn if you donât understand
fair enough
thanks for helping
@final iron
Stop pinging the poor guy
We donât sit around all day on the python discord server
We have lifes too
im using chrome os linux
Are you on a chrome book?
You do?
yes
I dontđŽïž
Is it school issued
no
Nvm, these are personal questions
I think Iâm breaking some sort of rule
Idk what but itâs probably something
it isnt
You cant download vsc on a chromebook
!ot
Off-topic channels
There are three off-topic channels:
âą #ot2-never-nesterâs-nightmare
âą #ot1-perplexing-regexing
âą #ot0-psvmâs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
Heâs using the Linux virtual machine built into it
you can through linux
Yes ik
Ah makes sense
I assume itâs very slow
Prob
As itâs a virtual machine on an allready shitty laptop
go off-topic channel.
Then why wouldn't the source downloads work?
its not really
I never said they wouldnât
talking about computers and distros is off-topic.
@lost wolf then use the link I gave you
I donât think they can be asked to move to another channel to help with the same problem
Yeah but the problem is from its bot but you can say that
This all points down to discord.py
So who cares
i tried
How do I handle something like a 503 HTTP Exception with regards to something like sending a message to a channel? Discord itself handles retrying to send the message but my script doesn't know the message has been send and instead gets an exception because the Async task was never retrieved. How do I work around this? I'd like to wrap some logic around the message sending method in my code to always handle that sort of failure. Any ideas?
Most problems were from the bots code
And it didn't work?
try: ⊠except discord.HTTPException
Idk what Linux version they are using
It could be a matter of bad software
Does that work for something like async await ctx.send?
say try: send except discord.HTTPException: do something

