#development
1 messages Β· Page 1778 of 1
Linux?
yes
use nvm
Yes otherwise changing node versions is going to be a pain
why
nvm allows you to have multiple node versions on your machine
node 16 is already out too
I use 15 so can't say much
becuse node 12 cnt work disocrd button
omg really
node 12 does
nop i try
discord.js dosen't
node 15 has AbortController <33
they use one function that requires node 14
node 12 can use buttons, but discord.js requires v14. its a discord.js problem not a node problem
You can use discord api with plain node-fetch no extra modules needed
It works. But... I let him react to this message that he sended when i reacted on the message, but then he already sends the message he should say when I react to the 2nd message
i use node fetch for meme command
why it not easy
npm node version
like this
@near stratus cb you say how update is i change version in package is it change
Like I do. V help (V is my prefix) and then he sends the message u just help me fix, but if I react to this one and he sends the next message, the "answers" from this question already Pop up. @near stratus
Even if i didnt react yet
what you just said I don't understand it at all
yup
how to fix that issue :')
I use mac and this works
IDK about Linux (I'll go Google and tell you later)
curl "https://nodejs.org/dist/latest/node-${VERSION:-$(wget -qO- https://nodejs.org/dist/latest/ | sed -nE 's|.*>node-(.*)\.pkg</a>.*|\1|p')}.pkg" > "$HOME/Downloads/node-latest.pkg" && sudo installer -store -pkg "$HOME/Downloads/node-latest.pkg" -target "/"
print(__import__("sys").version_info) at the top of your file
@near stratus I use the same command as the one u just fixed (I did copy and past) but now when I didnt react yet he already sends the messages that will Pop up AFTER i reacted
You mean what is the latest js version ?
wait a moment
current LTS is node 14 the latest is Node 16
Ok
You know you could just visit the site and see yourself? 
Beta geng
so when you don't react (no reaction at all) It still replies won. ?
npm ERR! notarget No matching version found for yt-search@^4.8.2.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'container'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! /home/container/.npm/_logs/2021-06-10T09_55_21_953Z-debug.log```
wht this
After 2 (maybe 3) years
Yes
i dont use d.js anymore, so i dont really care
Idk how its littleary the same command as the one that works
@earnest phoenix tbh use buttons... reactions are getting outdated....
message.react('π').then(() => message.react('π'));
const filter = (reaction, user) => {
return ['π', 'π'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === 'π') {
message.channel.send('Upvote');
} else {
message.channel.send('Downvote');
}
})
.catch(collected => {
message.channel.send('you reacted with neither a thumbs up, nor a thumbs down.');
});
Try this and say what it says
Ok
Still not in djs
Beta gang
IDK never used 11
It was just for memes
V11 is dead dead
there is a npm module for buttons on d.js
thatβs very dead
I'd suggest using djs 13 beta... instead of a package
v11 still works with a few mods
Still the same
It'll release this month
just use D++ :^)
Oh no⦠the infection is spreading
Already made a wrapper which supports handling normal and slash cmds with same methods
but yea, the docs are kinda shite and there are missing geatures
I made my own though
class InteractionMessage {
constructor (client, interaction, readonly){
this._client = client;
this._interaction = interaction;
if(!readonly){
this._message = { data: {
type: 4,
data: {
content: "",
embeds: [],
components: []
}
}}
} else {
this._message = { data: {
type: 4,
data: {
flags: 64,
content: "",
embeds: [],
components: []
}
}}
}
}
send(){
this._client.api.interactions(this._interaction.id, this._interaction.token).callback.post(this._message);
}
setContent(messageString){
this._message.data.data.content = messageString;
}
addEmbed(embed){
this._message.data.data.embeds.push(embed);
}
addButton(buttonObj){
let a = 0;
while(true){
if(!this._message.data.data.components[a]){
this._message.data.data.components.push({
type: 1,
components: []
});
}
if(this._message.data.data.components[a].components.length >= 5){
a ++;
}else{
break;
}
}
if(a >= 5){
console.log("maximum number of buttons reached");
}else{
this._message.data.data.components[a].components.push(buttonObj);
}
}
}
How can I make it wildcard
so you want to get all data?
it says Upvote or Downvote ?
just use schema.find({},Command:)
Upvote
I get that
this will find all Documents containing the command
And there's no reaction π on that message ?
Yes it is
I mean if I send hello then it sends message but if I send hello m then its not
are you sure its database related?
Nope
Then it's working
When there's a π it'll say Upvote
that's what it's supposed to do
But I want to have to react to it first
Wdym?
You want it to react ?
Just await message.react
Bc I have like a vote there
Then make collector
oh I get it
Can you please explain clearly?
message.send().then(m => {
m.react('π').then(mm => {
//add listner
})
});
Bot reacts -> User reacts -> bot sends message?
So I have like 2 Reactions that are Set by the bot. Like π and π© . I want it so I click on it and then he says an message. Not that he sends it before i click on it
Yes
cn any one give me meme api of reddit pls
But my bot is like : bot react -> bot message
then use this
message.send().then(m => {
m.react('π').then(mm => {
//add listner
})
});
Ok i try
just add .json in the end
i use fetch
await message.react('π').then(() => message.react('π'));
const filter = (reaction, user) => {
return ['π', 'π'].includes(reaction.emoji.name) && user.id === message.author.id;
};
await message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === 'π') {
message.channel.send('Upvote');
} else {
message.channel.send('Downvote');
}
})
.catch(collected => {
message.channel.send('you reacted with neither a thumbs up, nor a thumbs down.');
});```
Try..
Did I ask ?
I don't care you use fetch, axios or request (dep)
An api is an api
They all work the same way
I won't spoonfeed you some code
Just send a GET request to https://reddit.com/r/memes.json and see what it returns
no my old one is
huh ?
It would work... just try it
ok bro
You know how to send a GET request ?
no

Works thx
hahah
I never hit my head that hard before
Anyway here are some resources that'll help you get started with APIs and requests
IDK
i use axios
lol⦠like that would be something new in this channel 
https://www.freecodecamp.org/news/apis-for-beginners-full-course
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Introduction
https://www.mulesoft.com/resources/api/what-is-an-api
https://snipcart.com/blog/integrating-apis-introduction
https://blog.hubspot.com/website/application-programming-interface-api
https://www.w3schools.com/js/js_api_intro.asp
https://medium.com/the-era-of-apis/how-to-use-an-api-the-complete-guide-d701e32c7c9f
soory
^^ these will help you learn more about APIs and requests
Like how to send requests
GET POST
i learn how make meme commmand in yotube but
if(message.content.include("yo")){
message.channel.send("yo")
}```
Code is not working
api cnt work

It should and would if you change it to includes
.includes()
axios.get('https://reddit.com/r/memes.json').then(res => {
console.log(res.data.data)
}).catch(console.log)
wait i give my codes say there
This is how you use an api
this is meme codes
Firstly you need to rewrite the whole code to use it with Reddit
Imagine including Discord 2x 
if(message.content.includes("yo")){
message.channel.send("yo")
}```
Still not working
no codes work
but memes are not good
so i ask
it won't work the same way with Reddit
The reddit endpoint has a different twmplate
oh it like subreddit
You'll need to change ur code according to its structure
Phew
if i need ask one thing
Itβs case-sensitive
cn i say
?
dont ask to ask
Reddit returns like
data {
data {
children: [
{
data: {
//All the good things on earth
}
}
]
}
}
The check is case-sensitive
If you enter Yo, yO or YO it will fail
how add download link in image [avtar commmand]
I'm just typing yo
In small
Edit of the above message
data {
data {
children: [
{
data: {
//All the good things on earth
}
}, {
data: {
//All the good things on earth pt2
}
}, {
data: {
//All the good things on earth pt 3
}
}
]
}
}
right it proper or you cnt difined it so
Is the statement inside the right event (on_message)?
displayAvatarURL() ??
Yup
and say how add download link
show your codes bro
const schema = require("./models/custom-command")
client.on("message", async message => {
if(message.author.bot) return
const a = message.content
if(message.content != ""){
const data = await schema.findOne({Guild: message.guild.id, Command: message.content})
if(data) message.channel.send(data.Response)
} else if(message.content.includes("yo")){
message.channel.send("yo")
}
})```
Well then log the content before your statement to see whatβs going on
displayAvatarURL() returns an URL
hmm
now i see
you can use it
Wrap it in βcontentβ
Thats in db
It gives a download link
they literally just gave you what you need
Dude that statement is in a different scope π€¦ββοΈ
@earnest phoenix
let av = await User.displayAvatarURL({ size: 512 })
message.reply(`{av}`)
bye
?
finally

thx @near stratus
Your statement is wrapped into other statement.
First check if they are actually true/false
(if you actually get to the include statement)
Iβm not gonna explain scopes tho
message.content should never be an empty string, afaik
Alright I'm at the PC right now
if(message.content != "")
{
const data = await schema.findOne({Guild: message.guild.id, Command: message.content})
if(data) message.channel.send(data.Response)
}
else if(message.content.includes("yo"))
{
message.channel.send("yo")
}
Ask yourself why includes will never be checked
valve is publisher of gmod
Heard the real publisher is called "Lord Gaben"... but don't tell anybody!
I want to make my bot publish automatically all the messages in my announcement channel, how do I do it?
what lib
discord.js
message.crosspost()
Mongodb
alright, can't help you with that one
what did you want to connect?
hello
Imma tell u the story
I Making trigger create command but I want it wildcard
so it should be a random item from the database?
Like if trigger is yo it says yo but if content is udhdh yo then still it send yo
ok
Nope im storing guild id + trigger + response
did you have a snippet?
Like?
what you got for now?
Well my command is working but not in wildcard
#development message is this still valid?
client.on("message", async message => {
const a = message.content
if(message.author.bot) return
if(message.content.includes(a)){
const data = await schema.findOne({Guild: message.guild.id, Command: a})
if(data) message.channel.send(data.Response)
}
})```
New code
But not working
yea bcs you check if the message contains the message
the issue is not database related tho
Now if I send hlo its sending hlo but if I send bro hlo then its not
How can I fix this
make an array of possible triggers, and check if the message contains any of the triggers
wtf are you doing
But thats in mongodb how can I make the array
Oh... you guilds have multiple prefixes and you wanna use all of them.
make a schema that lists your triggers in an array, make a schema for each trigger and query all of them with find() then make a array or map from the object you get
there are many ways
The easiest way to handle this is to loop through ALL guilds you got in the READY event, get their prefixes from the database and cache them into an array.
incl. the guild ID as key
just call Guildschema.find({})
will return all guild docs you have, then just loop over it and map it or push it in an array
Well might work, but don't do that every time in the message event
Thnx too all
you do this in the ready event, and attach the map or array to the client
or export it
just dont forget to update it when you get a new Guild
As well as if there's a command to edit/add/remove the triggers/prefixes
That's why I said to add the guild ID as key
and also when you leave a guild
?
switch(args[0].toLowerCase()) { ... }
what are you trying to do
Checking args[0] lowercasely.
all the case statements inside the switch should be lowercase too
Example, if someone did !help eCoNoMy
Can this be used?
switch(args[0].toLowerCase()) { ... }
yeah
.. but put the cases lowercased?
if case "economy"
Correct.
π
can you access message from MessageReaction
Ooo.. yes I can! messageReaction.message.guild.id?
yeah
Thank you.
hi
does anyone know why this is happening
@bot.event
async def on_member_join(member):
global invites
inviter = None
for invite, use in invites.items():
print(invite, use, invite.uses)
if invite.uses > use:
invites.update({invite: invite.uses})
inviter = invite.inviter
What's more important for a discord bot, memory or CPU?
i basically have this to check invites on a server
but for some reason
even when an invite has 10 uses
if the invite had only 9 when the bot started, it always shows 9
but when i reload the bot, it shows 10 uses
hello
why it cnt work
.setColor("RAINBOW")
any one say pls
RAINBOW is not a valid embed color, if you want a random color, use RANDOM
.setColor("RANDOM")
.setColor("ROLECOLOUR")
soory this
bro
this
Or just use hex codes (ffff00 -> 0xffff00)
Well then fetch the role the user has, get it's color and set it as embed color.
see when i add role it come in role colour
when i remove it in default
@boreal iron
Well then fetch the role the user has, get it's color and set it as embed color.
Try yourself and get back in here if it doesn't work
@earnest phoenix
https://discord.js.org/#/docs/main/stable/class/GuildMemberRoleManager?scrollTo=highest
https://discord.js.org/#/docs/main/stable/class/Role?scrollTo=hexColor
If you want it to match Discord's color, use member.displayHexColor
Discord uses the highest role that has a color set for display
One step less... let's blame Voltrex
@ npm How
ask and wait
What library
no need to ping mods
What library are you using?
π€¦ββοΈ
At least you tried your best.
there are other libraries for python?
I'm asking him
client.guilds: list[discord.Guild] = [...]
It's a question, not a statement.
They're not as popular
Are you sure?
everyone
client.guilds is a list of discord.Guild objects
what does flazepe use
How do you get length of a list
Rose
Sick
you use len()
Discord.js -> Eris -> Discord.js -> Discord.js-light -> Rose
Misty plz I'm trying to help people learn 
Bet I write better Python than you
Fucking do this without help
π
I accept defeat
I should do 10D just for funsies
Not Detritus, thank god 
Ikr
Detritus bad
Very juicy, but what's that second arrow for?
bug lol
Why yes yes I do
thank u thank u
Oh lol, other than that it looks very nice
ty, there's an extra arrow cause when the error is found the position is already at the empty line
As rust fanboys would say: sPeEd
@earnest phoenix wanna crash my bot?
Maybe
dm
One message removed from a suspended account.
how can I convert all a tags into p tags on a site? from chrome devtools
I want to select and copy, link text.
"converting" them, wut?
show full error
How can I fetch all users? i am using d.js v12 and i have server members intent i dont have presence intent
As the docs says
User to reply to (prefixes the message with a mention, except in DMs)
except in DMs
If you're willing to reply to a message like that you could easily use <Client>.api if you're not using the master branch
Other than that, your error doesn't seem to be occuring there, you may want to show the stacktrace of the error as well
cool api key bro
?

that error is not coming from the code you showed
?
@quartz kindle AYO
Help me
How do I make my bot auto publish all messages in a certain announcements channel?
nope
read it again
...?
hmm π€ "I asked how to publish message in announcement channel and someone sent message.crosspost(). What is it? Oh... my answer!"
if (message.channel.type === 'news') {
message.crosspost()
.then(() => console.log('Crossposted message'))
.catch(console.error);
}
And do I have to put this under something like this?
client.on("message", async message => {
yes
k
thx
lemme try
[Pterodactyl Daemon]: Updating process configuration files...
[Pterodactyl Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
container@pterodactyl~ Server marked as running...
:/home/container$ /usr/local/bin/npm i && /usr/local/bin/node /home/container/${BOT_JS_FILE}
npm WARN IsmailZ@1.0.0 No repository field.
audited 15 packages in 4.889s
found 0 vulnerabilities
``` Console says "Running" but my bot's not online... and it didn't log the ready message
@quartz kindle help^^
"Server marked as running"
not "Bot is running"
Yeah so what's going wrong?
Just log the events to see what happens.
lets say my cpu has 4 threads, should i only have 4 shards for my bot?
and if i were to have more than 4 shards what would happen?
well, you need to show more stuff
7 lines of log ain't gonna help much
you cant do null.id
whatever you are using .id on is null
idealy, if your processes can handle it, have one process per thread and split all shards across them
if they start crashing for some reason then you can increase the number of processes. there will be a small performance penalty due to context switching but its usually negligible
How can I fetch all users? i am using d.js v12 and i have server members intent i dont have presence intent
Use await <guild>.members.fetch() to get all members of a guild.
hey, so im a bit confused here... so my ajax isn't working for some reason and idk why.
function sendData() {
const xhr = new XMLHttpRequest();
xhr.open('POST', '/guilds/<%- id %>/general', true);
xhr.onload = function () {
if (this.status === 200) {
console.log(this.responseText)
} else {
console.log(this.status);
}
}
const form = document.getElementById('changeData');
const data = new FormData(form);
xhr.send(data);
}```
if i go to the network tab, it doesn't say the status code but it says in the req payload it has been rendered
and in my api, i log req.body and it logs an empty object
I'm talking about all the members, not the server members. π
then just loop through the guilds lol
map your guilds to the fetch promise
and then await Promise.all(mappedPromises)
that'll resolve when all of the fetches finished
okay i will try thanks
What's up, guys, I've got a general js question that I've been struggling with. Not quite sure how to do this, but I have an array of objects like this
{
"postHeight": "5",
"type": "CL",
"barb": "None"
}
I also have a search function that allows you to search through these objects to find the right one. There will be hundreds of these objects in the array, so if I want to find one specific object with a postHeight of 6, a type of CL, and a barb of straight, it will find the object where all of those match up, and then push that entire object that matched, to a different array. Easy enough. My main problem is that I want to be able to tell the user, if only objects' postHeight and type match their inputs without barb matching their inputs, that No exact matches found, but there is a match that has the correct postHeight and type, just with an incorrect barb.
I'm not quite sure how I should be going about doing that, though. There could be 15 objects with matching postHeights and 20 with matching types, but I want to find the object with the most amount of matches, and then tell the users exactly which properties match, and which ones dont match their search query.
look up fuse.js
it'll do just that
I just looked into it, doesn't seem to be what I'm looking for
it is
fuse will fuzzy search through those objects and match them by similarity based on what you provided
use the keys field to search for postHeight, type and barb
in your case you wont be using fuse for whats its known for: fuzzy string matching
Yeah but there's going to be more than those three properties in the end, and many of them will just be numbers, so it doesn't seem to me like fuse will be able to properly handle that
you'll be using it to search proximity through the keys
you can specify which options you want to be searched with an array
Yeah it'd search thru them all
thats the point
fuse can do that
use score to see if its a perfect match or not
if its not, use the closest result
how do I tell fuse which number is associated with which property? Example:
I need a postHeight of 20 that is of type CL with no barb, but also has 8 OC, 3 OD, and 4 LP?
you can pass it as string, it should match it just fine
if you need OTHER options, you'd have to run the fuse() again
you'd search it one at a time
for example
postHeight of 20 that is of type CL with no barb
this is one
this is 2 8 OC
this is 3 3 OD
you'd narrow it down
The thing is tho, I need something that would match all of that and more
you need to do one query at a time, for more precise stuff like that, the best i can think of is a database
i dont think you'll find anything that does that
I'm not necessarily looking for a package tho
but if you want proximity, like you initally asked, it'll do the task perfectly
like "one of the entries didnt match"
but you get the closest one
im giving you feedback based on this
fuse will do just what u put there
search in all entries, and return the closes of your search
that'll fullfill what you mentioned there
Yeah, and you're right, fuse is good for that
My issue is that once I start adding more properties to the object it kinda falls apart
if you need multiple queries at once, then yeah, you'll need to use fuse along with your own logic code or something else entirely
you know what you could use
postgres
or something sql based
Ok, so, I don't know if this would work, but could I have a main python file, with the things to run a bot, then a seperate python file with commands?
SELECT * WHERE (postHeight > 20 OR postHeight = 20) AND CL = "no barb" AND (OC = 8 OR OC = 3)
im pretty sure u can run conditions in sequence with parenthesis
and then i import the commands file to the main file
Yeah I already use a database, though it's a json one
ig I just need to explain what exactly these objects are better
period
json databases are fine for some things
I dont remember 100% if this is what cogs are
not if u writing on them
only if u storing
but it looks like you're adding more and more
They work just fine lol
"works fine" doesnt mean its fine tho
writing bad code in js works fine too, doesnt mean its good
but regardless, try postgres for dynamic searches like i mentioned
They're great for portable and easy to install databases, and it doesn't need to be "good" lol
You don't always need everything to perform like a champ
thats what containers in docker are for
dont wanna install stuff? put it in a docker file
You have a point there, but if it aint broke
Been using json dbs for years
Obv not for everything, but for smaller stuff yeah
use sqlite or something light then
but for the love of god, dont use json for serious projects
evie and i had a whole convo about this
speically if u start running into atomic operations
like i said, "its been working fine" isnt an excuse for a bad practice
your point was "easily deployable" database
json db ew
use sqlite
Yeah but those are always just more painful to use
MariaDB ez
better than one day waking up to corrupted data
all the databases i mentioned are corruption free and acid compliant
so theres no chance for corruption
also security
Probably fine, but hundreds/thousands of people have been using my stuff for years and nobody has once gotten their data corrupted
and it's not a serious thing, just stores some file info
lmao
im recommending using postgres for your stuff
since it has the capabilites of doing what you need
you clearly missed my point
Just trying to sort through objects to find what Im looking for
read this carefully
im recommending the database for what it can do, not cuz im bitching about your json database
it can run the queries with the stuff you asked
I think that code stems from a misunderstanding of what I need (my bad for not being descriptive enough). I can already sort through the data to find matches. My issue is that when it does not find an exact match, I need the object with the highest number of matches, and what exactly did match and did not match. Somebody just answered my question tho with this
You could return an array of objects along with the number of fields that matched the criteria. Then you can sort the array by this count.
that would fall under what i said before, using fuse along with your own logic
for example
Fuse would really not be good for this
My issue is that when it does not find an exact match, I need the object with the highest number of matches, and what exactly did match and did not match. Somebody just answered my question tho with this
I read your original and current message (none of that back and forth in between), but it sounds like you should sort the results first (since there's a chance none of them match), then inspect the array from the start (since it's sorted, you can play around with it).
for(let i = 0; i > queries; i++) {
let arr = input.filter((obj) => { condition });
if(!arr.length) return {
reason: `Could not find match for ${condition}`,
results: arr,
}
}
this should give a rough idea
ew raw loops
keep filtering your results until it either matches all filters or the array lenght is 0
that means your previous filter was the last one matched
of course, this is not flawless
if it fails on the first search, and there are other objects who matches the other criteria, you'd have to either loop them and somehow map some metadata
or use something premade that already matches closest thing possible by what you provided(hence why i was suggesting fuse for each iteration)
Hi, anybody got experience with slash commands? (Using discordjs here)
Just trying to output an image via a slash command.
const img = new MessageAttachment(imageBuffer, `some_image.png`);
msg.channel.send("Here's your image", {files: img}); //This works
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: text,
attachments: [img],
},
},
}); // This only outputs the text, no image, no error
The send way works completely fine, but the interactions response only outputs the text, not the image.
I believe i'm matching the docs https://discord.com/developers/docs/resources/channel#message-object-message-structure, but must be missing something. Any ideas?
attachments: [file]
Donβt see file being defined anywhere
Or is it just a placeholder?
Sorry should be img, just wrote up the example code quickly, I am using the right one in my test though. will update the previous message
Interactions responses are different to normal messages: https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionapplicationcommandcallbackdata
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Ahhh I did not see that, cheers. Doesn't look like it accepts attachments unfortunately though :/ May have to make do with an embed image instead
It does
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
The MessageAttachment() function doesnβt create a valid attachment obj for interactions
The obj structure is different than normal attachments
You sure? It doesn't list attachments as a valid field for interactions callback, don't see what else I could put it as
Yeah that's the plan, not really what I wanted but doesn't particularly hurt
pretty sure they do support it
maybe just not documented
i remember an issue about it on their repo
If they do then it doesn't work with the typical formatting that channel.send accepts
Nope as I said
or it's called something other that attachments
The structure is different
Any reference to that structure?
I linked it above
That matches what MessageAttachment generates
oh lol np, will keep digging a bit anyway
Yeah just play around with it a bit
Maybe you will find the solution
Yeah did for a while, seem to either get it to completely crash, or just output the text
'Bot' object has no attribute 'add_Cog' π
add_cog????
hint: python is case sensitive
chill lol
wut
its rtfm ffs
hey anyone knows why it doesn't read the line 68 and 69? I already put a console.log in the next line and it logs but doesn't update and delete the data (mongoose)
Wow. I dropped erlpack as a dependency and memory usage went from 30mb -> 4mb.
Oh, read that wrong. Dropped to 15mb. Still quite a bit though.
https://cdn.jsdelivr.net/gh/user/repo@version/file
how can i make it so it pulls the latest version
from a file
literally on the front page
you're smart enough to figure this one out on your own
i no have timeee
Dylan shush
at least i haven't got hacked yet

i just wanted to know if there is a repo@version
that could get the latest commit
Just donβt include it from an external source.
Download it and include the local file.
That will decrease the loading time of the website.
Itβs not needed to have the latest version of jQuery at any time since their updates arenβt major changes anyways
Oouuu
I got hacked once π§π½ββοΈ
It wasnβt hacked I gave my token away
I was stupid then
big brain
My stylesheets are showing up empty for some reason, or are not being loaded properly or something similar to that.
https://i.callumdev.xyz/0yqh7.png
https://i.callumdev.xyz/hyxf1.png
https://i.callumdev.xyz/o4zgh.png
https://i.callumdev.xyz/tbgco.png
using nextjs
Just ask your question π
nodemon is for development. You would need something that auto-restarts the bot on failure.
pm2 can do restart on failure.
Is there discord bot support for elixir? I couldn't find any package for it
https://github.com/satom99/coxir is pretty nice.
no
its easier to chat about dev stuff here without general lynching me for talking about detritus
is it good?
damn should i use π€
sharding and clustering
and built in command handling for both normal commands and slash commands
its absolutely a bliss

cuz its in ts and there arent many docs
XD nice meme
i wasnt reading the npm package it looks great
let me get you the links
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
if you new to ts/discord developing, look at the last detritus-example
if you're very well experienced in both of them, look at cake's repo
i'd personally recommend my example, its much easier to understand
idk ts
specially cuz @earnest phoenix tried cake's repo and almost gave up
you can use js as well
but i have been learning JS for 6 months
woah
TS is js tho
theres barely any learning curve
any js code is valid ts code
ts is just a way to add types to your objects and variables
so you remove pesky bugs right ahead, rather than having them fixed later down the line when the error happens
i got a vid if u wanna check it tho
will do!
Learn the basics if TypeScript in 100 Seconds! If you love TS, upgrade to Fireship PRO for 40% off using code mbus5Kcj at https://fireship.io/pro
TypeScript docs https://www.typescriptlang.org/
#typescript #js #100SecondsOfCode
Install the quiz app π€
iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8
Android https://play.google.c...
short 2 minute video
and a 12 minute video if you wanna go deeper into the basics https://www.youtube.com/watch?v=ahCwqrYpIuM
TypeScript has forever altered the lives of JavaScript developers. Learn why TS is so awesome and the basic concepts required to be successful using it https://angularfirebase.com/typescript-the-basics/
Deep Dive https://github.com/basarat/typescript-book
TypeScript Docs https://www.typescriptlang.org/
i'd recommend watching the first 2 minutes of the long one first
is there any siginificant differences between them?
it gets the "introduction to ts" a little better
the small one is just a quick intro
the latter goes into teaching you a bit of the basics
it goes a little deeper
will check those 2 videos out
but for a "why use ts", its better to watch the first 2 minutes of the long one
got it, I am just curious though, why do a lot of ppl prefer js of ts or py
i'd js is more flexible, py is more stable, ts is best of both
js is super malleable, it can basically do anything
you'd have packages or libraries for basically everything, including frontend
Detritus sucks
typescript would make js stable, by enforcing types and removing as many bugs as possible
i always wondered whats the difference between a library and a long lines of code
imagine not understanding a good repo from a massive bot after refusing to read my basic code

a library is something that wraps around something most of the time
and what EXACTLY did u dislike about it? i might bring feedback to cake
errors that you produced with your own code, tho

and before you say I did something wrong
what about a starboard library vs a starboard code?
I cloned ur repo

and have u ever asked me for instructions or what errors it gave?
libraries are something like a module, you can easily write the same code, just make it easy for someone to download and use it themselves
thats what a lot of people do
npm is full of packages(modules)
Cap
π§’
Not giving up
already did
nah, its a necessary skill
I happened to do it early on
cause I just didn't care about trying a new lib to begin with
if you want be a dev, you need to know how to handle errors
thats ur own choice, but dnt call the lib bad cuz of ur laziness and unwillingness to use/learn it
I am calling it bad as a meme to begin with
random question might sound dumb but does adding like music commands use more ram and/or cpu
then do /s
I haven't tried it enough to see if its good or bad
you cant get sarcasm over a message
adding more commands would likely not increase much usage at all, but having a music bot would,. specially if u use lavalink or the likes
well ik music commands are more "heavy"
i doubt there are any commands that are heavy, its the actual song itself(aka streaming to the voice chat) thats your biggest concern
also making sure to save on data on inactive channels n such
but a command shouldnt be heavy, at all
everything uses ram
but its negligible
a file containing a function and some logic shouldnt use more than a mb
thats on the higher end
prob about right
i have over 900 commands used an hour
so not much anyways
i know detritus unloaded uses about 50mb
thats low
only 317 servers and 170k users
Tho I might of heard wrong
i use d.js light
Nice
didnt skills benchmark it?
1 sec
oh yeah, he did
Yes
very scalable
But the thing is
I will use discord.js
until I actually need detritus
I would rather stick with something I know for now and learn something new later on as I start gaining a use for it
thats what we call "waste of time" in this bussiness
you'd be writing a shitton of code knowing you'd have to change it later down the line with a full rewrite
usually you want to do it the exact opposite, and make your bot scalable off the bat
I mean trying to put out a product with something you don't know is bad practice no?
Wdym
have you used d.js thoroughly before?
I'd say I have used it fairly well yea
Seems how I have been using it for a good 2-3 years (still suck dick with it but I have used it a good bit)
then you're fine
your saving grace is that detritus's structures are similar to d.js's
otherwise you'd be fucked
I plan on making a switch to detritus soon I just wanna practice more with it which is what I have been doing on the side or at least trying to.
Finals are coming so haven't had a lot of time
im aware, but im still sad you didnt even bother asking me or cake for help when you "gave up"

kekw
I was going to
But I have grown used to being yelled at for now knowing something so basic
Credits to d.js server

you clearly havent seen a good community
discord.gg/typescript and https://discord.gg/CjdB8RRe
There, two good servers that wont kinky shame you for doing bad code
you spoke less than 100 messages in detritus server, but you should've seen theres no kink shgaming there
you can also check the ts server
responses are hella slow tho
might take a couple hours to get an answer
Ye
my point being, both are friendly
so idk what kind of shitholes you've been digging
but those are fine
DAPI might be a bit of a strech
they help, but they can be ruthless a lot of the times
want help with detritus or ts? => detritus server
want very hard ts questions with no rush? => ts server
want VERY specific questions with rush? => dapi (but expect it going sour with some name calling)

Alrighty
I will practice some detritus tmrw
It is getting rather late so ima finish some stuff up on rust and head to bed
lmao erwin be slippng ads
Kekw, I seen smaller lib with ego boosted out there.
Feelin like there work is da bomb
what prettier package is for? coz we there's already an vscode extension there. Then y do we need it
its a code formater
d.js-light and detritus is pretty chill
Yea
ikt, but what is the package is for?
having your code look less like it could cause eye cancer
do I need it, if I already hv a vsc extenion?
if you have it as vsc extension you dont need whatever package you talk about
you just have to select it as formater
so the package is useful, when someone dont use vsc right?
indirect, the code is usually easier to read when formatted with Prettier
bcs you have less rats net like functions, etc
using yarn to install packages, also saves it in cache.
Is this cache is saved globally, or only for that project?
idk how yarn handles it, for npm if you add -g its globaly other wise only for the project
Would it be possible to not download huge repeated packages, per folder and decreasing the storage space.
And install the package per folder, but which still uses it from global cache.
just install it globaly? you dont need to install it for each project
atleast Prettier
there is no benefit to have it in the project itself

npx
i want to install all my packages in a central location. And it still should hv dependency in my projects
there is no real difference in the package if installed global or local, so it should pick it from the cache
Anyways you will need to cd to the path you wanna install node modules and run npm in there
Which will install the packages in this directory
Thatβs at least how the raw location of the modules is always the same
fuq npm use deno
no more problems with install
I think u guyz didnt got what I'm trying to convey here.
I hv two react projects for example, they both hv node_modules of size approx 400MB each.
I want a way so these, both projects share the same node_modules and also my future project.
So I don't end up wasting storage space of my pc
The only closest thing, I hv found is to use, yarn workspaces
How much free storage do you have rn
I don' t think 400MB is big a deal, you probably have a 1TB disk
you're worrying over nothing
only 10gb FREE, Ihv a ssd of just 128gb. I couldnt update my mac
hmmm alright then, either install them globally or have them as sub-modules
installing packages gloabally doesnt create a dependency for my project
Well I don't think you can do that
It is quite good to save it in the project along with husky and lint-staged. It will then make sure contributors to the project use it regardless of editor.
https://i.callumdev.xyz/lfbft.png
https://i.callumdev.xyz/xpsg0.png
why aint the justify-self working, keeping the social icons on the end of the flex row
make a empty div, with flex: 1 in between the two footer items
brilliant, thanks
Back in the olden days npm actually did this, and then sym-linked everything into your project. Not sure if there is still an option for it.
what it is called actually?
Ive created, yarn monorepo and published it to github, which has a bunch of packages. I want to clone one of its package in vsc.
Also there is only one parent repository that Ive published, not sub repos for each package.
So how would I do it? Or is it even possible.
Alright regex pros I need to match the filename and the line:col from the following string; C:\Users\MyName\Desktop\test.js:8:39
I always use some janky javascript for these kinds of things. I will never understand regex π
Just check if it matches or need to catch the values?
const string = "C:\Users\MyName\Desktop\test.js:8:39";
const filename = string.split('\').reverse()[0].split(':')[0];
const line = string.split('\').reverse()[0].split(':')[1];
const col = string.split('\').reverse()[0].split(':')[2];
This is what I would do π
Didn't test this code btw
@cinder patio /\
ye that's what I usually do too lol, can't be bothered with regex
oh by filename I meant the entire path, my bad
Ah even easier
yup just split by :
/.*\\.*\.js:[0-9]+:[0-9]+/gi
you have to concat arr[0] and arr[1]
that returns null
You said you need to match it only NOT to catch the groups
I need to get em






