#development
1 messages Ā· Page 1992 of 1
the way me pull this is use xml request, then fetch and create the blob in server on the fly, then send the result data url via sendFile
fetch the video via xml then use a <video>
can u send an example?
const xml = new XMLHttpRequest();
xml.mimeType = 'buffer' // blob
xml.onload = (data => {
// do when data fully loaded
const urlres = URL.createResourceURL(data)
send(urlres)
})
xml.onprogress = (evt => {
// or streaming
})
xml.open(url)
didn't touch much on this part
you can use a promise to make it look cleaner
me dumb
lmao
after creating resource url, point the video src to it
and technically it's on your server now
how would i make express accept headers?!?!1
oh you're being serious
not sure what you mean exactly tho
you should be able to set everything fine
setting headers in the api code works, just not when using axios and stuff
could be CORS related?!?!1
hey, can anyone help me? i want to make my bot leave a server (i have the id) using eval command
cors is a bitch
bot.guilds.cache.get("ID").leave() I guess
or something like that
check dem docs
yw
is CORS the problem?!?!1
try printing the returned request
if it misses a shitton of info it's definitely cors
iirc cors only allows HEAD headers
yeah it is
What are the appropriate permissions to check when it comes to a moderator wanting to warn a user and mute a user? Unfortunately, no permissions called warn and mute on Discord. š
i'd say to warn, have manage messages
and to mute, MODERATE_MEMBERS
example?
I don't think it's related to cors tho
that only instructs browsers whether to block requests or not
sending a GET request to set headers on the api doesn't work
so uh, im using discord api to create a dm
for some reason im getting unknown user
const url2 = `https://discord.com/api/v9/users/266457718942990337/channels`; // dm channel with me
this is the url im using
yeah, im jsut sending the body as { content: "" }
i have the bot token but i dont wanna use djs to login and send dm
i wanna use the api
it says i can send dms, but idk why it throws a unknow user error, my account is like literally here
i'm afraid I can't help u with that, your best bet would be tim
thats the incorrect url. Check the docs for creating a DM. should be POST /users/@me and have some special body. The returned body is a DM Channel. Then you'd access it just like any channel with /channels/:channel_id
gotcha, will try that
stuff like msg.author.send checks if the DM channel exists or not and then creates one if necessary and then sends the message. Try not to request create DM too often
use cache
Am I doing something wrong?
My website works fine online but locally it looks like this?
your css import paths are probably in the full format
yes
What do you mean?
Dont use absolute paths for imports
I'm new to HTML, I'm afraid I yet don't understand. Do you have a code demonstration?
do you know what an absolute path is
Oh, indeed.
absolute: C:\Users\You\Projects\imgs\bread.png
relative: ./imgs/bread.png
Oh, well I don't.
considering index is inside Projects
might want to open the network tab and check for errors
Is there anything I should consider thinking before I change the nickname of 400 members in a server using a bot?
Is it API abuse or against any sort of rule or something?
If youāre gonna do it, set a delay in between each nickname
Wouldn't like 1-1.5s delay work too
in d.js how to get the playbackDuration
from @voice.js
better to stay safe and 2x-5x the interval
True
Hi anyone use heroku here ? i try to create vote log for my bot using #topgg-api and this is the error when someone vote:
js
djs
is the port open?
how can i check it ?
actually, nvm you can only have 1 port
check which one they assigned to you
use that one
https://devcenter.heroku.com/articles/troubleshooting-node-deploys#incorrect-port-setup in heroku website they say to use 3000
do i need web dyno ?
well what should i write in my env for PORT ?
just write that
ok
heroku is the one who gives u the port from what I understood
And you need to use the web dyno
when i use it i get this err in my log
Although it will be turn off if not used for several hour
Check your procfile
Edit the web to node index.js
ok
Or write it on package.json
?
On the start script
I guess
lets try...
is this how you send two buttons? it's not working await interaction.reply({ embeds: [suggestion] , ephemeral: false , components: [row, rick] });
are u supposed to run it with 2 dynos?
no you are send 2 row not 2 btns
?
Ooh right just use one
in each row you can have 1 menu or 5 buttons and ig you can have 5 row
ye, a 5x5 grid
so turn worker off ?
Yes
you can't have 2 dynos running simultaneously 24/7 without paying
if you want to host a webserver on your discord bot process you need to turn it into a web dyno
but that means your bot will start sleeping
web dynos sleep, workers don't
so what should i do š
You'll need to ping it on interval to prevent it from sleeping
the correct way is of course to have 2 independent dynos but yeah money
so how would i add a secound one to this? ```
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('primary')
.setLabel('This does nothing ok?')
.setStyle('DANGER')
.setDisabled(true),
);
await interaction.reply({ embeds: [suggestion] , ephemeral: false , components: [row]});```
wait i write web with capital W and now i have 2 web
Even on free tier you get only 500 hour so its not fully a month
add second btn to your row like first one
around 20 days if 24/7
i know about that
but are you sure that i cant have 2 dyno in same time ?
cause i turn both on and there isnt any problem
I dunno never tried
š¤
so another .addComponents( new MessageButton() .setCustomId('primary') .setLabel('This does nothing ok?') .setStyle('DANGER') .setDisabled(true), );
1 dyno runs 24/7 on free tier for the entire month. 2 dynos run 24/7 for half the month
no problem !
it'll work for now but it'll just die halfway through the month
which you probably don't want
i can create more than 1 heroku acc š
Oof
create 2 MessageButton and then add them in 1 Row its more clear and better
or just use railway
if its not using big amount of resources then its not a problem to use railway
i rather to have both in same host
so not this ```
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('primary')
.setLabel('This does nothing ok?')
.setStyle('DANGER')
.setDisabled(true),
new MessageButton()
.setCustomId('primary')
.setLabel('This does tho')
.setStyle('DANGER')
)
you do you, just remember you're capped at ~15 days with 2 dynos AND credit card
no this is fine but you can have it very clear
ok tnx for your help well lets first try it
you cant have 2 btn with same id
yes
also this is the better way to define btns out of the row
const btn1 = new Discord.MessageButton().setStyle('LINK').setLabel(`btn1`).setURL(`URL`)
const btn2 = new Discord.MessageButton().setStyle('LINK').setLabel('btn2').setURL(`URL`)
const row = new Discord.MessageActionRow().addComponents([btn1, btn2]);
ok thx
so now it should work
maybe
also remember your bot will be ran twice if u run the same process on both
what is that router?
thank you
guess what -.- its run twice...
yes
you need to split the code into api and bot
so huffffffff
how to do it exactly ?
easiest way would be using cmdline arguments
what if i turn worker off ?
then checkin what argument was passed
it'll shutdown the perma process
meaning your bot will die every 10 minutes or so
unless pinged constantly
oh...
any doc ? cause i didnt understand š¬
command line arguments is like the very first thing you're supposed to learn
followed by CLI programs
but anyway
then use if clauses to lock unwanted sections
for example, if u pass -api it locks the bot part
(that's an example)
^-- example --^
ok tnx
how do yall even begin a new programming language nowadays?
damn I kinda feel old now
how old are u ?
we used to always start from the bare basics then going up after learning the previous step
22
sorry I only know coding
and when you start coding ?
depends
if we consider any script as coding, around 9
gmod e2 was my first coding experience
if we consider only making actual programs as coding, then 17
on university, 2nd semester
I think nodejs doesnāt prioritize console applications as much as other languages do, since itās so easy to get an application up and running quickly
cool i start programming like 6 month and my bot is my first project so i need to learn many things š
Why are users so inaccurate in my bot
Because youāre probably getting from cache or something
that's still a great way to learn basics regardless of language
I agree
calculator, snake, "what is my name"
Ah wait member intent
and the infamous "hello world"
if you dont have the presences intent, discord only gives you your bot and users in voice channels
everything else you have to fetch
or wait until activity comes in
I think that console apps are a good way to learn any language
guilds=len(ctx.bot.guilds), channels=sum(1 for _ in ctx.bot.get_all_channels()), users=sum(1 for _ in ctx.bot.get_all_members()), this is what im using n its inaccurate
But people starting with nodejs are usually impatient and donāt care about command line stuff
if you jump right to guis you lose so much focus by having to deal with both sides of the coin at the same time
exactly
Huh??
"but that's too simple, I want to make big badass hackerz programs"
boi, shut and make the damn calculator
@lyric mountain Btw if i use railway do i need to do commandline again ?
the idea of command line args is that you can differentiate runtimes
like, what each one is supposed to run
this is one of the many ways to deal with that issue
Btw whats the average ram usage if the bot is in just 1 guild
depends
Is 38mb fair ?
Its pretty basic with few commands
~30mb is pretty much the bare minimum of the average python program
Fair enough
So then it cant be 1kb..?
for a python program no
python is an interpreter, a simple "hello world" program that does nothing but print "hello world" it will already use about 30mb
or whatever it needs to load the entire python engine
Ahh i see what if you print hello world in go n compile it how much ram that gonna take š¤?
Golang*^^^
Oh I didnāt see go
But i thought once its compiled engine got no job like its already machine code
if you compile it in rust/c/c++ for example, it will be compiled to machine code, the executable size and memory usage will be stupid small
Iirc golang compiles to bytecode does it not?
wasnt golang also interpreted?
Idk
Lemme look it up
Itās compiled
Seems like it compiles direct to machine code too
Yuh it does
write in assembly and you might be able to stay below 50b
or write in shakespeare, who cares about ram anyway
hmm but golang does include a bunch of stuff like memory safety and garbage collection, so the compiled executable has to include those
Wait kinda dumb question is assembly above binary or binary above assembly
assembly is essentially machine code
just "human readable"
Assembly is pretty much direct hardware instructions
So assembly is binary but readableā¦
You canāt really code in binary
nono, machine code
Binary is the fundamental building blocks of bytes, but bytes are the smallest addressable form of memory in a computer
Thatās why booleans take up a full byte and not just one bit
actually, shouldn't booleans be represented by a single bit?
they are always 1 or 0
@lyric mountain better idea i just can create something as topgg.js and then require it in my index.js and then use it for my web dyno so node topgg.js for web and node index.js for my worker so i dont need cmd line any more ig
so you're like stuck with 0000 0000 and 0000 0001?
so one could say bitflags are more efficient than booleans?
thats why they exist
^
interesting
Otherwise you would be wasting memory technically
in js a boolean takes at least 8 bytes lol
that's more trouble than writing a single line
Itās not a huge deal on a small scale but Iām sure thereās settings where it destroys memory usage
wtf
what they do with all the other bytes?
it's like a bigbool
v8 object specs
Wait yo i got another question
to be honest i didnt understand cmdline from that stackoverflow
gotta make a new node lib that introduces bool_32 and bool_64 now
Lol
What if an app doesnt use network and the disk space gonna be more than the ram usage ?
Youād probably have to modify the js standard itself
...?
how?
it's like, 2 words
an array
process.argv[0] is first arg
So like if a code is like 50mb n doesnt get no data from internet you think it might use ram more than 50 mb
process.argv[1] is second arg
and waht is the first arg ? web or worker ?
actually

I still donāt understand, the RAM usage does not depend on the program size
js doesnt use 8 bytes for booleans
it uses a special map of booleans
called an "oddball"
š„²
even worse
I can make a 100 byte size program that uses terabytes of ram, it all depends on what the program is actually doing
But like isnt ram usage equivalent to the program size if it doesnt use internet or ā¦
idk how to guide you from there, I'll leave for tim or waffle
internet is pretty much irrelevant
But its gets data from internet thoā¦
RAM is memory allocated for the storage of data in a program. For example, a number in js uses 8 bytes of memory, and therefore 8 bytes of ram (in theory), but a program like let data = 5; uses more than 8 bytes of disk storage
So it does matter then why would number of guilds matter to botā¦
but if u don't do anything with it it'll not matter
While in theory the program itself only has 8 bytes of memory usage (not counting internals)
Because the bot caches data about the guilds in RAM
because depending on the lib you'll be caching them
it has to allocate memory for the storage of that data about guilds
More guilds = more allocation
a program can easily create and destroy data, so its not really possible to correlate memory usage and code size
and more guilds = relatively more events = relatively more threads/async handlers
Hmm cool i see
I lost 100 bucks today maybe 200 š
Shorting hood didnt go as plan
Whats sberbank
I made like 70-80 bucks today on amd and nvidia lmao
russian bank that dropped 95% in value the past few days
shares went from 15 bucks to 2 cents
I woke up late n didnt get to trade the early market hype n got stuck in a bad trade
Itās not a good time to be invested in Russian companies haha
gotta invest in russian coin, then withdraw once putin finishes fckin everything (and someone replaces him)
prices are going to the ground
Economic panic will likely hit Russia when the banks open back up
And no, I just own some shares of stuff
Oof i day trade take risks everyday lol
trade crypto
Nah theres no options in crypto
I donāt have enough money to day trade and Iām not willing to risk it over some small chance of making 20 bucks a day
No options no fun
Options are like betting this stock will hit a certain price in a week n if it does you earn money
Like you dont have to wait till end of week tho n even if the stock makes small moves you still earn alot
Stocks are too risky for me, I just put some money into a couple stocks that I know will continue to go up over a while
Like you invest 200 dollars you can make 20-30 dollars for 5m of trade
@lyric mountain tnx alot i fix it <3
š
Bought a decent amount of AMD back when it was 27 bucks per share
Made a 300-400% return on that so far
You been holding 1 share for that long time period?
also a question š how can i define client in server.js
Iāve been holding on to like 10 shares of amd for a while
Itās not much but hey free money
Does amd offer dividends ?
no, you need to make a communication bridge between you 2 processes
Donāt think so
Should go for a dividend stock apple offers em n Pepsi n so on
you need to either put that code insde the same file where your client is, or pass it by require or something
I donāt really want to invest in stocks like that for dividends
I donāt have enough to invest to make any sort of money with that
require what ? š¤Ø
Its lowkey cool i lost money in stocks too i earn 50 bucks n lose 100 lmfaoo
for example ```js
// file where client exists
const server = require("./server.js");
server.start(client);
// server.js
function start(client) {
express, webhook, etc
use client here
}
module.exports = { start }
oh ok tnx
separate processes
he's running 2 dynos
one for api and one for bot
so this should works ?
you're using 2 dynos in heroku?
you dont need to use 2, just use one web dyno and have your bot in it
yes
otherwise you'll need to do what kuuhaku said, some way of communicating between processes
KuuHaKu ā Today at 11:06 PM
it'll shutdown the perma process
meaning your bot will die every 10 minutes or so
unless pinged constantly
so ig i need to go to railway rn
is there a way to increase the timeout limit on file uploads?
cuz my internet is bad and files take so long to upload that it just aborts the request
to discord?
yee
I dont think so
bruh
I imagine thats configured site wide
but it says user aborted request doesnt that mean it was aborted at my end?
i seem to remember there is a timout paramiter in the client object but idk if thats for somthing like this or somthing else
bruh i keep forgetting my E's in something
@lyric mountain i think i understand that what should i to with command line
well what should i do with that? i read the stack over flow and process.argv[1] will return /app/index.js so what should i do with that ?
if i do something like the image well again it run twice cause web and worker both has same file name
start from 2
0 and 1 are node and the file respectively
https://discord.js.org/#/docs/voice/stable/class/AudioResource?scrollTo=playbackDuration
Can some one tell me how to use .playbackDuration to get the time the bot has been playing
oh there is a 2 let me console log it
there isnt any process.argv[2]
did you pass an argument at all?
wdym ?
i just console.log the process.argv
...
do you know what a command line argument is?
no i just read the stack overflow link that you gave me
node index.js abc def
what is an arg there?
oh i know i know... pick me š
abc

everything after 'node' is an argument
yes but we are talking about arg[2]
oh tnx š now i know what should i do (i think so)
so now web become my [2] now i can check it am i right ?
believe it or not, node is also an argument
it's the arg in index 0
I guess so
yea i guess thats a fair point š
im sure there is also a difference between umm, idk how to explain..
like, the position of the arguments?
node -nodearg index.js -filearg```
Welcome to coding for dummies, where you will learn that a debugger is useless and console logging is perfect
š¤Ø
yes
Go back to doing homework
debuggering is weird
Because Iām not home yet weirdo
sounds like a personal problem
i love the way that some one tryes to help and then they just get treated like shit
Thatās why we all here tbh
wait till someone asks a question š
Not usually right off the bat though, thereās a grace period between being called dumb and being helped
php is kinda trash tho fr fr
php has its uses
but no one goes out of their way to use it
bruh pretty sure thats most places tbh
thats the point but eh
Misty says whilst being butthurt about me making a compiler instead of a discord bot :troll:
Well well well, what do we have here
I am only butthurt cause you lied about compiling me some bitches with your subpar skills
Also it was cause you weren't helping me with the backend not a discord bot
Pay me money and Iāll compile some bitches for you
stupid smelly
Just cause you need to pay them hospital bills doesn't mean I have money foru
I am broke as well mf
Why you think I am trying to sharpen my skills in the first place, you think im doing it for fun?
bruh i found that way more funny than i should
Yes thatās why I do it
I mean
I do it for fun i agree
but sometimes I dont have fun
and then I get annoyed
Money is the benefit of being good at something and putting time and effort into it
Indeed
They be trying to compile bitches for others when they can't for themselves
š
Waffle supposedly has a girlfriend
but I think its fake
Definitely fake yup
^^^
oh my
@boreal iron can you confirm
@boreal iron u dating waffle?
send pics or it didnt happen
šæ
Heās probably driving
vroom vroom
Huh what? Donāt know the context?!
boom
Yes no maybe
So it is confirmed
Maybe not
ur dating wafle
Idk
read this and one message above
Fake dating a Java user confirmed
fake loves java
yall are syntax racists!
W H A T is going on you crazy bitches?!
Im not crazy your crazy
Me loving Java wtf
smh
Ok Iām calling my friend Putin now
too soon
Gotta need to free another countrY
Way too soon
This channel became #real-life-character-development fr fr ong no-cap
lol

voltrex go back to working on the v8
banned from this channel
v9when
v10?
everyone skips 9 and goes straight for 10
The unspoken rule
mmmm
Shut up
Or what
The V8 engine is a representation of the real life V8 engine, a V9 engine AKA 9 cylinder engine can't exist (doesn't make sense to exist)
go back to not being home and expecting me to vc with you in an hour
It could exist
You just gotta try hard enough
Anything is possible
it just a matter of if you are smart enough to accomplish it
I'll turn you into the V18 engine
I dare you
I will come to your house and eat all ur noodles
Take that biatch
Very heave as those are airplane engines
This channel should be renamed fro mdevelopment to general-3
@earnest phoenix Did you know when you touch something you aren't actually touching it
mind = blown
Such as you touching grass?
The reason you feel as if you are touching it is cause of the pressure from the atoms repelling themselves (iirc)
Average dev when asked about the last time they went outside
Now that I have stated my fun fact
time to go lay down and ignore waffle
ā ļø
Driving probably counts as being outside 
Did you actually see the funny Ford meme?
Thatās a real engine?
Of course it is 
Like used in a production car?
š¤¦āāļø
Not in cars
That's an airplane turbine engine
Planes n stuff
Ohh lol i didnt read the thing msg i just looked at it n there was this picture of Pistons n thought itās a car engine
This pic
Yes being used in Ferraris only 
Only found in FakE's 24/7 running car

This channel turned from bot development to engine development thats sum real innovation going on here
This channel isnāt about bot development at all
It's for development, but not limited to Discord bots
and unnecessary shit
Is it possible to host a discord bot on roblox studio š
I noticed it allows to make http requests on it
I'm pretty sure it is
You better get job and rent a server
Nah i use replit
But a wise man should cut costs on stupid things to make the business running
Plus roblox studio comes with free database
Wise people host their shit themselves and donāt rely on free services
Also the wise man has enough cash to pay his shit
wise people dont host
Replit aint free if you pay for it
You may not belong to this selected group of people 
Can't wait for Charlie on YouTube to talk about Jass being sued for millions of dollars by Roblox for hosting a Discord bot in Roblox Studio
Roblox kills servers with no players in it so imma need a uptime bot like thing that stays in a server
is this a science experiment
Small cost you have to pay to be on the news
Wait can you mine crypto on roblox studio
Has science gone too far?
No you dont rely on yur own hardware
You use something thats free out there
If this continues Iām gonna believe in some god I swear
tell that to the mit kids
Oh gosh I donāt have the drugs to deal with that
Isnāt mit a license
and a university
Oh yuh it was in spider man no way home
I remember hearing about some experiment where they'd gather a group of people who claimed to be aliens and test that hypothesis
its a deltic engine used in old british diesel electric locomotives from the 60s
Didn't the MIT members make some kind of quantum programming language?
yes
no, that was ibm
Idk shii about quantum computing but i heard if you were to brute force someone with quantum computer it wouldnāt take you too long to get into someoneās account
basically
Itās infinite money glitch if you were to start brute forcing crypto wallets
You just need a multi million dollar computer
4D Tracking becoming real
We just need some information-theoretic secure systems
Oh god no wtf, MDN is leaning towards NFTs, end of the world is near
Whatās MDN now
Oh thank god
mozilla developer network
Best input was from the founder https://twitter.com/jwz/status/1478022085737803776
@mozilla Hi, I'm sure that whoever runs this account has no idea who I am, but I founded @mozilla and I'm here to say fuck you and fuck this. Everyone involved in the project should be witheringly ashamed of this decision to partner with planet-incinerating Ponzi grifters.
22004
5611
Ion mind nfts as long as its not stupid jpeg pictures n something useful
Can your discord bot hve animated pictures ?
?
no
Oh yuh sorry for not wording it right
Finally... 0.0
damn
it wonāt let me
;-;
Wym
The amount of triggered cryptobros in the replies makes me go š
Gotta love how most of the cryptobros know literally nothing about the crypto technology whatsoever yet they try to defend it and call the founder of Mozilla dumb for calling crypto dumb and the cryptobros as planet-incinerating Ponzi grifters
ey i like your bots logo, thats dope (assuming thats your bot)
Yeah they're all dumb
Lots of people try shrugging it off too since they think they'll get rich but it's just due to the fear of people missing out, so people will invest in dumb projects like baby musk and get rug pulled.
And even for what the founder is talking about, he's still right since basically every big crypto uses that proof of work system
Yeah
I mean its worth it if you join the hype early easy free money lul
trust me it's not
it makes the very lucky few rich
that's how every person in the web3 community gets fucked
I joined doge hype early and made 2k
at the expense of everyone else
If they bought crypto currency ācheaplyā and found out later nobody will buy it if they wanna sell it an high peak that proves once again the internet shouldnāt be open for everyone
crypto is purely speculative, so there are a lot of people who want to buy it
but use it? fuck no
You mean volume?
quick question relating to an api request, what does this mean? ```
< Cache-Control: public, max-age=5
< Expires: Thu, 03 Mar 2022 00:12:41 GMT
(These are headers btw)
yeah
Alright
I mean exactly what I said tho 
Pretty sure thats how volume works
Try to sell for example some bitcoins when they are on their highest peak
Ik what your talking about thats how stocks work too
It has become too speculative nowadays
Nobody buys stocks on all time highs i mean they do but its a risky move
Unfortunately Klay is right on that
||adding highest before peak doesnt really make a difference||

Wait it lowkey does
not really
it does
Arent smaller peaks also peaks
it literally does
Yuh it does
Lower peaks donāt exist for him?!
If I have stuff like this: ts const res = await Axios.get<ResponseTypes.ChessPlayerTournaments>( Endpoints.PlayerEndpoints.PLAYER_TOURNAMENTS(playerName), ).catch(err => { if (err.response.data) { throw new ChessRestError(`Code: ${err.response.data.code}\nMessage: ${err.response.data.message}`); } throw new ChessRestError(`Something went terribly wrong: ${err}`); }); would it be a bad idea do just make a function like this to handle the promise rejections? ```ts
async function handleError(err: any) {
if(err.response) {
switch(err.response.status) {
case 404: {
// do stuff
break;
}
// ...
}
}
}
No no i donāt see any difference

how can i make it as false?
permissions takes an object most likely
Is that replit too?
nope
Btw does replit not support jinja highlighting im having a issue with it
not everything is replit 
nevermind, djs handles permissions weird
I just thought it was cuz of the background color 
The high lighting looks similar
extensions
Ofcs
@shell torrent i got Invalid bitfield flag or number: 37080641. error
I need the permissions false ;=;
why you using bitfeilds again
just require permissions
You can't set those permissions to be denied when creating the role, no permissions are given to the role when creating it by default, if you want to set it to be denied, you must create a permission overwrite in the channels you want it to be denied the said permissions
did you require a BigInt?
no
ah
'-'
works
ok
We gotta praise discord for adding something useful with their timeout feature
After 6 years
Even if it requires to work with timestamps which means calculating which is math⦠errr even more disgusting
yeah now how about they let us users set specific durations
don't want to have to pull in a bot to mute someone for 2 days
You canāt use that feature in the client?
no
Oh never seen that before
lmao
Lol a tab menu
Now after they introduced select menus
smh
Letās hope we will get a date picker in the future also for interactions of course
Spitting out a UTC timestamp
Fucking random disconnects anywhere
It's planned in the API discussions
Does anyone know a good way to handle response codes from fetching from an api from axios? Would it be a bad idea to just do something like ```ts
const res = await Axios.get<ResponseTypes.ChessPlayerTournaments>(
Endpoints.PlayerEndpoints.PLAYER_TOURNAMENTS(playerName),
)
// Throws if status code indicates error
handleStatusCode(res.status);
return res.data;
To quote yourself, Sir
After 6 years
Or should I not bother handling axios errors, and instead let the end user worry about that
That's what we call Discordā¢ļø

Handling errors like that should be the user's job
If youāre still speaking about an API, then yes it should provide accurate error codes
it's fetching from an api
Ah nvm then
Should I just let axios throw the errors or should I be throwing my own errors with useful information (Like the response that the website sends back with their description of the error)
If Axios' errors are not packed with useful information much, go ahead
I mean my bot is requesting my API too
If something goes wrong I will at least tell the client something has gone wrong
Which is then considered to be an internal server error
Something like this then ```ts
throw new ChessRestError(
Code: ${err.response.status} | ${err.response.statusText}\nMessage: ${err.response.data.message},
);
Sure, pretty simplistic and nice
easy enough
I'll just use this api for something myself and that'll help me work out the bugs and such
Since you're building a wrapper, I would suggest you at least map the error to something meaningful to end users.
I mean, the errors the website returns are pretty simple. It's just a code (which is meaningless compared to the status code that axios gets from the http res) and a message
I'd say it's good enough
I'll use it a lot pretty soon though before I release it as an npm package (if I ever even decide to) so hopefully I'll figure out what's useful to people and what's not
let user = messageCreate.mentions.members.first() || messageCreate.guild.members.cache.get(args[0]) || messageCreate.guild.members.cache.find(r => r.user.username.toLowerCase() === args.join(' ').toLocaleLowerCase()) || messageCreate.guild.members.cache.find(ro => ro.displayName.toLowerCase() === args.join(' ').toLocaleLowerCase()) || messageCreate.member;
if (!user.presence.activities.length) {
TypeError: Cannot read properties of null (reading 'activities')
at Object.run (/home/runner/mika/commands/Fun/stutus.js:11:28)
at module.exports (/home/runner/mika/events/message.js:41:9)
oh my
user.presence is nullable, so you may want to check if it exists beforehand.
i.e. user.presence?.activities?.length
ok
let role = message.guild.roles.cache.find(role => role.name == "Muted")
if(!role) message.guild.roles.create({
name: "Muted",
color: "Black",
})
try {
message.guild.channels.cache.forEach(async(role) => {
role.permissionOverwrites.set([
{
id: targetMember.id,
deny: [Permissions.FLAGS.SEND_MESSAGES, Permissions.FLAGS.ATTACH_FILES],
}
]);
})
} catch (err) {
message.reply(err)
}
targetMember.roles.add(role)``` how can i do that if i use the temp mute, the hidden channels remain the same? because when i use the command, all hidden channels will show up
š¤ select menu's can be used with webhooks, how does that work?
can you actually have an interaction from a webhook?
Integrate your service with Discord ā whether it's a bot or a game or whatever your wildest imagination can come up with.
op, I see it requires an application owned webhook.
š which raises another question, how does that work
interaction events can be received through gateway or webhook iirc
Okay so I might've just invented the dumbest thing known to man... Just couldn't figure out a better way to do it: ```ts
async getPlayerData(playerName: string): Promise<ResponseTypes.ChessPlayer> {
const res = await Axios.get<ResponseTypes.ChessPlayer>(PlayerEndpoints.PLAYER_PROFILE(playerName)).catch(
err => {
throw this.handleError(err);
},
);
return res.data;
}
private handleError(err: Error | AxiosError) {
if (Axios.isAxiosError(err)) {
return new ChessRestError(
`Code: ${err.response?.status} | ${err.response?.statusText} | ${err.response?.data.message}`,
);
} else {
return err;
}
}
š¤ I wonder how I set that up.
I imagine theres something in the application for a webhook then.
thank you
oh pog.
https://i.imgur.com/9Inf2ov.png
that's so convenient.
Ah I remember tim talking about how much of a pain this is
It's a bit complicated setting the webserver thing
yeah, looks like fun though.
https://discord.com/developers/docs/interactions/receiving-and-responding#security-and-authorization
Integrate your service with Discord ā whether it's a bot or a game or whatever your wildest imagination can come up with.
https://github.com/discordeno/serverless-deno-deploy-template I used this template once, I think it's nice for that
honestly, I might just use tims stuff.
https://github.com/timotejroiko/tiny-discord/blob/master/docs/InteractionServer.md
Seems cool š® might try that later
That does indeed seem like a pretty neat project
i think what i like most is that it only uses native node modules š
its a really neat project that tim has been working on for awhile.
I'm totally gonna need to rewrite my whole shit again š¢
holy shit the chess.com api is even worse than I thought
thanks for sending me a 1.6 million character long json file for one month worth of data for one player
š
this is a really scuffed api
one of their most important endpoints isn't even documented at all. I had to find it in someone else's repo
why are you using a chess api?
I'm making a discord bot/api wrapper for chess.com's api
which is proving to be a terrible decision
should've done lichess
their api is absolutely beautiful from what I saw
actually fuck this I'm swapping to lichess
chess.com is way too much work for too little functionality
I have an level system, the prob is when someone have their role connected to the level system, when they leave and join again, the roles dont auto back, how do I do that? is there any docs?
you would need to listen to the guildMemberAdd event, and then check if that person exists in your database, and then add the roles that their level allows
but if someone leaves a guild, should they really get to keep their level? š
yep
they keeping the levels
there's no such thing as role.addBack right?
what do you plan on 'adding back'? if you know the roles that they had before leaving, just add them. but no, i dont think there is a way to view/auto add the roles a person used to have when they were in a guild and then left and rejoined.
it seems possible tho
but in your level system, they should still be the same level
ill just experiment the code xd
so just check that, then see what roles the server gives for that level
and then add those roles
ok ok
C
XD
what about tranchess
.addBack is just .add. If you wanted to "add back" a role you'd still have to know what that thing is beforehand
I make a temp mute but its going to crap after the bot restart
how can I restore the remaining time of the temp mute?
You can store the mutes in a database and reload them with the remaining time
alternatively, use Discord's timeout feature
using roles as means of muting someone is esoteric because of how permissions work. It doesn't solve every edge case either even if configured permissions are theoretically perfect
https://www.npmjs.com/package/discord-interactions This really makes the request verification easy
why
tweetnacl for verifying when you could just use the built in crypto module
use tiny-discord if you don't want to deal with the http/crypto part
it even has a good rest manager
and course it doesn't require any dependency 

"No such file or directory"
this file doesn't exists
probably
@earnest phoenix
try npm rebuild
if don't work
eeeh...
canvas is known to have issues with replit
hey how would i create a json file if there is none existant?
doesn't work NOW does it?
let json = JSON.parse(fs.readFileSync(`./${message.guild.id}.json`, "utf8"));
if(!json){
fs.writeFile(`./${message.guild.id}.json`, `{}`, (err) => {
if (err) console.log(err)
});
}```
then I keep my statement
createFile is a thing? Never knew that lmao
you'll need to wait for tim, he's the one who solved it the last time
Tim, the best dev helper
uh oh, what are u planning to do with that file?
we must agree, obviously
by the way, why are you using v12?
Delete package lock and reinstall.
but it has node v16
I am trying to save names of everyone who typed a certain command guild bound but i am too lazy to actually use mongo.
just make an sql file
That version of canvas was built for Windows and Replit uses linux, that's what's causing the issue.
it's like, at most 3 or 4 lines with sqlite lib
i've never worked with sql so i am scared it will take in a lot of time
what is he having a problem with?
not really, plus you don't get the nasty issue of concurrent edit of json file
but why use discord.js v12?
hi
create json file if doesn't exist, containing name of everyone who uses a command
Not the version, it's the build that's messed up.
if 2 people use a command almost at the same time you'll get a corrupted file unless you make a dedicate writer
why doesn't he use db? And yes json?
And the only fix I know of involves package lock being messed up.
^
Is the repl environment set to Node? @earnest phoenix
^
see this comment
try run npm rebuild on shell
what issue are y'all having
does it concern skill?
show your package.json
with screenshot psl
pls,z
WHAT
use npm install
wtf man
you deleted package.json
was to delete package-lock.json
imagine if it wasn't Replit
This has nothing to do with Node.JS. It's a Replit issue and the fix is using Nix.
aa
Learn?
just learn
I refuse to believe the issue is with nix and not repl
They're known for fucking up packages for no reason
replit.nix is the file that has nix configuration
@earnest phoenix
well then put language=nodejs in .replit
This'll help you, @earnest phoenix.
Mhm. Good luck.
Incorrect command?
didn't even copy-pasta correctly
no not what i meant
the problem is
it overflew the parent container
and since parent got overflow: hidden
that got cut off
lemme try using the service
i told ya to use popperjs
Is there a standard way to construct rest requests? Should I make a static builder method or something so I donāt have to always pass my token through the headers manually?
new Request()
you don't even need to pick it apart to send the request, just pass it along to fetch and it does its thing
damn
Alright Iāll make a builder probably
is it possible to set an iframe's text colour
You guys should check out React's issue page
christ
for (const whois of domainData.whois) {
let textValue = document.createTextNode(whois.id);
let anchor = document.createElement('a');
anchor.setAttribute('href', '/whois.html?id=' + whois.id);
anchor.classList.add('text-blue-400');
anchor.classList.add('hover:text-blue-500');
anchor.appendChild(textValue);
document.getElementById('whois-reports').appendChild(document.createElement('li').appendChild(anchor));
}```This doesn't add the LI tag...
Just appends the anchor.
What am I doing wrong?
Just do .innerHTML
And write what html you want to enter
But that's not very pog @spark flint
document.getElementById(āid nameā).innerHTML = āpro htmlā
uh huh
Lol
iirc .appendChild returns the child element and not the parent
so you'd have to put the li in a variable, append the anchor to it then insert it to the ul
even the element has pointer-events: all in it
or.....
use BRACKETS

wdym
s**ll *s*ue
Ey yo @quartz kindle, sorry for the ping, but I got a few questions on your tiny-discord lib if you got a minute to spare š
sure
yay thankies ā¤ļø
whats its limitations?
like, what situation would you recommend someone stick with discord.js, for example
no situation :troll:
if you dont want to use a raw lib and prefer using something that babysits you
lmao
well, ok, ill give you that one š
:^)


