#development
1 messages · Page 1774 of 1
will take some more years
you can add buttons in d.js for now but idk bout responding
wha
do you still need the appliciations.commands scope if you don't want to use the slash commands guild based
detritwhat?

erwin go away
detritusjs
whats that
im not rebuilding my entire bot just for buttons
ofc you have a link ready
its worth tho
no
and i can show u why
my bot is thousands of lines long in hundreds of files. id rather not do that
thats even worse
not quite
wh
mostly because detritus has its own commandHandler
eew
so most of the stuff you painfully wrote, it has off the bat
nevermind then
#development message read past this if u at least curious
no
lol
what i like about my code is that its 96% indepentant. i use almost no modules. and those i use is just for the music part
im not gonna rewrite it all in something that only depends on basic modules
and im telling you it isnt like that
wh
well, either way, you dont know how detritus work, saying "something that depends on modules" while you havent even seen what the lib is even capable of is blatently bad
i want acces to edit everything on my bot 100% as i wish. if i use something that automatically works. then i cant edit everything
lol
like i said, i wouldnt recommend implying you know what detritus CAN and CANT do, since you havent tried it
nor showed any interest in it
you literally told me exactly what it was “it already has a command handler” means i cant make my own
You can
i never mentioned what it has, nor that you cant expand it
They have events
you are the one who assumed it
hes gonna keep doing it everytime he sees a d.js user
Too bad
you literally said it already has a command handler
Doesn't mean you can't use your own?
omg. this is stupid
Detritus still has events like any other lib
you're the one refusing to even see what the lib is capable of and calling it stupid

everything thus far has been you assuming things
you went from saying “really. again?” to backing detritus
It's not detritus's fault
if you truly want to keep this convo going(which i recommend u dont), go check the message i sent at least
Why wouldn't I back him up
tis a good lib after all
smh
i didnt call it stupid. i said i dont want to use it
we both have different views at which is the best, but we both agree its either first or second in the js libs

About that, then you should probably ignore Erwin
better than djs by a mile
He's gonna bug you with the same thing
and i never assume things. i talk directly out of what you said
when did i say what the command handler had or that it couldnt be expanded then?
erwin just shut up now he aint interested
djs can do everything i’ve wanted to this far. and more. why would i switch from something that does everything i want and need?
So what is detritus
yea. im just gonna stop. lol
and other future things added by discord
Im interested Erwin
a discord wrapper for js
I was kidding
Nice
A wheels-attached, pure-TypeScript library for the Discord API.
I might look into using it
detritus is a module? that makes no sense
What
check the link i sent misty, it has the pros and cons
though the cons are being worked up rn
Detritus looks like a discord api wrapper
I think those are all the links i can provide
- an idiots guide to detritus(WIP) https://evie.gitbook.io/trash-guide/usage/the-simplest-of-bots
- docs http://detritusjs.com/
- cake's good bot code https://github.com/cakedan/notsobot.ts/tree/master/
- erwin's basic bot https://github.com/erwin1234777/detritus-example
less bloated, faster, updates a lot quicker and has more functions and stuff built in off the gate
like slashCommandClient and CommandClient
To me it looks like you can make your own command handler if you want tho it seems he said there is one already provided
which are handlers
am I right?
correct
So there is a default command handler but you can make your own sick
scounting detritus' src, it has a more sane design approach
djs abstractions are pure garbage
Perfect for those who wanna get their hands dirty
you can always run the commands like you did with d.js, off the message_create event, but theres a handler built in a lot better than the shit they teach u at the d.js guides
I will look at it
Might even switch to it for this open source bot
Since I am trying to try new stuff with it
#development message
and #development message this for pros/cons
me million and a couple other people are getting a basic deploy-ready bot example for you to try out
does djs still not have that, in master if anything?
dont think so
It does I think
lmfao
the fact that they took 4 months to add slash commands shows how good they are lmao
Like a manager of sorts
i mean if it wasn't clear enough, discord wants bots to move off the gateway and work purely off interactions
but that isn't happening anytime soon
but they're implying it
Yea
I like slash commands
Makes it a lot easier to manage args
instead of checking for yourself
nah
buttons are a saviour
Why isn't this error handler working? It's supposed to be for my user-info command. Using an alias isn't the problem, but I'm not sure why it isn't working.
You can ensure that arguments will be there
slash commands are still heavily garbage, the only pro in my eyes is the native UI you get
buttons legit cut 40% of my requests, cuz you can send ALL buttons at once rather than having to loop reactions for embeds
but you don't get the flexibility you'd get with your usual command handler
they should provide more arg types
you do tho
the only issue thus far with slash commands has been handling it
but now that detritus added a slashCommandClient
check this
you can have your functions run directly off what options have been sent
rather than having to parse all that shit by yourself with switches on the options
let the lib parse which option/s were chosen
and just run it off that
whats that 3rd run is for?
that was the only annoying bit so far with slash commands imo, the handling of it
the 3rd doesnt run, thats just a group
since you cant call a group, that'll never run
but you get the idea im trying to explain
rather than listening to the INTERACTION_CREATE event, see which command was ran and which options, and then go from there
the fact that it has that handling makes it doable
the enum naming is ugly ew
Mmmm
i hate screaming case
Looks sick
huh?
yes
cool
One question
What is up with the 4 different clients or whatever
so, let me explain that
okay uh. dumb question. how can i change to master djs?
bruh
only 82. lmao
yarn add discordjs/discord.js or same with npm
npm i discordjs/discord.js
CommandClient is the command handler, it can wrap around a cluster or client.
ShardClient is your normal "discord.js" client, its a single normal client that connects to the gateway.
ClusterClient is a client with multiple shardClients (which are used for sharding, i'd recommend using this right away so you dont have to worry about sharding later down the line)
The commandClient can wrap either around a ShardClient or ClusterClient
discordjs(github org/user name)/discord.js(repo name)
it will install whatever is the main branch
@earnest phoenix ^^
which in this case is master
hm
i'd recommend using my example bot to start off
or same with npm
im very confused
if you don't supply an org/user name for github it will install straight from npm
mhm
orgName/repoName
i still dont understand how to choose stable or master :/
discordjs/discord.js is master branch
and
discord.js is stable branch
oh so i need to do npm i discordjs/discord.js to install master
@earnest phoenix seen the messages?
u hv to delete and switch to other package
I read that in doc somewhere
@opal plank I see so command client wraps around the "base" client
kinda
yes
theres not 1 BASE command
that'd be the shardClient
Mmm I am trying to figure out which to attatch prisma to
thats your "base" client per say
attach*
prisma?
Prisma is an orm for typescript
database?
yep
u using my repo?
but on djs docs it says on both master and stable. to do npm i discord.js
I haven't looked at your repo yet
use this to deploy ur bot in
detritus?
it has a lot of stuff already ready for you to use
but as it stands I have prisma attached to my AkairoClient
but on djs docs it says on both master and stable. to do npm i discord.js
@earnest phoenix https://github.com/erwin1234777/detritus-example/blob/master/src/types/detritusOverrides.d.ts#L4 here to declare them into the client
detritus is typescript?
https://github.com/erwin1234777/detritus-example/blob/master/src/modules/start.ts#L16 and here to add the actual prisma driver
Ah right
yeah, but u can use with js if u wish
don worry, last time I saw it was correct. Dunno y they changed tht
you can, but i'd recommend looking at the repo example so you have a base/framework to work from
the comments should guide you
at least to get you acquainted with the lib
Nah.. I want to use Typescript. I started writing a new bot from scratch using discord.ts but its not a super amazing library imo :v
so npm i discordjs/discord.js will install master
yes
maybe I can try this one
okay thx
discord.js is trash
here, if you curious about it, check this
@elfin vale read past this #development message
okie
So far looks like a nice lib
its a running joke here that i get paid to recruit people to detritus
(i dont)
👀
i only recommend the lib cuz i've used both discord.js and detritus
so i can really give input on how shit discord.js is compared to detritus
nah
its just a good lib
~~im not like berry who advertises his own lib
~~
right stinky @slim heart ?

Discord rose is also nice but
I don't really feel like banging my head against a table
kek
yes he did
what is tslib
the lib requirement for ts-node iirc
or typescript tsc
theres something that needs it
i forgot what
ts-node requires typescript as far as I know
AH
I've never had to install tslib
for helpers
No idea what that is
you need tslib to import helpers
i think its used for when you want to import .json files and shit like that directly iirc
which i do for configs since it pulls the types along with it
you can use whatever you want in all honesty, .env, yalm, json, just make sure to add it to the types in the lib
/types/detritusOverrides.d.ts
basically i'd recommend the following
use my repo if you are new to this whole thing, its a good basic boilerplate/example with comments to get you going https://github.com/erwin1234777/detritus-example
if you KNOW a lot of typescript already, and you know what you're doing, use dan's repo instead https://github.com/cakedan/notsobot.ts/tree/master/src
the reason i dont recommend his repo off the gate is that it has a LOT of advanced stuff, so it might be hard to catch whats going on off the gate
look at the second repo from cake then

if you confident in ur ts skills, it would be better to get your bot going off a GOOD example, rather than mine
can t u just use resolveJson or whatever tf it is
mine is a crude/good/basic example to get you going
i think that requires the helpers i use
and importHelpers
theres definitvely something there that uses it
if u clone and uninstall it, either ts-node or tsc will screech at you
nah, there was definitively a reason for it
even the DOM lib is there cuz tsc
and I have never installed tslib with ts-node and it worked
it only required typescript
the only thing that has tslib installed on my entire machine is @typescript-eslint
Mk I am looking at dans example but I don't understand why he is doing all of this for the command client.
I thought it already did half the shit he is doing
Actually nvm
I am looking at it a lot more now it seems he is doing custom checks for guilds.
for what?
CommandClient
I figured out what he was doing now
Still a bit confusing at first so ima just stick with looking at your example until I understand the lib more
lmao i did warn its a bit complicated to understand
Yea
I mean I can tell what hes doing
I just don't understand the lib enough to know fully what its doing lol
his is the only open source repo we had before, thats why i made a simple and well commented one, to give out some general directions
Ah I see
What does supplying shardCount do?
tells it how many shards to create?
i'd assume so
Same here
and not passing it will automatically count
so can rose ok anyways
correct
but also
why lol
yes but rose makes me wanna bang my head on a table (message approved by Erwin)
i never told them to say that
Just don't get the worker standpoint

how many servers is your bot in
Well 1 cause its in development
well then yeah i wouldnt really recommend my lib then kek
its made to super scale not be simple
ye
So I assume workers are like sharding or?
clusters
Ah
workers are spawned from the master and workers take care of x amount of shards
Ah sick
where are the slaves at
Morning
My bot is working fine but I've got a stupid issue with time
.setTimestamp(new Date(quake.time))
Any idea why the timestamp is at 12:11 ? 
store and send everything in UTC
discord will calculate the timestamp according to end user's timezone
Thanks
nice
Now I just gotta wake for another quake 
That's quite the way to test if a bot works oof

Ikr
but it's fine, I'm plugged directly into the seismographs lol so there's a lot of noise
if I set the threshold low enough, I could probably trigger an alert just sitting on my computer chair
xd
didn't work at all 
I don't get why
turned my date into a Date object
Mon Jun 07 2021 16:00:55 GMT+0900 (Japan Standard Time)
wait a second


Too early for me to code, I'll go grab a coffee
lol
Is there any way to host a bot in the cloud on a Chromebook?
I don't think the hardware you use matter since you want to host on the cloud..
This sounds more like a "how to upload my software to the cloud that was developed on a Chromebook" question
some just let you pull from github
i read it wrong
i meant how can i host a bot myself, without using an app/website to host it
on a chromebook
need to download python anyways
and hope you don't lose internet

how?
Same way you run a normal python file
again how?
also my chromebook can't run linux
How to install Python 3 properly on a Chromebook
you don't need linux
I've never used a chromebook, so can't really help there
just run the file and hope you don't lose internet or pc goes to sleep
No offense but it sounds like you're asking how to build a bot from scratch
which is a totally different question
wdym by run the file
What
You run the file...
I think he meant to ask how to build a bot
He made a sort of bot
@hot sage Sorry to say, but really need to review how to use Python if don't know how to run a file. We can't really help with stuff like this, it's the extreme basics xd
idk how to run a file on a chromebook. I know how to open a file but that does nothing
I wonder, how did you debug your bot?
I used repl.it, but I realized that it isn't good to use long term so i want to switch
You need to have python downloaded to run python files. Some IDEs install it for you
Chrome OS can't really download apps, so I can't download an IDE.
doesn't help, as i have said, i can't run linux, otherwise i would have probably not have had to ask anything
Can't really help much there then, Chrome OS is made to run web apps, so anything else is kinda challenging. Only option would probably just be hosting on site or something of the sort
Yeah true
Hey i made something like I store a name and when someone uses =p name it will ping users who have data as "name" But I wanted to make alt names for name ( not storing alt names).
Like someone stored "Astrex" As a name and I have a list in which "Astrex" has a alt name of "coder" So whenever I use =p astrex or =p coder it will ping the user with the data "astrex".
I'm not asking for the database support but I want how to make the list with the alt names.
I use djs btw
but I want how to make the list with the alt names.
If you're not asking for database modeling, what kind of modeling are you looking for? Object modeling?
let username = {
name: "Adam",
alternatives: ["Smith"]
};
If you were, for example, using a relational database, it would be having a table (e.g. names) with the user ID attached to the row.
I feel your question is too abstract.
Umm
umm no its nthng with the database.
Like ill make a file where ill specify alt names for some names.
for eg:-
astrex: ["topgg","coder"] (just an example)
and as i said i have a command where if i do -p astrex it will ping me.
but i want to make it like -p topgg also ping me
Let's say we had a names.json file structured as so:
[
{
"id": "1234567890",
"name": "astrex",
"alternatives": ["topgg", "coder"]
}
]
In your program, you could do this for example:
let names = require("./names.json"); // [{ name: String, alternatives: [String] }]
onPingCommand((message) => {
let user = names.find((name) => name.name === "..." || names.includes("..."));
if (user) {
// ...
}
})
I haven't tested this, but this would look in names.json for any name that matches (.name === ... or if an alternative name exists (names.includes(...))). user will be null if no name exists, but if one exists, you could use the id key to reference the user attached to the name (message.channel.send("<@...>"))
Is this useful? @rare granite
Which is best
fireBase or mongoDb
I cant help you with non sql databases 
how do i import a function from a file in a different folder in py?
postgres
Well I'm meab in fireBase or in MongoDb
you better not fucking advertise that like detritus
fuck off erwin
how import file pytoon
I only know piefon
maybe read the docs
learn the language
i wouldnt be asking if i hadent
xd
dude
learnt
quiet
Any answer
IVE READ THE DOCS
I doubt it
I think you can do from python from folder.filename import function, function2
am looking through https://github.com/DankMemer/imgen/blob/master/server.py to see how they import their utils
hope that helps @drifting wedge
What's your directory like
got it working
i just did a bit of gaming
and my brain worked
ty tho
gn @slender thistle
<style>
.entity-header__image {
border-radius: 50% !important;
border: 3px solid gold;
animation: float 5s ease-in-out infinite;
}
@keyframes float {
0% {
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(0px);
transform: translatey(0px);
}
50% {
box-shadow: 0 25px 15px 0px rgba(0, 0, 0, 0.2);
-webkit-transform: translatey(-30px);
transform: translatey(-30px);
}
100% {
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(0px);
transform: translatey(0px);
}
}
.entity-wrapper {
width: 100%;
height: 100vh;
overflow: scroll;
overflow-x: hidden;
background: url('https://media.discordapp.net/attachments/851104008349417532/851303355891712020/vaporwave-wallpaper-preview.jpg');
background-repeat: no-repeat;
background-size: cover;
scrollbar-width: none;
}
.entity-wrapper::-webkit-scrollbar {
display: none;
}
body{
scrollbar-width: none;
}
body::-webkit-scrollbar {
display: none;
}
#menu {
background: transparent;
}
.entity-content__description {
background: transparent !important;
border: none;
}
.entity-content__divider {
display: none;
}
.entity-hint {
display: none;
}
blockquote {
background: linear-gradient(90deg, #363636 30%, #fff0 100%) !important;
}
</style>
pls telll error in this code pls
anyone pls tell
Hello! 👋
I have a for loop for a leaderboard command and for the first one, I want to add a custom emoji, same applies to second one and third one, but the rest has no emojis, is that possible?
1st, 2nd, and 3rd will have a custom badge as assigned in code, is that possible with for loops?
@feral aspen what language?
discord.js
are the values in an array
I use MongoDB with the sort method.
const emojis = [':one:', ':two', ':three:'];
const formattedLeaderboardValues = leaderboard.map((val, index) => 2 > index ? `${emojis[index]} ${val}` : val)
something like that
you can use .map
My code: https://srcb.in/J2w0HyGGKu
I'll do that, one moment...
Worked on my testing bot, let me try it on my main bot.
@proper bolt , I did this. ```js
${2 > i ? ${emojis[i]} : ""}
3rd one didn't work...
change it to 3 > i
Ohh... as per my code, i = start, and i means 1
ah ok
👍
Eloooo
Why my bot takes so much time to login?
How much time?
tips about doing an antiraid system?
Whats Self-botting???
when bots are used on users not clients
how??
its against TOS and i dont know how to do it nor do i want to
ok ok
its simply using bots on discord users
all users have a token
when you login with your username and password, discord gives you your token and saves it into the discord app, until you logout
people basically just extract their user token from the app and put it on a bot, the same way they use a bot token
detect raid and ban everyone participating in the raid
Next person who gets a shooting star, please wish that we didn't have to deal with user doing dumb stuff and causing errors bcz my code almost doubled in size dealing with those things 
try {} catch(err){}
I am using it
But even then
I need a true or false answer, but I know someone somewhere will try to input something different
for a command
Same thing for so many other things
yeah and more for Economy commands
Mhm
main reason why i stopped doing public bot deving
oof
i used to have commands come up with its info when they're misused
and it says
-whois <id>
logically, you'd provide an id, yeah?
Oh god, I always check the length of inputs like that
Bcz I know someone will put something else
yeah well I've had people send literally "<id>"
-whois <760967718269747201>
lol
average end users sets the bar too low
Just expect a donkey to be the enduser
a donkey has more brain than this user
Another problem is trying to describe the user inputting a value
-whois <id>
-whois [id]
-whois (id)
no matter which, someone will add it in the wrong format
oof
He just memed
Simple fix make it a mention
They wont get it otherwise
Even then, in the description, if you write -whois @mention someone will write that literally
Brain big
Check if he writes exaclty this and let the bot reply with a Gordon Ramsey meme calling him a donkey
That would be a nice way to handle errors

3 to 4 minutes
I don't understand why it doesn't make me change the page more than once ,meaning I click on the "2" and it takes me to that page then I click on the "3" and ok but if I click on the "2" again it doesn't work
module.exports = {
name: "msearch",
description: "search for music",
execute: async(client, message, args)=> {
const q = args.join(" ")
ytsr(q, {limit: 1}).then(r => {
message.channel.send(r.name)
})
}
}```
Error : cannot send empty message
But when I log this
Its gives me name
Shouldn't it return an array?
Log r and see
If it's an array r.name would be undefined
yea, considering it has limit: 1
It probably logged this:
[{ name: /* .... */ }]
Note the square brackets
It's an array where the elements are object with name props
||did i really just use the word prop outside of react||
can someone explain sharding to me
i’ve never understood it
sharding creates multiple ws connections rather than a single one
it helps discord reduce their load because they can split it up
*helps you reduce the load
kinda but also no
gotcha
sharding its self doesn't
the fact that you are required to shard enables you to scale well
Does anyone have discord group for twitch self promotion
no and this is for development related stuff
i have got a question
so
i saw that are bots that instantly change their icon and name send a message and change icon and name back
wdym
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
cry means that
hmm
and how they do this? create a sht ton of webhooks? basically this is syncing the chat on a website with discord
ok
ok thx
cc @slim heart
Error: DiscordAPIError
Maximum number of webhooks reached (10)
just because its 99% of my errors doesnt mean anything million
mb
what
imagine having lib errors
yikes
personally I blame the fact that he voids basically every function call
I don't think it's the lib lol
in my implementation yeah? what
not in the lib in any meaningful way
no
thats different
hes like doin
void worker.api.messages.delete('272764566411149314', '851449525960572938')```
What
void
void just turns a response into undefined
Idk man I just
it does jack shit
million is just brain small
what
i dont care abt the errors because they shouldnt be happening
and then if they do then it logs
and if they don't it just continues
if i wanted to handle the error / stop i'd do await ... rather than void ...
Nice
which is what i do when i want errors to end execution

how i just .catch(() => {}) any better like
i dont do empty catches because i want to actually see errors?
because im a decent coder?
what
yea but if you're doing something like deleting a message, why void it if its gonna error if your bot gets perms removed
its not like you can do anything about that
because i already check for perms
ok well that was a bad example
if something else happens then it's an issue with my bot
which means i should just be continuing
and ill find the error then
I mean I don't think missing perms is an issue with your bot
if i check for the perms
and i still get permission errors
then its an issue with my code
then i want to see errors
There is a way to create data in the database when the bot joins the server?
All of this bcs I'm doing an option for disable categorys of commands if someone don't wants it inside his server and this is verified with a database
but i also dont want to affect what would be expected functionality
such as muting
if the role is too high and it errors then it'll still log it because its a confirmation that the bot is working
wouldn't it be better to handle that and send a mesasge in the logs saying that the role is too high?
i've like 5 years of bot ux experience i know what im doing million lmfao
5 years
i only uploaded to github after a while 4head
👀
im just waiting for the right moment to say detritus
Lol
No
Why are you like this
what shit
v1 shit
oh
There is a way to create data in the database when the bot joins the server?
All of this bcs I'm doing an option for disable categorys of commands if someone don't wants it inside his server and this is verified with a database
you know what I mean
ewww
@slim heart What was the first lib you used, I've been wondering
bro
i have like 2 years of experience. i started 2 years and 40 days ago
in java or js
Js
I have like 3-4 years of experience and I still suck ass
and Java too, sure
JDA / D4J ig
java was jda and js was djs
O
D4J wasn't that popular back then was it
No clue
not rlly
I mean it still isn't really
i dont think i ever heard of it
but it has its user base
kek
back when jda was user bot only kek
I've got a komplex question:
In my App component I'm managing state which all my child components require and passing it to them with a Context. However, one of my components manages it's own state that other components may need to function. So should I keep the state in the top of the hierarchy or do I just forceupdate the parent when I need?
Why not use a state management tool
So all components can have access to it when needed
and update them as they need it instead of passing it up or down
well
issue is i dont know what else to make :/
you should be using hooks and keep it in the parent tbh
Yea
If this is a react/vue question which I assume it is I prefer using a state management tool like Redux or Vuex
improper tbh
you should only be using state management for global variables like locales etc
the state managed by the child component is supposed to forceupdate other components when needed so
I just find it easier allowing all components to be able to have access to the state and update it when needed
your bot doesnt have an avatar thats why
My bot has avatar
Could be that you changed it
hey
for some reason, when i do this print((await bot.fetch_invite(client_invite)).max_uses)
im getting None
but .id gives me the right id
and stuff
then the invite doesn't have max uses set
https://github.com/Rapptz/discord.py/blob/master/discord/invite.py#L347 It's typed Optional, so it could be None. The docs prolly aren't updated
master branch didnt work
wdym
que
should i just set it in package.json to discord.js v13?
instead of 12.5
no
it aint gonna change the code
code? what code?
source code?
if i change it in package.json then run npm i shouldnt it work?
okay yea. it doesnt find it if i change the version manually
@lost heath #824411059443204127 message
i dont have access to that link
hello, I'm currently making a discord bot with 100+ commands. And I was wondering if any of you guys would be able to tell me how I could get more people using it across many popular, growing servers.
thats an advertising issue not a development issue
Hello!
How should i best implement the bot listening to reactions for a message/voting that people can vote on?
I know how i can listen to the reactions on a specific message and also how to listen to all reactions.
This votings should be able to last very long (day, weeks) My problem is, that i want
- the listeners be still active when the bot restarts
- being able to show the voting on different channels/guilds and still count all the votes from all channels and also edit the embed on all channels accordingly.
discord.js@dev
okay thx
the description for the channel says ask questions

about development not advertising
if you want advertising, put it on the website and have friends and users upvote it
mk, thanks
noone know an answer?
what lib?
discord.js
okay hey. now it complains about CLIENT_MISSING_INTENTS
best method is to make a dedicate reaction button handler, but that'd be a lot of work and explanation on how it works
djs has reaction collector iirc, use that
okay ill read thru. thx
that guide is outdated though, but u'll get the idea
👍 thx
I'm using Chakra ui's switch component in a form with the name prop to required but when i log the key from the FormData object it always shows an empty string
how do you detect if it's selected?
weird it's logging null when unselected
at least i can check for null tho
oh kk
thnx
ñ
how can i (or is it possible to) make my bot go to a website and take a picture of it then display it on discord?
It is possible, but depends on what programming language your bot is made in
Selenium is a comprehensive testing framework for web applications which allows us to take screenshots of web pages programmatically amongst many other things. It makes use of web browsers, such as FireFox, to open the web page and then takes the screenshot. This how-to shows how to leverage Selenium to capture screenshots programmatically.
thanks
How to read a : within a json key with nodejs
{
"_declaration": {
"_attributes": {
"version": "1.0",
"encoding": "UTF-8",
"standalone": "yes"
}
},
"co:items": {
"_attributes": {
"xmlns:ea": "http://platinum.topicus.nl/v0.1",
"xmlns:co": "http://cobra.topicus.nl/v0.1"
},
"rLeerling": {
"co:link": {
"_attributes": {
"id": "xxxxxxxxxxx",
"rel": "self",
"type": "leerling.RLeerling",
"href": "https://api.somtoday.nl/rest/v1/leerlingen/xxxxxxxxx"
}
}
}
}
}
I want the rLeerling id
So i thought
school.co:items.rLeerling.co:link._attributes.id
But that didnt work
How to read that id
<Object>['co:items']
that gives udnefined
You must use the [] object property accessor to access properties with unsupported characters in the property name
Ok i will try
Are you sure? It shouldn't if you used it like school['co:items'] as you showed in your example
school['co:items'].rLeerling['co:link']._attributes.id
return message.channel.send("Test", {
embed:colors,
components: [n, a]
})```
How come the buttons don't get added
i want it to get added on the embed
but it doesnt work
Cannot read property 'rLeerling' of undefined

Because you're using a version of discord.js where it filters out those properties since it doesn't support them yet
You have to do a raw API request
With <Client>.api
i mean this is the error
(node:1569) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined```
from components: [n, a]
buttons: [n, a] just dont work. if its in a non-embed form, it works
I'm pretty sure that's not where the error is coming from, may you show us the stacktrace of the error?
(node:1664) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
at /home/runner/HanaleiNew-Final-1/node_modules/discord-buttons/src/v12/Classes/APIMessage.js:120:50
at Array.map (<anonymous>)
at APIMessage.resolveData (/home/runner/HanaleiNew-Final-1/node_modules/discord-buttons/src/v12/Classes/APIMessage.js:117:60)
at TextChannel.send (/home/runner/HanaleiNew-Final-1/node_modules/discord-buttons/src/v12/Classes/TextChannel.js:18:68)
at Object.run (/home/runner/HanaleiNew-Final-1/commands/colore.js:35:26)
at Client.<anonymous> (/home/runner/HanaleiNew-Final-1/index.js:255:18)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1664) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1664) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
Have you tried logging school itself?
only happens when i use components:
when i use buttons: it sends the embed but not the actual buttons
You're using discord-buttons npm package?
yep
console.log(school)
{
"_declaration": {
"_attributes": {
"version": "1.0",
"encoding": "UTF-8",
"standalone": "yes"
}
},
"co:items": {
"_attributes": {
"xmlns:ea": "http://platinum.topicus.nl/v0.1",
"xmlns:co": "http://cobra.topicus.nl/v0.1"
},
"rLeerling": {
"co:link": {
"_attributes": {
"id": "xxxxxxxxxx",
"rel": "self",
"type": "leerling.RLeerling",
"href": "https://api.somtoday.nl/rest/v1/leerlingen/xxxxxxx"
}
},
"co:permission": {
"_attributes": {
"full": "leerling.RLeerlingPrimer:READ:INSTANCE(xxxxxxxx)",
"type": "leerling.RLeerlingPrimer",
"operations": "READ",
"instances": "INSTANCE(xxxxxxxxx)"
}
},
"co:additionalObjects": {},
"UUID": {
"_text": "xxxxx"
},
"leerlingnummer": {
"_text": "xxxx"
},
"roepnaam": {
"_text": "xxx"
},
"voorvoegsel": {
"_text": "xx"
},
"achternaam": {
"_text": "xx"
},
"email": {
"_text": "xxxx"
},
"mobielNummer": {
"_text": "xxxxxx"
},
"geboortedatum": {
"_text": "xxxxxxx"
},
"geslacht": {
"_text": "xxxxxx"
}
}
}
}
That has issues, which is why that happens; I recommend using raw API requests instead
console.log(school['co:items']) //undefined
thats also undefined
ic
That's weird
What Node.js version are you using?
Then that should work, no idea how it doesn't; can you try logging school.constructor.name?
The what, that's kinda unusual
maybe it displays it as text but it looks like json
Try logging typeof school
Then parse it
school = JSON.parse(school)
ok
{
declaration: {
attributes: { version: '1.0', encoding: 'UTF-8', standalone: 'yes' }
},
elements: [
{
type: 'element',
name: 'co:items',
attributes: [Object],
elements: [Array]
}
]
}
how to retrieve the elements.elements
i just dont get that array
school.elements.elements
doesnt work. it gives undefined
or filter() or find() if you looking for something specific inside
school.elements.elements[0] = undefined
That will error
I got it thx
Can I create my own A.I chatbot
sure, go ahead
not that im aware, no
probably gonna have to use some ai out there to help you
whats that one famous one?

i think it was from google
ALL AI IS SAME
Sorry I got up to get coffee lol
Oki thnx
🐛 found a bug in opera 76.0.4017.94 on ubuntu
you cant visually see the text you type in window.prompt
it does get typed tho
i found a bug in discord.
the whole platform is borked. period.
it does have dark mode
facebook in 2021? 
Found a bug in tikTok. it exists
i made a facebook for the first time recently... for oculus quest
TikTok is fine
I wonder why mark even bought oculus
any idea how to make a new port?
to make that if someone vote for your bot, that it will send a message
you need a port right?
well, unless you are hosting somewhere without ports available. yes.
with app.listen()
just choose any free port
ports are rarely restricted, excluding like replit and stuff.
Make sure the port is above 1024 tho
4000 or 3000 is a good port that's rarely used by other stuff
When I try to fetch a 1000 members server, my bot responds after 10-15 seconds. How can i solve this i am using d.js v12
the issue is probably that its just a huge amount of data
yeah, 1000 members is no joke
😔
not that you're supposed to be fetching very frequently tho
you're supposed to use cache
Okay i will try
whatever u want
the one thats not ur token (and which u can put anything u want, like he said)
did you fill in the url and auth properly?
i think
where are you hosting?
home/repl/heroku/vps
how can i make sure?
in the const webhook = new Topgg.Webhook()
i need to put the webhook url in there?
no
or the auth?
you dont send anything with the webhook, you are making a webhook receiver.
no
then how exactly
both me and cry









