#development

1 messages Β· Page 22 of 1

proven escarp
#

wtf

sharp geyser
#

Oooo fun

wheat mesa
#

Most sane C++ discord server member

sharp geyser
#

I can finallyy make my calculator say Boob

wheat mesa
#

And yes, that is a hand written view of the memory layout on there

sharp geyser
#

😎

quartz kindle
#

nice

wheat mesa
#

(Not mine, someone in the C++ server)

civic scroll
#

he even wrote instruction addresses

#

πŸ’€

wheat mesa
#

Yeah lmfao

#

This dude printed out a whole ass binder of the TI-83 system routines too

lyric mountain
sharp geyser
#

lmao

vivid fulcrum
#

that picture triggers my ptsd from my microcontrollers class

#

writing instructions on a piece of paper πŸ’€

karmic thistle
#

HG_Seff_LMAO no but seriously thats a lot of dedication

ancient nova
#

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

sharp geyser
#

How are you loading your css

ancient nova
#

should I make my own server for that?

sharp geyser
#

then you have to depend on it registering before your site renders fully

ancient nova
#

I mean if I create my own get request func

#

how do I read file with FS?

sharp geyser
#

google

ancient nova
#

doesn't work

#

forgot how to do that lol

#

is that not right?

#

ok managed to get it working, css doesn't load tho

sharp geyser
#

ok

#

so

#

why are you using fs if you are using express

#

express already has a way to render files

ancient nova
#

it does...?

sharp geyser
#

res.sendFile

#

Look up express rendering html files

#

and you will figure it out

ancient nova
#

ok.. why does the CSS doesn't work though

sharp geyser
#

Look up static files

#

and view files (or whatever it is called can't remember)

ancient nova
#

it told me to use the function I am using now

#

it doesn't work

sharp geyser
#

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

ancient nova
#

oh my b

sharp geyser
#

at an endpoint

ancient nova
#

I'll do it rn

sharp geyser
#

usually you put all your files like this

#

at least in a typical express app

ancient nova
#

there

sharp geyser
#
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

ancient nova
#

yeah ik

sharp geyser
#

and then in your express app you can do

app.get('/', (req, res) => {
  res.sendFile('index.html')
})

or smth

wheat mesa
# ancient nova

classic disk abuse reading from it every time a request is sent πŸ˜‰

sharp geyser
#

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

ancient nova
#

can you guys see the CSS?

wheat mesa
#

mistyMemory* misty = new mistyMemory();

sharp geyser
#

yea I can

ancient nova
#

great tysm

sharp geyser
#

Personally I dislike using express on its own

ancient nova
sharp geyser
#

but for your use case it is perfectly fine

ancient nova
#

anything I should know about?

sharp geyser
#

Pain

#

be prepared

ancient nova
#

0_0

sharp geyser
#

especially if you are going to do oauth

#

Since you absolutely hate reading docs

ancient nova
#

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?

sharp geyser
#

Thats how a typical dashboard is

sharp geyser
#

you will have virtually no issues

ancient nova
wheat mesa
#

cap

#

biggest cap I have seen in the last century

ancient nova
#

no cap

sharp geyser
#

I am unsure if he is talking about what you said

#

or me

#

Waffle sucks at backend ;)

ancient nova
wheat mesa
#

one day you'll be using a language that I created for your backend buddy

#

:C

ancient nova
#

backend for my old api literally allows sql injection because I'm not filtering any user input

#

xd

sharp geyser
#

gotta support my friends

#

But I won't use a eso lang

wheat mesa
#

I hope to one day work on rust

sharp geyser
#

Go for it

wheat mesa
#

rustc kinda based

sharp geyser
#

Or make a name for yourself elsewhere

ancient nova
#

what's the point of using ''?

wheat mesa
#

wdym

sharp geyser
#

Wdym

ancient nova
#

I see '' in pretty much every old script

#

like '' instead of ""

sharp geyser
#

Oh

#

single quotes over double

wheat mesa
#

Depends on what context you're talking about

#

Single quotes in the majority of languages are for single characters

ancient nova
#

just casually, both seem to work the same

sharp geyser
#

in js there really is no difference I don't think

#

one just looks better

wheat mesa
#

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

ancient nova
#

so it's just up to prefrence?

sharp geyser
#

as far as I know yes

#

unless you are using something other than js or ts

ancient nova
#

good to know

civic scroll
#

i always use ''

sharp geyser
#

a lot of other languages do what waffle said

ancient nova
#

wonder why people switched from using '' to ""

civic scroll
#

until react forced me to use "

sharp geyser
#

If you try and do 'Hello, World' in C#

ancient nova
#

all newer js scripts use ""

sharp geyser
#

it cries

wheat mesa
#

Because double quotes is traditionally for strings, people inherited that idea from other c-style languages

ancient nova
#

whereas older ones, mainly web based use ''

sharp geyser
#

I still prefer single quotes over double when I program in ts

#

it looks cleaner

civic scroll
#

ima just only use backticks

wheat mesa
#

Same

civic scroll
#

same

wheat mesa
#

(To what misty said)

ancient nova
#

I only use `` when I need to display a variable in the string

sharp geyser
#

I have prettier to rewrite " to '

wheat mesa
#

same

sharp geyser
#

back ticks are not useful other wise

#

so it is confusing for those who do it for literally everything

ancient nova
#

yea

sharp geyser
#

When I see backticks I expect string templating

ancient nova
#

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?

sharp geyser
#

I am curious if that is even coming from that line specifically

wheat mesa
#

message_reference is the message you're replying to

sharp geyser
#

ah right

wheat mesa
sharp geyser
#

If the message was ephemeral or deleted it won't work no?

ancient nova
#

oh so he deleted the message right after sending?

#

too fast for the reply to even register?

sharp geyser
#

Well if the message is deleted

#

how do you expect to reply

ancient nova
civic scroll
#

i'm sorry misty

ancient nova
#

πŸ’€

sharp geyser
#

OR

#

hear me out

#

use the fucking escape character like it was meant to be used

civic scroll
#

no

sharp geyser
#

ok

#

then

civic scroll
#

jk i do that now

sharp geyser
#

good

#

i was fixing to show up to your house

#

and do unholy things to you

civic scroll
#

ima use linq on you

sharp geyser
#

Never heard of it

#

so it can't hurt me

#

😎

civic scroll
#

what

#

you do C# and dk linq

sharp geyser
#

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

ancient nova
#

so I'm trying to reply to it weirdsip

sharp geyser
#

you mean that cursory

#

Yea

#

I didn't like the look of it

#

and stayed away

civic scroll
#

hhhh

#

now i have misty repellant

sharp geyser
#

If I ever need it

#

I will learn it

#

😎

civic scroll
sharp geyser
civic scroll
#

what is it

sharp geyser
#

Ur

#

Mother

civic scroll
#

nah

#

that ain't a repellant that's a person

sharp geyser
#
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

wheat mesa
sharp geyser
#

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

carmine summit
#

is there a way to do this without causing any max stack errors?

async function foo() {
  //await do something
  foo()
}
vivid fulcrum
#

smells like bad code

#

what's your actual code you're using

#

you can probably refactor it

carmine summit
#
  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();
  }
sharp geyser
#

Oh

#

god

#

That is basically calling an infinite loop

carmine summit
#

well i had a condition on that the last time I did it

#

it was throwing an error so i scrapped it

tight zealot
#

can anyone help mje

#

me

vivid fulcrum
#

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

tight zealot
#

how do you make it to were a search command can only happen if certain amount of credits

#

for economy bot

vivid fulcrum
#

you can probably further optimize this with requestAnimationFrame if in browser context, but i wouldn't know from that snippet alone

sharp geyser
#

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

tight zealot
#

i mean like to the code to execute that

#

cause i have the rest of the code

sharp geyser
#

I told you exactly how to do it though...

tight zealot
#

im a learner

#

so not quite sure

sharp geyser
#

:/

#

I am not going to spoonfeed you

#

What exactly are you unsure of how to do

tight zealot
#

write just that one part down

vivid fulcrum
#

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
tight zealot
#

okie

civic scroll
#

you need at least one break condition and ensure that it gets hit before the max stack error does

carmine summit
#

I already added it, it still max stacks if it goes for long

lament rock
#

Does it need to run forever? Because if so, then you should be doing event based instead of potentially on the same tick

carmine summit
lament rock
#

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

eternal osprey
#

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.

sharp geyser
#

Display an image and some text?

#

ofc

eternal osprey
sharp geyser
#

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

eternal osprey
#

it's rather more secure to strictly check the ids of the bots

civic scroll
eternal osprey
#

yeah that's what i am doing!

civic scroll
#

then yeah it's done

eternal osprey
#

Awesome, thank you!

quartz kindle
#

you guys dont sleep?

eternal osprey
#
const row1 =  new MessageActionRow()
                    .addComponents(
                        new MessageButton()
                        .setCustomId(`${ids}link`)
                            .setLabel('Jump to Giveaway')
                            .setStyle('LINK'),
                    );```how would i actually set a link?
eternal osprey
civic scroll
#

assume that it's VSC

#

OH WAIT

#

i forgot

#

sorry

eternal osprey
civic scroll
#

it should have a url field

eternal osprey
#

wahahah alrightt

civic scroll
#

do a setUrl

eternal osprey
#

.setUrl

civic scroll
#

or sth

eternal osprey
#

i see, thank you!

civic scroll
#

looks cleaner

earnest phoenix
#

u dont need customId if ur button is a link

civic scroll
earnest phoenix
#

you'll get an error that a custom id and url cannot both be specified

eternal osprey
#

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
earnest phoenix
carmine summit
#

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

quartz kindle
#

do you know the item index?

carmine summit
#

yep

quartz kindle
#

then array[index]

carmine summit
#

that is too slow

quartz kindle
#

how lol

#

there isnt anything faster

carmine summit
#

left is array reads, right is miliseconds from first read

#

is an object acting like an array gonna be faster?

quartz kindle
#

no

earnest phoenix
#

Arrays are objects with indexes as keys and elements as values, so it's not gonna change anything

carmine summit
#

will a smaller array be much faster?

earnest phoenix
#

Love you too :)

carmine summit
#

is pathImageData[x + y * gameCanvas.width] going to be better than a 2d/3d array? isnt multiplication a resource intensive task?

earnest phoenix
quartz kindle
#

math will always be faster than object access

carmine summit
#

this is going to be tough

#

maybe i need to find a way to decrease array reads. thanks though

eternal osprey
#
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

earnest phoenix
#

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

eternal osprey
earnest phoenix
#

Yes

eternal osprey
#

how would i later on clear the set complete?

earnest phoenix
eternal osprey
#

omg you are the best voltrex!

#

While you are running warm with answering questions, might i ask you another thing?

earnest phoenix
#

Sure

eternal osprey
#
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

carmine summit
civic scroll
quartz kindle
civic scroll
#

i don't know what your code is tryna do

earnest phoenix
quartz kindle
#

your guildDB did not find anything

#

add a console.log for data

civic scroll
#

@earnest phoenix btw line 118

#

Collection.get does not return a Promise
consider removing the await expression

earnest phoenix
#

(The addField() method is removed in discord.js v14)

eternal osprey
#

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>)``
earnest phoenix
#

You can just let the formatters bundled with discord.js handle that for you

eternal osprey
#

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

earnest phoenix
#
import { time } from 'discord.js';

...

const date = ...;

console.log(time(date, 'R')); // <t:<TIME>:R>
civic scroll
#

oh

earnest phoenix
#

You need to get the time function from the Formatters class if you're still using v13

eternal osprey
#
.addField(`Ends:`, `${k4} <t:${newtime}:R> (<t:${newtime}>)`)```i tried doing this but it ain't working lol
earnest phoenix
#

Then you can do

import { Formatters } from 'discord.js';

const { time } = Formatters;

...

const date = ...;

console.log(time(date, 'R'));
earnest phoenix
#

If you're using CJS instead of ESM, you can get it like this:

const { Formatters: { time } } = require('discord.js');
eternal osprey
#

It returns me invalid date

#
<t:19804308079657:R>```
earnest phoenix
#

Show how you're using it

eternal osprey
#
.addField(`Ends:`, `${k4} ${time(newtime, 'R')}`)```
#
const { Formatters: { time } } = require('discord.js');```
earnest phoenix
#

What's the value of the newtime variable?

eternal osprey
#

19804308079657

earnest phoenix
#

You're supposed to pass the date instance in, in this case

eternal osprey
#

So I can't pass a timestamp?

earnest phoenix
#

Can you show us more of the code?

civic scroll
#

when you don't have intellisense

eternal osprey
#
    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?

civic scroll
#

it should have worked

earnest phoenix
#

You can just pass in the date variable to the method, but I think the timestamp in your case is invalid

eternal osprey
#

i passed the date variable

earnest phoenix
#

Yeah your timestamp is messed up troll

eternal osprey
#

it can't

eternal osprey
#

How the fuck does it return 500 years

#

ooowh woow

#

i am multiplying the ms by 60* 60 *1000

earnest phoenix
#

Yeah

civic scroll
#

500 years

#

W

#

what kind of giveaway is this

earnest phoenix
#

Giveaway to get some bitches (in 500 years)

eternal osprey
#

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

earnest phoenix
eternal osprey
#
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

earnest phoenix
#

I could be your boyfriend, homies mmLol

#

Jokes aside yes, you're welcome

quartz kindle
#

arent discord timestamps in seconds?

earnest phoenix
eternal osprey
#

i am using ms and it works tho?

civic scroll
#

yeah that's the point

eternal osprey
#
    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
civic scroll
#

unix timestamp is in ms

earnest phoenix
earnest phoenix
# eternal osprey ```js for( let i = 0; i < interaction.options.getNumber('winners'); i++){ ...

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

lyric mountain
lyric mountain
civic scroll
lyric mountain
#

divide

civic scroll
lyric mountain
#

ah ok

civic scroll
boreal iron
quartz kindle
#

just do both

lyric mountain
#

unix * 1000 / 1000?

quartz kindle
#

yes

#

:^)

lyric mountain
#

lmao

wooden ember
#

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

lyric mountain
#

have a map of aliases

wooden ember
#

done

#

just not sure how to set it

lyric mountain
#

are them going to be hardcoded or dynamic?

wooden ember
#

what do you mean? there is just a list of like three on each command file

lyric mountain
#

hardcoded means it's defined on the code

#

dynamic means it's defined during runtime

wooden ember
#

how would it be dynamic though is what im not understanding?

#

can i get it to predict my bad spelling?

#

lol

lyric mountain
#

user uses !alias command cmd
command now can be used as !command or !cmd

lyric mountain
wooden ember
#

ooooh

#

i see

boreal iron
#

It would by dynamic if people would be able to edit the aliases in their servers for example

wooden ember
#

that would be nice

lyric mountain
#

inb4, don't use fuzzy search for commands

wooden ember
#

but that would just be added complexity

boreal iron
tribal harness
#

Thats the point brother.

lyric mountain
#

I mean, every convenience feature u add is additional complexity

wooden ember
#

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

lyric mountain
#

no, that'd be catastrophic

wooden ember
#

indeed

#

but it would "work"

lyric mountain
#

you have to use a database if u want to go dynamic

boreal iron
wooden ember
#

could get away with json if i had a file for each command though

boreal iron
#

How would you manage two guilds defining different aliases then? KEKW

lyric mountain
#

file-based settings are always the worst possible option if u plan on editing it all the time

wooden ember
#

global

#

i mean the context is this bot is on like 3 servers so

#

eh

#

not tooooo much of an issue

lyric mountain
#

always consider ur bot is in 100 servers

wooden ember
#

eh

lyric mountain
#

don't think small because you'll have concurrency/personalization issues later on

#

your code has to be prepared for all range of usage

wooden ember
#

my bot has a command that streams the music from the servers cd player idk how id make that work over 100+ servers

lyric mountain
#

that's how u find bottlenecks

wooden ember
#

*adds 100 cd drives to the host server*

tribal harness
#

What do you mean? As long as it has perms

lyric mountain
#

and memory usage

tribal harness
#

How are you streaming the music?

wooden ember
#

didnt think of that but its funny having my the cd drive spin up at 1am

lyric mountain
#

wait, ur using physical cds?

tribal harness
#

Are you using an API for this?

#

Wait what?

wooden ember
lyric mountain
#

lmao what

wooden ember
#

theres a package called node microphone

#

huh?

quartz kindle
#

lmao

#

dude be streaming music from cds in 2022

tribal harness
#

Thats incredible

boreal iron
#

Next song -> please insert CD 2

quartz kindle
#

the only music bot that streams live music, as in, really really live

wooden ember
#

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

lyric mountain
wooden ember
#

i then route that audio over discord

boreal iron
wooden ember
#

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

tribal harness
#

So you play tapes and cd's?

wooden ember
#

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

tribal harness
#

xD

wooden ember
#

like the fan cooling the pci ssd held on by popsicle sticks jammed in the pci slot below

tribal harness
#

I mean, if it works

small tangle
lyric mountain
#

cant u just export the cd to a file and stream that?

wooden ember
#

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

boreal iron
wooden ember
#

i mean its works pretty well

#

the only issue is my internet fucking up

lyric mountain
#

coomber

wooden ember
#

indeed

#

nice deck but only mono though

#

sad times

boreal iron
#

Wow… and people called Tim and me old

wooden ember
#

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

boreal iron
#

The mess in that picture and the 30 years old PC is killing me

wooden ember
#

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

boreal iron
#

Somehow doesn’t change the fact it could at least be a little bit organized freerealestate

wooden ember
#

there we go

#

organisation? never heard of her

boreal iron
#

Physical pain

wooden ember
#

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

boreal iron
#

Hmm looks like common PC hardware to me

wooden ember
#

?

boreal iron
#

Anyways../

wooden ember
#

lol

quartz kindle
#

amazing...

boreal iron
#

Clean up your room, throw that thing out, buy a disk man, stream from it

wooden ember
#

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

quartz kindle
#

firenado, the IT cowboy redneck from texas

boreal iron
#

lel

wooden ember
#

yes

#

this is the current setup but from before I upgraded the server

lyric mountain
#

crt

wooden ember
#

crt moment

#

indeed

lyric mountain
#

you're almost growing an arm out of ur chest

boreal iron
#

Oh my

lyric mountain
#

and no crt shield

wooden ember
#

the top one had good grounding and shielding the bottom one is uuuuuhh

#

fine

boreal iron
#

Overall amazing ngl
Your setup is like Bea’s code… UNIQUE

wooden ember
#

i mean it works

#

and all of those monitors where free so eh

lyric mountain
#

the radiation too

wooden ember
#

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

round cove
#

How does Discord fetch members/channels for a server when swapping between servers? I assume lots of work is in cache.

boreal iron
#

that's pretty much it I guess, since I usually see avatars and sometimes user names being like... days/weeks old

round cove
#

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.

lament rock
#

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

round cove
#

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.

lament rock
#

idk where on disk. All I know is it's cached somewhere. Also, channels are sent on GUILD_CREATE

round cove
#

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?

lament rock
#

user accounts aren't too terribly different from bot accounts, just more privileged access

round cove
#

That I understand more.

lament rock
#

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

round cove
#

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

lament rock
#

guilded is omega lol garbage

#

interesting concept, but that's about it

#

competition to Discord would be healthy

round cove
#

Yeah exactly. So I'm hoping they figure it out.

digital swan
#

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

sudden geyser
#

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.

sudden geyser
boreal iron
#

but it somehow works

digital swan
#

yeah thats what im about to test out rn

boreal iron
#

like that

#

but it will reduce the other 2 columns on the next line to the max length

#

of above

wooden ember
#

most of them where cilled off due to privlaged intents but eh

sharp geyser
#

Also cause it breaks tos

stuck dawn
#

anyone knows why there's no overflow?

#

i am using grid

#

with flex it works but is not responsive

round cove
#

Overflow for what?

#

Where do you want overflow at?

stuck dawn
#

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

civic scroll
#

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%

stuck dawn
civic scroll
#

why tho

stuck dawn
#

it's not the same problem of the other day, i can't actually scroll

#

idk

#

its the grid

civic scroll
#

if the child overflows on an overflow-y-auto parent the parent is scrollable

stuck dawn
civic scroll
#

you should only limit the column to 5

stuck dawn
#

ohhh i see

civic scroll
#

you limit the row number to 5, hence it only renders 5 rows

stuck dawn
#

the columns are the problem

#

yeah

#

let me try

#

nope it doesn't work

#

even

#

if

#

i repeat 10 times

civic scroll
#

remove the row definition

#

you are rendering 10 rows for 100% height

stuck dawn
#

same thing

proven escarp
stuck dawn
#

and it is

proven escarp
#

wow

civic scroll
#

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

stuck dawn
#

its my first time using grid

feral aspen
#

@lyric mountain, got a question for you. πŸ‘‹

wheat mesa
#

Java question πŸ‘€

feral aspen
#

Yes.

lyric mountain
#

ayo

civic scroll
feral aspen
#

I'll need to give a backstory, gonna take a while.

civic scroll
#

sadly i haven't touch grids for now

stuck dawn
#

:( thanks anyway

feral aspen
#

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.

https://cdn.hamoodihajjiri.com/OKCODwBjug

lyric mountain
#

well, u could use the entire ascii table

wheat mesa
#

^

feral aspen
#

What?

wheat mesa
#

I’d just encode it as one byte each

lyric mountain
#

\uFFFF is probably enough for all your use-cases

wheat mesa
#

That way nobody can get confused

lyric mountain
#

one byte would be up to 255 different ids (256 if u include 0)

#

2 bytes would be 65535 different ids (65536 with 0)

feral aspen
#

How would that work? I still didn't understand.

lyric mountain
#

for java simply use char data type

#

it'll transform from number to unicode char

wheat mesa
#

A character is technically a number, just use the integer value of the characters instead of just printing numbers

lyric mountain
#

like F0 would become char \u00F0

feral aspen
wheat mesa
#

Aka char someCharStoringNumber = (char)5

lyric mountain
#

(char) thenumber

wheat mesa
#

(Do you even need the cast, idk)

lyric mountain
#

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

wheat mesa
#

Speaking of Java I’m actually writing some right now for CS class lol

feral aspen
#

I still don't know what I'm exactly supposed to do, I'm confused.

lyric mountain
#

like, is the map supposed to be viewed as a grid in terminal?

#

or will the grid be used somewhere else?

feral aspen
#

No, the map is like numbers, the code loops through them so it can display the tiles.

lyric mountain
#

...

feral aspen
#

I didn't make sense, fair enough.

lyric mountain
#

so are the ids being viewed as-is or are they used somewhere else?

feral aspen
#

They're being used.

lyric mountain
#

so they're a 2d map?

feral aspen
#

Yes.

lyric mountain
#

simply make a 2d array then

#

or better yet, a common array

feral aspen
lyric mountain
#

simply use a normal array

feral aspen
#

Each tile is the actual ID.

quartz kindle
#

you dont really need two sets of ids do you?

#

tile id, tile type, tile name

feral aspen
#

No, I'm just using tile id, tile name, and collision.

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

feral aspen
#

I'm organising a lot of stuff, so I need to look into the above, too.

#

Alright. πŸ‘

lyric mountain
#

hm, wait

#

the x loop has the wrong condition

#

well anyway, u can figure that out

#

nvm, already did

feral aspen
#

For sure.

ancient nova
#

anyone has any command ideas? :]

sudden geyser
#

yes

sharp geyser
#

looks like it

ancient nova
#

@sharp geyser btw I've done that add emoji command thingy

#

have u done that?

sharp geyser
#

?

bright thorn
#

to edit a ephemeral message what term we will use?

#

followUp or fetchReply

ancient nova
bright thorn
#

yes

ancient nova
#

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

bright thorn
#

okay

#

no

bright thorn
#

i send interaction by followUp

#

and after that i can't do edit reply

sharp geyser
#

It's hard to edit a ephemeral message

#

The point of Ephemeral messages are so only the user sees them

ancient nova
ancient nova
bright thorn
#

let's try

boreal iron
ancient nova
#

I don't have any command ideas

boreal iron
#

make sure to catch errors there as it can be gone already

ancient nova
#

maybe feature ideas

#

like anti spam or sumn

#

just give me something 😩

stuck dawn
bright thorn
#

not got it

ancient nova
#

maybe just do this:
send the ephermal message, once user picks delete it instead and edit ur main embed

#

should be easier to do

boreal iron
# bright thorn

your follow up message has a webhook ID property, use this to edit the webhook (response)

ancient nova
#

it actually looks pretty good

lyric mountain
ancient nova
#

bruuuuuhhhhhh

ancient nova
#

why does every dashboard is integrated into the bot itself

#

do people not separate the two?

#

it seems like hell to manage

lyric mountain
#

because it's easier to simply integrate it

#

no need to make external calls

ancient nova
#

:/

#

still

boreal iron
#

this thing just shows a few stats, that's all

lyric mountain
#

it's only hell to manage if u don't have a proper project structure

boreal iron
#

nothing you can't do yourself in a few hours

lyric mountain
#

like keeping everything in the same folder

boreal iron
#

from scratch

ancient nova
#

hmm

#

ok

civic scroll
#

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

ancient nova
#

na my problem is usage, it would prolly jump high af if i integrated a website into my main bot struct

ancient nova
#

although I have only 1 atm

civic scroll
#

not your bot

boreal iron
#

then just store your stats in a database which you query on your dashboard site

civic scroll
#

the application instance is a level lower

ancient nova
#

okay

#

let me

#

just

#

do sumn

civic scroll
#

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

ancient nova
#

wait doesn't top.gg store some of my bots stats

#

like amount of guilds and uptime?

civic scroll
#

nothing works best than from original source

civic scroll
#

for guilds maybe

craggy pine
#

You tell topgg ur bot stats

civic scroll
#

but for uptime it's impossible

ancient nova
#

bots for discord stores uptime

civic scroll
#

who would bother do a ws connection to your bot for uptime πŸ’€

ancient nova
#

I'll ask them if they have an endpoint for that

ancient nova
boreal iron
#

my gosh

then just store your stats in a database which you query on your dashboard site

ancient nova
#

lucky my bot is 99.7% up kek

civic scroll
#

nah

ancient nova
civic scroll
#

how come my bot is still on the site then

ancient nova
#

just gonna use top.gg api and bots for discord api

civic scroll
#

πŸ’€

ancient nova
boreal iron
#

?!

ancient nova
#

whats ur bots id

#

I'll check

ancient nova
boreal iron
#

so sending requests to the topgg api is easier for you than creating a table in your database you're pushing your metrics to?

civic scroll
#

the thing is

#

it doesn't

#

it doesn't do check uptime

boreal iron
#

once again... I have no words

civic scroll
#

that would be a costly operation

#

the only thing does that is discord api endpoint

#

it has a heartbeat field

ancient nova
#

it does tho

civic scroll
#

πŸ’€

#

fine

#

do 530044410050772992

ancient nova
#

alr

sharp geyser
#

What even is going on

civic scroll
#

i don't know

boreal iron
#

Don’t get into it

civic scroll
#

what's this bs about bot uptime

sharp geyser
#

I have been glancing over at chat

ancient nova
#

seems like it's a lil broken for ur bot

sharp geyser
#

and I am deeply confused

civic scroll
#

it's not broken

boreal iron
#

Like always

civic scroll
#

it's right

sharp geyser
boreal iron
#

Not me?

#

Makes me proud

sharp geyser
#

No

#

I fuck with you

boreal iron
#

Rrrrrr don’t make me horny bitch

civic scroll
#

i somewhat regret this

sharp geyser
civic scroll
#

but considering the goal then, it's not to be ashamed of

sharp geyser
#

Calm down old man im underage

boreal iron
rancid moss
ancient nova
boreal iron
civic scroll
sharp geyser
rancid moss
#

Not me casually stalking the channels

civic scroll
#

uptime verification

sharp geyser
#

and he expects top.gg to track that?

ancient nova
boreal iron
#

He wants to report his stats to topgg to send requests to the api to get the metrics back

ancient nova
#

show some stats on it

boreal iron
#

Instead of creating a table in his database

#

For his metrics

sharp geyser
#

You're hoping for too much

#

top.gg only gives back basic information

#

as far as I know at least

ancient nova
#

good enough for me

sharp geyser
#

basic as in

#

the only thing you will find useful is the ID

#

which you should already be able to get

boreal iron
#

Since it’s Bae I’m close to suggest saving your stats in a json database file

sharp geyser
#

sqlite would even be a choice here

#

but πŸ€·β€β™€οΈ

civic scroll
#

mongodb

boreal iron
#

Too complicated

sharp geyser
#

we talking ot the most complicated person ever

#

He expects to do oauth without reading the docs

rancid moss
sharp geyser
#

...

#

you don't know who we talking about though

civic scroll
#

nah

#

simplest one?

sharp geyser
#

This is no hate to Bae

civic scroll
#

key-value database

sharp geyser
#

but like he refuses to read docs half the time

rancid moss
sharp geyser
#

and wants us to give him every answer

civic scroll
lyric mountain
rancid moss
sharp geyser
#

no

lyric mountain
sharp geyser
#

sayuri just sucks at frontend

#

😎

boreal iron
civic scroll
wheat mesa
civic scroll
#

perhaps

lyric mountain
#

sayuri just created an entire game intro with nothing more than css and sheer weebiness

civic scroll
#

that's true

#

wait i mean misty's one

rancid moss
#

:O

boreal iron
wheat mesa
sharp geyser
#

Didn't sayuri create a "windows" environment in css and html

rancid moss
#

tf?

sharp geyser
#

or did you never go through with that sayuri

rancid moss
#

I-

sharp geyser
#

Not like it could really do much

civic scroll
#

but the thing is

#

i assigned them to actual processes

boreal iron
sharp geyser
boreal iron
civic scroll
#

my plan is to replicate the environment of an os

sharp geyser
#

Windows 11 is an abomination

#

Only good thing it does is possibly make your games run faster

#

at the proper bios settings

civic scroll
#

so each processes may have multiple windows

rancid moss
lyric mountain
#

SayOS

rancid moss
stuck dawn
#

like Windows96

sharp geyser
#

All windows 11 is

#

just Windows 10 with a new ui

civic scroll
civic scroll
civic scroll
boreal iron
sharp geyser
boreal iron
#

Much worse

feral aspen
#

Should I be using IntelliJ for Javascript (like discord bot coding, or something)? Eyes

civic scroll
sharp geyser
#

but

boreal iron
civic scroll
#

it's more suited

sharp geyser
#

there is a dedicated IDE already in the jetbrains suite

rancid moss
#

Webstorm would be better for js, html,css and py

feral aspen
civic scroll
feral aspen
#

Lemme check that.

sharp geyser
#

PyCharm

rancid moss
#

Ah

civic scroll
boreal iron
civic scroll
feral aspen
sharp geyser
#

Technically every IDE can do every language except .Net

rancid moss
#

well there are always scuffed plugins to support py

sharp geyser
#

.Net has its own dedicated IDE

boreal iron
#

I see

feral aspen
#

Also, when should I use VSC? Eyes

sharp geyser
#

Never

boreal iron
#

You like fully hardcode coding

civic scroll
feral aspen
#

Eh, alright.

rancid moss
feral aspen
#

Aww, it's for money. ;-;

#

$60.

rancid moss
#

yupp

feral aspen
sharp geyser
#

Or

#

go open source for 3 months and keep updating it every now and then

#

or get the github student pack

feral aspen
#

Oh, I have that. Hold on.

civic scroll
ancient nova
sharp geyser
#

padding

civic scroll
#

man forgot gaps in css flexboxes

ancient nova
#

to move the dashboard button from the support server button

ancient nova
#

I couldn't remember the css tag for it

civic scroll
#

just use a flexbox

ancient nova
sharp geyser
#

sayuri

#

too complicated for the man