#development
1 messages · Page 1408 of 1
Lemme check the docs
Yes I fixed it
So if you use discord.py with the commands extension then you can do something like:
@bot.command()
async def mycommand (ctx, channel: discord.TextChannel):
await ctx.send("Channel ID is "+str(channel.id))
@drifting wedge ^
Also nice discriminator
What else we can do
Instead of a function
in module.export
what are other things
Like I have a thing
cat: function cat () {}
So person has to do api.cat()
Is there any way he just do api.cat
Heyy, so, I would like to have two not just one (awaitMessages actions). So the bot asks you for something, then it collects your response. But if I want to have another await Message action it will straight go there without waiting for me to response the old question.
Here's an example:
Like, is there a way to set different parameters for both of them and have an await action between them?
message.channel.send('What title?')
.then(function () {
message.channel.awaitMessages(response => message.content, {
max: 1,
time: 3000,
errors: ['time'],
}).then(function () {
message.channel.send('What Description')
message.channel.awaitMessages(response => message.content, {
max: 1,
time: 3000,
errors: ['time'],
})
});
});
Really? Hm
@abstract perch You don't have to create different awaitReactions or whatever
You should use a Message Collector
Tried that but didn't have any luck
And iterate through every question
Probably I am doing it the wrong way
Want me to show you an example?
channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
.then(collected => console.log(collected.size))
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));```
You mean that?
Nah
Oh
If you could, go ahead 🙂
I will be more than happy
I will be here so do not worry, I am not leaving
how to return an array
chuckjoke: function chuckjoke() {
try {
fetch("https://api.chucknorris.io/jokes/random")
.then(res => res.json())
.then(json => {
return json
})
} catch (err) {
throw new Error("An error occurred , error: " + err);
}
},```
it returns undefined
return <array>?
let questions = ["What title?", "What description?", "What BOTTOM TEXT?"], asked = 0, mainMessage = await message.channel.send(questions[asked]);
let collector = message.channel.createMessageCollector(m => m.author.id === message.author.id);
let timeout = setTimeout(async () => {
if (asked !== (asked + 1)) {
await collector.stop();
return message.channel.send("It took you too long to answer my question.");
} else {
// Nothing
}
}, 30000);
collector.on("collect", async collectedMessage => {
questions[asked] = {
asked: questions[asked],
response: collectedMessage.content
};
if (asked === questions.length - 1) {
await collector.stop();
return clearTimeout(timeout);
}
asked += 1;
clearTimeout(timeout);
timeout = setTimeout(async () => {
if (asked !== (asked + 1)) {
await collector.stop();
return message.channel.send("It took you too long to answer my question.");
} else {
// Nothing
}
}, 30000);
await message.channel.send(questions[asked]);
});
collector.on("end", () => {
// Do whatever with the responses they're in 'questions' and there you go
});``` this is just a simple one yet
@abstract perch
Wow, thank you bro
so its a json object which is a promise
So i need to resolve it ?
@earnest phoenix Would like to thank you so much mate. I would let you know how it goes
Np
Yes check out this , I love this one https://www.npmjs.com/package/discord.js-collector
I will in a sec
k
I tried resolving but got an error
SyntaxError: Illegal return statement
I returned a promise
or did I
return new Promise(resolve => {
fetch("https://api.chucknorris.io/jokes/random ")
.then(res => res.json())
.then(json => {
resolve(json)
})
})```
I did some random shit
soooo
@earnest phoenix Idk if that would be possible actually
The questions?
@delicate shore Where did you put that
"seperate the answers with parameters" what params
I put them in module.export
Can you show the file
ok
@abstract perch I literally tested what i wrote and logged the questions to console at the end, idk what you're trying to do
module.exports = {
cnjoke: function cnjoke() {
// code
},
joke: function joke() {
// code
},```
<I said bruh 3 times don't worry>
this is how I am doing all
@delicate shore What are you trying to do?
return a joke
Why not make it an async function and use await
Hm let me see
^^ i did some backwards thing to get the function working one of them would be more of a help to you
Both returns a promise so not making the function async would be a bruh moment
I tried that as well
same error
What's the error
what exactly did you try tho
Wanna see the code
Can you show the whole code lol
let res = await fetch("https://api.chucknorris.io/jokes/random")
let json = await res.json()
return json```
I tried this as well
res.json()
Yes
How do i make it that if someone presses a reaction the bot does somehing? Is there a event for that or what? D.js v12
Use reaction collectors
I would use ```js
module.exports = {
cnjoke: async () => {
const res = await fetch("https://api.chucknorris.io/jokes/random");
const json = await res.json();
return json;
}
};
// some other file
const functions = require("script.js");
const joke = await functions.cnjoke();
@earnest phoenix I am trying to make an embed builder so you do ?embed then you answer every question and then every response will have its own argument/parameter and it will be placed inside a different ${bracket}
Like, collecting the answers and placing them in different places into an embed
Then, build the embed on whatever i showed in the end event and map through them by placing it in the embed wherever you want
@delicate shore or instead of using files you can use a one line code const joke = await (await fetch("https://api.chucknorris.io/jokes/random")).json();
I am using async in other functions like this
joke: async function joke(){}
and it's working
as well
const insulter = require('insult');
insult: function insult() {
try {
insulter.Insult();
} catch (err) {
throw new Error("An error occurred , error: " + err);
}
}```
My code
my error
how can i add commands to my bot
with code
commands.add(commandName[, callback])
i dont even use await
make a sacrifice to discord gods
@abstract perch I suspect, this is what you're looking for?
It didn't place the footer because the raw data isn't actually called footer
That error occurs inside the function itself not in your syntax
Which the function you used did use await inside it but it isn't an async function
yes
Then you can build the embed with it, i just rewrote the last part of what i already sent
collector.on("end", () => message.channel.send({
embed: questions.reduce((acc, current) => (acc[current.asked.split(" ")[1].slice(0, -1)] = current.response, acc), {})
}));```
oh
what programs do you use
that's weird hm
IntelliJ IDEA, DataGrip
kk wait
Waiting for JavaScript syntax highlighting for codeblocks in discord mobile to be added be like

they do have it on the alpha version of discord mobile i think
that stuff you have to apply for
The format is kind of weird
like, how can I define what's title and what's the description?
The alpha discord client build doesn't even have it at all
At least the regular and the beta build has it but only for 5 languages
Python, XML, Rust, Kotlin and ProtoBuff
By questions
I got an error
await is only valid in async function
insult: async () => {
try {
return new Promise(resolve => {
let jokee = await insulter.Insult();
resolve(jokee)
})} catch (err) {
throw new Error("An error occurred , error: " + err);
}
},```
I am using code suggested by flap
Tf
{
insult: async () => {
try {
return new Promise(async resolve => {
let joke = await insulter.Insult();
return resolve(joke);
});
} catch (err) {
throw new Error("An error occurred, error: " + err);
}
}
}```
thanks boi
try {
await insult()
} catch (ex) {
insulter.kill()
}```
That's what i call moments before disaster
Yeah, can't get it to work properly, the format is way to weird
the embed I mean.
Like, I can't define which is a title and which is a desc
You define them, by questions
embed: questions.reduce((acc, current) => (acc[current.asked.split(" ")[1].slice(0, -1)] = current.response, acc), {})
No, it takes the desc as a title
or no
no
sorry
Let's say I want to add the last one
The last one?
What do you mean by that
Oh yea
I meant that as a joke but it should be footer, you should predefine some of the properties which the properties of the questions are supposed to be inside that pre-defined property
Because footer is supposed to be an object
See
I see
Or if you want, you could just pre define all the methods that should be used for a embed property like
// Questions
let questions = [
{
question: "What title?",
response: "",
method: Discord.MessageEmbed.prototype.setTitle
},
{
question: "What description?",
response: "",
method: Discord.MessageEmbed.prototype.setDescription
},
{
question: "What footer?",
response: "",
method: Discord.MessageEmbed.prototype.setFooter
}
];
// After the collector finished
let embed = new Discord.MessageEmbed();
questions[0].method.bind(embed)(questions[0].response);
// And so on
message.channel.send(embed);```
could you not just make a folder in the dir?
or just make the folder the same way you make a normal folder
i wanted to make in commands folder
different folders like admin general
i didnt made any subfolder in my previous bot and that was headache
how do you register commands rn?
just go all the directories and ez
how do you register them now?
if(err) console.log(err);
let jsfiles = files.filter(f=> f.split(".").pop() === "js");
if(jsfiles.length <= 0) {
console.log(`NO COMMANDS FOUND !`);
}
console.log(`LOADING ${jsfiles.length} COMMANDS !`);
jsfiles.forEach((f,i)=>{
let sss = require(`./commands/${f}`);
console.log(`${i+1}: ${f} Has Been Loaded !`);
bot.commands.set(sss.help.name,sss)
})
})```
just make a function
just check if the file doesn't end with .js and if so, rerun the function 😯
and
well
I would make a function and for every file check if it is a folder, if it is, run the function again with the subdir
@delicate shore add a map, make it set to the map with the channel/user ID and the value being Date.now() + <your rate limit in milliseconds> now check if then Date.now() is greater than or equal to the rate limit and return if it isn't
What's the npm package being used for?
Ah
`api.joke() // Returns a dad joke
api.cnjoke() // Returns a cn joke
api.devjoke() // Returns a dev joke
api.insult() // returns a random insult
api.vase() // returns a vase image
api.cat() // returns a cat image
api.dog() // returns a dog image
api.duck() // returns a duck image
`
These all
Till now
Then do what I just said but don't do a map, instead have a rateLimit variable and make it do the stuff I just mentioned without the map
I just said no map
It has nothing to do with discord
What to store in rate Limit variable
Have it in the package
embed.image.url: Could not interpret "{}" as string.
at RequestHandler.execute (C:\Users\Krishan Kumar\Desktop\oggy bot\f\node_modules\discord.js\src\rest\RequestHandler.js:170:25)```
const client = require('nekos.life');
const Discord = require('discord.js')
const neko = new client();
module.exports.help = {
name: "hug",
}
module.exports.run = async (bot, message, args) => {
const embed = new Discord.MessageEmbed()
.setTitle('SOME NEKOS.LIFE STUFF')
.setImage(neko.sfw.hug())
message.channel.send(embed)
}```
?
plssssssssssss
@crimson vapor
@delicate shore when youw rite the package, put the rateLimit in a file
Like make it a function
Every time the bot is written to, call setRateLimit
how do i assign a variable to a number?
??
@vocal sluice le what
how do i run tasks not on startup?
for example if it prints a message every 5 secs
it prints it 5 secs after it starts
not as soon as it starts
discord.py fyi
because they are defaulted to start on_ready
Arent they uhh
Pause method on python
Don't call them on_ready then 
you cant change that
Not a good idea
Keep it outside of your on ready event
Whenever I coded that command , it isn't making those channels
There's something called Ratelimits 
Would suggest that you dont do that
these are there to prevent people like you do bad bad thing with discords api
Ok
hello
how to make a music command at my bot?
discord.js i assume?
I'd suggest looking through tutorials on how to do that, or wait for someone who has a clue about js
I speak very bad English sorry
what language to you speak?
French
Je vous suggère de consulter les tutoriels sur la manière de le faire. Ou attendez quelqu'un qui pourrait vous aider avec les js, car je n'ai pas d'expérience dans ce domaine.
daccord, jai un ami qui sy connais je vais lui demander
Cela semble être une bonne idée, bonne chance !
I’m a dev B)
so am i 
How can I make something like:
let prefix = '@everyone'
if (!/(prefix)\w/.test(message.content)) return
You don't
then how can I make something that the bot will run only if its the prefix then a letter after the prefix
slice the content by 0 and the prefix.length + 1
that works aswell
Gg
Am i doing something wrong?
const ms = require ("ms")
const Discord = require("discord.js")
const client = new Discord.Client();
module.exports = {
name: 'ping',
description: "this is a ping command!",
execute(message){
message.channel.send("Pinging...").then(m => {
let ping = m.createdTimeStamp - message.createdTimeStamp
m.edit(`pong! (${ping}ms)`)
})
}
}
im dum
re
ya problème dans le statut de mon bot, jai re entré un nouveau statut mais lancien veux pas seffacer
c avec bot désigner
Vous faites probablement tourner le robot deux fois
Attendez un peu et voyez si quelque chose change
Anyone know how to use better-sqlite3 as a database?
Which Database Do You Use Right Now?
None
yo any advice as to creating a kill feed
im new to the code world... just looking to be pointed in the right direction
But i want to use better-sqlite3 @earnest phoenix
quick.db wio.db
Sorry I did not read
its ok
Yo uh, how do i save files in micro?
you don't
oh ok
anyone know the length of a rate limit?
for discord
because i think my bot got stuffed from it
i am getting no errors its just not turning on
djs
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
hmm
ok i just tried with a different bot token and it works
so i think i did get rate limited
how to make discord bot leave a voice channel?
js?
yup
check your bot application
your bot probably got quarantined
So i have config.json i want to acces trough command handler and i use this ("../config.json")
But it cant find it
const Database = require("better-sqlite3")
const db = new Database("../db.txt")``` The code i use in that file
currently trying to download backups of my mongodb before uninstalling to reinstall, but I can't access them because missing permissions, so I chowned, and I did ls -l but it's still root
disconnect
I managed to fix the permissions by adding /* at the end of the chown command
this is so frustrating, I need help
hoi
heyy
Can you suggest some functions i should add in my api
It has currently these
api.cnjoke() // Returns a cn joke
api.devjoke() // Returns a dev joke
api.insult() // returns a random insult
api.vase() // returns a vase image
api.cat() // returns a cat image
api.dog() // returns a dog image
api.duck() // returns a duck image```
Any suggestions?
@delicate shore i don't have any suggestion but i just wanted to say that i really like your logo
lol pfffffff mine is ugly
oooooo
how would I go about fixing this again? I am trying to connect to the mongodb installed on a vps.
How can I make my bot change 32131 to 320K
?
you mean 32k
yess
rounding and something else
How '
which lang
js
Math.round()
Help me
Now buddy, I can't make a top. gg background while I'm doing the site, so it's kooyaed everywhere, can you assign this background code
ok
Command raised an exception: TypeError: 'int' object is not iterable
what does this error mean? (py)
are you trying to make a loop (i dont know py)
yeah
i was hoping for this #development message

I'm doing it, but it's copied, it's scattered everywhere, there are a million of them.@summer torrent
please learn basics
the message is pretty clear, you can't loop an integer
I know the basics but it's not happening, getting too big, finding a big gif, getting smaller and dying a million
@summer torrent
ty
Weel
here Is Such A Thing. Have You Read This?
tbh best is to force light theme and change it to dark theme through your own css
better control
I figured it nvm
how to use use this in the command?
SetTimeout(() => {
}, [10000]
Does anyone know how to see cluster ping on discord.js mongodb
@ionic silo
message.channel.send('abc').then(m => {
setTimeout(() => {
m.edit(`abcde`)
}, 1000);
})```
or
message.channel.send(`ab`).then(async msg => {
setTimeout(() => {
msg.delete()
}, 10000)
})}```
and so it goes on
so the top one is the message is edit to abcde and the bottom one is delete the message?
thank you
yea
How can i host my bot 24/7?
with a vps
A virtual private server (VPS) is a virtual machine sold as a service by an Internet hosting service. The virtual dedicated server (VDS) also has a similar meaning.
A VPS runs its own copy of an operating system (OS), and customers may have superuser-level access to that operating system instance, so they can install almost any software that run...
Ok
Thanks
How I configure?
would recommend researching on google for that
for mine i just use my own linux server
you can do it on any old laptop but its abit inconvenient
thats a mention not a snowflake
Yes
Yea I read error and got it
Thanks for help tho Erwin
np
sudo apt install nodejs
you can use that for most linux installs
np
i would recommend doing sudo apt-get update && sudo apt-get upgrade if you have installed your linux os recently
what is the name of it?
here
np
ive had no sleep and i forgot for a min that other linux os dont have the same commands
😂
ive got ubuntu server installed so its pretty easy to install stuff
what machine are you using to run the os?
hardware
ah ok
i run my linux on
raspberry pi 3b+
its a tiny computer
XD
its great for bot hosting if its relatively small
What is the best place to host a bot cause i need a database.txt file in, but idk how to get it in on heroku, any help to host i can use instead? That is free
Im working on a extention for my bot
Thats why i need database
i wouldn't recommend using a txt file as a database
what then
sqlite
what language?
ah sorry cant help there, i code in python
hmm
you haven't provided any info for the people who do know js
TailwindCSS examples if anyone's interested 
https://play.tailwindcss.com/EqzgborLga
https://play.tailwindcss.com/8Mc13LJarA
https://play.tailwindcss.com/DthqXA6orH
bot.on('messageReactionAdd', async function(reaction, user, guild){ how would i get the person who reacted and then be able to dm them
because reaction.message.author.send dont work
like so i have a role called Game 1 how do i make it so each time it is created it goes up in number
number = 1
for role in someIterable
create role
number = number + 1
why don't just enumerate it
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.title {
text-align: center;
padding-top: 50px;
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS",
sans-serif;
font-size: 50px;
}
.titleBackground {
width: 100%;
height: 200px;
background-color: lightblue;
}
.titleBackground :hover {
background-color: yellow;
}
</style>
</head>
<body>
<div class="titleBackground"><div class="title">Test</div></div>
</body>
</html>
``` Why is it not all yellow ? I want all the blue to be yellow
set its (min) height to 100vh
huh?
I want all the blue to be yellow
for some reason only the half until the bottom of the text is being yellow
You set it so it's yellow when you hover over it
yes i know but why is the blue left over
Because in the .titleBackground rule you set the background color to light blue?
It will be yellow only when you hover over it
otherwise it will be blue
you can add padding-bottom on title class, but pretty sure there's better way to do it

hmm
yes it is expected that if i hover over it, it will be yellow
but it is not expected that there will be some leftovers on the bottom
Try adding display: inline on the title class
need a bit of lavaplayer help
im trying to figure out how to do equalizer shit, but ive genuinely no clue what im doing
Excuse me
my bot wont do commands since ive added my ban command could u help
could we call and u help?
I need help
const lb = leaderboard.map(e => `${e.position}. ${e.username}#${e.discriminator}\nLevel: ${e.level}\nXP: ${e.xp.toLocaleString()}`);
it throws leaderboard.map is not a function
I need to delete a Command for deleting the post my bot makes, please help. Javascript will work
@earnest phoenix I do not get the question, what is the problem right here?
then leaderboard is not an array.
Show the command code, and the error you get
I need to delete a Command for deleting the post my bot makes, please help. Javascript will work
But what does that mean?
I guess he wants to delete messages with his bot
So my bot does this
And I need an opinion to delete it
Well, message.delete() usually does it, assuming discord.js
No, is a javascript function tho?
It's a method of the discord.js Message class.
"javascript" is a language, but that doesn't tell us what library you're using, and every library does this differently.
Does discord.js us javascript
yes.
Yes
But... like... you're probably already using a library, so you need to use that library to do this, not another one.
I got it
I don't
Then use powershell to add discord js
yo they already have a bot man, they don't need a step by step beginners guide 😛
How do I make it select the last message sent by you
It depends. Do you want to delete that embed on a reaction? Or how?
What 😂
I'm confused here. You should know what you want to do - this is your bot, you made it, we can't tell you what you want to do.
I've been helping people code bot for 4 years, if you want help, you have to ask the right things and answer the right questions.
The question was: what is the trigger for you deleting the message? How do you want to tell the bot to delete it?
You're not going to get anywhere starting from scratch.
Are you not able to answer the question I asked? I can help you if you do.
No one can help you if you can't answer that question.
Deleting your message pretending our conversation didn't happen isn't helpful either
you're removing very important context for people to understand what's going on.

Leave me tf alone
Interacting with humans is hard, on this planet. I don't know how y'all do it >.<
I need to delete a Command for deleting the post my bot makes, please help. Javascript will work
Yes
discord.js?
Javascript will work
<message>.delete() is the easiest way
well there are different libraries which one do you use?
Idk what that means
is that bot designer? lol
If that BDFD? They're a special little snowflake, you'll need to ask on their server for help on how to use it.
I can't
are you banned?
I am
why lol
yo
how did you pull that off
eh
I'm guessing behavioural issues and getting angry that people ask questions when they want to help? 
LOL

or complaining when not receiving help?
well anyways we can't help you then
LOL
Thank you
ye, nobody here uses BDFD sorry
i didnt say i want help togira 

i mean, i've seen some people use it, but the vast majority here doesnt use it
bye
I need to delete a Command for deleting the post my bot makes, please help. Javascript will work
Yo, we can't help you, stop.
Nobody here can help you with BDFD, because we're programmers not button mashers.
i can see why he was banned
yeah right there aren't much people here using what you use
out of 5000 maybe 10 use BDFD, and 99% chance none of them are online
That's what you're trying to say rn
We're telling you, if you keep saying "javascript will work" without telling people you're actually using BDFD and how/why/when you want the message to be deleted, you're not helping yourself
we are just being realistic
No you're not
You need to actually know how to describe problems in the first place. Your context is very important.
we are
Ok byeeee
if they were online they would have replied. your best bet is to ask again every 30 minutes or so, and ask if anyone uses BDFD
bye
How do i get members array now in discord.js v12?
guild.members.cache
How can I add commands to my bot
you code them
yo quick question, what is BDFD? 🤔
bot designer for discord, at least i think thats the full name lol
Yep, that's it.
its an app on google play
yes
yes
lmao
and ew bdfd xd
exactly
can I draw a discord bot and generate a code from it
wat
is it working in new discord api?
with an advanced library that converts images to stuff
There's no "new discord API"
i used it to make my friend an bot so it wouldnt take months and ew its trash
think they mean the intents and stuff
If you mean intents, then, in order to get the full member list, you do have to fetch all the members, and that means, you would need the GUILD_MEMBERS intents.
You probably don't need it, so it really depends what you're looking for in the members cache.
but discord.js is deprecated and no longer updated, never updated to work with the new intents and stuff
ohh once I'm being here, if I want a listener on "guildMemberRemove" I need that presence intent or however it's called right?
what? no?
wat
discord.js is absolutely not deprecated, what are you talking about
wait huh???
I'm using d.js works super find
Discord.js V11* is deprecated. The one from, like, a year ago. V12 is fine.
fine*
and v13 will be released soon
are you guys still talking here 
ohh once I'm being here, if I want a listener on "guildMemberRemove" I need that presence intent or however it's called right?
For each member add role.
I mean you shouldn't do that, add the same role to all members, to be honest.
There's already a role that affects all your members. It's the @everyone role.
hi
evie
you need the server members intent
you have to enable it in the dev portal yes
what's the difference between Fetch API and XMLHttpRequest
And when verifying you have to request it to Discord, and... well... they probably wouldn't give that for someone that just wants to give colors to their users wiht a role. 😄
one is new, the other is old
xD
lol
fetch is a browser library that's more modern and easier to use, XMLHTTPRequest is not quite deprecated, but is much more difficult to get started with for simple HTTP requests. Still used for other things though.
speaking of new, what's the difference between aFunction() and new aFunction()
class?
yes
Then again new is actually not mandatory when you create a new class with no constructor options
but you can execute new keyword on any function
because js is wonky
and w3schools.com uses normal functions
Here, this should help: https://js.evie.dev/classes
And w3schools sucks hairy monkey balls, don't trust it or use it.
also, classes were created with objects before ES6
new keyword just inherits the prototypes from the class/function and nothing else amirite?
and a lot of other hacky ways
yeah the whole prototype thing from the 1990's is a bit awkward and imprecise.
is this your website?
yeh
how do i get code to add command
I'm... good at explaining things very simply, I guess.
I will use that as future reference if I need help with js :)
Step 1) Learn the programming language you want to use
Step 2) Choose a library for that language
Step 3) Actually start coding
lmao
thanks
watch him ask the exact same question 15 min later
ffffffffffaaaaaacccccccccccctttttttttttttttsssssssssss
that looks like you're swearing
relevant: #memes-and-media message
"facts" would be enough but yes I agree
lol
I'm bored
starred

I was the first one to star that

Alright so anyway, does anyone have #development -related questions? 😛
Don't be shy, speak up!
my code no work pls halp
well i have a serious question about js that i've never seen answered anywhere
why are arrays in js so damn slow
compared to string operations
for example
Because we said so
~ V8
why won't my bot work (i coded it in google drawings)
if you have 100k items in an array, and you want to find 1 item, it takes 10 times more time than if you have 100k items in a string, delimited by whatever, and find the item in the string
@hollow sedge what the fuck
Exactly
can you fix my code
That actually could be a thing
but why
I don't wanna be here any more byebye
no pls help me
Because they're less real arrays than they are... "dictionaries". real arrays have a fixed length and usually a fixed type so the array can be seeked by start memory position + (index * array item size) , but you can't do that in JS. So JS arrays suck .
FREE CODE FOR BOTUMS! (WORKING 2020!)
console.log("figure it out yourself");
process.exit();

makes sense
This is why in, say, Java, you need to actually define an array of fixed length and type.
there's already discord bot designer if you want to be lazy
im working on a project that will require caching of about 15mb of string data, compromising of 500k items
Or, really, any strongly-typed language, and especially closer to the hardware you get.
Because they're less real arrays than they are... "dictionaries"
map has left the chat
and to find 1 item in those 500k takes 100ms via arrays, an 2ms via string.indexOf()
wait what? FIXED length?
"find" how though
not to mention that converting the string to array makes it waste 3 times more memory
what makes a discord bot good???
optimisation cannot be linked to generalisation. They're mostly contrary terms. (mutually exclusive)
that the developer does not beg for code/help and learns to do some stuff on their own instead of whining they can't do stuff
the idea and the way this idea is implemented
i've tested everything, string.indexOf() is the only thig that is faster than using exec + grep, seriously
A good programmer makes good code which makes a good bot.
grep is faster for everything else
If you're looking for performance, javascript is the wrong language.
chrome has another reason to eat ram because browsers don't use stuff other than JS
JS's idea of performance is "scale more"
i know but if performing an in-memory operation is significantly slower than performing a disk operation, something is seriously wrong
thats here im butting my head
One that can break out of the catalog of genericness
regardless of how slow js is, in-memory operations should not be slower than disk I/O
Well... again it depends how you do your find/search
i tested everything
no no I mean, what specifically and exactly are you looking for?
have you tried maps
yeah but each tool has different uses and optimisations
looking for "abc" in a string, of course it's gonna be faster to do a full string search - hell, regex can do it
If you're looking for a string in an array containing something, find() would be good enough
if you're looking for something at a specific key, then an Object is faster
umm i can't enable spotify secure web playback in brave
you can't compare JS with grep, it's just not even the same ballpark
not to mention converting 500k strings into an object makes it use 200mb of ram instead of 15mb for some reason
grep is, what, assembly? fucking binary? it's code that's compiled down to the barebone
versus an interpreted language
im not comparing the languages, im comparing disk vs in-memory
the comparison is wholly inadequate, and absolutely unfair.
lol evie thx so much for the link to your website I understood everything about classes now
grep performs a disk operation, it reads the file from disk. while performing an in-memory operation, even if less efficient, should be faster

Yeah but the reading of the data, compared to the actual looping through it, are two different things
maybe grep loads single files real fast because, again, it's a super barebone compiled tool that's been optimized for decades even before JS existed
i did enable it why won't it work now
um idk
its still a disk operation, thats why i was scratching my head, like i wanted to cache the data in memory to have faster lookup and access times, only to be crushed by grep lol
windows caveman edition
~cry 2020
if you come with a problem running windows ooga booga edition people will tell you to just update
yes
<3
ly cry
I'll repeat: the comparison between a tool that's been optimised for the last 35 years versus an in-memory interpreted process is absolutely unfair
this isn't apples and oranges, this is bike versus maglev train
is coding part of your job?
who compares apples and oranges anyways
I'm a web developer yeah
okay makes sense you know so much haha
is windows 7 still popular in usage today
yeah
no matter how many years of optimizations you have, you are limited by I/O performance
so i was surprised
thats all
I've also been working with JavaScript for almost 25 years so... yeah there's that.
you can certainly ask here and I can answer if I'm available 😉
boomer
Guys, I created a command. Is it that flashy to make epilepsy go BRR?
Bruh
Same here
Discord you living clusterfuck of all broken things
Wrong format
raw
just send an octet stream
It's used quite a lot in Kazakhstan. At least in my college all PC except teachers' have Win7
just mark it as spoiler and put a warning :)
my school recently updates all pcs to win10
didn't microsoft drop windows 7 support though
But in my school we had Win10, so they're probably moving away more and more from it slowly
Yeah
yeah
yikes
just fucking upgrade ffs
i hate my school
The computers keep showing that activation popup
or code913 apparently
or because you will execute rocket science and blow up your already terrible computer trying to install windows 10
when banks are supposed to be one of the most securely made places in the world but you find out they run trashy written BASIC 😩
i mean it can't run windows 7 properly
makes sense that they wouldnt want to break that though
written in matlab™️
im scared to go anywhere near matlab
wait we have rules channels in discord now?
we had it since the community servers update
they just have a different icon now
k
i mean is there really a point for a rules channel if not for the icon?
nobody: reads rules channel
things are looking like discord is going to implement the option to enforce reading the rules channel
downfall of discord incoming
how would they enforce that though
the only thing they can do is make you wait for some time or have you scroll to the end
language war 6218
your function is empty
im doing something
^
not may be, that is why 
hi
off i go
the error is 100% because you didnt put anything inside the function
yes well im doing somthing like i said the last 2-3 times
then finish it before running, otherwise put pass
It's saying the command is invalid 😭
Yes
bdscript?
Yes
@zealous helm join the bdfd support server lmao
and you used a var?
I never thought about that
vars are only used for commans to set a value like numbers or true/false
so unless you have an var named what var you put inside there it wont work lol
WHAT
That's subjective
i guess
And it's setup properly
Can't you also use javascript?
Yes
its very limited
instead of that shitty language
Not hating on a bot
i used it for about an month and said fuck this
they said they are banned
lmfao

i wonder why 
look up their message history in this channel and you will get an answer
wow this kid is stupid, annoying, ignorant and also likes to be an asshole too eh
well I wouldn't say it like that but okay
well
Not talking shit 😂

bruh
Not missing the context
ypu like to be an asshole so idk man 
it was ridiculous what happened
doesnt give you the rightto be like that tho
yeah
Be like what

an as hole, telling people to stfu etf
being rude to anyone and any staff member in general is a bad idea
Bruh
^^
What was happening


You dek
dek?
dek
ic
dek lolol
I have a strong feeling this guy is under 13
It's all good
lets ask them
I love you all
how old are you?
with a temper and pfp like that it is sus
how old are you younglin
google knows everything yes xD
lol
xdddddd
Looking for help with my bot
I agree

Dead ass
hmm I wouldn't report if I were you, just my personal advice
that's why
if anyone's harassing its you
loollllllllllooo
I'm reporting
if this was reportable and/or punishable 99% of the internet would be snapped out of existence
brb reporting my self for harringsing my self lolol
I'm looking for help with my bot
how old are u bud?
nobody here supports shitty third party scripting languages
we told you earlier that best for you is to join that bot maker thingy's support server








