#development

1 messages · Page 1996 of 1

earnest phoenix
#

<@id>

earnest phoenix
blissful coral
#

.id

earnest phoenix
#

like user.tag?

earnest phoenix
blissful coral
#

<@!${user.id}>

earnest phoenix
#

ok, ty!

#

Bruh

#

You

#

Exactly what I said

blissful coral
#

All good lol

earnest phoenix
whole glen
#

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]}) };

austere surge
#

nothing sends meaning it doesnt reply or the embed is blank?

boreal iron
#

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

lyric mountain
#

It results in a tiny square

bright hornet
#

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)
}```
boreal iron
# lyric mountain Embeds can be blank

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

bright thorn
#

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

earnest phoenix
bright hornet
#

just wondering how can i do list here like

"reason" : {
     "reason-1" : "",
     "reason-2"  :"",
}``` and so on
#

its mongodb

earnest phoenix
#

Why not just save an array of reasons

bright hornet
#

thats what im asking

#

so its type: array?

earnest phoenix
#

Oh depending on the lib ur using for mongodb

#

are u using mongoose or smth

bright hornet
earnest phoenix
#

I think you can just do []

earnest phoenix
bright hornet
river hull
#
+------------+-------------+------+-----+---------+-------+
| 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

earnest phoenix
#

you may want to use Sharding Manager
if so then how can i solve the database connection ot?

spark flint
#

No

#

Against tiktok tos

solemn jolt
#

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
  }
]
lyric mountain
#

hmmm, lead bot?

#

user manager probably

#

do note you cant change the name after verification

spark flint
#

that texting style kills me

lyric mountain
#

you mean
writing the text
like a fuckin haikai?

spark flint
#

why
talk
like
this

earnest phoenix
#

Eris or discord.js?

sudden geyser
#

Both are fine.

earnest phoenix
#

which one is better to use if you want a big bot?

lyric mountain
#

something not based on js

sudden geyser
#

Probably Eris since it's more minimal

earnest phoenix
#

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

lyric mountain
#

don't access the database directly from the bot's code, make a centralized manager

earnest phoenix
#

you mean i create a db in a separate file and only call it if i need a db for the x-y process

solemn jolt
lyric mountain
#

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

earnest phoenix
#

then you misunderstood

lyric mountain
#

you said you have issue with many database connections with sharding no?

solemn jolt
#

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
  }
]
earnest phoenix
lyric mountain
#

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

tranquil nymph
#

why ask the same question twice

#

if you want a leaderboard you can just get the collection and orderby the returned integer

solemn jolt
earnest phoenix
#

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

lyric mountain
#

this is what I mean

tranquil nymph
#

you're not above the world

lyric mountain
#

the shard should not have a connection at all

#

connection will be exclusive to the middleman

tranquil nymph
#

not that hard to do a google search next time, this was the top result ;)

earnest phoenix
#

i don't want to use mongoDB i have a reason for it

tranquil nymph
#

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

earnest phoenix
#

node.JS

earnest phoenix
lyric mountain
#

he's talking to the leaderboard guy

lyric mountain
tranquil nymph
#

yea quite a frustrating fella

earnest phoenix
lyric mountain
#

yes, don't do it

tranquil nymph
#

mysql has concurrency, you can freely communicate with a single manager across multiple shards

lyric mountain
earnest phoenix
#

how

lyric mountain
#

oh wait

#

nvm, misread ur text

tranquil nymph
#

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

lyric mountain
#

what u said does work

#

you just pass the reference to all shards post creation

earnest phoenix
#

I tried to connect to ShardManager only and the index doesn't get it anymore so I can't use SQL

lyric mountain
#

nono, create all shard THEN pass the reference

#

or make a globally acessible variable

tranquil nymph
#

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

tranquil nymph
#

I'd provide samples but I dont work with JS 😔

earnest phoenix
quartz kindle
tranquil nymph
#

ideally the driver only wants one dbmanager and multiple connections to it

earnest phoenix
tranquil nymph
#

thats far too many connections yea

quartz kindle
#

shouldnt be a problem, mysql handles hundreds of connections just fine

tranquil nymph
#

but thats inappropriate behavior for one application

#

they also list this officially

quartz kindle
#

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.

tranquil nymph
#

it's best to keep the amount of connections low so you can run traffic through less tunnels

earnest phoenix
tranquil nymph
#

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

quartz kindle
#

you cant do that

cinder patio
#

one connection is impossible if multiple shards are running in separate processes

quartz kindle
#

the only thing you can do is have one connection in the shardingmanager and interact with it via ipc/broadcastEval

tranquil nymph
#

but are they in seperate processes

quartz kindle
#

yes

#

thats how the djs ShardingManager works

tranquil nymph
#

oh that changes things a lot, my bad then

#

that'll just result in concurrency over the internal code and lock functions

earnest phoenix
#

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

quartz kindle
#

its better to keep connections always on

tranquil nymph
#

you should have a constant connection running, that's how sql connection is intended

quartz kindle
#

dont connect/disconnect all the time

earnest phoenix
#

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

tranquil nymph
quartz kindle
#

you only have two options:

  1. each shard has 1 fixed connection, so 25 shards = 25 connections. but each connection is always on, you dont disconnect them
  2. 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
earnest phoenix
earnest phoenix
#

so shardmanager runs con.query

quartz kindle
#

ok, then you need to make an ipc system between the shards and the manager

quartz kindle
#

and in the manager file, each shard that is spawned needs to have shard.on("message")

earnest phoenix
quartz kindle
#

more or less yes

spark flint
#

there is a really good shard manager

#

hybrid sharding or something like that

earnest phoenix
spark flint
#

not sure, but its easy to use and fast to integrate

earnest phoenix
# quartz kindle more or less yes

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 ?

earnest phoenix
quartz kindle
quartz kindle
#

two popular libraries that do this for you are discord-hybrid-sharding and kurasuta

solemn latch
#

Are they any good?

quartz kindle
#

never used them, but people who do say they are

earnest phoenix
quartz kindle
#

generally yes, its better than having lots of processes

earnest phoenix
#

okay back to shard.onso i got dq_query

spark flint
#

i use discord-hybrid-sharding

#

thats it KEKW

earnest phoenix
quartz kindle
earnest phoenix
#

but I will send the request at once

old cliff
#
interface Data {
    [key: string]: string | Data
}```
Is this valid?
#

🤔

lyric mountain
#

depends on the lang

old cliff
earnest phoenix
quartz kindle
#

go back to genshin utils

earnest phoenix
quartz kindle
#

lmfao

#

what did erwin do to you

marble juniper
#

convert him

earnest phoenix
earnest phoenix
earnest phoenix
earnest phoenix
earnest phoenix
#

can't you do without it ??

earnest phoenix
quartz kindle
#

uh... internal sharding is a thing

quartz kindle
earnest phoenix
earnest phoenix
#

Step 1: Switch to detritus
Step 2: new ClusterClient();
Step 3: Done

earnest phoenix
#

@quartz kindle , isn't that going to be good?

earnest phoenix
#

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

quartz kindle
#

should be ```js
// db_connet.js
module.exports = con;

// other files
const con = require("...");
con.query(...)

split hazel
#

uwu

quartz kindle
#

owo?

neat ingot
#

iwi?

#

nvm... ill see myself out...

stiff lynx
#

If I have the link of a message, Is it possible to get that message and send it again?

hybrid cargo
earnest phoenix
#

@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

quartz kindle
earnest phoenix
lyric mountain
#

just use normal websockets

earnest phoenix
earnest phoenix
stiff dust
#

if the removed role wasnt one of roles in roles array then it will remove all of the roles from member...

delicate shore
#

HELLO

#

guys

#

I need help

#

Is there any AI Libraries that allow me to uniquely identify users through their voice

severe perch
delicate shore
#

I just do

#

a school project

severe perch
#

How are you gonna hear the voice?

atomic kindle
#

If you're looking to recognize users by voice, you'll have to train your own model using Tensorflow perhaps.

severe perch
#

Probably but that’s illegal

delicate shore
#

no

#

It is for an app

#

not a discord bot

earnest phoenix
severe perch
#

Oh

atomic kindle
delicate shore
severe perch
delicate shore
#

like

austere surge
#

its

delicate shore
#

Any pre-trained models

atomic kindle
# delicate shore I mean

It's not a process I can break down into steps. Training AIs is a very complex and tedious task.

earnest phoenix
delicate shore
#

but how to identify different users

atomic kindle
#

And no pre-trained model will be of any use since you're trying to identify users by voice.

delicate shore
#

Damn

earnest phoenix
#

Is python good for ai? If so, why?

delicate shore
#

does TensorFlow even provide raw data for audios so I can identify

severe perch
neat ingot
#

you would need to feed the ai tons of user audio and teach it

delicate shore
#

I dont need to work it at a super large scale

severe perch
#

Ai is large scale

delicate shore
#

just need a prototype

neat ingot
#

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.

delicate shore
#

Time to go to stackoverflow

atomic kindle
spark flint
delicate shore
#

I was not able to remember

#

that specific term

atomic kindle
#

You just go through this so you get a better idea of voice biometrics.

earnest phoenix
slender wagon
#

install git

#

ez pz

next crown
#

But then hefest got this run

split hazel
#

you're not wrong BUT NOT USEFUL EITHER

sudden geyser
boreal iron
modest maple
#

So slightly interesting question, anyone able to lend me their API token briefly for the topgg api EYES

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

spark flint
modest maple
#

forgot about that

spark flint
modest maple
#

@modern sable Prepare ur anus api

modern sable
#

(I have one now)

spark flint
delicate zephyr
#

Do that yourself

#

Do you not have your own API token?

spark flint
#

what the fuck how is a bot in 13k servers getting 107k votes in 8 days

modest maple
#

because I dont have any bots on topgg anymore

boreal iron
#

Probably banned for abuse KEKW

modest maple
#

and servers dont get a fucking token to use :(

earnest phoenix
delicate zephyr
#

How do you have the role 👀

modest maple
#

shhh

spark flint
#

Luca™️

modest maple
#

the same reason why I have topgg premium despite cancelling nearly 6 months ago

boreal iron
spark flint
#

lol

boreal iron
#

Abusing i knew it

spark flint
#

i can't even get top.gg premium

modest maple
boreal iron
#

Damn hackers everywhere 😄

modest maple
#

oh longer than 6 months lmao

#

Man I didn't realise how long it's been

delicate zephyr
boreal iron
#

I better don’t ask why you should buy topgg premium

modest maple
#

you shouldn't

#

but err

#

yes

spark flint
#

discord mobile is fucke

#

d

boreal iron
#

always has been

spark flint
#

i logged out during the outage, now i'm getting notis for 2 accounts

boreal iron
#

Outage?

spark flint
#

api outage

boreal iron
#

Got no issues on my end today

spark flint
#

bruh

#

what

#

it was down for like an hour

#

so was spotify

#

it was a gcs issue

boreal iron
#

gc ?

spark flint
#

google cloud

boreal iron
#

Ah well my services don’t use external services also not cf

modest maple
#

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

spark flint
#

rip role

boreal iron
modest maple
#

oh

#

mother fucker

#

GUN Own up, which one of you did this

boreal iron
#

Somebody is Silently listening

#

Must be the NSA

modest maple
#

I gotta go add a bot now to reclaim my role 😢

marble juniper
#

Not like the role matters anyway

sudden geyser
#

literally 1984

boreal iron
sudden geyser
#

what would fake be without auctions role

#

some fake

boreal iron
#

Idk what this even is tbh

#

I’m not doing any research but okay

#

Must be something because I’m a good boy freerealestate

spark flint
#

its becauuse you placed and won a bid recently

boreal iron
#

Aha ok didn’t know you get a role for but why not

#

Not like the role matters anyway

spark flint
boreal iron
spark flint
#

yeah

boreal iron
#

Ah lol didn’t even notice that

marble juniper
#

Imagine u care about a different color code in ur name

boreal iron
#

Most important thing in live, don’t you know? freerealestate

boreal iron
marble juniper
#

Imagine

modest maple
#

😢 I need temporary green role plz

boreal iron
#

No no Sir

#

You are what you are

modest maple
#

PepeHands But science

boreal iron
#

Can’t take your words seriously anymore since you’re a white name now

modest maple
#

Fuck you're right

#

Where's my bot ghost!

boreal iron
#

lmao

#

Just add a clone real quick

#

Be sure to add 5 custom commands!

modest maple
#

and wait one to two weeks to be approved WICKED

boreal iron
#

Use your topgg premium to get a faster approval

#

:P

quartz kindle
#

why am i watching dragon ball videos instead of coding

marble juniper
#

Cuz thats more fun

boreal iron
#

Because dragon ball is legendary

modest maple
marble juniper
#

Dragon deez nuts

modest maple
#

I have never watched dragon ball tbh

quartz kindle
#

bindge listening to stereo sayan 3d

boreal iron
marble juniper
#

Shh poor user

#

lol

boreal iron
#

lmao

boreal iron
marble juniper
#

He is the most powerful ofc

boreal iron
#

Aye

sudden geyser
#

no role gang laingroove

modest maple
#

Im in luck! Someone has already scraped all content off topgg and made it a dataset

sudden geyser
#

watch it be a year old

#

or is that someone you

woeful pike
modest maple
#

you cant ban me ethically because I've publically mentioned and demonstrated that issue several times already

spark flint
#

lol

woeful pike
#

im grabbing my unethical ban hammer

modest maple
#

fuck

#

pulling a russia on us

spark flint
boreal iron
spark flint
#

also xetera have you heard of the new digitalocean serverless feature

woeful pike
#

I don't want to hear anything about digitalocean

spark flint
modest maple
#

Did DO not have Serverless to begin with pithink

spark flint
#

i mean i might be getting free sammy slippers so thats a plus

woeful pike
#

unless you're telling me that DO now supports floating ips for kubernetes nodes I'm not interested

modest maple
#

I mean

#

how often do you really need k8s

#

not often

boreal iron
#

You gotta choose Hetzner for that

modest maple
#

and if you do use it often

#

shame on you

#

Looking at you luke GUN

woeful pike
#

I use k8s 8 times

modest maple
spark flint
#

oml i found another bot posting fake server counts

#

i mean dblstats is helpful for finding them KEKW

split hazel
#

i swear top.gg started using the server count from the authorize page

simple stump
#

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] = ?;
}
split hazel
#

disappointing

spark flint
#

i found one earlier posting nearly 60k+ higher then it should

boreal iron
modest maple
#

Im not abusing the API

#

however

split hazel
#

you'd have to make an object

modest maple
#

I dont think you even get the server count outside of webscraping

simple stump
spark flint
#

i wish there was a way (without extension) to force all bot pages to be in dark mode KEKW

modest maple
#

you can already do that no?

spark flint
#

idk but im using dark mode and just got fucking blinded

boreal iron
#

It got removed

modest maple
#

oh?

#

Bro

split hazel
modest maple
#

Anyway, we have science

spark flint
sudden geyser
#

and pray top.gg doesn't override everything like they do on their blog page

spark flint
woeful pike
#

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

boreal iron
# modest maple Bro

Yeah but you can at least detect the theme (as class of the html tag) to adjust your design

sudden geyser
#

don't know what ghost is but it still sucks

#

just let me use my $5 extension pls

spark flint
#

lol

modest maple
woeful pike
#

server count fraud decreases to 0% 📉

spark flint
spark flint
#

still bright

woeful pike
#

cut the guy some slack he's running a moderation bot its rough out there

spark flint
sudden geyser
#

that's just a crime

modest maple
#

holy christ

spark flint
#

can;t even invite the moderation bot

sudden geyser
#

this is what they get for using charka

#

oh? you're hiding your science from us

woeful pike
#

exactly the kind of take I'd expect from a dynamic typing fan

sudden geyser
#

I love my method doesn't exist errors

modest maple
#

Attempt two thistime without vaugly leaking data

sudden geyser
#

looks in cache for old keys

woeful pike
boreal iron
modest maple
#

yeah pain

boreal iron
#

Got recorded and archived already

modest maple
#

oh well

boreal iron
modest maple
#

wasn't that bad

#

SCIENCE!

austere surge
#

scinc

modest maple
#

fucking python

split hazel
#

anyone have any ideas? after reinstalling vsc on arch i cannot sync my settings anymore

#

come on vsc at least a status code :(

modest maple
#

Maybe dont use arch hina_wink

#

joking aside

spark flint
#

every day i get closer to ditching cpanel

modest maple
#

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?

spark flint
split hazel
spark flint
#

"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

#

even tho the cpanel server doesn't use phusion

earnest phoenix
#

so if tuples and arrays are fixed length is there anything that can be any length in rust?

modest maple
#

vecs?

earnest phoenix
#

oh forgot that is a thing in rust

modest maple
#

things that are stack allocated aren't re-sizeable

earnest phoenix
#

ic

modest maple
#

A vec is a dynamically size array on the heap

split hazel
earnest phoenix
#

So a vec is pretty much an array but without a limit on size?

modest maple
#

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

earnest phoenix
#

Not sure what that means

modest maple
#

Means it has all the other behaviours except it's resizable

earnest phoenix
#

ic

#

I find the bitwise stuff interesting never bothered using that stuff that often

modest maple
#

what is this in relation to?

earnest phoenix
#

Nothing really I just found it as an interesting thing since I never bothered messing with bitwise operators

modest maple
#

you should

#

bitwise is awsome

earnest phoenix
#

This confusing to me tho

#

I don't get how this works

#

I get the >> and <<

modest maple
#

binary logic

earnest phoenix
#

but the others make no sense to me

modest maple
#

also holy fuck that text is hard to read

earnest phoenix
#

ikr

#

that is how they have it on the site

#

lmfao

modest maple
#

eek

earnest phoenix
#

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

split hazel
#

ever wondered how to get the first byte/8 bits of a number?

#

num & 255

#

you're welcome

earnest phoenix
#

I dont really understand binary related stuff

split hazel
#

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

harsh nova
#

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

neat ingot
#

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 😂

sudden geyser
#

self evaluation is dumb anyway laingroove

neat ingot
#

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 😂

quartz kindle
#

fml

#

this discord autocomplete is a nightmare to work with

#

my use case is too damn complicated

boreal iron
#

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

quartz kindle
#

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

boreal iron
#

Wut?

sudden geyser
#

confuzzled

#

you still have the options array

boreal iron
#

Can’t you stick with both being the same?

quartz kindle
#

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

boreal iron
#

But don’t you get the name as argument when processing your slash command

sudden geyser
#

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

boreal iron
#

Is that only the UI showing the option name or do you also get the name as argument when handling you slash command?

sudden geyser
#

just the ui

quartz kindle
#

the problem is that it screws up if you try to backspace and edit it

sudden geyser
#

you get the name and value when the command is submitted

#

Yeah that is annoying

#

I agree there

quartz kindle
sudden geyser
#

Would it be better when hitting backspace they show your previous input?

boreal iron
#

God damn

#

Wtf

quartz kindle
#

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

boreal iron
#

lmao I got the first time

#

Just didn’t know that’s a thing

#

Let’s hope the interaction rework Voltrex mentioned fixes that

sudden geyser
#

that sounds like a saturation problem

boreal iron
#

Once it’s live, 2032

quartz kindle
#

this is what i ended up doing to make it support arrays

#

but i have validation issues on intermediate values now

sudden geyser
#

oh would you like variadic arguments

quartz kindle
#

yeah

#

also, some of those IDs can have different variants lmao, i have no idea how im gonna implement that

boreal iron
#

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

quartz kindle
#

my entire bot is too complicated for the average user

#

its too complicated even for myself

boreal iron
#

I see if I take a look at the image behind your slash command UI

boreal iron
#

I’m sure I will find something for you to do

quartz kindle
#

ew no, theres war in there

#

europe is the new middle east

boreal iron
#

Even if that’s on our continent it doesn’t belong to the EU

quartz kindle
#

it soon will

#

lmao

boreal iron
#

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

quartz kindle
#

lmao

boreal iron
#

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

sudden geyser
#

dudes invading georgia in 2008

boreal iron
#

I mean when looking at the gas(olin) price the EU will indeed become a war zone in the near future

earnest phoenix
#

In rust when would a if let expression be useful?

sudden geyser
#

like Kazakhstan!

sudden geyser
boreal iron
#

Even the dumbest people will notice that the global oil price has not grown that much we pay here for oil atm

earnest phoenix
#

So if the value exists in the variable?

sudden geyser
#

e.g. if let Some(x) = opt {...}

#

Won't execute if opt is None

earnest phoenix
#

So it is essentially guessing?

sudden geyser
#

No, it's checking if opt's enum case is Some

earnest phoenix
#

Huh

#

Thats not how it was explained here

sudden geyser
#

Do you know what enums are in Rust?

earnest phoenix
#

I mean enums are pretty global across most typed langs isnt it?

#

Does rust handle enums differently?

sudden geyser
#

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?

lyric mountain
earnest phoenix
#

This seems like a bad example to me but I could just be dumb

earnest phoenix
sudden geyser
#

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).

earnest phoenix
#

Does it just take in things that you want to look for and then it checks based on whatever you pass after the =

sudden geyser
#

Yeah

#

In your example, you checked if the first element in the tuple was Rust, and it was, so it passed.

earnest phoenix
#

and it guessed the rest ig

#

So what if course only had Rust in it

sudden geyser
#

Not exactly. There was no guessing for c and d. They're just bound variables, like how you would use a let

earnest phoenix
#

would it stll evaluate as true?

sudden geyser
earnest phoenix
#

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?

sudden geyser
#

Do you still have c and d?

earnest phoenix
#

nah

sudden geyser
#

Then it would fail since the number of elements don't match.

earnest phoenix
#

🤔

sudden geyser
#

It would be redundant to use if let in that case anyway since you're not binding anything.

earnest phoenix
#

Number of elements?

sudden geyser
#

The number of items in the tuple. course as shown above has three.

earnest phoenix
#

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");
    }
sudden geyser
#

It wouldn't match, but it would still compile and run.

earnest phoenix
#

I see

sudden geyser
#

But like I said, that would be redundant.

earnest phoenix
#

So everything you pass must match exactly

earnest phoenix
sudden geyser
#

Yes, except for the bound variables.

earnest phoenix
#

gotcha

#

So what would be the use of if let in a real world example?

sudden geyser
#

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.

earnest phoenix
#

I see

sudden geyser
#

Either for things like Option, or for matchable things like tuple, structs, etc.

earnest phoenix
#

I will probably understand it more as I use rust

#

thanks for the help :p

craggy pine
#

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 thinkLul

lament rock
#

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

left osprey
#

hi guys!
can i ask how can i add a image to my bot long describtion? i can't add to it

craggy pine
#

Html img tags

left osprey
craggy pine
#
#

long description accepts HTML

left osprey
#

thank you

bright hornet
#

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++

craggy pine
#
const messageCount = 0;
#

Let not const

bright hornet
stiff lynx
#

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.

woeful pike
#

you can't await for things without async

stiff lynx
#

I know 🙂

woeful pike
#

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

stiff lynx
#

but idk how to fix this inside a lot of code blocks

left osprey
#

how can i put this on between the page?

rocky hearth
spark flint
boreal iron
rustic nova
#

You shouldn't drink and code

#

Otherwise you end up like that

boreal iron
#

Could also be his midlife crisis

#

You never know freerealestate

stiff lynx
spark flint
ruby geode
#

Hi, when I click on invite people button, I get this popup saying that invites are disabled.

spark flint
ruby geode
#

my own

#

when I right click on a server and click on invite people

#

look

warped turtle
ruby geode
#

so that can't be the reason

#

I have enabled create invite perm

warped turtle
ruby geode
warped turtle
ruby geode
#

breh

warped turtle
#

Maybe report it to discord

#

Mines works perfectly well

ruby geode
warped turtle
#

Take a look at this

ruby geode
#

ohk thanks

solemn jolt
#

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

stiff lynx
earnest phoenix
solemn jolt
spark flint
#

is anyone here good with digitalocean

#

i'm getting a node-gyp build error on apps

quartz kindle
#

what error

spark flint
#

2 secs

quartz kindle
#

is there more logs before that?

#

are you using the app platform?

split hazel
#

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

earnest phoenix
#

I would honestly use pure api instead of djs at this point

lyric mountain
#

groovy diver log, entry no. 52: today I learned constructors are optional

hybrid cargo
lyric mountain
#

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

boreal iron
#

Very complicated syntax freerealestate

hybrid cargo
boreal iron
#

If you have to import the builder tool to create a simple object then idk what else to say

hybrid cargo
#

And beg for help in alex's dms

lyric mountain
#

I kinda like how it is very java but with the best of ruby and js

stiff lynx
#

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

lyric mountain
#

findone what?

#

you didn't supply any filter

hybrid cargo
#

shows only the function name iirc, doesnt display the filters inside it

hybrid cargo
stiff lynx
#

ty all

neat ingot
stiff lynx
#

from an Array of objects extracted from MongoDB, how can I do a list inside an Embed?

boreal iron
#

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

boreal iron
earnest phoenix
#

⚠️ 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

wheat mesa
#

If I understand correctly you could use some trig

earnest phoenix
wheat mesa
#

Your x and y for a radius of 1 would be (cos(angle), sin(angle)) iirc

earnest phoenix
#

what

wheat mesa
#

Ok so you have an angle right

earnest phoenix
#

yes

wheat mesa
#

And you want to walk a certain distance in that angle right

earnest phoenix
#

also yes

wheat mesa
#

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

raw nest
#

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?

wheat mesa
#

I’m not sure if that answers your question but that’s what I’m thinking of @earnest phoenix

earnest phoenix
#

hmm maybe i am listening to you maybe i am silently installing a library to handle it for me

sage adder
#

can someone help me out with something ill show you in a discord call

sudden geyser
#

It's better you explain your problem thoroughly here

earnest phoenix
#

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

earnest phoenix
sudden geyser
#

Talking to ashton

sage adder
raw nest
#

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?

wheat mesa
#

I was essentially following this concept with my solution

#

Which is the same idea your mom was talking about

cinder patio
earnest phoenix
earnest phoenix
raw nest
boreal iron
# earnest phoenix ⚠️ extremely mathematical question ⚠️ I have a 2d canvas with the player somewh...

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

wheat mesa
#

Yes that’s a good explanation

boreal iron
#

Of course that requires to know the exact start point

wheat mesa
#

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

boreal iron
#

As he said he wanna go with 45°

wheat mesa
#

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

boreal iron
#

As long as you got one side length and a adjacent angle you can calculate it

wheat mesa
#

Yeah

boreal iron
#

just wanted to give an human understandable example for 45°

wheat mesa
#

Yes that’s good

boreal iron
#

completely fucked up labeling but who cares

wheat mesa
#

Although I’m just now realizing your explanation for that is technically wrong because those side lengths aren’t perfect numbers

boreal iron
#

YES BECAUSE IT'S JUST AN EXAMPLE

#

:D

wheat mesa
#

The side length for each of those sides would be hypotenuse/sqrt(2)

#

But yeah I get what you’re saying

boreal iron
#

As I said the label (legend) is also wrong

#

As the side length A would be opposite to alpha

wheat mesa
#

Fair

boreal iron
#

didn't find a better img to manipulate real quick

wheat mesa
#

Those sides would be 5sqrt(2) each

#

But yes for readability purposes it’s a good example

boreal iron
#

fine... now listen to your math teacher again

wheat mesa
#

:p

#

That’s one of the few classes I pay attention in!

boreal iron
#

Good! Without proper math skills, selling drugs will be horrible later the days

wheat mesa
#

Yeah

#

Gotta have some stats knowledge for that

earnest phoenix
#

maybe i should actually use a game engine at this point

boreal iron
#

always add the most important parameters after someone answered

wheat mesa
#

No it’s still fairly simple

#

@earnest phoenix do you know how long the hypotenuse of the triangle will be?

earnest phoenix
#

no

wheat mesa
#

...do you know how long any of the sides will be?

earnest phoenix
#

....no

wheat mesa
#

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?

earnest phoenix
#

yep

wheat mesa
#

So then you have the hypotenuse

#

Which is your distance

earnest phoenix
#

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

wheat mesa
#

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

earnest phoenix
#

in canvas the x axis is at the top and not bottom

wheat mesa
#

Then account for that

earnest phoenix
#

so 45deg is bottom right

wheat mesa
#

I’m talking about from the origin

earnest phoenix
#

ok

wheat mesa
#

You can tweak the numbers to work for you but that’s the basic concept

earnest phoenix
#

ty

wheat mesa
#

np

#

Gl with that

#

Sounds like a fun thing to make though :p

cinder patio
#

don't forget that math functions in js accept numbers in radians not degrees

wheat mesa
#

^^

boreal iron
earnest phoenix
#

npm i three

wheat mesa
#

The formula to convert degrees to radians is degrees * pi/180

sudden geyser
#

radians is a scam

wheat mesa
#

No

#

Radians are based

sudden geyser
#

bad

boreal iron
#

Are Radian democrats or ..?

earnest phoenix
#

why lol

sudden geyser
#

Long live 360!

wheat mesa
#

Radians are so much easier to calculate though

earnest phoenix
#

what the fuck is a radian

sudden geyser
#

Example

wheat mesa
#

It’s basically a different way to measure an angle

sudden geyser
wheat mesa
#

Pi radians is half of a circle

#

So 180 degrees

earnest phoenix
#

oh

wheat mesa
#

pi/2 radians is half of half of a circle, so 90 degrees

earnest phoenix
wheat mesa
#

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

lofty bay
#

hello
what are we talking about

wheat mesa
#

Trig stuff

boreal iron
#

meth

earnest phoenix
wheat mesa
lofty bay
#

right angled triangles or just any old triangles?

wheat mesa
#

Those measures are in radians

lofty bay
wheat mesa
#

I love meth

#

Smile

stiff lynx
#

How can I delete a document from mongo?

cinder patio
#

it's a search away

wheat mesa
#

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

earnest phoenix
#

An hour long chat on how to move a ball in a game of pong

wheat mesa
#

To be fair calculating angles and stuff like that isn’t a small subject

#

I knew my trig knowledge would become useful some day mmulu

split hazel
#

they are good enough approximations for whatever you're trying to do

wheat mesa
#

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

split hazel
#

there are probably some libraries which can truly compete the value

wheat mesa
#

Yeah

#

But that’s for more intense applications than what you’re calculating

#

Probably more computationally expensive too

split hazel
#

meh I'm sure you can use the FPU built into the CPU which has very good performance

#

(float processing unit)

wheat mesa
earnest phoenix
#

alright
two more years till im forced to study it in school

wheat mesa
#

It’s not very hard it’s just a very different way of thinking compared to what traditional math classes before trig had taught

earnest phoenix
#

what does sin and cos actually mean

solemn latch
#

dont sin cos its bad

#

ill show myself out

split hazel
wheat mesa
#

🚪 ⬅️

earnest phoenix
wheat mesa
#

they're trig functions, sine and cosine

wheat mesa
solemn latch
#

bad humor ^_^

cinder patio
#

What if I tan?

wheat mesa
#

out

earnest phoenix
#

i saw a youtube video titled why sin and cos don't mean anything

earnest phoenix
wheat mesa
#

have you ever heard of sohcahtoa

earnest phoenix
wheat mesa
#

sin = opposite / hypotenuse, cos = adjacent / hypotenuse, tan = opposite / adjacent

#

SOH, CAH, TOA

spark flint
#

luckily its billed hourly

wheat mesa
#

assuming x is your angle, these are the sides relative to that angle

spark flint
#

its $1 an hour

sudden geyser
#

all the power in your hands

earnest phoenix
wheat mesa
#

lmao

spark flint
#

anyways what should i do with it KEKW

#

its already cost me $1

wheat mesa
#

run an ai pong simulation on it for the entire month

earnest phoenix
#

delete your account

sudden geyser
#

mine crypto

#

Should go up to $1,000 pretty quickly

earnest phoenix
#

bitcoin gold in cgminer 😎

cinder patio
#

Find a way to make more than a $1 an hour

#

from using it

wheat mesa
#

damn that's actually a really good approximation

boreal iron
wheat mesa
#

the bandwidth is weird

#

only 10tb for a 1k server?

#

my free oracle vps gets 2tb a month lmao

boreal iron
#

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

wheat mesa
#

yeah I have more storage in my own pc than that server has lmfao

#

and I don't even have much

boreal iron
#

Most be the worst provider he could find on the market

austere surge
#

how do you accidentally rent something

#

yea

spark flint
#

i cancelled it KEKW

sudden geyser
#

Fuck I accidentally bought a mansion instead of an apartment

spark flint
#

i'm not paying $1000 a month when i have £0.05

sudden geyser
#

Thank god they bill me monthly

boreal iron
lyric mountain
wheat mesa
#

Pain

#

sin and cos are the most useful of all the trig functions because all the others are derived from them

boreal iron
#

Just get rid of one dimension and things are getting way easier

quartz kindle
boreal iron
#

oh no

#

lmao

#

meant some other Tim of course

earnest phoenix
quartz kindle
#

tim netherlands

#

the archenemy of tom holland

lament rock
#

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?
spark flint
#
  1. Pretty decent for the usecase
  2. Mid-end, nowhere near highend
  3. Yep, but no money to throw at it KEKW k
lament rock
#

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

spark flint
#

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

lament rock
#

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

spark flint
#

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)

lament rock
#

how much does the djs one consume

spark flint
#

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

lament rock
spark flint
#

oh christ thats a lot of servers

lament rock
#

this stats graph shows how insane my ram usage used to be and how it correlated with guild count

spark flint
#

yeah

#

mine is 350 servers KEKW

lament rock
#

smol

spark flint
#

thats my usage

lament rock
#

not bad at all

spark flint
#

massive decrease

#

thats one advantage of migrating to api requests instead

lament rock
#

?

spark flint
#

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

boreal iron
#

default caching behavior

lament rock
quartz kindle
lament rock
#

first 2 are really interesting to know. 3rd is really obv