#discord-bots
1 messages · Page 74 of 1
thats good to hear
youre welcome ;))
val never asks me how i am😔
😟
Is my pfp visible btw?
yes its a little qt
cat
sad :((
Hi, I am having an issue where when i get message.content it is " ". This is not a self bot. Please help.
Kinda odd that you say it's not a self bot. It's usually not a self bot when people ask those kinds of questions, so you saying that makes me think it's a self bot.
or hes stating that just to state it.
thats a bit odd, why would he state hes not using a self bot because of a message's content being empty thats probably the furthest thing someone would think about when trouble shooting an issue like that, either way how can a message content have just a space when a user cant send a space char only?
because every fucking time i look it up they said its cause its a self bot
i figured it out tho
its cause its a setting in the fucking dev portal
message content intent moment
i thought discord didnt dispatch message events if you didnt have the intent? i guess it does with missing fields
-_-
well, it's message content intent
you still get the event, just not the content of it
ill show you the bot
yeah youre right kek
walter white?😍
yes
sexy
yes ik, but still breaks commands
but uh if u look it up everyone says its cause its a selfbot
yeah a few days ago they started enforcing it on verified bots
thats why I said it in the post
so like all verified bots are stuck using slash commands now
val moment
shhhhhhh 😡
before the release of the message content intent, discord had made changes to the gateway that made selfbots always receive empty content/embeds, but now its no longer the only reason for its occurrence
Can anyone teach me how to make discord bots
So many tutorials out there.
Ohk
And many are outdated if youre going to redirect him to tutorials give him a good one to accompany your claim
First off, there is the discord.py Documentation
Second of all, I will.
A tutorial to help you make better Discord bots.
Thats a reference and has outdated examples?
How to Create a Discord Bot with Python [Full Tutorial]
- a video by CreepyD
In this Discord Bot Tutorial video, we'll go through the setup process of setting up discord.py so that we can create Discord Bots. I'll not only be showing you how to create a Discord bot with basic functions and features but I'll also be showing you how to make a Dis...
Terrible code being shown and isnt up to date
and the new release was like a month ago?
!pypi discord.py
2.0 on pypi
Quick question
import discord
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return
if message.content == 'ping':
await message.channel.send('pong')
intents = discord.Intents.default()
intents.message_content = True
client = MyClient(intents=intents)
client.run('token')
What is the difference between these two?
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='>', intents=intents)
@bot.command()
async def ping(ctx):
await ctx.send('pong')
bot.run('token')
What type of question is that and what point are you trying to prove?
No point
I am actually curious. I do not know myself
I see many examples of these, mainly the discord.ext
Well i think the code explains it itself and nothing needs to be discussed as you can read/see its differences and similarities
Its an extension for tasks and commands like prefixed commands and slash commands
?
I'm not trying to argue, I genuinely do not know
Im not really arguing but how did you conclude with that belief?
Oh wait I misread it.
But what is different between @bot.command and @bot.event
wait bot.command is for slash @bot.event is for actual discord.py events
nvm im dumb
@Bot.command is for the command abstraction used with dpy for prefix commands while @Bot.event is for gateway events mainly but can register namespaces/abstractions of the library like setup_hook due to its way of registering events to itself
Okay, thank you.
If you need more info the tutorial i gave should explain it fairly well or the documentation can as well
How could they differentiate a self bot and a bot?
by asking that question, cause regular bots written with dpy 1.7 didnt have that issue (except occasionally when receiving embed or attachment-only messages, which legitimately have empty content)
Guys how we can send a message to channel using discord api in python?
no no
discord had made changes to the gateway that made selfbots always receive empty content/embeds
changes to the gateway how and how could they differentiate a self bot to a bot
oh by the token used to login
user tokens are prefixed with Bearer while bot tokens are prefixed with Bot
reference: https://discord.com/developers/docs/reference#authentication
(well i guess this doesnt describe its usage for user accounts which makes sense)
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
but doesnt self bots just pass there token with the prefix Bearer or would the gateway disconnect that user with a 403 HTTP code?
sorry i dont really know how self bots bypass the gateway and API as ive never done it or researched about it
is there any more context to this? theres not a lot to suggest from that besides verifying your database credentials
(also not discord bots related)
oh wait, i think im completely wrong about bearer being prefixed looking at how it was implemented in 1.7
isnt bearer used for for the gateway IDENTIFY payload and other things while bot is used for the api im not sure ive never dealt with it
bearer tokens let you do stuff on behalf of a user, like getting the guilds they're in
you can get a general idea of it from the scopes listed in the oauth2 page on the dev portal
im not very advanced with discords auth system etc, as you can see🥲
i dont really understand the oauth2 stuff since ive just dealt with bot stuff for discord applications
same :^))
We are using discord.py or some other lib here?
Any
Oh last time i remember this channel was called discord.py
And we have that docs command linked to that
I do, I've implemented "log in with discord" enough times to know it inside and out haha... if you've got any questions i'd be willing to help
You might be thinking about discord.gg/dpy
I am there already ,just asking here
oh its nothing, its mainly just how discord deals with oauth2 which i dont really care about as im not going to make a wrapper or use the knowledge so it would be a waste of your time :33
Hm.. not sure how well an oauth2 wrapper would work. I think there are a few but none of them seem very well implemented or designed. Not really their fault, it's just the way the oauth2 system is designed makes it difficult to, of course, design a wrapper for it
no no, like a whole wrapper that wraps the API and gateway for bots, which when making one you should have a bit of knowledge with oauth2 right?
ive done one but ive never really focused on auth
Ah, a wrapper for the whole thing. Probably not a lot, I can't think of much Oauth2 and discord bots intersecting
doesnt discord bots use Oauth2? sorry im not really knowledgeable with the system at all
Oauth2 is for user account info ,mainly used for login purpose
Not necessarily, you make a bot, get a token, and use that for all of your needs. From a holistic point of view, it's pretty simple
I have used oauth2 in nextjs once, they implemented very clean way
As mentioned, though, once you start dealing with user accounts, and having to do something on behalf of the user, things start getting more serious, and as expected, complexity scales appropriately
ive never implemented it but i probably will if i ever finish my chat app which i was working on and after a week i stopped lol
Ah yeah. I tried implementing it myself, felt it was a pain to work with. What with setting the cookies and managing auth states manually. Found out Next-auth-js, was incredibly easy to work with
ill probably make a chat app with sockets in another lang over python
Same
Literally fallen in love with it lol
If u thinking of js and want to implement auth just go with next-auth it's very easy and very clean
Yep. It's just incredibly convenient to work with
hell no
😅
im wasnt thinking of js at all😭
Oops 😬
i was thinking using something like rust or cpp
For a backend?
yes
Sure. But depending on the scale of your chat app, Python will more than likely do the job
for front-end, my terminal is good enough ;^))
im mostly doing it as its a simple project and its good to develop your skill in a newer language
anyways night night guys :33
nop
yes
I think it's possible if user has bot as an Authorised App, but not sure'
!d discord.Integration.user
The user that added this integration.
discord.on_integration_create(integration)```
Called when an integration is created.
This requires [`Intents.integrations`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.integrations "discord.Intents.integrations") to be enabled.
New in version 2.0.
burh:(
💀 I saw your pfp from a good distance and couldn't see the cat's eyes either, that actually looked so inappropriate lmao
dw you're not the only one
async def suggest(ctx, *, suggestion):
await ctx.channel.purge(Limit=1)
channel = nextcord.utils.get(ctx.guild.text_channels, name="║💡║suggestions")
suggest = nextcord.Embed(title="New Suggestion!", description=f"{ctx.author.name} has suggested **{suggestion}**.")
sugg = await channel.send(embed=suggest)
await sugg.add_reaction("✔️")
await sugg.add_reaction("❌")```
guys why doesn't it work? it keeps saying nextcord.ext.commands.errors.CommandNotFound: Command "suggest" is not found
Did you use @bot.command()?
yeah?
Are you certain you saved the file?
yeah
Could you send me all of your code (without any important stuff, like token) in
!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.
alr
https://paste.pythondiscord.com/xenogogupe @hollow agate
It still doesn't seem like its @bot.command()
@bot.command()
async def suggest(ctx, *, suggestion):
await ctx.channel.purge(Limit=1)
channel = nextcord.utils.get(ctx.guild.text_channels, name="║💡║suggestions")
suggest = nextcord.Embed(title="New Suggestion!", description=f"{ctx.author.name} has suggested **{suggestion}**.")
sugg = await channel.send(embed=suggest)
await sugg.add_reaction("✔️")
await sugg.add_reaction("❌")```
should be it
alr I changed to that
Save the file and restart the bot and see if it works
What's the error?
Traceback (most recent call last):
File "/home/runner/Discord-Bot/venv/lib/python3.8/site-packages/nextcord/ext/commands/bot.py", line 1382, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/Discord-Bot/venv/lib/python3.8/site-packages/nextcord/ext/commands/core.py", line 948, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/Discord-Bot/venv/lib/python3.8/site-packages/nextcord/ext/commands/core.py", line 174, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: purge() got an unexpected keyword argument 'Limit'```
Are you trying to delete just the command message?
Use ctx.message.delete()
Don't use purge
It should be await ctx.message.delete() in full instead of await ctx.channel.purge()
If you ever want to use purge, it's limit, not Limit.
lets see now
don't watch them
Learn python from not guides xd
they're all outdated or bad
Also, discord.py isn't very friendly for beginners, but I did learn from discord.py so I can't talk 😂
WORKS
:)
THANK YOU ALL!
same
but it didn't delete my message
Send the code & error
no error
Code?
async def suggest(ctx, *, suggestion):
await ctx.message.delete()
channel = nextcord.utils.get(ctx.guild.text_channels, name="║💡║suggestions")
suggest = nextcord.Embed(title="New Suggestion!", description=f"{ctx.author.name} has suggested **{suggestion}**.")
sugg = await channel.send(embed=suggest)
await sugg.add_reaction("✔️")
await sugg.add_reaction("❌")```
You saved the file and restart the bot, yes?
what intents do you have enabled?
Ah, none that's why
yeah
it's a fork of dpy
@slate swan go to your Discord Developer Portal and enable everything you see named intents and put intents = discord.Intents.all() somewhere in your code
nextcord*
Oh, you do have it in there, just enable everything you see in Discord Developer Portal with intents
I have done that alreayd
well enabling all intents is not good, but they're just at the beginning so i guess nothing to care about
It's the easiest way for beginners, doesn't really harm anything
Put intents.message_content = True below intents = discord
Maybe that'll work
ugh its fine if msg.delete doesn't work
intents = discord.Intents.all()
He already has it
just how do I make this command only useable on one channel?
by the way @slate swan does your bot have manage_messages permission?
Get the channel ID and use if ctx.channel.id == 9999999999999999:
wait whose code is that
Pro Doggy's.
why the heck do you have both dpy and nextcord??? @slate swan
that breaks all the logics

OHH
THIS WAS THE PROBLEM BOTS PERMS WERE KINDA EDITED AND I FORGOT TO ADD THAT
no need to use so many capital letters
first of all consider using only one API wrapper, discord.py or nextcord
I'd recommend discord.py
but preference
forgot to turn off
that code makes me wanna die in my sleep 😭
It's tutorial code that Pro Doggy has
is that how py-cord has implemented their buttons
idts
that's a third party lib and not py-cord
https://github.com/Pycord-Development/pycord/blob/master/examples/views/confirm.py
this is how they're implemented
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/confirm.py at master · Pycord-Development/pycord
OH, I see what he meant, I'm just stupid, okay.
no...it took me half a minute to understand and I was wrong
smh, do message.channel.send and not message.send
thanks for cooperating

you asked again
!rule 4
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
!rule 4
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
@commands.hybrid.command(
name="avatar",
description="Get the avatar of a user.",
)
@checks.not_blacklisted()
async def avatar(self,context:Context , user: discord.Member = None) -> None:
"""
Get the avatar of a user.
:param context: The hybrid command context.
:param user: The user to get the avatar from.
"""
if user is None:
user = context.author
embed = discord.Embed(
title=f"{user}'s avatar",
color=discord.Color.blue(),
)
embed.set_image(url=user.avatar_url)
await context.send(embed=embed)```
ExtensionFailed: Extension 'cogs.fun' raised an error: AttributeError: module 'discord.ext.commands.hybrid' has no attribute 'command'
*hybrid_command
😭😭
seems like it is discord_slash
not pycord
uhm
did you even think about the question you asked? how it sounds?
like I mean
You are using discord-slash
then you are like "oh yes?? Im using it?"
and then How to use pycord then?
like wtf
i dont even know how to explain that
like just use pycord instead of discord-slash maybe?
what is that
well if you want you can use discord.py's Views implementation and I recommend that, but discord.ui doesn't have all these methods like create_button and e.t.c
idk? walk in the park? go wash your face?
well this code is absolutely nuts
you should rewrite it
it's not even close to how you make buttons in dpy
yes you can
View()*
i think so
btw try it and see
ok
wait are u trying to use both pycord and discord.py?
hm pycord uses pretty much the same sys
it just takes *items in View()
no idea, there is while True which i dont understand for what is there btw
discord.ext.commands.errors.HybridCommandError: Hybrid command raised an error: Command 'purge' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction```
@commands.hybrid_command(
name="purge",
description="Delete a number of messages.",
)
@commands.has_guild_permissions(manage_messages=True)
@checks.not_blacklisted()
@app_commands.describe(amount="The amount of messages that should be deleted.")
async def purge(self, context: Context, amount: int) -> None:
purged_messages = await context.channel.purge(limit=amount)
await context.send(content="Deleted {} messages.".format(len(purged_messages)), delete_after=5 , ephemeral=True)```
don't do content=, it's an arg.
use f-strings instead of format
if it takes longer than 3 seconds to delete the messages then you cannot respond to an interaction, to fix that use await context.defer() before deleting the messages, so you will have not 3 seconds but 15 minutes to respond
create a cursor object, then execute queries with it
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.
Oh ok!
This Is The Code https://paste.pythondiscord.com/sawiqivoni
and this the error ```py
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10008): Unknown Message
Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x0000021E4571BDC0>:
Traceback (most recent call last):
File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 848, in invoke_callback_with_hooks
await self(interaction, *args, **kwargs)
File "c:\Users\Ibrah\Desktop\Discord Bot\main.py", line 266, in fight
await message1.edit(embed=embed, view=myview)
UnboundLocalError: local variable 'myview' referenced before assignment
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: UnboundLocalError: local variable 'myview' referenced before assignment
i referenced myview
before i use it
but idk why it not work]
any idea why this not working ping me please
idk
But rip 😦
That code is pure hell
Have you ever heard of refactoring
you did something like
await message1.edit(view=myview)
myview = ...
You have like 8 lines repeating 30 times
wtf
Just look at that
I did
no 😦 what is this
:0 what a dumb guy me
ah
what do I say
Refactoring itself is basically making code better, and there are many ways to achieve that
so myview up not down
For example
how i still kinda new
Not ctrl+c ctrl+v a thing you need to execute in multiple places but put it into function
hmmm i use visual stuida
That's unrelated
That is what you should do with your code, but as I am looking at it right now those lines can be just brought out of if blocks
how do i put this in my bot description
I said don't copypaste
do i just have to type in manually
only for big bots
Read my sentence again
aaah me dumb
understand
Ok
k ty
Function?
**TRY MY COMMANDS**
`/slash` `anotherslash`
idk if that works
never do Function
ye but when i click on /activity it puts the text into my chat
so i can try it so e idk
What
any thing can make me learn what is Function
ohh ic
idk what is Function
Take literally any python guide
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
a
thx
useful
Function is like a separate piece of code that runs when it is called like if function is called myview you call it with myview()
Ima go learn go
i know what it is but idk how it work
are you make buttons with discord.py?
go bad
Idc
No documentation found for the requested symbol.
jeez
almighty '
!d discord.User.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/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/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
but really now i care about fix my problem than make my code clean
The only thing I hate about go yet is its error handling
prob watch this
Hey!
Thanks for watching todays video, todays video I really hope you enjoyed and join my discorddd :) Also thank you SO MUCH for 1135 subscribers!!
LINKS -
Editor's Server (Manda): https://discord.gg/S22UbR9
Join my Discord - https://discord.gg/xkmA3GPKPT
Nextcord Server - https://discord.gg/Ucmae5Kbwb
Set Up VSC - https://www.youtube.com/...
learn python
ah?
This is more like forkcord
Or just read nextcord.py docs
i learning it but i just got error?
or ask stack overflow
buttoms and everything working
just this small error
that is ?
yes
i did like this
so he not understand
what is your small error
so let me
click
how does buttons work
if that error appears
it means it cant run myview() because it is referenced before assignment
ok i put py buttom1.callback = buttom1_callback buttom2.callback = buttom2_callback buttom3.callback = buttom3_callback buttom4.callback = buttom4_callback buttom5.callback = buttom5_callback myview = View(timeout=180) myview.add_item(buttom1) myview.add_item(buttom2) myview.add_item(buttom3) myview.add_item(buttom4) myview.add_item(buttom5) myview2 = View(timeout=180) myview2.add_item(buttom12) myview2.add_item(buttom22) myview2.add_item(buttom32) myview2.add_item(buttom42) myview2.add_item(buttom52)up
i know
O
let me test
idk i sitll new
if you know about classes
this tutorial explains nicely how to do nextcord.ui.View in class
Hey!
Thanks for watching todays video, todays video I really hope you enjoyed and join my discorddd :) Also thank you SO MUCH for 1135 subscribers!!
LINKS -
Editor's Server (Manda): https://discord.gg/S22UbR9
Join my Discord - https://discord.gg/xkmA3GPKPT
Nextcord Server - https://discord.gg/Ucmae5Kbwb
Set Up VSC - https://www.youtube.com/...
i know what is class is
i know this video
gfu :)
its basically a code for a new object whenever you call it, it makes a new instance of itsself and can be changed
think of it like a blueprint for new objects
u should put that also with the code
it should be within the command
what in the world ```py
Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x000001FDE002B730>:
Traceback (most recent call last):
File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 848, in invoke_callback_with_hooks
await self(interaction, *args, **kwargs)
File "c:\Users\Ibrah\Desktop\Discord Bot\main.py", line 258, in fight
buttom1.callback = buttom1_callback
UnboundLocalError: local variable 'buttom1_callback' referenced before assignment
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: UnboundLocalError: local variable 'buttom1_callback' referenced before assignment```
put that block of code inside the command function
idk i use class before but idk how put classes in this ode
yep let's start do that
idk what is function really
but i know class

ah this class?
no
ah
its async function for discord bots
class buttom(nextcord.ui.buttom)```
class is indicated by class keyword
functions with def
yep
@bot.slash_command(name='fight', description="Fight With a Bot!")
async def fight(ctx, health: int, time: int):```
ok but your button block of code inside that
:(
rip
i need understand frist what you trying to do
async with self.bot.db.cursor() as cursor:
await cursor.execute(f"SELECT color_hex FROM EmbedColor WHERE guild_id = {self.bot.guild.id}")
result = await cursor.fetchone()
how would i get the current guild id
of the user?
ye
if your using interaction then
its in the on_ready btw
ah server name py {interaction.guild} or py {ctx.guild}
Are you trying to make a db using aiosqlite
already have im tryna get the guild id on the on_ready
also getting current guild is weird since the bot will be in a lot of guilds later
and i pertty sure server id py {ctx.guild.id}
im confused are you lookinng for a specifi guild
hm true, so is this not possible
xD
ye unless you have a specific guild you want it to always choose
ah sigh
ah
ty anyways
What are you trying to make it do
ok now any one can help me
ill come wait
basically a user selects an embed color and all the embeds of the bot will be that color, ive stored the hex and im tryna access it but i cant get the guild on the on ready
you will prob need it in every command
i could add it to every command but then id be lazy
sure
make it into a function
Ok me will wait 10 mins
make a async function that gets color from data
then you can just calll on it every time in code
aight ty for ur help
ok back
np
@vale frigate you have smt like this right
where your buttons are above it
you want to take buttons and index it inside the command
a
also make sure you put button1 to 5 variables also in there
OH WHat a smart guy
:/ e not relly
yes
it should work?
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: UnboundLocalError: local variable 'buttom1_callback' referenced before assignment```
@outer parcel
O is button callback a function?
true
click
e doesnt work for me
could u paste it into pastebin? or smt
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Sure!
ty
when i click this windows tell me there are vrius click to see more info
💀
i know this was kind a wrido
should be first thing
that does not mean there is virus
i know
its just a virus checkup there are no threats
i was jkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
o lol :/
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
kinda dumb jk lol
aight ty
🙂
you have not defined myview yet
@outer parcel could you help me with the fucntion btw cos now im kinda stuck
async def embed_color(self, interaction: nextcord.Interaction):
async with self.bot.db.cursor() as cursor:
await cursor.execute(f"SELECT color_hex FROM EmbedColor WHERE guild_id = {interaction.user.guild.id}")
result = await cursor.fetchone()
color_hex = f"{result[0]}"
readableHex = int(hex(int(color_hex.replace("#", ""), 16)), 0)
function ^
color=await embed_color(self, interaction)
its receiving a NoneType
aaaa then how
u cant select items from aiosqlite like that
wdym
like this
you are not returning anything
o
await cursor.execute(f"SELECT color_hex FROM EmbedColor WHERE guild_id = ?", (interaction.user.guild.id,))
result = await cursor.fetchone()
wait can you select from aiosqlite like that
idk im used to doing a bracket variable at the end
i defind view=myview
thats not defining
o i do mine different but it works
readdddd up dude
ok
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
you put this buttom1.callback = buttom1_callback
buttom2.callback = buttom2_callback
buttom3.callback = buttom3_callback
buttom4.callback = buttom4_callback
buttom5.callback = buttom5_callback
myview = View(timeout=180)
myview.add_item(buttom1)
myview.add_item(buttom2)
myview.add_item(buttom3)
myview.add_item(buttom4)
myview.add_item(buttom5)
myview2 = View(timeout=180)
myview2.add_item(buttom12)
myview2.add_item(buttom22)
myview2.add_item(buttom32)
myview2.add_item(buttom42)
myview2.add_item(buttom52) at bottom of code
ye ty its working now
you are passing myview as param to the function, you haven't defined myview though
put it below this
`py
buttom1.callback = buttom1_callback
buttom2.callback = buttom2_callback
buttom3.callback = buttom3_callback
buttom4.callback = buttom4_callback
buttom5.callback = buttom5_callback
myview = View(timeout=180)
myview.add_item(buttom1)
myview.add_item(buttom2)
myview.add_item(buttom3)
myview.add_item(buttom4)
myview.add_item(buttom5)
myview2 = View(timeout=180)
myview2.add_item(buttom12)
myview2.add_item(buttom22)
myview2.add_item(buttom32)
myview2.add_item(buttom42)
myview2.add_item(buttom52)
can you read up the link i send you
!e
def foo():
print(a)
a = 1
foo()
@paper sluice :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | File "<string>", line 2, in foo
004 | UnboundLocalError: cannot access local variable 'a' where it is not associated with a value
LOL
rip
sorry kinda rude xD
that's what you are basically trying to do
bruh
my view is not a function here
he is making it inbuilt within the code
xD
look
true
@vale frigate
i keeping tell him read up
copy what i replied
bottom of code or of command
and paste it below this
oh ok
paste it below this
player2 = random.choice(namesoffight)
buttom1 = Button(label="Push 🤛", style=ButtonStyle.red)
buttom2 = Button(label="Kick 🦶", style=ButtonStyle.red)
buttom3 = Button(label="Fire 🔥", style=ButtonStyle.red)
buttom4 = Button(label="Shot 🔫", style=ButtonStyle.red)
buttom5 = Button(label="Eat 🥩", style=ButtonStyle.green)
buttom12 = Button(label="Push 🤛", style=ButtonStyle.red, disabled=True)
buttom22 = Button(label="Kick 🦶", style=ButtonStyle.red, disabled=True)
buttom32 = Button(label="Fire 🔥", style=ButtonStyle.red, disabled=True)
buttom42 = Button(label="Shot 🔫", style=ButtonStyle.red, disabled=True)
buttom52 = Button(label="Eat 🥩", style=ButtonStyle.green, disabled=True)
buttom1.callback = buttom1_callback
buttom2.callback = buttom2_callback
buttom3.callback = buttom3_callback
buttom4.callback = buttom4_callback
buttom5.callback = buttom5_callback
myview = View(timeout=180)
myview.add_item(buttom1)
myview.add_item(buttom2)
myview.add_item(buttom3)
myview.add_item(buttom4)
myview.add_item(buttom5)
myview2 = View(timeout=180)
myview2.add_item(buttom12)
myview2.add_item(buttom22)
myview2.add_item(buttom32)
myview2.add_item(buttom42)
myview2.add_item(buttom52)```
ye see if works
Ok Sir!
very very weird structuring
Is there any errors quick i have to go soon
i understand how fix all this
does it work?
Yep but there are so small problem
what?
Frist of all py buttom1.callback = buttom1_callback buttom2.callback = buttom2_callback buttom3.callback = buttom3_callback buttom4.callback = buttom4_callback buttom5.callback = buttom5_callback myview = View(timeout=180) myview.add_item(buttom1) myview.add_item(buttom2) myview.add_item(buttom3) myview.add_item(buttom4) myview.add_item(buttom5) myview2 = View(timeout=180) myview2.add_item(buttom12) myview2.add_item(buttom22) myview2.add_item(buttom32) myview2.add_item(buttom42) myview2.add_item(buttom52) working
butttt py buttom1_callback is furtion
ye
we need put py async def buttom1_callback(interaction): up
async def buttom1_callback(interaction):
print("hi")
buttom1.callback = buttom1_callback
buttom2.callback = buttom2_callback
buttom3.callback = buttom3_callback
buttom4.callback = buttom4_callback
buttom5.callback = buttom5_callback
myview = View(timeout=180)
myview.add_item(buttom1)
myview.add_item(buttom2)
myview.add_item(buttom3)
myview.add_item(buttom4)
myview.add_item(buttom5)
myview2 = View(timeout=180)
myview2.add_item(buttom12)
myview2.add_item(buttom22)
myview2.add_item(buttom32)
myview2.add_item(buttom42)
myview2.add_item(buttom52)```
like this#
yes but index it probperl;y
make sure button1.callback is not isde of the callback
ye but all callbacks above this
but index properly
otherwise it wont work
ye but put it above the code like this
so altogether like this
like this what we trying to do rn py Print(view) view = "It will not work"
O
async def callback has to be aboce button.callbacks
still me not understand
oof
oh
wait OHHH
wait me dumb ;/
:o
Lol
put the async function iside of the command
but above the this area
so it is definied before it is called
o
I have to go soon
ok now above funtion?
Ok!
should look like this
I UNDERSTAND you try put funtion in command
Hey @vale frigate!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
ah
@outer parcel https://pastebin.com/nLTadAxq
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
huh where is the callbacks function
i ahve to go but put the button callback functions
above this
I am gonna get a heart attack from this
so just py async def buttom1_callback(interaction): above thos
;0 rip @vale wing
And why is it named buttom
but just don't make me change all my code let's just fix this problem
You'd better rewrite the whole code and your issues would automatically disappear
With actually thinking about architecture
I know but let's fix and then rewrite
You can fix it by rewriting
ah it will along timeee
um ok let's rewirte
@vale wing Now what we gonna do frist
so what i do now ;/
ok me afk ping me when you at pc
Thank you for help anyways!
i really still new ;/ and don't know alot of things
ping me if you ready
ah
@vale wing
😦
anyone
um D:
D:::
sorry for ping again @vale wing
D:::::::::
:0
0 understand 😭
RIp
any one help
i stay here or 1 hour
no help so idk you
does i have make this in /
frist time know that
ah
um
1 sec
yes this
!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.
you take arguments in the function definition, not in command decorator 🗿
Oh
OH
Nvm
wrongpy @bot.command(name="haha", argument: ...) async def haha(ctx):
error ```py
Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x00000241ED803730>:
Traceback (most recent call last):
File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 848, in invoke_callback_with_hooks
await self(interaction, *args, **kwargs)
File "c:\Users\Ibrah\Desktop\Discord Bot\main.py", line 237, in fight
buttom1.callback = buttom1_callback
UnboundLocalError: local variable 'buttom1_callback' referenced before assignment
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: UnboundLocalError: local variable 'buttom1_callback' referenced before assignment```
right py @bot.command(name="haha") async def haha(ctx, argument: ...)
this code
Read the error
first define variable, then use it, you have wrong order of that
well for you function
not variable
oh my gosh...
i did
that is -eyes
yes i still new
you'd better learn basics of programming first, because that code is... bad...
you are trying to use the function before defining
import it 💀
SlashContext does not exist
true
help this guy he good guy
you should refer to docs for that
i know class fustion everything but i really just lazy 🦥
so what i do??? put fuction up???
i would be lazy to write that whole code
900+ lines
ah you will not this not your code 😂
me who will edit
but just So i need put the defin before fution
me who dint inderstand you english
I would recommend structuring your code better
how
😭
How do I measure the latency between a message being sent, from the time it triggers?
thats for you to decide, but you can subclass View and add buttons with callbacks directly.
Example!
@vale frigate k I am back
congrats on surviving goland
About this @vale frigate
- There's special bool type for true/false values, use it instead of strings
is_fighting = True
is_fighting = False```
2. Don't use `time.sleep` in async context, instead use `await asyncio.sleep(...)`
3. Instead of `await ctx.channel.purge(limit=1)` you can just `await ctx.message.delete()`
4. `health` and `time` will never be equal to **type** `str` and as it is typehinted it will never be **instance** of str either
5. For checking if the value is in required range you can use `if a in range(min_inclusive, max_exclusive)` instead of or, that's ok too tho
Unnecessary typecast and unnecessary brackets
As for those hell-like callbacks..
Instead of doing this (pseudocode)
if a > 5:
a += 10
b += 20
c += 30
if a < 5:
a -= 10
b += 20
c += 30
Do this
if a > 5:
a += 10
if a < 5:
a -= 10
b += 20
c += 30```
This is one of refactoring methods you really should utilize
Also I just put some of your callbacks into diff checker, seems like the difference is only damage. Instead of defining the damage in every fricking callback make a button subclass with damage attribute and just overwrite the callback inside of subclass and instantiate objects of that subclass
hi I am programming a discord bot in python and was wondering how you call functions in something with discord api that still allows reading and writing to a file I've looked online but couldn't find what I was looking for
any help would be greatly appreciated
Um what
ok
Do you mean performing file operations without causing blocking?
Use aiofiles or bring it out to a thread/executor
performing the operation of the code thats been written as a sub root and then excuting it accordingly with discords api
am I making sense
let me know if you need more info
Yes please
You have some python code and you want to execute it with the discord api?
yes
Ok but that makes no sense
ok
I've written a program using sub-roots the code is there I just need to change the inputs ect but because there if statements to match with the code I think
unless I just write something like run subroteins()
Just speak in layman language
ok
You want to send code in discord, read it with the discord bot, execute it and send the output to discord?
yes
how would I go about using that?
For jishaku, install with pip and load the extension (bot.load_extension("jishaku"))
Then you can use {prefix}jsk py {code}
For piston, you can use aiohttp/httpx
my python bot not turning on and showing this. i made it on repl. it was working fine for the past months
sounds like a ratelimit
meaning ?
meaning i should remove some commands ?
what do you mean by that ? whats terminal ? i am a noob sry
you are right what to do now ?
no problem here, just so happy that i somehow guessed the line to disconnect from a vc first try 🙂
i made a guess that voice_client was a part of the guild and i was right 🙂
show the whole window
there should be like a "terminal" or "console" tab
isn't that just autocomplete doing 90% of the work
no, auto complete on vscode dosent even extend past message.author for some reason (for me atleast)
as per the pinned messages, its likely your bot was banned alongside everyone else running their discord bots on the same replit datacenters
await message.author.guild.voice_client.disconnect()
i didnt even know guild was an attribute of author so i had to guess the last 3 🤣
there, "shell"
you cant do much about the discord ban besides finding another way to host your bot (see pins in #965291480992321536)
and in the shell type "kill 1"
You can avoid the ban by changing your public IP as cloudflare is the one that sets the ban to that IP and blocks incoming traffic
oh something is happening
thats just poetry installing all dependencies from poetry.lock into an environment
if replit banned all discord-related packages, would they lose half of their customers?
iunno about their demographics
it worked thankyou
good ol workarounds
🤨 👍
That would be imposible to block any packages that interact with the Gateway and REST API of discord, the only possible thing to do is not to let any IP and its traffic reach that server/discord
😁 🤝
so ive been trying to get my bot to play audio in vcs, following a tutorial. but ive gotten the biggest error message i have ever seen in my 10 months of python and i dont know how to interpret this
its 241 characters above the limit
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
the code
FFMPEG_OPTIONS = {'before_options' : '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options' : '-vn'}
YDL_OPTIONS = {'format' : 'bestaudio'}
vc = message.author.guild.voice_client
if vc is None:
await message.reply("i am not in a vc")
return
else:
with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(content_words[1], download=False)
url = info['formats'][0]['url']
source = await discord.FFmpegOpusAudio.from_probe(url, **FFMPEG_OPTIONS)
vc.play(source)
the error message isnt consistent either, sometimes i just get
2022-09-04 15:36:08 INFO discord.player ffmpeg process 16672 successfully terminated with return code of 1.
How do i get the person who used the command using @bot.command() async def func(ctx):
ctx.author
thanks
what is the function to delete a message again?
is it await message.delete()
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
Hey um, oops wrong person
To access the author's name, it's "ctx.author.name", correct?
What does this mean?
Writing web request
Writing request stream... (Number of bytes written: 8764807)
Tried following a tutorial on YT to host Dc bots and I installed by typing iwr https://fly.io/install.ps1 -useb | iex in the powershell
I'm kinda new to programming in general so forgive my ignorance 
Yes, without the quotes
kk
It installed properly but I wanna know what that means.
isnt fly.io that sketchy ad website?
or is it that bee one
ok
Looks ok at first glance though
So far my code works!
How do i add reactions
what is the function called?
await message.add_reaction('reaction here')?
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
Changed in version 2.0: `emoji` parameter is now positional-only.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
What is the event for when a reaction is added?
I have a bot that is suppose to forward discord messages to twitter but doesn’t respond. All the intents are enabled th
on_reaction_add or on_raw_reaction_add
what is the difference
Latter is triggered even if the message isn't cached
ok
@bot.event(WHAT AM I MISSING HERE?)
async def on_reaction_add(*args, **kwargs) -> None:
print('Added')
What am I missing in bot.event(here)
it's coro= but idk what to put after the =
it says im missing a positional argument
you don't call event
oh yeah
ypeError: event() missing 1 required positional argument: 'coro'
you dont call it
ah okay.
just @bot.event
thanks
What does it give me
What does the on_reaction_add function give me as args
printing *args, **kwargs result in an error
What's the error
@bot.listen()
async def on_message(message):
with open("curse_words.txt", "r") as cursed:
gg = cursed.readlines()
print(cursed.readlines())
for line in gg:
if line in message.content:
await message.delete()
await message.channel.send("ayy dont curse")
``` message not deleting and no error
did you check for case sensetive? if yes, is the line read as a string?
in da print statement its printing an empty list []
the words in the text file are written as like this
fword
fword
The printing issue is caused by the second readlines() call
g = cursed.readlines() changes the stream position to the end
Try this:
content = cursed.read()
print(content)
So calling cursed.readlines() again will return []
This should print out the whole txt file
hmm, its printing
['fword\n', 'fword\n']
how can i make my bot print some stuff when somebody uses any of commands?
just put print() between the code of the command
well printing it was just an example
i will try to make it give some coins randomly when user uses the bot
I cannot help with it specifically but i will say, try making a list to record the no. of uses of the command or every single command and then trigger a specific coin giving system when that no. is hit
okay then try this:
content = cursed.read()
for l in content:
print(l)
make a try: and expect:
its printing the file in this way
fword
fword, and the command is working but raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message error keeps getting printed again and again also the "ayy dont curse" sentence gets sent and delete multiple times
@swift pumice can you give more details pls?
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., timed_out_until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
this has a timed_out_until kwarg
what would i put after the =
datetime object
readlines does that, read prints out whole the text in a string
isnt readlines the same as read().split("\n")?
hi guys is it possible to give a slash command argument a description
Yea
how
What module
Have u checked out the slash command example in the examples folder in the repo?
Thanks!
yes ik how to add a description to the whole command
but is there a way to do it to each argument?
Was wondering if anyone can help, I keep getting the following error on my discord bot:
AttributeError: 'int' object has no attribute 'id'
But I am struggling to get my head around this and where I am going wrong, so I was wondering if anyone had any good learning material that focus on this area of python, cheers!
!e
int.id
@primal token :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: type object 'int' has no attribute 'id'
Youre trying to use the id attribute on an int
Not really sure what I am suppose to use there then , back to learning basics then as this just isn't processing in my brain lol cheers.
You probably tried to use an attribute on a variable thats literal to an int and not an object with such attribute
!p discord.Interaction.user
Converting to "int" failed for parameter "pep_number".
Converting to "int" failed for parameter "pep_number".
!pep <pep_number>
Can also use: get_pep, p
Fetches information about a PEP and sends it to the channel.
There are a few common ways this error can happen. lets assume one of them. py channel = 343944376055103488 print(channel.id) Here, people who are new to python will assume straight away that channel is now a discord text channel when using discord.py. This is not the case and infact it is still an int.
What should be done here is that, first of all know how to convert an int into a discord.TextChanel py channel = Guild.get_channel(343944376055103488) print(channel.id) Now this piece of code works because we've converted int -> discord.TextChannel
how do i get the person who interacted with something
NoneType: 😏
do you have multiple on message events?
it might mean their for-loop attempted deleting the message more than once
but id first double check the code to make sure the content was read correctly
its very easy to screw that up
When using on_reaction_add how do I check what message they reacted to?
what code do you currently have and what library are you using? how it should look like will depend on what is being interacted with (slash/context/message component)
!d discord.Reaction.message
Message this reaction is for.
My if state does loop through the role ids with a dict i use and for example, if i did
print(role)
It does show the id of the emoji selected, so I assumed with that all set up an await would suffice:
await payload.member.add_roles(role)
I think I need a break from tech/coding for a bit 😄 haha.
thanks 🙂
i worked it out but thanks
i was using discord.py
interaction.user.mention
just needed that
oh i thought you meant getting the Interaction itself
Well you said role is gonna be an iteration of your dictionary that holds IDs right? So they would be ints. The problem is add_roles assumes you pass a Snowflake which is just a protocol for any class with an id attribute
You could do await add_roles(discord.Object(id=role)) to make it a snowflake
Crikey, I can't believe it was that simple and I have been at this for weeks. Goes to show that what your learning isn't always the right thing though, I'll have to go through the docs again, but thank you ❤️
No problem
Just remember there is a layer of abstraction that comes with discord.py, make sure to pass specific objects it tells you to do
File "main.py", line 40, in <module>
bot.run("token")
File "/home/runner/ScamCheck-1/venv/lib/python3.8/site-packages/discord/client.py", line 828, in run
asyncio.run(runner())
File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete```
??
I will do, I'll definitely have another read through docs to tyr get a better understand.
Is that all? Seems like there must be more
@hushed galleon is this how i get the right info? ```py
message, emoji = reaction.message, reaction.emoji
yp but ican't paste all
I am trying to find what emoji they used and what message they reacted to
!paste now you can
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.
do str(reaction.emoji) though
ok
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
@slate swan
ok
... @slate swan 'charmap' codec can't encode character '\U0001f633' in position 0: character maps to <undefined>
message, emoji = reaction.message, str(reaction.emoji)
print(message, emoji)
Kek, knew it was gonna be a repl.it error as soon as I saw the nix directories in the traceback
my bad, let it be that if it's a custom emoji
its not, do i just remove that?
go ahead
I am trying to recreate a feature that’s in the NekoBot. Basically you type n!punch @rich otter and it will post a picture of anime person punching another person. Same with hug, kiss, etc. does anyone know of a way I can use an existing database images on the internet to pull from to get the same type of specific gifs at random, instead of me having to collect all of the images and recreating my own db?
!pypi pykawaii
that's only for anime pictures, dont hate me :kek:
What function is used to remove a reaction from a message for a specific player.
?
like only their reaction is removed.
await remove(user)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Remove the reaction by the provided [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User") from the message.
If the reaction is not your own (i.e. `user` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.
The `user` parameter must represent a user or member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
thanks
isnt that okimiis package? he talked to me about it
but iirc its docs werent working or something?
Only needed it for anime, THANK YOU ❤️
pleasure is mine
How do I edit a message?
!d discord.Message.edit
await edit(*, content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
anyone know why i get this error when attempting to run my bot?
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
Could be a DNS issue, wait a few minutes and try again it might resolve itself. Or if your on MacOS it could be that you need to install some certifications (iirc)
Are you on mac?
yes, ive found on stackoverflow:
For Mac Users, If they are facing the same problem, You can do the following :-
Go to MacintoshHD -> Applications -> Python3.x Folder.
Double click on the "Install Certificates.command".
not sure what to do next
Did you do that?
yes, it’s finally worked!!
after a week of trying, my bot is finally running
Yeah I had the same issue a few days back when I was setting up my new MBP for Python stuff lol
I'd use my Mac labtop more if yabai WM wasn't so slow on that model
it’s a weird error
Lol. I've got the M2 chip so in terms of specs, it's pretty good. I also use it for school so might as well just do all my coding stuff on it and game on my Windows desktop haha
And occasionally use the arch dual boot when I'm too lazy to change to the mac
Specs with M2 is amazing, sadly my Mac labtop is like a model form 2016-2018 or something
nice, i recently bought a 9 year old Mac, the owner somehow installed OSCatalina on it, so it was a bargain 
At least it's better than my original "main" labtop which had a dead battery meaning It would only work when I kept it plugged in
😔
average gaming laptop user
All my labtops are strictly work related
My desktop is my gamer
Gotta use that RTX 2060 or it's kind of a waste
yeah lol. gaming laptops tend to force you to plug them in all the time, which kind of defeats the point
My old one couldn't power the components with just the battery so everything I did was framecapped or the performance was horrid
The labtop was decent had it not been for the battery health
The person I got it off from didn't keep it plugged in so it just died
I could replace but I'm quite lazy
Gaming laptops are like me, They get hot and explode
It's i7 with a few cores
GPU is some intel graphics card which kinda sucks
But it has more cores and a better CPU than my desktop which is just i5
Who doesn't
Females dont explode
Getting hot and exploding is my favourite pasttime hobby
Wait you explode? I thought females dont explode i guess you prove that study wrong
second grade roasts😼
How do I pick a tuple that is not any of those 5 tuples
I'm not following, how does a tuple have a range? It's not one number?