#development
1 messages · Page 688 of 1
With "bigger" I mean 60 Guilds or more
@brave elm what are you running to get that error?
@earnest phoenix it returned a promise I’m pretty sure I resolved it but now it returns that.
Increment returns the new model afaik
Ye, I think so
Yea I’m doing that
code.pls
@earnest phoenix it returned a promise I’m pretty sure I resolved it but now it returns that.
read the docs link i sent you
Glitch is stuck on "Loading project" after cloning from git repo, do I just refresh or leave it loading?
close the tab and find a proper host
those are not free 😛 I'll run the server on my own pc then...
Phew 1 Economy command rewrite done 3 more to go
^^^^
Self hosting is not a bad option. Unless you are hosting more than a bot like a dB or website. Linux is the best way to go
self hosting is technically still bad since internet outages are more common in households
Right i meant with that aside. Bots are ok because most people are only in a few servers
But when you run more stuff that need to be online then it becomes an issue
refer to https://discordapp.com/channels/264445053596991498/272764566411149314/617852173757448192 as to why not to use free hosting and why no free hosting is reliable
@abstract crow Self hosting on my personal PC is only for the bot right now, my websites and mail servers are self hosted but on a payed Plesk Server with linux
Am I allowed to paste raw data in here? or should I just go for pastebin?
I am really trying to figure out why the command is not working at all. I have another command working similar to this, and that one does everything I ask of it. but this command does absolutely nothing when I use it in the testing enviroment
https://pastebin.com/DcddYSYN
if you're using a bot maker go complain to the developer of the maker
lol, well I'm sorry. I was hoping to get some more help here. But fine.
we generally don't offer help to people using bot makers as the code in bot makers is static and we can't do anything about it
Fair enough, I am not well versed enough in node.js to write the code myself, hence me using the bot maker
tf?
You want help with? The error?
That's you trying to interact with a deleted message (most likely)
was zum
ja was
I'm thinking about writing a "best practice" document for hosting discord (.js) bots
Because so many people don't seem to understand why glitch is not a good host, why hosting on your PC is most likely not cheaper than renting a VPS, and why starting shit in screens /nodemon isn't good.
I would be glad if i can get some help
My command const [, command, commandArgs] = input.match(/(\w+)\s*([\s\S]*)/);
The error im getting
empty input
undefined
> first
'aaa'
> second
''
> [,first,second] = "".match(/(\w+)\s*([\s\S]*)/)
Thrown:
TypeError: "".match is not a function or its return value is not iterable```
also, just split the string normally
no need for that regex mess
@earnest phoenix use a catch
> function handleInput(i) {
... const args = i.split(/\s+/g);
... const command = args.shift(1);
... return {command, args}
... }
undefined
> handleInput("abc")
{ command: 'abc', args: [] }
> handleInput("abc def ghi")
{ command: 'abc', args: [ 'def', 'ghi' ] }```
no
don't use a catch
fix the code
I will try, thanks for the suggestions
Got 2 bots running on this, using 1.5 gb of ddr2 laptop ram lmao, cpu is at 0. Time to upgrade the ram to the max for really cheap.
if it works 
I would have a fat server at home, but my internet is to slow, and my electricity is to expensive
yeah
that is really cheap for power
as it's the same kind of lead / power output as my monitors
and monitors use literally no power
so it's just a cheaper alternative than a vps
just not that reliable
ehh
but yeah
what do you mean?
your pc is more likely to be down than a vps
its fine tbh
however it doesn't much , maybe once a year if that
yeah
I'm making circuit as a manager bot, and mafia bot is just for my gta rp server.
I'm going to make it show how many people are on the server sometime, when I figure out how.
I want my bot to get like really massive
just
because I want to cluster servers and build a cdn
but dreams are dreams
yeah
everyone wants their bot to be massive, if that's what it's for (public servers)
Mafia bot is only for my server, but Circuit, is going to be public use
After it's done with -help and a few commands
a 65w server on 24/7 is most likely more expensive than a real server
unless you have really cheap electricity
even then it's less reliable
i pay a bit less than 0.15 usd per kWh and it'd still be more expensive than my vps
while also being way less reliable
since there isn't a redundant power supply not redundant internet
@brave elm get a raspberry pi lol
that's even worse
no
rpi is ARM
Of course I meant rpi4
Still, the amount of the rpi, the power usage, costs more than a vps
just get a vps
^
if you're buying hardware to run a bot it's already more expensive
what why
I don't have a server at home because my internet is to slow, but how tf would that change anything about your internet bill?
and some people have bandwidth limits
In germany you usually have unlimited || but also very slow internet lol ||
dude stfu and ask a real question
basically
lol almost every ISP in europe is a scam
We could have 100k+, but the wires in our house only support 50k (but we only have 50k download, upload is 4k lmao)
man i have 16k down (normally 10) and 2 up (normally .5)
I pay a shit ton for my ISP as they are the only provider who allows unlimited calls to Russia
well parents no me
one of my friends has a 200ms ping so I can't really complain
I haz a dedi so idc
Contabo, so germany 
yas
i got a small vps there
and if you order on the german page you don't pay any setup fee
CHY4E#0505's bots:
@atomic nebula @slender sigil
hmm
oh the first is absolutely trash, I only run it because some people seem to use it
should remove it from dbl lol
does not display for me lul
i should get back into public bot deving but i just cant be bothered with low iq users not knowing how to use the bot
majority are underage
true
yes, just better 
so you can record your audio and make soundboards (and soon™ you can upload mp3 files)
but current code is trash 
js?
yeah
hmmm
currently rewriting it to typescript, and just making it better
I'm gonna stay with js/ts until I have to scale, then I would build a server that handles streaming for the clients
how do you deploy?
currently just git pull
und restarting
but I obviously have to change that with typescript
will probably switch to azure devops or semaphoreci
well i meant like deployment environment
well that might be just the wrong word for it
but like
do you use any kinda container system?
prolly not if git pull
lmfao
nahh, I thought about using docker, but currently I don't have the need for it
yee xD
best deploy is scp bot.jar host:/path/to/bot/folder && ssh host /path/to/bot/folder/update.sh
lmfao

best deploy is code, push and wait
docker and chill
nah docker lame
no u
docker väry lame
what then?
kubernetes?
I roughly understand docker 
so its not related to docker, but you would rather use kubernetes instead of docker?

nonono
it's completely built up differently
it's not used the way docker is used
docker is just the first thing you think of when talking about containers
my experience with k8s has been a lot of hate so far
starting with minikube being garbage and not even booting
i'm not paying for servers to try learning k8s
also some people i know have some horror stories with k8s
i created a CI/CD for a simple discord.js bot within a day
like it's dns fucking up massively
the cluster setup did take like 15 mins
man k8s' dns system is great
and k8s is actually getting the standard industry deployment system
ye wtv
i like it
but it's not easy
oy boi
copy pasted from the message complaining about this issue causing downtime
hmmm
I get very lazy with my commit messages

gay and sad and yes is my words
I think I should write a util that allows me to prompt input
cuzz it's getting annoying
It says unsubscribe on site for vote when you aren't logged in.
read the channel topic
Well it's probably what the error says, an indentation error
Which isn't very surprising if you're coding on mobile
Anyway, no one can help you without seeing the code
is it worth it to add translations to a bot? 
I mean, I don't think the majority of bots do it, but maybe if you were to add a translation, maybe do spanish
that conclusion makes no sense
you would check which regions use your bot

if the majority is english, it's up to you whether you want to translate it or not, it's not necessary as users will adapt, but if majority of your users is e.g turkish, you would make a turkish translation
but translations generally don't matter nowadays, if your bot is in english you're good to go as it's a globalised language and it's being taught everywhere around the world
The code got deleted
Bc I leaved app for more than 5 mins
I'll do it again
:c
sucks to code on phone
cool
prob a stupid question but how can i make it like the bot invite link has a pre-filled server in it?
I don't think thats possible
it is i saw it before
a "pre-filled server"?
like it has a server_id tag after url and it kinda pre-fills the server
you can set a guild id in one of the query params
discord.gg/dbl?
Bruh no
@inner jewel and how can i do that?
i know the tag but idk how to execute it
you do guild_id=<id> no?
https://discordapp.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot&permissions=YOUR_PERMISSIONS&guild_id=GUILD_ID
How can I define parameter types and return type for a callback?
language?
typescipt, forgot it, sry
I found interface myCallbackType { (myArgument: string): void } , but not sure if thats the best way
just did it this way 
i dont think thats his code lmao @earnest phoenix
Sadly there are some bot maker apps for Android
he must have either a fucky android version or a fucky python version
or a fucky pydroid error
the error complains about a missing parameter that goes against d.py's command design
it's self explanatory and well documented
that's why i posted the image
I'm thinking about implementing a "trending" page, would that be worth it?
what would that be
Content that gained many upvotes in a short amount of time
yeah but you want to make a trending channel in discord or... trending dashboard or what?
trending channel could be interesting
sounds really simple to make too
no, a hot/trending command that shows content that gained upvotes in a short amount of time
just thinking if its worth it to calculate stuff like that
tf
@potent ivy how would that be really simple? I imagine it quite hard to write an algorithm to decide if the content is trending or not
YouTube
I don't have external content, I mean content within the bot

so... discord messages?
the content are audio files, wtf u mean?
i was thinking you want to make a upvote emoji that you can clap on discord messages, once used the bot will track how many upvotes it gets within an hour and if its above certain point it puts it into hall of fame (which would be either a separate channel or a new command)
¯_(ツ)_/¯
nice token retard
@earnest phoenix reset your token
k
"im gay"
"i suck dick"
10/10 testing
@potent ivy yeah that would be easy but pretty basic. might do it that way
well i got no idea how d.py works, python always looked horrible to me in the first place
is it even d.py?
discord api server should be good
read your error
it's self explanatory
and read up on d.py docs
Who can help me?
client.on("message", message => {
if(message.content == prefix + "Привет")
var number = "21";
var embed = new Discord.RichEmbed()
.setTittle("Title")
.setDescription("Description")
return message.channel.send(embed);
}
);
Help pls
with what problem?
I guess its your syntax, because its wrong
if (boolean) {
// code here
}
no
nevermind you aren't opening it nor closing it
client.on("message", message => {
if (message.content == prefix + "Привет")
var number = "21";
var embed =
new Discord.RichEmbed().setTittle("Title").setDescription("Description")
return message.channel.send(embed);
});```
you have if(...) var x
which is invalid
actually
oh really 
I won't embed
fix ur typo and it should work
just s/setTittle/setTitle/
I literally just told you what it is
hey dev boys
😡
@hushed berry ur qt
Learn what kappa means
also you do know chy4e was memeing
And then come back and try to tell me I should learn shit
yardim
How 2 make multi-purpose moderation, fun and utility bot?
@hushed berry how 2 make burthday bot
why no work?
client.on('music', playMusic())
because playMusic() is an async method which returns a promise
lmao

Oof
Okay this is it! I will write a page about hosting discord (.js) bots.
Would make all those annoying hosting conversations useless
i hope you're aware most users will avoid it
(since they already avoid messages in faq and in pins)
One message removed from a suspended account.
Kek
How to host bot 
Lol
How do i add more roles to bot?
So that members of server can buy more?
what
dbl wrongserver @quick cradle
This server is NOT the support server for ANY bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of DBL.
One message removed from a suspended account.
$table->date(dd-mm-YY)('date');
anyone understand why the format isn't working?
mysql insertion
One message removed from a suspended account.
yea
And I’m assuming the rest is addField and a .setTimestamp and .setFooter
yes
Mk
It's not But that embed does have a timestamp
The "Yesterday at TIME" is the timestamp
Yeah, you cant have a timestamp and a footer I believe
You can
They go in the same place dont they?
Logger#6088 is the footer
Meh. I guess so lol
You can do .setTimestamp()
.setFooter() at the same time
Also why isn’t it loading the avatars?
Is it because it’s slow or am I doing something wrong
I have a .setAuthor(oldMsg.author.username, oldMsg.author.avatarURL())
I do the same thing in the footer except for the bot
use displayAvatarURL
That didn’t change anything
log that value to see if its returning anything
@lusty dew you on master or stable
Master
<User>.displayAvatarURL() it's a function
It's not longer a property, you need the parentheses
But avatarURL() should work too 
Oh
It's a method in master
In stable it's a property
Yeah, do what he said log it
I did
See if it returns anything
Okay
I would say displayAvatarURL() is better because if they dont have an avatar it returns their defualt where as avatarURL() will return null if they dont have an avatar
But I must sleep gn
displayAvatarURL() returns a url of the user icon which can be used to set thumbnail or other image properties of an embed.
Ik what it does
That’s not the issue
It’s returning the avatar url but not loading the avatar properly in .setAuthor() and .setFooter
it's loading the avatar properly
otherwise you wouldn't see an image at all
it's just loading the default avatar for some reason
it might be broken on master
use the logical or with the other properties
let avatar = user.avatarUrl() || user.defaultAvatarUrl should do the trick
Literaly the code for displayAvatarURL() tho
It's the exact same
So the error would still persist
hm
who uses d.js master or stable
Probably gonna use master now so it won't be a nightmare for me to rewrite code later
I use master
don't really see a reason not to
stable has multiple mem leaks, master is almost if not faster than eris aswell
Yeah looking at all the master changes gonna be 
Wasn’t that much for me tbh
Though I started rewriting to master at a very small point only had 5 cmds kek
But even then it wouldn’t have taken long to rewrite to master now with my 40+ cmds
In java what should I use for persistent data store?
I looked at Java's mysql and it seemed pretty mad.
How can I get the invite a user used to join the server?
Like the invite code
I’m already using a guildMemberAdd event in d.js master
afaik it's kinda cancer
Is anyone here good with LaTeX?
I want to make a macro with a default and a mandatory argument
and i want a fallback value for the default arg
but idk how to do the fallback part
@warm marsh I use jdbc personally as it supports multiple sql dbs
I'll have a look thanks.
https://github.com/Deivu/Suzuya/blob/master/src/main/java/suzuya/handler/SettingsHandler.java
here is an example
although forgive me if my java is bad
Thanks. Looks sorta easy I guess.
Also your Java looks good, I just started coding with Java 2 days ago and mines is very basic.
Saya is a coding addict lol
*anime
@twilit rapids smh 
Should I do something for these?
dblapi
Does anyone know the d.jda GuildCreate event?
I tried GuildCreate but doesn't seem to return a guild class.
@warm marsh you mean the guild join event?
guildJoin is emitted when a client joins a guild
it's in the jda docs
Yeah I know, When I used it nothing happened.
GuildJoinEvent doesn't work along with the GuildCreate event.
I tried just logging and nothing was logged.
Try adding @Override on it
Listener adapter has empty implementations of each event
Using the override notation tells it to use yours
For that specific event
Oh thanks I had no clue.
I seen it around in others code but was like probably don't need it.

Not anymore
await dbl.postStats(client.guilds.size, client.ws.shards.id, client.ws.shards.size);
Anyone knows in the master to get the ID? Its not client.ws.shards.id
Discord.js
On master? Are you using internal sharding?
.shards is a collection of websocket shards
Afaik there is no way to get the current shard id, except in guild. Guilds can give you the current shard id
@inner spruce there is no a current shard id like in traditional sharing.
Instead, just pass undefined as second parameter
All right, thanks guys!
Quiz:
which code snippet includes errors?
const num = 1_000 + 10;
console.log(num);
or
const num = 1000 + 10
console.log(num)
1

i mean, second is also valid
Something I never knew
no, it has no semicolons, code without semicolons is broken code
but it wont error out
never said it would 
wrong
idk why semicolons are even up for debate in the scope of js
I mean they’re pretty key inside a for loop
https://i.imgur.com/FDvpWGM.png doesnt look like that to me.
only place i know where they're required is for loops
in a language like c++ etc you need it bc strings can be broken into multiple lines
Semicolons = bad
and some other reason but in js = 
I will repeat for you: js requires semicolons, but there is an error correction mechanism which inserts them for you if they are missing
I only use semicolons when forced
are you using a ts linter
i was talking to le epic chy4e
Just take an extra byte
i have them autoinserted because of the fact that webstorm gives a bright flashy warning and offers to autocomplete
let x = 1
let x = 1;
Difference? One takes a miniscule more amount of storage
honestly it's preference
Not something to call someone a retard over
no problem with reaching over to one end of the keyboard
No, js without semicolons is broken code
Like ch4 did 
Not my words, but wise ones:
A strict reading of the spec implies that ASI is an “error correction” routine. What kind of error, you may ask? Specifically, a parser error…
In my view, the only way a parser error occurs is if it’s given an incorrect/errored program to parse. So, while ASI is strictly correcting parser errors, the only way it can get such errors is if there were first program authoring errors — omitting semicolons where the grammar rules require them…
When I hear someone claim that they want to omit “optional semicolons,” my brain translates that claim to “I want to write the most parser-broken program I can that will still work.”…
My take: use semicolons wherever you know they are “required,” and limit your assumptions about ASI to a minimum.
Ok yes then fine. I write my bot in broken code. Clearly this has such a big impact because no compiler ever inserts them for you. Seriously, JavaScript is based around it being optional but to compile it it needs a constant, so it puts them in. It still knows where they go.
are we seriously debating over s e m I c o l o n s
@onyx summit source please
btw there are plenty of cases that break without semicolons
Would like to read it from source
I always use semicolons, except lines that end with }
no its ur error prone code, not mine
Nah he called me a retard for not using fucking s e m i c o l o n s, of course I'm going to show it makes 0 difference
can you guys calm down
- I revoked that insult
- It does make difference, it leads to error prone code
Discussions are fine just don't start throwing around insults
The asi spec advises you to make informed decisions, you are free to omit semicolons as long as you understand why and how the code will be parsed
lol
And some of the best JavaScript developer advice you to not make guesses if the code will parse correct or not, just use semicolons. And if you are to lazy for that, use a linter that inserts them for you, and then you can check if they are inserted correct or not
my code has semicolons but i forget to add it some times :/
And don't come again with "uhh they use more storage", like wtf? Who cares about some characters size
in that case don't use tabs and spaces to preserve storage
hello
don't use variable names more than 2 characters
You can make all your variables a single character lul
lawl
But btw, reusing variables will probably give you more benefit than shortening them
and using recursion will help in shortening the code
we don't care about performance we care about storage (even though stacks might use more storage)
plz do follow that advise if you want your computer to give you middle finger
Yarn version:
1.16.0
Node version:
11.15.0
Platform:
linux x64
Trace:
Error: EIO: i/o error, scandir '/run/media/cyber28/Maxtor/Coding/temes/slimester/node_modules/mongoose/lib/helpers/query'
npm manifest:
{
"dependencies": {
"discord.js": "discordjs/discord.js",
"dotenv": "^8.0.0",
"mongoose": "^5.6.9"
},
"scripts": {
"start": "node index.js"
}
}
so one day i try working on my project, and it says that mongoose is not installed, so i tried reinstalling it. ever since then i get this error, and mongoose installation would get stuck at creating the lib/helpers/query directory, and installing everything afterwards. now it doesnt even create a node_modules directory anymore
pls help its so annoying
huh, using npm produces a similar error
npm ERR! syscall scandir
npm ERR! path /run/media/cyber28/Maxtor/Coding/temes/slimester/node_modules/.mongoose.DELETE/lib/helpers/query
npm ERR! errno -5
npm ERR! EIO: i/o error, scandir '/run/media/cyber28/Maxtor/Coding/temes/slimester/node_modules/.mongoose.DELETE/lib/helpers/query'```
One message removed from a suspended account.
what language
rolling a dice is simple, its just a random number
^
That's how you "roll a die" in JavaScriptjs function rollDie(sides = 6) { return Math.floor(Math.random() * sides) + 1; }
pseudo die*
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Then go and google "roll a die"
or roll a physical fie
Ok, I'll role a physical fie
One message removed from a suspended account.
fie
Unexpected keyword "role"
yeah my typos are clever
make a robot that rolls a die, take a picture of it, and use AI and machine learning to determine the result, and send it in the discord channel
lol
One message removed from a suspended account.
One message removed from a suspended account.
What you said sounds like this @mossy vine
if(goingToCrash()) {
dont();
}
if(goingToCrash()) {
crash();
}
run();
}```
else {
throw(acrossRoom);
}
this channel is a goldmine sometimes
Mm
restinpeace();
}```
restinpeace(); }```
Hmm```else if(!canRun) {
restinpeace(thisOne);
}`````
Having canRun as a standalone variable means you have to constantly update it ahead of time, which is hella inefficient
no pulling apart code, it's supposed to be a joke 
no joke this is #development this is what we do
Pulling apart joke code intensifies the joke
:thinky:
I mean honestly art if he funny bit is pulling apart the code
die();
}```
@grim aspen solid bit of code there, but I think you mean else if(!dead) {
!!alive
if (brain.has`depression`)
{
giveUp();
process.exit(1)
}
No I’m correcting variable naming clarity
define brain
gone
brain was not defined
@onyx summit pretty sure that code is not valid lul
why
smh
makes a full AI based around peters joke about brand not being defined
my brand has depression
Can you even do property'string'?
I don’t think so...
Just tell it to not give any errors and it will work ofc
Think it’s ` either side of the whole phrase
uhhhhhh, tbh I dont even know, but you could do sum weird shit with template literals
Thats js the origin of weird shit
I wanna deny that
Do it 💪
I can’t XD
// TAG FUNCTION
greet`I'm ${name}. I'm ${age} years old.`
// EQUIVALENT FUNCTION
greet(["I'm ", ". I'm ", " years old."], name, age)
dont know tbh
works
but looks ugly imo
@quartz kindle
Yeah it's kind of funky
funky kong?
I want to cry rn
:(
Crying is sad, don't cry
Crying is good
It releases your problems in tear form
I want to use my debugger to find out why my validation isnt working
cant get my debugger to work
Cry a little more i guess
cant cry at work
Get a can of bug spray
and spray it in my face
@onyx summit thanks to learning about tag functions, ive also learned all functions have a local arguments variable lul
Thanks lel
Doing moon walk you are
no problem
WHY IS THIS NOT A VALID DATE STRING "2019-09-04"
I hate coding
why did I started doing it
why is it the wrong way round
btw I found it, OBVIOUSLY THE VALIDATOR WAS NAMED IsISO8601
04-09-2019 best
no, I have to use the iso standart
The string is valid 8601
One message removed from a suspended account.
@valid frigate considering that's what (new Date).toISOString() returns I'm pretty sure it is
I have question, how do I make a command which reads a text document and sends something random from that text file?
what language
node.js
use the fs builtin to read the file, split it at every \n, and select a random string from that array
can u give me a exampel ?
fs.createReadStream(path) if you want to stream it,
fs.readFile(path, callback) if you want to read it in one go
for that use you dont want to use a stream
can try
or at least, its unnecessary
okei
always depends on the filesize 
oh god
what?
.txt
The callback gets called when it finished reading the file
whats a good and lightweight messaging protocol in node?
nng has the feature i need but the node bindings fail to build and is largely undocumented and abandoned
nanomsg has issues precisely with the feature i need, and its node bindings are also largely abandoned
zeromq doesnt have the feature built in, but could be done manually, but its node bindings are a mess and full of problems as well
rabbitmq looks more stable but has a lot of shit i dont need and looks complicated af
node-ipc and pm2 busses look weird and just feels wrong to use idk why
most other things i found that look exactly what i need are libs from years ago that havent been updated since lul
basically i need the surveyor/respondent pattern, one process broadcasts a message to all others, and awaits a reply from all of them, preferably over the same socket, and preferably without relying on an external service or process like redis
without a master process
im mostly interested in zeromq, but it has a lot of issues complaining about memory leaks in its github, which makes me scared lul
how do i get all member data to appear when for example i give a bl! eval message.author
Radhy{
"id": "469625237873491990"
"discriminator": "001"
"username": "Radhy"
"tag": "Radhy#6716"
}
you'll have to eval message.member then
JSON.stringify your result
how do i do it
what happens when you eval message.author?
is there a rate limit for fetchRecommendedShards?
probably
it's a rest endpoint
all rest endpoints have a ratelimit
that's a weird eval
it's a built in eval
what does your eval code look like?
like i said, JSON.stringify it
stop overengineering
a built in eval??
and dont json stringify, util.inspect's alot more appropriate
@quartz kindle I can recommend Veza for IPC stuff
Its request => response
Like http
Pretty cool
ytdl I guess
i'll check it out
also, fetchRecommendedShards uses the /gateway/bot endpoint, which should fall into the "all requests" rate limit of 50/1s, am i correct?
I don't know what you are trying to do, but I don't think it's gonna be a big problem if you fetch that endpoint a few times?
Are you scaling shit?
im trying to make something scaleproof lul
the problem is that i dont have a master process
all processes are completely independent
Dunno, ask quick.db
that error doesnt say anything, try reinstalling quick.db
also, fetchRecommendedShards uses the /gateway/bot endpoint, which should fall into the "all requests" rate limit of 50/1s, am i correct?
yes, but with the recent changes to ratelimiting and internal api bans it's not safe to hardcode anymore
yeah i am aware its unsafe, but i dont have any other choice
How much guilds?
well, my use case is definitely not a problem at all, im just thinking what can i do to make it scaleproof lul
im thinking about a hypothetical scenario with 50 independent processes booting at once
Why no master?
to make it possible to decentralize, and clone across machines with near-zero configuration, as well as usable with pm2 cluster (main reason)
the only input the process needs is the total amount of processes
from there it will calculate the optimal amount of shards for each process, and begin booting them sequentially
@earnest phoenix that error doesnt tell us anything, we need more information
@earnest phoenix again, that doesnt tell us anything
we need more information, such as full error, what and how you installed, where you are hosting your bot
thats not the full error
post the full error
it has to be long, otherwise it doesnt explain whats going on
do you know what a callback is? @edgy orchid
@earnest phoenix try enable-pnpm in the glitch console
somewhat
@edgy orchid a callback is a function that you give it, to be executed after the first function is done
myFunction("something",functionThatWillRunAfterMyFunctionFinishes())```
it can be used in many different ways, the most common one being like this
myFunction("something", function(response) {
// do something with response
})```
Arent promises better now though?
define "better"
I know callbacks are relevant
Idk, I guess it depends
I see most going to promises
I havent used a callback in a while
promises were created to solve many problems with callbacks, and in general they are an improvement to readability and code flow, but sacrifice performance for it
like basically everything in programming
the easier it gets, the slower it becomes
okay idfk who uses python enough to help me but I want to list all the file sizes which ends with .mp3, .webm, .m4a
and then get the overall size
I can tell you how in js 
@unique nimbus os.listdir probably
promises are just sugar for callbacks
I am trying that it works and lists shit in the folder with the mp3 webm m4a
however it doesnt work and I am to retarded to figure out how
"doesn't work"
could you be any more vague
slice indices must be integers or None or have an index method
for file in os.listdir("./"):
if file.endswith(".webm",".mp3",".m4a"):
yes = os.path.getsize(file)
a = size(yes)
embed=discord.Embed(title="Deleting Files",description=f"File Size:{a}", color=discord.Color(randint(0x0, 0xFFFFFF)))
await ctx.send(embed=embed)
thats the error above
thats the code
however I need to redo the whole shit again
However I am to retarded to recognise the problem
so 
Make .endswith args into one tuple/list
the command works but says nothing needs to be deleted eventhough there are files which ends with .webm, .mp3, .m4a
give me a sec
nope
doesnt work
thats the whole code
Any errors
Wrong directory probably
try debugging it
prints/...
print the os.listdir thing
Let's start poking fingers at random things.
What is size
its an addon which basically changes interger from getsize into shit like 100M 1GB
etc
removing it doesnt make it work either so its not from that
@slender thistle
thats what im trying to avoid xd
I mean, most bots need a database anyway, so I don't see the problem if you create a new table
i mean, my queue system works pretty well, but like
my problem rn is that my lockfile doesnt get deleted if i restart the process with a bad timing
and then the processes wait forever and never login, because they cant secure a lockfile
i need to hook into pm2's shutdown signal
if you want stuff to scale you shouldn't be using file locks anyway
because as soon as you have more than one server that's 100% useless
yes, thats a problem for another day
it would, but it requires setting up a separate thing
Ur bot doesn't have a db?
my old code still uses a json db yes
Json is fine but gets very tricky when you wanna scale imo
Rewriting?
i wanna finish my setup before i start reworking it
im making a weird ass lib
im gonna call it djs-shanenigans
If I ever need to scale my bot it's gonna be the best project I ever made.
- job queue
- weird CDN with one server
- a server that streams files to voicechannels
But
that's ever happening lmao
i probably wont even need it either, but i wanna do it for the sake of doing it
because thats what programmers do
"why? because i can"
the way i've always scaled bots is just throwing better hardware at it 
Seems like a good solution tbh
NASA it is
At some point you can't run everything on a single server
or it's cheaper to break your bot down to multiple small ones
One message removed from a suspended account.
One message removed from a suspended account.
My bot has a command that has the ability to assign a random role to every person in a server that does not have a role.
does that fall under API abuse?
You should do it over time and not all at once
how much time would you suggest to be fair
@sage bobcat yes, you never call the function
Whever I dont know the rate limit for something or think it might be abuse I just do it 1 per second
n o tarp
Idk if it's api abuse tho 
thats bad
Shhh it's ok
@dusk gale once per minute
alright ill do that i guess
One message removed from a suspended account.
One message removed from a suspended account.
@sage bobcat then show updated code
https://cdn.discordapp.com/attachments/272764566411149314/604449094680707072/unknown.png i would refer to this
@onyx summit running everything on a single server has worked pretty well so far 
One message removed from a suspended account.
One message removed from a suspended account.
you didn't
You're missing a }
you're converting the function to a string
One message removed from a suspended account.
One message removed from a suspended account.
it's not missing a }
One message removed from a suspended account.
const Discord = require('discord.js');
module.exports.run = async (client, message, args) => {
function rollDie(sides = 6) { Math.floor(Math.random() * sides) + 1; }
message.channel.send(`you rolled a ${rollDie}!`)
}
module.exports.help = {
name : "roll"
} ```
One message removed from a suspended account.
One message removed from a suspended account.
Oh thats why
```LANG
CODE```
One message removed from a suspended account.
Mobile
```js ```
One message removed from a suspended account.
It looks weird lmao
One message removed from a suspended account.
One message removed from a suspended account.
this scares me https://i.imgur.com/hxec9v7.png
```js
console.log("hello world", 123);```
console.log("hello world", 123);```
vs
\`\`\`
console.log("hello world", 123);\`\`\`
console.log("hello world", 123);```
I wish mobile had syntax highlighting already :(
One message removed from a suspended account.
One message removed from a suspended account.
@topaz fjord scares why
One message removed from a suspended account.
Return
it's just clang-format'd code
Make a new line after js
i don't like the way it looks
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
that send isn't valid
One message removed from a suspended account.








