#development
1 messages · Page 104 of 1
Does someone know ChartJS? Is there a possibility to place datasets between labels?
E.g. I want 30min periods as labels but between them I also have data for e.g. 12:37 AM a dataset etc.?
Oh you dont know how much I had to deal with ChartJS
you can have multiple datasets on one chart
Should also allow mixing multiple datasets with different labels
something like this https://www.chartjs.org/docs/latest/samples/line/multi-axis.html
Open source HTML5 Charts for your website
@rustic nova hm okay. Yes I already saw that. So what I want is e.g. I have 1:00 PM & 2:00 PM labels and I want to place 10 datasets between it (e.g. 1:13 PM, 1:15 PM, 1:37 PM...) so the datasets don't stick to the labels
So essentially something like
1:01PM 1:02PM..
1:00PM 2:00PM
exactly
the example seems to match what you'd need
just as an example with months and years
the implementation seems a bit more complicated than I thought, but yeah that should do it
Also works with the y axis
You sure? It seems that you still can only place (or show correctly) as many datasets as there are labels
ohh
the second x-axis seems to only be for keeping track of the ranges itself rather than the times, so you'd need to have the main x-axis as the times, then the second one with the 1:00PM, 2:00PM and so on
as far as I can tell at least
As far as I can see one axis is only for the years separation. And the other is for the data. There are actually no datasets between labels, they still stick to it 😅 Is this even possible? xD
Am sure its possible, chartjs is pretty customizable
unsure how it would be done though

How should I save images that are being sent from client to server?
What is the most efficient way?
lossy compression exists or resizing to a standard format
yes
Anyone can sue anybody for anything. Doesn’t mean you would win, so I would seriously love to see you try lmfao
no
i don't think his parents are gonna agree on suing anyone over the internet
true
very true
so change that to
i can't sue you
no
yes
i could sue him
u are underage and can't make a case
anyway if u wanna talk more bring it to dms i'll show you why even tho u may sue them you can't win the case
dms are at $230 a hour rate
Yes
Hey guys, i had a question about registers (a set of flip flops) in general. A flipflop must have 2 selector bits denoting whether we want to perform the set, reset or hold action right? In a digital circuit it's only denoted to have one input called d. Does this mean that d must expect 2 bits?
We’ve been doing flip flops in my class and I’m ngl our teacher sucks so unfortunately I don’t understand them either
brooo me too tvh
tbh
like flip flops are quite easy, i could help you with that
just registers were never really fucking mentioned besides a 2 minute short description brev
Our teacher has an English degree and has never taught this course before and knows basically nothing about electronics
But the school gave him this course to teach for some reason
whhahahhaha no way that's fucked up
We literally teach him 💀
The course is called digital electronics
no i meant digital
No idea what that is
the program to simulate digital circuits
We use a program called MultiSim
ahh i see
We’ve been trying to make truncated binary down counters for the last 3 days and our teacher can’t figure it out to teach us how to do it
omgg that is fucking hell
i have a teacher that is like really smart in these things, so he assumes we already know everything
we are both fucked
I can make a binary down counter with d flip flops but I can’t figure out how to use the async inputs to get it to count from 5 to 0 instead of 8 to 0
@eternal osprey I was recently watching a yt video explaining stuff like registers and other concepts which I found very informative and fun.
Exploring some of the basics of computer memory: latches, flip flops, and registers!
Series playlist: https://www.youtube.com/playlist?list=PLFt_AvWsXl0dPhqVsKt1Ni_46ARyiCGSq
Simulation tool (work in progress): https://sebastian.itch.io/digital-logic-sim
Source code: https://github.com/SebLague/Digital-Logic-Sim
Support the channel: https://www...
hey, thank you! i will have a look
He does revise his logic a few times, but it shows some techniques
I understand the topic quite well, but had trouble with understanding how the value actually gets hold. Then i came with an insight but not sure whether it's correct. If we select the I to be 1, we perform the set action right? So Q will be set to 1. But on the rising edge of the clock the Q could already be overridden as I could change. Does that mean if we want to hold a value, the input I must stay the same?
once the set signal has been sent, any value sent to a register is stored but if the value of the input has changed due to a race condition, you may need to separate bus lanes if they're shared
or make a queue system
oowh so the register takes one set/reset input and another input for selecting what you want to store?
Yeah. Depending on the register size of course
i thought that the registers were just flipflops attached to each other
as the flipflops don't really need an external input for the thing to be stored
Well. 1 bit registers can effectively be flip flops
hmm
the flipflops, if they have a 1 as input it will set the q to 1 right. It will instantly output it. Is this the same with registers? Because, if we set something in the registers, will it output the current value like normal flipflops or the previous value?
I still recommend watching the video or at least parts that are relevant to you because he does go over accepting an input and a store signal
It'll only output the stored value
i already found it strange that the register had an extra input
oowh i see, i will def watch the video.
i see, thank you!
oowh wow i understand it now
this fucking simulator sees the registers as a series of flipflops, so the d is the action you want to perform and the en the data to store (1100 for example if you want to have a register of 4 flipflops)
so suppose we are saving 1000, it will output 1000 as well. As long as our D is 1 (if that is our previous action) it will stay 1000. If the D is 0, it will reset the register (or if we have an input en that is different than 1000 and D is set to 1)
hey, so i am working on some discord webhooks rn and for some reason they work only once and then they respond with status 200
anyone has a clue?
Trying to add a pause in my code that looks somewhat decent;
try {
Thread.sleep(500); // Pause for half a second
} catch (InterruptedException e) {
// Handle the exception
}
if (i == 1) {
System.out.print(".");
} else if (i == 2) {
System.out.print("..");
} else if (i == 3) {
System.out.print("...");
System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
System.out.print("Creating Player..."); // Print the final message with an extra space
z++;
}
try {
Thread.sleep(500); // Pause for half a second
} catch (InterruptedException e) {
// Handle the exception
}
System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
System.out.print(" "); // Overwrite the previous output with an extra space
System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
System.out.print("Creating Player");
if(z == 1) {
System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
System.out.print(" "); // Overwrite the previous output with an extra space
System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
System.out.println("Creating Player...");
}
}```
Is there an easier way to do this lol? Seems like a lot for such a small thing
Please, use codeblocks
Hey! I got a question 🙂
I have a setinterval function but sometimes the function inside it takes more time to execute then the interval time set (& it all depends how many guilds are using this feature) how can i insure this doesnt happen?
Thanks
create a method for your "cursor back" ways, with an integer as a parameter
also for
if (i == 1) {
System.out.print(".");
} else if (i == 2) {
System.out.print("..");
} else if (i == 3) {
probably a way to optimize too
Cause its making my bot super slow if it runs again before its done
also tbf, adding a simulated delay is ehh
Wtf did you put yourself into lmao
Just wanted to try it because it looked goofy with how it was
Gone from path detection to cpp to circuit design
but yeah you can improve on the "move the cursor back" methods instead of having out.print all over
Also other random question-
I want to make this thing into a discord bot but have no idea how (lol)
Would it be hard to create the idea in java and then fix it to work with a discord bot? Or would it be easier to just learn how to make a bot and do it from the ground up
2 things, yes would suggest to learn bot development from the ground up
second, using thread.sleep inside a discord bot is gonna be pain
since it would pause the whole discord bot iirc
guys just so you know the global fetch of node can be very weird
keep node-fetch atm

i had to delete 15 webhooks cuz of it
for some reason it was sending the info only once
Global fetch?
well the fetch node has on its own now
what node version are you using because it might use outdated undici
18.13
i am attending computing science at my university in the netherlands, so we get like 4/5 different courses each semester
from databases, to coding, to fucking math.
each course is enlarging my ass
U sure it ain't computing engineering?
CS doesn't usually go down to fucking circuits
yeah circuit design classes usually are for electrical engineering majors
we got like 3 different degrees in the netherlands, so like you got the CS that's equivalent to college ig that mainly does practical things like coding etc, then you have a degree higher, which is university where you mainly learn about the information behind the practical things.
So cpu's, memory, as well as matrices, security and what not
ion know what the fuck i am doing with my live tbh
You'll end up with 3 degrees at once
Node.js v18.13 uses an Undici version that has regressions, update to Node.js v18.15
yeah i wish that i went to a university in like the US or something
Oh good to know thanks
I mean, you'll end up quite knowledgeable in a bunch of areas
At the cost of 1/3 of your sanity but oh well
I'd say the majority of software engineers probably don't know too much about the internals of a computer. You'd have an advantage over people in that space for sure
i gotta study 24/7 to understand half of the topics lmao
Rigorous programs will make you a diligent and experienced person when you get out of uni
yup indeed, but at this moment it has become a bit too much for me
Try to get a hobby to ease your tension if u can
Else you'll burn up like a grape in microwave
yeah i go to the gym and love to code, but yeah don't really have much time for that as my exams start in a week
@lyric mountain just made a pretty decent improvement to the performance of the systems in my engine by giving an initial size to the HashSet that stores the entities in each system
Ah yes, heard abt that
The same applies to arraylist
In fact, arraylist is pretty slow if it grows fast since it increases the capacity only a bit at a time
thought it doubled the size on every resize?
Not arraylist iirc
Lemme check, just a sec
Most apache collections do use doubling method
What is this and why does it need my 2fa code
Discord applications by default are assumed to be for rich presence purposes and you have to specifically mark it as a bot in order for it to be a bot account which is a destructive action
does it do anything to my actual account
not to your account no
Is there any reason not to do it
If you're not making a bot
also making a bot there will not, I repeat, will not create a functional bot
it'll just create a bot account that can be used for programming a bot
wdym
I mean you'll just create an empty shell
it won't give you a bot like @gilded plank or @grave zealot
oh boy
when you setup a project intellij will download it automatically
my question is, what are u trying to do?
make a bot
do you have previous experience with java?
I know how to do everything I want to in java
just not discor dbot
trying to make something like this i guess
what did u make in java before?
just asking cuz very rarely you'd not bump into maven/gradle soon or later when programming in java
AP cs stuff if you're familiar with that
this is my first time coding outside of taht shitty website codehs
so haven't really experienced all this stuff
ah ic, no prob then ig
ignore the inputs (lol) but this is what I have so far- just want to make it into a discord bot
I have to ask cuz we get a lot of people here who never touched code trying to make a bot
uh so fair warning AP CS is a lot different than making a bot with JDA
it's going to be a challenge I'll warn you
but it's definitely something you can do if you've taken the fully AP CS course
yeah
I suppose ur gonna use JDA right?
i understand that I don't know what I'm doing 💀
i guess
the discord library I mean
there are a couple for java iirc, but jda is the most stable (and popular) atm
...you see, choosing the correct library is highly critical if ur gonna make a bot, since you can fall into pit traps (abandoned libs for example)
but well, did u download intellij?
ye
I have a program setup in intellji
just not for anything discordbot relayed
then all you need to do is click new project and select gradle, the setup is pretty straightforward
Hello how are ther to dey
the screenshot is outdated, gradle got merged into java
ye
I do not recommend using java 8
what else is there
java 18
oh
java 8 is extremely outdated, you should always use the latest LTE version
can i just do this
unless you're forced due to backwards compatibility
yes, that one is fine
intellij automatically downloads versions for you, which is nice
yes just checked, you're using jda
I recognize that guide
that guide is outdated tho, you don't need to make a shadowjar to run the bot
you can simply run with gradle directly
so how do i actually do it
it's in the readme iirc
after u create a gradle project all u need to do is add what's written here
yes, but what's shown there is if you were to create a shadowjar
implementation("net.dv8tion:JDA:VERSION") this is all that matters
replace version with the version shown in the repo
replace $jdaVersion with the latest version
without v
u can also click on that tag to get the full gradle string
implementation group: 'net.dv8tion', name: 'JDA', version: '5.0.0-beta.5'
u wrote something wrong
yes
now click the elephant button on the top right
and let it download the necessary stuff
that's supposed to be an elephant lmao
k yeah it did it
ohhh
it's useless since u cant unit test a bot
I unit tested my bot by faking Discord's gateway
you're crazy
the lightbulb/
You're only now realizing that after all this time I spent discussing all of my stupid projects?
lmaoo
yes
that's not really a stupid project
still says htis though
do the same again
lightbulb went away
alt enter
testing remote stateful things is fairly useful
oooh
also, BOT_TOKEN is supposed to be replaced
tbh I am a little intrigued in making a server people can override their gateway connections to test their bots
please do fucking do it
since most libs offer proxying requests
why is it saying my token isn't a thing lol
because it doesnt exist until you declare that constant
Would be fun trying to have non committal objects which is based off of sessions
or delete everything after a time period
did u write "like this" or like this?
2nd
...ok, listen
ik making bots is cool and all, but you should attempt an easier project until you get the hang of java
bots aren't as easy as it sounds
This has nothing to do with java
it does
I'm just trying to get it setup and then learn it
you forgot strings require quotes
No
the token is supposed to be a string
I did not know it was supposed to be a string
the function shows it
You just said put the token in lol
that has nothing to do with java
Like I said, I'm just trying to get the basics setup and then worry about everything
That has everything to do with Java
Not this specific problem that prompted them to say that I should go learn java before trying something like this
booting up intellij just to show it does ask for a string
You cannot setup something without prior knowledge of the language
Like I said before
This is my first time actually using intellji
not some shitty website that doesnt help with anything
Forgot you could hover over it to see what it needs
The issue isn't that I didn't know a string needs "", I just didn't know it was supposed to be a string
as you type, I'm pretty sure a popup of the argument list and expected types pop up showing what's needed
java only has 3 types of values (from a very high view)
either a primitive, a string or a class
a token contains both numbers, letters and punctuation
which cannot be any of those
unless put in quotes
plus the error would tell u it was supposed to be a string
Someone else told me that you can't create a bot in java and it's completely different. I wasn't thinking about java logic. Again, I'm just trying to get the basics setup and then figure everything out. I know what I need to know in java for this
that person is terribly wrong lul
you can make a bot in any language that allows http requests
And as I said before, this is my first time using intellji. What I've mostly coded on before doesn't tell you what needs what, or anything close to that, so I wasn't even thinking about looking at it to see what was wrong.
no problem with that, but try to make a simple project just to get used to your tools first
else you'll get stuck after the guide ends
and I mean it, most of using JDA is using javadocs and ctrl + space to discover methods
since it lacks a comprehesive wiki (don't blame them tho, it's a huge lib)
Keep in mind that AP CSA is actually also a fairly introductory course to the language and actually doesn’t teach a ton
The most advanced data structure they go into there is like arraylists pretty much
if u do choose to practice before making a bot I'd gladly help you with your questions
so even making a bot that's just input output is complicated?
well, not exactly "complicated", but it's somewhat counter-intuitive for a new dev
there's a lot of setup involved
just trying to turn this into an interactive like
this
but yeah i guess i could see how its not as simple as i thought it would be
like, with bots you'll be mostly working in an async scope
Yeah, HTTP requests and responses are not taught in AP CSA, so it's going to be a new concept
Events as well
Lambdas and such
hey can someone help 🙂
verifyservers.find().then(async function (b) {
for (const server of b) {
const address_to_track = server.track_address;
const guildid = server.server_id;
const roles = server.roles;
const guild = client.guilds.cache.get(guildid);
if (guild) {
const perms = guild.me.permissions.has("MANAGE_ROLES");
if (perms) {
const members = await guild.members.fetch();
await Promise.all(
members.map(async (member) => {
const account = await profiles.find({
discord_id: member.id,
});
let count = 0;
if (account.length > 0) {
//check number of nfts
await sleep(100);
} else {
//remove the related roles
}
})
);
}
await sleep(1000);
}
}
});
} finally {
isRunning = false;
}```
i have this piece of code in a setinterval function but its making my bot SUPER slow, does changing to a much more powerful vps solve that problem?
Why sleep?
You're sleeping every member of every guild,
If your bot is in one guild with 30000 bots that's 3000 seconds for just that one guild for no reason
Also, you're fetching every member of a guild every time
It's not sleep per server?
To not hit the rate limit, inside each account i have an api call to check the nfts each user has
mee6 moment
The sleep is only inside if thr user is in the database anyways, so no 30,000 bots isnt 3000 seconds
Bots arent in my database anyways, the database consist of users that linked their wallets only
Yes, but you fetch all users on each such server, not just those who are in the database
can't you just track that data through other means?
If you don't need them then why do you need them in the cache
To remove related roles if they have them 🙂
It doesnt sleep if they arent in the database though so this part isnt causing problems
try a reactive approch, instead of proactive
like, react to actions instead of taking actions yourself
for example when the user speaks
Yup might have to try that, cause this is making my bot take lots of memory and cpu usage somehow
it's cuz ur fetching + sleeping
sleep usually takes quite a bit of cpu usage (in js)
and fetching will create new entities, thus using more ram
other than that, might want to use more named functions instead of lambdas, since apparently js creates a new anon function every single time it's called
thanks alot, got 1 more question can this cause problems too cause i am calling mongodb too often?
const account = await profiles.find({discord_id: member.id,});
Each database query takes some time
I have no idea how much, but in the case of my bot, it's enough that it can't respond within 3 seconds of receiving an interaction
most databases cache recently fetched data
yeah but if i keep my own cache that just updates every min instead of calling the database for each user, isnt that better?
true
i'd say more cache is never a bad thing
you should 100% keep your own cache alongside the databases one imo
you can also save a lot of requests to mongodb over a network
unless you need alotta ram
You mean the .env file?
Just ask your question, if someone is experienced with something they'll answer your question
The Path env var is basically a list of directories the command prompt looks at for binaries (commands) the shell can execute. You would append a directory to the Path variable and separate entries with whatever character is used
I think on windows it's ;
what os
oh
windows 8.1

does it give you an error when you try to add another
Whenever you click the edit button on path, you should get an option to Add an entry
That's literally what's supposed to happen
You don't add variables to the PATH environment variable, you edit it and add paths
They're separated by semicolons on Windows
Which one are you choosing? The user variable or the system variable?
I wonder why you're using Windows 8.1 anyway unless you can't upgrade to Windows 10/11 for hardware incompatibility reasons
hey i have this,
members.forEach(async (member) => { });```
if i change it to
```const members = await guild.members.fetch();
for (const member of members) { }``` its bugs why?
You haven’t even shown what you’re doing with the members
Fundamentally those two things do the exact same thing
Also you haven’t described what you mean by “bugs” either
if i try to do anything with the for it just bugs anything
even if i log member.id
if i log member.id it sends "undefined"
in the for loop^
in forEach, it works normally somehow
the one commented doesnt work
Oh
You need to do for(const [guildId, member] of memberstest) {} instead
Because member in your for..of loop is [string, GuildMember], not GuildMember like you think it is
(Typescript for the win)
@lyric mountain do you know if there's a way to "simulate" command line args? I want my program to always run with -Dsun.java2d.opengl=true but I don't want to have to specify that for each user running it
how about programmatically setting the option
yeah that's what I'm trying to do but I've never done that
you can also do launch scripts the user is supposed to run versus the user trying to run it themselves.
This is what I do for most of my typescript software because I enable source maps for debugging even in production systems
also telling my users to launch a LavaLink remake I did using the start script via npm run start or yarn start if they prefer yarn package manager over npm
i need to be 16 to be verified dev right
to verify a bot, yes
that memberstest is of Collection<string, GuildMember>
so if you call regular forEach, it gets called like an array (<Array>.forEach)
https://discord.js.org/#/docs/collection/main/class/Collection?scrollTo=forEach
Collection<string, GuildMember>
.forEach((value: GuildMember, key: number, map: Map<string, GuildMember>) => void)
but when you loop like for const, membertest turns into an iterator
(possibly via calling .entries() of Map)
https://discord.js.org/#/docs/collection/main/class/Collection?scrollTo=entries
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries
(optional https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols)
Collection<string, GuildMember>
.entries(): Iterator<[string, GuildMember]> // something that Array implements
that's an iterator of arrays with two elements (key, value)
to make it do the what you want it to do (which is only accessing its value)
, make a call to .values() instead
for (const member of membertest.values()) {
//...
}
for more of that, i assume that you use discord.js, can read more here
https://discord.js.org/#/docs/collection/main/class/Collection
oh shit the signature was differnt
imagine using Collection
@boreal iron since you helped me (and in the end you were right, not making ReactPHP mandatory was the right thing to do) if you want you can look at the temp documentation while they revise the pr.
https://github.com/top-gg/php-sdk/blob/195363a23e519fecd5b683cba1974df48e7fc6df/docs.md
A simple Top.gg API wrapper written in PHP. Contribute to top-gg/php-sdk development by creating an account on GitHub.
can't i have this event in a cog?
http://cdn.sugari.live/74264.png
doesn't seem to be working-
hi guys,
when I need to return information that exceeds the amount of characters allowed in the embedded message, what should I do around it? Instead of an embedded message, send a DM to the person who requested it?
you can just return that error to the user, unsure how that "embed creation" is being triggered
ok but the complete information requires more characters than allowed.
can i send the complete info to DM breaking the message ?
you can send it in multiple embeds
It would then look spammy and untidy but yes you could.
I can't, the reviewers rejected it because of that ^^
interesting, that I didn't know, but will they deny it if I do that too? ^^
ohh i see i can send array of embedds
Np
The server responded with error 50035: Invalid Form Body
Inner Errors:
MAX_EMBED_SIZE_EXCEEDED: Embed size exceeds maximum size of 6000
i think isnt work for me too 😛
how i turn around for reviewers dont deny it lol
check if the embed is too large, if it is, just strip the rest of it and replace it with ...
if your embed really needs to have that content, consider using pagination
hey! if i wanna slice members to process them in batches how can i do so?
good idea, i can put some emojis to paginate it
const members_to_process = members.array().slice(processed_members, processed_members + batchsize);```
i have that but it doesnt work
normally in javascript when I need to do a skip take, I use the splice.
the code becomes cleaner and more readable
the problem isnt with the slice, member.array() doesnt work, its something different ig
const takeNumber = 3
const numbers = ['1', '2', '3', '4', '5','6', '7', '8', '9', '10'];
for(let i = 0;i < numbers.length ; i + takeNumber){
console.log(numbers.splice(i,takeNumber))
}
if i were you, i would see what object is coming from this fetch and what is this processd_members? is it control variable ?
const members_to_process = members.map((member) => member).slice(processed_members, processed_members + batchsize);
did that and its all good now, not sure if its efficient though
and yes, its a variable
starts at 0
increase each loop by the batchsize
do you know of a nodejs package that returns audio properties like this
don't use map for loop, use map if u have to return a different object. instead of map use for.
const takeNumber = 3
const members = [
{id: 1, nome: "jao"},
{id: 2, nome: "maria"},
{id: 3, nome: "augusto"},
{id: 4, nome: "lerolero"},
{id: 5, nome: "fabiano"},
{id: 6, nome: "namala"}
];
let membersProcessed = [];
for(let i = 0;i < members.length ; i + takeNumber){
let arrayConcat = members.splice(i,takeNumber);
membersProcessed.push(arrayConcat);
}
console.log(membersProcessed);
the output will return an array of object arrays
If bot
Reach
More then 100 Servers
and after it verifed
can I still use prefix COmmands?
without slashes
yes
oh Okay
you have to apply for message content intent for that as well
not just verification
it rlly isn’t but 
Wait I will create a form nw
Making the slash commands is the Most Curse thing in the world so no need to ask more things about it
🥲
discord is moving away slowly from message prefix commands anyway which means lib devs will probably eventually drop support as well
by support i mean helping w coding it
kk
paginator is a good way to keep things clean
not really
it's basically the same process
and they're easier to use as a developer
What? Lib devs are going to support message commands, message intent still exists and many people use it. Just because discord prefers slash commands doesn’t mean that libraries are going to drop support for one of the most fundamental parts of their libraries
^
it’s still going to exist in libs. it just means that they won’t have support for it
That doesn’t make any sense either
many are already doing that
Of course they’re going to support people working with message commands
I don’t know of anybody that does that
doesn’t mean it doesn’t happen
That would make no sense, anybody that does that probably doesn’t have many people using their lib
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "pico/stdlib.h"
#include <stdlib.h>
int main() {
stdio_init_all();
printf("Working");
size_t current_size = 0;
char buffer[1024];
memset( buffer, 0, sizeof( buffer ) );
while (true) {
char character;
character = getchar();
int a = (int)character;
if (a==10 || a==13){
printf("%d",a);
printf("%s\n", buffer);
memset( buffer, 0, sizeof( buffer ) );
current_size = 0;
}
else {
buffer[current_size++] = character;
}
}
return 0;
}
i somehow end up not being able to reuse the array
after the first or second memset
nvmbuffer[current_size++] = character; sounds like an array access out of bounds
it works fine without 2nd.memset but probably
wha
System.setParam() or smth
try changing them to memset(&buffer[0], 0, sizeof(buffer));
thanks
glad my C brain is still working
i want to learn c better lol
why
yeah i know that
took me a few months to get used to the pointer system
yeah it will to me
Support for prefix commands will exist as long as discord stays a message-based chat app, lib devs can't drop support for something so fundamental
That is, unless discord cuts messages from bots permanently, in which case it'd mark the death of discord as we know it
prefix basically is to distinguish if it is a command or not
It would become a different thing, not necessarily die entirely
how
started with a prefix what is concatenated with the prefix is the command after spaces become parameters
Many unprefixed features like moderation, automatic responses, drop prizes (ik discord hates this one, but people like it), levelling, and other stuff I can't remember now
By "cut messages from bots entirely" i don't mean just content, I mean the actual message event
i doubt they would do that
but i understand what they were trying to accomplish with the message content intent
its funny though because clients receive message events for channels they can't read. There are obviously not contents attached to it, but you can exploit it for images
Yeah, it's easier to filter-out misuse of quite a sensitive data by whitelisting instead of blacklisting
nice
so i can technically view images from the #moderators channel here
Discord: we dont want our users to create AIs using our users' messages.
also Discord: we're making an AI from our users' messages
yeah if the sender is on mobile, the images usually follow image0.png format
wym by users creating AIs using their messages
if on pc you can try unknown.png
Wait you can what?
yeah
People can train AIs using messages
I knew about being able to see hidden channels, but didn't know about events
one sec
the events arent sent to the client
Yeah it wasnt recent
but I didnt imagine it would be patched since it seemed like it had to deal with arbitrary permission assignment like editing the channel last_message_id so that you don't have to GET the channel before you can GET /channels/:cid/messages
oh wait nvm last_channel_id is just for before searches which are optional
Please ignore me I am dumb
also I think it was only user accounts that got the events because this was probably before the message content intent so having the content be null would have broken apps
@lyric mountain I have a performance question, would it be a bad idea to get() from a HashMap every frame using a string? I'm thinking of using this for a custom input system so I can do something like if(keybindManager.triggered("Fire")) {}
That wouldn't be very expensive at a small scale right?
Hashmap access is always O(1), it's fine to use it
Well yeah algorithmically but I wasn't sure if the hashing operation on strings would get expensive to call frequently
I'm assuming it's probably cached after one use anyways though
oh perfect
Strings are stored in a special table in java, so their hash values are stored when they're created
Which is why strings are immutable
Figured so, that's one of the things I would expect java to optimize (considering what little optimization it actually does)
kinda insane that it does almost all of the optimization at runtime
not sure why they went with that design decision, maybe to optimize differently on different platforms
The whole thing around strings in java is overwhelmingly optimized
I think most languages where strings are immutable use some sort of string table
Yeah that's generally one of the most basic optimizations languages make
string interning is super optimized
But yeah, java speed ramps the longer it runs since JIT will fine-tune the code depending in where it's running
Also why micro-benchmarking is remarkably hard to do in java
Yeah I never understood why java doesn't do more compile-time optimizations
Hell it doesn't even do inline function calls until runtime
You can hint the compiler with annotations
Like @Range annotation which tells the compiler the expected range of values in a param
There are others that tell it to inline too, I don't recall the names now
I don't think there's an inline function annotation
unless I've been living under a rock
@inline 
there's certain things you can do to convince it to inline, like I think that final functions are more likely to get inlined
if a method is too many bytes in the resulting bytecode it won't inline as well
I think default is 12
Hm, I think I mistook with scala's inline annotation
does anyone know why we would use .DATA over .CONST in assembly?
Like for example in one of my lectures, they computed k = i + j
so they used i: .DATA 3
J: .DATA 5
but couldn't they also use constants for this or am i wrong?
Bro's gonna be using punch cards next ☠️
i will become a master coder/engineer/rock smasher in a few years
yall aint ready for this
The last one

There are multiple types and formats of Assembly, such as AT&T, Intel, x86, GAS, NASM, and many others, how should we know which one you're talking about?
(I would assume he's probably doing x86)
x86 doesn't have a .CONST assembler directive
i honestly have no clue
it's talking about assembly in general
i actually think that we use our own assembler
but not sure what it's based on
You can't really talk about Assembly in general because it doesn't have a single or general form, it has many upon many
So there's no way we can help without knowing the specifics
ah np, i didn't know that mb
Java is multiplataform, C is single plataform, ASM is half-plataform 
Which makes RCT even more impressive
This channel is for asking help regarding code and other things related to coding. No one here will help you make a bot for you.
huh
I wish to throw devs against a wall
bootstrap select
- support for bootstrap 5
- does not work on bootstrap 5
How to validate the image buffer, that are being sent from client to backend
You can probably try to load it into a bitmap image manipulator and if it fails then it obviously isn't an image. Otherwise, you can check Content-Type header if it's sent by the browser itself and not an API. You can also add extra hidden fields to a form if it is posted via form to verify that it was sent on your site and most likely sent by a browser, but people can scrap html. Having hidden forms is recommended to protect against XSRF
But when user look at the internet inspect tab, they can see the hidden forms. How can I hide it complely
btw do you have any docs about bitmap image manipulator?
the person I replied too deleted their msg.
So currently learning a little bit of git/github, does anyone know how I would fetch the most recent commits/version from a repo if the fork I'm working on is behind the original copy? My friend is working with me on my game engine, and so he has his own fork of it which needs to be caught up with the commits I pushed to my repo.
you can't hide anything in the frontend
if there's anything u don't want the user to see, don't put in the frontend
The original repository is called the upstream repository meanwhile the forked repository is called the origin repository, if you want to sync your fork (origin) with the original (upstream), simply add it as a remote:
$ git remote add upstream <URL of the original repository>
And pull from it (I would also recommend using the --rebase CLI flag as it would put your work on top of the new changes/commits):
$ git pull --rebase upstream main
(Note that main is the branch, in this example we're pulling the changes/commits from the original (upstream) repository's main branch)
thank you for the detailed explanation C:
Well, I'm working on a repo that I own, and my friend has forked that repo and is working on it as well, but when I commit to the repo he needs to be able to sync his cloned fork with my repo so he can continue where I left off
So this is basically exactly what I was looking for
That way he can update his copy, create his own changes, make a PR, then I can merge it
Sooooo
Im working on a bot...
Made from BotGhost because...well...idk C+ and so im making It there
My Bot can do Tickets/Moderation/Role give/Partnership and im working on much more made from scratch
I've send the bot to TOP.GG and im waiting approval...
But if i want to create a website for my bot to join servers and get a Premium version of It...
Is It a normal thing or not?
+
I know Bluerpinte Is not appreciated by the most of the Devs because of multiple Things...
But can i still call my self a Dev if i programm Whit Bluerpinte?
nobody sane would make a bot in C++
I forgot the right leanguage
Also I don't know why people care so much about being called a developer
I don't care that much Im Just curios
@ brain
and a lot stupid
You can call yourself the king of Great Britain, but that doesn't change anything
I Was Just asking... 😦
And they're replying
It doesn't matter, say what you want
If you want to make people call you a developer, do it
If you want to make people call you a king, do it
No One calls me the way i want
And that's the hard reality of life
Even at my Age you can see the entire Life and know how hard It is
at what age 
🫣
Someone doing a fully fledged game on unreal engine with blueprints is more a developer than someone doing a discord bot with blueprints.
3 years old
@ mods ban !!!
Using Unreal Engine to make a game Whit Bluerpinte actually
Because there's nothing to say
Ok
As for these "partnerships", I hope that the bot does not send links in private messages because they will not accept your bot
You can call yourself whatever you want, but don’t expect people to call you a developer if you’re using botghost, it’s not really a “real” development experience
Nooooooooo... Ok maybe...
But not for what you think
I don’t even call myself a developer about 2.5 years after starting programming
But if i use Bluerpinte on Unreal i can call my self whatever i want?
That's... A lot of time
You can call yourself whatever you want but other people may not do the same
You don't need to do anything to call yourself whatever you want
^^
Others won't call you the way you may want, and who cares
If they don't consider you a developer but you do, then you probably did something wrong
E.g. using botghost which is not a development experience as already said
Calling yourself a developer when you’re a beginner is the epitome of the dunning-kruger effect though
Well...if Someone when i have my Dreams job doesn't call me how i want i Would be mad
Nobody called me by my job's nature so far
I haven't done any drama around it either
being a dev is more about thinking logically than writing code
0 confidenze 50 Competence
Especially Whit Bluerpinte
Yeah the majority of programming is logical thinking/problem solving
we frown upon "blueprints" because they're severely limited and a pretty cheap way to solve things
nothing wrong with who use it, but there're better options
Yeah, plus they shelter you from what you would actually use in the real world
But Is more complicated
Like IDEs and GitHub and other tools that are used frequently in development
Nothing's easy if you want to be good at it
This ^
Nobody starts off as a senior dev, you gotta work your way up by getting out of your comfort zone a little
And that’s a perfectly good thing to do
I think they mean blueprint as in a specification for how something should be implemented
No
You sure? They were talking about using BotGhost and such earlier
Blueprints as in Unreal Engine's blueprints
That too
I prefer learn from my errors alone
So did I
Not quite sure if I understand what you mean by that
When i started using Bluerpinte of Unreal and BotGhost i started Whit nothing
Generally speaking when you start to learn a new skill you start off with virtually 0 knowledge of it, yeah
Starting off with botghost and blueprints is nice and easy, but at some point you will have to face the challenge to move away from these and use technologies closer to reality.
Nobody uses blueprints in the real world because like KuuHaku said, they are very limiting and don’t provide much customization, and often times “blueprint languages” don’t even exist for what you may attempt to do
Blueprints are very introductory and are used as a way to not confuse you a ton when first starting something like Unity
Most developers combine blueprints with some C++ or C#
They do make use of blueprints, not in the game's entirety
Tried roblox
You won't achieve with just blueprints what people achieve without them
Not sure what that has to do with the topic
I know a Youtuber that Is making a game Whit 0 knowledge in Bluerpinte
You can make games without them
As said, the game won't be the same quality
I tried programming in roblox
But you usually can’t do much complex stuff with only blueprints
And how did that go?
Try to make a proper multiplayer FPS game with blueprints only, good luck 
Not bad actually
Easy
Not at all
inb4 people actually start using scratch for discord lmfao
Roblox uses lua as its primary scripting language
Networking can't be handled by blueprints
Make your own discord bot in 5 minutes using blocks with no coding required. Try your bot online and export it on your computer or server.
So won't be multiplayer
Which is a language that is pretty easy to pick up quickly
Honestly, it's more complicated for me than writing a bot XD
Knowing that the base pack for FPS games uses A weapon and a character i only Need to do AI plugin/Character in Blender and a map
Again, multiplayer
I want to Try actually
Yeah that’s not the only thing that goes into making a game
Blueprints won't be able to handle network packets correctly
You basically just described how the art works
Idk how to make multiplayer
I actually love Cars more so i Was thinking about making a car game not an FPS Game
oh shit i said the forbidden word
mods pls have mercy
and pls dont write me a 2k char long dm
Same thing, you won't have the same tools available by just using blueprints
You didnt Say Multiplayer before i started writing
I did
He…did..
Message has not been edited, you said
Easy
the average discord user who cant read
Replying to the message that said it as well
pretty common in tech related servers
For example in BotGhost i maked my Own way to the finish of the command
Yeah i didnt read it
So there's no point on talking if you don't read imo
I think that the initial argument was about whether or not you can call yourself a developer by only knowing blueprints and botghost. The position I take on this is that you can call yourself whatever you want, but other people may or may not consider you a developer
You are rught
I wanted to know if i should make a Website for my bot in reality
thats like using copilot/chatgpt to write code and calling yourself a dev
And yes this one
I wouldn’t consider you a developer by only using the skills you described, but you can call it whatever you want
That’s just my personal opinion
And i have an answer
…if you want to?
Nothing is stopping you
And i respect it
Now i Just Need a web site Creator programm...
Well
Gotta search for it
It’s called HTML + CSS + JavaScript
It's java
It’s like the difference between car and carpet
They have the same word in them, but they are drastically different from one another
You can learn
You can try JavaScript for discord bot
Isn't It the same?
What?
There are plenty of tutorials and JS will also be useful for a website
🤔
JS is pretty easy, especially in comparison to the languages you just described
I seriusly know more of Jbeam and modding BeamNG than JavaScript
Just do what is in the discord.js guide and you have a bot, the rest you can write yourself using the acquired knowledge
Dude, JBeam isn’t even a language
It’s not even comparable to javascript
They do fundamentally different things

This is for like physics or some shit for an engine
it looks more like json than javascript
Probably not very useful in discord bots and websites 
It is quite literally based on JSON
BeamNG Is write in that leanguage l
BeamNG Is the most accurate Simulator that Someone can play
I’m telling you that javascript and Jbeam are not comparable because they are quite literally different things
I give up
I know you are trying to Say: Jbeam isn't a leanguage and so on
But the entire modding community of BeamNG can easily Say to you that It Is right...
But Is It still used for information and Automation mods
a whole community of flat earthers will say the earth is flat, doesn't mean it's true
or anything other than beamng
does anyone know why i am unable to save keynumber?
like, it always logs undefined outside the listener, eventhough keynumber is initialized globally.
while if logged in the listener it is actually defined for some fucking reason like tf
is the event supposed to be lowercase?
Result[0].key.key?
not really
{
key: {
id: 16948418,
name: 'ChittyKat - 345138133429649408',
key: 'x',
active: true,
admin: false,
type: 'anonymous',
share_type: 'all_subcalendars',
role: 'modify_from_same_link',
subcalendar_permissions: [],
require_password: false,
has_password: true,
creation_dt: '2023-03-20T01:46:47+00:00',
update_dt: null
}
} ```
so result[" key"].key
also logs me the right value, just outside the listener it's not working. Almost like the keynumber isn't saving
also forget that last snippet, i already removed the [0] from the code call
tbh, modifying variables from inside an async scope is never a good thing, tho I don't think that's the reason
hmm strange..
did u try debugging?
for some reason my vsc on mac is looking primal lmao
so ion know where to find it tbh
i am using the go debugger now
You'd usually just return a new Promise and resolve with the key and then use it when you need it
why is making discord embed my media so difficult
im trying to use meta tags on html but it just wont embed
Keep in mind that discord caches previous urls
so add a ?aaaaaa or anything else to the end that still goes to your wanted page to get a new uncached one
each time you want a different url tho, so ?a then ?aa and so on
PNG image files begin with an 8-byte signature which identifies the file as a PNG file and allows detection of common file transfer problems:
\211 P N G \r \n \032 \n(89 50 4E 47 0D 0A 1A 0A). That signature contains various newline characters to permit detecting unwarranted automated newline conversions, such as transferring the file using FTP with the ASCII transfer mode instead of the binary mode.[10]
Can this be faked and execute as a XSRF
as long as the library you're using isnt assuming that "Yup I hope this is correct im just dropping it into memory" you're good
because I have a backend server that allows image uploading and then display that saved image to frontend. But the files can contain virus and then execute the XSRF on frontend and I don't know how to prevent it
Does checking the signature of the first bytes is enough?
you can, if you want to go the extra mile, ensure that all the data matches the rfcs for an image/file/etc
though I really suggest having a library handle that
ensure that all the data matches the rfcs for an image/file/etc
I don't understand what you mean here, can you explain?
theres a common data format within the image itself, such as the length of the signature, length of options etc
you can ensure these are valid and discard the image if these are not
cant provide resources about that, dunno where to find em
ahh okok, I understand. I have googled it, I think it is called the magic numbers or smth
not magic numbers, one sec
such as this for png, unsure if this is uptodate or not http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html
okok, thank you a lot. I will take a look into it
One more question, what if I use the Content-Type header to check if the data is an image, what will happen if I send the Content Type with header image/png, but the data is something else?
Magic numbers is basically what you've written as first message
Usually called magic bytes though
Don't rely on headers to know what content type it is, it's as naive as checking the file extension after the dot
so is there a way to validate if the data is an image?
More than one check
wdym?
Edit the permissions for the files uploaded, check the MIME type, check the file extension, check the magic bytes, rename the files to random names, validate content type header, etc. etc. etc.
Also actually host uploaded files on a completely different server or service offering that
Website with the collection of all the cheat sheets of the project.
okok, thank you
Hey! If i wanna process members in chunks, is it better to fetch the guild members in a pagination format or to fetch all the members then split them into chunks?
If I understand correctly, fetching server members every time someone changes page doesn't seem like a very good idea
No not that, i have a loop that goes over a specific guild members, this guild has a huge number of members & i have to process them to check if they own a specific nft
If i just loop over them it takes so much memory and cpu usage so i am splitting them into chunks
My question is, is it better to fetch all the members and split into chunks after or fetch the members directly in chunks??
wasn't u going to take a reactive approach?
fetching will always load the members into memory, you can't avoid that
you can simply track from your database if you really want to check automatically on a schedule
Yeah still going too, but i still have to have a loop that atleast runs once a day that filter out bots / users that dont chat
Yeah i know that, but is fetching into chunks better for memory or no?
I got to a point my bot is doing much better during that loop, but still wanna optimize it to the max
fetching by itself is bad if ur going to do many times a day
Its once / twice a day
simply track from within your own db
Yeah but what if someone has the role thats he got manually but he never chats and never got in the db
if they got manually you won't be able to prevent them from getting again
at this point it's more about staff discipline than anything
True
iiiiiiii
iiii
hey guys i was wondering if i could get a little help with something because ive been trying to fix this issue for awhile now and havent been able to figure out what i did wrong
so during the night i was making a giveaway command for my bot. i got the creating the giveaway down pretty well but its the reroll command im having issues with ill do a test giveaway with one of my friends to react to it so theres more than one person then once the giveaway is over i attempt to reroll but it says "no one has participated in the giveaway" so its not registering that theres people in the giveaway and ive tried for hours and cant figure it out
You'd have to provide your code and possibly what database you're using
mysql is a db
ah, u mean for those specific commands
yes
well, if ur not using for those commands then u should, since u need to create a new giveaway in the db
ahhh i see
or if you want not to, you'll need a global variable of some kind to hold those who react
actually, just saw you're using reactions, don't you need to fetch the users who reacted?
im kinda new to this sort of stuff so maybe i do idk
yep, it has no cache property
nvm, it had a manager
oh well, what a messy structure
damn
so something like this?
const filter = (reaction, user) => reaction.emoji.name === '🎉' && !user.bot;
message.awaitReactions({ filter, max: winners, time: 15_000})
.then (collected => console.log(`Collected ${collected.size} reactions`))
.catch(console.error);```
yes, not necessarily the example shown there
inside .then see if it logs the users who reacted
Show your code
You never defined collector
also the awaitReactions need to be inside the collector, not outside
Also I guess awaitReactions should be assigned to sentMessage, not message
that too
Yes
Hey I want to ask that does presence_count counting people who are online but they are in invisable status or it just count online + dnd + idle?
I am confusing about this so much :))
You mean this?
Or this?
hey guys i wrote this piece of assembly code here
READ [i], R1 # R1 := i
READ [j], R2 # R2 := j
READ [k], R3 # R3 := k
CMPF R1, R2 # R1 - R2 (TO CHECK)
JUMP.LE else # if I <= j, jump to else
if: MOVE R1, R3 # k = 1
JUMP endif
else: MOVE R2, R3 # k = j
endif: WRITE R3, [k]
HALT
i: .DATA 7
j: .DATA 12
k: .DATA 0
``` does anyone know where i can assembly this into machine code and actually execute it?
idk how to setup it for offline compilation tho
well I think I mean both :)))
json parsing blocks the main thread in nodejs if im not mistaken, correct? If so is there any module (thats not irrelevant) that does that either in a streamed or in an async way?
Well, "Invisible" is probably not considered online then
it blocks the only thread yeah
you can put it inside a promise to prevent blocking
it's inside an async block
it doesn't matter if the operation is sync (everything is sync - they're just wrapped in async blocks)
change perf?
I have no clue why I just wrote that, whether an actual async parse would run better, generally
an actual async json is impossible
what da heck is that horror
async is simply "something that might return a result in a near future", so the runtime simply continues its path without waiting for the result
that function will simply allow the code continue before it finishes parsing the json, but it holds little value if ur going to await it anyway
ah, now it makes sense, so await basically turns something async into something sync (pure technically, not actually)
await tells the runtime to wait for the result
yes
so something like the render function from the ejs package would not benefit from running as async if in an async enviroment anyway, right?
yes ig
does anyone know how we can transform such hexadecimals to bin v
0x8000 012f
i tried searching it up online, however i only found easy examples and no 0x... things
Converting a hex string to a binary string? What language?
Hex is just like binary, but with powers of 16 instead of powers of 2
Usually I would convert the hex number to decimal then the decimal number to binary
First place is the 1s place, second place is the 16s place, third place is the 16^2s place, fourth is the 16^3s place, etc
Just as note, 0x is the prefix and has no other use than to show it's a hexadecimal number
Same for binary numbers who often use 1011b for example
The b itself is just to show it's a binary number, nothing else
in some langs it's 0b1011
Yeah that as well
owh wow this is pretty easy actually
so each char in the string can be seen as a 4 bit code?
0x8000 01af
f = 1111
0 = 0000 etc
1000 0000 0000 0000 0000 0001 1010 1111 this would be the result right
what the fuck is that
That's how it works, just like the decimal system
154 decimal is
4*10^0 etc.
i rather just wanted like a bistring from a hexa string
i denoted it wrong in my question
But yeah that's correct
but i think that i got it now, thanks for all the help
one last question about loadhi, sorry for so much crap i been asking but i've got a test to learn for and they didn't give us the right answers lmao.
1000 0000 0000 0000 0000 000110101111
10-00 0000 0000 0000 0000 00*01- 1010* 1111
.LOADHI 1, R10
.ADD 175, R10
would this be a correct translation?
if we have this format
like, the 1 is the 22 bit constant within the - -
and the ** the 10 bit constant (as loadhi is c22 + c10 )
Yea
Try it and see
You can use displayAvatarURL() too

