#development
1 messages ยท Page 1590 of 1
without sharding, you are on shard 0
0 based indexing kinda weird
wrong channel
Also, it's never bad to test scalability
Just because it isn't required until 2500 doesnt mean you shouldnt do it just in case
Quick.db
How do you delete a specific thing for a inventory thing?
Basically I use db.push(`inv.${message.author.id}`, "cookie"), But how can I say, reach a specific item, and remove it from the database?
Ya
IPC kinda easy to do
meh I use eris-sharder
so it's mostly done for me
which has clustering capabilities too
i think it's ```js
db.remove(inv.${message.author.id}.cookie);
Iโll try it. Ty :-)
Np
The person I worked with made a TCP socket based IPC solution which is kind of jank, but it's alright. I'd have rather done over http, but eh.
you would technically need to know the exact array index of the thing you want to delete for that. push() is for arrays, and arrays are notoriously difficult to remove from.
unless quick.db supports that which might be the case, since it's just a string.
why the fek would you do IPC over http
I don't think that works in quick.db
I forget if the delete keyword works on Arrays to remove elements, or if it just shows removed element
I could be wrong though
Just make a wrapper around enmap 
He's pushing an individual string, not an array so he'll probably got an error
hmm
pushing individual strings to an array
that's what push does.
a wrapper of a wrapper. ah yes! peak bloat
I thougth he was setting an individual string
it'd still be faster than quick.db is right now though 
setting an individual string would be set not push
My logic behind wanting to have done http ipc was that http has responses which in most cases are necessary depending on the op. socket might have a little bit of overhead since you'd have to process other packets and see if it's a response to a specific thread.
wat?
watdafuq
http-based ipc sounds like a bad idea
http is built on top of TCP, any overhead will be way bigger
yeahhh
To be fair I didn't do any benchmark, as I don't see the point in the competition. But everyone that has benchmarked quick.db against enmap seems to call enmap as the clear winner.
I'm masochistic
Hi masochistic
comparing quick.db to enmap is not completely fair though
yeah it is
since enmap keeps a copy in memory
Yeah, enmap is fully buffered
im gonna make a quick little benchmark
You're right that is true, but the benchmarks I've seen were for initial load and a set of changes that would not be affected by memory
Yep, and i though he was trying to set an individual array with push();
especially since that cache is only used for features like filter, map, etc, not for sets and gets.
im gonna do a simple bench of set & get
does nothing, no error. just doesnt work Lol
Like, logically speaking, enmap should be slower if you're going to do, say, 10,000 loads at once and then close. but it's faster apparently, from what I'm told
Is there a way with db.fetch to find a specific index for that user
yeah so we concluded that you can't. you need to litearlly get that array, modify it yourself, and then set it back
Or I can try db.all() [Object] and use Object.entries(db.all().find(...)) right?
^ this will change eventually
Also
Try enmap it has all you need
kthxbaiiiiiiiiiiiiiiiiiiiiiiii
lol evie
So
Does anyone know about the css update and the name and short description wrapper? cus mine got fucked up in the updat
@glossy spoke we're not imagining we're literally talking about, specifically, the features of quick.db, which is db.push()
which, quite specifically, uses array.push() internally
have you tried using the dev tools and looking at what it is now?
yes
but i cant figure out which specific part is broken
and i know im very dumb, cus i didnt do my own css
looks like the css class is .entity-user-content
ok, what should i replace with that
actually might be just .content
( i did say im very dumb)
Evie, ill be honest
ah shit you said short description
im so unbelievably lost
no
.entity-header__short-description is the one
My username is actually mentionable
DM a moderator that's currently online or active.
no
The proper selector is ```css
.entity-header__short-description {
css here will affect the header
}
Ah,
evie
you dont quite understand
i know that
but like, i dont wanna post the screenshot here cus of self ad but here
m
How about you show us what CSS you currently have
and what exactly is broken about it
Finally
ok so what's your CSS
Dont ask me, i didnt code this
Ok but can you at least go to your bot edit and copy the right CSS?
can i post pastebin links here
or do we have to do ALL The work for you
yeah i know evie but like i was talking to erwin
about the class
Im not THAT dumb i can get the css
i'll take a look at theirs, i used on mine but something broke
worked fine for a whole month
a simple copy/paste of the appropriate css block here in a codeblock should be sufficient
Ok i have the css in a pastebin
for both of us to see
logged in couple days ago, boom, not working
And yes you can link pastebin not problem
Ok ill get that then
i'll take a look at the source dont worry
oh ok
here
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
im so confused
I have a feeling the issue isn't the actual short description but rather the image
Ok,
could it be the margin itself that's breaking?
dont ask me why the fuck footer-header affects the header
but thats a thing
now which one is the ACTUAL footer?
is so confused
i know that
but like i just wanna know how to fix my css
what do u want me to do with that
nono, not you, im trying to fix mine
(i know im dumb but ken did my css and hes big brain im not)
cuz some of the classes are used legit broke
ohhhh
interesting - the font-size is what breaks it
as if...
no rather the font family
it's fine with that unchecked
Oof
Chonky Font
I could ask xetera but i dont wanna bother them
and i know ken is busy and dont wanna bother him either
honestly I'm absolute shit with CSS and that's precisely why I don't fuck with it
I'm a web developer not a CSS Designer
frameworks ftw
bootstrap go brr
ok thanks anyway evie
since when is css not part of web developing lmao
raw html op
^
markdown ftw
but u cant do selectors
uncooked html
u cant do like :hover and stuff
just add margin:50px to .entity-header__name
this css shit makes me want to explode
lul
wait i finally got a question
how do i connect to my vm instance ssh in a github actions workflow?
Thanks
Float has basically been superseded by the power of flexbox
flexbox for life
From my experience at least
yeah, like when you see newspaper columns and the text flows around an image floated to the left or right of the columns
^
dude flex is the bESt
flexboxes cant wrap text around like floats can
that above is the use for floats, you wouldnt use flex for it
wdym
u can use flex-wrap wrap
same as you shouldnt use float for positioning boxes in relation to each other
this
What the hell is that
an example
thats an image float: left
I mean the text
lorem ipsum
youve never seen lorem ipsum?
who's loren ipsum?
can i get like desktop of a vps?
yes
depends
i wANT
lol
lorem ipsum is dummy text that predates electricity
there should be a "joe mama"-type lorem ipsum joke
In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before final copy is available. It is also used to temporarily replace text in a process called greeking, which allows designe...
on what things?
if you are paying for a vps, you already have remote access to it lol
ssh is remote access
how can i get the ssh key of my instance?
@delicate shore galaxygate right?
Remote Desktop
yes
most VPS's dont have a gpu
ah
can u get desktop for that?
so desktops are very high cpu usage
depends on what operating system you run
most "server" versions of operating systems are called "headless"
meaning they have no video
however you can install a desktop on a headless linux for example
can we get them a head?
and then use something like rdp or vnc
i mean it must be a birth defect
this 
im trying to use github actions to deploy my bot with ssh
why would you need a gui
@quartz kindle do u have a desktop in ur vps?
a gui on a server is something even microsoft are pushing out of fashion
no
lol just wondering
cool
tim hows ur job doe?
u said the company thingy is bad?
wut
wutยฒ
there are some legit reasons to have a gpu in a server, rather than just for console access, and that is for using them for shader processing, e.g. bitcoin mining and stuff
and AI
and cracking passwords
yes
but just like bitcoin, if you want to crack passwords the most efficient way is an ASIC
an array of ASICs to be exact
how?
will it slow down my vps
yes
Thanks
it'll take tons of ram and a fair bit of cpu
oh
Was wondering if I can use it for mining as well along with hosting
๐ค
Or should I get another vps for mining
99% of hosts will delete your vps

the vast majority of VPS's are shared cpu's meaning you are not allowed to use 100% cpu usage 24/7
as in a dedicated server?
vps's with GPUs are expensive af tho
yus
gpu costs way more than ram and cpu
gpu cant be shared thats why
most hosts will probably allow it, youd have to ask your provider
each user that requests it needs to be moved to a dedicated instance with a spare gpu in it on a pci-e bus
and that hardware dedicated to their vps
for sure there must be ways of sharing gpu computing power
gpu's are also generally just more expensive
its cheaper to get a dedi and have a gpu put in it, OR to co-locate and put a high end gpu in your server hardware
My Father has a business and he has few Windows vps (with remote desktop)
They are dedicated as well
He needs it for hosting all apps and softwares
So maybe I can just use one of those 
but if you can run multiple programs on the same gpu, you can come up with ways of sharing its power
even if you have to virtualize the shit out of it

you can only run one "program" on a gpu, thats the one your OS uploads to it
you can run multiple hashing programs and mining programs on one gpu
then that program (the firmware) accepts shaders
pixel, vertex and compute shaders
I will just keep my laptop on 24*7 for mining ig 
It's a Mac 2015
I think it can handle it
most hosting have terms of use against using them for mining
o
its damaging to the hardware in the long term on dedicated servers
oh
and disruptive to vps
theres a reason that graphics cards that have been used for mining are worth tons less second hand
np
if you want to do it on home hardware, feel free, but be aware it does tax the gpu to the point that it can fail earlier
as gpu's arent designed to run at 100% all the time, like a cpu is
I won't keep it on 24*7
I use laptop for like 13 hours a day
I will keep it on during that
last time i ran a laptop at full pelt 13 hours a day for months, it died ๐
i killed the battery, the wifi module, and the motherboard
lmao
My battery is damaged
laptops arent designed for long periods of use like that
what
I have the ID 2
PGamerX is 3
@daring fjord
its a malformed id
ids have timestamps
??
snowflakes have a certain format, where certain bits must be set
you can tell what region and what time and date a snowflake id was created from its value
:bruh:
IDs are bitfields right?
hmmm, anyone else noticed that then
discord is randomly rejecting non-built-in-emojis
Please don't randomly add people @feral lantern
:/
how does uh
Discord recognise it's token when we put it on github

they have a format too @delicate shore
and they have an agreement with discord to examine all commits for that regex
oh ok
They scan for tokens from Atlassian, Dropbox, Discord, Proctorio, and Pulumi
I mean
are they helping developers
or abusing them
wait nvm
that was stupid
dont answer
I-
which is why making public repos is bad with credentials
and there isn't really proper training/tutorials on how to not commit sensitive info
env.txt
so if you think that you "deleted" your important files after pushing then you are very wrong
if you commit your token just regen it
ezpz
and even if you wiped commit history, if you can get the commit ID you still can go back to it
ive committed liek 20 tokens so far
know what?
I need help with stuff
yeah, with what?
never mind I think I got it?
Actually For the form data file is it an object?
you set the content type to "formdata/multipart" iirc then send a FormData
I meant liek
bcs Im getting this
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
form.append("file", await getBuf(options.attachments.file), options.attachments.name);
{
content: 'Pong',
tts: true,
attachments: {
file: 'https://tenor.com/view/sad-cute-anime-pillow-hugs-gif-17231623',
name: 'file.gif'
},
embeds: { title: 'Ping?', description: 'Pong!' },
reference: '810729619967049729'
}
attachments should be an array iirc but idk
what are you attempting to do?
send an attachment
a link or FormData?
https://github.com/discord-rose/discord-rose/blob/master/src/rest/resources/Messages.ts#L47 this is what I use lol
it takes a buffer
what
do you use form-data?
(node:10720) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
at FormData._getContentType (C:\Users\Owner\Desktop\jscord\node_modules\form-data\lib\form_data.js:249:29)
at FormData._multiPartHeader (C:\Users\Owner\Desktop\jscord\node_modules\form-data\lib\form_data.js:178:26)
at FormData.append (C:\Users\Owner\Desktop\jscord\node_modules\form-data\lib\form_data.js:70:21)
at createFormMessage (C:\Users\Owner\Desktop\jscord\jscord\src\utils\resolve.js:79:10)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Object.createMessage (C:\Users\Owner\Desktop\jscord\jscord\src\utils\resolve.js:37:22)
at async Client.<anonymous> (C:\Users\Owner\Desktop\jscord\index.js:13:13)
Please don;t think me as stupid
that makes no sense assuming its from this https://million.is-a.computer/files/QD6lR68bvJPOjRns.png
?
attachments can't be undefined
async function createFormMessage(options = {}) {
console.log(options)
const form = new FormData();
form.append("content", options.content);
form.append("nonce", makeid(12));
form.append("tts", options.tts.toString());
form.append("file", await getBuf(options.attachments.file), options.attachments.name || "file");
form.append("payload_json", JSON.stringify({ "embed": options.embeds, "message_reference": { message_id: options.reference || null }, }), { contentType: "application/json" });
return {
headers: {
"Content-Type": "multipart/form-data"
},
body: form
};
}
since file didn't error
const fetch = require("node-fetch"), fs = require("fs");
module.exports = {
getBuf: async function (path) {
var buf;
if (path.startsWith("http")) {
const response = await fetch(path), content = response.headers.get("content-type");
if (content && content.startsWith("image/")) {
buf = response.buffer();
}
} else if (fs.existsSync(path)) buf = fs.readFileSync(path);
return buf;
}
}
Is somethign that Im doing wrong in any of these
umm
https://million.is-a.computer/files/vCAiX1F4UHC00XoK.png try attachments?.file and https://million.is-a.computer/files/msmNDLUXdNhioKzR.png form.getHeaders() instead of an object with preset content type
hmm
hmm
How do I put ` in json ?

SyntaxError: /app/res/commands/resource/helpmessage.json: Unexpected token ` in JSON at position 229
you can't, it's not part of the JSON specification
I was just trying this
can you show the full line?
{
"content": "Take a look\n\nMy prefix for this server is `.` \n\nHere are my commands catagories:\n\n**๏ฟฝ ANIMME\n`.help anime`\n\n๏ฟฝ MANGA** aka **COMIC\n`.help manga`\nn\nโช MEMES\n\`help memes` \n\n๏ฟฝ PET\n`.help pets`\n\nโซ IMAGES\n`.help images`\n\n๏ฟฝSEARCH\n`.help search`\n\n๏ฟฝ MAII NTENANCE\n`.help maintenance`\n\n๐ต MODERATION\n`.help moderation`\n\n๐ด OTHERS\n`.help others`\n\nโฅ๏ธ NSFW** aka ๐\n`.help nsfw`"
}
but
SyntaxError: /app/res/commands/resource/helpmessage.json: Unexpected token ` in JSON at position 229
Imma google what's in pos 229
Why don't you use ' instead of `
i thought that was the error, but it's not
I Just noticed you are using ` in a bunch of places here
This is probably not where the error is
yea actually
@pale vessel
well ' won't do this
can you bin the file?
'poop' and poop
huh ?
Ok so I literally copied that and executed and it worked fine
My guess is that the problem lies on the way you are splitting the string lines maybe
Still the linter shows the error there
can you bin the file?
yes
Can you test replacing the ` for ' just to see if the problem really lies on the '
I'll show it
if I put a space between ` and " in the ending it's working fine
{
"content": "Take a look\n\nMy prefix for this server is `.` \n\nHere are my commands catagories:\n\n**๏ฟฝ ANIMME\n`.help anime`\n\n๏ฟฝ MANGA** aka **COMIC\n`.help manga`\nn\nโช MEMES\n\`help memes` \n\n๏ฟฝ PET\n`.help pets`\n\nโซ IMAGES\n`.help images`\n\n๏ฟฝSEARCH\n`.help search`\n\n๏ฟฝ MAII NTENANCE\n`.help maintenance`\n\n๐ต MODERATION\n`.help moderation`\n\n๐ด OTHERS\n`.help others`\n\nโฅ๏ธ NSFW** aka ||PORN|| ๐\n`.help nsfw`"
}
``` This dosen't work but ```json
{
"content": "Take a look\n\nMy prefix for this server is `.` \n\nHere are my commands catagories:\n\n**๏ฟฝ ANIMME\n`.help anime`\n\n๏ฟฝ MANGA** aka **COMIC\n`.help manga`\nn\nโช MEMES\n\`help memes` \n\n๏ฟฝ PET\n`.help pets`\n\nโซ IMAGES\n`.help images`\n\n๏ฟฝSEARCH\n`.help search`\n\n๏ฟฝ MAII NTENANCE\n`.help maintenance`\n\n๐ต MODERATION\n`.help moderation`\n\n๐ด OTHERS\n`.help others`\n\nโฅ๏ธ NSFW** aka ||PORN|| ๐\n`.help nsfw` "
}
``` this works
IKR
Good u got it resolved
my brain went numb now
Thx for the new info
does the api let me get votes too or no
only up to 1000
there's another endpoint
past that you need to use webhooks and manually sotre votes
do I can fetch vote count only if it is under 1000? what if Iโm trying to fetch another bots vote count
yeah Iโm looking for vote count
then you can use what flaz sent
like instantly last time I tested it
an interval for 10m should be fine then ye
yeah, I posted my server stats and refreshed the endpoint and it's already updated
correct
@heady gazelle you do
oh ffs
you cant use top gg's api without an approved bot
erm
why not
is there any way i can get my old bot added back then lol
or do i need to be added to a team
unless he can't access the webhook section for unapproved bot
apparenlty i cannot
you nned a token to connect
oh
tokens wont work without it being approved
is there any special conditions for it? or do i need to be added to a team to interact w/ the api
Erwin
wusup
(node:3200) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
at FormData._getContentType (C:\Users\Owner\Desktop\jscord\node_modules\form-data\lib\form_data.js:249:29)
at FormData._multiPartHeader (C:\Users\Owner\Desktop\jscord\node_modules\form-data\lib\form_data.js:178:26)
at FormData.append (C:\Users\Owner\Desktop\jscord\node_modules\form-data\lib\form_data.js:70:21)
at createFormMessage (C:\Users\Owner\Desktop\jscord\jscord\src\utils\resolve.js:79:10)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Object.createMessage (C:\Users\Owner\Desktop\jscord\jscord\src\utils\resolve.js:37:22)
at async Client.<anonymous> (C:\Users\Owner\Desktop\jscord\index.js:13:13)
https://sourceb.in/N71FdMydg3 (error emits from line 7 on this paste)
can you help me with this
Ive been trying for hours
what
async function createFormMessage({
attachments: { name: string, file: any }
}) {
either do this to force users to pass attachments
form.append("file", await getBuf(options.attachments?.file), options.attachments?.name ?? 'temp_file' || "file");
or this
Im not using ts
then the second option
thats vnilla js
should probably use ts btw
for proper code
Im on 14
if it is, it sets it to the next item
okay
form.append("file", await getBuf(options.attachments?.file), options.attachments?.name ?? ("temp_file" || "file"));
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
if (!options.attachments?.name) options.attachments.name = 'temp_file'
that ?? is the equivalent of that
also u butchered my code
thats not what i sent
("temp_file" || "file"));
actually
does node 14 even have conditional chaining?
i think it might, but that'll give users errors
just check if attachments is there
if it isnt, set it to something
or throw if theres noa ttachments
there you have it then
you should make some defaults
I dont need to
attach a debugger to your code too
because Im sending it
instead of console logging
I dont know how to debug honestly
console logging is bad in cases like urs
use debugger instead so you have real time variables and locals
imma do this tmr
well imma go back to code in detritus
@halcyon kite
do this
} else {
do this }
what

that else in your code will be never executed
(probably)
unless you're doing ```js
if (num = 0)
{
}
else
{
// in this case else will be ran
}```
Javascript does not really on placement of brackets but on brackets themself, it would require a == and not just a = and = just declared value of a variable but bracket placement does not effect exectution.
I had a stroke reading that
i know its probably illegal to ask here
but.........
does anyone know how to use the ||discordbotlist ||api
i know, i just made joke out of it
and thats kinda false
if the variable is 0 then it will execute the else
otherwise the if
and i was assigning num to 0, so if was never executed
does that apply to heroku lmao
Heroku is fine
Used it for more than a year, no problems but it's not enough when you gain more guilds and have to restart constantly
I linked a card
550*
hey guys
const filter4 = m => m.content.startsWith('+');```how do i filter this also on message.author.id?
So if message.author.id == targetmemberD
The logical AND (&&) operator (logical conjunction) for a set of
operands is true if and only if all of its operands are true. It is typically used with
Boolean (logical) values. When it is, it returns a Boolean value. However,
the && operator actually returns the value of one of the specified
operands, so if this operator is used with n...
so m.content.startsWith('+') && message.author.id == TargetMemberD
yeah
thanks
okay it didn't work
onst filter4 = m => m.content.startsWith('+') && message.author.id == targetMemberd.id;``` this sadly takes all messages
instead of only messages of the targetmember.id
use m instead of message
oowh
let collected = await message.channel.awaitMessages(filter4, { max: 1, time: 15000, errors: ['time'] })
this should also be m instead of message
so m.channel.await right?
nope
ah okay
m is message which collected by collector
let m = await message.channel.send(targetMemberd + "What pokemon do you want to use against: " + found.name + "?. Only input your pokemon-name, starting with +. Example: ``+Charizard``.")
const filter4 = m => m.content.startsWith('+') && m.author.id == targetMemberd.id;
let collected = await message.channel.awaitMessages(filter4, { max: 1, time: 15000, errors: ['time'] })```i think i got it, i will test it out!
Yeah, i see. Idk what i said before lol.
it still did not work
i could literally write anything, even without the +
@summer torrent

yeah me too.
have no clue what is wrong tbh
do you know what is wrong by any chance?
Hai
I am assuming I have to download an express module since I have downloaded the ones that were said on the website, but it says cannot find module 'express'.
How can I use a css in the long bot description?
@zenith ruin <style> </style>
can i convert gif to canvas buffer?
const buf = canvas.toBuffer('image/gif')
console.log(buf)//undefined
<style>
/* here put the css */
</style>
<!-- The description -->
thanks
biลey sorucam ben bot kodluyorum iรงine baya komut girdim ama รงalฤฑลtฤฑrmaya รงalฤฑลฤฑnca action diye bir bรถlรผmde sฤฑkฤฑntฤฑ รงฤฑkartฤฑyo

Either
I put like
5-10 blog posts in index page
and a "View all" button
to view all blog posts
or i put the same but with the ability to switch pages on index
so instead of view all, you can go to next page?
what's the view all for though
yall i need help with something
-ask2ask
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
wtf is this

anways
idk
how tf do I do this
but what's best then, view all or next page
yea if you gonna add "next page", just remove "view all"
where do you put your posts, on the index or on a path like /posts
/blog/blog-post-slug
o
Look at your library's reaction add event and then it's just regular logic
is the whole website the blog itself?
not really
hrm
ah
That's current view
the index should only be for last 5-10 blog posts then
and then you can have "view all" that redirects the user to the listing
now
you can put the date in the post itself ig
if you still want to put it, put it below the title at least
HI,one question is it possible to embed just the list of a gitbook in a html page
ight thanks, will do everything
oh and @pale vessel
should i make pages on the view all
to not have people to scroll forever
but like 20-30 per page
``` { name: 'โชNow playingโช', value: ([**${song.title}**](${song.url})), inline: true },
not working
Why not?
weit
``` author: 'โชNow playingโช', value: ([**${track.title}**](${track.url})), inline: true },
2021-02-15T11:55:28.710969+00:00 app[worker.1]: });
2021-02-15T11:55:28.710969+00:00 app[worker.1]: ^
2021-02-15T11:55:28.710970+00:00 app[worker.1]:
2021-02-15T11:55:28.710970+00:00 app[worker.1]: SyntaxError: Unexpected token '}'
@pale vessel ^^
show your embed code
if (!message.member.voice.channel) return message.channel.send(`${client.emotes.error} - You're not in a voice channel !`);
if (!client.player.getQueue(message)) return message.channel.send(`${client.emotes.error} - No music currently playing !`);
const track = await client.player.nowPlaying(message);
const filters = [];
Object.keys(client.player.getQueue(message).filters).forEach((filterName) => {
if (client.player.getQueue(message).filters[filterName]) filters.push(filterName);
});
message.channel.send({
embed: {
color: 'AQUA',
author: 'โชNow playingโช', value: (`[**${track.title}**](${track.url})`), inline: true },
footer: { text: 'HAPPY' },
fields: [
{ name: 'Channel', value: track.author, inline: true },
{ name: 'Requested by', value: track.requestedBy.username, inline: true },
{ name: 'From playlist', value: track.fromPlaylist ? 'Yes' : 'No', inline: true },
{ name: 'Views', value: track.views, inline: true },
{ name: 'Duration', value: track.duration, inline: true },
{ name: 'Filters activated', value: filters.length, inline: true },
{ name: 'Progress bar', value: client.player.createProgressBar(message, { timecodes: true }), inline: true }
],
thumbnail: { url: track.thumbnail },
timestamp: new Date(),
},
});
};```
aight ^^
Remove that inline: true },
It shouldn't be there, you probably took it from a field
I want to take that
same error
Is it that horrible to send embeds on JS?!
can be
const embed = new Discord.MessageEmbed()
.setTitle("test")
.setDescription("test2")
I'm using this way, looks more clean at least
Erwin: NO NO NO THAT'S SLOWER!!!!!!!
obviously it would be a lot more lines if it were the same embed as what was shown - which is just about the largest embed you can send in the first place
0.00000003044344 nanoseconds
so small it only matters at > 50k guilds on one process basically
how to covert
convert*
title+url
in
if (!message.member.voice.channel) return message.channel.send(`${client.emotes.error} - You're not in a voice channel !`);
if (!client.player.getQueue(message)) return message.channel.send(`${client.emotes.error} - No music currently playing !`);
const track = await client.player.nowPlaying(message);
const filters = [];
Object.keys(client.player.getQueue(message).filters).forEach((filterName) => {
if (client.player.getQueue(message).filters[filterName]) filters.push(filterName);
});
message.channel.send({
embed: {
color: 'AQUA',
author: { name: track.title},
footer: { text: 'HAPPY' },
fields: [
{ name: 'Channel', value: track.author, inline: true },
{ name: 'Requested by', value: track.requestedBy.username, inline: true },
{ name: 'From playlist', value: track.fromPlaylist ? 'Yes' : 'No', inline: true },
{ name: 'Views', value: track.views, inline: true },
{ name: 'Duration', value: track.duration, inline: true },
{ name: 'Filters activated', value: filters.length, inline: true },
{ name: 'Progress bar', value: client.player.createProgressBar(message, { timecodes: true }), inline: true }
],
thumbnail: { url: track.thumbnail },
timestamp: new Date(),
},
});
};```
Can you help me get an error like this?
@quartz kindle There's a big difference it seems like, is it just me?
yes, split should be faster
does sharding require alot of server space?
show beginning of the file
depends, but it only affects cpu and ram, not hard disk space
Yes ฤฑ wait
WEOW
so I've noticed something with my bot, when i run a command that sends canvas pics on another server it just sends it within a few miliseconds but when i do it on another server it takes like 2 minutes and then after that you can use the rank command all the time without any problem
it seems like i have to wake up my bot
does this have to do with the vps? or is it just something that has to do with my db
restart and retry
does your rank command use guild.members.fetch()?
i think it does
then thats why
no
is there anything i can do?
how many users do you display in you rank command?
so fetch only those users
but it takes longer for the canvas one rank command
and the users are stored on the db
if you use .fetch() instead of .fetch(id) it doesnt matter
.fetch() fetches ALL in the guild
My bot is returning an API error when performing moderate actions where it has auth2 for moderators. How can I solve this?

It's already activated.
presences have nothing to do with moderation lol
first of all, what error are you getting?
what moderate action?
why does it need oauth2?
Is there a recommended way to store and use options that servers have set, such as permitted roles? Because right now the idea would be to just create another table in the database, then fetch and compare on every call, and that just feels like it'd bog down quickly.
database + cache
Oh, I realized the mistake. The server needs AUTH2 to perform the moderating actions. If the user does not own Auth2, is there any way I can send a message warning them? (UnhandledPromiseRejectionWarning: DiscordAPIError: Two factor is required for this operation)
Hmm the bot need 2fa to do that
If u meant that's the use missing 2fa i dont think so
Thats more like the bot needs 2fa
How do I put Auth2 in my bot?
You as the application owner need to enable 2fa for your account
2fa is not oauth2
2fa is 2 factor authentication
autenticaรงao de 2 fatores
you need to enable 2fa in your discord account
Oh, so I put 2FA in my account to be in the bot?
yes
Oh, thanks bro.
โค๏ธ
And there's a way I can put an error message? @quartz kindle
you can catch it
I put a catch, but it wasn't the message...
return message.channel.send(`:errado: | ${message.author}, a mistake happened, try again later.`);
}```
Ah, okay.
And how do I put a "return" in a catch?
message.channel.bulkDelete(fetched).catch(message.reply(`Error!`))
with await
Ok.
It worked, thank you very much, friend.
how do you do your ping?
assuming you send a message then do subtraction, it would be because of longer REST times, if you use message timestamps, that could be an inconsistency between sending and discord receiving
hly s*** the bot crashed
poggers
Let's say I have a 2D coordinate object. What would be the best way to store them, in order to get O(1) lookup and a simple data structure (no nested arrays / maps)
^ for js. I saw a few solutions in other languages which cannot be done in js
is that possible?
i don't think this is normal
wouldn't it be coord[x-1][y-1] depending on how you do your code?
does it take 12 seconds to send?
yep
the point is that a 2D array is perfectly fine in JS
it seems to me it would be more efficient to do a nested map
no, maps are slower than arrays
Coords.get(x).get(y)
they are?
ah
I never knew that
I thought maps and arrays were the same speed
I mean sure, alternatively you can use something like ```json
{
'x-y': value,
...
}
But then you can't do things like looping over only one row, for example
yeah a nested array is the best option at a first glance, but I'm wondering if there's another solution, which uses less memory / less complex data structure
I don't need to loop through anything though, just lookup
you could loop thought an object like that right? it would just be some ugly code
A 2D array is not "complex", and you can't save memory by using a "simpler" structure.
the data size will be essentially the same
Unless you're doing something like a 100k+ rows/columns, all this is really just pointless optimization anyway. Use a 2D array it's the best for what you're doing.
Evie do you have a degree in cs or are you self taught?
I've been doing development full time professionally for 5 years, but 20 years before that as a hobby.
In other words, I have more development experience than most people here have life experience ๐
But to answer your question: no diploma beyond high school, all self-taught with some work training in the last 5 years.
I'm just wondering if there's another solution, which uses only one map, for example. A 2D array is definitely a good way to do it
I mean yeah sure you can use a simple object
(without turning the two numbers to a string)
like I said, have the key be x-y or something
ah
Geeze, you like shooting yourself in the foot after moving the goal post don't you
stop having such unreasonable weird expectations.
is there a function that takes 2 numbers and outputs a different number, that won't be outputed UNLESS you input the same numbers
in the same order*
No, you can't store a 2-number pair as a key in a map for access, and if you could, it would be slower than a 2D array.
how do i make a economy system which works for different servers
Just. Use. A. 2D. Array. That's the solution.
Use a database where the key is your guild ID
getting a 2D array would be O(2) or O(1)?
whats the use case for the coordinates?
can client.users.fetch("user_ID") really access users even outside its own shard? I thought this part will break with implemented sharding but it seems to work still the same 
it works even if you dont share guilds
fetch uses the api, which isn't locked to a shard
REST
ohh, great, thanks for clarifying ๐
https://haste.ntmnathan.com/epunohafow.sql error I previously had an newer version of node so I downgraded and then deleted my node_modules folder and package-lock.json file thw I tried npm install then I tried to install all the package using npm install but it throwed error
REST
the error will still happen probably, npm doesn't have permissions to write in that dir iirc
I used chmod -R 777 node_modules
hmm
A rule of thumb as I have learned is to never run npm install with sudo. That creates items with root being the owner as opposed to your username.
https://www.npmjs.com/package/mention-validator
hmm do poeple will need this shit
advertising much
well... the english could improve
lmaoo
opinion question
ain't this the same as mention.id?
well
What's best? Own functions or Modules
yea
depends on what you're doing
idk, but poeple don't use message.mentions.members stuff, I prefere to convert string to ID
if it's something simple I'd say DIY
if I can do them myself, I'd rather choose DIY
it really boils down to what you're trying to do
curse words filter? library
is thirteen? diy
example: Tim told me a way to remove VIP status from DB, using setInterval() each day, to check if any VIP term ends in 24h or less, and then timeout() to remove everything VIP from a certain user
@lyric mountain if something is 2 operations, is it O(1) or O(2)?
I actually liked the idea and used it
nothing is ever O(2)
so O(1)
use cron
lets say 2d array
but I have node-schedule already installed, I could use node-schedule for that
oooo, another way ๐คฉ
if you're accessing the index directly, it's O(1)
even if its 2 operations?
Cron's a local library?
guess I named it badly
O(1) means "independent of collection size, it'll be constantly 1:1 operation"
O(n) means "times is equal to collection size"
setInterval has the drawback of resetting the timer on each shutdown
cron is based on calendar/clock
I created a method, to execute it at startup, and then an interval to execute that method again every 24h
for my mutes I have a 5 minute interval
realistcially if its only doing 3 operations thats not blocking
I should be moving it off to a different process using worker threads tho
removeVIP(admin, bot, db, vips);
setInterval(() => {
removeVIP(admin, bot, db, vips);
}, 86400000);
this.muteInterval = setInterval(() => {
this.worker.db.guildDB.getMuteDocs().then(docs => {
const now = new Date();
for (const doc of docs) {
const timestamp = new Date(doc.timestamp).getTime();
if (timestamp < now.getTime()) setTimeout(this.unmute(doc.userID as any, doc.guildID as any, doc.timestamp), (timestamp - now.getTime()));
}
});
}, 5 * 60 * 1000);```
bro
or it mutes for 5min.?
shit
yea, I was trying to think about that

