#development
1 messages · Page 1949 of 1
I'm uhh, reading the file 1000 times a second
Wtf
why are you reading a file 1000 times again
I dont exactly understand your question but based on whatt you said ima guess you want this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in
Cache it for a specific time at least

I hope you weren't reading the same file 1000 times
I will take that as a yes
Huh?! I can’t follow anymore
lol
They were reading the same file 1000 times
He*
dont be one of those people rn please
kk
im too tired to care about your pronouns

I assume they were reading it 1000 times to get each item in the list in that file
Well may I say that is dumb when you get everything on the first read
good
Depending on the format of the contents of the list you can always just loop through the returned stuff by turning it into an array some how.
I'm splitting it up yeah
Counting indexes and when indexRightNow is high then length then back to 0
@earnest phoenixnot worked
does it exist a npm that opens all the files one by one every certain amount of time?
confused
like the npm will open all the files every 5 mins
but not all the files at once, it'll take it's time and open 1 by 1
You could write a script that runs every 5 minutes (e.g. with setInterval)
And just set a rate limit to do it sequentially.
You'll use the fs module built-in to Node.js
You should do research on it so you know how to use it.
Since you can read and modify files and directories with it
yeah I know a bit how it works
thx
I heard/read that replit doesn't save the files if you're not there but it's possible to skip with this function
u mean that replit can't save files or write file?
and replit will skip the write function
?
I meant discord doesn't save files that change by commands when you're not in the repl, and that includes file based databases like .sqlite so I read that with that function it can be bypassed somehow
sorry for being confusing, it's because it's late here and I don't wanna get caught
I'm awake
How would I set the VC channel of the bot on startup?
If you don’t create a channel for your bot, you may need to find a(ny) voice channel and join it
e.g. channel cache > find channel by type
fs D.E.A.D https://www.npmjs.com/package/fs
then?
You can require("fs") like a regular module.
const fs = require("fs") will work just normal?
tias
Yes
Or you can use ES6 imports as well
however you want to
I used it with nodejs before in an app
it gets quite messy ngl
you need to know if you really need it first
most of the time a simple object/map cache is enough
its for an api
- you get no overhead
you don't really need it unless you'd for example have many different clusters where it would be useful to have a shared cache and if you want to take advantage of long-term storage, events or data compression it offers
or you want it for the cool points
its more to prevent too many unneccesary db checks
you can just use a local cache for that
oh ok
its purpose is for bots to check user id's on join, which means there will be lots of api calls
literally something as simple as
const cache = {};
cache["12345"] = { user_id: "12345" };
don't think there's too much of a difference between a map and an object as a cache in js other than interface methods
though tim did say objects are a bit more complicated behind the scenes so maps will probably be better
fs.read("filepath") will open the file, read it and then close it?
hello, I have trouble with something I find weird(?)
im using djs v13.2.0 for my bot's code
the issue at hand is:
guildMemberRemove does not fire/execute after a fresh start or restart of the bot until I manually trigger the event with a emitting it or the same member leaves/gets kicked twice in a row (in the time span of up to 5 minutes)
what would be the cause of this?
you need to enable guild member partials
yes and guild members as well
enabled on the developer portal and intent is taken upon starting
Enable debug log level maybe?
what's that exactly?
as i've done console logs in before and after specific parts of the code
literally on the first line of the module exports and it doesn't log even that lmao
do keep @ me for further answers, i'll see when i wake up, but yeah intent is enabled, the thing is enabled on the developer portal for the unverified bot and it works as intended after manual emit of the event with eval or kicking twice the same user in succession (time frame of up to 5 mins but it is unconfirmed)
Can the intents actually be an array of strings?
Not flags or simply their numeric values?
yes, as it works as you see it on the image
Log level
Idk if node has that tho
At least in java all loggers have at least 5 levels
Trace, debug, info, warn, error
In debug pretty much all operations get logged
oh that, yeah i have debug enabled
however even then nothing happens, its as if the event literally doesn't exist lmao
aight
Do note, be quick since trace will spam the console
Easily 1m lines in a few minutes
if i know what are gonna be the spammy messages i can ignore them
for debug i've excluded heartbeats
partials, not intents
yes
oh dear
a contributor figured out how to run a D++ bot on repl.it
so its the beginning of the end lol
He figured how to run D++
it isnt simple to do 🙂
we made it simple, though
you have to extract the content of a prebuilt deb to your home dir, and reference it in the g++ commandline
because they dont give root to install the deb properly 😦
partial should be enabled now
oh wait its member not memberS
ok enabling the partial did it, it works now after the first time
yay i got half your token, brb gonna half hack your bot /s 
oh fk
nah its ok
i actually should make it exclude that
your code obsured the last half

cant do anything with it hence the /s
but i found it interesting it'd show anything at all
uh yeah
thats because of the debug logging
perhaps 1 sec lemme just make it display it in the bot's status real quick

ik ik, i'll make it ignore the message with the token
Or like this (required field)? https://discord.js.org/#/docs/main/stable/typedef/ApplicationCommandOptionData
which comes from client.application.commands.set
oh it's there
most class instances have some client property
e.g. a message
goodluck grabbing my token now 
If not that would require a second login (instance)
Thanks for saying it, Klay
Damn writing the objects by hand is so much shorter and looks way better
And let’s you understand what you actually do
aren't you able to pass the client from the main index file to this command file?
right
He already has as interaction has client as property
all the pattern is good for imo is validation
interaction.client
Magic
The client who has initiated shit is attached anywhere in djs, messages, interactions, etc.

That doesn’t always be the solution
I’m also passing client to my modules
But in your case it’s not required
If you pass the client as argument since you defined it as parameter in your execute function anyways why don’t you use it there?
it's also just more flexible to get it from the property
if, for some reason, you wanted multiple clients, a property would make that work vs. a global variable
In his case it is but the structure not always includes the client which makes it sometimes required to pass it
But as I said in his case it is already accessible
You handle the options by their unique IDs you better define
setInterval(() => {
fs.open('json.sqlite', 'r', function (err, f) {
console.log('Readed!');
});
}, 5000);
``` will this work to make replit save the database even when i'm not in it? As i've read, this saves the file in the memory after reading
¯_(ツ)_/¯
how do you know? maybe you tried yourself
so any solution or anything?
Heroku is shit so i'm trying to solve this...
yeah
yeah
will it work?
ok
it's 3 AM rn so i'm going to check it fast
oh thx
i won't judge
railway looks amazing and the bot is just what I needed, same type of code as mine I thought you were using the class things
but what happens with the db tho?
it won't restart like heroku?
and if we change the github repo, it will change too or we have to re-deploy?
oof
oooh
you're genius
wait you're trying to use fs for sqlite?
yeah don't do that
use some package for sqlite databases
if repl.it doesn't allow it for some reason you don't have many good options
and uploading the database to github isn't a good option either
still not a good option
you've version controlled a database
what packages?
committing the database file to your project is to version control a database
which is github
that being the problem
I’m actually sure it does, maybe the method has a different name
Version control systems like git are meant for source code/files about the project. There's data that will be generated by the run project that shouldn't be committed, and one of those are databases, as those are meant to be locale. It's often worse for version control to handle them since they're not optimized for the format they're written as.
Like, imagine a dev committing your account settings in a version control system they'd retrieve and download along with your project. You can't delete any of that data as well (history).
I get why you want to do it, but it's not a recommended use case.
I mean you can simply add required = true to the object manually
@earnest phoenix do you actually speak about slash command options?
Or did I miss something
Oh then maybe i version controlled it @sudden geyser. Is it harmful?
Well it is
Notice how .setRequired(true) is specified within the options builder. Setting this will prevent the user from sending the command without specifying a value for this option!
Generally you shouldn't do it
You may didn’t use it on the option but on the slash command
I don’t know I’m not using the builders
But adding setRequired here causes an error?
Just show me what you did
So I can?
nah better I make a new repo and do what wass said
or it's still version control?
still version controled
oh
having repositories just store data is generally not a good thing, but it doesn't mean you can't do it
for example, jetbrains allows users to set up github repositories to store user settings across IDEs
and I use that
i'll search a bit for npms to fix replit thing if there isn't any i'll do this
Ok that’s 1 min support out of 1 hour
That means my invoice includes 1 hour of work
but the replt's db is 50mb large I think
Are .db files good for js?
an extension is just an identifier. it doesn't restrict the contents of a file
so a db file could be anything. what do you expect in that file? an sqlite database?
a key value database?
It's just JSON renamed to .db
Oh okay
Ok lol sorry
Or use the report feature on the site
Oh yea
🧐
hi
how to solve this error
java moment
😂😂😂
how do i see if i already have requested intents access?
Because i did it yesterday, but i haven't received any confirmation in my mail or something and it is again asking for verification:
If you already applied just wait for a response back from the review team
sure
Pretty sure it says apply no matter if you already ahve or not
ah okay. Thank you! How long does it usually take?
how to get msg link in discord.py
got blocked
something similar also happened with me
too bad mobile replit doesnt have terminal
it must be discord issue now its fine
its not tho my bot still works
idk know then but do you know how to get msg link in discord.py
if you have a laptop , go to your repl terminal and kill 1 (not always work)
how to get msg link in discord.py
answer please 🥺
wdym
link to message which triggered event
wut?
something like this #development message
oww
i mean the keyword whats the keyword for getting msg link
jump_url ?
This is the url*
hold a msg click share whatever the link it give you there
he didn't understand what msg link even is
explain him not me
why me
he further asked which link you are talking About
right here
im asking you lmao
just leave it
nvm idk either

Huh
what is the limit of creating invite links
Create a variable named "foo" representing the integer 0.
For every index within a range of numbers from 0 to 5, do the following.
Add 1 to foo's value.
Output foo's value into the console.
0
1
2
3
4
How fast can you edit a message with it still being allowed?
As probably changing a message every 2s is not allowed? :p
edits count towards the same limits as sending messages
so, 5 messages per 5 seconds per channel
so if you edit it twice every 5 seconds, you can only send 3 other messages in the same channel at any moment
but libraries will throttle those edit calls for you
but for some reason despite this topgg still declines bots that trigger this automatic throttle
dont ask me i dont make the rules
"Just because you can do it doesn't mean you should" ftw
wut
wut
go back to OS dev
I will:(
it is terrible
how to deal with this annoying thing
embedded system developers/windows devs better be getting paid a fucking million every year
otherwise it's not worth it
hello
you got temp banned from discord for exceeding the rate limits
the ban usually lasts 1 hour
for exceeding the rate limits
rate limit of what
idk
what should I do
everything has a limit on how fast you can do things
how many times you can try to login every 5 seconds, how many messages you can send every 5 seconds, etc
you did something wrong which caused your bot to try to send stuff to discord way too fast
the only thing you can do is to wait 1 hour for the ban to be lifted
i am sending code wait a min
then double check your code to avoid doing such things
if "blah" in message.content:
if message.author.id == 294882584201003009:
link = await message.channel.create_invite(max_age = 0)
msglink = "https://discord.com/channels/"+str(message.guild.id)+"/"+ str(message.channel.id)+"/"+ str(message.id)
GaTimeone= message.embeds[0].description.split("Ends:")
GaTime = GaTimeone[1].split("Hosted")
for guild in client.guilds:
channel = discord.utils.get(guild.text_channels, name='specific channel')
if channel:
GA_msg= discord.Embed(
title="title",
url="url" ,
description=
"\n---------------------- \nbah==>" + message.embeds[0].author.name + "\n---------------------- \nblah==>" + str(GaTime[0]))
GA_msg.set_image(url=message.guild.url)
GA_msg.add_field(
name="join link",
value="[" + message.guild.name + "]("+ str(link)+")",
inline= False)
GA_msg.add_field(
name="message link",
value="[msg link]("+ str(msglink)+")",
inline= True)
await channel.send(embed=GA_msg)
@quartz kindle
Use f-strings please
what should i do to not make it exceeds rate limit
One way of doing it is adding an interval with asyncio.sleep
another way is using cooldown
Make it wait a second or two before sending a message
^ Cooldown sounds good too
but it works on event not command so cooldown will be difficult
A manual cooldown system isn't that hard to make
why would people torture themselves with event
what if I wanna do time.sleep and freeze the whole bot???
Break your fingers please

ok:(
its not difficult to make but it just interfare with accuracy of whatever the bot is meant for
Eh, cooldown is optional and none of my business
Ooooof Tim
evil Tim = good Tim
you would have to be beaten as a child every day and bullied on a regular basis to be able to mentally handle os development
did i enter chat at the wrong time
yeah come back in 20 minutes
be careful, you never know what happens next in here
@spark flint add this to topdotgeegeeoutofcontext
Lol
what is the url for the site
@remote chasm omg thanks!
@remote chasm stinky
😂
wut? that russian domain is a fake me?
Pun intended
russian domain
someone in here was talking about canvas yesterday. it inspired me to go and finish working on a concept I had. Basically, my bot runs ina docker container, and there is a netdata container that runs alongside it to track system metrics. I was able to write a little module to autodetect the container id, then communicate with netdata via a hidden network to poll it for system data, which I then used chart.js and canvas.js to make all pretty before sending back. I'm mentioning it here in the hope it inspires others! ❤️
I doubt it got registered in RU from outsite somewhere
my gosh... English very good today
@rose warren
awesome
ty ❤️
app.get("/generate/:id", async function(req, res) {
const userid = req.params.id
const data = await users.find({userid:userid}).toArray()
if (data) {
const json = { "Name": "Capy.host", "DestinationType": "ImageUploader, TextUploader, FileUploader", "RequestMethod": "POST", "RequestURL": "https://static.capy.host/upload", "Headers": {"Authorization": data[0].apikey}, "Body": "MultipartFormData", "FileFormName": "file" };
jsonfile.writeFile(`${userid}.sxcu`, json, async function (err) {
if (err) console.log(err);
res.download(`${userid}.sxcu`);
fs.unlink(`${userid}.sxcu`);
})
}
else {
res.send("Unknown user!")
}
})```
C:\Users\Churt\Desktop\Projects\capy.host>node app.js
http://localhost:5000
node:internal/errors:464
ErrorCaptureStackTrace(err);
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined
at makeCallback (node:fs:186:3)
at Object.unlink (node:fs:1702:14)
at C:\Users\Churt\Desktop\Projects\capy.host\app.js:24:16
at C:\Users\Churt\Desktop\Projects\capy.host\node_modules\universalify\index.js:22:54 {
code: 'ERR_INVALID_CALLBACK'
}
You might want to give a callback to fs.unlink() or use fs.unlinkSync
getting a new error now 
or use the Sync version
its not actually saving the file so its returning an error
hm
okay good boy
await jsonfile.writeFile(`${userid}.sxcu`, json, async function (err) {
if (err) console.log(err);
res.download(`${userid}.sxcu`);
fs.unlinkSync(`${userid}.sxcu`);
}) ```
whats the error now
yes
Error: ENOENT: no such file or directory, open 'C:\Users\Churt\Desktop\Projects\capy.host\471409054594498561.sxcu'
Oh
making a file generator 
you need to JSON.stringify the object
ohhh
i dont understand why you're saving it to the disk tho
how do i return the file without saving then
he's saving then deleting
yeah
so he can throw a pre-generated config for sharex stuff
yep
its still not saving tho
await jsonfile.writeFile(`${userid}.sxcu`, JSON.stringify(json), async function (err) {```
Dont do it there
ah
it wont work like that
Because you're mixing callbacks and sync
never has for me
const json = JSON.stringify({ "Name": "Capy.host", "DestinationType": "ImageUploader, TextUploader, FileUploader", "RequestMethod": "POST", "RequestURL": "https://static.capy.host/upload", "Headers": {"Authorization": data[0].apikey}, "Body": "MultipartFormData", "FileFormName": "file" });
should work
ohhh
That makes zero difference
now the issue is the file not saving
oop no fixed that
moved from the jsonfile module to fs
fs.writeFileSync
but its not sending the file
You could always just not save the file and use buffers instead js res.writeHead(200, { "content-disposition": `attachment; filename="${userid}.sxcu"`, "content-type": "application/json" }).end(Buffer.from(JSON.stringify(json)))
oh that works
epic
ty
wait no
because that makes the file then not work
"{\"Name\":\"Capy.host Uploader\",\"DestinationType\":\"ImageUploader, TextUploader, FileUploader\",\"RequestMethod\":\"POST\",\"RequestURL\":\"https://static.capy.host/upload\",\"Headers\":{\"Authorization\":\"f2fec1455875c99fed5db44424ae919c6c1549d9a95f6048e0ca2d5e\"},\"Body\":\"MultipartFormData\",\"FileFormName\":\"file\"}"```
it saves like that
is that really necessary tho
fixed it
You just stringified the stringified JSON lul
res.writeHead(200, {
"content-disposition": `attachment; filename="${userid}.sxcu"`,
"content-type": "application/json"
})
res.end(Buffer.from(json))```
you could literally send file data for download
without saving it to the disk
and then deleting it
it doesn't save it anymore
that's basically what i think would be better yes
yep that all worked thanks
this works? or console.log?
console.error(error);
And... Why it's not coloured anymore?
when I installed it, it was more colourful
now it's like replit
I changed the theme from dark to monokai and it looks better
yall need more synthwave84 in your life ❤️
y'all need more of this guy in your life
tim face reveal
Dont even know who that is
But he looks like the kind of guy who sits in the ally way behind stores trying to sell drugs to kids
thats exactly my point

Lemme guess... guild ID 925571069539131422
Same as 924190330604113980 922525849050300446 903880326475051028 etc.
All bot test/spam guilds
anyone has a list of those? i need to check my bots as well
huh... don't u filter them out when joining?
no
What's the point of those servers anyways? To break bots & make them use more resources?
i dont have members intent
I don't have that, too but simple filters as name filters are quite successful
anyway it wont really matter once i move to slash commands
wtf
A few more you can sort out
893235932336095272 872038092264058941 902348231567106049 529023183391555594 804009231845163018
all got flagged for spamming or inviting random bots the whole day long
👍
i've changed from replit to railway and vsc and git so here what do I put?
in URL, it's replit project's http url
I put railway's url?
railway.app/project/TOP-SECRET
discord webhook url?
this?
He's speaking which URL to put on topgg
omg NO
You create a webhook listener and put it's URL onto topgg
Which will most likely is your IP or domain
how
I've read
Ok once you started the listener on your server, use it's public IP address or domain
for rplt I remember people say it's the project URL you can see in your dashboard
I used to but I changed so I came here to know what to put there instead of repl http server url
hmm dunno both platforms anyway...
is there a way i could make my bot post emojis in embeds
Discord emojis only work in certain fields
hmmm
You can send them like normal: <:name:id> or <a:name:id>
can that work on embed description?
yes
Yes
okay so next thing i gotta do is make the bot recognize emojis and add their name and id on them
anyone know how to get what line the error is on without logging in the console? (im trying to make an error logging system that would log errors + their lines in json) also this is in JS
can the bot get an emojis name
you can just get the emote mention
You could expend your code into multiple lines
And hope the stacktrace references the line
technically, yes
the usecase in this is basically the bot will get a entire message sent from someone (it may or may not include emojis) and it will repost it as a embed
but be advised, generally it'll NOT end in the actual code
like
sometimes it goes into internal code
or class functions
so you'll get a pretty useless line of code instead of the actual error
for example
how can i achieve this? currently i have a process.on that catches uncaughtException and when i log the error to the console it shows the lines but when i log it into a json as a string it logs TypeError: blah blah blah blah
ohh
so
no point?
i already have it where it logs the command that they tried to execute so it should be easy to find the error but i wanted that just in case
class Blabla {
const shit = [1, 2, 3];
function doShit(value) {
return shit[value];
}
}
...
let bla = new Blabla();
console.log(bla.doShit(5));
it'll error cuz 5 is out of range
if you get the error line tho it'll return return shit[value];
but the error isn't there
i c
the actual error is here console.log(bla.doShit(5));
so useless
pretty much
unless you handle the error in doShit no?
error logs contain so much info, if you try to abstract it you lose so much debugging data
example sir
In what ways will it not be handled?
^
ic
that wont actually error tho, it will just return undefined xD
fckin js
I couldn't think of a quick example, and js doesn't help being too lenient
the class itself will error tho, because you dont use the function keyword for class methods
I haven't encountered it ever
🤔
So in what situations would you encounter this range error
try working with typed arrays and buffers
people actually use those kind of arrays?
yes
I mean
That isn't what I mean though
Actually nvm
I am reading it wrong due to my tired brain
or wait no, doesn't that create an array that can only have 10 elements in it?
or just an array that has 10 elements already
clean?
JSON file:
{
"guild": {
"name": "ch$rry network",
"ID": "775604768675463178"
},
"user": {
"name": "clap#0007",
"id": "773630440606138408"
},
"command": {
"name": "eval",
"arguments": "1+1",
"type": "Message"
},
"error": "TypeError: Cannot read properties of undefined (reading 'username')"
}
```|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| https://embed.rauf.wtf/?title=clapclap&color=2f3136&image=https://cdn.clap.wtf/0wx.png&redirect=https://cdn.clap.wtf/0wx.png
it creates an array of length 10 yes, so if i try to set bytes at index 20, it will range error
Okay
So you can't go past 10
Then yea okay that makes sense for a RangeError to occur
I was thinking more along the lines of trying to index something that isn't there
let arr = [1,2,3]
console.log(arr[3])
for my minified error output I always log the error message + the topmost line that is inside my code
js doesnt usually throw for that, because by default arrays behave like objects, ie, they have unlimited size, and the indexes are like keys in an object or hash table
that way I always get the reason + where
so the natural behavior is to always return undefined on out of bounds
how can i get topmost line?
mmmm
I guess that makes somewhat sense
But i still think if it is out of bounds it should say so
It would fix a lot more problems

it cant, because arrays are not fixed length
for example, I run through the stacktrace and check if the package is com.kuuhaku
if it is, I return it
mmm yea
if it isn't I go to the next line
also sparse arrays exist
arrays with holes in them
🤔
ooo ok i see
wtf is an array with holes in them LMFAO
I don't see the value in using a sparse array as well
but tim probably knows several reasons
tim big brain
i mean, there arent many reasons to purposefully use them, unless you're adding/removing items from random indexes without resizing the array
but the way the language is designed makes them exist
ie: arrays should fill all possible requirements and merge the abilities of all different array types from lower languages
c/c++ does have a sparse_array class
to purposefully create arrays with holes
Do google chrome developer dashboards refresh every 24 hours?
I dont see the point of an array with holes
a hash table is what powers most key-value structures behind the scenes
its one of the methods to achieve constant time lookups
it's what makes getting values from maps fast
ie no matter how many keys you have, 10 or 10 billion, the time it takes to get an item is always the same
in most cases*
cuz collisions™️
well yeah
if u manage to collide in a hash map you need to rethink ur code
I mean, you're not supposed to even get near the cap
depends on the table
depends on le table and hashing algorithm used
some tables have up to 95% memory efficiency, like robin hood tables
the faster the hasher is the more prone it is to collisions in most cases
others have less than 70%
Really fast hashers produce 32 bit hashes where you dont care about collisions too much because its a really small table but you care about the hash speed
Also collisions generally are pretty common to worry about with performance situations because it quickly leads to a slow down of the access times which isnt always ideal
useful for doing pigeon hole principles though
thats where all these different hash tables have been competing all these years, who can get the most memory efficiency while maintaining good performance
Personally the Google Swissmap + aHash hasher is the best combo i've used
because as soon as you start getting collisions, it is going to slow down, how efficiently can you manage the speed reduction and keep it at the minimum is a very interesting topic
best i've used is robin hood
although python's hashmaps are just insanely fast with a tiny collision rate
the current state of rust hashing algos:
intersting, fnv is the fastest one i've ever seen in pure js
xxhash advertises itself so much as being the fastest, but i never got good results with it
JS optimisations though wont come close to what LLVM can do with some added architecture optimisations for archv etc..
also wheres the good old djb2
dont exist in the rust world
rip
ah i see why ahash is so fast
its like 99% hardware AES instructions
i've never used rust, but in cpp the most memory-efficient table i've seen was tsl::sparse_map
used about 3-4x less memory than std::unordered_map in my use cases
Only time I've really cared about memory usage is on my implementation of SymSpell
Where containing a bunch of pointers cost too much so used a load of 32 bit ints acting as virtual pointers instead
Cuz yay 64 bit points on 64 bit machines
what is the most effiecent way to convert array of arrays to array?
array.flat()
oh
How can I close the current tab in js for a chrome extension?
Is there a specific justification I'll need for it?
I never felt so happy until today
that closes your current window
yeah
But like justification as in permission
Like
"storage",
"unlimitedStorage",
"tabs",
"https://ajax.googleapis.com/"
],```
Is there another thing I'll have to include?
Oh okay
Can certain websites not work with js code an extension is trying to add?
you can basically always inject your JS into the site
Plugins take priority over the site itself
oh okay
you could also inject it with a bookmarklet
got it, ty
is it worth adding api keys to my api
its a user id check api (to check against known raiders)
if you want to require registration, sure
its more to ensure no abuse
and to have rate limiting too
as each request will make a database request
I mean, you would be suprised how much your db can handle if its setup right
purely IP based ratelimiting would likely be enough
yup
any have suggestion how to practice rust?
like learning the syntax but without practice is useless
There's the book (https://doc.rust-lang.org/book/), but if you want practice, how about the Rustlings course? (https://github.com/rust-lang/rustlings)
same ^^
Anyone know what's happened here? https://i.callumdev.xyz/r6kjp.png
pretty sure you covered up a critical part of the error
I covered my server ip
at the end does it say something like econnreset or econntimeout
Is uninstall a detail reason for a chrome extension?
This is what I mean:
if(details.reason == "uninstall"){
chrome.storage.local.set(defaultSettings, function() {
alert("Extension uninstalled");
});
}
});```
Hey, is there a NPM Command that would fix this? When I press "Run" it doesn't start the bot.
do you have anything to keep the program running?
It's replit, I have the Hacker plan.
So 24/7
Sooo, if by that you mean code then no, its just another Discord Bot
It'll stay idle like that for hours^ and has
Actually, can this even be possible when the extension is not existing on your browser anymore?
I mean code wise
No, just the login with the token, that's it. Otherwise its a "Run" button.
are you pressing the run button?
-_- That was rhetorical right?
because you asked about npm commands lol
you dont use npm commands on replit, you do everything by pressing buttons and shit
and what exactly is not working?
What part?
There's a lot.
{
"name": "LPSupport",
"version": "0.0.1",
"description": "A simple discord bot, mainly used as a template.",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"@discordjs/builders": "^0.9.0",
"@discordjs/rest": "0.1.0-canary.0",
"@mycool/discordjs-slashcommand": "^1.2.1",
"amethyste-api": "^1.1.4",
"ascii-table": "0.0.9",
"canvacord": "^5.1.0",
"canvas": "^2.6.1",
"chalk": "^4.1.2",
"config.json": "0.0.4",
"cpu-profiler": "^2.1.1",
"cpu-stat": "^2.0.1",
"discord-api-types": "^0.25.2",
"discord-buttons": "^4.0.0",
"discord-rich-presence": "^0.0.8",
"discord-rpc": "^3.2.0",
"discord-slash-commands": "^1.2.4",
"discord-ytdl-core": "^5.0.1",
"discord.js": "^13.3.1",
"discord.js-pagination": "^1.0.1",
"erit-ytdl": "^0.1.3",
"express": "^4.17.1",
"figlet": "^1.5.0",
"fs": "^0.0.2",
"fs-extra": "^9.0.1",
"g-i-s": "^2.1.6",
"got": "^11.8.1",
"graceful-fs": "^4.2.4",
"humanize": "^0.0.9",
"imageapi.js": "^1.3.2",
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"ms": "^2.1.3",
"node-fetch": "^2.6.1",
"opusscript": "^0.0.8",
"os": "^0.1.1",
"path": "^0.12.7",
"quick.db": "^7.1.3",
"sequelize": "^6.6.0",
"simple-youtube-api": "^5.2.1",
"soundcloud-downloader": "^0.2.4",
"sourcebin_js": "0.0.3-ignore",
"sqlite3": "^5.0.2",
"string-progressbar": "^1.0.3",
"twemoji-parser": "^12.1.2",
"util": "^0.12.3",
"uuid": "^8.3.2",
"ytdl-core": "^4.4.5"
},
"engines": {
"node": "16.x"
},
"repository": {
"type": "git",
"url": "git+https://github.com/KeemROH-Development/Simple-Discord-Bot.git"
},
"license": "MIT",
"keywords": [
"node",
"bot",
"discord"
],
"devDependencies": {
"node": "^16.13.1"
}
}
There's a lot of un-needed stuff from my base handler 🤣 this is a handler that I use for everything.
So then I don't need to keep adding one by one by one by one
Yeah, this is from my very first bot :Rofl:
When it needed like 1900501501050150
packages
lol
you should definitely remove everything you dont use
some of those are even bad to have
every npm package can be a vulnerability.
as few as possible is always my goal
show your index.js
well since you dont have any other leads and dont debug you own code, yeah i guess
Oh oh
you have something in your code that is making your bot stuck probably
I see myself scrolling for minutes
if you would have posted it in the channel
hm?
thats wrong on so many levels lmao
do you know what ! means?
if false or sumthin
! means NOT
so NOT 37598374598370 makes no sense
its a static number, not being compared to anything
its always true
with ! it makes it always false
either way that entire if has no logical meaning
That still didn't make it come online o-o
huh?
pfft lol
That's not useful
so uh, I gotta go find another way to do this or?
I mean it usually works tbh
It's just all the sudden not coming online
i mean
i can see a lot of bad things in there
but none of them should be causing this particular issue
try adding a few console.logs
outside the events, for exemple before the ready event
and see if it logs
Okay.
It logged.
Not the one inside on ready
but the other two above and below it worked.
did you get ratelimited? 👀
Replit always re-checks it like after one hour
Ohhhhh
Whenever I edit it
I gotta re-run it
that could be why
and when I edit it, I do baby steps, so one by one by one, which involves me to keep re-running it
So that could be why.
Damn and my phone can’t open txt files
No way I'm banned for 14 hours right?
but this is with another token-
o-o is the new ^_^
Whaaaaaaaaaaaat
discord only lets you login 1000 times per day
wait
if you exceed that number, you have to wait until the day ends
How can you fucking exceed 1000 logins/day?
crashing in a loop usually does that
with stuff that autorestarts your bot
I somehow think saving and running the code after each added letter in the code might be the reason
But who knows
*woo knows

doing that 1000 times in a day sounds like programming for 8 hours kek
Idk, I got it off the docs.
what docs?
I can’t even open the file on mobile but regarding on how Tim reacts, you should throw your code away and start from scratch
lmao
This code took forever 
Wut 9.2kb took forever?
anyway from the code it looks like you want to decide whether to register the commands globally, or in your guild only for testing
Well, I wanted to prioritize the guild only one then move to global.
in that case, just remove the number and put something there yourself to control that
o-o What would I put there?
Just leave it blank? 😉 that's a good idea
if you want globals, put true
otherwise put false
then when you want to reverse it, just reverse the true/false thing
or if you want to be more descriptive so its easier to understand, create a variable for it
I should probably not keep re-running it within the time limit or the time will restart huh?
const testing = true;
if(testing) { guild commands }
else { global commands }
or why not just put if(true) instead of all that? o-o
thats what i said
okay 🤣
but you'll have to remember what that if(true) means
the variable makes it easier to read
ahhh
makes sense
for global commands & guild : true
for non-global commands : false
Why not just add a property to your command module?
For example guilds: null or an actual guild ID
And handle it in the command handler
it seems like the guild commands are for testing only
since they are only being set in his guild
Yeah
Hmm just a suggestion as I can’t see anything
I assume there’s no proper command handler anyways?!
Fetching, registering, updating or deleting commands
I'm going to be real, not sure what the bot does
I swear I’m close to start the PC to take a look myself 
probably best to fix the login issue
repeatedly getting ratelimited on multiple bots may be bannable
Like my account could get banned?
or I'd get API Banned totally?
Account
Dude the account bind to your apps is always the same
Also your requests are always coming from the same IP address
...
bruhhh
I have no way to control how many times replit does it -
It always sends heartbeats
Does that mean its re-logging in?
If he has a hostname (maybe a RDNS) it’s always the same
I'm not even trying to ratelimit the project.
does this mean that its restarting?
Getting 1 by 1 closer to rate limit?
Why do I read successfully registered commands?
You’re not supposed to register commands more than one time without running into more issues
..






