#discord-bots
1 messages Β· Page 421 of 1
Value of what
the variables for the interactions I created
its determined on who presses the buttons and what channel they create
Huh
Those are reinitiated on each interaction bru
Well yeah you need to pass those when you use the view
Don't need a db
doesnt the data get lost when the bot resets? without DB?
uhh not sure you should use cog like that
Persistent buttons are still somewhat dynamic... You need to pass those values every time
Persistent views* there's no such thing as a persistent button and that's some of the point
yeah but the value is detemined by who presses it I cant just use like self.opener?
There are dynamic items
You pass it to cog so Idk how to help with that
Add the view to the bot without passing,
And when you use the view, pass it
use the view = send a message with it
I found this on github. Is this how it's supposed to be passing value to keep it?
This code shows 2 different things
nvm it's prefix
?
Wdym
You got 2 options:
-
Dynamic Items
It's a component instance that is completely dynamic and does not "save" data, rather it gets the data from the component's custom id -
Persistent views:
The view instance can "save" things for as long as it's active, allowing you to not have to use the custom id of its components for accessing the data
Persistent views are meant to be able to work after restarts but they depend on you giving the view instances the right data.
Dynamic items will always work as they depend on the custom id
so is dynmaic items what im looking to do or does either work based on how im handling the class methods?
The code at the top is a dynamic item
yeah but waht I wanna eventually achieve is getting the values back after the bot resets. Currently im just setting it to none and you said using cogs is a different method than whats normal
Then you should probably use dynamic items
ok thanks
You can also use dynamic items with a static custom id
Thanks i'll try it tomorrow. I spent too long coding today lol
https://discord.com/developers/docs/events/webhook-events#event-body-object
I can't figure out why data is marked as nullable, no event has empty data.
Does ? maybe mean it's dynamic?
Build games, experiences, and integrations for millions of users on Discord.
What does optional mean in this context
i believe
data: dict[str, Any] = {}
data['key'] # Raises KeyError if optional else returns None if it is nullable
basically
!d typing.NotRequired
typing.NotRequired```
Special typing construct to mark a [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict) key as potentially missing.
See [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict) and [**PEP 655**](https://peps.python.org/pep-0655/) for more details.
Added in version 3.11.
i think?
So data.get('key', None)?
yes
isnt that the definition of nullable...
ah i see so optional is something that might not even be there
got it
how to use docstring correctly?
i tried everything but it's still showing "no description given" like this:
?timeout
Timeout a member
:param member: The member to timeout
:param minutes: The number of minutes to timeout
:param reason: The reason for the timeout (optional)
Arguments:
member No description given
minutes No description given
reason No description given (default: no reason)
You would need to use numpy style i believe
Which format exactly are you using?
Theres many styles
"""Short desc
Long desc
Parameters
----------
a : int
desc for a
b : str, optional
desc for b
"""
class Application:
"""
An application object to handle webhook events for. Used in `start_listening`.
---
Args:
url_path (str):
The URL path to the webhook endpoint you have specified on *your application's Developer Portal page -> 'Webhooks'*.
For example, if your endpoint is *`https://quackbots.xyz/webhook1`*, then `url_path` should be *`/webhook1`* (it depends on your server/file configuration).
verify_key (str):
Your application's public key, used to verify Discord's request signature.
You can find this on *your application's Developer Portal page -> 'General Information'*.
"""```
Example
You're not forced to use a specific style
This is an option, and yes it works with intellisense or whatever you want to call it
the standard one
Sorry, but there is no standart really (iirc)
I know of 3 different styles
But there isn't a specific one that "everyone and their mother use"
like this:
:param member: The member to timeout
:param minutes: The number of minutes to timeout
:param reason: The reason for the timeout (optional)
oh wait
Hello again chat I'm once again in need of help
With what?
I'm getting the error "In guild_id: Value "[]" is not snowflake." HOWEVER there is not a single "guild_id" in my code so now I'm extremely confused
"""
Timeout a member
:param member: The member to timeout
:param minutes: The number of minutes to timeout
:param reason: The reason for the timeout
"""
Can you show the fill traceback?
youre probably passing a positional arg somewhere
*full
Uh yeah probably should've sent that from the start π
Is it fine if i screen shot
Perhaps a post in #1035199133436354600 is appropriate
I mean when i read the thing it said to use the topical helps and i need help with my bot isn't this the right place
for smaller questions and stuff, yes, but for long topics a seperate thread is usually better (so people can talk about discorsd stuff here, but yopur specific questions are in a thread)
Oh I see I see thanks
I dont see where you specify the type of the parameters
That could be why it failed to parse
yea this work thx
That's RST style,
You're missing a
:type param_name: param_type
You can also change the desc of the param to a new line instead of being in the same line (the parser probably think thats where you specify the type, so it failed to parse)
Like this
"""
:param member:
The member
"""
discord.py's ext.commands only supports the numpy style fwiw
And app_commands support google, numpy and sphinx
My initial thought was that it only support numpy, now i know it also support more in app_commands
i believe you can even add types to your params like this:
"""Class to hold the parameters for fetching content from the API.
:param list[str] | None tags: List of tags to filter posts
:param FileType | None file_type: File type filter
:param SortOrder | None sort_order: Sort order for posts
"""
I finally figured out how to find the number inside the count and add the value to the int
I was overthinking it the whole time
this will give you false positives on substrings
its counting
My only goal is the match the int inside the message content so people could produce messages
target number is 3, I type 8532165 and your code will say it counts
well I asked for help earlier and got insulted so im not gonna try anymore
suit yourself, odd to post code here with the explicit intent of not getting help on it though
What about
if message.content.strip() == str(count["Count"]):
Depends if you want to allow for the number being between words. Regex would be the approach if you did
You have been given 3 solutions and are still choosing to do that lol?
Also are you reading and writing to json on every message π
I mean they've said they don't want help
I don't see where they got insulted
Unless asking for help and not getting the solution or people calling your current code bad is a personal insult to them
But it looks like they left the server, so, welp.
Rip
Has anyone else made an animated discord bot? I want to see what others look like and how they managed it. Id like to compare notes and see what we did differently.
what is an animated discord bot
A discord bot with animated responses
I used GIFs that I render custom for commands and then cache. GIF counts as one message even if its 60 frames, so if you keep it under 8 mb you can send animations
@burnt quiver im not the best at always checking discord w/o notifications. Im happy to talk but you'll get my attention better if you tag me
proceeds to not tag
Hello, I am a new coder and I want to program discord bots. I would appreciate tips and resources. Thank you.
Hellou
Do you have a proper TTL system?
especially since you caching them, at a high usage if it's caching onto bot's memory that's bad, especially if tons of gifs.
@timber dragon I moved that panel onto URL operations for images, they work much more smooth than uploading.
Neat
It decays and then the eviction zone is the bottom of particle space. Eviction exists but everything is memmapped with OS paging and the physics state is saved so its gradual. This is a more prefetch and prebuild oriented approach. Instead of getting a LEGO brick 1 at a time, id rather get the whole set with instructions and bags and pieces organized.
Oh hold on. Let me link it
Sorry I got a little confused what I was answering because its related
Hey so I had a question but I'm not sure if it deserves a thread so I'll ask it here
ok, go ahead
Is it possible to attach a button to an embed that when clicked brings up a modal that sends another embed with the data provided, while also having a button that's identical to the previous embed
for a discord bot?
Yes
iirc yes, idk how exactly you'd do that though, ask in #1035199133436354600 if you want to get a more specific answer than that though
I see alright
You don't attach buttons to embeds
Buttons can either be on the bottom of messages or in containers
Yes I do that with my bot
Did you really have to correct that you know what I mean I just meant the message π
They're right tho
Would you mind sharing π
Buttons under
The terminology matters because those two things are accomplished in different ways
I have a view with a nav bar underneath and buttons under thst. I send an embed with an animated GIF and pressing the paging button underneath edits the message to have a different animated gif. It ends up looking like a loading screen and then a blinking cursor terminal interface like fallout.
Gets around discord rate limits for animations as well. Counts as one message even though its 60 frames
Just need to stay under 8 mb
That's cool but editing isn't exactly what I was going for
So could you maybe explain the differences between them? I've only seen one yet, maybe the other one is what I actually need
Underneath messages uses the "v1" components. You can have up to 5 rows of 5 buttons each
"V2" allows you to put buttons within a message using a more flexible layout. These can use containers, which look like embeds but are very importantly distinct from them. Containers can have arbitrary text, mediagalleries, and components (like buttons)
Uhhhh that sounds complicated. Can I use that for my bot though? As in use it to achieve this ^
Yes you can use either
Both?
You can't use both at the same time
No I meant as in both methods
Yeah both methods could be used to accomplish what you described
I have been just sending the view with my send_message which I'm assuming is the v1 here so I'm confused how I can use that
What have you tried and where are you stuck
So like I said I first made the modal which takes the info, then the view and the button, so now I just have no idea how to make the new embed sent by the modal have the same button to keep the chain going
It doesn't need the exact same button object
You can just send another view with a button that does whatever you want (even if that's the same thing)
...
Now that I think about it
You are absolutely right and I'm dumb as hell
I appreciate it π
v2 components have everything from v1
they're so fun
@fast osprey there u go, since u said it's slow, it was due to the upload method of the images inside of the containers, which im now doing thru a public github repo, using url instead.
It's by definition going to be slower than the integration panel
- user -> discord -> user
vs - user -> discord -> your bot -> discord -> user
I believe the integration menu is just easier to use
The idea/code is there, but what solstice said is true, so I think you could implement this same idea but somewhere else where it's not possible or as easy through discord
We have to be real, users still don't like discords implementation, and i doubt most know how to use automod, or do use it for common words.
the only people saying that are the people who hate change for no reason
it's a perfectly fine implementation
Yeah bro, u gotta follow the market tho man
it ain't like we can do anything about it
i ain't gonna make a public bot, with this insane structure, that only me and 2 friends use
u get me?
And i can assure people would rather use BOT'S SETTINGS rather than "discord integrations"
i've already discussed this yesterday, about interaction / prefix commands, discord been trying for years to remove prefix commands, can u guess why they won't remove them?
cause nobody finna use discord anymore, that's the truth man
...discord can't "remove" prefix commands
and neither try
they're messages. Discord isn't going to remove messages
You don't gotta be anti innovation just because "you're following the market"
with they're "interaction commands"
It's something neither me, you, him can change.
We can't, and im not gonna sit here teaching people how to properly use discord.
in milions and milions of servers
I will say though - many people don't know of these Discord implementations
i ain't making no info/knowledge bot
exactly
I'm taking it you're exclusively in brainrot roblox children servers who cannot understand extremely basic client functionality
Bot has it, built in, works easily.
because I do not see that behavior where I go
But they are better than bots still
In the servers im in, AKA "coms" are huge servers, that have a whole network behind.
And people i also dev for, different custom bots.
made 400$ early month
all these servers have over 200k members
and that's my target server, not a dev server composed by 50 bots and 30 actives, sorry.
It is your decision to design for the lowest common denominator and make it worse for everyone involved
I think bot devs should refrain from still developing these things
Don't care about old bots. But if you're making a new bot, why stick to old things
Since you think you can make this change, go ahead! Make your own bot and do this, i think you'll die before teaching all milions servers how to use discord.
But i ain't doing it.
What old things?
Prefix commands; Doing an integration menu via the bot; Moderation bots
Containers are new, fully component setup, and whole bot will remain coded as component based.
Because people still want that man
Im remaking all of these features, also remastered, that's the key
with my own salt, if u know what i mean
Just because a person wants something that doesn't automatically mean a) it's good for them or b) you are absolved from any responsibility for providing it
incredibly small minded viewpoint
but once again, i ain't gonna make a bot to teach people how to use cord, and neither tell me this, and shit that u can make thru discord integrations, cause respectfully, idgaf π€£
Because these developers keep making them within bots instead of "telling" users that it's available in better form
Neither Me, neither YOU have the right to decide for them, if they want it, they use it, they dont want it, they dont use it.
π
!mute 404264989147529217
:ok_hand: applied timeout to @dry kelp until <t:1761422958:f> (1 hour).
was waiting for the personal attack to come out
!unmute 404264989147529217
:ok_hand: pardoned infraction timeout for @dry kelp.
No personal attacks, thanks.
This isn't much better
There are good reasons to use either application commands or text parsing
No need to flamewar over it
Respectfully, when people think they can make a change over million guilds, it's just nah, my apologies for acting as so, but i don't feel bad over it.
They have a history of personally attacking me
if you want to look through their message history
Because your points are always so out of context, and it gets tiring explaining over and over, which guides me into thinking that.
Then don't engage with them
They do it in response to my answers to other people
Okay, I'll be more explicit
@dry kelp please stop engaging with someone who clearly doesn't want to engage with you
I've never done anything to anyone else, besides of you once points were in total out of context.
@fast osprey just because someone's not behaving well doesn't give you an excuse to do the same
Ping mods instead
You need to verify this information, please read chat history within these days.
You'll understand.
I fully recognize that, and I have endeavored to be cordial minus the one out-of-pocket comment you called out
.
which I apologize for
Alright. This wasn't particularly bad so all I expect is change moving forwards

Many people have axes to grind. If it's getting really problematic, then staff can have an extended conversation about expectations. You should contact modmail about this, in my opinion, it's not something I alone am going to have input on
I genuely tried understanding his points, but they were always so out of context and clearly most of them against me, which gets tiring.
Consider it a competition on providing clear help. People will gravitate to helpful, easy to grasp answers. We don't limit problems to one answer or one interaction
Provide your point, and if they don't bite, they don't bite
@west escarp I never wanted to engage with this person, till the moment happened 2 days ago, randomly commenting of my code, poiniting it as being "bad" saying that there are no "reasons" why i should modify python pkgutil, which i proved him a reason of why we're doing this.
All visible reading chat history of this channel.
Yes, and frankly that's just another instance of todays behavior. Neither of you look good there. "just let rottens rot" isn't something that would catch grace, and neither is "it's not a good reason I'm sure"
Both of you are overly abrasive and aggressive
Thatβs absolutely true, not saying that what i said its alright, but it was all after these replies coming from this person.
Which clearly wanted to engage with me, having 0 experience in the topic related.
Then I expect both of you to cease needling the other, and if it resumes then I will start escalating
Just acknowledge, now assuming they have no experience isn't a good thing to do
Anyway yurp have a good day
Thank you.
I would prefer to interact cordially, which involves not having my experience underminded or having slurs thrown at me
barring that I'm fine not interacting at all and people can choose which answers they prefer
There clearly was a lack of experience, since i was able to prove him wrong in that context.
Its not meant to be rude, its just that our brain is not AI, and we cant access that much data at once :)
and you are doubling down on undermining my experience
He shouldnt of had engaged saying what im doing is terrible from a docstring inside of an image. But i will respect the moderator decision, and fully ignore this person since its just not worth my time.
I already proved my points :)
does anyone know any service that solves hcaptcha? it seems like 2captcha or solvecaptcha.com no longer supports it
!rule illegal to help bypass captchas
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
This channel is so dead
Good
It's not really supposed to be an active community channel, it's here mostly for getting help with Discord bots, and sometimes people don't need help.
^^
@commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
async def ban (ctx, member: discord.Member, *, reason: str = ": Not specified "):
try:
if member.guild_permissions.administrator:
a = discord.Embed(description="User has administrator permissions. ", color=0x0001)
await ctx.send(embed=a)
else:
a1 = discord.Embed(description=f"**{member}** was banned by **{ctx.author}**!", color=0x0001)
a1.add_field(name="Reason: ", value=reason, inline=False)
a1.set_footer(text=f"ID: {member.id} : ")
try:
await member.send(f"You were banned by {ctx.author} from **{ctx.guild.name}**!", embed=a1)
except:
pass
await member.ban(reason=reason)
await ctx.send(embed=a1)
except Exception as e:
await ctx.send(f"An error occured: {e} ") ```
rate my code
Worse than built in
No role hierarchy check π
π
@commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
async def ban (ctx, member: discord.Member, *, reason: str = ": Not specified"):
try:
if member.top_role >= ctx.guild.me.top_role:
await ctx.send("An error occurred while trying to ban the user. Make sure my role is above the role of the user you want to ban.")
return
elif member == ctx.guild.owner:
await ctx.send("you cannot ban the server owner!")
return
elif member == ctx.author:
await ctx.send("you cannot ban yourself! ")
return
elif ctx.author.top_role <= member.top_role:
await ctx.send("you cannot ban someone with a higher or equal role!")
return
elif member.guild_permissions.administrator:
a = discord.Embed(description="User has administrator permissions.", color=0x0001)
await ctx.send(embed=a)
return
else:
a1 = discord.Embed(description=f"**{member}** was banned by **{ctx.author}**!", color=0x0001)
a1.add_field(name="Reason: ", value=reason, inline=True)
a1.set_footer(text=f"ID: {member.id} : ")
try:
await member.send(f"You were banned by {ctx.author} from **{ctx.guild.name}**!", embed=a1)
except:
pass
await member.ban(reason=reason)
await ctx.send(embed=a1)
except Exception as e:
await ctx.send(f"An error occurred: {e} ") ```
is my code good?
^
how can I improve it
By using the built in system
Why is everything wrapped into a try-except
Why are you checking for admin perms specifically
The role check takes care of that
guess they're aware of it now https://discord.com/channels/267624335836053506/1432278129421848708
yes
it happens cause some people with no experience think AI is giving accurate answers.
With no experience they cant make a good prompt
may i ask, why are you giving your variables names as βaβ βa1β
idk
How are you doing something you dont know 
we can name variables anything we want
i couldn't think of a name so named it a,a1
its not wrong, but when you code you expect common sense
π
you are building an embed, just call it embed =
i think thats what most people do
yes
But i can also see lies, and because AI doesnβt inform you properly, that variable is assigned under a function, you can assign same variable under a different function.
And i do believe you tough u needed different variable names everywhere into your file
o
I can also see you are building prefix commands, most people modify the baseclass of bot using a updated ctx
building ctx.error / warning / approve
ty twin i didn't coded that much like I saw a yt video and tried making a bot
alr
so u only create in your code the final response embed
and that administrator check can be counted as a validation, just by checking if target has administrator permission
Why would you need admin perm to ban
This is the correct answer, developer implemented versions bypass 2fa checks and are just less secure for no value
Real
I think he's trying to prevent admins from getting banned, not that permission needed to ban.
Generally speaking, that's a bad idea, or at the very least useless
That's his code, not mine π€·ββοΈ
Maybe he's building a private bot, and not a public bot.
And he wants to prevent admins from being banned thru bot, that's his choice.
i wanna make a public bot
where can I learn this all
Oh man... firstly, i suggest you digging into learning python features.
yes
Then learning how to properly setup your workshop.
Then you wanna look into different packages for your settings, i recommend Dynaconf
Then you wanna learn how to setup poetry, which is an amazing tool, loads all packages inside of a venv directly.
Can also hold different typing rules...
oh
Then you wanna learn how to use docker, which is a most common tool across developers
uv on top tho
Then you wanna dig into how to establish a connection with database (avoid using raw SQL), use a ORM (sqlalchemy)
Avoid using files such as config.py or any .json files for bot's settings, focus on using .toml files for settings, and an actual proper .env for configuration, e.g bot token, database credentials etc.
Once you have knowledge in those, your workshop will eventually look better.
No problem man, there are also other packages you could use, im just saying these because it's what i work with, and they're absolutely amazing.
There's absolutely nothing wrong with raw sql
And in fact it can be more performant than ORMs in many cases
Didn't that admin say to stop engaging with me? Perhaps i never said it's bad, i said avoid, since they're a begginer, it has a better performance than ORM, but imagine besides all mentioned above, he starts learning sql too, something that can be avoided.
Not engaging you doesn't mean you get to express an opinion in response to someone else first and I am forced to let misleading statements stand. This isn't a race to comment
Bro i swear to god, ill start again, and i wont feel bad
tell me what the fuck operation could require such a critical speed that a orm wouldnt do?
in a fucking discord bot
I gave my opinion and you gave yours, they can make their decision and that's it
orms can get inefficient when building long series of statements, at that point it's better to use raw sql instead
Before you trying to engage a conversation with me, look at the messages said, keyword "Avoid using raw SQL", you acted like i said raw sql is bad, when orms will do just fine, even when his bot is in 100k guilds, that traffic will still be handled.
Ace's bot will not be dyno bot sized upon release.
Using an ORM is just fine for learning, and understanding code logic.
Read the last line
That is google btw
brave more specifically, cause i hate ads π
And do you read, not like there are no opinions and everyone agree to something one sided
huh?
Are you even reading what i've told the man? Or you genuely blind, i can understand it from solstice, but you?
^
So i cant have my opinion on things
You can, but he was engaging with me, we all know ORM will work better for a beginner π€·ββοΈ
And performance comment is true, but uneccesary, since it will handle traffic over 100k guilds.
and to achieve 100k guilds up-to-day you need some crazy shit to be able to compete with current market π€·ββοΈ
Then let the man decide, there are no downside of trying viable approach
You think a beginner would prefer:
"""
RAW SQL equivalent:
SELECT id, username, age
FROM users
WHERE age > 18;
"""
rather than
adult_users = session.query(User).filter(User.age > 18).all()
Yes
I havent learned to use orm once in my life
I started by making raw sql and it just more fascinating to see how each keyword works
Then you cannot even engage in this conversation, if you don't have experience in both.
Since you're trying to evaluate 2 things, while only having experience in 1, it doesn't work like that.
you are not a president so you cant vote for president
To make an evaluation you must know both arguments cons / pros.
That's the truth, how would you compare 2 arguments while having experience in 1, do you even think?
Ohhh, i get it, you're like these AI rats, that all they're information comes from AI!
Trying to compare something you have 0 experience in, thats just crazy
ππππ
Have i used any comparision about sql and orm
try an orm your own, then we can resume this discussion , until then i wish you best luck into your things
π€ because i think not
You are trying to point out why raw sql is better, since you have no personal experience into orm, you just cant.
Once you can validate your own points, based on your own experience, thats when we will resume this topic.
its not my business to buy you glasses to see your messages and ours in order to understand this topic discussion.
^^
Can someone please respectfully explain the debate going on here to me?
Kinda Raw SQL vs ORM ig
I preferred an ORM solely because I find it easier to use objects and functions in a traditional Python way
Hmmmm, I have experience with both, and honestly, I prefer and recommend using SQL (without an ORM).

Yes, I agree.
Could you please define why you prefer and recommend raw sql? to a beginner that was struggling to create a ban command, if the reason is operations related, provide a source of information.
Thank you, this is why i told a beginner to relay on ORM
Yes that makes sense 100%, but you told them to avoid using raw SQL, which might make them think it's bad which it isn't
so the wording here might have caused this confusion and all
Avoid doesn't mean it's bad, it's just so they would focus on an ORM usage for now, since it might suit them a lot better.
i meaaannn
when someone tells me to avoid doing something, I would have a mindset that it's bad, but ig it's subjective
I prefer raw SQL because it gives full control and helps you truly understand how databases work, for beginners, itβs better to learn SQL first before touching an ORM.... ORMs hide too much and can cause bad habits
I recommend this page to learn: https://sqlbolt.com/
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
im not gonna play this word definition thingy, i just said to me it seems like something is bad if someone tells u to avoid it, and i already said it's subjective
Welp, when i use a word it means because i know the definition behind of it, you don't think so?
They're just looking to argue. The person who asked hasn't even weighed in
Personally I'd say "I recommend using y" instead of "avoid using x"
This is misleading, and false, you said raw sql gives you "full control", You said you had your own experience into orm, didn't you? I suggest you checking mature ORMs, such as SQLalchemy, Prisma.
Partially right there
ORMs isn't what you should be looking for if you want to truly understand how databases work, yes
But full control logic is out of context.
Do not rely on AI for your answers, you didn't have to say you have "experience", it's fine if you dont, but don't be misleading, cause that is false.
@scarlet tiger
For a beginner, starting with an ORM isnβt really recommended β they should learn SQL first. That was my point, ORMs are great (as long as you understand how SQL works), but as I said before, for someone still learning SQL... theyβre not really recommended yet...
Using an ORM or not is personal, but if you want to really help new developers, donβt just give them the βeasy path.β 
I was reading this unless i realized it's AI
I don't exactly get that point; Would you also say it's better to first do raw http requests with the Discord API before using a library?
Maybe I'm wrong but Idk much about databases, so I can't tell what are the cons of not learning raw sql first
I speak Spanish, and when I write in English I sound like it because I respect spelling very well, sorry if my English is still bad

This guy is clearly using AI for his responses, and makes absolutely 0 sense, for when he brought up the "full control" thingy, which is also possible with mature ORMs
You're writing well they're just trying to undermine you
only AI could spew bullshit like that
Eh
I speak Spanish and your writing in English is better than my writing in Spanish.
What is well?
have you read this?
there's things like having to keep up with the API, and the API can be quite abstract
so using a lib can be easier
"it gives full control" Something ANY mature ORM does already, Prisma, SQLalchemy
i don't want to engage with people that use AI for they're responses.
Yes. I have. Which is why i am disagreeing with you. Have you read it? Because you can. Now you write something in Spanish we all can read please
Sometimes I have to use the translator because I forgot some words lol
What you disagree with? I've said ORM can still give you full control something he said they DO NOT
That's my opinion about wrappers in general, wouldn't an ORM be considered a wrapper
i mean yeah? but because you're not 'wrapping' the same thing, you can't really compare it like that
I've also sent my documentation source.
not*
Yeah hey I'm not calling anything "better", sorry if it sounds like that
Im gonna leave i dont like getting heated and sormtimes i misunderstand. Your English is good man @scarlet tiger
Have a good one
Keep it up
@gritty inlet You doing good, some people think discord bots are nasa rockets, and they want operations to fly out like pigs.
Don't take me under your wing though
Anyway meh each person should use what they prefer
Seriously, should someone just learning use an ORM without understanding SQL directly? That was my point.
Absolutely, beginners should relay on ORMs.
You have 0 experience from the moment you said that bullshit with ai
Lol
this response, it's fully AI
"RAW SQL GIVES YOU FULL CONTROL"
something ANY mature ORM does already
Thank you! Your English is also very good.
@dry kelp if you cannot engage politely, do not engage. We expect people to help others without putting them down or assuming things about them.
Also, for ORMs, #databases is likely a more appropriate channel
I can't engage with people that are misleading and use AI for help.
Good, then the conversation can stop
i replied to his response, which makes 0 sense.
You did so in a way that does not adhere to the #code-of-conduct .
It's tiring repeating same thing 100 times
Hmmmm try writing in Spanish and I assure you I will say the same thing
let's drop it please
???
dude what? are you saying???
(if anyone wants to politely discuss the tradeoffs involved in using or not using an ORM, let's move to #databases)
@scarlet tiger Stop misleading people, mature ORMs will give you full control same as Raw SQL, e.g SQLalchemy, Prisma.
My advice, genuinely you'll be much happier if you take time to realise that you don't need to take on the world and get involved with every conversation you disagree with. Sometimes people have vastly different views on how stuff should work, you're welcome to give input on ways you think would also work, but 9 times out of 10 in a space like this it doesn't benefit anyone to start arguing about them. People will figure out things over time, and if someone is giving really bad advice you can always take to @novel apex and the mods will figure it out, they're more likely to be listened to and don't have a personal attachment so they're not going to be making anyone upset
@vocal plover read that, and tell me if that ain't something AI would say π€£
I'm still learning English and writing with proper spelling (as my teacher taught me), so am I an AI? Help. 
And he thinks this is english related, oh my god
I don't care if it's AI and I don't want to debate you nor anyone else on this, I want to say that if you drop it in cases like this you'll be happier, as will everyone else involved
!mute @dry kelp You were told multiple times to drop this behaviour
:ok_hand: applied timeout to @dry kelp until <t:1761578899:f> (1 hour).
Okay so quick question how can I actually handle errors in a modal?
I tried using a good old try... except but that doesn't return anything while the modal still says "Something went wrong".
you need to actually respond to the interaction
but errors raised in the callback should be handled by overriding the on_error method in the class
OH wait that might be my mistake actually
Okay okay got it thanks a lot
So I'm a little confused about the syntax of Modal.on_error. How do I implement that π?
You'd implement the on_error method within your modal class. It accepts (self, interaction, error)
I opted not to make modals with the class because when I did that it just didn't work
I mean with the class as in you know class modal(yada yada)
You should, that's the recommended way
It's not that bad and I'm sure the troubles you were having can be pretty quickly resolved
I mean of course they can be resolved but like I just DON'T understand classes
Which leads to more problems elsewhere
That's something I'd strongly recommend you target given you are using an object oriented library in an object oriented language
Without the use of classes you'll find you have much worse problems with variable scoping and the like
I watched this a couple years ago but it was pretty good when I did.
https://youtube.com/playlist?list=PL-osiE80TeTsqhIuOqKhwlXsIBIdSeYtc
Oh aigh aigh thank you
how do i install discord.py in visual studio code? i already have python i only need the library
You install libraries into your python installation (or virtual environment) not vsc. The simplest way is to use your command line with <your python exe> -m pip install discord.py
On windows that should ideally be the py launcher
on command promt rigth?
What I'd do is add Python to PATH; Add Python to system variables; Then you can just do pip install x
how do u add py in sys?
Do the whole command at once, e.g. python3.14 -m pip install discord.py or whatever
First step is go here
(Click on Path -> Click on edit)
can i share my screen?
Then you're gonna want to make a New -> and add these 2:
- Your Python folder path, e.g.
C:\Users\User\AppData\Local\Programs\Python\Python314\ - Your Python scripts path, e.g.
C:\Users\User\AppData\Local\Programs\Python\Python314\Scripts\
You might but it's simple, just search "environment variables" on your settings search
Btw all of this is considering you're not using a VENV. Cuz I got no idea how to manage Python in a Windows VENV.
Anyway for further help I'd suggest visiting #1035199133436354600
This becomes an issue especially on windows when you have multiple versions of python installed, which is why using py is recommended
Eh I made 314 use the main while the rest use their full name. Works fine
Or could just use py which was exactly created for this purpose to reduce confusion
Whatever the user finds convenient. I'm just used to using the main name so I made it accordingly
yeah my laptop cooked
poetry tool
I only use a VENV on my RPI
creates the venv for them, they can also mention desired python version.
@toxic notch look into poetry tool for python
and then in your IDE just select to use the venv created, which should appear as recommended
I doubt they should mess around with allat before knowing how to even install it
Not to mention all commands including VENV ones are very simple, dunno why you need a helper.
But hey I never tried it so what do I know. Just sharing my point of view.
actually
its easier than installing all deps manually ππ
and you can js set whatever python version u want
so i would say this is apart on how to setup workshop properly, thats something they could do
I doubt it's much more than little help.
But hey I never tried it so what do I know. Just sharing my point of view.
@toxic notch look into poetry, will save your workshop
no debs will be installed locally on your computer, its all venv
so they wont conflict across projects
Considering that's what they want..
I use a VENV on my RPI because I'm pretty much forced to
Overwork in its prime
How is it overwork tho?
I use vs code
it's so much easier
xD
the overwork was the ruling part of the project, which is half visible
Venvs and dependency managers are well and good, they're not required though and folks should probably understand what they are and make an informed decision
Ama continue tmr
This whole mix of docker, toml, yaml
https://python-poetry.org/docs/pyproject/ @toxic notch Save this, this is your start.
The pyproject.toml file
In package mode, the only required fields are name and version
(either in the project section or in the tool.poetry section).
Other fields are optional.
In non-package mode, the name and version fields are required
if using the project section.
Note
Run poetry check to print warnings about deprecated fields.
The pro...
etcetc
absolutely
the overwork is worth it, cause i know my shit runs smooth as fuck
Most projects don't need that for a fact. But if you find it helpful then go ahead
bot is not chunked either, has my own TTL cache logic, which goes to redis cluster and pulled from redis
i can't rely on library chunking due to milion users, it would take bot minutes to connect after a restart
So don't chunk at all
i am not chunking
Exactly
i did mention, i have my own TTL
Whatever makes yer happy
Holy moly I had to turn my strict typechecker off
Just opened a file and I got flashed with red
xD
__slots__ is also an amazing python feature
I'll prob only turn strict on when I'm working on an actual lib, it's just annoying when doing personal code
fr
Like mind you why do I need to import typing for a few functions xd
I have 0 warnings on standard type checker
This block turned out to work very well
That's how it be when you're too lazy to migrate some buttons to a better system
π
Ok THATS overwork brudda
(:
In my personal codes I don't be putting effort into typing and docs.. But I cant shame those who do
brah

Cmon Discord I know you can document these already..........
But this is the dumbest shit I've seen so far
Like ok? Dont add it then xd
But I can already add them to my library since it's 99% guaranteed that it's just a normal entitlement object without additions.
For example these 3 events are all the same payload xD
But then here it's different. Consistency doesn't exist in this stuff
can't lie, entitlements are so ass to manage
glad i dont gotta do that
but yeh man, dont think the shit i do is overwork, is what i need since i cannot handle milions of users thru library chunking.
Millions?
Yes
There is a PR
Unoffical and unmerged of course but it exists: https://github.com/discord/discord-api-docs/pull/7919
they are an absolute pain man
"Spooky" you say?
very spooky !
We've discontinued 3 months back, coming with a new v2 version much more improved.
lost only 20 guilds meanwhile, people have faith in spookylito
but what we building cannot be done overnight, takes time
Did you ping me?
O yea
When you say millions, sure you don't mean something as "bot.users"? Which doesn't really count
π

If you are familiar with what happens when a bot is chunked.
It sends you all guilds and users data (to keep this short i said data), Doesn't matter if users interacted or not with the bot.
Yeah you can't realy count that as your user base xD
Once you stop chunking, you receive NOTHING, you need to make your OWN fetch operations.
I know
Dude, all that gets sent towards bot if chunked, which is BAD at milions users
doesn't matter if they interacted or NOT
It's still data your bot receives towards library, and yes there are milion users across all guilds spooky is in, reason why you see my "overwork"
Exactly why you'd usually not need to chunk
reason why SPOOKY is NOT chunked
When you chunk such a huge amount, your bot can so long to start up.
It's bad practice to have all that across bot's memory
And no, high amount of users that a bot can "see" doesn't mean much, sorry
imagine your bot's memory, receiving all that load of cache
It's about who interacts
???
It only does if you chunk them
Why would it matter if you don't chunk or cache them
BECAUSE we DONT cache them on fucking bot's memory
But you said you don't chunk
BECAUSE we DONT cache them on fucking bot's memory
And there is a TTL to hold a MAXIMUM amount
which we limited to 5000
and it doesn't go to bot's memory, it uses REDIS
so bot's memory will always be low
Eh yeah the memory of the bot's process specifically
not fucking chunking milion users across guilds, since it chunks people that NEVER interacted with bot, holy
Cause you're talking information you have 0 clue of
Chunking WILL get onto your bots memory all users and guilds
all my memory goes to redis, and NOT bot's memory
!tempban 404264989147529217 1d Take a break. If you return, re-read our #code-of-conduct thoroughly before.
:ok_hand: applied ban to @dry kelp until <t:1761677078:f> (1 day).
Not cheering on one's downfall but yeah no need to repeat such word again and again
You can't make me look dumb and only at the end explain what kind of cache it is...
Yikes.
I was going to talk about MY cache system
Ill be civil I promise if anyone wants to talk
All good vro
Ngl I just let my library handle the cache
Everything i do is pretty physics related
I made an emergent lesrning cache system and so far its buggy a little but has promising data
Using particle physics to model access patterns
You lost me there 
Uh. Its like. Here's an analogy.
Most systems grab one piece at a time and have it delivered.
I use physics forces to act like access patterns. Different patterns apply different forces and related content clusters.
Instead of ordering and waiting, I drive to the store, find what I want, and grab the box, all its pieces, the instructions, and a couple other boxes that were buy 1 get one free. Then I go home. I do extra work.
But everyone else waits for pieces
I have like 3 open boxes with the instructions.


I'm lurking in chat trying to see if I'll hear anything interesting until I realized I don't understand a single thing being said π£οΈ
Real talk
Ok. Its like. Caches are little particles. They are hot or cold and time cools them down. Stuff being dependent makes it cluster together and accessing something heats it up. Over time related stuff clusters because it gets hot and the interactions get stronger. So it like. Learns by just literally making an entry hotter and seeing what happens
They end up grouping by stuff being accessed together. Then when you grab the group, everything is related
Hahaha. Cool color
Ngl it's just hard to make non useless stuff
Most true thing I've heard here
First both I made just pulled from a list of random insults I liked and called someone a random insult
I just make what I need and build it from what I know. I know physics so even caches end up as metadata particles π
But I got one bot with like 50 completely random commands xDD
This one's fun tho
Prototype that I never did anything with
Was cool to make
!unmute 865986856268333056
:incoming_envelope: :ok_hand: pardoned infraction timeout for @shy talon.
Hey, you can't send that many emojis. Maybe a screenshot would be fine
ok, thanks. sorry, i did not know that
hi, i'm trying to make a minesweeper game(just send a 10x10 grid of emojis 1οΈβ£ - 8οΈβ£, each behind a spoiler). The generated grid looks like this:
||:blue_square:||||:one:||||:bomb:||||:bomb:||||:one:||||:blue_square:||||:one:||||:two:||||:two:||||:one:||
||:blue_square:||||:one:||||:two:||||:two:||||:one:||||:blue_square:||||:one:||||:bomb:||||:bomb:||||:one:||
||:one:||||:one:||||:one:||||:one:||||:one:||||:blue_square:||||:one:||||:two:||||:two:||||:one:||
||:bomb:||||:one:||||:one:||||:bomb:||||:one:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||
||:one:||||:one:||||:one:||||:one:||||:one:||||:one:||||:one:||||:two:||||:two:||||:two:||
||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:one:||||:bomb:||||:two:||||:bomb:||||:bomb:||
||:one:||||:one:||||:one:||||:blue_square:||||:blue_square:||||:one:||||:one:||||:two:||||:two:||||:two:||
||:one:||||:bomb:||||:one:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||
||:one:||||:one:||||:one:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||
||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||||:blue_square:||
I have checked, this is 10x10, even the last line, however for some reason, discord only shows 9 squares on the last line
this is how it looks for me. i asked a friend too, it is the same for them
oh, it's even worse for 15x10. it instead shows 15x7, with 6 squares missing on the last row. does anybody know what causes this and how to fix it?
Are you accounting for borders or page breaks? Are you using visual width vs len() and keeping track of both?
This is for emojis right? Most emojis are 2 cells visually but one character in code.
Wcwidth handles visual width really well
i am generating them exactly as in the codeblock, with the :emojiname: . even when sending it manually, it does not work.
it also can't be that a row is too wide, because the emojis are missing entirely
import random
emojis = {
0: "||:blue_square:||",
1: "||:one:||",
2: "||:two:||",
3: "||:three:||",
4: "||:four:||",
5: "||:five:||",
6: "||:six:||",
7: "||:seven:||",
8: "||:eight:||",
"bomb": "||:bomb:||",
}
def gen_grid(width, height, mines):
if mines >= width * height:
raise ValueError("too many mines!")
grid = [False] * (width * height)
mine_positions = random.sample(range(width * height), k=mines)
for mine in mine_positions:
grid[mine] = True
res = []
for y in range(height):
for x in range(width):
if grid[x + width * y] == True:
res.append(emojis["bomb"])
else:
surrounding = 0
for mx in range(x - 1, x + 2):
for my in range(y - 1, y + 2):
if (
(mx < 0 or my < 0)
or (mx >= width or my >= height)
or (mx == x and my == y)
):
continue
if grid[mx + my * width] == True:
surrounding += 1
res.append(emojis[surrounding])
res.append("\n")
return "".join(res)
this is my current prototype to generate the game
Do you have the emoji font?
? what emoji font?
Suggestion: Use the emoji unicode and not the Discord format
But also, what's the point of this if you can just cheat by clicking on the spoilers xD
Feels like playing TicTacToe against yourself
that also doesn't help
No I'm just saying. Never said it'll solve anything.
well, i would enjoy it, and i know some others too. if you are just gonna cheat, why play in the first place
You're right π
Most fonts need an emoji font installed too.
I'm pretty sure the problem isn't fonts. it also happens when i use normal digits and X for bombs like this:
||`X`||||`2`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||
||`X`||||`2`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||
||`2`||||`2`||||`1`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||
||`2`||||`X`||||`2`||||`1`||||`1`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||
||`X`||||`2`||||`3`||||`X`||||`2`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`1`||||`1`||
||`1`||||`1`||||`2`||||`X`||||`3`||||`1`||||`1`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`2`||||`X`||
||`0`||||`0`||||`1`||||`1`||||`2`||||`X`||||`1`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`2`||||`X`||
||`0`||||`0`||||`0`||||`0`||||`1`||||`1`||||`1`||||`0`||||`0`||||`0`||||`0`||||`1`||||`1`||||`2`||||`1`||
||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`1`||||`X`||||`1`||||`0`||
||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`0`||||`1`||||`1`||||`1`||||`0`||
hi guys who
hi
hello
Thank you, Ace, for joining us.
You're essentially just advertising
ist not allowed in rules?
if its not allowed i will delete all messages about it
Please do. Advertising is indeed not allowed.
ok
ok π«‘ i deleted messages
Has anyone tried animation?
As in?
I know in the past discord has had issues with messages with a lot of spoilers. I think the markdown parser just gives up after a while. If you remove the spoilers do you get the correct message?
discord.py; interaction_check.
I want to have a check that if false, respond to user with x.
I currently do that in my check, implemented in the item's interaction_check:
I am also wondering why would it be a problem to respond in the check, not library wise but why does it fail sometimes? Unless the failure is something else
async def is_original_user(interaction: discord.Interaction) -> bool:
if interaction.message and interaction.message.interaction_metadata:
if interaction.user.id != interaction.message.interaction_metadata.user.id:
await interaction.response.send_message(f"This belongs to <@{interaction.message.interaction_metadata.user.id}>.", ephemeral=True)
return False
return True```
Today there was a time where I clicked someone else's button and the interaction just failed to respond. I can't figure out what caused it to fail, there was no exception raised anywhere either (at least I don't see one in my logs)
I restarted the bot and tried again and it responded.
Is this purely a latency thing π
For a discord bot. Have you tried animating one?
Its 100% possible

I was just wondering if anyone else had tried?
Idk what u mean by animating a dbot
Like giving responses custom animations. Instead of using embeds, use animations in the embed
I know there is sprite swapping already but thats a low frame rate
One can not understand this is what you meant from your first messages π
Sorry. Not my intent
I render GIFs on demand and that deals with the FPS/rate limits problem
Not sure what other answer you're expecting. Discord is a message service, it's not youtube
You can upload a gif or a video or link to a host that has either
Learn a programming language, find a discord library for that language, follow that library's official getting started guide
Can I do -1 instead
Im asking if other people have tried
Tried sending gifs or videos? Yes
Yeah I think you need to rephrase all of this because you're talking about simply "sending an animation" in a response.
Nevermind
@proper slate I think I've seen a bot send a gif in an embed with a slot machine and the result of gambling or something.
Containers support mediagallery items, embeds do not
What that has to do with what they said π
can you show your interaction_check function?
Most likely just latency
Or you're not handling a specific situation
It's just return await is_original_user(interaction)
Worth doing some debugging to see what is or isn't being executed. You wouldn't get a latency issue without an error (or you're swallowing errors)
I'm not too surprised about the latency though, the more far away you are from Discord's servers the worse it gets
And I'm far enough
Didn't they fix the discord caching issue with mentions?
Not a cache issue, but yeah they made them resolve always but reverted that change the day after
Sometimes they show up as "unknown user"
Why? 
Known users shouldn't. Never happened to me
Some privacy issue they said. Sounds dumb but what can we do
Source?
Don't remember, I think someone quoted it here
Isnβt it a client side caching issue?
No and that wouldn't make sense with what I said
They can fix it and they did temporarily
.
That's why I said it sounds dumb, because this doesn't make sense
Well people claim that it has to do with not being indexed beforehand
What is your theory?
Users that are not in the server won't be rendered
It also happens with users on the server
I've never seen that happen before unless you're talking about in embeds
Does it change the fact that it happens in embeds?
in embeds there's some weird caching issue so yeah
Every mention will be rendered if they roll out the thing again iirc
It was mainly reverted for performance issues
Hmm now that I think about it, wouldn't your client need to fetch unknown users to be able to display their partial info?
In that case, I can see why they didn't want it
no, in embeds or not, users not in the server won't be rendered
Issue being users are not rendered properly in embeds even if they are in the server
Wasn't talking about this
Was talking about that time they made them resolve everywhere
That's exactly how it works yeah
It would send all the resolved objects with the message
Does that specifically degrade performance?
π€
I guess? I don't manage a big ass codebase like discord
I mean if it does that every time then it would worsen the performance than just rely on user's client cache
If it is cached it is cached, if it isnt it isnt
Yup
"If it isn't it isn't"
Wise words
@commands.has_permissions(administrator=True)
async def removerole (ctx, member: discord.Member, *, role: discord.Role):
try:
if role is None or member is None:
embed = discord.Embed(description="You missed the ``member`` argument. do it like: `^removerole <member> <role>`")
await ctx.send(embed=embed, delete_after(3))
return
elif not ctx.author.guild_permissions.administrator:
embed = discord.Embed(description="You must have Administrator permissions.")
await ctx.send(embed=embed, delete_after(5))
return
elif ctx.author.top_role <= ctx.guild.me.top_role and ctx.author != ctx.guild.owner:
embed = discord.Embed(description="Your top role should be above my top role.")
await ctx.send(embed=embed, delete_after(5))
return
else:
await member.remove_role(role)
except discord.Forbidden:
embed = discord.Embed(description="I don't have permissions to *Remove Role*")
await ctx.send(embed=embed, delete_after(5)) ```
@commands.has_permissions(administrator=True)
async def addrole (ctx, role: discord.Role, *, member : discord.Member):
try:
if ctx.author.top_role <= ctx.guild.me.top_role and ctx.author != ctx.guild.owner:
embed = discord.Embed(description="Your top role should be above my top role.")
await ctx.send(embed=embed)
return
elif role => ctx.guild.top_role:
embed = discord.Embed(description="This role is higher than my role, move it to the top!")
await ctx.send(embed=embed, delete_after(5))
return
elif not ctx.author.guild_permissions.administrator:
embed = discord.Embed(description="You must have Administrator permissions.")
await ctx.send(embed=embed)
return
elif role is None or member is None:
embed(description="You missed the ``member`` argument. do it like: `^role <role> <member> `")
await ctx.send(embed=embed, delete_after(4))
return
else:
await member.add_roles(role)
await ctx.message.add_reaction("π€ΉββοΈ")
```
is there some context for this i'm missing?
Prefix commands in 2025 
My bot supports both, application commands and prefix commands, but my users only use prefix commands. Many say that application commands are more difficult to use.

More difficult - no
More feature rich - yes
What specifically is harder about slash commands? It should be approximately the same number of key strokes
I asked some users and they told me that prefix commands are much simpler and faster to send, others told me they like them better, and still others said that sometimes prefix commands respond much faster.
As a developer, I have to adapt to my usersβ needs and preferences. If they like and use prefix commands more, then I have to go with that.

Although whenever I make a prefix command, I also create its slash version, since there are also some users who prefer those (even if theyβre few) π
There is no real difference to the response or send speed
Preference is fine although as I said slash commands have way more features.
Without slash commands you have to make a help command describing each command, as well
Thatβs true, my bot used to only support application commands, but users asked for prefix commands, and yeahβ¦ it was tedious to make the help command.

Honestly don't see why people want those so bad
Making both is the worst option
hi
Bc when your server has 17 bots, many commands overlap, and you have to manually choose which one you want from the list lol
That would be even worse with prefix commands
If anything that's even more reason to use slash commands
When you do !help you don't know which of these 17 bots will respond
It's much less of a mess when you have a command list
The one where ! is the prefix?
That's a default for plenty of bots
Yeah, I can see how it would get confusing if you have several bots with the same prefix
Which necessarily happens
When you remove the need for a help command (and superfluous commands that are just reimplemented native behavior), from my experience there aren't many overlaps
...unless you configure them properly.
(To be honest I also don't understand why a server would have that many bots.)
Yeah see you gotta configure them now
It's just less convenient, not a disaster
Also with slash commands you can have user installed commands
It's much easier to type /command and pick the bot you intended to use, instead of memorizing the prefixes
dont even need to remember the command name
type / and then everything you can execute is shown
I like to use prefix commands cuz I know them and it's undoubtedly faster since u know the arguments and this is like a private bot
But for 'production'/public bots, slash commands are definitely better in almost every aspect
The thing is, people hate change regardless if its for the better or worse
There are people who really hate change since they are so used to prefix commands
For me it really depends on the type of bot rather than whether it's in prod/public, moderation commands for example I find it easier to use prefix commands because I want to run them as fast as I can without needing to mess with the slash commands ui
Yes but thatβs only if know the command well, someone whoβs new to the bot wonβt know and slash commands are much more friendly
Yeah not arguing with that, just that there are uses for prefix commands in 'real' bots beyond not liking change
Depending on what the moderation action is, if it's doing something more sophisticated than the native operations and it's super time sensitive
Yeah I should clarify that if you're running a server with like 1000 people then you almost certainly have no reason to need the extra speed of prefix commands, my case is somewhat more unique
because I frequently need to ban people sending scams/gore/etc in a server with around 600k people, so the impact of leaving it in chat longer is a lot bigger and more immediate
(and also sometimes includes multiple users in one command, where are variadic args Discord? we've been asking for 4 years)
Agreed that is a huge gap on slash commands 
it's such a shame because I really like slash commands generally, but a bunch of stuff I do needs variadic args
so I'm blocked from properly using them, I mean I can just dump IDs into a text field but if I'm not getting the benefits of the slash ui anyway at that stage why bother using it
that said, advaith is now employed on the apps team and we're getting stuff added to modals for example, so maybe soon we'll get the stuff we've been asking for for years
In theory you could have a multi user select. It's one extra step but might be more ergonomic
You might wanna try automod
you don't even wanna know what our automod config looks like 
how many lines of yaml is too many lines of yaml?
an unfortunate consequence of being a large server is we get hit by new stuff first, so although we have a frankly insane amount of automod stuff we still get a bunch of stuff that we need to react to (and then filter when we've seen a pattern)
Just don't let new members send links or media
Wow why didn't I think of this! (It's not that simple, firstly because people send messages without links that guide people into scams, and also because we don't want the community to be hyper restrictive. Also, we do, but people aren't new forever, and people who are existing members get compromised)
I mean it can work alright with a leveling system if you have one
But yeah I never said you can 100% avoid this
The latter scenario is pretty common
Yup
That's one reason why you should require moderators to have 2fa
In general, not talking about your case
Isn't the typical case of compromise token theft (where 2FA doesn't help)?
Yeah, again to be clear we're a unique-ish case becase of scale, there's more you can do at smaller scales but at 600k members everything is just hard and the small wins you can get (like the speed of running mod commands as text commands) are nice to have
Still doesn't mean it's useless
Matter of fact it's very good practice
That's not what I said
In theory a moderator should be more educated than the average discord user and know not to "test my game pls"
Also just to point it out, I specifically mean regular members being compromised rather than mods, since there's a fuckton of people in GTAO with a high enough level to post media, and we can't enforce 2FA on them
Yeah I think those two cases got mixed up here
You'd be horrified by how often I see people talking about their mods being compromised in the moderation meta communities
I certainly am 
I just troll scammers when they dm me lol
Sadly not many of them are particularly fun when you screw around with them from my experience
I'm involved in too many anti-abuse organisations and projects so I don't get them anymore. Literally the scam software skids use for it has me and a few other IDs blacklisted because they've worked out that it will result in instant termination lmao
It's nice to know that I'm that much of a problem for their operation lol
The ones that find me are
And funny enough there's a code word for some of them
Tested that
try, except or @cmdname.error
which one is better π¦¦
π€ΉββοΈπ€ΉββοΈ
honestly depends
Ig if you want more specific error handling, try except is better?
cuz if there's two places in your code that raises the same error and are similar, you might not be able to tell where this error came from
ohh
which one would be better if I wanna make a public bot
Can we get perms for voice txt
same perms as a text channel
try-except if it's a discord.HTTPException or its subclasses
otherwise global error if possible else local
imo
hmm
!e import discord
:x: Your 3.14 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File [35m"/home/main.py"[0m, line [35m1[0m, in [35m<module>[0m
003 | import discord
004 | [1;35mModuleNotFoundError[0m: [35mNo module named 'discord'[0m
!e import pandas as pd
:warning: Your 3.14 eval job has completed with return code 0.
[No output]
!e print("Hi gais")
:white_check_mark: Your 3.14 eval job has completed with return code 0.
Hi gais
.
@gritty inlet What DB are you using for your bots?
Btw what do you guys think about MongoDB vs asqlite?
DB type: SQLite
Library: sqlalchemy
Isn't it synchronous?
I love sqlalchemy but I kind of wish there was something faster to use just to prototype with. Feels like a lot of boiler plate to get anything useful.
NoSQL feels a bit weird for discord related stuff which is generally fairly relational but it could definitely be used
What would you recommend? I'm looking for something thatβs easy to use without too much hassle (mongodb replacement)
If youβre already on MongoDB you should probably just stay unless you have a good reason to switch.
Postgres is common and a really good database engine
Itβs not in-process like sqlite is though
There's also #databases
what's the raw api for creating a server invite?
raw api meaning?
Build games, experiences, and integrations for millions of users on Discord.
thank you
let me try it rq
like this
channel_list = httpx.get(f"https://discord.com/api/guilds/{guildid}/channels", headers = {"Authorization": f"Bot {token}"})
channel_ids = []
for x in channel_list.json():
channel_ids.append(x["id"])
print(channel_ids[0])
threading.Thread(target=wrapper.waifu.create_invite, args=[channel_ids[0]]).start()
r = httpx.post(f"https://discord.com/api/v10/channels/{channel_id}/invites", headers = {"Authorization": f"Bot {token}"}, json={"max_age": 0, "max_uses": 0, "temporary": False, "unique": True})
Why are you looking over all channels and making invites to all of them
I'm not just making an invite for 1 channel
Please tell me you're not using synchronous operations in production though
threading.Thread(target=wrapper.waifu.create_invite, args=[random.choice(wrapper.waifu.get_all_channel_ids(guildid))]).start()
i know
Then why use threading + asynchronous
for it to be faster
What is the purpose of making an invite on a random channel
u just said the purpose
Not how it works really, and synchronous blocks your whole loop π
No I didn't I asked you why
Threading is really not more fast or more effective than using async operations
i just need a random channel invite
This is what I do:
client = httpx.AsyncClient(headers=...)
async def x():
response = await client.get(...)
...
i know httpx is async
Been using that for almost 2 years and it works great
but i'm using it sync
Why do you need a random channel invite
Who is getting this invite and why would it be random
because i already have a function in my class for getting all channel ids
it's some moderator bot i'm making
i just need a invite function
To invite who
idk bruh anyone
That doesn't mean you should do it.......... theres no point in creating invite for all channels, not to mentions that's hella sketchy
So create invite for the guild, not for a channel of it
no need to since i can just use random and pick a random channel id
Dude why are you always picking the obviously worse option π
But have fun if that's what you believe is good
thanks
9 times out of 10, code like this is malicious and used to back door into servers
People can use the native invite feature. This adds nothing
not mine tho, y'all stay safe
There are a few cases where you might want that. But manually creating an invite to a random channel screams "I want a back door into this server"
did you know that async automatically utilizes threading when needed
for heavy io
ur just bloating up your app with additional threading
But ChatGPT said it's faster :(
Where are you getting this info? The whole point of asyncio is that it uses cooperative multitasking, the only time it'll ever use threading is when instructed to do so (i.e. run_in_executor)
Threads are meant for CPU intensive tasks and async for I/O intensive task. You need to explicitly use threads separately if you want it to. It doesn't use it on its own
i see
see i told y'all my code was good smh
Did anyone say it's good
I assure you api calls are not intensive in any way, but they do block, not in a way that would make it better to use threading
The best practice is to use async
I have a working bot that sends a message to a channel with a hardcodded user's ID in the code. I was wondering if there is a better way to see when that user gone offline or online. And when the user gone offline, i want it to show how long the user had gone offline when user gets online.
Sounds confusing :c
Like a timer? (Not live, ofc)
Ping me if anyone have an idea. Because i'm going to take a shower!
capture the datetime object of when the user goes offline (via datetime.datetime.now()) and another datetime object when the user comes back online. Subtract the datetime object of when the user comes online with the one when they went offline. You'll get a datetime.timedelta object which has the total elapsed time
!d discord.on_presence_update
discord.on_presence_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member) updates their presence.
This is called when one or more of the following things change...
Very carefully
Thank you! I'll read datetime library docs for a better Understanding
!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) subclass. The remaining arguments must be integers in the following ranges...
class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)```
All arguments are optional and default to 0. Arguments may be integers or floats, and may be positive or negative.
Only *days*, *seconds* and *microseconds* are stored internally. Arguments are converted to those units...
!e
import datetime
import time
offline_snap = datetime.datetime.now()
# Capture the datetime of when the user went offline
time.sleep(1) # Simulate user was offline for 1 second
online_snap = datetime.datetime.now()
# Capture the dateimte of when the user came back online
time_elapsed = online_snap - offline_snap # You get a datetime.timedelta object
print(f"Seconds elapsed while user was offline: {time_elapsed.seconds}")
:white_check_mark: Your 3.14 eval job has completed with return code 0.
Seconds elapsed while user was offline: 1
Thank you! I understand now
!d discord.utils.utcnow
discord.utils.utcnow()```
A helper function to return an aware UTC datetime representing the current time.
This should be preferred to [`datetime.datetime.utcnow()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow) since it is an aware datetime, compared to the naive datetime in the standard library.
New in version 2.0.
You should use that for time comparisons in a library like discord.py
Everything else works the same way
Result will be the same, this will only really be an issue when sharding.
It'll actually error out
Since you can't compare a timezone unaware (?) with one that is
!e
import datetime
print(datetime.datetime.now() > datetime.datetime.now(datetime.timezone.utc))
:x: Your 3.14 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File [35m"/home/main.py"[0m, line [35m3[0m, in [35m<module>[0m
003 | print([1;31mdatetime.datetime.now() > datetime.datetime.now(datetime.timezone.utc)[0m)
004 | [1;31m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[0m
005 | [1;35mTypeError[0m: [35mcan't compare offset-naive and offset-aware datetimes[0m
surprised I typed that right first try

tyty
@mighty briar

Welcome back
Thanks homie
i managed to implement openai free moderation api
which apparently still requires billing 
added the minimum 5 usd

