#development
1 messages · Page 1996 of 1
I know that, but what do I add after user.?
.id
like user.tag?
.id sends the User ID
<@!${user.id}>
All good lol
ik sorry i just realized
nothing sends when i use if (message.content.toLowerCase().startsWith("dababy")) { newUpdate.setTitle('DaBaby Bot has been updated to use slash commands and slash commands only') newUpdate.addField('If you don\'t see slash commands for this bot or they are not working click this link to regive permissions and permission to add slash commands:','[https://discord.com/api/oauth2/authorize?client_id=836069453389234206&permissions=532646526784&scope=applications.commands%20bot](https://discord.com/api/oauth2/authorize?client_id=836069453389234206&permissions=532646526784&scope=applications.commands%20bot)') message.reply({embeds: [newUpdate]}) };
nothing sends meaning it doesnt reply or the embed is blank?
Embeds can’t be blank as empty messages cause an API error
I don’t see his newUpdate var being initiated with the embed constructor
Just log your var newUpdate to see if it’s a valid embed structure
Also catch your errors of the reply() promise
Embeds can be blank
It results in a tiny square
after changing awaitMessage to awaitMessageComponent the error is gone, but after sending the captcha text, nothing happens ```js
const msg = await member.send({
files: [captchaAttachment],
embeds: [captchaEmbed]
}).catch((err) => console.log(err))
const filter = (message) => {
if(message.author.id !== member.id) return;
if(message.content === captcha.text) return true;
else member.send("Wrong Captcha").catch((err) => console.log(err))
}
try {
const response = await msg.channel.awaitMessageComponent(
filter, { max: 1, time: 1000 * 15, errors: ["time"]
}).then((collected) => console.log(collected.first().content))
if(response) {
member.roles.add(`${req.roleID}`).catch((err) => console.log(err))
member.send("You have been verified").catch((err) => console.log(err))
} else {
await member.send("You have not verified and I need to kick you. If you wanted to join again. Please answer the captcha thank you.")
member.kick("Have not answered captcha").catch((err) => console.log(err))
}
} catch (err){
console.log(err)
}```
Well it can’t be empty, never
You might be able to use some special (Unicode) chars to make it look like it’s empty but still an empty embed without content will cause an error
And that’s not relevant for his issue anyways
How can i use createIndex() while i am using schema in mongo db
const { Schema, model } = require("mongoose");
module.exports = model(
"History",
new Schema({
userId: { type: String },
tracks: { type: Array },
createdAt: {
type: Date,
expires: null,
default: Date.now() + 86400000 * 7,
},
})
);
I want to use TTL beacause i want remove data from mongo db after 7 days
Use a setInterval OR if you have a vps use a cron job that runs every day and deletes the entries that have a createdAt date of more 7 days ago
got it
just wondering how can i do list here like
"reason" : {
"reason-1" : "",
"reason-2" :"",
}``` and so on
its mongodb
Why not just save an array of reasons
mongoose
I think you can just do []
default: []```?
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| id | int | NO | PRI | NULL | |
| name | varchar(30) | YES | | NULL | |
| city | varchar(15) | YES | | NULL | |
| created_at | date | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
i want to add default constraint current_date to created_at column in mysql
can somebody help me in it
you may want to use Sharding Manager
if so then how can i solve the database connection ot?
hello i wanna know how I can create a leadboard by MongoDB if the collection is this
data: [
{
name: "Alex"
money: 100
},
{
name: "ahmed"
money: 13
},
{
name: "olever"
money: 67
}
]
hmmm, lead bot?
user manager probably
do note you cant change the name after verification
that texting style kills me
you mean
writing the text
like a fuckin haikai?
why
talk
like
this
Eris or discord.js?
Both are fine.
which one is better to use if you want a big bot?
something not based on js
Probably Eris since it's more minimal
I'm currently using discord.js and thinking about switching or using shardMananger
and there is a problem with shardManager since I also use db, but every shard boot has one connection, which will be a lot of connections
so after all, the question is whether djs or eris and sharMannagers or not
^ but if you must, make a database manager that queues requests
don't access the database directly from the bot's code, make a centralized manager
you mean i create a db in a separate file and only call it if i need a db for the x-y process
no i mean leadboard
like, keep the database access and the bot separate, then have a middleman pass requests do the database
I don't mean 2 different projects, you can run both on the same runtime
just have the middleman handle database calls, the bot pass requests to the middleman
then you misunderstood
you said you have issue with many database connections with sharding no?
hello i wanna know how I can create a leadboard by MongoDB if the collection is this
data: [
{
name: "Alex"
money: 100
},
{
name: "ahmed"
money: 13
},
{
name: "olever"
money: 67
}
]
i mean that there is eg bot.js and db.js the contents of db.sj is db connecton
bot .js is bot and if the command needs db then require (db.js)
no
like, never have the database and the bot talking to eachother
any request must be handled by a third guy
so the third guy is the only one creating connections
some libs have an internal pooler, some not
in which case you need to create the pooler yourself
why ask the same question twice
if you want a leaderboard you can just get the collection and orderby the returned integer
wait
if i know how to do i don't ask it.
old index.js
//SQL
client.con = mysql.createConnection({
host: process.env.host,
user: process.env.user,
password: process.env.password,
database: process.env.database,
charset: "utf8mb4",
});
client.con.connect((err) => {
if (err) throw err;
console.log("Connected database");
});
(async () => {
client.commands = new Map();
client.events = new Map();
await registerCommands(client, "../commands");
await registerEvents(client, "../events");
await client.login(process.env.TOKEN);
})();
//API
server.listen(process.env.PORT, () => {
console.log("API started in " + process.env.PORT);
});
AND shard MANAGER index.js
//SQL
client.con = mysql.createConnection({
host: process.env.host,
user: process.env.user,
password: process.env.password,
database: process.env.database,
charset: "utf8mb4",
});
client.con.connect((err) => {
if (err) throw err;
console.log("Connected database");
});
(async () => {
client.commands = new Map();
client.events = new Map();
client.prefix = process.env.PREFIX;
await registerCommands(client, "../commands");
await registerEvents(client, "../events");
await client.login(process.env.TOKEN);
})();
SHARD MANAGER more cennet
this is what I mean
yet there is absolutely no reason to ask the same question twice if it isnt even worded correctly, someone even asked what you ment already
you're not above the world
the shard should not have a connection at all
connection will be exclusive to the middleman
anyway, if you want to do it in the query, look at this: https://docs.mongodb.com/manual/reference/operator/meta/orderby/
not that hard to do a google search next time, this was the top result ;)
i don't want to use mongoDB i have a reason for it
if you want to do it in code, please care to note down what language we're looking at, so we know what the possibilities are
not u
node.JS
sorry
he's talking to the leaderboard guy
dw, just so you don't get confused kekw
yea quite a frustrating fella
if i use SHARD manager every shard that launches the stick will have a new connection one of which 1 is a lot
yes, don't do it
^
mysql has concurrency, you can freely communicate with a single manager across multiple shards
his issue is with many connections being created when using shardmanager
how
create a single instance of a mysql connection manager and inject it into the shard handlers
I don't know how DI is respected in JS, so I can't help you to figure out how exactly that works
I tried to connect to ShardManager only and the index doesn't get it anymore so I can't use SQL
nono, create all shard THEN pass the reference
or make a globally acessible variable
post creation yea, you may be best off if you run it in the shardhandler ctor
you can also check if the db is connected through there, so you can return if it fails
I don't understand now
I'd provide samples but I dont work with JS 😔
no worries
yes thats how it works, and no that shouldnt be a problem, mysql is designed to handle multiple connections at once
ideally the driver only wants one dbmanager and multiple connections to it
okay 25k server 25 db connection = problem
thats far too many connections yea
shouldnt be a problem, mysql handles hundreds of connections just fine
but thats inappropriate behavior for one application
they also list this officially
By default, MySQL 5.5+ can handle up to 151 connections. This number is stored in server variable called max_connections. You can update max_connections variable to increase maximum supported connections in MySQL, provided your server has enough RAM to support the increased connections.
it's best to keep the amount of connections low so you can run traffic through less tunnels
mysql server settings 151 max connection
concurrency is supported by a single connection due to the nature of sql queries, so one connection is fine
again, a global manager is ideal here, with multiple references to it
you cant do that
one connection is impossible if multiple shards are running in separate processes
the only thing you can do is have one connection in the shardingmanager and interact with it via ipc/broadcastEval
but are they in seperate processes
oh that changes things a lot, my bad then
that'll just result in concurrency over the internal code and lock functions
but if you need tb for a given command then i will make it a db connection in a separate file which I will call after that and then there is a connection until the script runs and then stops
and you don't have to constantly connect to the database unless you need to
its better to keep connections always on
you should have a constant connection running, that's how sql connection is intended
dont connect/disconnect all the time
okay but then how do i solve the fixed connection so that only 1 piece
if you don't need a shardmanager of course you wouldn't have a problem
^ might be the only approach, or having a completely seperate overhead which is completely unnecessary
you only have two options:
- each shard has 1 fixed connection, so 25 shards = 25 connections. but each connection is always on, you dont disconnect them
- you put 1 connection in the ShardingManager only, and all shards need to make a request to the manager, and the manager makes the request to the db, then db responds to manager, and manager sends response to shard
this is a good thing just for me even new to shardingmanager
I choose 2 nights
so shardmanager runs con.query
ok, then you need to make an ipc system between the shards and the manager
how
you start with this https://discord.js.org/#/docs/discord.js/stable/class/ShardClientUtil?scrollTo=send
and in the manager file, each shard that is spawned needs to have shard.on("message")
more or less yes
and what's the difference ??
not sure, but its easy to use and fast to integrate
shard.js ```js
shard.on("db_query", (query) => {
console.log("run");
});
test_cmd.js
```js
client.shard.send("db_query");
did you think of this ?
exists, I just don't know why it would be better than discord.js
shard.on("message", message => {
if(message === "db_query") {
...
}
})
the discord.js ShardingManager only supports 1 shard per process or worker, which will be very inefficient when you have a lot of shards.
hybrid sharding, or clustering, enables you to run multiple shards per process, for example instead of 24 processes and 1 shard each, you have 3 processes with 8 shards each
two popular libraries that do this for you are discord-hybrid-sharding and kurasuta
Are they any good?
never used them, but people who do say they are
is it better to use a hybrid sharmananger ??
generally yes, its better than having lots of processes
okay back to shard.onso i got dq_query
how to enter query data for example select .....
everything you want the manager to do, you have to send it in the message
then I can't have db_query and DB command as data
but I will send the request at once
depends on the lang
yes
ts
me and the bois using detritus that already does sharding by default
go back to genshin utils
this message is the reason i am switching to tiny discord
convert him
Erwin gave me drugs in exchange for advertising detritus
it's high for me i don't know how to solve itit's high for me i don't know how to solve it
damn that's hard
that's not what she said
high? like on drugs?
xd hard...
anyway without a shard manager it's so much easier
can't you do without it ??
without sharding it's so easy to get banned from discord api once you reach 2500 servers
uh... internal sharding is a thing
the only other option is to do the other thing i said, 1 connection on each shard
good i just can't solve this shit
but it won't be much ??
Step 1: Switch to detritus
Step 2: new ClusterClient();
Step 3: Done
read back on my other worries
@quartz kindle , isn't that going to be good?
is that file supposed to be named db_connet
1 character left but it doesn't matter
but now the socket io won't be good, fuck
need some simple alternative
sure it is
that require is wrong
should be ```js
// db_connet.js
module.exports = con;
// other files
const con = require("...");
con.query(...)
uwu
owo?
If I have the link of a message, Is it possible to get that message and send it again?
destructure the message link to get the message ID and channel ID, then fetch the message to get it's content
@quartz kindle okay the only question is what am i doing with this
server.listen(process.env.PORT, () => {
console.log(`Connected the ${process.env.PORT} port!`);
});
io.on("connection", async (socket) => {
console.log(socket);
});
SOCKET IO
but there is because we provide realtime-info on the web dashboard
just use normal websockets
They don't use Java they're not used to smashing their head on the wall
i don't stack my head i know what java is like unfortunately
if the removed role wasnt one of roles in roles array then it will remove all of the roles from member...
if(!added) return
HELLO
guys
I need help
Is there any AI Libraries that allow me to uniquely identify users through their voice

How are you gonna hear the voice?
If you're looking to recognize users by voice, you'll have to train your own model using Tensorflow perhaps.
Probably but that’s illegal
any idea how
no
It is for an app
not a discord bot
*against tos
Nothing is illegal in america
Oh
Tensorflow.
I mean
True. My teacher just told us this morning privacy is just a myth
like
its
Any pre-trained models
It's not a process I can break down into steps. Training AIs is a very complex and tedious task.
Google speech to text
but how to identify different users
And no pre-trained model will be of any use since you're trying to identify users by voice.
Damn
Is python good for ai? If so, why?
but like
does TensorFlow even provide raw data for audios so I can identify
The AI gotta know what the user sounds like and that why training is needed
you would need to feed the ai tons of user audio and teach it
I dont need to work it at a super large scale
Ai is large scale
just need a prototype
i made an ai to play ping (it predicted where the 'ball' would go, and move there). it took literal days to train the ai.
Time to go to stackoverflow
everything is legal in new jersey
Thank god
I was not able to remember
that specific term
You just go through this so you get a better idea of voice biometrics.
But then hefest got this run
thats like saying if you're homeless just buy a house
you're not wrong BUT NOT USEFUL EITHER
sounds like something andrew cuomo would say
Any py dev 
So slightly interesting question, anyone able to lend me their API token briefly for the topgg api 
Or quickly fetch like the top 10k bots for science?
@woeful pike 💋 heyyyyy, want to do science? Also holy fuck why is your name so hard to ping
https://dblstatistics.com/rankings/monthlyvotes get from there
View the historical performance of up to 32661 bots listed on Discord Bot List (top.gg). Updates hourly.
forgot about that
https://capy-cdn.xyz/i1lAJLxR.png @delicate zephyr is marco still a weeb who wants a body pillow 
@modern sable Prepare ur anus api
(I have one now)

You know you can like
Do that yourself
Do you not have your own API token?
what the fuck how is a bot in 13k servers getting 107k votes in 8 days
no i dont
because I dont have any bots on topgg anymore
Probably banned for abuse 
and servers dont get a fucking token to use :(

How do you have the role 👀
shhh
Luca™️
the same reason why I have topgg premium despite cancelling nearly 6 months ago

lol
Abusing i knew it
Damn hackers everywhere 😄
Bruh
I better don’t ask why you should buy topgg premium
always has been
i logged out during the outage, now i'm getting notis for 2 accounts
Outage?
api outage
Got no issues on my end today
gc ?
google cloud
Ah well my services don’t use external services also not cf
Ngl im quite surprised how many system used GCP consider they seem to have one of the lower sides of reliability
although then again idk
rip role

I gotta go add a bot now to reclaim my role 😢
Not like the role matters anyway
literally 1984
That’s damn important!
You aren’t anyone without a discord role
Idk what this even is tbh
I’m not doing any research but okay
Must be something because I’m a good boy 
its becauuse you placed and won a bid recently

yeah
Ah lol didn’t even notice that
Imagine u care about roles
Imagine u care about a different color code in ur name
Most important thing in live, don’t you know? 
Imagine paying for nitro to get emojis
Imagine
😢 I need temporary green role plz
But science
and wait one to two weeks to be approved 
why am i watching dragon ball videos instead of coding
Cuz thats more fun
Because dragon ball is legendary
That would be too useful
Dragon deez nuts
I have never watched dragon ball tbh
bindge listening to stereo sayan 3d
Shhh nitro user
lmao
Best character is Mr. Satan 
He is the most powerful ofc
Aye
no role gang 
Im in luck! Someone has already scraped all content off topgg and made it a dataset

you cant ban me ethically because I've publically mentioned and demonstrated that issue several times already
lol
im grabbing my unethical ban hammer
That makes you belong to a minority
And you know what happens to them 
also xetera have you heard of the new digitalocean serverless feature

Did DO not have Serverless to begin with 
i mean i might be getting free sammy slippers so thats a plus
unless you're telling me that DO now supports floating ips for kubernetes nodes I'm not interested
You gotta choose Hetzner for that
I use k8s 8 times

oml i found another bot posting fake server counts
i mean dblstats is helpful for finding them 
If I declare variables like this:
let list1 = ["i contain a string", "and another string"];
let list2 = ["woo", "asdf"];
let list3 = ["cool array", "idek"];
let list4 = ["aihuwerhuiawehuip", "arrays"];
In a loop, could I get each variable?
for (let i = 0; i < 4; i++) {
list[i] = ?;
}
we have not
disappointing
i found one earlier posting nearly 60k+ higher then it should
Abusing the API will let you end up as white name.
And nobody wants to be a white name.
Look at those poor fellows Klay, and chillfish 
nope it doesnt work like that
you'd have to make an object
I dont think you even get the server count outside of webscraping
Aight that's what I thought. Thank you!
i wish there was a way (without extension) to force all bot pages to be in dark mode 
you can already do that no?
sign of jealousy 
idk but im using dark mode and just got fucking blinded
you can do something like
const list = { '1': [1,2,3], '2': [4,5,6] };
list[1]; // [1, 2, 3]
list['1']; // [1, 2, 3]
try dark reader
Anyway, we have science
smart
👍 thank you
iirc they use ghost for their blog
next update in order to get an api key you have to first check a box that says "I swear to tell the truth, the whole truth nothing but the truth so help me god" before you can click reveal token button
Yeah but you can at least detect the theme (as class of the html tag) to adjust your design
lol
next update: let servers have api keys so i dont need to hunt the planet to get a list of all bots
server count fraud decreases to 0% 📉
well i'll snitch so https://top.gg/bot/463733562601111553
plus invite doesn't work
just tried and https://capy-cdn.xyz/ocx4z8kO.png
still bright
cut the guy some slack he's running a moderation bot its rough out there

that's just a crime
holy christ
can;t even invite the moderation bot
I love my method doesn't exist errors
Attempt two thistime without vaugly leaking data
looks in cache for old keys

Too late
yeah 
Got recorded and archived already
oh well

scinc
anyone have any ideas? after reinstalling vsc on arch i cannot sync my settings anymore
come on vsc at least a status code :(
every day i get closer to ditching cpanel
do you not get any more info from logs if you can adjust the log levels?
I mean cpanel in itself should be enough of a reason no?

good idea honestly
"Due to the nature of off-site storage, the process of transferring and restoring accounts is a rather lengthy and time-consuming process." its been like 12 hours
now https://capy-cdn.xyz/RH8XeYj3.png on my api
even tho the cpanel server doesn't use phusion
so if tuples and arrays are fixed length is there anything that can be any length in rust?
vecs?
oh forgot that is a thing in rust
things that are stack allocated aren't re-sizeable
ic
A vec is a dynamically size array on the heap
bros over at phusion passengers never investigated in their life 💀
So a vec is pretty much an array but without a limit on size?
generally it'll reserve a given size, then when that runs out of space, it will re-allocate generally n * 2 items
basically
Well, it's a varible length array
Not sure what that means
Means it has all the other behaviours except it's resizable
ic
I find the bitwise stuff interesting never bothered using that stuff that often
what is this in relation to?
Nothing really I just found it as an interesting thing since I never bothered messing with bitwise operators
binary logic
but the others make no sense to me
also holy fuck that text is hard to read
eek
yellow was not a good option
that is how all their examples look
Ig I made it a bit better
I turned dark reader on
ever wondered how to get the first byte/8 bits of a number?
num & 255
you're welcome
I dont really understand binary related stuff
it gets very simple once you know it
you should also definitely understand it
it will help you move onto lower level things
because thats really how numbers work
I made some code that parsed inputs from a ps4 controller about a year ago. It learnt me a bit about bitwise operators and other low level stuff and was pretty fun. Can recommend if you have a ps4 controller about
i hate this crap.
i've literally been staring at my screen for like 30 minutes trying to think of anything to write for any of them 😂
self evaluation is dumb anyway 
oh, i can roast my own performance fine. but like, they literally gave us the template for the design doc, told us what app to produce and junk
i feel like they are trying to like, get feedback on the course contents/structure as part of my final assessment
which just annoys me 😂
fml
this discord autocomplete is a nightmare to work with
my use case is too damn complicated
Yes as you can’t force the user to choose an item
You got to verify each input
After providing lots of resources for the search already
my issue is that when a user clicks on an option, the option name is written in his slash command, rather than the option value
which screws up my idea for accepting arrays of values
Wut?
Can’t you stick with both being the same?
this is what happens when the user clicks on one of the autocomplete options
the name of the option is what discord choses to add to the user's full command
and not the value of option
But don’t you get the name as argument when processing your slash command
well that's kind of the point
it wouldn't be nice to display an ID for value because using the name wouldn't be reliable
Is that only the UI showing the option name or do you also get the name as argument when handling you slash command?
just the ui
the problem is that it screws up if you try to backspace and edit it
you get the name and value when the command is submitted
Yeah that is annoying
I agree there
if you leave it as is, you dont get the name, you only get the value, but if you press backspace to edit the input, you lose the value completely, and the name becomes the full thing
Would it be better when hitting backspace they show your previous input?
lol I don’t know that
God damn
Wtf
for example
user types abc, gets autocomplete option with nameabcd united states and value 1
user clicks the option and sends the command, you receive 1
user clicks the option and presses backspace then sends the command, you receive abcd united states
lmao I got the first time
Just didn’t know that’s a thing
Let’s hope the interaction rework Voltrex mentioned fixes that
that sounds like a saturation problem
Once it’s live, 2032
this is what i ended up doing to make it support arrays
but i have validation issues on intermediate values now
oh would you like variadic arguments
yeah
also, some of those IDs can have different variants lmao, i have no idea how im gonna implement that
Hmm seems to be an issue
I mean a dynamic amount of arguments is probably to complicated for the user
Even if they have a name
my entire bot is too complicated for the average user
its too complicated even for myself
Time to throw everything off, get back to the EU
I’m sure I will find something for you to do
Even if that’s on our continent it doesn’t belong to the EU
Ha ha it won’t
Maybe in like 10y if the EU is fast
I guess that’s enough time for Russia to replace the government with one which doesn’t wanna join thr EU anymore
lmao
Don’t get me wrong I don’t wanna get into politics in here or wanna appreciate war in any way but how the world reacted to Putin and his statements what will happen is no surprise
And not subjectively spoken what he does makes sense
always has been
dudes invading georgia in 2008
I mean when looking at the gas(olin) price the EU will indeed become a war zone in the near future
In rust when would a if let expression be useful?
like Kazakhstan!
If you need to do something if the value exists
Even the dumbest people will notice that the global oil price has not grown that much we pay here for oil atm
So if the value exists in the variable?
So it is essentially guessing?
No, it's checking if opt's enum case is Some
Do you know what enums are in Rust?
I mean enums are pretty global across most typed langs isnt it?
Does rust handle enums differently?
It's like them, with a few subtle differences, though they're small and probably not relevant here.
How was if let explained to you?
Not in java/c# afaik
Ah, yes that matches.
if let is still an if, but used for pattern matching, like it says. My if let Some(x) = opt is an example of pattern matching for opt and Some(x).
Does it just take in things that you want to look for and then it checks based on whatever you pass after the =
Yeah
In your example, you checked if the first element in the tuple was Rust, and it was, so it passed.
Not exactly. There was no guessing for c and d. They're just bound variables, like how you would use a let
would it stll evaluate as true?
ah ok
It would fail since the number of elements does not match.
so what if course was let course = ("Rust", "Advanced", "Course")
and I only checked for rust like in that first example
Would it still run through or since everything else is incorrect would it fail?
Do you still have c and d?
nah
Then it would fail since the number of elements don't match.
🤔
It would be redundant to use if let in that case anyway since you're not binding anything.
Number of elements?
The number of items in the tuple. course as shown above has three.
yea
But if you did
let course = ("Rust", "Advanced", "course");
if let ("Rust", "beginner","course") = course {
println!("Wrote all values in pattern to be matched with the scrutinee expression");
} else {
// do not execute this block
println!("Value unmatched");
}
It wouldn't match, but it would still compile and run.
I see
But like I said, that would be redundant.
So everything you pass must match exactly
ye
Yes, except for the bound variables.
You should use it when you need to check for the existence of an enum variant (e.g. Some) or that some value in a destructuable data type exists while having a need to bind other values to variables.
A bit complicated, but what means is the two use cases demonstrated here.
I see
Either for things like Option, or for matchable things like tuple, structs, etc.
Anyone familiar with the error:
errno: -99,
code: 'EADDRNOTAVAIL',
syscall: 'bind',
ip: 'proper IP is in here'
This is using a package with a rotator function for ipv6 blocks. The block is accepted, and in the error msg it does indeed print out a proper ip. Why wouldn't it bind to it 
I wonder if processes feel like they're getting mixed signals when they receive multiple termination signals.
Protest to add feeling signals where processes can signal to each other how they feel about each other. First being SIGHORNY
hi guys!
can i ask how can i add a image to my bot long describtion? i can't add to it
Html img tags
wha?
thank you
I was trying to create a sticky command but there's an error Assignment to constant variable. https://sourceb.in/iRUEezSsox The error came from messageCount++
after changing some code, the command works but the sending message not working https://sourceb.in/hitIy0nu0z
I have this error and I also know why.
SyntaxError: await is only valid in async functions and the top level bodies of modules
But I would like to ask if there is a way to avoid this error because I need this function inside the code and I cant take it outside.
you can't await for things without async
I know 🙂
you cant have a function that claims to return a result immediately wait 10 seconds for a calculation. That's why the async thing is there
but idk how to fix this inside a lot of code blocks
err?
how can i put this on between the page?
show code
you can use self executing async functions
You shouldn’t drink and drive chat. 
bruh
can u give me an example?
Hi, when I click on invite people button, I get this popup saying that invites are disabled.
This server?
the only invite allowed here is discord.gg/dbl
no
my own
when I right click on a server and click on invite people
look
It could be a bug or glitch
But it said like you didn't have permission for it
I have given the perms that it needs
so that can't be the reason
I have enabled create invite perm
Try look at invites option in server settings
It's could be a glitch
breh
where can I report it?
I can not tell you exactly
Take a look at this
ohk thanks
hello, i have an object in the object i have more than 100 array how i can get 0 to 9 or 10 to 19 from the object
I dont know if I get what you want, but I think that u can do a for cicle starting from the position 0 to pos <= 9
array.slice(startingindex, endingindex);
ty
ill use this thank you
what error
the way of registering slash commands for d.js is so messy
you have to import 4 different modules and kind of have to interact with the api "by hand"
d.js is really deviating from its simple and predictable syntax
I would honestly use pure api instead of djs at this point
groovy diver log, entry no. 52: today I learned constructors are optional
There can also be multiple constructors / methods... aka you can overload methods and constructors 
ye
and you can pass named properties in the constructor, you don't need to follow the parameter order
I'm having a lot of fun reading the docs ngl
client.application.command.create() or .set()
Very complicated syntax 
I can say that i had fun.. but no im not gonna say it cuz ive faced so much problems with that, that made me lose my brain
If you have to import the builder tool to create a simple object then idk what else to say
And beg for help in alex's dms
kekw
I kinda like how it is very java but with the best of ruby and js
MongooseError: Operation partnerWorld.findOne() buffering timed out after 10000ms
Still get this err and idk how to fix it
Idk why it buffers but doesnt find the model
thats the error 
shows only the function name iirc, doesnt display the filters inside it
Maybe try after sometime... faced this issue many times but never tried to figure out the right reason..... tried after like a couple of minutes and worked fine 💀
docs are always fun to read! ❤️
from an Array of objects extracted from MongoDB, how can I do a list inside an Embed?
you gotta loop through it (or map it) and add the object values as fields
embed.fields = [
{ name: "title", value: "value" }
]
don't know how your object looks, but if it contains the fields title and value, then it wont be a big deal


⚠️ extremely mathematical question ⚠️
I have a 2d canvas with the player somewhere on the screen. The player is rotated, for example 45deg facing the top right of the screen and wants to move forward. My question is how do I calculate the x and y coordinates to move the player based on their rotation.
realizes how badly phrased the question is
suppose the player is facing this direction
If I understand correctly you could use some trig
i have never done that in school
Your x and y for a radius of 1 would be (cos(angle), sin(angle)) iirc
what
Ok so you have an angle right
yes
And you want to walk a certain distance in that angle right
also yes
Here’s a graph to represent it with radians
Think about 0 as your starting point
And I multiplied the cos and sin by 10 to make it a longer distance
(Pi/4 is just 45 degrees in radians)
Ok wait I found how to turn Desmos to degree mode
Is there a possible way that I can make a diffrent device rerender? Like Device A clicks button and counter gets increased on Device B?
I’m not sure if that answers your question but that’s what I’m thinking of @earnest phoenix
hmm maybe i am listening to you maybe i am silently installing a library to handle it for me
can someone help me out with something ill show you in a discord call
It's better you explain your problem thoroughly here
according to my mom, you have to use the direction the player is moving as the hypothenuse and the sides it is moving towards as the legs of the triangle. then i can calculate the distance the player travelled on the hypotenuse using some trig bs to get the final position
i don't understand it myself
Talking to ashton
Yes
okay so my bot wont clear the warning given when i do =clearwarns <user> ..
Is there a possible way that I can make a diffrent device rerender in ReactJS? Like Device A clicks button and screen gets rerendered on Device B?
I was essentially following this concept with my solution
Which is the same idea your mom was talking about
You'll have to use websockets
device A sends a message to server -> server sends message to device B -> device B re-renders
have a websocket on both devices connected to the server
device a button click => send request to server => server sends a websocket event to device b => device b updates state to display data
ok first i have to learn how to draw a triangle
thank you and @earnest phoenix ! That's what I was looking for! Amazing
welcome
You can simply think of a triangle to calcuate length A and B
At an angle of 45° (facing the top right) both other angles of the triangle are known
The length of your player moving forward is also known
To calculate A + B is just simple here
Once you got A calculated, you add your start point on x to it (in my example A + 11 = 14 (x))
Once you got B calculated, you add your start point on y to it (in my example B + 11 = 14 (y))
And there you go
Yes that’s a good explanation
Of course that requires to know the exact start point
But for his use case I think he needs trig rather than manually calculating side lengths and such
Because 45-45-90 triangles are a special case
As he said he wanna go with 45°
There’s probably a ton of different ways to do it
But that might not always be the case
I just went based off of what I interpreted it as
As long as you got one side length and a adjacent angle you can calculate it
Yeah
just wanted to give an human understandable example for 45°
Yes that’s good
completely fucked up labeling but who cares
Although I’m just now realizing your explanation for that is technically wrong because those side lengths aren’t perfect numbers
The side length for each of those sides would be hypotenuse/sqrt(2)
But yeah I get what you’re saying
As I said the label (legend) is also wrong
As the side length A would be opposite to alpha
Fair
didn't find a better img to manipulate real quick
Those sides would be 5sqrt(2) each
But yes for readability purposes it’s a good example
fine... now listen to your math teacher again
the angle is variable
maybe i should actually use a game engine at this point
always add the most important parameters after someone answered
No it’s still fairly simple
@earnest phoenix do you know how long the hypotenuse of the triangle will be?
no
...do you know how long any of the sides will be?
....no
They don’t need to be constant you just need to have it
Certainly walking at an angle will be walking for a distance, right?
yep
in my case the player is going at a constant speed till they hit an obstacle
so in the 45deg example the legs of the triangle would be y of the player to y 0 and x of the player to somewhere unknown
The player’s x and y in the form (x, y) will be (cos(angle) * hypotenuse, sin(angle) * hypotenuse) iirc
Like say the player walked 2 meters at an angle of 45 degrees, that means their position is (cos(45) * 2, sin(45) *2)
Which means their x y position is (sqrt(2), sqrt(2))
And the same thing could be done with any angle
in canvas the x axis is at the top and not bottom
Then account for that
so 45deg is bottom right
I’m talking about from the origin
ok
You can tweak the numbers to work for you but that’s the basic concept
ty
don't forget that math functions in js accept numbers in radians not degrees
^^
he had a little bit of hope to make it, now you blow up his mind
npm i three
The formula to convert degrees to radians is degrees * pi/180
radians is a scam
bad
Are Radian democrats or ..?
why lol
Long live 360!
Radians are so much easier to calculate though
what the fuck is a radian
Example
It’s basically a different way to measure an angle
180 = pi
oh
pi/2 radians is half of half of a circle, so 90 degrees
so it's easier in that circle / smth = pi / ( smth / 2 )
If you ever do some sort of trig class try not to make the association between converting between radians and degrees all the time, try to understand them as their own unit if possible
hello
what are we talking about
Trig stuff
meth
the seven deadly sins of math class
right angled triangles or just any old triangles?
Those measures are in radians
hmmmmmm yes
How can I delete a document from mongo?
Also the Math.sin() and all those trig functions are approximations of trig, I’m not sure if it’s due to floating point inaccuracies or if it’s a more advanced algorithm for speed
So it’s not going to be 100% accurate
But it’ll be good enough
An hour long chat on how to move a ball in a game of pong
To be fair calculating angles and stuff like that isn’t a small subject
I knew my trig knowledge would become useful some day 
they are good enough approximations for whatever you're trying to do
I highly recommend taking a trig class of some sort if given the opportunity, it’s a very interesting subject and it’s pretty useful in the dev world
there are probably some libraries which can truly compete the value
Yeah
But that’s for more intense applications than what you’re calculating
Probably more computationally expensive too
Trig class be like
meh I'm sure you can use the FPU built into the CPU which has very good performance
(float processing unit)
No no trust me it’s very interesting
alright
two more years till im forced to study it in school
It’s not very hard it’s just a very different way of thinking compared to what traditional math classes before trig had taught
what does sin and cos actually mean
algorithms which produce special numbers allowing you to do things like calculating missing sides/angles etc
🚪 ⬅️
i have literally written 0 lines of code since this conversation began and you're making me more confused
they're trig functions, sine and cosine
(he's saying don't sin because it's bad)
bad humor ^_^
What if I tan?
out
i saw a youtube video titled why sin and cos don't mean anything
racist
have you ever heard of sohcahtoa
I don't watch anime
sin = opposite / hypotenuse, cos = adjacent / hypotenuse, tan = opposite / adjacent
SOH, CAH, TOA
https://capy-cdn.xyz/knMU2q0z.png fuck i accidentally rented a vultr $1000 server 
luckily its billed hourly
assuming x is your angle, these are the sides relative to that angle
its $1 an hour
all the power in your hands
a nitro subscription every 10 hours
lmao
run an ai pong simulation on it for the entire month
delete your account
bitcoin gold in cgminer 😎
damn that's actually a really good approximation
that shit isn't even worth 300 bucks, dude
the bandwidth is weird
only 10tb for a 1k server?
my free oracle vps gets 2tb a month lmao
Not only that dude…
Wtf just a 24c CPU and just 256GB of RAM?
Not even going to argue about the disk
Just shit worth like a cheap dell server for ~ 220 bucks/month
Not a single penny more
yeah I have more storage in my own pc than that server has lmfao
and I don't even have much
Most be the worst provider he could find on the market
i cancelled it 
Fuck I accidentally bought a mansion instead of an apartment
i'm not paying $1000 a month when i have £0.05
Thank god they bill me monthly
You’re close to be as poor as Tim
imagine drawing a circle without them
Pain
sin and cos are the most useful of all the trig functions because all the others are derived from them
Just get rid of one dimension and things are getting way easier
😩
Tim Holland
Questions for all;
- What tier of hardware would you say you have?
- What tier of production machines do you have? e.g. low - high end.
- Have you ever tried to make the most of your hardware by deliberately trying to optimize your environments (whether it be for gaming or a production env) or are you complacent with how things are right now or do you tend to just throw more money at it?
- Pretty decent for the usecase
- Mid-end, nowhere near highend
- Yep, but no money to throw at it
k

Basically, I'm trying to metric how often developers go out of their way to make their software work better or at all for lower end hardware
ah fair enough
I have an old PC i'm going to turn into my backup server as my VPS can be a bit temperamental
For instance, I used to use official discord.js until my production machines just could not keep up in memory usage. Since then, I made a cacheless version and I maintain modular libs called CloudStorm and SnowTransfer which are gateway and rest libs with no caches. I also remade lavalink into a node application because it used too much ram than I'm comfortable with. If I had to estimate ram savings, I'd have to say close to 1-2GB currently. I have an 8GB production machine, but I used to be running on a 2GB. Ram usage previously was close to 3GB and now less than 1GB
Nice
I use Discord.js and have an 8gb ram VPS with ryzen 9
which is really good price
but then tbf i do host 3 bots on there (2 py, 1 js)
how much does the djs one consume
50-60mb ram max?
really not a big bot
my py one used 500mb+ because it made 2 DB queries every user join
now it just uses axios to send a get request to my api
Oh. If it isn't big and not particularly expensive feature set, then I can see that.
oh christ thats a lot of servers
this stats graph shows how insane my ram usage used to be and how it correlated with guild count
smol
not bad at all
?
literally as soon as I replaced the db queries the bot makes with api calls (still db, just as api lol) the ram dropped 10x
yeah. Spreading loads to multiple processes across multiple machines is the way to go
- low end
- low end
- yes i microoptimize my shit
first 2 are really interesting to know. 3rd is really obv

Own up, which one of you did this

