#discord-bots
1 messages · Page 414 of 1
"every couple weeks a random letter"
the worst case is when they start using the russian alphabet
they tend to simple find a replacement letter.
thanks
how to do this, but command groups
Are all of the commands in the cog belonging to one group?
Do you have a question about developing a bot?
looks like they are just here to advertise
yeah sadly likely
no
this bot was apparently created with discord.py but how did they get different types of nitro badges and the users bio?
Thought bots coulnd't acess bios unless there's a oath2 for that
they have a view profile link? do they have an associated website for that bot
if so they might be using oauth
yh heist lol
yeah then they might be creating a separate db, with reference to user details like that
when you grant the bot access
Is it possible to code permissions to view slash commands? Like with roleIDs?
yes, what library are you using?
I'm using discord.py with the app_commands extension for slash commands
I've searched everywhere on yt, google, etc and I simply cannot see an example of someone coding view permission on slash commands 💔
@app_commands.default_permissions, this only works for permissions sadly. No role ids
But still it prevents users without the permission to see the command
Bio doesn't appear to be one of the fields given in the user object granted by the identify scope https://discord.com/developers/docs/resources/user#user-object
Could you explain a bit more? What do you mean by permissions that aren't role IDs?
like ban_members, you can't set it on per role basis iirc
You can limit slash commands to roles natively in the UI. You don't need (and can't use) code to do this
^
I doubt you would know what roles a server has
Thank you!
Asterisk* on can't, you might be able to do something via the applications.commands.permissions.update oauth grant but it's incredibly simple for the user to just do this themselves and a lot more transparent
command**[]**_prefix=*
i should replace that with this
I didn't know how to point it out without making it too obvious lol
TypeError: BotBase. init (): missing 1 required positional argument: 'command_prefix'
tnx is working
just modify that message.channel.send message line?
or just use the builtin automod for stuff like that unless you're just trying to be funny
Really might want to reconsider posting that in a large public server
what about this
Yeah because you aren't registering it as a command
then how
@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.command) and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command).
i might be dumb i used the same thing already
and how do i make it to show the channel
Where in your code is @command
like #discord-bots
Why would you make a command that lets anyone give themselves an admin role
it isnt a admin role i made it like that
...
are you often in the habit of naming your variables completely misleadingly
sometimes
how do i make it to show the channel like #discord-bots
yh like #discord-bots when u click on it it takes u there
You can use the ID of the channel
<#channel_id>
i changed it
!d discord.TextChannel.mention
property mention```
The string that allows you to mention the channel.
what abt this one
both work
ok
What one? Your questions are very vague
so now how do i do this wth this <#channel_id>
If you only have the ID then just what I said works, but if you have the channel object then just use it's .mention attribute
do i paste the id in id <#channel_id>
or what
this is so confusing
If you send the text [#12345](/guild/267624335836053506/channel/12345/), literally, to discord it will render a mention to channel with the id 12345
or you can use get_channel(id).mention
show i replace the id with the channel id
What's even your purpose, how are you obtaining the channel ID?
Is it hardcoded in?
You're allowed to try things without asking if you should every time
no when u run the command it should say
ctx.author.mention will have to apply at #apply to get the ip
so i add an underscore
No, just the channel ID
what I wrote is just a placeholder to tell you where the channel ID goes
.
[#5678](/guild/267624335836053506/channel/5678/) will render a mention to channel with id 5678. [#42069](/guild/267624335836053506/channel/42069/) will render a mention to channel with id 42069.
thx
it worked
srry for the hard time
Funny thing is it'll still work if they add random underscores in the channel ID lol
just like python
API is written partially in python so that might be why 😅
can someone tell me how to achieve that in a ticket .py file?
to use send my text with my avatar and my name as APP, how it that possible>
When you send a message via webhook, you can set the avatar and display name at the time of sending the message
How did you know
Not exactly sure where I picked up that info. They reference python in a few blog posts iirc. And I think the API devs have also just said they use some python in various discord chats.
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.check) that is added that checks if the member has all of the permissions necessary.
Note that this check operates on the current channel permissions, not the guild wide permissions.
The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions)...
you're looking for this
!d discord.ext.commands.bot_has_permissions
@discord.ext.commands.bot_has_permissions(**perms)```
Similar to [`has_permissions()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.has_permissions) except checks if the bot itself has the permissions listed.
This check raises a special exception, [`BotMissingPermissions`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.BotMissingPermissions) that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.CheckFailure).
Alr solved it was to be removed the bot.commands
How do u make it only when u have certain roles u can use kick ban purge and timeout
!d discord.ext.commands.has_any_role
@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.check) that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return `True`.
Similar to [`has_role()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.has_role), the names or IDs passed in must be exact.
This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.MissingAnyRole) if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.NoPrivateMessage) if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.CheckFailure)...
Or just let people use the built in versions of things which already have permission checks and better security than anything you'll build (purge excluded)
Oh ok
sometimes some discord staff leaks portions of code to explain how beta features works 🙏💀
is there a work around to getting a users bio? and the nitro tier badges?
click on them
in a bot app…
I'm like 99% sure you cannot get a user's bio through a bot token
but why would a user need to use an app for that info when they can just click
Maybe the public flags that show other stuff would have it?
https://stackoverflow.com/questions/66951118/discord-py-showing-user-badges
cos i wanna display the bio of a user in a userinfo command…
Yeah but why would they bother running that if they could just click, you're only adding extra steps 
Either way, bios and certain user flags are specifically withheld from bots
Anyone know how to use sir-lancebot in my own server?
The GitHub repo should have instructions on getting it set up
Is there an event for when an Audit Log is made?
Or created ^
Not talking abt events for each thing, talking abt for just Audit Logs.
So you can log anything in Audit logs.
Yes
!d
Hey y’all! 👋
Been working on a Python Discord bot the past few weeks — just finished adding an XP + rank system with image-based cards (like the ones MEE6 has).
Trying to keep everything lightweight and modular — might even open-source parts of it soon.
Curious: what features do you actually find useful in bots these days? I feel like most bots are bloated with stuff nobody uses 😅
Would love to hear what your server uses the most — or even features you wish existed but don’t see often.
Feel free to dm if you need anything.
Bots that just staple on random features without having a clear, precise niche just become mee6 bloatware
I'd much rather have 5 small bots that do specific things than 3 that are random Frankensteins of unimaginative copy paste commands
yeah. i far prefer bots that do something very specific but do it very well
ok so you mean like if i were to implement for example some mini game in my bot i should do it good
im currently trying to become a freelance bot developer so im asking for other peoples advice beacuse chatgpt gave me a small foundation
More like you should have a stated, narrow purpose for your bot and do that
Rather than just picking random disparate things that people like
Like if I make a streamlined todo bot, shoving gacha anime wives into it just because people like gacha anime wives doesnt make any sense
yea i get what you are saying i shouldnt do 2 diffrent things
too many bots, more discord bots than humans nowdays
Whats up with a random invite being made every day around the same time. But NO user attached to it? Is this related to a discord thing or what is this..?
As you can see, everyone has an invite user, besides the top one?
It just has no user, and I am wondering if this is a thing I should worry about or just not care about it?
and reason why im talking about this in discord bots is because, I was wondering if a discord bot was doing it and some how not showing the user to. As I have logs to show when an invite is made n stuff and it never knows the user either.
We have DISBOARD, but it has its own invite already
i have no clue what else would causing it..
I meant some discord native feature
Yeah, but like what?
also, if discord made the feature, the author / owner of the invite should be Discord
bots can't just decide they're not the creator of an invite, so no
so what in discord is doing it?
well if it's not a bot, it's not a question for discord-bots is it 
You have to also consider discord itself, as far as I concern, doesn't have a account in a conventional sense
Hmm, it does have a user ID
you never know 
Bro why are you using AI generated messages, this is a fricking chatting channel
does it really matter
Yo, does on_member_join return what code / invite code was used?
If not, is there a way to get what invite code a user used?
there is not
Well, discord should ADD that lowkey ong
trust, idk why discord doesnt have that ngl
how do other bots do it then?
Huh 😭
check how many uses are left on all invites -> see someone join -> check again -> fail miserably due to race conditions and server lag
oh..
So then uh, if the invite tracker was to see like ya know 100 people join within a second, which is possible ofc, uh they would completely die 💀
Alright, so thats a COOL thing to know. Not making the feature now!!
Mostly they would just give completely wrong results
especially if you care about who used which invite
yeah alright then. Ty for letting me know, do you know why discord might not add this? Privacy reasons?
just curious on why discord actually doesn't allow us to grab this information ig
That presupposes that discord does things for reasons
which is sadly not often the case
so real lmao
💀
alr, well ty for the answer, assuming all invite trackers are now 50% accurate or 0% accurate based on this information. Uh yeah, invite trackers are goofy then, should be a feature via discord or some bot MADE by discord but thatll never happen, we know this 💀
They might, who knows. It's available for human users now iirc
Don't know if it's a privacy thing, I'm honestly struggling to understand an ethical use case for why you'd want to treat people differently based on what invite they used
No no, actually the purpose for me was a logging bot. So you know who is using what invite blah blah. Not to treat them different, more of just so you know whos inviting who just incase..?
Scenario: Say person1 invites person2 right? And person1 starts to act weird / inappropriate in the server with person2, then you can narrow it down to those 2 being friends via logs ofc or invite links.
Thats just a scenario ofc, not saying its happening, just an idea behind why I wanted to do it ya know?
if that scenario even makes sense.. 💀
Yes ofc you can say "well if those 2 are being inappropriate no need to figure out the invite link blah blah"
Yeah ofc you don't need it, more for receipts or whatever ig.
Example video here. But since its not directly possible im going to move on and not make the invite tracker a thing ofc. But you get the scenario in a way but yeah.
you can get at this yourself via the members settings menu if it's for moderation purposes
On who invited who?
ya
If so, then I did not know that, my bad
Alright, so yeah, no need to actually make a feature then. Well thats nice to know
❤️
server settings -> members -> type in the name -> hover over the invite code
Alr ty
I mean as a user (a moderator of the server), you can see it
Oh it have been talked about
hmm
Is python or discordjs better for disc bots
I mean the last one I wrote was in discordjs and It was pretty easy
If you ask in a python server, python
And the honest answer is the language you knew the best
mods have a tab in the discord UI for that
not much reason to have it in a bot anymore
oh someone already mentioned that. lol
lol, 3 times 😂

Python if you know python, as you use cogs, and in discordjs you have to create a lot of custom things from what I was told. But again, depends on if you like python, or javascript, I would recommend python as I am in a python server. But again, thats all on what language you know.
its finnaly work
its just database for rp server in game fivem, its for like LSPD discord, you just type your name your badge number and you can search your name by your badge number
sqlite
Guys. Does anyone know why the Discord bot on the Discord.py library stopped running? The terminal says this: ...[INFO ] discord.client: logging in using static token
yeah thats true
I mean I'm fine in both python and js but yeah I see your point there
thank you ❤️
yeah alright
thank you
That alone isn't anything to go on
Code and the full terminal output would be helpful
I can give you an example bot in dms to help you start if needed.
Quick and stupid question: How is it that 'DiscordBot' has channels, but not roles?
-'DiscordBot' object has no attribute 'get_roles'
trying to make a function to post things to a specific channel and ping a specific role, but I am too incompetent to figure it out 🙁
The other attempt was just sending the role directly, but would I need to make it pingable first?
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
Changed in version 2.0: `role_id` parameter is now positional-only.
roles are per server
you can use this if you have the guild ID
or channel.guild.get_role
yep basically you just need a Guild
bot.get_channel loops through each guild to get the channel so it can be slower than doing it directly on the correct Guild
ah, found the problem, apparently the bot needs mention everyone perms to ping a role
Thanks ❤️
Is there any way to combine the ping and the embed into one message?
await channel.send("<@&1234>")
await channel.send(embed=embed)
does it twice, which is not ideal
await channel.send("content", embed=...) or await channel.send(embed=..., content="...")
ah, perfect, thanks ❤️
sqlite database with discord.py 
B.N is badge number, its for rp discord LSPD server
Made a wrapper for ComponentsV2 lol (dpy is taking way too long to release theirs
)
Implemented it here for example (:
How do I set the footer icon on an embed to a users pfp?
Depends on what kind of user
Any user? Interaction user?
Is it the user who ran the command?
it's an event
Which
icon_url = message.author.avatar.url if message.author.avatar else None
Without the if statement, it can raise an error when there's no avatar and you don't want that
or usemessage.author.display_avatar.url, display_avatar cannot be None
Ah, what you had originally worked.
Thanks so much you ywo
*two
Are you validating inputs to the command options at all? If so I am curious how you are doing that.
A short syntax way for your bot to display mobile status (😭)
Or you can just go to the right file and change it
Oh okay sorry
it's a joke dw lol
with discord.id
i made Patrol system
Are you asking for help on something...?
What's the field where you put the image there?
embed.set_thumbnail(url=interaction.user.avatar)
thumbnail ok
yes
thanks
I meant the date/time inputs, can I enter random stuff in those options?
@bot.tree.command(name="pomoc", description="Jak použít Příkazy.")
async def pomoc(interaction: discord.Interaction):
embed = discord.Embed(title="Help", color=discord.Color.dark_blue())
embed.add_field(name="/settings", value="`Musíš vyplnit informace` </find:1402298966363738315>", inline=True)
embed.add_field(name="/find", value="`Podle B.N najdeš informace` </settings:1402078090527641840>", inline=True)
embed.add_field(name="/patrola", value="`Po konci patroli ji zapíšeš` </patrola:1402298966363738316>", inline=True)
await interaction.response.send_message(embed=embed, ephemeral=True)```
why is my command doesent work? its not vissible in discor and not synced
yes. but it doesent work
Restart Discord
Commands take time to appear, and when you restart they will appear right after
this is printed ✅ Synchronizováno 3 slash commandů.
it mean 3 works but 4. not. this is 4
no
Sure you saved, git-pulled or whatever
what is git pulled
Forget that
All good (:
oh my god
very cul stuff
thanks
anyone now how to make this embed? i didnt mean the values but like this lines
|
In some keyboards it's shift + \
i know \n
but its field its description its what
its like description="\ndandysek\ndandysektest"
or what
I need help
with?
Pls help
i dont know its so hard i am new
Ok
Show the from discord.commands line
I'll help
It seems as if this is the whole line. In Python, you cannot do from discord.commands and that's it. You may do from discord.commands import x
Yeah I don't think you need a while loop
Let me see...
So you don't really gotta change it
I mean at least for what I can see it looks solid
But maybe other people can help
Is the 6000 char limit counting for description + footer + author alltogether?
Hmm
Ah yeah
Well yeah you need to do that to know if you need to make another embed
why can't you test it yourself
Yo, anyone know an alternative to discord.watch? They shutdown a year ago, and I have no clue if anyone has made a new one or anything?
Yes, this is related to discord bots 😭
what is that?
Was a website to track all discord bots if the bot Discord Watch was in it, it would track the guild count for that bot, and allow you to "Promote" your bot in a way kinda.
Discord Watch was a very popular thing from what I knew.. but maybe I am wrong
like top.gg? But either way this doesn't sound like it has anything to do with making a bot, or making a bot in python specifically
But basically they had charts that would show growth and much more, was just a little thing to get information based on a bot ofc
Topgg doesn't show charts related to guild count and growth. But yes kinda like topgg, also figured it fit in the category because it revolves around discord bot development.
I mean its a way to grow your "Discord Bot" but anyways why do you care?
the man is just asking a question
its not that deep joe 😭
Typical joe
so real
I know the owner and they shut down for the funniest reason
House fire 😭
And no there was no up to date backup
Places have topics
Well I assume they asked here since this channel regards Dbots in some way. Can't blame 'em, it's not like Ddevs is a very welcoming place
But yeah following topics is appropriate
How do I go about checking wether it was a bot or a user that deleted a message?
Unless a user deleted their own message, it'll show up as an audit log entry along with who did it
yes I know. The owner was def hacked tho
and its wild that no one backs up anything, we run minio on its own server and thats all
Is there a way to not only grab the users name so I can send it in a logs message, but also make sure the message was deleted by a user not a bot?
Not that I know. I know that it was due to a house fire
Hi I fixed but I have a new problem now
@gritty inlet help
You use discord.py?
(Looks like it)
Py-cord
You should ask what library they use. The different libraries are not compatible
Oh
Cybrancee supports various libraries for Discord bots including but not limited to:
- discord.js - A powerful Node.js module that enables you to interact with the Discord API easily.
- discord.py - A Python wrapper for the Discord API, allowing you to write bots using Python.
Users can create and manage their bots using these libraries depending on their preferred programming language.
If you need further assistance or specific guides on setting up your Discord bot, please let us know!
Here
It's not about that, you're mixing 2 libraries in your code

There is no reason that they can only support discord.py. it is probably a stupid host that preinstalls the library for no reason
Mhm. And if they do, you'll have to use it...
I can disable it
But this is the main problem ^
Does anyone know cybrancee
No but your host should not matter for errors in your code
Wdym
"Including but not limited to"
ya
So you can use Pycord, I assume. But make sure you don't mix in code from discord.py
Am I right
Yes
You don't need to use both because they both cover pretty much the same features
@stark ingot @gritty inlet can one of u make my bot py-cord only or discord.py only I will send the bot.py
I'm not familiar with pycord syntax
don't use ai :blobpain:
Yeah you're right 😭
just send the relevant code here. Conflicting over which library to use won't help you in making a bot, so just choose one
hello, for a crowbot discord it's better discord.py or pycord ?
Entirely personal preference
Also what the heck is a crowbot
I think it's a term french
it's a bot that can do it all on your Discord server
Well it's your choice what library you use
i am trying to sync patreon with discord
i already made a test sub and still says 0 active patreons
here is my code
404
Click here to see this code in our pastebin.
can you see from this?
Seems like this is a problem with the patreon api/client, not discord
yes but its like 15 hours+ from the time i created the API , i send them an email and i am still waiting for answer
so the code is fine right?
I wouldn't know, I don't use the patreon API
ok i wait for their answer then ,as the code have no problem
If you have a problem with the patreon API/client specifically, you should ask them or a community dedicated to it. This is not that
But it would help to do some narrowing, put in some debugging to identify the line specifically that isn't working like you expect
Pretty sure hw as though, who knows
Wanted crypto for discord.watch and I did NOT wanna do allat, was gonna buy discord.watch, but they had no source code no nothing, so I was not gonna do that.
The guy I told you I know is a newer owner, he got ownership I think after the fire happened
The thing is, for like a year, Watch was running on leftovers 😭
Until the code started failing due to things like outdated libs, etc. To the point where it wasn't functional anymore
Yeah
Im talking abt a furry owner.. forgot his name, but he was the newer owner from what I remember..?
But he seemed to be hacked from what I remember.
🤷♂️
Not like it matters, discord.watch is now dead.
Yeah that's him
Either way there was nothing he could've done, he basically told me that
Why is the channel id invalid
Try restarting discord
Thats all
https://paste.pythondiscord.com/3AIQ
The participants list is not showing anything
have you tried debugging the relevant variable(s)?
yeah
And?
You're looping over something called participants. Do you know what the value of that is?
Teilnehmer (Typ): <class 'list'>
Teilnehmer: [881929560059428924]
its a list
okay, then what is happening in that loop as you're looping over it?
That's the list itself,
Let's say you want to have all participants in a simple string, you'll do:
text = ", ".join(participants)
This is a basic example and of course you don't have to do it this way
Odd
looks like a timeout on reconnect
The serverit is poopish
can anyone recommend a platform like patreon good for discord bot donation subscription system?
You can use "Memberships" and their webhooks but there is no proper documentation for them
is stripe a good solution?
Yeah stripe is good
Hi everyone! Quick question... you've probably seen or used discord.builders to integrate buttons and dropdowns into your bot's embeds. Could someone help me out? I'm trying to figure out how to use it properly.
but i have to keep ngrok online all the time right? for Signing secret
Not sure, I haven't used stripe before
I will try
Is discords app monetization available in your region?
discord.builders is just a webpage to test Discord's ComponentsV2 feature
You're not supposed to use it "in production"
As of using ComponentsV2: some libraries already have the feature,
I for example use discord.py and it's taking them decades to add it so I just made my own Python wrapper for it
The logic is pretty simple (discord.builders helped me with the JSON structure 🫡)
(This is just a fraction of it all, but it's an example)
cool
Someone told me this is normal for a bot if it’s only in 1 server
seems about right, resumed gateway connections are normal and expected. The 13.4 seconds behind may indicate blocking code or it might have just been a one off occurrence.
number of servers is not relevant to what is shown in that screenshot
It goes back online after that
resumes should happen quick enough that the bot does not appear offline for more then a few seconds, if at all
Will look better with ComponentsV2
Can internet speed affect it?
And it shouldn't be a blocking code, that gives a different warning
I've always wondered what the use of that is
You're on a device, just open a calculator?
Unless it's to learn and build something to gain experience, there's no practical use imo
Shared calculating! :D
there's probaly (hopefully) a check
more fun waiting for a round trip when input something
the computer's calculator app works so fast we gotta nerf it
same with my owner control panel!
this is what my owner control panel looks like, its very complicated lmao. But its something thats good imo
How do you restart? 🤔
Using a process manager
And turning it back on
That's pretty much the accepted and common way for any managed process
They explained it, but yeah.
Pretty cool control panel imo. Synced via owner ids, so not anyone can just use it
whatsup
And its synced to a certain guild, so only 1 guild can see it
damn python has a huge community
Also, if u wanna know how our logging buttons work, we have setup logging like this:
Yes, but i rather be logging, as our bots are ran on linux ofc, but in development we are also using windows, mac, or other devices.
So you have to make it User Friendly for the team.

Honestly I find on_interaction useful (discord.py), ok yeah it's an internal but it does some things that i need
Like
responding to expired buttons from a few commands that i still didnt migrate to use dynamic items
and for buttons in ComponentsV2 until dpy adds that
You do you I guess, weird thing to flex about
on_interaction is an event like all the others, nothing internal about it 
I guess this guy was wrong then
(dpy server)
Get a load of this guy
@restive perch smh my head
What
The idea is that the library gives you more elegant and maintainable ways of routing interactions. The exception being unimplemented interaction types, but your other example is just electing to not use what the library gives you
What kind of bot u guys r working on 💀
This was a year ago
A bot that tells people what kind of bot to make
Bad inside joke. Currently looking into a prompt sharing tool for art communities
Ik , that's good
Btw making a large scale bot is worth it 
u have an example of a command with a separator and a button/dropdown menu so I can see what it would look like?
I'm making a bot to create/administer surveys.
Also a user app tag bot that I am going to add a bunch too not just, tag get/create/edit
Oh nice
Would be interesting to know. How do you handle temp bans?
Hey, thats a good question, I can show you my handler that might explain how its all done!
This shows my worker + my command.
This is all done using PostgresSQL, a lot of the stuff you are seeing in there is custom functions or custom connections, so you can't copy that exact logic, but you get the whole idea!
Is it possible to ask my bot to delete messages from the user in a DM?
No
thats a lot of nesting.
can't you do something like that instead of fetching all the bans
and then loop through all of them
Or just time people out instead of banning them if you want it temporary, weird move
real
Self bot, but its against ToS so don't even bother.
You could, but imo idrc
Temp ban has been a thing in many bots 😭
Just because people do things doesnt mean it's remotely smart to do
(Or that it wasn't made obsolete by native features that were introduced after those bots were made)
But temp ban is not the only thing that could leverage this code
(This isn't functional but I was making a prototype)
You should really invest in making it as an Activity instead
working with images for this stuff is not fun
(assuming that's an image, I have no idea how componentsv2 work)
Very true
And yea that's an image
I don't plan on making activities as I'm not a web dev and that's what it takes
Valid
Indeed
Interestingly enough, I recently found a bot that's in 6k servers and monetized, that uses a selfbot in its backend ☠️
Just a suggestion, instead of sending a new DM when unbanning (not sure it will reach them if they don't share a mutual server), you could edit the old DM to say that it expired
Thanks for sharing btw
The user might not notice that
Well you could ghost ping in a try except
In the worst case, nothing will reflect the change
So I guess it's better than nothing
Thats why I send the invite first just incase..
I think i do, forgot ngl
I personally think the code is fine how it is, sure there are improvements, but at the end of the day, it works fine as is. No pyright errors, no typehint errors either.
Why not use a permanent invite link?
Also why not use a Discord timestamp instead of {readable_time}?
Because sometimes the timestamps are annoying, I only use them when I think it looks good imo
Timestamp would look bad in this imo
No need for a permanent.
Honestly you could let the invite link embed, because it shows "invalid" or whatever when you're banned from the server
Read the note.
If you try to join before the unban, completely on u
🤷♂️
I just don't see the reason for having a temp invite link
Yeah I read it, was just a suggestion (:
Is there some logic behind it?
Ngl I'd add a relative timestamp for in how long you get unbanned 
It's not temporary, it won't work for you when you're banned
At least I guess that's how it is
I already suggested that lol
Well yeah but it doesn't have to be instead of the text that tells you for how long
Imo the best would be both
As a user I'd like to know immediately for how long it is, but also have a relative timestamp
Because if you put only one of those, and this goes for both - you'll need to "calculate" the other one (if you wanna know it), I think putting both makes it easier for people
That’s what a relative timestamp does
Hopefully that doesn't sound too confusing
Oh yea right forget the "immediately"
Hmm u have a point but still I'd have both, I don't have a good argument as of why xD
But yeah if I had to choose just one, it'd be relative
Nice tos violation 
Is it good to use Optional for nullables? 🤔
I don't see why not

nowadays it's recommended to use T | None syntax but Optional is fine as long as you stay consistent
Unless you really want to tell the user that the field wasn't there 
T as in a placeholder or
The type yes
T would be the type if the variable had something other than none
Well I knew Optional was like a shortcut to that
it is, but if you use it in a function declaration it could be confused for a variable being "optional" (in that it has a default)
Nah in func declarations I dont use Optional
Kinda pointless since var: type = None tells you that
If provided - should be that type otherwise None..
typehints aren't just for humans reading it, it's for typecheckers which isn't pointless to tell them what the variable could be
Alright
Well in the context of Optional what I said isn't really wrong
Since Optional doesn't do much, in terms of var attributes 
Unless there's more stuff where it is necessary
If you want to be more subtle and enjoy writing it more, consider using TypeName | None, it's evident that it can be this one value, or is none, and it doesn't require an import and takes up less space. It also works backwards to python3.8 so long as you import from __future__ import annotations.
^
unless it's checked at runtime by some package
Is that the same case for Union?
Recommend using basedpyright and ruff check to make sure your code is good 👍
That is a Union so yes
Also, personal opinion, recommend 3.10 or higher with dpy. But each their own ofc!
why is primary guild still a clan here lol
Or 3.12 while you at it since that's kinda the standard
and enjoy the new typing features :)
I personally use 3.12, but im saying don't go below 3.10.
Well yea (tbh Im using Optional influenced by dpy backend 😭 )
Dpy has to because it's 3.8+ and does runtime checking
Optional and Union are all over the place there lmao
Also, very much recommended uv for discord bots as its a lot safer!
Not just discord bots, but any py project
Wait so what exactly does from __future__ import annotations do
It's complicated lol
Backwards compatibility if im not wrong? Could be wrong.
Was a bit lazy to change the file and class names lol i can easily do that
But tbh blame Discord, both clan and primary_guild are present in the user response 💀
See these https://peps.python.org/pep-0649/
https://peps.python.org/pep-0749/
Ans ask in #type-hinting ig
It basically makes the newer annotation stuff work on the older versions, I specifically use it to get the unions with | syntax on 3.8 because I highly prefer writing them that way
So backwards compatibility 😭🙏
I'm not sure though, was it originally there on 3.8 before 3.10 came around, or was it there after? because if it was there before is it really backwards compatibility?
It's not really for that afaik?
I would consider it backwards compatibility.
It was added in 3.7 iirc
3.12.9 on top ✌️
You're good then and can use the syntax without anything extra
Originally because the stable diffusion thingy I have supports just that version
3.10.6 to be exact
https://peps.python.org/pep-0563/ is the PEP for it

But yeah thanks
Me in college learning Linux 😭
Idk if Im even doing this right
I cant wait for dpy to release 2.6.0
soooon
What comes in 2.6.0?
Trust lol
cv2
V2 components
About damn time
Which ate fire
modals v2 sooon
Yes, its a fire thing tho 🙏
Modals are currently bland
Ngl I'll miss my code
But there's goodbyes to everything
No return types 😢
For some reason that's the only file in the REST client that i didnt do that in yet
Ill do that
😭🙏

Awesome
Nah but fr tho why is that happening 😭
Maybe because Container class def is under ComponentsV2 class?
probably
Weird that its an issue only for the return type
iirc from __future__ import annotations should fix that and you shouldn't have to change
ill just move it up (:
😅
You can wrap it in quotes if you don't want to do that like "Container"
none. Discord doesn't tell you and you don't need to know
hello pythonistas, whats new on discord api?
why you need to know if someone has nitro? I mean for discord sure, but for a bot
No sure way. You can check for banner / animated avatar though 
If interaction user, you can also check for upload size limit
Hey, so this is not related to discord bots, but have no clue where to ask.
So I use UV in my discord bots, and when doing uv export > requirements.txt --no-dev it puts the file format to UTF-16LE and I am wondering if it should be that format, or if it should be UTF-8?
Sooo don't ask it in the discord bot channel? 
Where else can I ask it?
It relates to my discord bots, but not exactly related to discord bots 💀
is the implication that pip isn't secure?
I just see uv as more secure cuz of hash checks and all of that!
also mb, didnt know they had a discord!
Ah- so I need some advice. Is it really worth investing the time and effort into developing a complex, collectible-trading Discord bot that features economy systems, marketplace mechanics, and interactive multiplayer elements, similar in functionality to existing large-scale bots?
Would people choose to use your bot over an existing one
Ah- I’m just a programmer… my creative brain is dead. I’ve wanted to make something like that for 4–5 years, and every 2–3 months I feel like doing it again. But each time, I get stuck on these same question.
It really depends on you and what makes you happy. If your happiness hinges on people using what you build, you need to build something useful and unique
If your happiness is just from building something that nobody uses, then great make whatever you'd like
Ah- it’s a time-consuming project. I can’t just start it as a side project for my GitHub, and I want more people to actually use it. For that, I need a creative idea, which I don’t have… That’s why I ask those questions. And if I’m not wrong, having Discord.py on a resume doesn’t really give much of an advantage.
Having successful self directed projects isn't nothing
But it's easily less valuable than something more relevant to the position you're applying for
But if your goal is to make something popular, that almost never starts out from looking at existing solutions and thinking how you would tweak them slightly and repackage them. It comes from finding what people want but don't have
Yea u r right , what's your reason to work on discord.py ...just asking
My guess is there are extremely few jobs that knowledge of a specific discord bot library gives you bonus points.
I find it interesting and fun I guess 
I've found one or two niche things that a few people find useful. I have no desire to try to trend chase and make a thousand+ guild bot
Oh get your point
I take it you've never used poetry, pipenv, pdm, hatch, or uv?
I mean you're welcome to make whatever assumptions you want about my experience
Anyone who knew about incapsula
This is what you get when you know how to code and you're bored lol
you should hide the results and the emoji in individual ||spoilers|| to enhance the gambling experience
ooh
I like your style
🎰
ty
Damn
Click here to see this code in our pastebin.
difflib?
i tried doing this once using difflib
it's to do with sequencematcher
sorry i have to catch a bus ride
alr
im on mobile so itll be a min lol
quick question
why do you have your variables in all caps
you dont gotta scream it lol
it looks like AI when its like that
other than that I have absolutely no idea
I've never seen anything like that
cool beans though
your variables for COLOR_EQUAL
I just write those in normal letters
not caps
then again nothing i make ever works so
dont listen to me
xD
constants are often named using screaming snake case
^
no thanks. What is the purpose of ServerLogger? To log the servers the bot is in?
So the audit log but also invading user privacy
mhh, is that necessary to log? A lot of data
@slate swan what functions does your bot have?
I will and I have
are you polish?
ah ok, you know mata, I think i have heard a song from him
but anyways, why you log so much data?
@slate swan
Do you have a ban kick command in your bot?
what is a softban? a temp ban?
ok
is your bot online and hosted somewhere?
ok
is there any way to learn good discord python coding?
any book or like any online book?
The official python tutorial is quite comprehensive
Not very discord python related but where do you find tasks for python
Would be nice to just practice with tasks which engage multiple core topics
In theory leetcode but i aint quite there yet skillwise i think
Code abbey is another solid practice site for bite sized problems
Thank you
how do i check if my bot has the send messages permission without any intents?
You don't need any intents to check permissions
channel.permissions_for(guild.me)
Well that requires the guilds intent but pretty much any cache requires that at minimum
So I’m screwed
No
Guilds is not the same as guild members. Two separate intents
The guilds intent isn't privileged so you can ask for it without approval
Okay thank you, I’ll try that
tbh could just use diff code blocks, generating images per message edit is pretty expensive on the cpu
!d itertools.zip_longest also use this
itertools.zip_longest(*iterables, fillvalue=None)```
Make an iterator that aggregates elements from each of the *iterables*.
If the iterables are of uneven length, missing values are filled-in with *fillvalue*. If not specified, *fillvalue* defaults to `None`.
Iteration continues until the longest iterable is exhausted...
also i am not really clear what's happening in your case or what's the issue you say "strange things happen" so maybe shed some more light on that
Also this only limit:
- Getting the entire list of members in a guild
- Listen to member joining/leaving the guild
So you can still get a specific member in the guild if needed
If they are in the guild
Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.
yeah sorry
not in any library I'm aware of
I mean technically no library can ever stop you from going into internals or even modifying its source. But in dpy at least there's no supported way to influence the cache beyond setting a size limit
Again, you adding messages to the cache isn't supported
does a message cache even exist
Dpy at least (and presumably forks) cache a limited set of messages received while the bot is online
ofc someone could easily make their own cache too and do whatever operations they want with it
but it's for internal use? I don't think a get_message method exists, right?
It's mostly for providing the old message on relevant events (delete/edit)
Oh well, I thought it existed but seemingly it didn't
You can just manually cache completely outside of the lib's code, I don't think there's a good reason to modify the code
Closest thing is get_partial_message
Does the event payload not include the message data?
(Never got deep into the gw events so Idk)
No, the payload doesn't give you old states
guys, is there an option in discord server settings to change the roles based on message activity, for example if a user has a total of 100 messages the role changes to like bronze and so on?
a bot plus a database I assume?
Can be hardcoded but sure if it's multi guild / often changing
Or a human with way too much free time
mhh ok.
a simple bot would be convenient
I have looked inside the discord API and the Gateway, there is a message create event
user sends a message -> messages += 1 like this I assume
With a db, this is probably on the order of like 200 lines of code. But at what point is the number of messages a person sends relevant at all, incentivizes the complete wrong thing
You can use a sliding window log approach to count number of messages in a certain time window if you want to
the gateway is used to track live events on a server, yeah? Like A message was created, then some informations who created this message, when .....
Yes; your bot opens a websocket with the gateway and it pushes subscribed events (intents) down to you
ah ok that is great.
like when a user joins, to send a little message in the welcome channel
XY has joined the server. Welcome and have a nice stay!
yeah?
For what is the API endpoint modify current User and when do I need this, examples?
The gateway is how discord pushes events to you. When you want to send instructions to discord that goes through the api
understood, you ever used the modify current user endpoint?
like changing the bots avatar
it is really well documented, I enjoy reading the docs
No I haven't had any need for it personally
I'll change presence to announce downtime/maintenance but that's about it (presence does go through the gateway iirc)
ah ok that is an implementation aspect that discord wants to go through the gateway?
can you pleas send a link to the specific page on the discord api
Practically speaking, you don't need to know the api
Language specific libraries (like discord.py and its forks) wrap the api calls
yeah it is wrapped into libraries
It's fine to read if your curious but for a developer it's one layer deeper than you really need to know for implementation purposes
Sry, I have autism and I always need to know how things work exactly
I'm sure you're capable of interacting with things without fully understanding them, or you'd be fully unable to leave your house or pick up the device you're typing on
The discord api is very thoroughly documented though, and you can look at the source of a library to see how it implements it too
hey
I was wondering if it would be possible to make it so that the discord discover server features could be disabled
via a system
You can do it via server settings, do you want to do it with a bot instead?
how can i do it via a server setting?
basically
I just want smthing
that disables the explore/discover servers feature on discord
Humans can do that. What is triggering this system to do it instead?
You only want to gain XP once per minute to avoid spam
Not based on number of messages
understood, I have chosen nextcord as my wrapper hopefully you guys understand
@young dagger you are probably using discord py he?
Mhm
I never used it
what wrapper you using if I may ask?
Just the same one I’ve always used
I wouldn't use a fork unless someone told me a really good reason to do it
They're all functionally equivalent, the only difference really are some minor design decisions and the support you get
Mhhh okay
Whatever suits the best for you 😊
They’re all the same; only very specific things and the time it takes to add new features change. I used to use discord.py, and I switched to py-cord, and it wasn’t difficult to migrate all the code.
Nice
There are many more Python wrappers fwiw
Hello 👋👋
Please I want to learn about discord python but
Is there a crash course
Hello can you help?
I mean no course for it?
I was directed here by a friend
No such thing as discord python
You learn python, you read the documentation of the api, or its wrapper and you write a code for that
Can't you just use the on_app_command_completion event instead of doing it every command manually?
Or on_interaction if you need it to be called immediately after invoke
You can get those from the interaction yes
https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.Interaction.namespace
hey guys, so I am reading about application commands, and there is one with a prefix like !ping and one with a so called slash command, what for application commands you using and is better?
Prefix commands are not real commands
Application commands are slash commands and context menu
ok got it
I think slash commands more up to date or you say prefix commands also good?
!ping or /ping
You are not allowed to use that command here. Please use the #bot-commands channel instead.
Slash commands have more advantages that prefix ones
yeah sry example
got it
Like autocorrect, self documented, enforcing value types
when I write a slash command on this server the commands are described
Yes it is self documented, you don't need like a help menu to list out all the commands and their usage, discord already display them for you
but the concept is the same, instead of a message create event discords gateway sends a interaction event to like trigger the callback?
with the discord api the slash command is just registered and linked to discord
but the actual trigger is through the gateway?
They send a interactionCreate event i think, i dont use raw api call
When the library already route the event to the right callback for you
nice got it
Just see the example of the library, mess around, change stuffs to see how it work
yes of course
Note that syncing have rather heavy rate limit, the example shows you a convenient way to sync on startup for example sake, you should only sync when needed
yeah the good old rate limit on apis
If you use pycord, they have a smart way to auto sync for you
If you use others, sync when you need discord to know
got it
pycord, by default automatically syncs for you. If you want to handle the syncing yourself, you can do that too
"Smart"
indeed very smort
if youre using dpy you can do hybrid commands so your commands work with both
mhh ok
Which comes with a host of other complications like the permissioning being opaque
I think slash commands and its variations suits the best and is in my opnion up to date
it might be also efficient, prefix commands cause that the bot must read all messages but with slash commands the bot reads just interactions
and message content is a priviliged intent so
if anyone can understand my thoughts
and as mentioned slash commands comes with autocomplete desccription ......
correct me if I am wrong, I am open to feedback
Yea there's no right or wrong selection. I would generally say that bots that need frequent usage like economy bots are better off using prefix commands and bots that don't require frequent command usage may be better off with slash
Both is nice for me because it offers the user the choice
right, but what is the point solsticeshard mentioned, if anyone can explain? You are right, the user can choose between prefix or slash
Useful command?
^ real
I like it, I didn't know discord messages could be differentiated down to milliseconds
The idea is to find a way to validate messages as moderation evidence, when messages are fabricated
Example if you copied a message from 13:12 and edited the HTML to show 13:25 and then provided that message ID, we could see that something is not right
I need a visual example
How do you get the message IDs?
Well, if you are not into moderation it's not really an issue for you
From the user
Ah, valid
What would the second ID be? If you fabricate a message what would you link to?
Second ID could be used as any reference (even the message where the command was revoked from)
message ID 2 is optional
Why do you even need to compare then
To see if the timing of any message is fabricated or not, you can just see when that message was created_at?
Slash commands and prefix commands have entirely different permissioning systems. There's no purpose in publishing a command twice in two different systems
The purpose of giving the user a choice, no?
People can just learn to use the correct system
got it
Real timestamp is 15:05 for me
Sorry I didn't understand your point
What's a real timestamp?
I edited the message to say it's 15:12, but in reality, it's from 15:05. If you provide the message ID, I could easily confirm that the screenshot was manipulated
no thanks
Yes so you just need one message ID and check when it was created_at
You don't need to know the time difference between anything
I guess. I thought why not just use both
(could maybe be used for other cases I don’t know yet)
Because with a second ID you're having to do maths and inevitably someone is going to fuck up their maths
I doubt
I'd much rather just have a command that checks when (a) message(s) was/were created and if I really wanna compare the timings of two IDs then I can just compare the created_ats with my eyes
Right, I might actually add that as an additional command
Thanks for the feedback
Probably also worth noting that most edits are not done through HTML but just image editing
Not sure if you have done this, but you should detect the channel(whether it's nsfw channel or not), and restrict the nsfw option in non-nsfw channel
Where it's fairly common for people just to fuck up the message alignment
Nice
a features that spit out feature ideas
a command to delete the source code and maybe on GitHub, then initiate disk wipe and shutdown itself
"interesting" is subjective
also delete the db
@quick gust @wise mica What time format would you use to show when the message was created?
long date time
One of those discord time stamps so people dont get confused converting to their timezone
asking people besides trained server admins to get message ids is pretty cumbersome. If this was something you found useful, I'd suggest presenting this as a message context menu you run twice instead
or... Just ask for the message link and strip the ID yourself
But the perspective also matters, normal discord user probably also don't care how many seconds difference between 2 message, just roughly
Like about 5 mins, about 2 and a half day etc.
I mean I have a hard time seeing why anyone would care how far apart messages are beyond the day or minute even
I would sometimes

you should pass nsfw=True in your command decorator (or group) instead of manually checking if it's an nsfw channel or not
that way the command wont even show up in non-nsfw channels
im pretty sure its not legal to make nsfw commands which dont mark themselves as nsfw
you should probably separate the nsfw and sfw into separate commands and mark the nsfw one to discord respectively
I don't see how a country make a law on whether it is required to mark a flag on a proprietary system in a proprietary social network
lol they probably meant it's not allowed in the developer policy
I assume you mean embed titles. You have to set the URL parameter of the embed