#development
1 messages Ā· Page 2005 of 1
I always create a snake game everytime I start a new lang
I'd give a search, but am on mobile data
I found a tutorial, I'm gonna see how they do it
I usually don't like going through video tutorials because they just give you all the answers without needing you to think about it
but I'll make an exception for this one
A great thing is that video tutorials from 1990 are still valid today
lol not wrong
Cuz java is fully backward compatible unless using JNI or obscure sun packages
not to mention swing probably hasn't changed all that much since then anyways
Ye kekw
You can notice for how it still use Graphics instead of Graphics2D
Btw
Use fillRect instead of drawRect
So u get a filled rect instead of outline
Yeah I got that down
Since it's a game, u can also set rendering to fast
So u get faster rendering by sacrificing quality
But it's a blocky game, so u can afford it without issue
setRenderingHint
so turns out this guy is doing it vastly different than I am
I think he's about to add a keylistener to the actual frame/panel
U can add it to the paddle too probably
he's got a proper game loop
I probably should've put more thought into this initially but I didn't expect it to be too much of an issue lol
Go easy
Make it work, then optimize
For game loop u can probably use a ScheduledExecutor
this guy kinda pains me though
Set to loop every 200ms or so
he manually types out his imports every time
instead of just using the intellij suggestion
Ah, caveman method
Common among old devs
My teacher used to force us to use np++/sublime so we had to type it all manually
He said becoming dependant on IDEs is bad
No wonder everyone finish college hating java
neither of them are lightweight, but neither of them actually provide useful features
I'd be fine with one or the other
no one takes java in college and likes it
I installed intellij idea on one of the school computers and I could tell my teacher was internally proud
been using sublime for java more recently
idk why schools decide to use the most obscure IDEs for languages where a good IDE can make a world of difference
I take autocomplete for granted until I don't have it
at first I was just building the project to get it to spit out errors
then a linter
EOP best method
then gave up from there
Error Oriented Programming
how about guardrail driven development
my current CS class starts off assuming you know nothing about programming previously
which to be honest it's done a pretty good job for those who didn't know much
but they're teaching you java?
Isn't swift ios?
I'd say java is one of the best languages to learn whether you like it or not at this point
python
Heard apple puts out breaking changes all the time
python is good tho
I haven't seen Apple put out one
ah ok
It has the C strictness but more readable on the long run
eh, if I were to personally recommend a language to newcomers, I'd pick python
but this is for beginners
Yes
there is only one pick
java is perfect for beginners
it teaches types, objects, C-like syntax, and is useable basically anywhere
but so does python while removing all the complexity and stuff people don't like about java
except the c type syntax
I see people that go from js/py to a strictly typed language like java and they struggle a lot with the concept of types
Python might be too abstracted
People get dependant on writing little code and not thinking how it works inside
isn't that a good thing
In my opinion, types are one of the first things you should learn about programming
because it's useful in every language
Not for beginners, else u get lazy devs
even if you don't have to explicitly declare them in said language
that's like suggesting someone learn traditional chinese first because simplified chinese will be easier than the other way around
I don't know if I would compare it to a real language
real languages have WAY less structure
I mean, python is so off the curve that you have harder time learning more standardized langs
(well, technically they're very structured but there's always exceptions to rules in real langs)
python is unique in comparison to most langs out there
in syntax at least
Like ruby
head on, yes, real languages are harder to compare, but I meant it by the thought that you should learn the harder, more detailed language (Java) first before learning the simpler language, even if it has the same or more usage (Python)
I don't think that Java is necessarily "harder"
For beginners, it certainly is š
It's just that python does some work to abstract certain things away from you
python makes sense at first for beginners but then you switch to a different lang and you're perplexed because the syntax is so foreign and types and all that
in terms of familiarity, yes, python is harder, agree there
but for beginners to learn what programming is like and being able to apply it, I think Python does what people want from Java but without all its baggage.
In my CSA class, for example, I know a lot of people who were well off learning Java because they learned JavaScript/Python beforehand
I think python is a good beginner language as well, I just think that Java builds some of the most crucial foundational knowledge that will be applied to many other languages
my CS1 class didn't dive right into java
js best lang for beginners
beginners are not a monolith
they explained some of the things that lead to thinking about why java is why it is (if that makes any sense)
different languages appeal to different kinds of people based on how and what they like to learn
I definitely think python is less intimidating
print("hello world!")
``` is probably way less scary than ```java
public class Main {
public static void main(String[] args) {
System.out.println("hello world!");
}
}
someone who wants to understand how computers work probably isn't going to enjoy starting with python and a beginner who wants to make discord bots probably won't want to begin with C
the more simple and abstracted the language, the better to start with
its the same principle everywhere else in education
you start with a basic overview of biology, physics, math, etc
terrible principle
then as you progress, you dive deeper and break down things into more complex things
begin with what excites you, not the simplest
I agree with that
Most don't dive deep after meeting the easy
people are much more prone to learning if they're motivated and excited about the content
yeah because a lot of beginners are forced to learn dumb shit and not what motivates them to learn more
yeah, and diving straight into something complex like a low level language is often gonna be a turn off
(my cs1 class)
depends on what your goals are. I know plenty of people who went into programming to understand how computers work
they made us spend 3 weeks learning how to convert binary to decimal and vice versa
I understand why it's useful but that's one of those things that I don't think is entirely necessary to spend that much time on
That's why, at the beginning of all this debate, I said college ruins programming for everyone not already in the area
They force u to make dumb stuff using dumb means
And dumb tools
and complexity isn't a linear thing. C is a dead simple language in some sense and complex in other ways
personally I love cs because I was able to get an early start in it rather than having to wait until college to get useful courses
75% of the class you spend trying to setup the tools you'll be using
20% typing
5% actually thinking
I mean that's pretty realistic tho lol
I hate u for saying the truth 
I'm just lucky to have CS classes in high school I suppose, I'm grateful for that, so I don't really mind this sort of thing
my hot take is dont teach programming in cs courses until like 3rd year or whatever
granted we use pretty much 2 tools
you guys wanna know something really dumb though?
the APCSA exam
how much % repeating things instead of actually thinking?
that shit is stupid
never took it
APCSA isn't a joke, it's just stupid
It's memorization
And tedious work
It's just literally doing the work that the compiler was literally invented to do for you
for the AP CSA exam, you pretty much just have to be the compiler
Itās to prove understanding but itās a shitty test
I'm sitting in both classes this year and massively favor CSP over CSA as a class
Which I think is incredibly stupid
both exams are still stupid
At the same time??? Lucky as fuck
One thing I once read that I'll never forget is: "you're not a programmer for memorizing and typing, you're a programmer for solving problems"
I hate how every programming debate boils down to 2 people going "no nuance, only correct answer
"
I don't think that one exam should determine your understanding of an entire class
i had to take CSP this year and next year CSA
i hate the way my school does it
But I'm still glad to be taking it
CS is a 3 class program with classes that donāt need to be taken in any order
except they force progression
Yeah it's funny
and lock it to an āacademyā
CSP requires no knowledge, CS1 requires no knowledge, CSA requires no knowledge
this is a formal education problem not a cs problem
the only cs class offered at my school that has prerequisites is CS3
I heard they might not offer CSA next year because not enough kids are taking I
which is a data structures course
basically intro to CS
We have āIT Fundamentalsā
not csp tho
I'm surprised we have a data structures course offered
I'm very lucky for that
Gonna gladly snatch that up next year
Iām just taking CS at the state college as well
except I had to take CGS1100 or some shit
taking cs at my high school
Me not understanding what those terms mean: šļøššļø
basically I have to take Microsoft word before I take intro to programming before I take programming in C
thank you education system
computer science principles = csp, computer science 1 = cs1, advanced placement computer science A = csa/apcsa, etc
psh A levels
try asking your counselor if you can just skip up the ladder of classes
In 11th grade I was taking intro to programming and robotics and wanted to take AP but would normally require I take honors first
didn't want to do that, asked, pray, get in, profit
is it supposed to look like that
I would've skipped to CS3 this year, but an AP credit is free college credit
It is
not to mention I also get a math credit for taking ap
so is dual enrolling
yeah but you need to find a college that actually accepts it
no dual credit cs at my school unfortunately
and lots like not doing that so you take their class regardless
I think your discord needs a restart... or an exorcism
yeh
so if they let you for free, take college composition or something easy
most colleges accept a 4/5 on the apcsa exam
Music appreciation
oh hey I took music appreciation
yeah but even if it's a 4, I've heard lots of colleges that still force their students to take their class regardless
[...] or an exorcism
lmao
Lmao
so I'd argue it's something to consider
i never took it
I learned some music theory stuff on the side by making a program for it
How would I get the time left in an audio stream?
For CSA?
next year I've loaded my schedule with as much college credit as possible
yup
Same lmao
7 classes, 6 AP
6 classes, 2 AP, 2 dual credit
Lang,
Physics C,
Calc BC,
Econ/Gov,
CSA,
HUG
Iām taking intro to programming over the summer as a free college class
then I take c programming and probably Java
sounds painful
AP calc BC
AP Physics 1/2
Dual Credit Gov/Econ
CS3 Honors
Dual Credit Eng Lang
Digital Electronics (had nothing else to take)
https://replit.com/@xetera/Music lol I still have it
itās not
ENC?
i took ENC1101 this year
idk
joke of a class sadly
Gonna elaborate on this actually, imho AP classes are so much easier than honors classes because the teachers are actually competent for the most part
I think that dual credit is infinitely easier than ap imo
It is
all you have to do is pass the class and you get credit for it
in AP your college credit all hangs on one test at the end of the year
couple kilobytes, on a vps, https://ogp.me/, no
example url?
can dm if you dont want it public
CS is the only non-college prep class I've taken so I don't know how true that is where I am
My teacher does a fine job teaching but is aggressive about the class being an AP class
done
i dont see anything wrong with them, they load fast for me. the only thing i noticed is that your tags are using relative url, im pretty sure the opengraph spec asks for absolute urls
it only loads fast cuz discord already has the embed for the link
lemme send u one w/o embed
iām not sure then soentimes itās just laggy
if you suspect the issue is in your server, you can try benchmarking / stress testing it
see how many requests per second it can serve
there are several tools for that
otherwise its either a discord issue or a network issue in general
How do I get the length of an mp3 or audio file?
let mut x = 0;
let mut y = 1;
// Wouldn't it be fucked up if this could modify y?
x = 2;
println!("{y}");
``` I love how this very well written rust article about an unsafe pointer overhaul just has this comment in the middle of it
yes
foreshadowing
The only difference bw, C malloc and calloc, is that calloc creates memory with default of 0, right?
But it was working fine yesterday I didn't changed the code
highly doubting that it was "working fine yesterday" without changing the code like that
you can only use .catch on promises
this could be code for something like logging, which would only have the issue on some events
oh wait it shows file doesn't it
oh index
It's my chat bot
what wud be the output of this c snippet?
char x;
x = getchar(); // given b as input
switch(x) {
case "B" || "b":
printf("this is b");
break;
case "a":
printf("this is a");
break;
default:
printf("this is none");
}
Well, whatās getchar();?
never this is b?
Can you even do switch cases like that?
sorry, I updated now
this is none
I donāt think you can do switch statements like that so Iām gonna go with this is none
do
case 'B':
case 'b':``` instead
' for char in C iirc
and "B" || "b" will just be true
iirc
Oh wait wouldnt that be an error? The switch case is on a char but your cases are char* technically
yes I'm getting this error on case "a"
error: case label does not reduce to an integer constant
I donāt know enough about the very specific areas of C to answer this question with 100% accuracy
Yeah
yeah thats because a string isnt an int
hm
because a char is just an abstraction of an int?
char is just an unsigned integer type
lobby?
no like
like a lobby create and join option
elaborate
and what does said lobby do?
it waits a few moments
Like 60 seconds
Then starts
and then runs a function
a extremely long function
what does said function end up doing
ends up playing a game
ok
so just displays text or something?
Make a lobby class
and different people do different things
I did that
pov: you learn classes 12 hours ago and u start using it
So how do make x, treated like a string.
I want to compare those strings with x
Classes are just bags of data that can manipulate themselves
Just use chars?
idk python
class lobby
lobby(timeout) // creates lobby
join(id) // adds person to lobby
yes but like
how does it know how many people are in it
unless I create a database for it
Every single time someone makes a lobby
and what if someone just left
went afk
switch(x) {
case 'b': // do something
}
why strings? just keep them as ints
char x = getchar();
switch(x) {
case 'b':
case 'B':
printf("this is b");
break;
case 'a':
case 'A':
printf("this is a");
break;
default:
printf("not a or b");
break;
}```
Single quotes indicate character literals, double quotes indicate a character pointer in C
ooohs itās Java
ok
Same shit different ass
ooh, yes single quotes. I forgot that
store an array and then just use the size of the array
Just remember that thereās technically not a āstringā in C and that itās always just a block of characters
idk python
class lobby
func:
lobby(timeout) // creates lobby
join(id) // adds person to lobby
prop:
people = [] // array of people or ids or something
and how does, c evals 'b' || 'B' in cases of switch?
How C treats them like?
oohk
I donāt think you can have a logical OR in a switch case but if you can itās just the same as it would be treated elsewhere
Oooh ty
is not?
yeah, the program successfully ran the default case this time
If you can have an OR in a switch case itāll just be evaluated as x matches b OR B
Not always true
oh
Iāve been looking into getting into C more but no classes hurts me so I stay with C++ instead
so x == b || B
x == b || x == B
oh?
But again, I donāt think that works in a switch case
that works in switch cases?
I donāt think a logical OR would be in a switch case
like
case 'b' || 'B':
and
case 'b':
case 'B':
are both same thing?
Just let it fall through
Yeah the OR thing doesnāt work
It doesnāt crash but it doesnāt have the intended behavior either
I don't know I assumed it would be
case 'b' || 'B':
// or
case 98 || 66:
// or basically
case true:
I donāt know why you would write code like this in the first place
No real reason to do the job of the compiler on whether it works or not :p
just let it fall through like that
that's the switch equivalent of OR
no u dont
now you get to enjoy your 12h of driving
Now Iām gonna enjoy 12h of sleep
gn fake, don't let the java bugs bite
I'm currently updating my deprecations inside of my applications, but when I fix them all, all I get is errors and my project no longer starts when I update to latest, however, when I revert to a depreciated version (such as embed.setAuthor or embed.setFooter) everything works fine, any thoughts?
I don't know what's wrong, you should probably show some errors and code
That would help
What is this method of printing floating number
printf("%+010.2e", 0.7234); // gives +7.23e-01
What r these called?
TypeError: embed.footer is not a function
at init (B:\Coding\rpbot\bot.js:60:8)
at Object.<anonymous> (B:\Coding\rpbot\bot.js:224:1)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
const embed = new MessageEmbed();
embed.title('Restart Soon');
embed.color(0xA1EE33);
embed.footer(config.copyright);
embed.timestamp();
that's not how you do that
you have to use setFooter and stuff like that when you're using the builder functions
Okay, that makes some sense. I will look into it further, thank you.
np
is it not possible to do data encapsulation and abstraction in , C++ structs?
Use classes for that? Structs just group data together
hi, how can i fetch all interaction slash command name + id
i think Interaction#guild.commands is the applications command manager or whatever its called
ik, but im asking for the possibility.
Can built-in functions be overloaded in c++
i want to fetch my global slash command, so i have log interaction for get the command id and after fetch them :
console.log(client.application?.commands.fetch("the id of the slash command here"));```
Note: i have tried with `interaction.id` and `interaction.commandId` but my bot returns `DiscordAPIError: Unknown application command` how can i do please ?
can i ask for help about html and djs?
You will get the application ID any time the command is triggered.
Itās part of your interaction object
@boreal iron
Donāt ask to ask, just ask
i wanna make a select element with all the guild's channel name
and for each channel name its a button
just map the channel objects to construct array of select menu objects and add it into the action row... also remember that one select menu can have only 25 options and a single message can have a max of 5 select menus considering that you dont have any other components in that message
Wut a select menu or a button?
I think the button he is talking about is the select menu option
Both doesnāt make sense considering the limits
Yeah probably
exactly... even tho you can fit a max of 125 channels in just select menus.. its really not predictable... most servers have more channels than that
Well since channels are cached by default, choices or autocomplete is the better option here
or go the very user-unfriendly way by telling them to provide the id of the channel
not that it would be a big deal to fetch them anyways
i want a select menu and in it buttons which each one have a channel name
message.guild.channels.cache.map(channel => channel.name)?
Err why if you can select CHANNEL as interaction option
EXACTLY
1 mn translate
Those arenāt called buttons but (select) options
Map it to construct a select menu object
https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure
Integrate your service with Discord ā whether it's a bot or a game or whatever your wildest imagination can come up with.
To stop the confusion
oh ok
Where can I see my bot's dbl token?
in webhook tab
Topgg site > login > edit bot > webhooks (left menu)
Token for this bot -> here?
You can find it there, yes
Thanks bro. I love you :D
Keep in mind to map the channel names as option name and better use the channel ID as value
You will see the option name when opening the select menu but your code will receive the channel ID as selected option
Easier to work with than the channel name
yeah how to?
can u give code?
Well the select menu is just an array of objects which are your options
please idk html alote
let options = [];
ā¦map((channel) => options.push({ label: channel.name, value: channel.id }));
Wtf that isnāt html
Those options need to be added to your select menu and thatās it
For example when pressing a button or using a slash command
ok nice ty
Why are you using map here that's not it's purpose š¤
Because people always cry if I respond with a for loop
Why not just map it to that object instead of pushing to a new array
Because I always provide simple examples to let them understand what it does
const options = ...
.map((channel) => ({ label: channel.name, value: channel.id }));
I don't see how that's simpler than this
he probably means more familiar, although I disagree that it is
forEach would be better here anyway
or just a for of
or a regular old for
or specifying the indexes manually 
I feel like thereās a battle going on of micro optimizing each possible answer here 
That's what we do in the core of our Node.js runtime, to avoid mangled iterator symbols 
But I like to push things!!1!
I'll push you into a pool of Java
I mean you literally using map.. which does the exact same thing that you are trying to do.. create a new array from another array... So it doesnt make sense to push elements into an array from the callback of map

š
I know, I know I wanna repeat here
But I like to push things!!1!
Just replace map with forEach and you are good to go with that code š

Arrrrrrrrr FakE is aware of map returning an arrrrrrray, stop blame FakE
FakE likes to complicate things
Upvote with top gg did not apply code.
You were unaware! FakE news
const client = new Discord.Client();
const DBL = require("top.gg");
const dbl = new DBL('TOKEN HERE', client);
module.exports.run = async (client, message, args) => {
emirhan.hasVoted(message.author.id).then(voted => {
if (!voted) {
message.channel.send( new emran.MessageEmbed()
.setTitle("Hata")
.setColor("RED")
.setDescription("Sunucumuz da ƶzel role sahip olabilmen iƧin ilk ƶncelikle oy vermen gerekiyor!")
.addField("Oy Vermek iƧin:", `[Buraya Tıkla!](https://top.gg/bot/${client.user.id}/vote)`)
.setFooter(client.user.username)
)
} else {
message.channel.send( new emran.MessageEmbed()
.setTitle("BaÅarılı!")
.setDescription("Sunucumuz da baÅarılı bir Åekilde rolünüz verildi!")
.setColor("GREEN")
)
message.member.roles.add("954094782534258698") //Vericek rol id.
}
})
}
exports.config = {
name: "votes",
guildOnly: true,
aliases: [],
permlevel: 1
};```
I wrote a vote code with the top gg module and it didn't work.
The https://npmjs.com/package/top.gg library you're using is deprecated
Plus unofficial
Use https://npmjs.com/package/@top-gg/sdk instead
Official Top.gg Node SDK. Latest version: 3.1.3, last published: 4 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 7 other projects in the npm registry using @top-gg/sdk.
Well nice try but I canāt open JS files on mobile
Neden
Soon youāre the one having a pipebomb in your mailbox 
Did you tell me?
Just said the reason, the one you're using is deprecated and no longer official, as it was maintained by a banned member rather and it's structure was too outdated and inconsistent to maintain
ok thanks. Which spider changed my name? Please correct my name.
It won't be changed because your name starts with an exclamation mark
Unfortunately sir, before you'll be able to place any pipe bombs, I've strapped an exclusive atomic bomb on your car
Exclamation mark = !
and he'd still be texting while driving
Aye he will
Then put my name without an exclamation point. Batu write. pls
try asking a mod
Why, there are good people.
what
It has no relation to the said people being good or bad, hoisting is something else entirely
Trying to place yourself on top of the members list is just outright attention seeking
Unlike people trying to fuck off FakE as soon as he answers 
Because you spread FakE news 
You Sir⦠soon 
Again, try asking a mod
Goodbye FakE, the atomic bomb on your car... soon
Such as Thor
Iranian terrorists are everywhere ffs
I'm not doing that for this server. I just mean correct my name without an exclamation point. Do not exclamation. Write my name properly. Please mate.
anyway why people hoist using their username
My guy I'm not a mod, ask a mod
is this a rhetorical question
Better question is why are people still buying nitro
I get confused. OK
because you can't change it here
quite white name
you all looking down on us because you know we're better than you

ok green name who loves driving
gotten worse
damn
oh he changed his username too
who did it this time

whay name change
at least it's unique 
o god
You wanted a name change, there you go
thanks
yay its back
aw fun over
sen bad boy
just regular batu
I'll bat you to the Java land
I'm getting offended, little friend:
Thatās so true
i evaled it and it show the channels count
H-hey
Wut
Say a few sentences in Turkish.
The level of confusion this morning is just remarkable
Have fun
Le baguette
what, ıt espaneol
sa
ooo sa is hi
is help
i dont understand
Guys guys guys this isn't #general-int !!!
okay voltrus
it is now
daffus
the meaning of what she said

oky
No
votekick fake
Shut
I'm gonna vote kick you with that atomic bomb you got in your car!
vote him out of his car
broo this isn't #general-int
Hmm because you donāt return options as output
Why are you using map to update values of another array?
That white codeblock though
why not just map it to the object directly
Exactly.
instead of pushing to another array
leme try
Tim I already explained, but FakE loves to push things
like js const options = message.guild.channels.cache.map((channel) => ({ label: channel.name, value: channel.id }));ā
The one miss take I never come back from
I'll just push this detonate button just like FakE likes to push things, that atomic bomb in your car FakE

undefined
Access the options variable
how?
i evaled it
.eval const options = message.guild.channels.cache.map((channel) => ({ label: channel.name, value: channel.id }));āā returned undefined
Put options as the last line in your code
objects
if you just want to eval it, you dont need the const options anyway
just eval message.guild.channels.cache.map((channel) => ({ label: channel.name, value: channel.id }))
well it depends on how your eval code works
if it supports implicit return or not
@earnest phoenix Now youāre getting fucked Sir, enjoy it
Sorry can't hear you with the beep beep of that atomic bomb you got in your car
[
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object],
[Object], [Object], [Object]
] what i get
I yet donāt know how to fuck about Tim⦠but thatās a job for the next generation I guess 
stringify it
Literally any second sentence using that word
I highly guess youāre on top of the nsa key word list
how?
the stringify function
idk whta is that
Time to push these nuts in your mouth
.eval const options = message.guild.channels.cache.map((channel) => ({ label: channel.name, value: channel.id }));
options what i did
me?
the output is correct
Can't escape the fate you've locked into
Nah

if you want it to show more than that, you have to increase your inspect depth level
but also check if it doesnt go beyond the character limit
Why do you actually waste time on evaluating it?
Thought you wanna use them as options in your select menu?!
i am seeing if it works first
lol
Of course it does
FakE only responds with working solutions

Perfectly optimized ofc
ok then respone with my actually solution
which is a select element with each channel name as a option and value channel id
what if there are more than 25 channels?
const options = message.guild.channels.cache.map((channel) => ({ label: channel.name, value: channel.id }));
That's like your entire options array already
The rest is a response to a slash command or button for example
i did it in a server with 2 chnanels still show objects
im not talking about that, im saying that select menus can only have max 25 options to chose
xD
hmmm
i already answered why it only shows object, because your depth level is too low
youre likely using depth:0
I think we're back to the inital try to add it as select option
whats depth level
in your eval code, you're using inspect right?
the inspect function has a depth option that tells it how deep to go
wait brb
ok
Might be a good idea to add depth as (optional) parameter of your eval command
for example, lets say you want to eval an object like this: {a:{b:{c:{d:{e: 10}}}}}
with depth level 0, it will show {a: [object]}
with depth level 1 it will show {a: {b: [object]}}
with level 2 it will show {a: {b: {c: [object]}}}
etc
i set it as 10 xD
now, depending on what you are evalling
it might return more than the message character limit
so you need to deal with that as well
if result.length > 2000
either retry with a lower depth level, or slice the string
lol
yeah
now for the select element thing
as i have the options which returns [
{ label: 'exclamationrules', value: '810825516462112788' },
{ label: 'server-update', value: '814024291674488902' },
{ label: 'general', value: '857617987019735070' },
{ label: 'robotbot-command', value: '857618573852934154' },
{ label: 'notesmusic-command', value: '857619126734159872' },
{ label: 'voice channels', value: '857619676057436221' },
{ label: 'music', value: '857619718609305620' },
{ label: 'private 1', value: '857619783763361792' },
{ label: 'private 2', value: '857619823467298836' },
{ label: 'important', value: '857620026672021545' },
{ label: 'loudspeakerheadquarters', value: '857623562164895775' },
{ label: 'staff', value: '857629582974124082' },
{ label: 'cyclonestaff-chat', value: '857629772229115975' },
{ label: 'cyclonestaff-commands', value: '857629914714996756' },
{ label: 'boostest', value: '857910682947026954' },
{ label: 'envelope_with_arrowwelcome', value: '859506503982776340' },
{ label: 'incoming_envelopeleave', value: '859506663840546866' },
{ label: 'staff-music', value: '870230858609594418' },
{ label: 'pencilmod-logs', value: '884150735376355328' },
{ label: 'ticket', value: '893776986583994388' },
{ label: 'ticket-ticket', value: '899212177007869952' },
{ label: 'earth_asiachat', value: '903302479066845275' },
{ label: 'MODMAIL', value: '919165170322931773' },
{ label: 'white_check_mark-verify', value: '921312403705184266' },
{ label: 'mutemuted-rules', value: '932173908914872361' },
{ label: 'muted', value: '934405966496145428' },
{ label: 'mutemuted-chat', value: '934407361282576394' },
{ label: 'reported-bugs', value: '946784267474731048' },
{ label: 'transcriptchannel', value: '947068267854438400' },
{ label: 'general2', value: '952219917099364452' }
]
Oh god
Now that's your options array you add to your select menu component
but i only wanna add the labels
and for each one a option
only if i could do options.label.forEach
but i cannot even do options.label
its undefined
ofc it's undefined
you dont need any of that
The objects are inside your array
are you using discord.js?
yes
array[0].label
messageSelectMenu.setOptions(options)
Is your first item
done
so objects[0].label?
....
i wanna add it to my website as a select element
your website?
wtf
so its not discord.js lol
you should eventually tell that BEFORE 1 hour of discussion starts
how are you sending this data to the client side?
yes
rendering with ejs or something?
ejs yes
you probably want to map it to html select element
I mean you can still pass the channel IDs as option value, to make sure working with the channel ID, not the name when handling the form submit
yeah
<select name="channel">
loop:
<option value="channel-id">channel name</option>
:end loop
</select>
<select name="channels" id="channels">
<%- options.map(item => `<option value="${item.value}">${item.label}</option>`).join("") %>
</select>
or something like fake said
i dont use ejs
Neither do I lol
hmm
or like the example from the ejs docs
where are the ejs docs?
<% options.forEach(function(option){ %>
<option value="<%= option.value %>"><%= option.label %></option>
<% }); %>
'E' is for 'effective'. EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. It's just plain JavaScript.
ig
oh yes...
ok leme see
having to use the ejs marker on every line of a loop is the weirdest thing ever
imagine if php did that
I mean I'm opening and closing the tags, too instead of using an entire template scheme
as in this particular use case I don't wanna use a template build
well yes, but you dont do shit like this ```php
<? forEach() { ?>
<a><? a ?></a>
<? } ?>
exactly, something like this is much better ```php
<?
forEach() {
print something
}
?>
<% <array>.forEach(function(variablename) { %>
<h1><%= variablename %></h1>
<% }) %>
You usually parse your entire template files just by replacing for example <p>{{php var here}}</p>
But template builds have a lot of disadvantages when you wanna add some code to the template file for exampling handling a form instead of throwing everything into a config file etc.
In theory the template file only contains your final vars which will be parsed and rendered
But eww that's too much work
imo ejs should be able to do something like this instead ```js
<%-
let str = "";
for(...) {
str += "..."
}
return str;
%>
please just add macros to javascript
I mean php is far more than a template engine
tru
all the haters must be sleeping
more like all the haters dont want to chat afraid to get banned 
New rules lol
PHP - Pog Hi-level Programming 

(yeah ik. That was cringey af)
Need to add you to my special list now
The block one?
Almost every website I've made has been in PHP
Almost half of the visible internet still is in php
And yet noobs be hatin
considering how much php moved forward the last years getting to something structured and well optimized instead of the chaos like 10y ago
especially with php > 8
ewwww really? php? š¤®
I havent used php since like 2012 lol
proves you're not up to date
yea thats fair š
tbh, I did enjoy writing in php when I used it š
its just so much more convenient to have your entire framework (front+back) written in js
no ?
how do you figure?
It basically depends on the site's features
"I don't have to learn another language" isn't a good cause to use js everywhere
what featureset would you argue would be more suited to another languages?
Most of the cases you'll need more than one language
Let's say Discord
Everything can be done with js no problem there
But what about the server discovery / suggestion page ?
You need ml / ai for that (Here comes python)
You might need more security at the backend (Rust, Go)
Or you might focus on execution time / memory usage (C)
You can practically use JavaScript for everything (Atwood's law), but some languages are better than JavaScript in certain categories.
why do you need ml for server discovery? what additional securities could rust/go provide over a website written in js? Ill grant you, if performance is a major consideration, you might want to use something lower level.
100%! Javascript is incredibly versatile, and can run almost anywhere. Its not the fastest by far, but imo, versatility trumps performance (as long as performance isnt 'bad')
Agree with you there
JavaScript was not meant to be good at a lot of things it's good at today, so people like to use it.
Including me sometimes
But to set a bar, I would suggest people not become too attached to the language, as other languages can you blow you away at what they're capable of and have had since day one.
imo, being able to spend more time in js (due to everything written in js) allows me to increase my js knowledge more, and become much better with that language ~ rather than using multiple technoologies (say php+sql), which would naturally mean my learning is split between those two.
yea, thats probably fair. I am a bit of a js fanboi š
everytime i go to use some lower level/more performant language, the speed of things is just so much faster
i do honestly think though, if js was capable of multiple threads, it'd rival a lot of the 'bigger' languages out there
first time?
I see lot of vsc activities up to 23 hours long
but it's usually just the rich presence not pausing / resetting the timer on inactivity
how do you know which servers I'd like?
You'd draw a regression model based on the servers I'm in and predict which servers I'd be interested in
Just showing random servers cuz they got more ppl won't be that much helpful
(yt and steam works this way)
oooooohhhh. idk why, for some reason I was thinking of like, the native server discovery feature discord has that makes every website with said feature redundant š
but yea, if you were doing such a thing, sure, ml could be used
for argument sake though, there are ml libs for js š
(not saying you should use them though...)
finally someone spoke in favour of brain.js
I have used brain.js before. to create an ai to predict the location of the 'ball' when the opponent hits it (in a pong game i made) š
can't u just use math for that
uHH
A simple but powerful deobfuscator to remove common JavaScript
obfuscation techniques
one thing you can do is replace hex numbers with some random letters, that'd make it a lot easier. Also unminify
yea, but wheres the fun in that? š
trig is fun
hello!
is there any lib just like this one
https://pypi.org/project/mee6-py-api/
for Invite Tracker https://invite-tracker.com/
As in, you want a library that manages the invite tracking logic?
No no no
What sort of key is "$el"?
How would I be able to access it (plain JS)?
If it were a literal key, x["$el"]
if you see the mee6 lib you can see it can fetch levels from mee6 leaderboards which I can use in my bot
object.$el
$ is valid in identifier names
similarly was wondering if there's a lib which can get the invites of a user which Invite-Tracker bot has of a user
Ah I see, ty
more or less it's like accessing the DB of Invite tracker
Well, you may want to check if Invite Tracker has an API for that. I didn't know Mee6 offers an API.
nah mee6 doesn't offer API
this lib just scrapes the mee6 leaderboards from website
https://mee6.xyz/leaderboard/953300942839775232
like this one
Install our Discord bot to set up leveling, moderation, music, Twitch, YouTube, and Reddit notifications for your Discord server.
obfuscator.io obfuscates it in such a way that even after using this its hard to understand
Do you know how I can get relation data using typeorms query builder?
Hey when i use fetchLogs, it return me an array with executor, target ect, but when i put UserManager: 0 on the MakeCache client options, the executor is null, how can i get the executor without caching everyone ?
how can i send a message with a dynamic amount of elements in? if u have an array with a random number of objects i could do like the code under to for example log what i want js for (let x = 0; x < array.object.length; x++) { console.log(array.object[x].name); } but what do i do if i want to send all those elements in a message
channel.send(array.object[x].name)
or
let content = "";
// Add each name to content in the for loop, and after the for loop send the content
channel.send(content);
That also works but there's nothing wrong with sting concatenation inside a for loop
Someone know how ?
There is actually, string concatenation is quite slow, and generally there's a better option for loops
Like in java we have StringBuilder
Methods like map and join tend to be slower because they perform type checks that just don't happen with a regular for loops (not a for...of).
This is a micro-benchmark but it just goes to show that the string concatenation is not slow
not saying a for loop is better here
but if you're going for 100% performance a for loop is your safest bet
Ig that's one of the drawbacks of being dynamically typed
if you're going for 100% performance it's time to stop using javascript
.join is never going to be your bottleneck
not sure why you'd bother even thinking about it
also these micro-benchmarks are totally unreliable
Because KuuHaKu said it's slower and I just wanted to show them that it is in fact not slower than a .join. Obviously .join should be used whenever possible.
In js at least
In other langs I used it's the opposite
Because of string being immutable thus needing to be recreated on each iteration iirc
wait you're not even testing the same thing
you're testing appending a number in the first one with fixed-size allocation lol
part of why microbenchmarks are terrible
you have no idea if you're comparing apples to apples without manually going through the bytecode
cringe
well for once you would have to append a string to it not a number
Ic
oh your array is just an int array in the first place
other website that shows otherwise because these results are meaningless
oh no wait they swapped 1 and 2 around lmfaoo
why tf would they do that
I don't think so
I'm surprised because v8 usually optimizes native methods like these
to the point where reimplementing them by hand isn't actually faster
that's how it works with .forEach and .map etc
still can't know if the benchmark is comparing the right things
Is there an easy way to and a number with all values in an array and check if anything is true. Without doing a for loop? F.e. 16 & [2, 8, 16, 32] (= true)
js
Includes
My only guess on why .join might be slower is because it does extra checks - if the array contains holes, maybe some other guards.
Isn't it possible to see the underlying code?
yes but the codebase is huge and if it'll take u a while to find it
Ctrl + click doesn't take u there?
Considering the codebase contains more than 600,000 lines of code, probably not
oh no
it doesn't since it's definitely implemented in C++ and not js
Eh
One way to do it is with every which does a loop so no it's not possible
mogus
anyone happen to know a stable and more supported version of wine?
I tried using raw wine to run things but they either won't launch or completely broken
Does mysql have something similar to js's .includes() but for a WHERE clause?
Ex: A person select a playlist and wants to chose "My Playlist" and they type "My play" it would kind of assume it's my playlist
WHERE search LIKE '%laylist'
WHERE search LIKE '%y Playl%'
WHERE search LIKE 'My Play%'
I've always wonderedāhow would you protect that against injection?
Where % is your placeholder aka. wildcard
So the user can't insert % as a placeholder
At least not with prepared statements
ty
maybe the ui
oh ffs ~ a delete button ~ duh
aligning them to the text within the input, or the border of the input?
too controlly? š
I'm talking about the edge here
Would probably look better if the title (General) was aligned perfectly
But maybe not
yea, but do you suggest aligning the general to the border of the input below, or to the position of the text below?
border of input
hmm 
actually I think I like your original more
š
I hate designing gui's so much. I spend so much time doing this kind of pixel perfect placement of junk š
this is why I stay away from front end
you spend too much time with styling just for it to not be perfect
front end dev is the easiest ~ if you have a designer to actually design things, or a strong concept in mind. but trying to build it all from scratch with no idea where to begin ~ thats where it gets tedious imo š
yeah
we all want a system but creating a system is hard
so we use designs that already exist (material), but then everyone uses it, need something more special/cool looking
ive never used material ui, nor react š
i normally use raw bootstrap, which there is a material design kit for
How do I get the length of an audio file
i dont think it is possible, you can do that by changing the filename tho
or is it
i forgor
Make an Attachment with the url then rename it SPOILER_name.png
Alright
channel.send({
files: [{
attachment: "imageurl",
name: "SPOILER_FILE.jpg"
}]
});
Check the npm package get-audio-duration on npm
cant you just extract it from the file metadata
Yes you can
bro that package is a wrapper which uses another wrapper š
I'm probably going to upload it to github/my site for others to use (free) when its finished.
this.client.cluster.broadcastEval(c => [
c.cluster.process.memoryUsage().rss / 1024,
])
tells me ```
Cannot read properties of undefined (reading 'memoryUsage')
Seems to be running but nothing
no error or logs
does it return the value that you want?
nvm fixed it
For some reason doing that and using the package music-metadata doesnt work. The duration is 0.007 or whatever which is weird.
Okay; thank you.
newb question but how do you ping members on slash command?, i know how to use options but how
Why the bot doesn't show it avatar?
https://top.gg/bot/574812330760863744
A cute bot with battle RPG, PvP gambles, text to speech, anonymous confession, temp voice channel, conditional giveaway, Among us, etc
Well, you can do a traditional ping, like <@id>
Press refresh data
Of course, replying to the interaction is basically a ping.
still doesn't work
...it isn't instant
Takes 30 mins+
interaction.mentions.members.first()``` works too?
