#development

1 messages · Page 1535 of 1

opal plank
#

what the flying fuck

lone pivot
#

helo

opal plank
#

bruh

#

${} exists

pale vessel
#

Tbh

timber fractal
#

@quartz kindle u know?

lyric mountain
#

`This server prefix is` + "`" + fetchprefix.prefix "`"

quartz kindle
#

thats like logging bots that require you to have a channel named "logs", but worse

pale vessel
#

I would rather use + than escaping it

lyric mountain
#

this is awful

opal plank
#

why not properly explain to them how to do stuff?

#
const prefix = db.get(message.guild.id) || default_prefix

There. one line

lyric mountain
#

wait, return message.channel.send?

#

is it returnable?

pale vessel
#

yes

opal plank
#

im not even going to bother looking at the code inside

pale vessel
#

What can't you return in js anyway

tired panther
opal plank
tired panther
#

@opal plank that is explained here

crimson vapor
#

what the fuck is this fucking shit

quartz kindle
#

those variables need to be declared in a local scope, inside the same block

glacial pagoda
opal plank
#

this is ur famous ?

crimson vapor
#

tim

opal plank
quartz kindle
#

macrohard onfire

glacial pagoda
crimson vapor
#

yes

#

perfect

quartz kindle
crimson vapor
#

since they are different

glacial pagoda
#

So I Gotta Just Replace?

#

ok

tired panther
#

@opal plank and its the only working mongoose prefix module

lyric mountain
timber fractal
rocky hearth
#

For js generators is these both the same thing?

function *generator() {
  yield 5;
  // OR
  return { done: false, value: 5 };
}
opal plank
glacial pagoda
tired panther
lyric mountain
glacial pagoda
#

ok

lyric mountain
#

like, instead of putting the id in the code, make it changeable

timber fractal
lyric mountain
#

with a command or db or whatever

opal plank
#

thats the issue you dont get mesiter, there isnt a point in doing something that simple, its the same as is-undefined, its a package that, not only isnt good, but its too simple to be considered a avalid package

tired panther
glacial pagoda
#

Mongodb?

opal plank
#

you dont provide them anything?

lyric mountain
quartz kindle
#

let them do the package they want lol

tardy hornet
#

what do i define creatcanvas to?
const createCanvas??

quartz kindle
#

but

opal plank
quartz kindle
#

@tired panther at the very least remove the dependency on client.prefix

lyric mountain
#

or cv

#

or anyvariablename

quartz kindle
#

no

#

you require the user to have client.prefix

#

if the user doesnt do that, your package wont work

#

thats not a good thing

tired panther
opal plank
crystal wigeon
#

i still couldn't figure out why sharding is executing twice

opal plank
#

i've explained here quite a few times for new people how to set their own prefixes

tardy hornet
#

in the line:

tired panther
tardy hornet
#

const killCanvas

lyric mountain
quartz kindle
crystal wigeon
tired panther
quartz kindle
#

{ createCanvas } = require("canvas") or createCanvas = require("canvas").createCanvas

crystal wigeon
#

@quartz kindle any idea why shards are executing twice?

tired panther
# opal plank what?

when u have 4000 guilds and you load all info, that is not worth it. WHen just 1k servers would need the commands.

quartz kindle
crimson vapor
#

this hurts

crystal wigeon
#
const { ShardingManager } = require("discord.js");  
const { logger } = require("../public/static/js/logger");

process.on("unhandledRejection", (error, promise) => {
    console.log(
      "Oh Lord! We forgot to handle a promise rejection here: ",
      promise
    );
    console.log("The error was: ", error);
    logger.error("UnhandledRejection: " + error.stack);
  });
  
  process.on("uncaughtException", (error) => {
    console.log("Oh my god, something terrible happened: ", error);
    logger.error("BOT SHARD CRASHED, FATAL ERROR: " + error.stack);
    // process.exit(1);
  });

const manager = new ShardingManager("./server/client.js", {
    totalShards: 2,
    token: process.env.DISCORD_TEST_BOT
    // token: process.env.DISCORD_BOT_TOKEN
});

manager.spawn();
manager.on("shardCreate", shard => console.log(`Shard #${shard.id} is Online`));```
#

well this is all the code

#

if i set totalShards to "auto"

#

it still executes twice

#

the commands and stuff

quartz kindle
crystal wigeon
#

double commands

crimson vapor
#

do you have 2 instances running?

quartz kindle
#

packages and modules should be self-contained and not interfere with other packages

opal plank
crystal wigeon
tired panther
opal plank
#

why would you fetch it every time?

tardy hornet
#

what do i define it to?

opal plank
#

its absolutely retarded to do fetch requests on every message

#

specially with databases that arent local

lyric mountain
#

storing prefix in memory is negligible actually

opal plank
#

not only will they increase your bot response time but it'll also spam your db with requests

#

they are all strings

#

theres NO reason NOT to store them in memory

#

be it 4k, or 400k

#

use redis

quartz kindle
opal plank
#

if you really fancy ram

lyric mountain
#

or sqlite if you don't want to use ram

opal plank
#

the linting is bad, the coding is bad, and the premise behind the code is bad

quartz kindle
#

why redis for prefixes

#

waste of tcp round trips

opal plank
#

also doesnt help beggingers learn how to deal with a db, just creates dependency and not writing stuff for themselves

#

i checked a couple days ago after we talked Tim

#

redis has memory optimization and compression

quartz kindle
#

its not about storage

#

its about access

opal plank
#

the same map on js uses more ram than redis

quartz kindle
#

storing prefix in js is better 100% of the time

#

the same way you dont want to spam your db with requests, you also dont want to spam redis with requests

opal plank
#

yeah, though if memory is an issue, redis is an option, and a good one at that

tired panther
quartz kindle
#

memory will never be an issue with prefixes xd

#

even if you have 4 million servers

opal plank
#

well yeah

crimson vapor
#

how much memory is a map with 4 million entries?

opal plank
#

lets see

quartz kindle
#

lets check

crystal wigeon
#
const clientEvents = require("./app");
const express = require("express");
const Topgg = require("@top-gg/sdk");
const server = express();

const webhook = new Topgg.Webhook("izziwebhookauth");

process.on("unhandledRejection", (error, promise) => {
  console.log(
    "Oh Lord! We forgot to handle a promise rejection here: ",
    promise
  );
  console.log("The error was: ", error);
  logger.error("UnhandledRejection: " + error.stack);
});

process.on("uncaughtException", (error) => {
  console.log("Oh my god, something terrible happened: ", error);
  logger.error("BOT CRASHED, FATAL ERROR: " + error.stack);
  // process.exit(1);
});

const discord = require("discord.js"),
  client = new discord.Client({
    partials: ["MESSAGE", "REACTION", "CHANNEL"],
  });

server.post("/dblwebhook-secret", webhook.middleware(), async (req, res) => {
  const voter = client.users.cache.get(req.vote.user);
  const createDM = await voter.createDM();
  res.status(200);
});

server.listen(5000, () => {
  console.log("listening for webhook on port 5000");
});

client.on("ready", async () => {
  client.user.setPresence({
    activity: {
      name: `iz help | alpha v2.8.0`,
      type: "LISTENING",
    },
  });
});

// const cluster = new Cluster();
// cluster.createJob("client", clientEvents, client);
// cluster.queueJobs("client");
// cluster.initWorker();
clientEvents(client);

// client.login(process.env.DISCORD_BOT_TOKEN);
client.login(process.env.DISCORD_TEST_BOT);
lyric mountain
#

most prefixes will be 2-char length, so somewhere about 8 bytes

crystal wigeon
#

this my client.js

cinder patio
crystal wigeon
#

also app.js has the commands

crimson vapor
#

Map<"guildID", "prefix">

lyric mountain
#

8 * 4000000 = 32000000 bytes, or 31250 kb, or 30 mb

#

note that I'm considering only string bytes

quartz kindle
#

an array with 4 million times "a" increased rss by about 30mb

crimson vapor
#

arrays do be slow

lyric mountain
#

arrays are O(1) operations

#

with indexes

quartz kindle
#

only some operations

opal plank
#

this much

tardy hornet
#
  case 'kill':
    const { createCanvas, loadImage } = require("canvas")


        var imageW = 600;
        var imageH = 600;
        const killCanvas = createCanvas(imageW, imageH);
        const ctx = killCanvas.getContext("2d");




        var secondMemberPP = await loadImage(message.author.displayAvatarURL({format: "png"}))
        ctx.drawImage(secondMemberPP, 0,0, imageW, imageH);

        var amongKill = await  loadImage("https://i.imgur.com/g1cdZ9U.png")
        ctx.drawImage(amongKill, 0, 100, imageW, imageH);

    const attachment = new Discord.MessageAttachment(killCanvas.toBuffer(), 'kill.png');

        const killf = new Discord.MessageEmbed()
        .attachFiles(attachment)
        .setImage("attachment://kill.png") 
        .setColor("RED")
        message.channel.send(killf)
    

        break;
#

sends

quartz kindle
opal plank
#

that many bytes

tardy hornet
crimson vapor
#

a find() on an array is slow, no?

lyric mountain
tardy hornet
#

how can i do that the background will be the coin?

opal plank
#

by all means this is not a proper test, but a close and cheesy one

#
    let mem = process.memoryUsage().rss;
    let s = new Map();
    for (let i = 0; i < 4000000; i++) s.set(i, i.toString());
    let mem2 = process.memoryUsage().rss;
    console.log(mem2 - mem);
lyric mountain
lyric mountain
opal plank
#

that should run fast enough where it shouldnt be taking into account the other ram

quartz kindle
crimson vapor
#

yea

lyric mountain
#

to see map memo usage

crystal wigeon
#

@quartz kindle ?

crimson vapor
#

so arrays kinda slow

lyric mountain
#

so we can subtract it from total

opal plank
#

what?

#

dude, first and foremost

lyric mountain
#

lul dude's comparing an is-undefined to an api wrapper

opal plank
#

that was a fork

#

if you are too dumb to check the commit changes

#

before topgg moved from dbl-api to node-sdk

tired panther
#

why?

opal plank
#

cuz i added the typescript documentation?

#

you know what forks are, right?

crystal wigeon
#

@quartz kindle ??

lyric mountain
opal plank
#

correct

#

he's clearly mad now and just digging on my repos to find something to try to bite back at me

crystal wigeon
#

lol

#

shards are biting my back hard

tired panther
#

I want to end the Discussion here and now
Its very unfriendly from you to critize small devs and laugh about them
You broke rule 4 lol.

crystal wigeon
#

jesus

tired panther
crystal wigeon
#

help me solve my issue

#

;-;

lyric mountain
opal plank
#

you're the one recommending bad stuff to new devs my dude

crystal wigeon
#

up

#

shards are causing double commands

#

tim wanted to take a look at the client.js file

#

but he gone now

lyric mountain
#

aren't u starting it twice with the same shard id?

opal plank
# tired panther 🍴 🤣

but yes, its a good thing that you're focusing on rules and trying to dig on my repos rather than trying to defend your librabry

crystal wigeon
#

nop

#

i only start it once

tired panther
crystal wigeon
#

but its spinning up twice

crystal wigeon
#

i only execute the app once

#

it tries to spin up twice

tired panther
crystal wigeon
#

so double commands

lyric mountain
#
require("dotenv").config({ path: __dirname + "/../../setup/.env" });
const clientEvents = require("./app");
const express = require("express");
const Topgg = require("@top-gg/sdk");
const server = express();

const webhook = new Topgg.Webhook("izziwebhookauth");

process.on("unhandledRejection", (error, promise) => {
  console.log(
    "Oh Lord! We forgot to handle a promise rejection here: ",
    promise
  );
  console.log("The error was: ", error);
  logger.error("UnhandledRejection: " + error.stack);
});

process.on("uncaughtException", (error) => {
  console.log("Oh my god, something terrible happened: ", error);
  logger.error("BOT CRASHED, FATAL ERROR: " + error.stack);
  // process.exit(1);
});

const discord = require("discord.js"),
  client = new discord.Client({
    partials: ["MESSAGE", "REACTION", "CHANNEL"],
  });

server.post("/dblwebhook-secret", webhook.middleware(), async (req, res) => {
  const voter = client.users.cache.get(req.vote.user);
  const createDM = await voter.createDM();
  res.status(200);
});

server.listen(5000, () => {
  console.log("listening for webhook on port 5000");
});

client.on("ready", async () => {
  client.user.setPresence({
    activity: {
      name: iz help | alpha v2.8.0`,
      type: "LISTENING",
    },
  });
});

// const cluster = new Cluster();
// cluster.createJob("client", clientEvents, client);
// cluster.queueJobs("client");
// cluster.initWorker();
clientEvents(client);

// client.login(process.env.DISCORD_BOT_TOKEN);
client.login(process.env.DISCORD_TEST_BOT);

just so I can read it better

opal plank
quartz kindle
# crystal wigeon so double commands

i dont understand half of your code, but for starters you're listening to port 5000 in a shard, which should immediately throw EADDR port already in use

crystal wigeon
#

yeah, because the shard is trying to execute everything twice

#

so even the commands are being doubled

quartz kindle
#

the shard shouldnt even be starting

#

it should crash immediately

crystal wigeon
#

this what i mean

#

double commands

tired panther
quartz kindle
#

and run the command again

#

any response?

#

to rule out any ghost process

crystal wigeon
#

well nop

#

because the shard for some reason still running in the background

#

1 shard stops

#

but the other is still running

lyric mountain
#

ghost process then

opal plank
quartz kindle
#

shutdown all processes

crystal wigeon
#

the addr 5000 port stops

quartz kindle
#

of course it stops

crystal wigeon
#

but my question is why is it even spinning twice?

quartz kindle
#

you cant listen to the same port multiple times

#

start by fixing your code

opal plank
crystal wigeon
#

i know

#

bruh

#

im asking why is the sharding

crystal wigeon
#

executing twice?

quartz kindle
#

because your code is broken

crystal wigeon
#

like my bot is listening twice for commands

quartz kindle
#

fixing your code will eventually fix the problem

tired panther
opal plank
crystal wigeon
#

when i spawn a shar

#

what do i need to fix?

#

i can move the listenere

quartz kindle
#

dont listen to the same port

crystal wigeon
#

forget about that

#

the client login

#

is happening twice

quartz kindle
#

remove stuff from the client

#

and run a barebones bot

tired panther
quartz kindle
#

then add stuff back one by one

crystal wigeon
#

ok so

#

even the client.on("ready") logs twice

#

when i shard

quartz kindle
#

because something in your code is breakig everything

#

so remove it

#

and start with a barebones

#

to confirm its working

crystal wigeon
#

i removed the addr

tardy hornet
#

i made that

#
case 'kill':
    const { createCanvas, loadImage } = require("canvas")  
        var imageW = 600;
        var imageH = 600;
        const killCanvas = createCanvas(imageW, imageH);
     const ctx = killCanvas.getContext("2d");
     var amongKill = await  loadImage("https://i.imgur.com/g1cdZ9U.png")
     ctx.drawImage(amongKill, 0, 0, imageW, imageH);
     var imageW2 = 250;
        var imageH2 = 250;
    
    var secondMemberPP = await loadImage(message.author.displayAvatarURL({format: "gif", dynamic: true}))
        ctx.drawImage(secondMemberPP, 175,170, imageW2, imageH2);


    
    const attachment = new Discord.MessageAttachment(killCanvas.toBuffer(), 'kill.gif');

        const killf = new Discord.MessageEmbed()
        .attachFiles(attachment)
        .setImage("attachment://kill.gif") 
        .setColor("RED")
        message.channel.send(killf)
    

        break;
#

sends

#

how can i make it to move like the pfp

lyric mountain
#

that's dealing with gif

tardy hornet
#

ik

lyric mountain
#

which might be quite hard and confuse unless you're familiar with image manipulation

tired panther
#

@crystal wigeon I can give u the barebone code xD

tardy hornet
#

i changed the all thing to gif tho

tired panther
#

wait download it from git discordjs guide

tardy hornet
#

the format

lyric mountain
tardy hornet
#

and attachment

lyric mountain
#

changin only the format will not do anything

tardy hornet
#

what about the attachment

#

?>

lyric mountain
#

no difference

#

basically: unpack -> render every frame -> pack

#

else you'll have a single-frame gif

crystal wigeon
#

@quartz kindle

tardy hornet
#

so how do i do that?

lyric mountain
#

no easy way

#

become familiar with canvas and procedural image manipulation

crystal wigeon
quartz kindle
crystal wigeon
#

just basic client.login

lyric mountain
#

gifs aren't easy nor straightforward

crystal wigeon
#
const discord = require("discord.js"),
client = new discord.Client({
  partials: ["MESSAGE", "REACTION", "CHANNEL"],
});

client.on("ready", () => {
    console.log("bot ready")
})

client.login(process.env.DISCORD_TEST_BOT)```
#

this it

quartz kindle
#

thats normal

crystal wigeon
#

and i spin this up with shard

#

so it logs in twice?

quartz kindle
#

once for each shard

#

if you have 2 shards it logs two ready events

opal plank
#

you should use once()

#

thats exactly what its for

quartz kindle
#

not in this case lol

opal plank
#

wait really?

crystal wigeon
#

ok so

quartz kindle
#

client.once() will still log twice for two shards

opal plank
#

i thought it was meant to only trigger once

crystal wigeon
#

yeah and my commands are getting executed twice for 2 shards

quartz kindle
#

yes

#

it triggers once

opal plank
#

PER?

quartz kindle
#

per process

opal plank
#

gotcha

quartz kindle
#

or rather

crystal wigeon
#

so how do i add commands now then?

quartz kindle
#

per instance of the client

crystal wigeon
#

like

#

2 shards

lyric mountain
#

2 shards mean the server count will be divided by 2

quartz kindle
lyric mountain
#

each half to a shard

tired panther
quartz kindle
#

thats not possible

#

unless you screwed up something

lyric mountain
#

4 shards: ok
output twice: creating the client twice

crystal wigeon
#

tim check DM if you dont mind

quartz kindle
lyric mountain
#

if shards were the issue you'd get 4 replies instead of 2

quartz kindle
#

how many guilds is your bot in?

lyric mountain
#

Shard 0, Shard 0, Shard 0

#

all the same shard

tired panther
#

yes

lyric mountain
#

multiple instances

tired panther
#

thats the problem

quartz kindle
#

what does handle.status do?

quartz kindle
tired panther
lyric mountain
#

are you really mad at her pointing that your libs arent useful?

tired panther
slender thistle
#

Poor Erwin turned into a girl from all the beer he stole from me

crystal wigeon
opal plank
quartz kindle
#

and show the results

crystal wigeon
#

250

lyric mountain
#

because people

quartz kindle
tired panther
# lyric mountain because people

do , yes Ik, but when the people come to you and say "That helped me to learn data storing" that is something different. As just downloading it.

lyric mountain
#

how would a lib teach about data storing?

slender thistle
#

What lib is even being argued this time

rocky hearth
#

What does this refers to, in a static method of an abstract class in js? The global?

tired panther
lyric mountain
#

dot dot dot

tired panther
opal plank
quartz kindle
crystal wigeon
#
const discord = require("discord.js"),
client = new discord.Client({
  partials: ["MESSAGE", "REACTION", "CHANNEL"],
});

client.on("ready", () => {
    console.log("bot ready", client.guilds.cache.size)
})

client.login(process.env.DISCORD_BOT_TOKEN)```
slender thistle
#

Nice, avoided my question

lyric mountain
#

shivaco feels

tired panther
quartz kindle
#

roughly half the guilds on each shard

crystal wigeon
#

yeah so what changes do i need to do for my commands?

opal plank
quartz kindle
#

do some basic command

crystal wigeon
#

like why are my commands being execuited by both shards

quartz kindle
#

like client.on("message", message => { if(message.content === ".ping") message.reply("pong") })

lyric mountain
#

if each shard is executing it, both commands will have a different id sent

quartz kindle
#

sure

slender thistle
#

How is data storing even related to that

#

Like

timber fractal
slender thistle
#

What...

#

I don't understand JS people generally

crystal wigeon
#

ok so

#

the command seems to replying once

quartz kindle
tired panther
crystal wigeon
#

even when both shards are online

opal plank
lyric mountain
slender thistle
#

Glad I rolled with Python because at least people make sense in that community

quartz kindle
#

now add your bot code back, by pieces

#

see which piece causes the mess

crystal wigeon
#

ok so i'll try my best to explain my handler, so first i search for commands from a diff file and then execute that function which is in another file

quartz kindle
#

can you show code?

lyric mountain
tired panther
crystal wigeon
#

check DM pls

#

😄

#

@quartz kindle

small mason
#

I want to ask why the invite in the analytic page is decreased, yesterday is 24, in the morning is 23, now is 22?

opal plank
lyric mountain
#

like, as everything else in the market

slender thistle
timber fractal
small mason
tired panther
slender thistle
#

I just had a stroke trying to read that

opal plank
#

once again, WHY PUBLISH it?

tired panther
opal plank
#

if you coded that for someone, why not send them?

tired panther
slender thistle
#

People use useless shit because they are lazy and don't want to learn

opal plank
#

why do you publish a purposefully bad package for the general people to use?

timber fractal
tired panther
#

or edit the existing one

#

will work too

timber fractal
tired panther
timber fractal
quartz kindle
timber fractal
#

but i already added my own ip

tired panther
#

you could whitelist all ips

timber fractal
#

good idea

#

they dont have my password

tired panther
#

add 0.0.0.0/0

quartz kindle
#

bad idea lol

timber fractal
tired panther
timber fractal
lyric mountain
quartz kindle
#

well you do you

tired panther
lyric mountain
opal plank
#

1234567890.... is not the best pass

lyric mountain
#

sometimes a 10-char pass can be harder to crack than a 100-char one

opal plank
#

just gen a hash key, good luck passing that

tired panther
quartz kindle
#

@opal plank btw, 4 million Map entries with a key roughly the size of a guild id and a 1 letter value took 400mb ram

timber fractal
lyric mountain
#

wait, xkcd has a meme for that

timber fractal
#

F

#

I SAID MY PASSWORD

#

no i did not

tired panther
timber fractal
#

im just kidding lol

lyric mountain
tired panther
#

lol

quartz kindle
opal plank
#

absolutely correct

quartz kindle
#

and no way in hell you're gonna have 4 million guilds in the same process

opal plank
#

2500 maximum

quartz kindle
#

imagine 4k shards

opal plank
#

that brings me some flashbacks ngl

#

some big vietnam flashbacks

tired panther
#

lol, rhtym has 13 000 000 glds

quartz kindle
#

erwin has ptsd from twitch

lyric mountain
crystal wigeon
#

so @quartz kindle , i have the dbl think also which needs client to get the users, so shards kinda crashes when addr is already in use

tired panther
crystal wigeon
#

i cant move the dbl server outside of client

opal plank
tired panther
quartz kindle
tired panther
crystal wigeon
#

Ah

#

so the second shard

opal plank
#

of course not, im already verified on twitch

crystal wigeon
#

wont call it

#

gotcha

opal plank
quartz kindle
#
if(client.shard.ids.includes(0)) {
  dbl code here
}
crystal wigeon
#

thanks a lot!! will try it out

opal plank
#

my bot got verification on twitch before it did on discord

#

even though it started as a discord bot

earnest phoenix
#

twitch knows youll ddos them if they dont verify

tired panther
#

lol

opal plank
#

i explicitly stated i was testing my twitch library

#

and that was my own sharder

#

there isnt a twitch wrapper available with caching nor sharding

pale vessel
#

l.t learn first

opal plank
#

this means any twitch bot you ever try to make will start to fail at around 150-200 channels

quartz kindle
#

erwin i think im gonna use ts for my api v2

#

hope u happy

opal plank
#

if you need help let me know

quartz kindle
#

i stll need to finish this goddamned lib

opal plank
#

finally tim is coming to the dark side of developing

pale vessel
quartz kindle
#

with 90 functions

#

in c++

#

because my api directly depends on it

opal plank
#

well im just waiting for you to tell me so i can write the delcarations

#

¯_(ツ)_/¯

tired panther
#

Do you both do jobs as dev? or are u just hobby dev?

quartz kindle
#

soon™️

opal plank
#

i do have a job

quartz kindle
#

its gonna be easy for you tho

#

i'll give you an example

restive furnace
opal plank
#

declarations are easy, i can make it fancy too

quartz kindle
#
#include <sweph.h>

static std::vector<std::pair<int, std::string>> args = {
    { 4, "Expecting 4 arguments: tjd_ut, geolat, geolon, hsys" },
    { number, "Argument 1 should be a number - julian day in universal time" },
    { number, "Argument 2 should be a number - geographic latitude in degrees" },
    { number, "Argument 3 should be a number - geographic longitude in degrees" },
    { string, "Argument 4 should be a string - house system ID" }
};

Napi::Value sweph_houses(const Napi::CallbackInfo& info) {
    Napi::Env env = info.Env();
    if(!sweph_type_check(args, info)) {
        return env.Null();
    }
    double cusps [37];
    double points [10];
    char sys = info[3].As<Napi::String>().Utf8Value()[0];
    int flag = swe_houses(
        info[0].As<Napi::Number>().DoubleValue(),
        info[1].As<Napi::Number>().DoubleValue(),
        info[2].As<Napi::Number>().DoubleValue(),
        int(sys),
        cusps,
        points
    );
    Napi::Array c1 = Napi::Array::New(env);
    Napi::Array p1 = Napi::Array::New(env);
    for(int i = 1; i < (sys == 'G' ? 37 : 13); i++) {
        c1[i] = Napi::Number::New(env, cusps[i]);
    }
    for(int i = 0; i < 8; i++) {
        p1[i] = Napi::Number::New(env, points[i]);
    }
    Napi::Object data = Napi::Object::New(env);
    data["houses"] = c1;
    data["points"] = p1;
    Napi::Object obj = Napi::Object::New(env);
    obj["flag"] = flag;
    obj["data"] = data;
    return obj;
}
``` this is one of the 90 functions
#

you basically just need this

opal plank
#

i cant assure integrity though tim, i might put one or two Raid Shadow Legend ads in the docs though mmulu

quartz kindle
#
    obj["flag"] = flag;
    obj["data"] = data;
    return obj; ```
earnest phoenix
#

timotej roiko

quartz kindle
#

which means, a js object with a flag field and a data field

earnest phoenix
#

your name is rojko tho

quartz kindle
#

and the data field is another js object

earnest phoenix
#

why did you misspell on your repl username

opal plank
quartz kindle
opal plank
#

why did that not embed?

#

oh, there we go

quartz kindle
#

yes

lyric mountain
#

raid would be one hell of a movie

earnest phoenix
#

i have a question

lyric mountain
#

uh, apple-question

earnest phoenix
#

since react elements are just objects is it possible to save an element to a variable and modify it later?

opal plank
quartz kindle
#

i have an apple

opal plank
#

applepen

earnest phoenix
#

I have a doctor

earnest phoenix
#

He is absolutely mortified of the apple

earnest phoenix
tired panther
#

\👀

lyric mountain
#

but yes, you can save them as objects

lyric mountain
quartz kindle
#

stupid c++ doesnt have array conversions

#

so i have to do this everywhere

#
    Napi::Array asc1 = Napi::Array::New(env);
    Napi::Array dsc1 = Napi::Array::New(env);
    Napi::Array per1 = Napi::Array::New(env);
    Napi::Array aph1 = Napi::Array::New(env);
    for(int i = 0; i < 6; i++) {
        asc1[i] = Napi::Number::New(env, asc[i]);
    }
    for(int i = 0; i < 6; i++) {
        dsc1[i] = Napi::Number::New(env, dsc[i]);
    }
    for(int i = 0; i < 6; i++) {
        per1[i] = Napi::Number::New(env, per[i]);
    }
    for(int i = 0; i < 6; i++) {
        aph1[i] = Napi::Number::New(env, aph[i]);
    }
opal plank
#

wait what

#

you can do that?

quartz kindle
#

basically remapping a double array to a js array

opal plank
#

oh

#

nvm

#

i almost got scared there

lyric mountain
opal plank
#

i thought you were doing asc[i] = Napi::Number::New(env, asc[i]);

earnest phoenix
#

@lyric mountain ok

opal plank
#

was about to ask how the fuck you getting element before declaration

quartz kindle
#

xD

opal plank
#

sneeeky 1

quartz kindle
#

this is the full thing (well not the full thing but the gist of it)

#
    double asc [6];
    double dsc [6];
    double per [6];
    double aph [6];
    char serr [SE_MAX_STNAME];
    int flag = swe_nod_aps_ut(
        info[0].As<Napi::Number>().DoubleValue(),
        info[1].As<Napi::Number>().Int32Value(),
        info[2].As<Napi::Number>().Int32Value(),
        info[3].As<Napi::Number>().Int32Value(),
        asc,
        dsc,
        per,
        aph,
        serr
    );
    Napi::Array asc1 = Napi::Array::New(env);
    Napi::Array dsc1 = Napi::Array::New(env);
    Napi::Array per1 = Napi::Array::New(env);
    Napi::Array aph1 = Napi::Array::New(env);
    for(int i = 0; i < 6; i++) {
        asc1[i] = Napi::Number::New(env, asc[i]);
    }
    for(int i = 0; i < 6; i++) {
        dsc1[i] = Napi::Number::New(env, dsc[i]);
    }
    for(int i = 0; i < 6; i++) {
        per1[i] = Napi::Number::New(env, per[i]);
    }
    for(int i = 0; i < 6; i++) {
        aph1[i] = Napi::Number::New(env, aph[i]);
    }
#

ugly af init?

opal plank
#

seen worse

#

idk what double keyword does though

slender thistle
#

I strongly hope I'll never have to do CPP

opal plank
#

i will have to do it

slender thistle
#

Come here, let me give you a hug

opal plank
#

i know a bit of it, cuz i've used some hacky code in the past, but im a complete noob

opal plank
lyric mountain
#

double the bytes of a float

slender thistle
opal plank
#

oh i see

quartz kindle
#

double precision float

opal plank
#

specially cuz i need to make my own app soon, so i might wanna get into cpp

earnest phoenix
#

im making minecraft commands generator for bedrock so my nooby friends dont have to pull their hair out

lyric mountain
#

like, cpp is ugly? yeah it is
but is it easy? no

opal plank
#

as soon as im done with this genshin bot i'll hop into cpp

#

gotta learn cpp, rust and then frontend

quartz kindle
#

this lib is so annoying because it has a bunch of functions with multiple outputs, so you have arguments for input, then reference arguments for outputs, plus the return value of the function

earnest phoenix
quartz kindle
#

imagine if you had to do this in js

opal plank
#

API devs hate you, with this one little trick

#

imagine not having consistent outputs

quartz kindle
#
let result;
something(input,result);
console.log(result)
earnest phoenix
quartz kindle
#

more specifically

lyric mountain
#

two things I hate about cpp is how it use pointers and how arrays are read-only

opal plank
earnest phoenix
#

arrays are read only? 🤮

opal plank
#

i might need to cast it in code

quartz kindle
#
let result;
let error;
let status = something(input, result, error);
if(error) throw new Error(error);
return { status, result }
``` thats basically how these cpp functions work
lyric mountain
#

theres std::vector which is basically normal arrays in any other lib

#

but normal arrays in cpp are...weird

opal plank
#
function test(input, result) {
result = input++
}
test(input:any, result:any) => result as [output]

That might do the trick, but holy shit thats a dumb way to do it

earnest phoenix
#

when tim adds a comma for no reason smth's off

tardy hornet
#
case 'coin':
    const { createCanvas, loadImage } = require("canvas")  
        var imageW = 600;
        var imageH = 600;
        const killCanvas = createCanvas(imageW, imageH);
     const ctx = killCanvas.getContext("2d");
     var amongKill = await  loadImage("https://i.imgur.com/g1cdZ9U.png")
     ctx.drawImage(amongKill, 0, 0, imageW, imageH);
     var imageW2 = 250;
        var imageH2 = 250;
    
    var secondMemberPP = await loadImage(message.author.displayAvatarURL({format: "png", dynamic: true}))
        ctx.drawImage(secondMemberPP, 175,170, imageW2, imageH2);


    
    const attachment = new Discord.MessageAttachment(killCanvas.toBuffer(), 'kill.png');

        const killf = new Discord.MessageEmbed()
        .attachFiles(attachment)
        .setImage("attachment://kill.png") 
        .setColor("RED")
        if(!args[1]) return message.channel.send(killf)
        const opponentcoin = message.mentions.users.first();
            if ( !opponentcoin ) {
              var imageW3 = 600;
              var imageH3 = 600;
              const killCanvas2 = createCanvas(imageW3, imageH3);
           const ctx2 = killCanvas2.getContext("2d");
           var amongKill2 = await  loadImage("https://i.imgur.com/g1cdZ9U.png")
           ctx2.drawImage(amongKill2, 0, 0, imageW3, imageH3);
           var imageW4 = 250;
              var imageH4 = 250;
          
          var secondMemberPP2 = await loadImage(opponentcoin.displayAvatarURL({format: "png", dynamic: true}))
              ctx2.drawImage(secondMemberPP2, 175,170, imageW4, imageH4);
      
      
          
          const attachment2 = new Discord.MessageAttachment(killCanvas2.toBuffer(), 'kill.png');
          const killf2 = new Discord.MessageEmbed()
          .attachFiles(attachment2)
          .setImage("attachment://kill.png") 
          .setColor("RED")
          message.channel.send(killf2)
            }
        break;
#

works if i dont mention, if i do, it returns the error that displayAvatarURL is undefined

tardy hornet
#

E

opal plank
#

let/const

#

var creates more bugs than not

tired panther
#

let \👼

quartz kindle
opal plank
quartz kindle
#

cpp bs stays in cpp

opal plank
#

🙏

quartz kindle
#

the js side will just output { status, error, result } as an object

#

and let the user handle the error

lyric mountain
#

cpp is like minecraft harcore survival

#

you can build anything

opal plank
#

oh, then its fine

quartz kindle
#

type errors will be thrown tho

#

but cpp handles that

lyric mountain
#

but one punch and you're dead

opal plank
#

cpp do be like that

#

which is good i guess?

#

forces people do to actual good code

quartz kindle
#

i have to type check every single argument

#

some functions have like 7 arguments

#

or more

opal plank
#

my complexity is QUITE high too

#

cuz of shit like that

#

complexity up the roof

#

my genshin bot estimated at 400k

quartz kindle
#

xD

opal plank
quartz kindle
#

jesus christ

#

im currently reworking all of the 90 functions

#

so i can stop doing this bs

#
    if(info.Length() < 6) {
        Napi::TypeError::New(env, "Expecting 6 arguments").ThrowAsJavaScriptException();
        return env.Null();
    }
    if(!info[0].IsNumber()) {
        Napi::TypeError::New(env, "Argument 1 should be a number").ThrowAsJavaScriptException();
        return env.Null();
    }
    if(!info[1].IsNumber()) {
        Napi::TypeError::New(env, "Argument 2 should be a number").ThrowAsJavaScriptException();
        return env.Null();
    }
    if(!info[2].IsNumber()) {
        Napi::TypeError::New(env, "Argument 3 should be a number").ThrowAsJavaScriptException();
        return env.Null();
    }
    if(!info[3].IsNumber()) {
        Napi::TypeError::New(env, "Argument 4 should be a number").ThrowAsJavaScriptException();
        return env.Null();
    }
    if(!info[4].IsNumber()) {
        Napi::TypeError::New(env, "Argument 5 should be a number").ThrowAsJavaScriptException();
        return env.Null();
    }
    if(!info[5].IsNumber()) {
        Napi::TypeError::New(env, "Argument 6 should be a number").ThrowAsJavaScriptException();
        return env.Null();
    }
opal plank
#

lmao

#

i mean fair

lyric mountain
opal plank
#

i tweaked it a little bit, but you should be able to get similar info with it

tired panther
#

I have no idea, what to could at next, after erwin Critics. I will not create a npm libary. Any Idea what you would suggest?

lyric mountain
#

scheme2c?

lyric mountain
#

it's not that ur lib is bad, it's just that it's really unnecessary

opal plank
#

what i got mad wasnt about doing bad code mesiter, @crimson vapor can tell you the same thing i told em, i dont want to disencourage you to code, but i do highly disagree with publishing bad packages. Npm is a mess polluted with bad libs, adding more is not contributing whatsoever. By all means, please, DO code, but do not publish it if you dont intent to put effort into it

#

the usually guides i follow are:
does it exist? no => make one
yes => is mine better or a competitor for the other ones?:
no => dont make it
yes=> make it

crimson vapor
#

I agree

quartz kindle
#

i disagree with the first one

tired panther
quartz kindle
#

does isFourteen exist? no? make one

tired panther
#

lol "mesiter" , meister xD

opal plank
#

and thats another key

tired panther
tired panther
opal plank
#

npm is public, and you can install directly from github, just give your friend access to your repo

#

theres absolutely no need whatsoever for it to be on npm

quartz kindle
#

if your repo is public, you dont need any special access or permission

cinder patio
#

Imagine including compiled javascript in a ts repo though

earnest phoenix
#

replit fucked up and i lost the entire contents of a biggo file :(

quartz kindle
#

npm install meister03/discord-error-handler

opal plank
#

i explained why

opal plank
#

im NOT forcing my users to transpile their code

#

js users should NOT be required to use ts to transpile shit for themselves

lyric mountain
cinder patio
#

you put the compiled js on npm, typescript on github

lyric mountain
#

guess I have a million-dollar project on hands

restive furnace
quartz kindle
#

holy

slim umbra
#

are u working w that rust shit

opal plank
#

i'd rather bundle

earnest phoenix
quartz kindle
#

let me download that

tired panther
opal plank
#

have /lib be send as well as /dist with the transpiled code

opal plank
#

like @umbral zealot with his guides

#

your is a patch

#

its just spoonfeeding a user

#

that teaches them nothing, other than create a dependncy on ur lib

pale vessel
cinder patio
#

but it just makes things messy, nobody benefits from the transpiled code being on github as well. It's not like people who don't know typescript can contribute, because then the codebases won't be in sync

opal plank
#

the js is always up to the ts cuz they are transpiled before being published

quartz kindle
#

wait

opal plank
#

if i were to merge someoens commit i'd transpile it after they changed the ts files

quartz kindle
#

does scc include node_modules?

opal plank
#

you gotta exclude it

quartz kindle
#

so thats bad lol

#

lmao

lyric mountain
#

43 million dollar

#

lul

opal plank
#

the js there is only transpiled ready for usage, not to be changed in commits

tired panther
lyric mountain
opal plank
tired panther
tired panther
opal plank
#

your lib is quite small, tis one file, why not convert that into a guide snippet like discord js guide?

tired panther
opal plank
#

how come?

tired panther
#

npm was the only channel to comunicate with my end users. all starter dev will go to a big server and they will provide them nearly no help xD.

lyric mountain
#

there's github...

#

imagine npm is a market

tired panther
opal plank
lyric mountain
#

with tons of fruits being sold

tired panther
quartz kindle
#

damn, my FTSet lib would cost 28k and take 3 months

opal plank
#

or link a guide right at the beggining

cinder patio
lyric mountain
quartz kindle
#

estimated people required 0.7

#

lmao

tired panther
#

0,7 ppl required lol

#

thinking the same lol

earnest phoenix
#

lol

quartz kindle
#

discord.js-light

earnest phoenix
#

hey tim does discordjs light support light mode?

#

i hope it doesnt

tired panther
lyric mountain
#

imagine using light mode terminal

tired panther
#

and how do they calculate it?

lyric mountain
quartz kindle
#

the c++ lib

opal plank
quartz kindle
#

ah but it includes the original C source that is not mine

#

how to ignore it

tired panther
#

@quartz kindle could u check https://github.com/meister03/mongodb-reaction-role

lyric mountain
#

oh no whole code

tired panther
lyric mountain
#

I mean, not the source code, just the "whole code" part of readme

#

that's dangerous

#

and copy-ready

cinder patio
opal plank
#

i could take that in consideration, there hasnt been a refactor yet

#

this would be the refactored code

quartz kindle
#

there, without the original C lib

opal plank
#

hehe, mine is still at 400K

tired panther
opal plank
#

a working computer

#

thats about it

quartz kindle
#

my bot

opal plank
#

that json isnt from the package depencies btw, i do have json stored locally

quartz kindle
lyric mountain
quartz kindle
#

--exclude-dir dir1 dir2 dir3

tired panther
#

what, that does not makes any sense djs-light just required 0,7 worker , erwin requires 2 workers lol

lyric mountain
#

oh nice

quartz kindle
#

i removed the api portion of the bot tho

tired panther
opal plank
#

what workers?

quartz kindle
#

so i need to add the api code

opal plank
#

you mean people required?

quartz kindle
#

so bot + api = 260k

#

not bad

opal plank
#

mine actually only took 2 ish months to be done

quartz kindle
#

erwin only wins because of typings and jsdoc

#

:^)

opal plank
#

wdym typings

tired panther
#

lol

opal plank
#

you REALLY think im adding typings to my PRIVATE bot?

#

that quadruple if i were tim

tired panther
#

same xD

quartz kindle
#

lmao

lyric mountain
quartz kindle
#

LOL

opal plank
#

lul

earnest phoenix
#

lel

opal plank
#

i work the same as 4 people combined, and 4x faster

earnest phoenix
#

does djs have slash commands yet?

opal plank
royal herald
lyric mountain
#

did scc only on the src folder

quartz kindle
#

lmao

opal plank
#

thats a whole lot of lines

#

8k comments though

lyric mountain
#

I don't comment at all lul

opal plank
#

and you somehow managed to get higher complexity than mine

lyric mountain
#

game frameworks

opal plank
#

congratulations, i was already being ostricized for having 1k

quartz kindle
#

do you have third party source files?

lyric mountain
#

nope, not at the source code

#

src contains only my code

quartz kindle
#

so you wrote 471 files all by yourself?

lyric mountain
#

third-party is stored at gradle file

quartz kindle
#

impressive

lyric mountain
#

and commands ofc

lyric mountain
#

lul

opal plank
#

should've censored the pfp too now that i think bout it

zenith terrace
quartz kindle
#

no pls

zenith terrace
#

gimme one good reason why not to

opal plank
#

i wonder if you can do multiples

lyric mountain
#

multiples?

opal plank
#

--exclude-* --include-Tim

quartz kindle
#

wanna scc your entire projects folder?

opal plank
#

actually

#

thats redundant af

lyric mountain
opal plank
#

i think you can use include to target specific no?

#

wanna see my whole thing?

quartz kindle
#

my stuff is all split around and disorganized lmao

lyric mountain
quartz kindle
#

yup

opal plank
quartz kindle
#

xDD

opal plank
#

beat that scrubs

lyric mountain
#

lul

quartz kindle
#

my projects folder is 7gb

lyric mountain
#

what's Handlebars?

quartz kindle
#

and includes a shit ton of random non-code stuff

quartz kindle
opal plank
#

sendGrid iirc

lyric mountain
#

ah

pale vessel
quartz kindle
#

your bot?

pale vessel
#

Yeah

quartz kindle
#

nice complexity

opal plank
#

mine still winning? wtf

#

its a 2 month old bot ffs

quartz kindle
#

lmao

#

because you're insane

opal plank
#

technically 1 and a half, but who's counting

#

actually, let me check

lyric mountain
#

there she goes to count it

quartz kindle
opal plank
#

well..... technically less

#

2 months

#

so yeah, 2 month old

lyric mountain
#

lemme see my lib

opal plank
#

with 800 servers basically

cinder patio
#

does scc exclude node_modules by default?

opal plank
#

dont think so, no

earnest phoenix
#

Wait a minute, what package does that scc command belong to?

quartz kindle
opal plank
#

^^

lyric mountain
tired panther
#

@lyric mountain what happens when u try just console.log("hello") ?

quartz kindle
#

my best lib

#

small libs are best

opal plank
#

hahah 12k, smol boi

tired panther
opal plank
#

no you dont

quartz kindle
#

half of that is benchmarks code

tired panther
opal plank
#

im running it on windows

quartz kindle
#

and that pricing is unrealistic af

tired panther
opal plank
#

shhhh

quartz kindle
#

if i were to code this lib for someone, i would be paid like 500 bucks

opal plank
lyric mountain
quartz kindle
#

thats reality

tired panther
opal plank
#

its like comparing pp sizes, unrealistic but fun, read the room @quartz kindle

tired panther
opal plank
#

you dont install it

#

you run it

opal plank
#

its a package

#

run with powershell or bash

quartz kindle
cinder patio
tired panther
#

ah , I do not have to download it?

opal plank
opal plank
cinder patio
#

I did --exclude-dir node_modules

opal plank
#

is there any other dependencies inside?

cinder patio
#

oh yeah there is one

opal plank
#

dashboard maybe?

tired panther
cinder patio
#

blockly

opal plank
cinder patio
#

this is like a one year old project I forgot everything about it rip

tired panther
lusty quest
#

is it bad if SCC is taking long?

opal plank
#

that explains why tis big

quartz kindle
opal plank
lusty quest
#

one of my bots

opal plank
#

thats 100% taking module folder

tired panther
#

lol

lyric mountain
#

exclude node_modules lul

quartz kindle
#

with C files

cinder patio
#

did you exclude the node_modules folder

quartz kindle
#

lul

opal plank
#

Protocol Buffers

#

lmao

lusty quest
#

nah its this high mostly bcs of the Tensorflow Module i guess

cinder patio
#

--exclude-dir node_modules

quartz kindle
#

if you have a .gitignore file in the folder where you run the command, it will auto pick it up and ignore everything in it

lyric mountain
#

really?

cinder patio
#

oo

slender thistle
#

Can you gitignore gitignore?

opal plank
#

nah, you can create a shortcut for trash bin and then put the original inside of it

#

that'd create a singularity

lusty quest
#

now the bot is worth 56$

lyric mountain
#

imagine gitignoring your source code except the modules folder

opal plank
#

56 mil or 56 dollars? mmulu

quartz kindle
#

56k likely

lusty quest
#

56$

quartz kindle
#

56 dollars?

lyric mountain
#

lul

tired panther
#

I downloaded the repo, what do I do at next @opal plank ?

opal plank
#

you dont download the repo

lusty quest
opal plank
#

you download frmo their release page

quartz kindle
#

so

lyric mountain
quartz kindle
#

56k

opal plank
#

thats 56k my dud

quartz kindle
#

lmao

lusty quest
#

are you sure?

opal plank
#

so im second after feud?

#

not bad, i'll take the crown

lusty quest
#

bcs for me would be 65k if it would be spaced with a . not a ,

opal plank
quartz kindle
#

yes because if this is 300 million

#

then that is 56k

lusty quest
#

wired

#

why?

#

took me like 2 days

cinder patio
#

the --exclude-dir flag doesn't work

quartz kindle
#

it works for me

lusty quest
#

works for me

opal plank
#

same for me

cinder patio
#

I'm trying to exclude blockly but it doesn't work

opal plank
#

add to gitnore then

tired panther
#

nah that is to much work lol

opal plank
#

let it auto pickup

quartz kindle
#

i dont get it either

opal plank
#

one to download

#

one to open cmd

#

and then a command to run

quartz kindle
#

another thing

#

this cant account for code difficulty

lusty quest
quartz kindle
#

not sure what they mean by code complexity, but it probably only takes into considerations the number of lines and tabs and nesting

tired panther
lusty quest
quartz kindle
#

this is the hardest thing i ever worked on and it has the lowest value

tired panther
pale vessel
#

no

#

/releases

opal plank
lusty quest
#

compile it yourself or get a release

tired panther
earnest phoenix
#

Uh what’s with the quality?

opal plank
#

what quality?

earnest phoenix
#

The gif

opal plank
#

my gif is in 1366x768

#

if you getting lower res its on you

#

open the gif on the browser if your discord is compressing it

quartz kindle
#

unless they're viewing it on a phone

tired panther
#

lol, the quality was high

opal plank
#

or that

quartz kindle
#

opening images and gifs in discord mobile its horrible

opal plank
#

i would record on my other screen, but its in 4k, i dont even wanna think about how big it is to send it

#

but then again

tired panther
opal plank
#

gigabit internet

cinder patio
#

scc --exclude-dir website/client/public/scripts/blockly/
Either I'm going crazy or somehow it's not including blockly by default

tired panther
#

ah good hidden

#

and then extract it?