#development
1 messages Β· Page 22 of 1
Oooo fun
Most sane C++ discord server member
I can finallyy make my calculator say Boob
And yes, that is a hand written view of the memory layout on there
π
nice
(Not mine, someone in the C++ server)
8008135 is where it's at
lmao
that picture triggers my ptsd from my microcontrollers class
writing instructions on a piece of paper π
This whole code will print βhello worldβ at the end
no but seriously thats a lot of dedication
dude can anyone check my site out
cause the css doesn't appear to load sometimes
it should look like this
it looks like this for some reason most of the time though
How are you loading your css
using some other website's CSS
should I make my own server for that?
then you have to depend on it registering before your site renders fully
how can I fix that? will trying to access it with a post request work?
I mean if I create my own get request func
how do I read file with FS?
doesn't work
forgot how to do that lol
is that not right?
ok managed to get it working, css doesn't load tho
ok
so
why are you using fs if you are using express
express already has a way to render files
it does...?
ok.. why does the CSS doesn't work though
I already did
it told me to use the function I am using now
it doesn't work
WEll first of all
you are doing it wrong
as you can already see from looking at literallyy the first example
express.static doesn't TELL it to use that file
it serves it
oh my b
at an endpoint
I'll do it rn
root
-public
--css
---styles.css
--js
---something.js
--view
---index.html
so then you do
app.use(express.static('public'))
and then you can freely use anything from the public folder in your html files
so yyou can do
<html>
<head>
<link ref="stylesheet" src="/css/styles.css" />
</head>
</html>
or however you do link tags for stylesheets
yeah ik
and then in your express app you can do
app.get('/', (req, res) => {
res.sendFile('index.html')
})
or smth
classic disk abuse reading from it every time a request is sent π
Again, I haven't used express since 2018 though
so my memory about it is fuzzy
but that should be close to what you wanna do to serve a file
A fast, refined, and cleanly written all multi-purpose discord bot.
can you guys see the CSS?
mistyMemory* misty = new mistyMemory();
yea I can
great tysm
Personally I dislike using express on its own
but for your use case it is perfectly fine
I'm planning to make a dashboard pretty soon
anything I should know about?
0_0
oh yeah I planned to have a per-server dashboard type thing where they can access the same settings u can see in the -settings command
and a bunch of other info
as well as a command list
that going to be hard?
Thats how a typical dashboard is
If you read the docs
you will have virtually no issues
I will
no cap
I am unsure if he is talking about what you said
or me

Waffle sucks at backend ;)

backend for my old api literally allows sql injection because I'm not filtering any user input
xd
If that day comes I will gladly do so
gotta support my friends
But I won't use a eso lang
I hope to one day work on rust
Go for it
rustc kinda based
Or make a name for yourself elsewhere
what's the point of using ''?
wdym
Wdym
Depends on what context you're talking about
Single quotes in the majority of languages are for single characters
just casually, both seem to work the same
Whereas double quotes usually indicate a string in most languages
In js they both have the same meaning
But in 99% of statically typed languages that symbolize different things
so it's just up to prefrence?
ic
good to know
i always use ''
a lot of other languages do what waffle said
wonder why people switched from using '' to ""
until react forced me to use "
If you try and do 'Hello, World' in C#
all newer js scripts use ""
it cries
Because double quotes is traditionally for strings, people inherited that idea from other c-style languages
whereas older ones, mainly web based use ''
ima just only use backticks
Same
same
(To what misty said)
I only use `` when I need to display a variable in the string
I have prettier to rewrite " to '
same
As you should
back ticks are not useful other wise
so it is confusing for those who do it for literally everything
yea
When I see backticks I expect string templating
also sometimes use it when I want my text on more lines
like this for example
without using the \n escape
guys what?
There was a problem with your request.
Invalid Form Body
message_reference: Unknown message
if (message.channel.nsfw === false && fetchResult.data.Media.isAdult) {
return message.reply({
content: `It appears that the anime you requested is an adult anime!\nTo view the information you can try executing the same query, but in a NSFW tagged channel.`
});
}
what's wrong?
I am curious if that is even coming from that line specifically
message_reference is the message you're replying to
ah right
And by reply, I mean like this type of reply ^
If the message was ephemeral or deleted it won't work no?
oh so he deleted the message right after sending?
too fast for the reply to even register?

`i use backticks to escape "`
i'm sorry misty
π
jk i do that now
ima use linq on you
I just started
not too long ago
so
The first time I actually sat down and used C# was a few weeks ago when working on a game in unity
well he just used it to execute the command
so I'm trying to reply to it 
OH WAIT
you mean that cursory
Yea
I didn't like the look of it
and stayed away

I also have a repellent for you
what is it
namespace TestSomething
{
class Program
{
public static void Main(string[] args)
{
int[] scores = { 97, 92, 81, 60 };
IEnumerable<int> scoreQuery =
from score in scores
where score > 80
select score;
foreach (int i in scoreQuery)
{
Console.WriteLine(i + " ");
}
}
}
}
Okay
but
wtf is this
This looks weird
@wheat mesa I might be turning into a graphql lover oh no
I can't argue with the points they are making tbh
linq slow
Graphql is honestly starting to look more favorable than a rest api
a rest api is rather "bloated" for a lot of the use cases I use now a days
is there a way to do this without causing any max stack errors?
async function foo() {
//await do something
foo()
}
smells like bad code
what's your actual code you're using
you can probably refactor it
worker() {
if (this.x === this.dX && this.y === this.dY) {
this.path.push([this.x, this.y]);
this.ghost.changePath(this.path);
}
const validDirections = [...config.directions].filter((a) => !this.isBlocked(a) && ![this.lookingAt, config.opposites[this.lookingAt]].includes(a));
if (validDirections.length && Math.random() < 0.5) {
this.path.push([this.x, this.y]);
this.lookingAt = validDirections[Math.floor(Math.random() * validDirections.length)];
} else if (!validDirections.length && this.isBlocked(this.lookingAt)) {
this.path.push([this.x, this.y]);
this.lookingAt = config.opposites[this.lookingAt];
}
if (this.lookingAt === "w" && !this.isBlocked(this.lookingAt)) {
this.y = this.y - 0.5 * this.speed;
} else if (this.lookingAt === "a" && !this.isBlocked(this.lookingAt)) {
this.x = this.x - 0.5 * this.speed;
} else if (this.lookingAt === "s" && !this.isBlocked(this.lookingAt)) {
this.y = this.y + 0.5 * this.speed;
} else if (this.lookingAt === "d" && !this.isBlocked(this.lookingAt)) {
this.x = this.x + 0.5 * this.speed;
}
if (!this.done) this.worker();
}
well i had a condition on that the last time I did it
it was throwing an error so i scrapped it
assuming it's a javascript worker (from the context of the code) it's actually not that bad
you can refactor that loop to a while(true)
recursive functions are expensive hence why they have a limit and error out at a certain point
what you can do is the while(true) approach, break out of it if this.done is true
how do you make it to were a search command can only happen if certain amount of credits
for economy bot
you can probably further optimize this with requestAnimationFrame if in browser context, but i wouldn't know from that snippet alone
before executing any code make sure they have the right amount of credits and do whatever after
if they don't have the right amount of credits tell em that
I told you exactly how to do it though...
write just that one part down
you won't get spoonfed here, here's some pseudo to help you out though
fetch user credits, store in a variable
if user credits < x amount
return
// rest of code execution
okie
function recursive(...args)
if (break_condition)
return;
// body
return recursive(...args);
}
you need at least one break condition and ensure that it gets hit before the max stack error does
I already added it, it still max stacks if it goes for long
Does it need to run forever? Because if so, then you should be doing event based instead of potentially on the same tick
it stops after a condition is met
How many steps does the fn take
can you show your code? Because you may be doing something horribly wrong and your exit condition is never met
the maximum call stack size is 11034 by default. If you ABSOLUTELY need to take ALL of the steps, then you can either use setImmediate so that node can clear the stack and call your function on the next tick or increase the stack size
increasing the stack size isn't recommended though
hey, is there any way i could do this?
I was thinking of, checking if one of the voice channels has bot 1, and make bot 2 check that. If it is occupied, bot2 will join. If bot 2 is occupied, bot 3 will join and so on.
you now that i am not talking about the image but the text lol
I mean
sure you can also do that
Just have the bots constantly observing the VoiceStateUpdate event or whatever its called
If a user joins a vc, and the bot joins after, you know that channel is already occupied by a bot
so if someone joins another vc make the other one in line join
Yeah i could also do that, but it's less secure as idk there might be another music bot in that channel that isn't ours
it's rather more secure to strictly check the ids of the bots
you can look for members that are currently in the vc and check if your bot is in there
yeah that's what i am doing!
then yeah it's done
Awesome, thank you!
you guys dont sleep?
const row1 = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId(`${ids}link`)
.setLabel('Jump to Giveaway')
.setStyle('LINK'),
);```how would i actually set a link?
it's 1 pm in the netherlanmds
hit Ctrl + Space in your editor
assume that it's VSC
OH WAIT
i forgot
sorry
wa
it should have a url field
wahahah alrightt
do a setUrl
.setUrl
or sth
i see, thank you!
also if it's not post addition you can do a ```js
new MessageButton({
customId: ${ids} link,
label: 'Jump to Giveaway',
style: 'LINK',
url: giveawayURL
});
looks cleaner
u dont need customId if ur button is a link
for button events
you'll get an error that a custom id and url cannot both be specified
Imagine using builders
how do i set a button label to a custom emoji
this is the embedemoji:
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId({ids})
.setLabel(`${configuration["starter"].embedemoji}`)
.setStyle('SUCCESS'),
);```and how i've set it
You're supposed to use the setEmoji() method to set a custom emoji
What is the fastest way to read a single item from a large array. I need something to handle 365,397.911765 reads per second
do you know the item index?
yep
then array[index]
that is too slow
left is array reads, right is miliseconds from first read
is an object acting like an array gonna be faster?
no
Arrays are objects with indexes as keys and elements as values, so it's not gonna change anything
will a smaller array be much faster?
Love you
Love you too :)
is pathImageData[x + y * gameCanvas.width] going to be better than a 2d/3d array? isnt multiplication a resource intensive task?
Not really, accessing a specific array element with an index does not really depend on the size of the array as it knows where to exactly access in due time, so you can't get any faster than that
math will always be faster than object access
this is going to be tough
maybe i need to find a way to decrease array reads. thanks though
for( let i = 0; i < interaction.options.getNumber('winners'); i++){
userid = database1[ids].users[Math.floor(Math.random()*database1[ids].users.length)];
user = interaction.guild.members.cache.get(userid)
console.log(user)
const embed7 = new MessageEmbed()
.setColor(configuration["starter"].embedcolor)
.setTitle(`Prize: ${interaction.options.getString('giveaway-prize')}`)
.addField(`Host:`, `${interaction.member}`)
.setDescription(`You have won the giveaway of **${interaction.options.getString('giveaway-prize')}**! Congratulations!`)
.setTimestamp()
.setFooter({text: `Total winners: ${interaction.options.getNumber('winners').toString()}`})
user.send({embeds: [embed7]})
winners += `${user}, `
}```how would i actually make this for loop only pick new members? So basically, it runs till the winners number is reached, but it runs till new people are drawn as well (so a winner can't win twice)
I thought about checking the winners string to see if user is in there
You can initialize a set, when the winner is drawn; add their ID to the said set, on the next draw check if the ID of the user exists in that set, if it exists then redraw, otherwise draw that user as the winner
hmmm so:```js
if(set.has(userid)){
userid = database1[ids].users[Math.floor(Math.random()*database1[ids].users.length)];
}```
Yes
how would i later on clear the set complete?
You can call the clear() method on the set
omg you are the best voltrex!
While you are running warm with answering questions, might i ask you another thing?
Sure
if(interaction.options.getRole('required-role') !== null){
maka1 = interaction.options.getRole('required-role')
k3 = interaction.options.getRole('required-role').id
}else{
k3 = 'No required role set!'
maka1 = 'No required role set!'
}
if(interaction.options.getRole('bypass-role') !== null){
k1 = interaction.options.getRole('bypass-role').id
maka2 = interaction.options.getRole('bypass-role')
}else{
k1 = 'No bypass role set!'
maka2 = 'No bypass role set!'
}
if(interaction.options.getRole('blacklist-role') !== null){
k2 = interaction.options.getRole('blacklist-role').id
maka3 = interaction.options.getRole('blacklist-role')
}else{
k2 = 'No blacklist role set!'
maka3 = 'No blacklist role set!'
}```i have this system implemented in my code
const embed = new MessageEmbed()
.setColor(configuration["starter"].embedcolor)
.setTitle(`${interaction.options.getString('giveaway-prize')}`)
.setDescription(configuration["starter"].embeddescription)
.addField(`Duration:`, `${k4}`)
.addField(`Host:`, `${interaction.member}`)
.addField(`Required role:`, `${maka1}`)
.addField(`Bypass role:`, `${maka2}`)
.addField(`blacklist role:`, `${maka3}`)
.setTimestamp()
.setFooter({text: `Total winners: ${interaction.options.getNumber('winners').toString()}`})```for this embed. Is there any way to instead of saying 'No required role set!', to just remove that field completely?
I know i could define the embed globally and set the embed in each if statement, but that means that i will have to create 9 options (3 roles, false or true = 3^2). That's why i am asking if there's a better and easier approach
i had reduced the array reads from 365,397 to 160,233 reads per second. someone congratulate me please

ln 118: await has no effect on Discord.Collection.get()
ln 118: var channel is not in channel cache collection (guildCh.channels.cache)
show the output for console.log(channel) from your line 114
what is k1|2|3 and maka1|2|3 anyway
i don't know what your code is tryna do
All console output []
@earnest phoenix btw line 118
Collection.get does not return a Promise
consider removing the await expression
Using if statements to set them accordingly is the best approach for that, for example:
const embed = new EmbedBuilder()
.setColor(0x0033ff);
if (roles.length !== 0)
embed.addFields([
{
name: 'Roles',
value: roles.join(', '),
inline: false
}
]);
// And so on...
(The addField() method is removed in discord.js v14)
I already did it, thanks for helping me again voltrex!
I used cases actually
just cuz i liked the way they were stacked
const date = new Date();
const numOfHours = 2.5
date.setTime(date.getTime() + numOfHours * 60 * 60 * 1000);
console.log(date)```how do i encode this in the discord's unix way? so ``<t:unix:R> (<t:unix>)``
You can just let the formatters bundled with discord.js handle that for you
date.getTime i think right?
const date = new Date();
console.log(date.getTime())
const numOfHours = 2.5
date.setTime(date.getTime() + numOfHours * 60 * 60 * 1000);
// ποΈ Tue Mar 15 2022 09:25:30
console.log(date.getTime())```
i see
import { time } from 'discord.js';
...
const date = ...;
console.log(time(date, 'R')); // <t:<TIME>:R>
oh
You need to get the time function from the Formatters class if you're still using v13
.addField(`Ends:`, `${k4} <t:${newtime}:R> (<t:${newtime}>)`)```i tried doing this but it ain't working lol
I am indeed using the v13
Then you can do
import { Formatters } from 'discord.js';
const { time } = Formatters;
...
const date = ...;
console.log(time(date, 'R'));
could i instead require it?
If you're using CJS instead of ESM, you can get it like this:
const { Formatters: { time } } = require('discord.js');
Show how you're using it
.addField(`Ends:`, `${k4} ${time(newtime, 'R')}`)```
const { Formatters: { time } } = require('discord.js');```
What's the value of the newtime variable?
19804308079657
You're supposed to pass the date instance in, in this case
So I can't pass a timestamp?
Can you show us more of the code?
when you don't have intellisense
const date = new Date();
const numOfHours = Number(numba)
date.setTime(date.getTime() + numOfHours * 60 * 60 * 1000);
let newtime = date.getTime()
console.log(time(newtime, 'R'))```this is how i am getting the newtime
instead of getTime() should i just pass date?
it should have worked
You can just pass in the date variable to the method, but I think the timestamp in your case is invalid
Yeah your timestamp is messed up 
it can't
look, numba in this function is 5100000ms
How the fuck does it return 500 years
ooowh woow
i am multiplying the ms by 60* 60 *1000
Yeah
Giveaway to get some bitches (in 500 years)
wahahahhaha
wait so we now have the R type set
insn't there a t type as well?
<t:unix:R> (<t:unix>)```
So it would look like this
time(newtime, 't'))``` would this be the new one then?
voltrex, i would totally kiss you on the cheeks but i unfortunately have a girlfriend.
All jokes aside, thank you for helping me
arent discord timestamps in seconds?
Yeah
i am using ms and it works tho?
yeah that's the point
for( let i = 0; i < interaction.options.getNumber('winners'); i++){
userid = database1[ids].users[Math.floor(Math.random()*database1[ids].users.length)];
if(talkedrecently.has(userid)){
userid = database1[ids].users[Math.floor(Math.random()*database1[ids].users.length)];
}
talkedrecently.add(userid)```one last issue before i fuck off, it keeps on drawing the same winners
unix timestamp is in ms
Well passing it in seconds if you're passing in the number directly instead of the date, if you pass a date it'll convert it to seconds
https://github.com/discordjs/discord.js/blob/main/packages/builders/src/messages/formatters.ts#L267-L302
You gotta keep redrawing the winners until they're not present in the set
userId = // Draw winner
while (talkedRecently.has(userId))
userId = // Draw winner
talkedRecently.add(userId);
Although this can be pretty inefficient if it keeps landing on the same winner repeatedly, an efficient way to do this would be creating a copy of the users array, delete the user from the said array when picked as winner, then when redrawing it won't pick that user anymore as it's deleted from the array
unix is seconds yes
just multiply by 1000 then
divide
for ms
ah ok


just do both
unix * 1000 / 1000?
lmao
how would i get commands to execute from aliases using a commands handler?
is it any different from setting the normal command
im guessing its not but idk
have a map of aliases
are them going to be hardcoded or dynamic?
what do you mean? there is just a list of like three on each command file
hardcoded means it's defined on the code
dynamic means it's defined during runtime
how would it be dynamic though is what im not understanding?
can i get it to predict my bad spelling?
lol
user uses !alias command cmd
command now can be used as !command or !cmd
only if u use fuzzy searching
It would by dynamic if people would be able to edit the aliases in their servers for example
that would be nice
inb4, don't use fuzzy search for commands
but that would just be added complexity

Thats the point brother.
I mean, every convenience feature u add is additional complexity
i would just use fs to edit the line in the command file but thats a bit too much of a redneck solution for my liking
that would be simple
no, that'd be catastrophic
you have to use a database if u want to go dynamic
Not really
could get away with json if i had a file for each command though
How would you manage two guilds defining different aliases then? 
file-based settings are always the worst possible option if u plan on editing it all the time
global
i mean the context is this bot is on like 3 servers so
eh
not tooooo much of an issue
always consider ur bot is in 100 servers
eh
don't think small because you'll have concurrency/personalization issues later on
your code has to be prepared for all range of usage
my bot has a command that streams the music from the servers cd player idk how id make that work over 100+ servers
that's how u find bottlenecks
*adds 100 cd drives to the host server*
What do you mean? As long as it has perms
performance
and memory usage
How are you streaming the music?
didnt think of that but its funny having my the cd drive spin up at 1am
wait, ur using physical cds?
just streaming the sound from alsamixer to discord
lmao what
Thats incredible
the only music bot that streams live music, as in, really really live
ok ok lemme back up a bit, the server is old and i had an old cd drive, it can work independantly of the pc as its got a headphone jack on the front
so i use child prosses to run play and stop commands
i then capture the audeo internally using the internal cd audeo cable that is basically line in
the cd after nonstop streaming for 1 week
i then route that audio over discord
Back in times when streaming meant to invite your friends to your home to watch something on this:
also i have it so that i can use child prosses to set the input from the cd drive to the line in jack which is connected to a tape player
i got pics some where
ill see if i can find them
So you play tapes and cd's?
yeah the cd is fully controlable but the tape player has to be started manually so i only listen to that when in in a vc with my friends
this is the old setup
the cd drive wouldnt fit in that case
so i dug out another even older case and used that
which is this
pls dont zoom in theres alot of redneck shit in there
xD
like the fan cooling the pci ssd held on by popsicle sticks jammed in the pci slot below
I mean, if it works
looks like art from dali 
cant u just export the cd to a file and stream that?
wheres the fun in that
also i did this after i couldnt get streaming from yt to work
how this worked and the yt thing didnt idk
also this is the tape player
using the old server
When looking at your pictures I wonder howβs that fun 
coomber
Wow⦠and people called Tim and me old
bruh i like my tapes
went on a trip with my mates camping and we found a cool small shop that sold second hand records and tapes
got like 5 for 50p each
The mess in that picture and the 30 years old PC is killing me
bruh you shoulda seen my main pc 4 years ago
shit keped breaking on it and i just stoped bothering to put it back together after a while
and it kinda degraded after that
got a pic some where
Somehow doesnβt change the fact it could at least be a little bit organized 
there we go
organisation? never heard of her
Physical pain
hahaha
also thats the same case the server is in now
spray painted it black with a dollar store rattle can
looks crap inperson but better than nothing
Hmm looks like common PC hardware to me
?
Anyways../
lol
amazing...
Clean up your room, throw that thing out, buy a disk man, stream from it
bruh my setup is pretty clean now
idk what ill do when i upgrade my server whough since anything new wont have an internat cd audeo connecter
firenado, the IT cowboy redneck from texas
lel
crt
you're almost growing an arm out of ur chest
Oh my
and no crt shield
the radiation too
i mean its not that bad i dont sit here the entire day
and I usually only have the botom one on cuz i dont need all 4 screens going
the side one is connected to the server but can be switched over to the pc aswell
How does Discord fetch members/channels for a server when swapping between servers? I assume lots of work is in cache.
that's pretty much it I guess, since I usually see avatars and sometimes user names being like... days/weeks old
Assets like images make sense, but like when I swap say to this server, I don't see any member/channel request to load in those things.
And to do so would be so expensive each time so I was curious how Discord handled that.
The official client is like any other bot, just with a gui. They have some lazy loading practices when it comes down to member lists, but you can operate with just data sent from GUILD_CREATE and fetching channel messages since member and user Objects are attached to message Objects
last_message_id is used as well since the clients can persistent cache channel message history and have it either be marked as stale or not depending on the last_message_id
Curious.
But if I were to kill the client, start it up and monitor the request I won't see any channels request, right? So where is their persistent storage at.
idk where on disk. All I know is it's cached somewhere. Also, channels are sent on GUILD_CREATE
That's an interesting concept that it'd be like a bot with a gui.
Where did you learn this? Or just a good educated guess?
user accounts aren't too terribly different from bot accounts, just more privileged access
That I understand more.
A mix of educated guesses as well as watching the network tab for inspector when I was bored. I'm also slightly forced to know my way around the Discord API and I believe I could replicate the behavior of the official clients quite well if it weren't for my shitty front end skills

The only reason I'm investigating it is that Guilded has the horrible issue of gettings members and CHANNELS every single time you swap to a different server.
Ever seen a 1.5MB member file load before? Yeesh
guilded is omega lol garbage
interesting concept, but that's about it
competition to Discord would be healthy
Yeah exactly. So I'm hoping they figure it out.
is there anyway to have 2 wide inline fields instead of 3? i wanna have a sort of 2x2 grid of fields in an embed
nah
You can make the first two fields inline and not the third one, but you can't inline the one succeeding that one since it'll be put on its own line
So at best you could have 2, 1, 2, 1, 2, etc.
Guilded doesn't seem to be competing with Discord in the same way that Discord isn't competing with Slack.
yes and no there's a way to push an empty field title and value (with a few spaces) as third column, but that wont work on mobile and wont expand the two other columns
but it somehow works
yeah thats what im about to test out rn
like that
but it will reduce the other 2 columns on the next line to the max length
of above
bruh there are clients out there that let you log on to a discord bot and use it as a normal user
most of them where cilled off due to privlaged intents but eh
anyone knows why there's no overflow?
i am using grid
with flex it works but is not responsive
in the grid
the slots you know?
if i remove the display none the scrollbar appears but don't let me scroll
there are 50 squares
only 25 are there
you can use overflow-y: auto
then it automatically becomes scrollable
if you are worry about the scrollbar, just set the scrollbar width to 0
or you can set it absolute in relative parent container with right 0, width 10 and height 100%
it doesn't let me scroll
why tho
it's not the same problem of the other day, i can't actually scroll
idk
its the grid
if the child overflows on an overflow-y-auto parent the parent is scrollable
you should only limit the column to 5
ohhh i see
you limit the row number to 5, hence it only renders 5 rows
the columns are the problem
yeah
let me try
nope it doesn't work
even
if
i repeat 10 times
that looks like a fivem inventory lmao
and it is
wow
i think you should only limit the column and set the child element to have 1/1 aspect ratio
i'm dumb on grid api
its my first time using grid
how can i do that?
@lyric mountain, got a question for you. π
Java question π
Yes.
ayo
think about it
I'll need to give a backstory, gonna take a while.
sadly i haven't touch grids for now
:( thanks anyway
Alright, long story short, I'm currently making a 2D game as a project to learn Java, and I'm currently making a map. However, in order to make a map, supposedly, I can create a map using a .txt file and give each block an ID. Supposedly:
https://cdn.hamoodihajjiri.com/geoWx9J0dR
This is a 16x12 map whereas 0 is a dirt block, 1 is a water block, 2 is a tree, etc. As I come to create more blocks, I've noticed that when it comes to reaching an ID of 10, you notice how it makes the line longer and I've noticed how it can confuse other developers when making a map. So I'm like, alright, why not start IDs with 10, but I also cannot leave 0 to 9, if that made sense.
well, u could use the entire ascii table
^
What?
Iβd just encode it as one byte each
\uFFFF is probably enough for all your use-cases
That way nobody can get confused
one byte would be up to 255 different ids (256 if u include 0)
2 bytes would be 65535 different ids (65536 with 0)
How would that work? I still didn't understand.
A character is technically a number, just use the integer value of the characters instead of just printing numbers
like F0 would become char \u00F0
Yes, but I'm confused on how I'm supposed to be turning this into what you're tell me: https://cdn.hamoodihajjiri.com/CueDD593Ll .
Aka char someCharStoringNumber = (char)5
(char) thenumber
(Do you even need the cast, idk)
u do
actually
if ur storing in a char variable u dont
but if u do stuff like println(thenumber) it'll print the actual number
Speaking of Java Iβm actually writing some right now for CS class lol
I still don't know what I'm exactly supposed to do, I'm confused.
like, is the map supposed to be viewed as a grid in terminal?
or will the grid be used somewhere else?
No, the map is like numbers, the code loops through them so it can display the tiles.
...
I didn't make sense, fair enough.
so are the ids being viewed as-is or are they used somewhere else?
They're being used.
so they're a 2d map?
Yes.
You know, something simple like this: https://cdn.hamoodihajjiri.com/umjpfoNsxY .
simply use a normal array
Each tile is the actual ID.
No, I'm just using tile id, tile name, and collision.
byte gridWidth = something;
byte[] mapData = ...the array;
for (int y = 0; y < mapData / gridWidth; y++) {
for (int x = gridWidth * y; x < gridWidth * (y + 1) && x < gridWidth; x++) {
byte id = mapData[x];
// do something with id
}
}
I'd go an extra length and make a wrapper for that
hm, wait
the x loop has the wrong condition
well anyway, u can figure that out
nvm, already did
For sure.
anyone has any command ideas? :]
is this java?
yes
looks like it
?
discord.js?
yes
I think there is a editReply function, also check if it errors, if it does followUp instead
that will mean that the user removed their ephermal message
its no done
i send interaction by followUp
and after that i can't do edit reply
It's hard to edit a ephemeral message
The point of Ephemeral messages are so only the user sees them
u have to reply first, then edit reply and if that errors follow up
ig
let's try
webhook edit
I don't have any command ideas
make sure to catch errors there as it can be gone already
so, the problem was that i need to set the height to each slot now is scrollable
hmm
maybe just do this:
send the ephermal message, once user picks delete it instead and edit ur main embed
should be easier to do
pog
your follow up message has a webhook ID property, use this to edit the webhook (response)
ooof should I use this for my dashboard?
https://github.com/LachlanDev/Discord-BOT-Dashboard-V2
it actually looks pretty good
this is any c-like language tbh
umm trying
why does every dashboard is integrated into the bot itself
do people not separate the two?
it seems like hell to manage
this thing just shows a few stats, that's all
it's only hell to manage if u don't have a proper project structure
nothing you can't do yourself in a few hours
like keeping everything in the same folder
from scratch
it's simple
your bot works as a backend server already
so serving up some stats is not a big deal
it's not like you are sharding from multiple instances and report stats to a central server anyway
na my problem is usage, it would prolly jump high af if i integrated a website into my main bot struct
I do shard
although I have only 1 atm
not your bot
then just store your stats in a database which you query on your dashboard site
the application instance is a level lower
it contains both your bot and stat process
or you can take advantage of child process and pass messages around as json and text
that works too
nothing works best than from original source
You tell topgg ur bot stats
but for uptime it's impossible
who would bother do a ws connection to your bot for uptime π
I'll ask them if they have an endpoint for that
they do like if the uptime is below 60% they remove ur bot
my gosh
then just store your stats in a database which you query on your dashboard site
lucky my bot is 99.7% up 
nah
too lazy to make a whole ahh db for that
how come my bot is still on the site then
π
idk 
?!
it's easier
so sending requests to the topgg api is easier for you than creating a table in your database you're pushing your metrics to?
yes
once again... I have no words
that would be a costly operation
the only thing does that is discord api endpoint
it has a heartbeat field
alr
What even is going on
i don't know
Donβt get into it
what's this bs about bot uptime
I have been glancing over at chat
seems like it's a lil broken for ur bot
and I am deeply confused
it's not broken
Like always
it's right
I am only ever confused when it involves this guy
Rrrrrr donβt make me horny bitch
i somewhat regret this
Ayo wtf
but considering the goal then, it's not to be ashamed of
Calm down old man im underage

π€£
TF?
Letβs hope my nsa agent was afk
Might I ask what you are even trying to accomplish
Not me casually stalking the channels
uptime verification
dashboard
He wants to report his stats to topgg to send requests to the api to get the metrics back
You're hoping for too much
top.gg only gives back basic information
as far as I know at least
good enough for me
basic as in
the only thing you will find useful is the ID
which you should already be able to get
Too complicated
we talking ot the most complicated person ever
He expects to do oauth without reading the docs

Mongo must be one for the most easiest db out there, no?
This is no hate to Bae
key-value database
but like he refuses to read docs half the time
But ya'll should know I'm stalking ya'll
and wants us to give him every answer
nah you know too little about us
bae used confusion
it's very effective
Well, seeing u have the css-jail role, means u do cursed "art" with css
no
"cursed" is an understatement
Not only that but also likes to make things far more complicated than needed
man when spoonfeed but is quirky
"art"
hhhh
I fucking told you it was π§’
sayuri just created an entire game intro with nothing more than css and sheer weebiness
:O
Nobody taking your words seriously dingus
Didn't sayuri create a "windows" environment in css and html
tf?
or did you never go through with that sayuri
I-
yeah
but the thing is
i assigned them to actual processes
Canβt be worse than w11
π

my plan is to replicate the environment of an os
Windows 11 is an abomination
Only good thing it does is possibly make your games run faster
at the proper bios settings
so each processes may have multiple windows
Guess I'm not welcome here anymore then D:
SayOS
like Windows96
dw my laptop uses w11 too
man when spoonfeed but is quirky
but less reliable and ease of use
But worse
you already said this
Much worse
Should I be using IntelliJ for Javascript (like discord bot coding, or something)? 
discord client resent msg when i reconnected
Webstorm
I don't see why you cant
but
webstorm go
No stick to nodepad++ and try the hard way
it's more suited
there is a dedicated IDE already in the jetbrains suite
Webstorm would be better for js, html,css and py
Webstorm?
as this point just use nano ig
Lemme check that.
Ah
it's tailored for js and ts and web in general
But but but syntax highlighting
nah we don't need that
Fair enough, was going to ask why that.
Technically every IDE can do every language except .Net
well there are always scuffed plugins to support py
.Net has its own dedicated IDE
Also, when should I use VSC? 
Never
You like fully hardcode coding
general-purpose editing
Eh, alright.
When your pc can't handle webstorm xD
yupp

Or
go open source for 3 months and keep updating it every now and then
or get the github student pack
Oh, I have that. Hold on.
me when student liscense
https://butler.scarlex.org/ how do I make space between the buttons again?
A fast, refined, and cleanly written all multi-purpose discord bot.
padding
man forgot gaps in css flexboxes
to move the dashboard button from the support server button
just use a flexbox
what's that 0_0


