#development
1 messages · Page 1457 of 1
Hmm gonna take look into it tomorrow
Looks like something new exciting nobody asks for but why not
Is MongoDB faster and better than quick.db/SQLITE?
The thing is sqlite is just in one big file so idk
it's going to be faster yes
I’m considering changing my level database to MongoDB that’s why
if you use something like postgres though
sqlite doesn't scale well at all
im pretty sure it'll be really fast
postgres is extremely powerful yeah
My music bot uses postgres but I wanna try something different for my level code
But yeah Postgres pre good
But is it possible to transfer all data from an SQLITE file to a Postgres database though?
you can create a small script that does it 🤷♂️
create all tables that sqlite has and migrate the values
they both use SQL
Does anyone know how to dm a embed? I have been trying to figure it out for my help command.
sending a message is the same no matter where you're sending it to
js
well I am trying to figure out how to send the embed thru a dm*
it is?
so do i replace the with something?
message.channel.send('SMTH')
if you already know how to send an embed to a normal channel, its the same, just send it to a user instead.
if you already know how to send a text dm to a user, its the same, just send an embed instead.
ok
Something like user.send()
However you define the user
$kyucity

https://www.dndbot.ga/
just got a site made and working for my Work in progress D&D bot now to finish up the bot so I can submit it to top.gg
loving how this project is turning out so far (added the tags for nice website url embed too as seen above)
That’s the wrong place for ads 
@lost berry adtum
I'm more just looking for feedback on it right now
the bot isn't even done so don't want people to add it yet really
Calm
I can delete it though if that'd be consider against the rules
hmm not a bad idea for as I progress right now trying to keep it simple and just a way to intro people to the bot not a full dashboard like mee6 and such
aight
then our last layer of protection will be robots.txt
How do I create slash commands In discord.js Hmmmm
Robot: Reads robots.txt
User-Agent: *
Disallow: /earth
Robot: aw shit we outta here boys
lmao
hi
yesterday this was working fine
await asyncio.sleep(3)
new_msg = await ctx.channel.fetch_message(m.id)
for i in new_msg.reactions:
users = await i.users().flatten()
users.pop(users.index(self.bot.user))
for user in users:
txt = ""
member = await commands.converter.MemberConverter().convert(ctx, str(user.id))
txt += str(member.display_name)
print("txt1: " + txt)
if not re.search( '🍐', txt ):
txt += f" {i}"
print("txt2: "+txt)
await member.edit(nick = txt)
print("name: " + member.display_name)
but today all the lines after await member.edit(nick = txt) and that line itself isnt executing
plz help
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'approve.png')
.attachFiles([attachment])```
How come the image isn't in the image? How do i fix?
cuz i tried that and it didnt work bruh
so am i
it worked perfectly fine yesterday
and the code wasnt even changed
oh hsit
shit
i know why
its due to perms
skskskskk
Are you legitimately silencing your errors
well i have to
and i just realized i did
ok what am i saying i didnt have to
but i forgot that i did
anyone know what is this https://i.imgur.com/SKPS4m1.png
you must have some invalid option in your tsconfig
which one
is that js?
is that python
or ts?
is it case sensitive
thats ts
mine is 'commonjs'
hmm
"moduleResolution": "node", "esModuleInterop": true
i think if it's python it is supposed to look like from discord-akairo import { Command }
moduleResolution wasn't necessary for me but its worth trying
its ts
oh
@tribal siren thats typescriot lol
yea it should be commonjs
@summer torrent yo
"moduleResolution": "node", "esModuleInterop": true
These too
Add these too
aaaah finally my shackles are free
my tsconfig: json { "compilerOptions": { "module": "CommonJS", "target": "ES2020", "outDir": "dist", "lib": [ "ES2020", "ESNext.Array", "ESNext.AsyncIterable", "ESNext.Intl", "ESNext.Symbol", "ESNext.String", "DOM" ], "sourceMap": false, "inlineSourceMap": true, "inlineSources": true, "incremental": true, "esModuleInterop": true, "moduleResolution": "node", "experimentalDecorators": true, "emitDecoratorMetadata": true, }, "include": [ "src/**/*" ], "exclude": [ "node_modules" ] }
add strict to ts
yea
watch: true
wait watch?
yeah
well maybe its necessary
its just handy
well probably
what does watch do
i just run ts-node-dev for development
it recompiles stuff when you make changes
helps recompiling
oh
yo this is cool
New stuff
not for most
its still whitelisted
had to manually do requests
its all cool n shit but it seems like an annoying thing to do
not in any library yet
actually it will be pretty easy once the major libraries adopt it
imagine 20 bots with a help command
its just an event
it will recompile when my github server pull changes from remote, right?
yeah im pretty sure
"port": 3000,
"clientId": "",
"clientSecret": "",
"scopes": ["identify", "guilds"],
"redirectUri": "http://localhost:3000/authorize/callback"
}``` how can i add my own domain instead?
whats that?
wdym?
Oauth2
you gotta add a redirect uri with your domain on the oauth2 section of your app
It should be in redirecturi
so just change redirect? and add the redirect in Oauth2?
that's something on the server
using freenom for now
You also need to change the uri at app panel
Else you'll get an unauthorized status
is there a reason it does that screenshot?
Discord dev dashboard
Is the domain registered?
Did u configure the dns?
Your server's ip
what server?
Your vps
i dont have one atm
What are you using to handle the oauth2?
localhost
Error: listen EACCES: permission denied MY IP
at Server.setupListenHandle [as _listen2] (net.js:1301:21)
at listenInCluster (net.js:1366:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1503:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:69:8)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1345:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EACCES',
errno: -13,
syscall: 'listen',
address: 'MY IP',
port: 80```
I get this error
You can't use localhost anywhere outside ur pc
for testing discord slash cmds
Because "here" is wherever your "here" is
so what do i do?
ok then once i done that
Some site builders also allow custom domains ig, not free tho
Probably more expensive than a vps
Once you have your server, you need to configure where that domain should redirect to
how do i get auth code?
In this case, your vps ip
so what do I do
That's anything you want
Srry, was talking about astrah
That's only a code top.gg will send u on every request
you shouldn't need the protocol
Because it's not valid
wait what are we helping with?
so i need to buy vps
Nothing more
Yes
Heroku doesn't open ports afaik, so your only resort is a vps
Also note that, despite having a vps, you'll also need a webserver
To handle the requests
how much is that?
0
You need code
Webhooks will only send the url a request containing vote data, nothing more
what are you helping with?
It's up to you how you'll handle it
Dude got a freenom domain but doesn't have anywhere to link it to, and is trying to use it for top.gg hooks
yikes
do you not have a vps?
You must code a webserver to handle top.gg requests, there's no other way
Top.gg will send u vote data
You need to handle it
Sdk?
ok
dblapi was pog
it did its job, wasnt anything too fancy
yeah
It was like iexplorer
which made it pog
i mean the new one is likely better
probably
anyone here use json as storage and wanna find the most common letters?
Stopped reading at "json as storage"
What's the difference between json and any other string
none
same
Then why not just iterate over each character and save the amount of occurences
But...did I not just tell you how to do it?
What
Not using jsons is a good start
well yeah ik that
basically I want to know the most common letters people use when they use JSONs
Btw, common letters in jsons would teach nothing
I don't know what "jsons" are
Wouldn't you just need the values
That doesn't help
ik
There's no "commonly used" letters
but if you replace every occurance of a letter with a word it would make more sense to have the most used letter as the shortest word
WHAT DOES THAT MEAN?
A, e, i, o and u
e.j {, }, ", etc
I think we need to know why you help you
Why are you trying to get the most used chars in a json string
poggers
because of a thing i made LMAO
You're likely trying to count sand grains in a beach
Also it won't teach u anything about the beach
Lol
Only that it's made out of sand
well this is more of joke anyways
The joke will become much slower than before
"0": 4471,
"1": 7660,
"2": 5314,
"3": 4899,
"4": 4918,
"5": 4859,
"6": 4930,
"7": 5304,
"8": 4517,
"9": 4301,
"{": 2467,
"\"": 14642,
"l": 4787,
"e": 4824,
"v": 2393,
"s": 5,
":": 7286,
"x": 2427,
"p": 2427,
",": 4820,
"}": 2467,
"g": 1,
"u": 3,
"i": 36,
"d": 1,
"r": 38,
"f": 35,
":tm:": 35,
"️": 35,
"o": 1,
"w": 1,
"n": 1,
"t": 1
}```
my json
wat
a lot
Who uses numbers in keys?
all
````{}`.split('').forEach(e => x[e] ? x[e]++ : x[e] = 1)```
whats x
WHY ARE YOU SPLITTING IT
because I needed to run it once
Congratz, you just discovered that jsons are made out of LETTERS
why not just iterate over the string
@mellow kelp i get exports is not defined error in compiled files 
I don't need to make hella efficient code if I run it once
Such a breakthrough
u running it with node?
sure
If you have a big json file, you will be splitting every single character in it
And storing it temporary in a list
this hurts my eyes
IN MEMORY
I only need to do this once
Yeah
I still don't get the reason tho
Why not just store the count of each one in a dict and then sort it after
Why does all the code have to be one line
basically I want to be an idiot and introduce some shit code as a joke
Why are we here, just to suffer?
It'd be hot, scratchy and metal
how, I posted some example code that was fast to write
and I only need to use it once
Your code is taking all the characters from the string and building an array
Which isn't necessary anyway
There are easier ways to act like an idiot
for(let c of String) x[c] ? x[c]++ : x[c] = 1
Like doing chmod 777 -R /
Is there a reason to use forEach
Foreach creates an anonymous method or something like that
it has it uses, but its garbage performance wise
mine?
o
o
Also always remember kids: you never delete something from an array during its iteration
That moment when your poggers db needs a method to get highest-occurring character in a JSON string
you guys still mad at me?
cracks nuckles
Next goal: store a sqlite binary inside a mongodb
mongodb maxes at like 16mb iirc
doc size
Did u ever see some sqlite go above 1mb?
Why would you
Erwin I don't think I can let you continue typing
When you have a poggers db
Million you got to sell that stuff
yes
poggers
Microsoft would buy it
you bout to get richer than bill gates
they should store their data in .poggers
You can finally live up to your name
yes
"the million poggers man"
LOL
"so secure, the decryptor might actually fail sometimes"
Also, there's no db at all
A new NoSQL database set to surpass MongoDB
You can't have errors if you don't have a db
https://www.npmjs.com/package/jason.db <-- best db 100%
ty
don't use DB, store data in JSON
Oh god
perfection
POGGERS repeated 1 million times is 7 mb
There's an npm package now :(
im ditching mysql and mongodb from now on
Don't use json, store data in filenames
always has been
million made it
@mellow kelp idk how. But i fixed it
the hottest million dollar idea
Filenames don't affect file size /s
noice
imagine
mind size MEGA
using file name as storage
Can't wait for some random kid to come here and ask why their discord bot that uses poggers db keeps running out of memory
I like your idea

Poggers penguin
file name db would be intresting
i just removed 'type': 'module' from package.json
No hacker will ever think about looking at the filename

my on ready event
ohh that thing
stealed
use discord as your db 🧠
150ms access time is a feature, not a bug!
yeah if i saw your package.json i wouldve known
that makes node run scripts as es modules
ratelimit in 5 queries
Wait so I can save space by having an empty filename :o
use user notes as db 🧠
you can save memory by deleting system32
type: module forces ES Modules, so require will not work
Minimal space, but yeah, basically
use your brain as db
:ooo
discord.db
https://i.imgur.com/nIakfrl.png
That's the future
BIG BRAIN
who needs databases when you got your brain
I don't think so
i remember i saw something about notes in djs docs
anything can be a db if you try hard enough
indeed
probably user only
bob has about 5 coins or something
From the same creators of "SwiftKey Ninja Pro theme": Windows Explorer Ninja Pro theme
use new Map()
GUYS I DID IT
selfbots go brrr
I DID IT
Also no icons, they're a lie
GUYS HE DID IT
you can make a bot with wires and mechanical stuff that writes data into a piece of bread
THEY DID IT
I DID IT
YO
HE DID IT
HE DID IT BOYS
HYPE GUYS
make everything chromium
hmm
"in the future, everything will be chromium"
chromium is cancer
well guess what
discord runs on chromium
I DID
yeah (╯°□°)╯︵ ┻━┻
ik lol
<button class="btn login-btn btn-outline-accent my-2 my-sm-0" style="font-size: 10px !important;font-family: poppins !important;" href="/authorize">LOGIN</button> nothing happens?
yea
Wait until they release Polonium
imagine not using opera
freakin electron
Electron is cool
chinese spyware lol
https://million.is-a.computer/files/nmfVnkzavFB9qRt.png I use it for school
so I can use extentions
nO
i use microsoft edge
what happened to native apps 😔
its pretty fast
Electron is the future
opera best
agree
it is chromium too
Electron is now
electron is cool but it's such a ram chonker
yo
OH SHOOT
waiting for a Electron operating system with nodeos
They got colonized
who wants to code filename.db for jason.db?
Hey, does anyone know how I can fix this?
This method always worked for me with Quick.db but doesn't seem to work with MongoDB.
let alp = 'abcdefghijklmnopqrstuvwxyz'.split(''),
map = new Map(),
str = 'Im sexy and i know it';
for (let e of alp) {
let exp = new RegExp(`${e}`, 'g'),
match = str.match(exp);
if (match?.length) map.set(e, match.length);
}
console.log(map);
message.channel.send(JSON.stringify([...map], null, 2), { split: true });
There, proper cursed code
doesnt that already exist lmfao
oh god
take back the night
thats why premid started to coding rewrite with cpp
yes you can write an os in Node.js
im not gonna be reading that Erwin
People can afford it
too many lines of brainfuck
You don't deserve discord if you don't have 8 GBs
<button class="btn login-btn btn-outline-accent my-2 my-sm-0" style="font-size: 10px !important;font-family: poppins !important;" href="/authorize">LOGIN</button> nothing happens?
we did it boys
At least
Actually, there's a js OS
href
"several people are typing"
https://github.com/ultralight-ux/Ultralight seems to be an up and coming electron competitor
i am?
yeah
Games?
unity will remember that
you can use their API to render html/css/js in your game
im just using regex to match all letters and setting the length of the array returned
since it's c++
return this.options.caching ? this._data ? this._data : (this._db._read())[this.name] : (this._db._read())[this.name];``` good code?
oh god why
Writing an OS in Node.js is the same as bdsm torture if you're into that
nested ternary expressions 🤢
https://million.is-a.computer/files/0reJb5oHeSVhpOu.png I commented it earlier
Did u just use bdsm and torture in the same sentence?
lightweight
using node.js
proceed to laugh
wait
don't nest to much ternary expressions
I have my barricades ready
node is single threaded
I guess they must have spent time doing that
but worker threads are so stupid
wait
just run 100 node processes so
I should add worker threads to jason.db?
you lose the main feature you'd use threading for; synchronization
Anyone know how I can fix this
add await
🤔
Node threads are like releasing a bunch of balloons to the sky
They'll fly but....what else?
you have to await those functions
since they're async
so who wants to add FileNameDB to jason.db? or do I have to do it?
Oh weird it works on quick.db though
pretty much lol
you know they're up in the sky but you don't know where exactly is each and every one of them
Ima try with await though
make sure you are in an async function
Nor when will they fall back to the ground
ye
Or if they'll fall someday
The last commit was 2 years ago.
or if they somehow popped
Thanks :) @mellow kelp @crimson vapor
mongodb returns promises
no problem 
yea
jason.db doesnt
LMFAO
Yeah I was hella confused when I console logged it at first
jason.db is a better db
i updated it
(jk never use it in your entire life)
Much better now
var alp = 'abcdefghijklmnopqrstuvwxyz'.split(''),
map = new Map(),
str = 'Im sexy and i know it';
for (let e of alp) {
let exp = new RegExp(`${e}`, 'g'),
match = str.match(exp);
map.set(e, `${match.length}`);
}
console.log(map);
message.channel.send(JSON.stringify([...map], null, 2), { split: true });
jasawn.dbee
jaysown.deebee
Erwin could you make a function that grabs a in a specified folder and renames it to a stringified json?
a what now?
🅰️
{} is blacklisted
Damn son db
but like actually working
you don't need to run .split() on a string, it's already an Iterable
I finally did it ! I finally coded a cloudflare worker which forwards the request to the specified port !!!
lol
I'll make a trashbin db, the data will not use space because it's already deleted /s
ah yes, my best friend regex
LOL

its
Regex is an introvert, because it can't express itself
a fucking string
yo that dog emoji is epic
alright ill just make a shittier version of it


i got an idea
an incredible idea
a database that hashes data with bcrypt so that it becomes almost near-impossible to decrypt ever again
lol
isnt that great
no
the one requirement is that it needs to work
and not fuck the cpu
memory is ok
wait until they realise thats how you "securely" store tokens and personal info in databases
Write-only database, perfect
linked lists
who would have thought
isnt a write-only database revolutionary
why
you guys want fuckery?
great for storing data /s
now we need a read-only database
What about a database that stores the word obama for each entry?
Does anyone know how I can get my MongoDB's connection url so I can run it from another machine
ObamiumDB
Yes
we can just extend poggers but change it to obama
have you read the code for poggers yet?
nope
its quite something
just the encryption I mean
MY PRECIOUS CODE IM GOING
It'd be your vps ip + database path ig
make sure the port is open and you setup authentication
Beautiful words ❤️
let epoch = Date.now();
let newArrayIndex = epoch.toString().charAt(epoch.toString().length - 1)
Done, now like Lua, make it so that index is the new index at which arrays start.
If the last digit of epoch is 8, arrays start at 8;
This would change everytime you restart your node and its almost impossible to detect since theres ms of delay between operations and you cant reliably get the same epoch timestamp of when whoever made the noodle code ran the function
im already working on FileNameDB
i gave one right above your msg but nobody read

random array indexer
Lua starts at 1? pff, plebs, my indexes start based on last epoch digit
Next id is cheetos, and you can never reach the third id because it'll yell to stop the count
my arrays starts at Math.min()
my arrays start at 0
Thats some crazy sh*t
rate the new changes on jason.db
unless you are storing passwords
and when the program finishes it deletes everything
TempDB
So
RAM
you see
But in files
store in js map object
it has many benefits
Fun
@slender thistle yes u
you store data
no that's too much easy
even though its gonna be deleted from storage as soon as the code ends,
you don't have to worry about ever running out of storage space
import a ramdisk npm package, and then use FileNameDB there
lol @mellow kelp
Still can't seem to figure out how
reeee
StoriesDB
Just like my laptop
Non-existent
Or, rather, not working
reeee how long till u get one/fix it?
No idea
im not saying you should steal someones pc or going for a job that would require grinding in a pole
im just saying its only bad if someone catches you doing it
if only there was someone to steal one from

baka
legit though, Ts is life, Ts is love
const fs = require('fs');
class FileNameDB {
constructor(folder, options = { startString: 'OBAMA' }) {
this.options = options;
this.folder = folder;
if (!fs.existsSync(this.folder)) throw new Error('The folder must already exist.');
console.log(this._getData());
}
_getFile() {
const dir = fs.readdirSync(this.folder, 'utf8');
const fileArray = [];
dir.forEach(e => {
if(e.startsWith(this.options.startString)) fileArray.push(e);
});
if(fileArray.length === 0) throw new Error(`There are no files in the folder that start with "${this.options.startString}"`);
if(fileArray.length > 1) throw new Error(`There are ${fileArray.length} files in the folder that start with ${this.options.startString}`);
return fileArray[0];
}
_getData() {
const fileName = this._getFile();
return JSON.parse(fileName.slice(this.options.startString.length));
}
}
module.exports = FileNameDB;
``` status so far
Isn't there something more useful you could be doing
nah
yes
_clean(data) {
data = JSON.stringify(data);
let str = '';
for (const c of data) { str += dataMap[c] ? dataMap[c] : c; }
return str;
}``` someone yell at me and give me a better way to do this
dataMap[c] ?? c
remove the brackets while you're at it
whats a char I can use that files can be named but but will not be used in a json
vscode wtf https://i.imgur.com/1iIEt9s.png
yes
how can i make it so it doesnt have .html
like
www.example.com/example.html
i just want it like www.example.com/example
Yea
<p class="card-title" style="font-size: 50px !important;line-height: 15px !important;letter-spacing: -0.06em !important;font-weight: bold !important;"><client.guilds.cache.size></h1>
res.render('index', {pageTitle: 'Bucks Discord Bot', user: req.session.user || null, client: client}); no error jus nothign shows
thats what I do 
you can also just create a rewrite rule lol
wdym
I have so far gotten to reading and parsing data as well as cleaning it but I need to figure out how to write
dont forget to make it support concurrency lol
huh
this is the part where people choke and corrupt their files
google concurrency and concurrent access
why can't I fucking unlink OBAMA.OBAMA
reeeee
wait ik why
rip
my dream
NOOOOOOOO
file name max length
Aw shoot
Then how about
A folder per collection
Each file inside has the name of a key:value pair
O
i have an index.html
in /example folder?
how to code / commands ?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Does discord.js support slash commands yet?
Im gonna go ahead and assume that in-memory storage would be in ram?
yes
1gb?
YES
PLACEHOLDER
I can't do string replacements due to limitations
herm
I need to shorten placeholer
Dang
ph
make sure there is a express.public() on the folder
like
*express.static
wat?
res.render('index', {pageTitle: 'Bucks Discord Bot', user: req.session.user || null, guild});```
``` <p class="card-title" style="font-size: 50px !important;line-height: 15px !important;letter-spacing: -0.06em !important;font-weight: bold !important;"><%guild%></h1>``` why does it not enter the guild size amount?
good code
my folder name should be example express.static()?
Nope
Like
You should have a public/ folder
With your public files like html and that stuff
And then do
app.use(express.static('public'))
rate my code please
So that they get served as public files
cries in cellphone
rip
Im supposed to be sleepin rn
you should get the gh app
I got it
same its 12
FL
ye
honestly
who would have known you could rename a file to a json
ima start making weird shit with json
Lmao
How long would it take for a bot to cache through about 150,000 members without the { fetchAllMembers: true } ?
too long
._.
For some reason
When I use fetchAllMembers my level code and commands stop working
Not sure why
Idk if its cause the server the bot is in has too many members or something
Do you have the guild members intent?
Ye
check out changes to jason.db pls
I need the forceful fetching for the users rank position
You can debug
Otherwise it shows as 0
only fetch when needed
realistically fetch 10 at a time max
and only on user input
This is gonna take like 15 days 
Debug
how does filename work
Stores data in file names
you input a folder and it will choose a file to use the as the db
bruh
We have successfully revolutionized the database industry
I'll ask my query when everyone's else query is solved
Because my problem will take some time
I sleep soon
so ask
Ye same
Okk
My issue is a long one and on the issues page of mongoose
Can you guys check it there
Noone has replied because many issues are there I doubt they'll reply me
So I'm asking here
what version mongoose are you using?
V5.x
Was that the last one?
gotta love typescript lol
https://i.imgur.com/i2Xp2F4.png
Indeed
Ts is life
yes
anyway
try npm uninstall mongoose and npm i mongooose
Alright
Ah yes
Btw I think I found the issue
Oh cool
Lmao yea that stuff happens
Lol
wait
Lemme change that and see if it works
Yes indeed
It's channel.id
If message mentions channels than its msg.mentions.channels.first().id
Thanks
Now I should study for my tomorrow's exam
Haven't read a single thing
Bye
Thanks
Now i better go to sleep
same
🌛
Wait
Yaa
let messagechoose = new Discord.MessageEmbed()
.setTitle(`Time to set the Message!`)
.setDescription(`
Kindly send the message which you would like to set as welcome message .
**PlaceHolders** -
1.` + " ` " + `{mention}` + " ` " + " - Mentions the user. For eg - @PGamerX "+
`2.` + " ` " + `{usertag}` + " ` " + " - Writes the username along with tag . For eg - PGamerX#7851 "
`3.` + " ` " + `{memberCount}` + " ` " + " - Writes the member count " )
.setColor("GREEN")
const botMessage2 = await message.channel.send(messagechoose)```
TypeError: " - Writes the username along with tag . For eg - PGamerX#7851 " is not a function





