#development
1 messages · Page 1753 of 1
the error message here is really wonky because I did some hacks to make this work but in general it's almost always better than js
I really had to get used to defining types for everything when I used Typescript for the first time. But when the project got bigger I absolutely understood why it's better.
I think my blog is the only thing I still have in js only because I don't care if things break there
😂
ayyy
I've always had some trouble working with TypeScript, whether it be compilation errors or some sort of weird bug
heres thefun part tho
//@ts-nocheck does not get compiled
for whatever reason
weird
so
heres the thing
[i need //@ts-nocheck there to make sure my main file doesnt get type errors
there are likely some differences between tsnode.register() and the tsnode cli
and then the ts-expect error afterwards for then ts-node.register() gets called
Map<string, 0> 
itsw kinda odd, but its a quirk i managed to get around
isn't that just Set<string>
i guess so, but i think maps are better indexed
and 0 is the smallest byte-wise thing i can set there
rather than using includes() or some other sort of array method
I haven't heard of performance comparisons between map and set like that
in theory the smallest value you can have is nothing the way sets do
i'd be interested to see which is more performant tbh, a set or map for indexing
set.has should have comparable performance to map.has, no?
im not on pc now otherwise id already be benchmarking it

I can't imagine there's any meaningful difference between indexing a set and a map. Aren't they implemented similarly under the hood
i would benchmark it but im the middle of work rn
probably so, but these workers are meant to grab a lot of traffic
since they are dealing with presences, i'd like to make it as performant as possible
use objects then lul
im getting 1-2 presences per second now as oppose to the 150k i was getting before on a single thread
objects are more performant when keys are strings
maps are better for non-string keys
delete obj[id]
obj[id] = 0
?
yes
aight, lets roll with that then
but hasOwnProperty has the same perf
at what point do you go ok maybe javascript is not the right tool for the job here lol
realistically i wouldnt be worrying about that too much, its just due to the fact that i ACTUALLY managed to clog a very high end server with presences alone
so worrying a bit too much here wouldnt be that bad
spikes were going up to 160%
now its stable at 5%
because you were single threading right
Map<string, {}>
100% cpu usage vps dying
Map<string, 0>
0 resource usage we chillin solo bolo
at least in dev
correct
now with the workers the main thread is at 5%
though now im not doing any parsing in the main thread
im just emitting the userid, the guildid and if a new presence was triggered or no
since i need to know when they start/stop playing
I would use a Set personally. Until performance was really a concern.
How to rule
yes
get engaged to bill gates
Think you can just return data without the ()
it not worked
if bot is public
Please read: #development message
im just using json for 15-20 member data
The size of your bot, whether it's public, and what data you're storing, is utterly irrelevant.
Do not use json as a database. It's not.
no no, don't argue. Just switch to something better.
i promise you
And you also you can't... like... send your entire DB as a response to a web request.
that's stupid
You cannot send your entire DB as a web request
because
if you want to know what's in it, LOG it.
2 min ago i opened question on stackowerfellow or which name is trash site
lmfao
im gone fix this
Look, you're using notepad++, trying to use a json db, and use var. You obviously cannot be trusted to understand the impact of what you're doing.
stop.
Jesus christ kid, this isn't fixable, it's dumb, stop doing dumb things when grown ups tell you to stop.
DO NOT use JSON as a database.
noooo
json > all
Stop ditching notepad++ or the devil himself will come over you! 

notepad + cmd > vs code + terminal
im using quick db for more big size datas
Who cares about the size? It’s just an optimized storage system offering huge amount of possibilities.
it's not that hard?
yeah, ok? Same deal as in Discord, man
you have a looooooooot more to learn before making a website
when i restart then it
quick.db will save your data just fine on restart
bruh
READING a file = Querying a database
It does read a file, too
i didnt meaning this
Files on your drive, nothing else
im making api and fetching data from api to make html table

so every refresh page

need to get new data
Right ok so just keep using quick.db, it's not cached, so the data is always the fresh one
ezpz
What’s the issue? I’m querying my tables a few times any website reload.
That’s how it works.
JSON would be worse for this. Literally, the worst thing you could use for this.
Hindsight is trying so hard 
you can also implement a second level cache so you can prevent querying your database every single time
but again
then quick.db not be here
backtrack and learn web development properly
the issue is the half broken english and the inability to listen after asking a question from people who HAVE done websites before
One of the intents of quick.db and enmap is to enable rapid prototyping and simple development without having to deal with databases. So, really, it's perfect for someone who's wanting to learn web dev.
follow this roadmap https://github.com/kamranahmedse/developer-roadmap#back-end-roadmap instead of making very vulnerable websites
i wonder if at this point they just just modify some boiler-plate
since they are lacking SO much in terms of developing front-end/back-end
To be fair there's no one right way to learn web design
im just using json for these 10 moderation user
No you're using quick.db for these 10 moderatoon users.
Well I would more likely call files than the RAM. Any cached data is gone on an unexpected shutdown.
Not so for files.
I mean they can actually get corrupted but it hardly depends on the type.
uh
did you want to learn what is real?
I want you to stop being an idiot and start doing the right thing
theres a difference in passing json to your website(which uses js) and likely your api/db returns a json payload. That doesnt mean you're storing the data in json
because no one here will help you load the shotgun you're aiming at your foot like a noob.
however json > all

cough cough keydb/elasticsearch
the point of second level cache is so data you pull frequently is stored in memory, any update done on a second level cache entry first updates it in memory and then the database as a side effect
had a stroke there ngl
And additionally that makes sense only for data to cache which won’t change dynamically.
Imagine caching if a user account is locked or not on the login and don’t query the database each reload to get the latest value. 
Actually there's sort of a correlation between discord and the web, yeah? You can't send an entire object to Discord so you have to stringify it (like, message content). There's an additional front-end layer to parse that message but the base idea is that.
corect, but the website would likely be using js to fetch() whatever they got in the db, which would in turn be json. the data itself would be stored in the db however, which wont (necessarily) be any sort of json relative
I mean it really depends
tbh someone starting in web dev would be best served by using EJS or PUG
the way they are saying suggests they are confusing the json format to what they get in the front-end, not how its saved on the backend
Yeah but I have actually no case I can imagine I would need that or would ever needed it
rather that straight-up understanding the correlation between fE and BE with requests.
hmmm ejs would be a good thing
that whole thing just screams 2006 cliche web vulnerabilities
react would likely be a good alternative, its amazing for dynamically changing things on the go
svete might be another strong contender
Obviously, cry. Beginners need to go through this process of making shitty things in order to understand how they're shitty. Hopefully without falling a victim to some hacking
this is why i recommended they should probably use a boilerplate
If you don't go through the pain of creating a bunch of static pages before realising how beautiful dynamic generation is, how can you appreciate the beauty?
or some other already secure-ish thing. Firebase should have some very decent db/website options with GUI instead of code
though i agree with you evie
Guess that’s the common way anybody goes
i personally would have 100000x more satisfaction seeing my own thing
and one thing, using json data and choosing harder way to searching thing for make website and choosing your way to easily make website and not understanding anything
i think i just wasted my 3-4 hour for searching something on google
if i just used quickdb or other things
You're going to waste a lot more time trying to use json
it just be 10 min for me but not understanding anything or wasting my time to make better
trust me, please, if you're ever going to trust someone with more years of experience than you've even lived, trust me here : JSON IS PAIN
^^
do NOT use JSON as a database
the only thing worse than json is jsonb tables
see what i mean evie?
no , they are not equal
yes it equal
this
let's be clear. do not store thigns in .json files
and json is minimalized to store
they are probably confusing front-end with backend if they state they use quickdb
You can definitely store objects and shit in quick.db and enmap
the problem isn't the json format.
the problem is storing in json files.
You'll still need to exchange json strings between your backend and frontend, that's fine, and required
im saying against
What you cannot and should not do, ever, unless you're literally mentally incompetent, is think that you can and should store data in .json files and modify them programmatically.
Don't do this
if im going to make holy owo bot or anything i need to develop / waste time
i can use quick db
but im now just making for 20 moderation user
and they dont know how to edit quickdb
it will be quicker
That is a stupid argument
we've sucessfully waste 17 minutes trying to explain that quickdb is not equal to .json
because you don't edit data manually in a file when you have a website
if you want them to be able to edit data, you make a form with a Save button
Don't care
here, you are SO angry about how easily you can modify data?
if you download db browser sqlite
I started with Discord Bots
yes
and now I'm paid $80k/year to make websites
And guess what I never ever did in my bot developer or web dev career? store data in json.
That's why I'm actually paid $$$
you are not making sense
You already know quick.db , you have zero excuse
im just making bot for private server
I don't care what you're doing.
Looks too complicated to tbh, no Alexa support obviously
we are understanding, you just not making any sense
use quick.db
so i want to give their basic bot system
I do'nt even like quick.db and I want you to use it
it doesnt matter if you are using a bot, facebook, a new discord platform or a new mail, just DONT USE .json
its bad
period
If you're making something for a private server, give them commands in the bot to edit things if they need it
ughhhhhhh
and it's going to be much easier to change things in quick.db
We understand you perfectly
i hope you sponsored with quick db
dude, i HATE quickdb
I would suggest SQLite but who cares
im a postgres/redis and keydb fan
my data = number
we are saying you should use it cuz you ALREADY HAVE IT
quick.db and enmap both use sqlite
Doesn't matter
num
you can store ANYTHING
ber
doesnt have to be string
10-15 entries in a quick.db file will take about 5kb of space
yay numbers. lol.
whats ur argument now?
Well never used quickdb but I guess I learned something
do you see????????????
im using quick db tooooooooooooooooooooo
but i dont want now quick db on current project
make colums for EACH thing inside your json
you do'nt need to edit things manually when you're making a website or bot
you use commands and UI features
^^
im saying firstly itttttttt toooooo
i dont need ui features
its just basic project
Lmao using a database to store a JSON string
its like google or opera
they dont understand they dont have to have only TWO colums
im choosing holy opera
So here's the thing, right? That "one thing" you need help with, is literally the simplest thing you can do, which is read data.
After you figure that out, you need to figure out a way to write this data
After that's figured out, you realise the data doesn't update so you need to figure out how to "reload" the data
And after that, you need to figure out how to load, edit, and save the data to change it.
None of these things are easy in json
All of these things are super trivial in quick.db
yes it is
when im getting some code from another user
Click the big fat "invite" button on the right.
im just store it and
using to create new system
so if i get there help with json
im going use this system on .... system too
ok but you're not even there yet
json is not main problem here
it is
as you can see
You haven't even started learning what you need to know to start doing the shitty thing
@analog tinsel does this make sense to you?
instead of ```
|id | json |
|123| {"stats": 1, "otto": 1010} |
You do
| id | stats | otto |
|123 | 1 | 1010 |
how harder to talk
Again, I'm speaking from experience here : you haven't scratched the surface that is the horrible pain of using json as a database
you don't know how hard this is because you literally are at step 1 of understanding
and there's at least 10 steps of pain
bro bro
I'm telling you to stop not just because it's bad, but because it's bad and hard
I don't care what justification you have
Lol Hindsight... why do you want to convert him?
Because I cannot allow this tragedy to continue
i dont need quickdb
Looks like an exorcism. 
It's for your own good, child.
so if you dont answer its all right
you can find another members to invite quick db using
We did answer, we gave you the right answer.
but im happy with json
It's not the answer you wanted, but it's the right answer.
you shall not stop me from doing ```ts
client.on('message', (m) => {
m.content.startsWith('ping') m.reply('pong');
client.on('message', (m) => {
m.content.startsWith('hi') m.reply('world');
})
})
The only reason we keep saying quick.db is because you've used it before. I would suggest enmap, otherwise. smh.
example
why people bother asking questions if they dont listen to the answer?
no no, hi must reply ping and ping must reply hi 
correct 
maxEvenetLIstener reached, memory leak detected
there was discord bot maker user and javascript/python another code language user
some people can choose discord bot maker
some people can choose node etc...
"hey expert, give me an answer"
"yes here's answer"
"no no I do'nt like this answer let me spend 30 minutes telling you why my stupid answer is the right one"
you cant talk about choice
Because they don't like the solution
Dunning Kruger at its best.
They'll find some answer later or until they get hit in the head sign with a stop sign
I would say they’re bored and it’s your job to entertain them.
you are comparing apples to airplanes, they are different things
This is not about choice. This is about using the right tool for the right job. If you're trying to use a phillips screwdriver to unscrew a square head screw, you would usually have a dad around scolding you and handing you the square head screwdriver because it's the right tool. You're not even using a screwdriver, you're using a hammer, because you don't have any idea what you're doing.
these image saying everyting
we are saying your setup is TERRIBLE, not bad, TERRIBLE
it's not a choice problem, it's a "correct tool" vs "not even a proper tool" problem.
i dont need waste time with you re all
im saying tooooooooooooooooooooooooooooooooooooo quickdb is uiiiiiiiiiiii and other godmode thingsssssssssssss
and im using to quickdbbbbbbb
but in current project im using json
oooookkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk so keeeeeeeeeeeeeeeeeeeep usinnnnnnnnnnnnnngggggggggg quickdbbbbbbbbb
Partially cloudy but very pleasant. lol.
Imagine one unescaped char 
understandable have a nice day
Well exorcism failed - mission failed
Well what did you expect from an inbread cat.

"you can lead the thirsty donkey to the water, but you cannot make it drink it" - well known brazilian saying
especially when the donkey is convinced the toxic radioactive mud pit on the way looks very appetising, eh?
looks? he already chugging it
Speaking about monkeys, you like to throw your shit around, too?
... oh actually donkey not monkey
correct, do you not see me spreading detritus around like some sort of jeovah witness?
lmao
I wonder you didn’t tell him to use Detritus
Wallet is full enough already hmm?
judging that detritus means trash, wouldnt be too far off to say, yeah, you are correct, i speak the words of shit
So detritus is a waste
lel
you legit think he had the brain cells to use ts? wouldnt even let him touch js
cough cough detritusjs best discord lib cough cough
Anyway that last discussion was very aggressive. You should've just let them fail and learn for themself
TS ewww you god damn Microsoft fanboy
Go on!
oops, sorry, my throat is sore
ACTUALLY
unironically
microsoft suprised me
and worse of all
its using edge
Learn more about WebView2
the carrot of bill gates is micro soft
Most of us here use windows 10 each day
my friend managed to compile his electron app that was 110mb down to 2mb with that
Honestly no, because if we do'nt stop them here at the first step, we have to deal with their problems for months
it uses rust for backend
rust is left in the dust
I'm saying by experience, btw. Do a search json from: Awsome#6366 and tell me we didn't have 6 entire months of pain from one person that took this long to finally use a real database. and then we finally convinced them to switch and they did.

That's how a lot of development goes. They stick with their poor solution until they learn for themself and learn to think differently
nobody can blame us later down the line for not trying either. He asked a question, we were trying to make him at LEAST understand why it was bad. He was just stubborningly flailing around screaming json better than quickdb.
I'd rather stop them dead in their tracks and put them on track for at least a decent place rather than let them wallow in the mud for months
cough detritus be like cough
he wasnt putting any effort to even understand, hence why i gave up and just asked evie hows the day
because once the system has been implemented with something shitty, changing it is even harder than preventing it from happening in the first place
we know this.
export ur data
import ur data
This is experience talking
loioooooooool
i consider myself a good dev, but every 2 weeks i come back and think " who wrote this shit code", just to realise it was me
I bet u say that every 2 days when looking at detritus
even experienced devs will look back and see the flaws and shit design of their own code
lol
i'll bite you and kiss your dog if you continue with that rude attitude, punk
the dog would bite me back, duh
yikes... cleaned up a few backups of projects from 10y ago and laughed about the amateur code I wrote
That’s how things are 
i legit look back just 2 or 3 weeks
But the funny story is it worked, too even if it was trash
perhaps even a month at best
dont get me wrong, i have a great capacity of making things work. Now, efficiency, thats a different story
u don't have to do the part with biting the dog

but that first part doe 😳
but i want to bite the dog tho
Programming is a learning curve where everyone's curves are different. Programming is not meant for everyone, but if you choose to proceed regardless, it's uncommon to run into people like that (in fact, I'd say most programmers are like this today). I personally believe, no matter how inexperienced the person is, failure and bad solutions is the fastest way to improve, as opposed to aggressively forcing a solution on someone.
Anyway, I have to go to school. See ya
your point of going to school completely breaks your own argument
time to roast him on his way to school
yes
why should you go outside putting your hand in fire?
lol
why do you need school to teach u?
lol thought the same
Imagine going to school... ewww
its better to learn from someone experience so you can jump straight into the "good dev" than being stuck in the mud for years until you finally pick up good habits on your own
you might flail at HOW to do it, but its always best to ask what approach you should take, at the very least
"If you do not heed the lessons of history you will be doomed to repeat them". I try to teach the lessons of history to people.
you have the path, you just missing the legs to walk it
IF they won't listen they can go fail on their own, I'm not going to help them
^^
It’s actually more fun driving a car into a fence than taking driving lessons by an expert

the issue is that, the more time i spend trying to tell them, the angrier i get that they dont listen and made me waste all my time when they arent even willing to listen even after asking
Because if your entire argument is that people should feel the pain before seeing the light, then I shouldn't help them at all since they can fail purely and entirely on their own without my assistance, and then, it's going to be more painful and they'll appreciate the right methods even more, right? RIGHT?
Right.
Don’t bother him he’s at school to learn something!
Yes, being taught the right methods to do things. Whoddathunkit
This generation might be our future.
Don’t ruin them hindsight
hey no I'm supposed to be the generation of our future
same generation that ate tidepods
or was that our parents
cant get worse
And that was our Ted Talk. Thank you for coming!
==> PING <== State is now: ERROR (13:48h 2021.05.18) State before: OK (was 15 days)
yikes and the node died
You can still help them (look no further than me). I feel a lot of people don't recognize that this channel is more or less for beginners (in fact, I'd say this server is for beginners). I still think people should experience failure and see the light from it and learn to adopt great standards early on, but I feel the way some members offer solutions is done poorly. It often stems from aggressively pressuring users to accept "suggestions" or diminishing their current solution for the wrong reasons. I'd like to explain more but typing on a phone is hard while walking.
It's harder for beginners to capture it
Hi, I wrote a backend with express and then I wrote auth with passport-discord. The auth works fine but I have no idea how to pass it to frontend, can you help?
@earnest phoenix
I especially expect from you :D

I presume that means you're doing a reactjs front-end?
Yes
You didn't say but it feels implied
I'm trying
mostly this is done from the express, and the sessions
pass it as a prop in getServerSideProps if you're using nextjs
Here's the magic: React doesn't need to "deal" with the authentication
react gets a cookie when you create the session in express
and it uses that cookie on every request
the back-end reads that cookie
That's your authentication
Oh,yes i think i forgot to tell😄
So it is enough for me to create a cookie?
Basically yes. Express will generate it when you create the authenticated session as part of the passport-discord process
But it is not necessary to change the code and change the query there, right?
Not from the react side, no
Because you're querying the same back-end endpoints, and the back-end checks the auth
So a final question is one of the ports 3000 and the other 3001 does that make any difference?
no that's just... ports.
So, now, let's say you want to have a "secure route" in the front-end, right? You want to not show, say, an "admin" link to normal users. Or just a "my profile" link for authenticated users.
What you need to have is an endpoint to get the current logged in user's "state". I usually have /me that returns the current username, avatar, and status, whether they're admin, etc. This is sent from Express, and if the user is authenticated you get a response, otherwise you get a 403
So now you know, from React, on page load, whether the user is authenticated or not ^_^
Oh okay ,Got it? I will review it, I will authorize the user in express, then I will check with cookies in react (SPA by the way)
You can't read cookies from react
you can't read cookies from javascript at all from within your page
that's the magic of it - you don't check auth directly from your app
API ?
you just query backend URLs which will return data if authenticated but return a 403 if you're not authenticated
So if you do GET /api/me and that returns, say, { username: 'SteoidVoid", isAdmin: true } then you know that you're authenticated, your username, and that you're admin
the what now
passport-discord deals with this already on its own
to prevent clickjacking and csrf
no but
the state parameter has to be appended by frontend
doesn't it
We're talking about FE<->BE authentication here with express, not oauth2 login
session management !== oauth login
k
Bro U Just need to before returning the page make a function and just send http requests for data to the server
use a renderer with template
like ejs
hhhfgngngngng
does anyone know a goodway to bold inside of a codeblock?
can't
they're using React
Are you talking about a markdown codeblock, or an html <code> block?
then he can use the vdom it is easy on react
how is that relevant to express authentication?
this bad boy
we just had an entire conversation on this where I gave them information, please.
can't do it inside you can only do it outside
you cannot format inside a codeblock.
but i did striking inside
in a container, I've make an image follow my cursor, with top and left values with js.
I was thinking if it is a good idea to use these, or I should use transform translate for the img to follow my cursor in that container
bcoz I hv read that translating an element is faster
What do you mean you did striking inside
i struck a specific line inside a code block
I can do but that's still formatting outside of ittest
no no
you can only affect the entire codeblock
i didn't saw that he uses react
in code i did it inside
Hi, I wrote a backend with express
that's why express
yes and they pinged someone named "react js developer" and then we had an entire conversation about reactjs
which you apparently didn't read at all 😛
But I want to spa
Any formatting inside a codeblock is going to be considered a bug and should not be relied upon
He did not mention it which is weird but you have right
No he didn't mention it, but again, we had a full conversation about this
smh people replying to 15-minute old questions without scrolling down
imagine not replying to a year old message
i think '\u0336' works cause its not true striking. Rather its a character that overlaps with the character in front of it
probably
cause theres still slight spaces when inserting
yes I can see that
what
OAuth2
+https://discord.com/developers/docs/topics/oauth2
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
hey I have a question
how to make a autorole but like:
when i have a invite.gg in my statut, the bot add a role?
This sounds like you're trying to get people to advertise a server and give them a reward for it. Don't do it, that's against the discord ToS
😮
Any feature where you give something in return for advertising is bad. Don't do it.
ok ok
hey evie, u know react well?
how does discord change the window href without the browser reloading the page
oh and just
yes
Through SPA. You can actually change the URL programmatically
how
do'nt think they give a shit you're using a special character like thousands of other people to pretend you're clever or something. lol.
there's a window API method for that?
xD and last question,
a bot can write on a website?
I would like to know how to change the url without redirecting like on this website http://dekho.com.pk/ads-in-lahore
when we click on tabs the url changes but the page dosent reload completely. Th...
and copy something of a website?
uhhh I mean, you can programatically read and write to websties using code, yes
"bots" don't do that
code does
oki
but how? xD
because the glitched edited message, its a website
oh
any programming language that can do queries on a URL can read websites
which is most of them
function () {
const dot = useRef(<Dot />)
const onClick = (ev) => {
// Error: Argument of type 'Element' is not assignable to parameter of type 'Node'.
ev.currentTarget.appendChild(dot.current)
}
}
this onClick event is applied to multiple buttons.
I want to append the same dot to these buttons, without instantiating a new dot
so the dot can be moved to each button one by one
So how do I achieve something like that
I have a feeling you're going about this entirely the wrong way
dot.current
Showing ping on mongoose is like this, isn't it?
await sunucuschema.findOne();
let DatabaseLatency = Date.now() - DatabaseTimeNow;```
don't programatically append shit using code, that's not how react works.
Change your data, and have it update from your render function
that's how you do it
add an id to every button,use state to store the button id and render the dot beside the correct button on rerender
Anybody know ?
It can be
store the position of the dot in the state
hmm, and then check the position with button position?
I'd have an array with all the buttons and their content, rendering each of them via map
Again, use actual data that you modify, and then render from that data
instead of mixing up rendering in your setup function
This is a no-no in react.
ok, lemme try
button position = button index in an array
and set the key to the button's content if it's not unique, if it is then use the index
This is for the chess game right?
is there a better way of making an xp bar than using the boxes emojis
hmmmm
yes
good one 
Its an add_field of an embed
The title of the field or the content?
content
Then you can use custom emojis
embed.add_field(name="Progress Bar [lvl]", value=boxes * ":blue_square:" + (20-boxes) * ":white_large_square:", inline=False)``` i wanna use something else cuz it bugs alot and it ends up creating more boxes if all the boxes are filled
it should work
can I add classes to element with ev.currentTarget.classList.add('dot') dynamically though?
Exactly
I was hoping to add/remove classes, and use dot::after in css
you can still use add / remove classes, but use state
unless my math is wrong? py boxes = int((xp/(200*((1/2) * lvl)))*20)
You can have a dynamic/conditional class in your render function
how does the mee6 xp bar work? is it a custom emoji too?
You mean the image they generate?
Mee6 probably does it completely custom for efficency.
But many bots use canvas
oh
there's a guide on discord/guide, they use canvas package for that
too bad they're using python
mee6 is python bot?
I'm sure there's a library equivalent to canvas for python
just gotta search for it
so mee6 is a js bot?
Pillow
Their old source code was python
Not sure if it's still the same
i see
559726241280688130
Watcher
8293
This bot watches over the bots in the top.gg server to make sure everything is following the rules uwu
discord.js
watcher
17
2
15 Servers
@coral trellis

@tulip loom
dam
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
watcher watch
fr
🇫🇷
One message removed from a suspended account.
k
Is there a way to message collectors continue after bot restarts? So that new ones don't need to be made
you're going to have to make new ones regardless
no, if you have collectors you'd need to start them again after reboot
alternatively, you should consider using regular events for this sort of functionality
stopping to think, imagine someone colorblind trying to identify flags
yooo we're from the same country!
you could also use the pretty-ms package which will return the hours/minutes etc themselves
var thenum = response.replace( /^\D+/g, '');
if(m.embeds[0].fields[0].value.includes('Time travels')){
userman = await guild.members.fetch(`${first}`)
console.log(thenum)
if(thenum = 1 || 0){
console.log(thenum)
message.channel.send(`**You have **${response} **. I am giving you the Super Miniboss 500+ role and tt0-tt1 role, If you want to remove any of the roles , react in [#839731098153517099](/guild/264445053596991498/channel/839731098153517099/)**`)
userman.roles.add(rolett1)
}else{
userman.roles.remove(rolett1)
}```hey why is thenum first logging 4 (the right number) and then 1?
Oh god lmfao
client.on("messageReactionAdd", async (reaction, user) => {
const Logchannel = client.channels.cache.get('843647036394176580')
Logchannel.send(`${user} sent ${reaction}`)
})``` why won't this work? there isn't any errors, nothing happens.
by default this will not listen to reactions on old messages (uncached messages sent before the bot started)
see https://discordjs.guide/popular-topics/reactions.html#listening-for-reactions-on-old-messages as a workaround for that.
Oh ok.
import discord
from discord import colour
from discord.ext import commands
import config
class status(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name=f"check-status", aliases=['cs', 'check-s'])
async def check_users_status(self, ctx):
if "support me" in str(ctx.author.activites):
print("Should work I hope")
else:
print(f"the activity is {ctx.author.activites}")
def setup(bot):
bot.add_cog(status(bot))``` trying to see uses activity but doesn't work. `prints None`
@client.event
async def on_message(message):
if message.author == client.user:
return
for happyWords in message.content:
randomDis = random.choice(disencouragements)
await message.channel.send(randomDis)
break
Why this not work? It's replying to every message I send not the ones I have in the list
because you did for happyWords in message.content: ie everything
Because you're telling it to send a message for each word in the content
oh
and then you break immediately so it does it once each message
you seem to be missing... some sort of condition? Or the understanding of what is a condition versus a loop.
also use snake_case in python
I think you missed an i in activities
that's more a style nitpick, but it's a good habit to follow style conventions
So what should i type?
it's a list
so check if a word in that list is in message.content
ye
you should be able to do that yourself
wdym?
sounds like that'll require some double loop. "for each word in happyWords, check if it matches one of the words in the content"
if(reaction.message.id == 844229915116830821){
reaction.remove()
}``` i only want the bot to remove the author's reaction. not everyones reaction. how can i do that?
OH!
Now says this lol
I changed it
import discord
from discord import colour
from discord.ext import commands
import config
class status(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name=f"check-status", aliases=['cs', 'check-s'])
async def check_users_status(self, ctx):
if "support me" in str(ctx.author.activities):
print("Should work I hope")
else:
print(f"the activity is {ctx.author.activities}")
def setup(bot):
bot.add_cog(status(bot))```
see
I think you need to actually have a status
have you tried stepping through the code and looking at what your local variables are
I'm guessing ctx.author.acitivities is.. some stucture. like a dict or soemthing.
I do.
it's not a string you can just throw in a message
wdym
you need to format this correctly
it's a tuple
print(f"the activity is {str(ctx.author.activities)}")
Maybe idk
I will try
hmm
nah it's needed
i don't think
honestly, never - function components can do anything class components can
but if you prefer the syntax, then go ahead
The time where you'd use class components is when you want to extend them
which is rare enough
hello, I am trying to use an API that is a web link and than the api output at the link. how do I incoroprate that into my D.py bot? in other words, how do i send to the channel the API output from the link? the api is here: http://161.35.137.131:3001/info
is that your ip?
that is zibiz pool's ip ig
ye.
pog
so how can I incororate the output from an api call to a discord.py bot?
fetch the data from the api endpoint then send the response body to the channel
ok
how?
idk py
ok
but ig you use the requests thing
ya
use requests or something to scrape it, get the json and send it
ok
import requests
Use aiohttp please
why scrape when you can use their api
since when did flaze know py
lol
right my bad
@deep mantle @earnest phoenix @pale vessel ty for ur help. ill google and try and figure out
- you need the presences intent
- activities returns multiple activities if there are multiple so you'll need to format with that in mind
- Done!
- I just really want to check if there message says a message, currently saying "support me".
but you're checking activities not message
I want it to check if it says in there status
activities != status
very different things
Could you help me code it then please because I am so lost.
just look in the documentation
https://discordpy.readthedocs.io/en/stable/api.html#member
guys can someone help me with my minecraft server command? I dont know whats wrong. I'd appreciate it. :)
read the attributes
I have
read the attributes
Describe your problem and your code please.
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)```
that would be how to change your own status
looks like a problem with that module then
Hmm
it's saying ping isn't a function, but you're not using ping
so it's in their code
¯_(ツ)_/¯
ik
to npmmc
there
same thing
Ah, right, ok
import discord
from discord import colour
from discord.ext import commands
import config
class status(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name=f"check-status", aliases=['cs', 'check-s'])
async def check_users_status(self, ctx):
game = discord.Game("support me")
if str(game) in str(ctx.author.activity):
print("Should work I hope")
else:
print("yikes")
def setup(bot):
bot.add_cog(status(bot))```
uhhhh this sounds like an rtfm moment, hold on
I see you're still checking activity not status
oh 1 sec
it in, indeed, not a function. Seems like you're missing the thing you want to do with npmmc
ther'es .status(), .query(), .scanLAN(), etc
https://www.npmjs.com/package/minecraft-server-util docs are real helpful
Ok ty
import discord
from discord import colour
from discord.ext import commands
import config
class status(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name=f"check-status", aliases=['cs', 'check-s'])
async def check_users_status(self, ctx):
game = discord.Game("support me")
if str(game) in str(ctx.author.status):
print("Should work I hope")
else:
print("yikes")
def setup(bot):
bot.add_cog(status(bot))```
What in heavens is discord.Game() ?
...
oh it's a special thing... I see.
can't just, like, check a string or something? smh
I just the bot to tell me Yes or No if this says "support me".
it's for ease of use with bots, b/c bots can only have specific activities
is that a question?
You just confuse me
you confuse me
@commands.command(name=f"check-status", aliases=['cs', 'check-s'])
async def check_users_status(self, ctx):
if "support me" in str(ctx.author.status):
print("Should work I hope")
else:
print(f"the activity is {ctx.author.status}")
They I change it to status and you say why you doing that smh
If you look at that code you're checking activities
i need a free vps for hosting discord bot if you know any pls tell me with ping
why does it sound like you're gearing yourself to checking whether someone has an invite status so you can give them a reward
check pins. there are no good free hosts.
Lol free hosts is something u will never get
Then how do I make it check what I want it to check
I literally sent the code
What do u want? lazy to read the messages above
will it work when i close the tab?
no, for it to work u need uptimerobot.com
actually, this is a tutorial https://www.freecodecamp.org/news/create-a-discord-bot-with-python/
Repl.it can work but it's very limited in power and you will most likely end up sharing the IP of someone that's api-banned and not be able to use your bot
There are no good free hosts.
i host 5 bots and they all work
Or u can check heroku
But it's pain in as* when something doesn't work
Just because it works doesn't mean it will always work, neither does it mean it will work for everyone.
i did but i cant see where to add files
What does it do?
Which files?
Everything but that
Heroku requires a credit card to be online 24/7, you can't save files on it, and it's pretty complicated.
There are no good free hosts.
code of bot
replit.com is a bit better
That's what I meant when I said it's pain in as*
I mean can u simply say the output you want
no really it isn't. your files are public too so your code isn't secure.
so what
Could ya help me code it because so many have made me confused now.
doesnt matter for me at least
Alr what are you trying to check?
they explained this pretty clearly if you bothered to read up in the history to know what they tried and what doesn't work.
This.
They want to know if someone has a specific custom status. it's pretty simple. they're using a python bot.
@umbral zealot there is an alternative
So u want to see the custom status of a user
buy a raspberry pi
Of course there's always alternatives. raspberry pi is fine. But it's not free.
Then cry when u don't have internet or power outage
i know someone who did this
smh
Pretty much
yes so do I, that's not the question or the point
dats rare
depends where you live
sounds like active.channelID was not a valid channel ID, thus get() returned null
but you can pretty much have infinity bots
How to get the Discord user custom status through discord.py?
I've seen the discord.py documentation. And the only thing I could find is Member.status
Which returns the status as: online / offline ...
Tried this?
Not at all, rPIs are very underpowered and cannot run a lot of code. You can get away with a few, but none very large, and certainly not music bots or bots manipulating images. It's limited, it's not free, it requires an always on power and internet connection, thus does not fit the definition of "free host"
ok
my too
and i deal with it
For someone like me who uses internet connection via phone and runs the bot on heroku, it's the common issue

Arguing a solution works great then agreeing the solution doesn't always work is such a karen move.
it works fine and it`s easy for me to deal with that
So it worked?
Ehh
here are times when my bot self restarted
You do a lot of this "for me" crap. You have to take other people's needs into considerations, not just yourself.
yes but how can I get it to do something if it says something
Guess what? It was the first result on google
Explain pls
funny enough did not know it was a thing tbh
I will make a Command on my server
I will make /Fessel
Bot:"Du fesselst jemanden" I will make that so
Can i get help?
Like if it says "support me" I want it to say in a channel they have "support me" in status else they don't have it.
When the bot says "support me"
U want the bot to send msg in some other channel as they have this status
sounds like a super basic command => response ? What are you struggling with exactly?
I have figured out the errors
Yep
Use
await channel.send(f"{status}")```
want to make a command where I write "/ Fessel" then the bot should tell me "You are tying someone up
I don't remember if get_channel is Coro or not
why is a custom status under CustomActivity, wack
no its not
to see a custom status, it's in CustomActivity
get_channel(ID) is correct
for python at least
@umbral zealot
yes I understood your request. I'm asking where you're stuck
Oh
What did you do, what did you try, what problem are you having?
Isn't it same as just creating one extra cmd?
We're basically talking about having a ping/pong command with different text
Oh oke
shouldn't be that hard, but it requires you to... y'know, at least have a bot that exists.
I don't know how I can do the command like that, that's the problem. I don't know how to do the command with the "/fesseln"
I think he's doing slash commands
is it though
Oh
could be just a prefix


