#discord-bots
1 messages · Page 407 of 1
Hi, I have a question, how can I split commands in files? I want to have each command on a file
That's egregious
Id recommend questioning where you got the idea that is good practice
Either way, a bot isnt any different than any other python program. You can put whatever definitions you want in a file, then import those definitions in another file. Works for commands too.
Libraries like discord.py have an extension system which makes loading and reloading of those modules easier, but it's not required
Thanks!
» args-kwargs
» async-await
» blocking
» botvar
» class
» classmethod
» codeblock
» comparison
» contribute
» customchecks
» customcooldown
» customhelp
» dashmpip
» decorators
config formats are relatively irrelevant
dotenv influences your environment variables directly, and that could include 'system' ones vs. ones you care about in your app. JSON has the advantage of being fully contained in your app, and only able to do what you decide it should do.
^
So you need to trust your dotenv files more than your JSON files arguably
if you dont feel like all the JSON formatting, TOML exists 
That too, yeah
then why are you still working on it
i dont im just in the same folder
....sure
anywho, both python3 and pip are ambiguous to what python installation they're hitting. They're most likely hitting different installations
on windows, any python command line commands IMO should use py, both for running code and interacting with pip
Unless when you are in venv?
Idk if py handle that, but I would leaning towards using python for venv instead
they are presumably not in a venv if they are encountering this, but yes
Well
Idk it it's my bias but for me windows python is just harder to use
Python provides the ability to run multiple tasks and coroutines simultaneously with the use of the asyncio library, which is included in the Python standard library.
This works by running these coroutines in an event loop, where the context of the running coroutine switches periodically to allow all other coroutines to run, thus giving the appearance of running at the same time. This is different to using threads or processes in that all code runs in the main process and thread, although it is possible to run coroutines in other threads.
To call an async function we can either await it, or run it in an event loop which we get from asyncio.
To create a coroutine that can be used with asyncio we need to define a function using the async keyword:
async def main():
await something_awaitable()
Which means we can call await something_awaitable() directly from within the function. If this were a non-async function, it would raise the exception SyntaxError: 'await' outside async function
To run the top level async function from outside the event loop we need to use asyncio.run(), like this:
import asyncio
async def main():
await something_awaitable()
asyncio.run(main())
Note that in the asyncio.run(), where we appear to be calling main(), this does not execute the code in main. Rather, it creates and returns a new coroutine object (i.e main() is not main()) which is then handled and run by the event loop via asyncio.run().
To learn more about asyncio and its use, see the asyncio documentation.
Default arguments in Python are evaluated once when the function is
defined, not each time the function is called. This means that if
you have a mutable default argument and mutate it, you will have
mutated that object for all future calls to the function as well.
For example, the following append_one function appends 1 to a list
and returns it. foo is set to an empty list by default.
>>> def append_one(foo=[]):
... foo.append(1)
... return foo
...
See what happens when we call it a few times:
>>> append_one()
[1]
>>> append_one()
[1, 1]
>>> append_one()
[1, 1, 1]
Each call appends an additional 1 to our list foo. It does not
receive a new empty list on each call, it is the same list everytime.
To avoid this problem, you have to create a new object every time the
function is called:
>>> def append_one(foo=None):
... if foo is None:
... foo = []
... foo.append(1)
... return foo
...
>>> append_one()
[1]
>>> append_one()
[1]
Note:
- This behavior can be used intentionally to maintain state between
calls of a function (eg. when writing a caching function). - This behavior is not unique to mutable objects, all default
arguments are evaulated only once when the function is defined.
hello, I am new to python. Why are you guys building discord robots, when there are millions of them?
Can I also build a robot, but what if the idea is taken?
Because sometimes you might wanna make something that’s never done before
A few responses:
- Bots layer on several python concepts simultaneously. They are not for beginners. You can choose to do it anyways, and I'm sure a lot of people in here will say "it's fine bro I learned building a bot", but unless you're a genius you are going to get frustrated and make very slow progress trying to learn several advanced concepts simultaneously
- There are a ton of bots, and 95% of the ones I see people build here are uninspired, recycled ideas. But people can still do it for fun, or to make minor tweaks for personal servers.
- You can do whatever you want, nobody will stop you just because it's a copy of functionality
- That said, there's still tons of unexplored ideas that people seem allergic to for some reason
Yeah, still haven't seen an interesting Code Climate integration with Discord for example, and there's a ton of easy stuff to do there
Do you guys understand completely what the module discord.py does and how its working? Would be a start
I mean, yeah? Are you familiar with asyncio? That's really what discord.py is built around.
You could argue it's a 'typical' network library using asyncio.
I dont think it is just asyncio since SolsticeShard just said it has several python concepts
Anyway, I was curious what it is all about discord robots
You need to know Object-oriented programming
Well it depends on your perspective, yeah; you could say you need to understand socket programming also, if you want to understand what it's actually doing for you.
But asyncio is how it 'runs'
I mention it first because you can't even follow the code flow until you understand it.
I mean the documents for discord api seems really understandable for me as a beginner. Just curious and reading
Sounds like you're on the right track.
The main things to understand are OOP and async programming generally, plus general ability to debug and read docs
Knowing vaguely what a WebSocket is is probably useful too.
I'd argue that modern libraries pretty much completely abstract you away from any sockets or network issues, it's good to know but you can implement a fully featured bot without it
Also learn to stop hardcoding your tokens
Because apparently that’s a very difficult concept for beginners
I guess it sorta makes sense; you have to learn how to make "variables your code can see" suddenly depend on the outside world, and a lot of people probably just barely got their first script.py working.
actually it's main.py
?tag cogs
This is not a Modmail thread.
whoops
- A fun note that when I attempt to learn at beginners stage(side note: don't do that), I don't even understand any of the advanced concept and just trial and error
And trust me it's not fun
are you now understanding everything?
it's a constant learning process lol
I do community help for discord.py and I've done python in the industry for like 7 years now, always something new that you don't get the first time
!d discord.TextChannel.threads
property threads```
Returns all the threads that you can see.
New in version 2.0.
try it and see what it gives you
what do you consider an active thread
you have the discord.Thread.archived and discord.Thread.locked properties respectively
you can apply a filter to a discord.Thread list to only get what you want
It might be more economical to get all active guild threads and then filter by channel ID
that is actually what the TextChannel and ForumChannel.threads properties do:
https://github.com/Rapptz/discord.py/blob/v2.5.2/discord/channel.py#L389
discord/channel.py line 389
return [thread for thread in self.guild._threads.values() if thread.parent_id == self.id]```
Archived threads aren't cached iirc
Hey can someone show me how to code with Python?
Bit of a tall ask to start from scratch. Have you done any self learning with the resources available?
Nope
There are lots of free and quality self-guided resources for learning the basics
Where can I find them?
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
is it possible to run a discord bot 24/7 in a VM and when a question is asked pinging the bot it reaches out to a VM running a LLM and gets an answer from that all this free of cost?
Hello, has anyone used seleniumbase before? I'm trying to automate appointment booking but I keep hitting 401 often and it logs me out
You will probably have better luck asking in the help channel instead of the discord bot channel: #❓|how-to-get-help
I was wondering the same thing
You could listen to the Message Create event. Then check if the message contains a mention to your bot. Although it would be more resource efficient if you used a slash command like /ask text:abc. Then you can use an API or localhost a LLM (just make sure it follows TOS such as not training on the input and making sure you have the users explicit consent). For the free of cost part you can localhost on your own hardware for the cost of electricity. You can also use free trials from big name hosting companies like oracle but these will not be the highest quality. My guess is self hosting the LLM will be the only way to get unlimited free responses
Just use openai api and put a 5$ limit
If u do host it locally you'll have to use something with a good gpu
@austere whale lol
I think this person does. Some crypto thing or so. I dont remember
can you send it to me, I want to read what this person posted
It's just boring uninspired grifting
Hey SolsticeShard, I read a good amount of the discord api and it is very interesting. But I dont understand the snowflake id, if you may give further explanation? Is a channel id also a snowflake id? Has a every component a snowflake id?
Anything with id attribute is a snowflake
@runtime_checkable
class Snowflake(Protocol):
id: int
Except components which have a custom_id which is a string that can be 100 characters long. In the components update there is also a new id field which is not a snowflake either. It is an 32 (or 64? Cant remember) unsigned int that can be used for whatever the dev wants.
Channels/threads, users, guilds, custom emojis, messages, roles, forum channel tags, etc are all snowflakes
I think this image is from the docs but just in case you did not see it
It really depends what you actually care about in regards to snowflakes. It's just a method discord uses for generating its ids
also discord way of saying
there are nothing there and don't even brother decoding this except getting the timestamp of generation
well, maybe someone think it have some random data and try to decode it for whatever reason
or maybe I just overthinking and no one would think to do this if discord doesn't post the structure of a snowflake
I mean I don't know who else is in the habit of seeing random long numbers and trying to "decode" them
Make a bot that gives people ideas for bots
I have seen in the docs components. Maybe you could do a game in there. Like guessing game or hang man.
There is a chapter in my book about the requests module. Is there some API to connect and get results?
you would not use that in the context of discord
I mean there are plenty of APIs and for sure one that prints out some bot ideas
you would not use requests in an asyncio based application
which all modern discord libraries are
aiohttp is the async equivalent
yes
aiohttp is what you'd use to make nonblocking http requests, which is the library that discord.py and others use under-the-hood to make requests to discord
And if one request fails the flow goes on
Sounds great
Make a bot that takes Roblox player Vector3 data from an in-game drone, converts it to a numpy array, and then launches a bomb at that player
isn't that just a graph?
you could probably just handwrite the connections and then make a parser for them: ```yml
hello - i'm, Kuba, friends
i'm - Kuba
to eat - strawberrie
Kuba - likes
likes - strawberries, to eat
sure, why not
don't use json to save generated data, period
@dc
class node:
value: str
children: list['node'] = []
def add(*o: 'node'):
self.children += o
def __hash__(self):
return hash(self.value)
def interpret(graph: str):
cache: dict[str, node] = {}
for line in graph.split('\n'):
left, right = line.split(' - ')
right = right.split(', ')
if left in cache:
leftN = cache[left]
else:
leftN = node(left)
cache[left] = leftN
children = []
for ch in right:
if ch in cache:
n = cache[ch]
else:
n = node(ch)
cache[ch] = n
children.add(n)
leftN.add(*children)
# something here, idk
digraph responses
moment, via graphviz?
i'd be simple and have a simple from | to table
no cuz it's not meant to be displayed
yeah but with networkx or such you could navigate the resulting graph to make the response chains
to make an apple pie you must first invent the universe
"to make an apple pie you must first invent the universe"
"!pip universe-inventor - there's a lib for that"

lmao dude's making an LLM by hand
keras get out the way
we got trev tryna make chatgpt manually
alr im really slow but why cant i pip install?
"The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again."
I’m assuming you’re on Linux because that doesn’t happen on windows
And Ubuntu is the most common distro so I’m going to assume that as well
yeah im on linux
sudo apt install python3-pip
this doesnt work either 😭
yeah it doesnt work
okay
run curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py\npython3 get-pip.py --force-reinstall
"Invoke-WebRequest : A positional parameter cannot be found that accepts argument 'get-pip.py'."
What the
I swear that worked for me the first time
Well if all else fails just stick with python3 -m pip
this is weird bc ive done pip install b4 i hard reset my laptop
idrk whats happening
wait am i supposed to download python on microsoft too..
"Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases."
???
i have python downloaded 😭
Btw this discussion doesn’t really belong in #discord-bots just so you know
oh..
Are you actually using Linux or are you using WSL
linux
Yeah that should not happen on Linux
Let’s move over to #1035199133436354600 and we can continue this convo
Are you on linux?
nope, windows
Me too
Would you consider switching?
probably not
sure, devving on windows is kinda hard but only for lower-level programming, from what i've seen
Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.

Have you done any debugging? Is your database working correctly? You question is not very clear. It also concerns me that you seem to have a bunch of duplicate files (dice(10)). Is it possible that you are running the wrong files?
yea thats a lot of code to check for errors. from my quick look through i didnt see where you were creating most of your mongo documents. Like rakeback stats returns 0s but doesnt create them for the user
is subclassing View that hard
why would people still use Item.callback = callback_func
Because they’ve seen other people, have been told so, or have seen YouTube tutorials that do that
pretty sad that people rely on youtube tutorials for everything and when the problem they want to solve isnt on youtube they just quit because theyve learned minimal to nothing
It's not always tutorials
Some people find is easier and more convenient
Instead of a ""whole class"" and passing state around etc
Why are we caring about KB's now
The psychological superiority one gains from observing their program's size grow, giving them a higher mental status over others to flex; regardless of the potentiality of just writing extremely verbose and inefficient program is inexplainable.
it's actually all comments!!!!
string
anyways should we care that much for tens of KB files
not like your storage is gonna goes out with that
The only thing that cares is, if the Code ist well written and for sure well documented
It is like, oh I have written a 10 Page Essay, but the Essay is badly written.
Also when the callback function is dynamic or one time use.
Doesn’t that mean your complexity is just O(n^3) every time you call that function
Is this that vibe coding everyone's been talking about? 😂
It's people hyperfixating on random things that don't matter, not really worth entertaining
Because this guy just sent a thousand lines of code with zero context and basically said “why doesn’t this work man”
it doesnt matter, what code he/she/it sent, we care about how well it is and if it works grrr
Bro is NOT trying to misgender 😭
Heyo gais
Let me check for how many KB over some constant of list of string
could anyone help me code
ok
why can the bot not ping roles as a response to an interaction but can otherwise?
Do you have allowed mentions set correctly?
yep, I tested it in the same channel with the same bot and the same role. The first image is me sending the message through the bot through jishaku and the second is of a command
Also, individual user mentions work fine
Probably because it’s edited
@jaunty cape
No the ping is sent before the edit
Nvm
are you deferring?
Yeah
Deferring then sending the message using ApplicationCommandInteraction.send (disnake)
deferring and then following up counts as an edit
I see, alright thank you
no progress
async def sprint_start(
self,
interaction: ApplicationCommandInteraction,
duration: str,
ping_role: disnake.Role,
start_in: str = "60s",
) -> None:
"""
Start a reading sprint
Parameters
----------
duration : str
The duration of the sprint
ping_role : disnake.Role
The role to ping when the sprint starts
start_in : str, optional
The time after which the sprint will start, by default 60seconds
"""
await interaction.response.send_message(content=ping_role.mention)```
Dang I just witnessed disnake in the wild
this is crazily annoying
nevermind I got it
What was it
So far I understand fully what the concept of discord api is
holy shit you're alive
The gateway is a socket connection that gives live updates what happens inside discord and the http requests are like to respond to these events ping pong
Please correct me
you can hit the api whenever you want
it doesn't have to be tied to any event happening
Yeah for sure but live updates make it interesting

"interesting" is pretty divorced from explaining how something works
There are some cases where these things are more strictly tied (i.e. getting an interaction through the gateway and responding through the API) but otherwise they're entirely separate
I think the gateway and the http requests make it interesting together
Getting an event and then parse the informations into the http requests like channel id
I mean sure, but that's an implementation detail you choose and not how the system fundamentally works
It's a pretty minor detail lol
When I send a text into this channel is it also a http request or no?
It is
how
So when I click the button it sends a post http request ?
Sure
that's the protocol your local client uses to send requests to the discord servers
So every chat app telegram whats app do this?

What? You dont know
Ok fair enough
The discord docs are so well documented every discord worker needs a raise of 500%
Discord docs are really good, a combination of staff and community work
🥹
As far as I concern
Client --HTTPS--> Discord --Websocket--> Bot(event)
i think the discord client uses websockets too right?
it does
But e.g. if you send a message it will be HTTPS instead?
I believe so, but given that you should never be handling a user token yourself it shouldn't matter
I mean you can also just replace client -> bot, given that the bot is the one triggering the event
those are entirely different questions
bots do send http requests to post things to discord, yes. I believe the only exception is presence that's set through the websocket but I could be wrong
yes, they're HTTP API requests
both for users and bots
there are a handful of things you can do from the gateway: https://discord.com/developers/docs/events/gateway-events#send-events
Weird on requesting member and requesting soundboard specifically is in ws
it might just be because they take a while
But soundboard is literally like emoji but for sound
yeah idk why thats on there
oh right right, especially for large guilds members get sent in chunks when you request them
and voice stuff is in its own protocol
yeah but get soundboards just returns some metadata about the soundboard, and since the number of sounds per server is limited it shouldn't be taking that long
Ice Wolfy was right
it was the allowed mentions not being set properly, not the deferring -> sending message
Aha good to know
I have a guild_user_relation table which maintains relations between user <-> guild
I need this because my bot hasn't been approved for members intent
Now I need to remove a specific relation whenever a member leaves a server to avoid outdated data
Adding a relation is easy because I just add it whenever the first command is ran by a user in a guild, but I'm not sure how I can remove obsolete relations too.
that is what I also thought. Maybe there is an event when a user leaves a guild then fire a delete to the database you are using or how would you do it. please correct me
Why have you not got approved
You usually can get approved if you get a valid reason
well yes theres on_member_remove but I need members intent for it
no clue, I told them the feature I wanted to add and they said "its not creative enough" ¯_(ツ)_/¯
Great lmao
who is they?
Discord...
ah
Discord team that approve the usage of intents
what functionality do you have which needs to know every person in a guild, even the people who have chosen not to interact with your bot
Never said I do?
this is my question lol
I dont know how to handle that, maybe solsticeshard can or who is expert on this?
we need an expert to answer that question
This is just 1 of the features of the intent, and not the only
I mean, you could do periodic scan, depends on the size of db ig
periodic scan okay but check that against what?
are intents to subscribe to discord events that are sent throufgh gateway? correct me
You can ask a specific guild member by their id
And if it doesn't exist, it would give error (not in guild)
but why all users in database?
If you don't need to know people who don't interact with your bot, then why do you want the intent
I see, so do that every ~one week?
Sounds plausible
Remove a specific relation whenever a member leaves a server to avoid outdated data
also depending on what you're actually trying to do, you may not need this data at all persisted
Data doesn't become "outdated" when you don't actually need it in the first place
Never said I wanted an intent, if you read my original message you'll know I'm not talking about intents and solely looking for a solution to something completely unrelated
So then put differently, why does your database care about what guild a user is in
Clearly it's something that is needed and those people do interact the bot
❓ Yes I need it persisted for my usecase, and yes it will be outdated if a member leaves the server
it's alright friend I'll go with @tender bobcat's suggestion, thank you
but why should every user in a guild memorized in a database? what is the functionality behind it?
Just so you know the operation is expensive and don't do it too frequently
every user
When?
having a sorting function for a command which allows you to read reviews submitted by bot users
you can sort by "guild members only"
so it will display reviews only from the guild members where the interaction took place
It's just need to remove if the user leaves the server
It doesn't add automatically if the user join the server
Then the guild is a property of the interaction not the user
X user left a review in Y guild doesn't change no matter what that user does
?
I think you're confused as to what I want, that's okay maybe I haven't explained well but my question has been answered
lol sure
If you don't have the members intent, this doesn't work anyways
X user create a review on Y guild
When user X leave the server, the sorting functionality must allow to not show the user review when "Guild Member only" options is used
According to what I read, it only doesn't allow getting update/join/leave event, or request all guild member in a guild
its alright @tender bobcat we can leave this topic, I belive they're just confused anyways I have got what I needed
So what is the endpoint you're proposing that will tell you if someone is in a guild without the members intent?
I don't think I'm confused here
and it's pretty condescending to insist I am without actually responding to my points
The top one
And the bottom one is what restricted, but top one seemingly isn't
It's not condescending, I just do not care to elaborate something if I have already gotten an answer to it, its pretty straightforward
Yeah this works, thanks
You can say that without insisting I'm "confused". That is condescending. You could choose not to say that, but you did
Welp my bad if it came off as condescending 🤷♂️
Okay
Like insisting that it needs to know every person in a guild when it doesn't?
I didn't say it did
I was asking why if it did, which was heavily implied by their initial phrasing

they did say "Adding a relation is easy because I just add it whenever the first command is ran by a user in a guild"
It was implied. Why would you say "I wasn't approved for members intent" unless you were implying you requested it.
This was again clarified, but you can't look at that sentence and read it another away
?
Member intent doesn't have a singular use
I didn't say it did?
It's clearly indicated that they want to listen the member remove event
damn what have I started
And you made the incorrect assumption after clearly stated
a very pointless exercise of pedantry, apparently :D
It was after they clarified jesus
big words, vocab is not my strong suit
literally goldfish levels of conversation context
lmao mood
Well, I made my point
There are nothing implied in the first message and clearly stated
I have something else to do now, good bye
Either way, the endpoint works in singular instances but is not designed for what you're suggesting they do. The rate limits get clamped down pretty quickly when it becomes apparent that it's being used to bypass the members intent
yeah that's a good point
I see
SolsticeShard his point is, why they need to know every user in a guild, when not interacting with the bot
oh god 
and they have clarified that isn't what they're trying to do, which is fine
here we go again
ok. end of this topic period
watch this conversation come back alive hours later when someone else reads it lol
I go eat now
i've done that before. stir shit in a discord server (not without good reason, mind you) and then get pelted with responses hours later from people scanning it and totally missing the context
it happens though

Really either a) you justify to discord you need to know who is in a server or b) change your functionality such that it's not built on top of knowing whether or not someone is presently in a server but only with the context you're given at the time of interaction. The fetch member endpoint will work in small cases, but the rate limit is dynamic/unpublished and I've seen plenty of cases of endpoints getting tightened
Makes sense
Randomly thought of an idea
Probably not recommended tho
Listen to messages event and have a timer for each user
Update the timer if they send a message in the server
And maybe check the user if timer>some large value
Again, not recommended but possible
nah that requires message content intent
You also don't have that? Oh well
no, that intent I actually don't need at all
Well
I'm out of idea maybe
That's alright, thanks for your help
you can get messages without content, but yeah this is all approximating a question discord has decided you don't need the answer to
also too hacky I don't like it
Just deal with it mate.
Spiciest channel in python discord server
I think this is a valid question when data like this is being collected like which user has been in which guild. Regardless it's easier to think about or answer when the why or the intended use case is known, as well as to assist reaching the end goal rather than getting caught up in one solution to it.
At least it would probably get a better answer anyway. But idk. Bleh.
The thing is, as far as discord is concerned with intents it's not just what people say they'll do with the intent, but what they could do with it. While they clarified that they intend to only track when people leave a server, that also inherently comes with being able to determine all people in all the servers their bot is in at any time
Can bots send voice messages?
no
Ok.
Well, technically, but not very straightforward
I did see some text to speech stuff in the discord api docs, but I haven't looked at it in detail. Search those docs for 'TTS' and have a look
huh
what's that supposed to mean
fr
yes, its also not that hard. can explain more later if you want
Could you explain? Im curious
isn't it just sending an attachment with a specific filetype?
For Voice there is a request to the api and the you Need to Connect to a Voice Gateway
I think Voice works with udp Protocol rather than tcp
They are talking about voice messages, not connecting to a voice channel.
All you have to do is send a attachment with a supported file type (wav is what I used). In the attachment you can set a duration and a waveform. You also have to set the IS_VOICE_MESSAGE flag to have discord render the file as a voice message. There are some limits on other content in the emssage that IO cant remember rn tho
ah alr
I figured it was something like that, but I was on mobile when I was reading the docs
so I just came in here to ask cuz it would be easier than trying to read on phone ngl
connecting to a voice channel is very easy for discord bots lol
So is this a workaround or an intended feature
I’ve honestly never heard of that before
Its all documented so I assume it is intended
- Make sure you have a good understanding of python
- Select a library (or use the raw API but that is generally not recommended). This is a good list: https://libs.advaith.io/#python
- Follow that libraries tutorials/examples/docs (specifically the one the library recommends not random ones online)
that is not what I mentioned. To play sound you have to connect your client to a voice gateway to send packages in order to hear music for example
chat is tcp protocol I guess, but voice is udp protocol
how can i fix this please?
what's the error when you run it
type checker is dumb sometimes
the error is in front of your eyes dude
from Source.Commands import
from Source.Functions import
anyways can we get some hate going for the python interpreter's error messages?
❯ python3 main.py
An error occurred: near "names": syntax error
that's not helpful man, i have no idea where the error could have happened
Ctrl F
Yeah lemme just Ctrl F through my 50 SQL queries to see where the error occurred
Such a smart idea man
I really appreciate your absolute genius advice
did you write your own try/except for catching errors? that's usually what ends up hiding the traceback, an error handler that doesn't print it correctly
No, the thing I found to be broken didn’t have a try/except weirdly enough
hi
all I did was import discord.utils
Hi

Hello,
im new to python. Check my field value:
value=(
f"[Vote]({SERVER_VOTE_LINK}) * "
f"[Website]({SERVER_WEBSITE}) * "
f"[Shop]({SERVER_SHOP})"
),
i wanted it to look like this:
Vote (Unordered Dot) Website (Unordered Dot) Shop
but im getting:
Vote * Website * Shop
Appreciate it! Thank you!
it’s because of the stars in the string
This is good
Just add newlines after every value
Because discord doesn’t parse what you’re doing as a list
Ok nvm that’s bad
For unordered list MD to apply, it needs to be at the start of the line. You should use a Unicode character instead •
This one looks a bit too small, so I recommend you put it in bold **•** •
hey yall, just posted a request https://discord.com/channels/267624335836053506/1371596436386349136
been struggling with this all day, nothing but errors hopefully somebody here knows
We're all friends here. Just curious as to what we're all working on. I havent coded in a while so need to get back into it lol
- Can't you just do lists by putting proper indentations into your strings?
- Like this?
myexample = "- A clear example",
" - More example?"
```?
Yes. But they won't be on the same line
oh he wants them same line? :( shame
🤔 Is there a legitimate, legal and within TOS way to get the member list of a discord server? 🤔
So far all I've managed to figure out is self bots (against TOS sadly) and actual discord bots, but actual discord bots require you to be invited lol
sadly
Yeah there's no "legal" way
Alright. Lets pretend we dont care about legalities and it's simply whatever method doesnt get me perma banned lol
self bots are against ToS
i know i said that
Yeah you won't get help related to that here then
I was hoping there was a way to monitor a server without an actual bot or being in it myself and not breaking tos
No ^^
:( well drats
Unless you monitor it with your physical self, and your eyes
Think about it for more than 5 seconds. How would that be remotely private or safe if any rando could just find out who is in whatever server whenever they wanted
Didnt ur name use to be blue?
narp
oh
bro it's much better than for some other languages
Almost impossible with any other language
that's what you get for not raising your errors properly 

!e print(set(dir(Exception)) - set(dir(object)))
:white_check_mark: Your 3.12 eval job has completed with return code 0.
{'__setstate__', '__dict__', '__traceback__', '__context__', '__suppress_context__', '__cause__', 'args', 'with_traceback', 'add_note'}
!e
try:
raise TypeError("sup")
except Exception as e:
print(e.traceback)
print(e.context)
print(e.cause)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | <traceback object at 0x7f9408b207c0>
002 | None
003 | None
!e
try:
raise TypeError("sup")
except Exception as e:
print(e.traceback.dict)
:x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 2, in <module>
003 | raise TypeError("sup")
004 | TypeError: sup
005 |
006 | During handling of the above exception, another exception occurred:
007 |
008 | Traceback (most recent call last):
009 | File "/home/main.py", line 4, in <module>
010 | print(e.__traceback__.__dict__)
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/V7EEMDPTNQ7ZRQAAZGWHJUODLI
you are everywhere I go

!e
class A: ...
f = lambda x: set(dir(x)) - set(dir(A))
try:
raise TypeError
except Exception as e:
print(f(e.traceback))
:white_check_mark: Your 3.12 eval job has completed with return code 0.
{'tb_frame', 'tb_next', 'tb_lineno', 'tb_lasti'}
!e
class A: ...
f = lambda x: set(dir(x)) - set(dir(A))
try:
raise TypeError
except Exception as e:
tb = e.traceback
print(tb.tb_frame, tb.tb_next, tb.tb_lineno)
oh my fuck
:white_check_mark: Your 3.12 eval job has completed with return code 0.
<frame at 0x7f32b2264c40, file '/home/main.py', line 10, code <module>> None 6
cant lie ima just go do this shit on my laptop

Of courses
im a lot into hockey stats and i coded a bot that fetch stats from a google sheet
Nice! Next step is to use the NHL API so that you do not have to rely on a potentially outdated google sheet
thats the sheet of my own Quebec League
dont need no api
Ah, gotcha
🤔
Looks good
hey does anyone know how I should / could verify my discord bot as someone under 16? Would I need to ask a parent, or what would be needed
Better to ask in discord.gg/discord-developers
alr, thanks 👍
I don't know if it's against TOS. But you could just make an account using your parents name, email and number (ask permission of course). and put the bot in their name.
Added a command that updates this message every time a new score is posted
This is borderline illegal in some places. The safe way to do it is to just have your parents make the account. It should take less than 15 minutes.
Arguably, someone who isn't an adult really should not be operating an application at that scale
A kid doesn't need to be managing anything that affects random people they don't know at any scale
Anyways, this is the relevant clause from the dev tos:
You also confirm and agree that (i) you are at least 13 years of age and meet the minimum age required by the laws in your country, and (ii) if you are not old enough to have authority to consent to the Terms in your country, that your parent or legal guardian must agree to the Terms on your behalf. If you are a parent or legal guardian, and your teenager accesses or uses the APIs, then the Terms also apply to you and you are responsible for your teenager’s activity. Please read all the Terms carefully.
(The Stripe identity requirements at verification are separate)
was the bot to study coding?
?
kids have proven that many of them have the foresight and the ability (the ability one is obvious) to run things like that. And i have seen lots of kids manage large-scale things with actual people under them. No catastrophies there 🤷♂️🤷♂️
The exceptions do not make the rule. Children very rarely cannot comprehend fully the data privacy laws they are agreeing to, and even then it's very difficult to hold them accountable for fucking up data privacy that has very serious real world implications
Which is the reason the whole sponsor thing exists. If it was a major issue they would increase the age.
I think that adults screw this up and often have crappy attitudes and don't care and that it is slightly unfair to single out teenagers here. Like if I am not mistaken these same kids could get a job in some places regarding working with food which is very serious about sanitation and safety and they'd be able to understand, so like why can't a teenager be taught the principles of data privacy acts and examples of what not to do? Like right to erasure, right to access, purpose limitation, data minimization, etc.
I'm not saying that adults handle data privacy well, they often don't. What I'm saying is that kids don't have proper accountability if/when they do (and they do all the fucking time)
I see it a lot. Kids just storing people's private messages unencrypted and have no clue there's a problem with that
made it so instead of editing it deletes and repost the schedule with the updated scores
There are pretty hefty rate limits on consistently editing a single message
Idk. I think it is more of an issue with kids and people in general not knowing better. Like if you think about it as being a data subject or know that your information is not supposed to be collected without your consent most of this could be avoided. Like, can I store these people's messages in my server? Do I need to? Is it communicated? Like anyone, if they know better could weigh it against the data minimization principle and I think the issue (at least in situations I can realistically imagine using ORMs and stuff that makes SQL injection unlikely) would be that they stored the messages at all (because I am thinking that if the application is hacked and thus the server then they'd have access to the database plus the decryption keys). And it's like a teenager could be stupid and email everyone who signed up to their site something but if they were to know about purpose limitation they could think, can I use these login emails to send notifications and they could be like "oh I can't cause it violated the purpose limitation principle". I am not gonna sit here and say making a discord bot is not serious and that accountability shouldn't be expected, but I just think that not enough would realistically go wrong if someone got the concept of data privacy and acted in good faith. It's not complicated people are just not taught it and even though they can't be held accountable, enough in good faith could be done that I don't think it matters as much for a discord bot.
There's two separate issues between people not reading what they agree to (which isn't going to change), and children being allowed to agree to things they can't legally be held accountable for
Can someone create a discord bot for me pls
hey i'm sure you could find something open source on discord
can you create a discord bot for yourself pls
Aww gee sorry mister. I would but I'm all out of codes. :( come back next week when I restock
lmao
Why is it always you two that say some bs lmao
Me?
Yes
:O I would never!
Let's say I tried to get a member object from d.py cache and it wasn't found. If I call the fetch method on the guild object, will that member be added to the cache?
Also if I have members intent enabled, is there still a chance that a member wouldn't be added to cache for some reason?

If the bot cant find the member its coz the member isnt in the bots view
that didn't really help 
For the first question, its a no. I decided to look at the src
but what about the second
No, fetch does not add to cache
And things don't get added to the cache randomly. There's a reason why it's not in there
Alright, guess that's all I needed
- you don't have the intent
- you're looking for a member on a guild on a different shard
- you've disabled chunking
- you're checking before the cache is populated
yep that's all I need
ty 
@fast osprey I found also this in documentation of fetch
"""
This method is an API call. If you have :attr:`Intents.members` and member cache enabled, consider :meth:`get_member` instead.
"""
does this mean that I can have members intent enabled and member cache disabled? If yes, how?
What are you trying to accomplish
I'm just curious
Did this just tell me to consider meth?!
You can't fully disable the cache, but there is an option to tell it to not populate the cache automatically (chunking)

So chunking is enabled by default?
Kind of a dumb question
I could've already assumed that is a yes

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, ...)```
Represents a Discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client) and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client) you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.GroupMixin) to provide the functionality to manage commands...
It's chunk_guilds_at_startup
I remember there is something that set the cache size but forgot where
only for messages
and members
chunk_guilds_at_startup
max_messages
member_cache_flags
Oh
Me??
Neato.
Can you show us in real time and not sped up?
Are you updating the message or sending a new one?
Neat
Hmm
I made a timer once before and I only got to message edit every 6s consistently (it's a timer) and any less would give me 429
discord specifically does not want you spam editing a single message, and will clamp down your rate limits if you try to
Yep I am aware
Just questioning is could it actually update every 2s if without interaction
grrrr makes me angry such statements
did you make it yourself?
everything
ok fair enough
have you experience in discord api?
nice
seems good
ok, where do you host your dc bot
fair enough, I want to buy a raspberry pi 5
just to expirement with linux
sry experiment
ah that is why you are java developer
isnt minecraft java?
It works until it doesn't
And if you wait for things to break instead of reading documentation and following advice, things breaking will be your only feedback point
Same way you import any definition from any file in python
Why would you have a group and a command in that group in different files
That's not good practice and is actively making your code worse
You should bundle definitions that are related to each other in one file
It's more complex than that. But a module is meant to have all of the definitions that are deployable/reloadable/interdependent together
Thinking "long files are bad" is a very common newbie trap that isn't grounded in any kind of rigorous framework
That's a personal neurosis worth questioning and backing up with community standards
You could get this to work, but you're going to be patching together several files for no functional purpose
since I am new to python, I have noted your sentence/statement
every advice is good to know
This in particular is very squishy and opinionated. But when it's "make more convoluted code" vs "appease my personal neurosis", it's a pretty easy call. I encourage people to look up when it's appropriate to make multiple modules and why you would functionally want to, rather than just go on a random gut feeling
yeah, when you have a module called games, you put your commands that are refered to games in one module
for example /game1 / game2 /game3 .......
when you have a module called moderation then all commands that refer to that in one module
correct?
correct me guys if I am wrong or so, I dont want to spread false informations
I mean that's some pretty imprecise language that's hard to comment on
Definitions that directly refer to each other (like a group and a command in that group) really should be in the same module unless you have a functional reason not to.
For commands that are "related", which is a pretty subjective and squishy term, that's really up to you
we can help you but not code entirely
ok noted
Ok
The first one you are not instantiating the class.
Are you familiar with object oriented programming?
yikes
It is a bigger topic that I will not be able to explain quickly. I recommend these videos about it
https://www.youtube.com/playlist?list=PL-osiE80TeTsqhIuOqKhwlXsIBIdSeYtc
1, 2, and 4 are probably the most important for now but it is only ~1.5 hours total and it is a very important topic ot understand
What is async & await function and why we are using it to make discord bot
But what is the point
Like the main idea of it
did you read all of that?
Give it a read, ask questions on what doesn't make sense
What if everything doesnt make sense?
Then you pick one to start with
can't remember the part of the docs, but in dpy 2.5.2, does it allow you to upload emojis to the discord panel?
if so, where is that in the docs?
!d discord.Client.create_application_emoji
await create_application_emoji(*, name, image)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Create an emoji for the current application.
New in version 2.5.
Guys
Help me on this please..
from discord.ext import commands
from discord import app_commands
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
status_channel = bot.get_channel(1374024344698617866)
if status_channel:
await status_channel.edit(name="BOT STATUS: :green_circle:")
channel = bot.get_channel(1372999749925470379)
if channel:
await channel.send(f"HELLOOO {bot.user.name} IS HERE")
@bot.event
async def on_disconnect():
status_channel = bot.get_channel(1374024344698617866)
if status_channel:
await status_channel.edit(name="BOT STATUS: :red_circle:")
bot.run("TOKEN_")```
So yes I checked and it does make the channel go green when active
But when it shuts down it doesnt make it red
@sharp lintel
Or anybody 😭
I assume on_disconnect is not an event?
I asked AI and it said it was im unsure
Oh damn
What AI should I use then?
from own experience, it creates trash code that doesn't work 96% of the time
you should just learn the d.py library by yourself and not depend on AI
I understand that, I dont rely on AI at all, I just ask it questions from time to tim
I am really, I dont depend/rely on AI at all
I just ask it for some minature questions
Okay so for your case
You should most likely create a commands.Bot subclass and override the close method (coroutine) to execute the logic that you want to be ran when tho bot is being closed
So you mean I should use a shutdown command instead of CTRL + C on the terminal?
Well I did think of that, But the main reason why I wanted it to be automatic was because of my slow wifi, Which might shutdown the bot randomly
My wifi's peak is at 500kbps
It’s called human intelligence and discord.py docs
I was talking about your problem where you attempt to edit channel's name to BOT STATUS: :red_circle:
Stop vibe coding smh…
:/ well why not use tools at your disposal
Im unsure, Thats why I asked
async def close(self) -> None:
# Do some logic before closing
await super().close()
I assume that this should work
Ill try this, Hopefully it works
@bot.event tho right?
That’s if you’re disconnecting at your own will right , I thought he was tryna make it automatically in case of a disconnect lol
Nope, close is a method that commands.Bot contains
close is not an event
You shouldn't be using channel names as a data holder in the first place
That's api abuse
true
I mean I also think its not possible, Because if you disconnect your bot wouldnt know its going to even disconnect only after it right?
Can you elaborate
You aren't supposed to be using channel names to record things that change
Yeah that’s what I’m saying lol
Channel names are for the channel's purpose, which isn't something that changes repeatedly
Just because you said that, I’m moving all of my code in setup_hook to on_ready
Jajajajaja
I mean your right, But this would be happening once an hour at most so isnt that okay?
I mean this also seems pointless as the user can just check the status of your bot by checking its profile
That doesn't change the fact you're using channel names for something discord has specifically said they're not for
I havent been following. What is he using channel names for?
I bet it's for something silly
And it's not unlikely they'll see you're doing this and clamp your limits further
tracking bot's status
He wants to change the channel description on bot ready, and change it again once it disconnects
What does that even mean? like if a bots online or not?
Bro he’s not even doing it right
He’s spamming the API by having it done in on_ready
But.. Why?
Just set the bots role to display separately from everybody elses and check if it's there..
Your logic is this:
if bot dot green. bot online
Another way you can tell your bots offline is if it responds to commands..
checking bot's status
wow i dont even need to click a single thing
i wonder if the bot is offline when it says Online on the status
Not sure but CoPilot sciprted what I need
and it works
"""Perform shutdown tasks such as updating the status channel and closing the bot."""
status_channel = bot.get_channel(STATUS_CHANNEL_ID)
if status_channel:
try:
await status_channel.edit(name="BOT STATUS: :red_circle:")
await status_channel.send("Bot is shutting down!")
print("Status channel updated to red and shutdown message sent.")
except Exception as e:
print(f"Error during shutdown cleanup: {e}")
else:
print("Status channel was not found during shutdown.")
await bot.close()
print("Bot closed gracefully.")
def shutdown_signal_handler(sig, frame):
print(f"Received exit signal {sig}. Beginning graceful shutdown...")
loop = asyncio.get_event_loop()
loop.create_task(shutdown_bot())
# Register signal handlers for SIGINT (Ctrl+C) and SIGTERM
signal.signal(signal.SIGINT, shutdown_signal_handler)
signal.signal(signal.SIGTERM, shutdown_signal_handler)```
sadly I dont understand anything so I wont use it 😭
I like using stuff that I understand only
Get a load of this guy

Can you show me all your code @broken sluice?
You can read the docs on how to discord api
or more specifically. the command itself?
I dont have any code, Im just learning 😭
Show me the command to shutdown your bot
CTRL + C in terminal, I dont use a command?
Did AI add something by itself
you dont have a command? :|
Nope ;-;
Im just testing around and learning
You got any commands?
not really I didnt reach that point yet
Dont rely too much on AI to build your bot
discord.py or any library has the bare bone example code in their github repo
if you dont understand the bare bone version of the bot well its better to learn the language first
It also important what await or async does because it is essential for serving thousand of io network operations
The first version of discord py wasnt async
Another solution you could look into is posting a message to a webhook. This would mean that even if your bot completely crashes the status could still be communicated.
;-; am i cooked? I made a full bot with that ai?
yes
AI's are routinely blatantly wrong. They are not a substitute for learning and reading documentation
Just yesterday someone was asking why there bot was not working, it was because the AI combined multiple different discord bot libraries together. The training data out there related to discord bots is often of very low quality and extremely outdated.
ChatGPT will routinely spit out completely wrong things like claiming 3 isn't a prime number, and it will be incredibly confident about it
Why would you fork something just to not add anything to it
I use AI to chat when I am feeling lonely, I just write how you find these shoes I have found on the internet and what outfit fits on and other bullshit
I declare independence and am seceding #discord-bots from the rest of the server
Who’s with me
sobheap
Well bot I made has a very specific purpose it's not on git
Bro I’m talking about your profile in general
Oh I was like developing it but i forgot to put a pr
And GitHub is mostly private you won't find anything impressive there but sure there are no major projects done i am doing them but it is taking a lot of time
Since you dont know the code, and are heavily relying on an AI to create the bot/code for you, you will have a lot of security issues involving your bot.
Security issues are quite concerning because i am aware that it's super easy to like get my bot token
I learnt that don't rely on ai too much better to learn it yourself if you have time to learn that way we would have more control of what we are doing
Where do I learn about this discord bot development?
?
@quick quest please stop dming people. Nobody wants to make your bot.
Worse than that thing from rick and morty who just wants to make an app
Yeah can you please make a bot for yourself
@jaunty cape Did he dm you as well? lol
No I just wanted to be as annoying as possible to that guy

lol
Wait since when could non-nitro users use emojis from other servers
He dm'd me, I asked for 500 usd for his basic ass bot, he said sure np.then demanded to see my past work. i said na he came to me. i aint begging for a job i didnt know about or want.
they cant
Aw man why did it show up like I could
Nothing is free
If you think it's free than you're the product
Please do not be tricked into thinking it's free
Think of it how you want, but its is indeed a nitro trial from discord
😂
Ya'll out here thinking they're giving you free shit out of the goodness and kindness of their hearts
Like they're out here being all "Why thank you valued free user of our services who never pays us anything, have some free shit."
Cinema
Who cares if it is free or "free"
Because discord is doing it to convince you that you need nitro in your life
so ¯_(ツ)_/¯
Never a dull moment in this channel
This channel deserves to be its own server
Which is why I declare myself the senator of #discord-bots
I declare independence and I am now seceding #discord-bots from the rest of the server
oh
Do you have your own police force? your own currency? laws? citizens?
you cant just declare something its own nation
Please stay on topic everyone... the subject of this channel is Discord/Discord bots.
You probably shouldn't use buzz words /sayings if you don't know what they mean
facts
look at honey
markiplier caught that 5 years ago
What does this have to do with discord bots?
also isnt this a python server since when was goku coding 💀
idk i just joined
Then the rules must still be fresh in your mind
i didnt read the rules
like i said
i just joined and went straight to the lounge
besides what does python have to do with dsc bots
WE MAKE GAMES
IN THE FAVELAS
!timeout 1287493549251629077 Time to read the rules then.
:ok_hand: applied timeout to @arctic egret until <t:1747764290:f> (1 hour).
The .topic bot here is pretty cool
would be better if it had slash commands
How do I write unit tests for my bot
does anyone actually do that?
you should
it's a bit tricky but in concept it's similar to unit testing API endpoints (but pretend the http endpoint testing tools don't exist)
you need to separate out the "business logic" part from the part that interacts with discord, then you simply test your separated functions.
you could also write up mock objects for contexts, channels, guilds, etc but generally speaking you want to avoid mocking as much as possible, since the more you mock the farther you're going from a real environment
remember that you get the most value by going from no tests at all to a good amount of tests than you do going from a good amount of tests to even more tests
I could steal the mock objects from @unkempt canyon right
rules won't answer the question 
i dont know if i'd say avoiding mocks is necessarily best practice
its just heavily debated and i think you're likely to find people on either side
that doesn't really answer the question either. i think we're all aware about bad practices and how prevalent they are in the discord bot space
they were referring to writing unit tests
Did you even read what the conversation was about
I'll tell you one better, build a discord API emulator then connect your bot to it via an environment variable at startup and see how your bot will interact with it for real. Acceptance test it. 
thanks for standing up for abusive mods
mods that once given power go rogue
mods who are on a power trip
I stand for what's right, and this isn't it
Free Discord
'good boy' this isnt the 1800's
stop bending over to their will
It makes them stronger
They might have the power to push a few buttons but they have no power to push around people
FREE DISCORD
FREE PALESTINE
wilding
!tempban 1287493549251629077 3d Looks like you need some more time to read?
:ok_hand: applied ban to @arctic egret until <t:1748085425:f> (3 days).
free discord 😂
Holy yap
They clearly just lack attention, you're better off not giving it to them
Seeing someone use an arabic insult is the least thing i expected to see on a python server
Seeing an Arabic insult is the first thing you should expect anywhere
Seeing free discord and free Palestine unironically in the same sentence in here did it for me.
Anyway, did anyone build something awesome with Component v2 yet? so I can steal them
dont steal mine thank you
how long have they been out?
2-3 month I think?
Not library tho, I meant API
I think all the popular library is at most PR rn
Consider this is a python server, I am only discussing about the discord library bot for python
Hmm it's later than I thought it was
I found back on the message that let me know component v2 is available and it was 19 April
yeah the "lock" was lifted days before
but 22 april is when the official announcement was
suppose i want to master creating discord bots (being able to create any kind of bot), but i don't want to fully learn python what parts of python do i need to learn for that?
Ping me when you reply
learn another language if not python 
I meant what parts of python
that's a really weird question...
having the ability to build "any kind of bot" in python requires you to know everything about python
Functions, data classes, async await? I don't know if you are going to get very far on so little programming experience
you can't learn specific parts and be able to build anything
Thanks
This list only tells you what you need to know to be able to build a good discord bot
Depending on the features you want to add to the bot you will also need knowledge relating to that
Lets say i want to build a bot like bleed,
Database management, API integrations, web management, security practices, logging, version control, proper deployment practices
2 things
Saying that you want to master something like discord bots is not really possible. There will always be more to learn and always be ways to improve your bot.
What you need to learn will depend on what you need your bot to do. Most people probably do not go into a project knowing everything that they need. They need to do research and learn new things even if they have a lot of experience programming.
I learnt programming just to make a discord bot. I suck at it, and that's ok. I ended up creating (and then destroying) a moderately successful community as a result 😎
My friend would constantly give me ideas on how to improve or add features to my bot and give me exestential dread for an entire weekend.
Who learns python just for bots 😭
It will be hard to learn specific parts only as the topics are interconnected, so you should probably learn basic concepts of programming which are similar in most languages and then build projects like bots and gain experience
Me. Thats who.

@robust fulcrum Hey, I see you thumbs down my comment, that's cool. Why did you learn to program?
ignore, everyone starts making what they are passionate about. and knowing what you wanna do when you started programming is great because you know what you need to learn and it gives you a clear goal abt it. that's my pov tho
Oh I do ignore all the haters. Dont worry.
I do what I want. I just wanted to roast him
ah I see lol
Nobody cares why you decide to learn something. What matters is how, and you all seem to be conflating the two.
Sure you could get into the medical field because one day you want to do brain surgery, but that doesn't mean you start on day one by cracking open someone's skull. Even if your goal is eventually to make a bot, learning programming from scratch by starting on a bot is misguided and impatient.
Interest in web development
The probably only difference is compare to medical field
No one gonna stop you from doing so
But you would just have a very hard time and probably give up
lol that’s it?
ye, i don't have a bad reason to learn programming, nvm bro i was just kidding
How do I sync discord.py slash commands to work in DMs? I thought this would work automatically as when I add the bot to a new server I can use the commands there w/o doing anything, but when I add the app to myself for use in DMs the commands list is empty.
You can set it for all command at once or per command
i just want to sync all commands globally the same way i do for servers
but i dont see anything in the docs
You first need to mark the commands as installable and useable
Syncing will still be the same
https://about.abstractumbra.dev/discord.py/2024/04/11/user-installable-applications.html shows how to set it per command
To set it for all commands at once, pass the allowed_contexts and allowed_installs kwargs to Bot:
commands.Bot(
...,
allowed_contexts=app_commands.AppCommandContext(
guild=bool,
dm_channel=bool,
private_channel=bool,
),
allowed_installs=app_commands.AppInstallationType(
guild=bool,
user=bool
)
)
tysm works fine now
what command did you use to run the bot?
pip and python are ambiguous. They don't necessarily hit the same python installation
You should be checking python -m pip list
It has been just under 9 hours. are you home yet?
"just under" - yep I am on my way walking from north pole to south pole, wish me luck /j
Hehe 😜
I Need A Discord That Have A Currency Only And Have A Shop No Games That's it
But I Add Balance
That's It
@dusk pelican @
Not with that attitude
I have a previous attempt on using python only as a wrapper and do basically everything (or almost everything) in SQL
Which is a fun attempt
Then make it yourself
discord.sql when?
hello
From where do i start in the process of making discord bots?
Like i need complete guidance of it
https://fallendeity.github.io/discord.py-masterclass/ maybe give this a read?
A hands-on guide to Discord.py
:D
How bad isit to use discord channel webhook to receive form data from a website? (will be used in frontend)
so what can discord webhooks do? other than sending messages to channel?
That's all they do
Isn't that like the best use of them lol
See GitHub webhooks
That's why i am thinking of using them,
But was wondering if it could somehow be security issue,
No security issue as far as I am concerned and I dont know a lot about much
Just dont give the webhook URL to people who dont need it
Same. I just know that you shouldn't share the ID/TOKEN at the end of the URL. Since that'll basically allow anyone to send messages via it.
I mean adding it to frontend literally means, people will be able to see it!
can someone kindly share d.py link?
discord server link cant join using ur tags for some reason
Web hooks are meant to not be seen. So wherever you're seeing someone elses webhook means they did an oopsies
Not sure what the policy is here on promoting other servers, but this is very fast to find on the front page of the docs and the github
It's also in the channel topic
Which for some reason does not have any information about any other libraries other than noting that "other relevant python libraries" exist.
feel free to suggest changes in #community-meta
To be fair, d.py is the de-facto library for discord bots.
And a lot of the other relevant libraries are just forks of it. It's more practical to refer to the source itself
we had a whole ass argument about what default meant and if dpy was that, not worth barking up that tree with these particular folks
I have.
Since when? Definitely not for the past ~3 years.

I'm yet to see any library replace discord.py in its popularity
You may see in PyPi
This statement does not make sense and is just ignorant.
Is it untrue?
So what? Just because one thing is most popular means the others dont exist?
It does not. It however does mean that it's the de-facto choice
i dont think anybody ever said the others dont exist
We're talking an objective metric here
Yes, the other libraries are forks. But in one of the core aspects of modern discord bots, app commands, all these libraries are different. Discord.py is not the "source itself" it is one of many sources. If you think that discord.py is of higher quality and makes better design decisions that is your opinion, but that differs from my opinion.
Thankfully, that's not what I said
Once this devolves into straw men it's really not worth arguing
I dont get why people who still use discord.py are so against other libraries being added to the list of resources in a python discord server. Why is there any argument at all?
In order to work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
And this means what?
Please point to where anyone said the other libraries shouldn't be added
!d disnake.discord
Unable to parse the requested symbol due to a network error.
Other libraries are available for consulting in the docs
I'm not sure what your point is
Py-cord is not
You may submit an issue on the bot, or perhaps bring it up on #community-meta
And that is also unrelated to my original statement
I have
From what I recall, you support directly replacing the discord symbol
Or am I mistaking you for somebody else?
#discord-bots message This message in response to mine directly implies that it is unnecessary
If that's how you want to read it, that belies a pretty severe victim complex
Dont know what you mean by this. Please elaborate
As in, doing !d discord yields multiple choices in which the user is forced to make a choice
Yes, I am in support of that
And that's... not really what I meant.
It just means that. discord.py is the de-facto library for Discord bots, hence why it gets a link.
And hence why it's the also go-to symbol when consulting the docs
Any of the forks could have very trivially just picked a different package name
It's wild to me that most didnt
Array objects
NumPy provides an N-dimensional array type, the ndarray, which describes a collection of “items” of the same type. The items can be indexed using for example N integers.
All ndarrays are homogeneous: every item takes up the same size block of memory, and all blocks are interpreted in exactly the same way. How each item in the array is to be interpreted is specified by a separate data-type object, one of which is associated with every array. In addition to basic types (integers, floats, etc.), the data type objects can also represent data structures.
Although array also exists in stdlib
Well not all of them did
I assure you that there's simply no witchhunting or bias against other Discord libraries.
But we simply acknowledge what is mostly frequently what people mean when consulting docs
most
Furthermore, inconveniencing people by clicking an extra button to get the option they want 90% of the time is not the way to go
I know this was not your doing. But just explore some of the tags on the discord.py server.
🙄
Point being?
That's totally unrelated
I encourage you to try ?tag who is the most intelligent developer
also if we look at stats, discord.py has had ~550,000 downloads in the past week (500,000 for discord.py and 50,000 for discord). and if we take py-cord, it's had ~18000 downloads in the past week. i use the past week because i'm assuming those are the people that are most likely going to ask for help. if we go by those stats you can assume someone asking for help is using discord.py and you'll be right 97% of the time. of the remaining 3%, you most likely only really need to change up your answer if the person is asking for help with app commands
i think assuming the software 97% of people use is fair to call the default
Again, this is a side-topic of my original statement. But I dont really care about that as much any more. Manually linking is good enough for me. But it is concerning when py-cord, disnake, nextcord, etc users get linked discord.py docs.
?tag who is the most intelligent developer
This is not a Modmail thread.
What even is your original statement, then?
Because at this point, I may have either completely lost what you mean or misunderstood
If you add the other libraries it gets closer to 90-92% last I checked
I want the other libraries mentioned by name (and with a link to docs) in the channel description of this channel
Hit #community-meta up with a request
sure. it's still the vast majority of people using discord.py, i'd only really consider it if it was like, 60-40 but i guess thats arguable
And what are the criteria you would use to determine which forks "earn" a spot
Oh wow hikari is still there
What happened
