#development

1 messages · Page 128 of 1

hushed robin
#

look above bruh

civic scroll
#

that code may not be isolated

hushed robin
#

wym

civic scroll
#

again, only way is to debug

#

know what it actually does saves time

hushed robin
#

idk how to use debug

#

it's complex

civic scroll
#

if you don't know debugging, this is a good time to learn it

civic scroll
hushed robin
#

when i try debugging

#

it like turns on

#

then off instantly

civic scroll
#

nothing in console?

hushed robin
#

what console

civic scroll
#

by default it debugs only current file

#

go to your program's entry point and run debug there

hushed robin
#

oh

#

it worked

#

not sure what this means

civic scroll
#

that is the value of the variable

#

hit f5 to continue execution

#

observe on the left to see what changes

#

or you can use the watch tab

hushed robin
#

?

#

what am i obersving

hushed robin
#

it's empty

civic scroll
#

enter xp.ranks in the expression to track its value

#

see if the array gets modified

hushed robin
#

i don't

civic scroll
#

when it pauses at this staement, look at the console, see if they do get duplicated

hushed robin
#

how am i suppose to track this

#

it happens instantly

#

my code is not slow

civic scroll
civic scroll
hushed robin
#

yes

#

i did insert the breakpoints

#

i watched it

#

nothing happens

civic scroll
#

just tap f5 and watch how many times it hits console.log(rank)

hushed robin
#

how tho

#

i don't see the console logs

civic scroll
#

did you open the debug console tab?

hushed robin
#

yeah

#

it doesnt log them

civic scroll
#

then check your terminal's console

hushed robin
#

nothing happens there

civic scroll
#

oh i see

#

hit f5 once more

#

it should log

#

you paused right before the log call

hushed robin
#

ok i see

#

there's 4 logs

#

like the last two are the same

#

as before

civic scroll
#

so it's happening within the function

hushed robin
hushed robin
#

i said that awhole ago

#

awhile

#

i just don't know whats causing it

civic scroll
#

there is no jump statement

hushed robin
#

what is jump

civic scroll
#

so it could be something messing with the iterator, aka xp.rank

civic scroll
hushed robin
#

there is a break

civic scroll
#

even that

#

that break should only escape the inner for loop

#

and does not affect the outer one

#

what could triggered a re-iteration of the last item hmm

#

hang on i have an exam now

hushed robin
#

bye

#

i will continue trying to fix this

civic scroll
#

@wheat mesa, @earnest phoenix if you have time, look at this
the last item of xp.rank gets iterated twice, there is no sign of the iterator being modified and the bug happened within the function

#

could be Array.prototype modification but that's very unlikely

hushed robin
#

i mean i think my code works but thats a weird issue

dusk sequoia
#

anyone can suggest me great hosting ? vps

neon leaf
#

yes

rustic scarab
compact pier
#

should I hash the data that being sended to client and then the client dehash it?

rustic nova
#

Please don't say hash and dehash

#

You can't dehash something

#

At least not easily

#

Are you perhaps referring to encrypting?

sharp geyser
#

always encrypt data being sent over the internet

rustic nova
#

Depending on how it's sent, through browsers that's mostly done by https if used

quartz kindle
#

yes, "hash" and "dehash" with base64 :^)

sharp geyser
#

hey tim

quartz kindle
#

hey

#

hows your starmie doing

sharp geyser
#

starmie?

quartz kindle
sharp geyser
#

dk what that is

#

only know its a pokemon

quartz kindle
#

its a pokemon that belongs to this girl

#

her name is Misty

#

@_@

rustic nova
#

Tim weeb

sharp geyser
#

I know nothing about pokemon

quartz kindle
rustic nova
#

Funny

sharp geyser
#

So who knows anything about embedded systems?

quartz kindle
#

be more specific maybe?

#

miss pokemon trainer that knows nothing about pokemon

sharp geyser
#

More wondering how I am supposed to run a machine learning thing on a microcontroller or how to make use of a ML model on a microcontroller

#

tbh I don't know much about any of this so if anyone has articles or videos they know of please link sad_pepe

neon leaf
#

whats the maximum offset I should accept when handling 2fa codes?

#

currently I have it at 5min

frosty gale
#

fuck it

frosty gale
#

its optimised to run on limited hardware like risc arm (theres probably also a fork which is specifically optimised for your microcontroller)

earnest phoenix
hushed robin
#

hi development

#

how r u

hushed robin
frosty gale
#

but its ok

earnest phoenix
hushed robin
frozen tusk
#

i am having a problem with using slash command for my bot anyone can help or guide me please?

#

i am not able to see my bots pfp when i type "/"

hushed robin
#

happens to me sometimes too

frozen tusk
#

Ok

surreal sage
#

what is this guy doing

deft wolf
#

Hm?

wheat mesa
#

Definitely an interesting snippet but nothing is functionally wrong with it, which is a plus

quartz kindle
wicked pivot
#
const configuration = {
    type: 'line',
    data: {
      labels: dataSort.map((d) => moment(d.unix_timestamp * 1000).format('DD/MM/YYYY')),
      datasets: [{
        label: 'Guilds',
        data: dataSort.map((d) => d.server_count),
        backgroundColor: 'rgba(54, 162, 235, 0.6)',
        borderColor: 'rgba(54, 162, 235, 1)',
        borderWidth: 2,
        borderRaduis: 5,
        borderSkipped: false
      }]
    },
    options: {
      scales: {
        y: {
          beginAtZero: false
        }
      }
    }
  }```

I find this graph quite "ugly" is it possible to make the max number higher so that the lines go down a little?

chart.js
solemn latch
#

so like, you want the graph to go from 0 to 100? so it looks smaller?

rustic nova
#

there is a method in chartjs in your config or plugins called xAxis, which allows you to set a max value

#

setting that will expand the chart till that point, doesn't matter the values you have in it

rustic nova
#

seems old, sec

#

that one

wicked pivot
#

not working Daltons_ref

solemn latch
#

using suggested, or min/max directly?

wicked pivot
#

oh wait

#

i'm using an old version because I couldn't get it to work on one of the new versions

rustic nova
#

which version are you using

#

could check how that was in that version back then

#

still good to update nonetheless

wicked pivot
#

I'm just looking to update but I don't know what caused the problem.

#

well nothing I see, everything is up to date and it works haha ​​thank you

dusk sequoia
#

Anyone knows where can I get a year hosting for postgressqll?

#

I mean if there are free options also pls suggest

spark flint
#

most web hosts support postgres

#

so you can probably pick up some dirt cheap hosting

#

that would give you a panel to access it too

dusk sequoia
#

Hostinger?

spark flint
#

never hostinger

#

they overcharge

dusk sequoia
#

Then?

spark flint
#

i think https://railway.app does cheap postgres

Railway

Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.

dusk sequoia
#

What's the cost?

granite sun
#

Hello! I'm new with webhooks so do bear with me, I've set up a Flask app in Python and created a tunneling service(?) i'm not sure what it's called using ngrok. I'm using the forwarding url as the webhook url to pass through the test data and my Flask app is receiving it.

How do I trigger the event on my bot whenever I send the test data? Do I need to setup webhooks as well on my discord bot or is there a way that the topgg api can send that data directly to my bot without setting up webhooks on my bot?

spark flint
#

i think you can technically get it for free

#

lemme check

dusk sequoia
#

@spark flint where the option

lofty zephyr
#

Aaaaa

rustic nova
frosty gale
dusk sequoia
#

I'm not retired

#

@spark flint sir?

granite sun
# rustic nova there's a library for that otherwise, https://docs.top.gg/libraries/python/

I'm not entirely sure how to use the python library in this case, I already have installed the library on my discord bot. I copied the example on webhooks and changed .dbl_webhook("/dblwebhook", "password") to .dbl_webhook("/") because I don't have an authorization set on my bot's webhooks settings, and the route on my Flask app is set to it's root (hence only "/"). But I don't see the print(f"Received a vote:\n{data}") on my discord bot console

rustic nova
#

you need to set the authorization on the dbl_webhook

#

have you also set your publicly accessible url on your bot page webhook settings

granite sun
rustic nova
#

so that should work then?

granite sun
rustic nova
#

how can you tell the test data is actually received by your bot

#

also, can you show your whole function that has the print statement in it

#

because theres 2 types of functions that handle voting, one is the one that handles the actual votes, and then theres one that handles test votes coming in, which you need a separate case for

granite sun
rustic nova
#

yeah on test, seems fine

granite sun
rustic nova
#

where is it printing it out? do you have a separate route set on flask?

granite sun
rustic nova
#

are the routes the same or what have you done

granite sun
#

This is my whole flask app

rustic nova
#

is that running along with the library?

granite sun
rustic nova
#

ohh

#

yeah unsure then tbf

granite sun
#

Do i need to place the token somewhere too?

rustic nova
#

nah

granite sun
#

could it be because I have my client setup like this?

bot = commands.AutoShardedBot(shard=2,command_prefix="!", intents=discord.Intents.all())```
proven lantern
#

what do you think is a better format for recording match results.

Option 1

#1 @player1 @player2 #2 @player3 @player4

Option 2

@player1 and @player2 placed first, @player3 and @player4 placed second
quartz kindle
#

lmao

proven lantern
#

should i have different commands for recording 1v1, 2v2 etc?

quartz kindle
#

how about ```js
First Place:
@player1 @player2

Second Place:
@player3 @player4

proven lantern
#

and then optional third and forth and so on

quartz kindle
#

ye

proven lantern
#

hmmm

#

that could be nicer, but what about ties

quartz kindle
#

if its a tie, put everyone in second place

#

:^)

proven lantern
#

if it's an ffa with 3 people and two people tie

#

that's tricky

quartz kindle
#
First Place:
@player1

Second Place:
@player3 @player4
proven lantern
#

that's a 1v2

quartz kindle
#

or ```js
First Place:
@player1 @player2

Third Place:
@player3

proven lantern
#

how does it know if it's a team or people are drawing?

quartz kindle
#

can you have 1v2 teams?

proven lantern
#

yeah

#

juggernaut gametypes

quartz kindle
#

can players score individually even if they belong to the same team?

proven lantern
#

i have 5 different rating types. one is an individual player rating

#

Combined Team
Combined Player
Distinct Team
Distinct Player
Overall Player

quartz kindle
#

so when you score players individually, the team doesnt need to be factored in:

First Place (tie):
@player1 (team X)
@player2 (team Y)

Third Place:
@player3 (team X)
First Place:
@player1 (team X)

Second Place (tie):
@player3 (team X)
@player5 (team Y)
First Place (tie):
team X (@player1, @player2)
team Y (@player3)

Third Place:
team Z (@player9)
proven lantern
sharp geyser
proven lantern
#

a 1v1v1 is different than a 1v2

quartz kindle
#

or you prefer something more like this? ```js
team 1
#1 @player1
#4 @player2
#2 @player3

team 2
#3 @player4
#6 @player5
#5 @player6

proven lantern
quartz kindle
#

ye

#

like overall placements, but still separated by teams

proven lantern
#

i dont let that happen. same team gets the same placement

quartz kindle
#

then the third option from the previous ones

proven lantern
#

parens around the teams?

#

maybe have like 5 team inputs and 5 placement inputs. might be a bit more cumbersome for 1v1 gametypes though

#
team 1: @player1
team 2: @player2
placement 1st: team 1
placement 2nd: team 2
#

maybe the bot could ask if the user is recording an ffa match, or a team match first and then follow up

#

2v2

First Place:
(@player1, @player2)

Second Place:
(@player3, @player4)

2v2 tie

First Place:
(@player1, @player2) (@player3, @player4)

ffa with 2 ties

First Place:
@player1, @player2

Third Place:
@player3, @player4
frosty gale
#

but you should avoid using machine learning or try to get whatever you want processed done on another machine like through internet or something

#

although it is very fast but you need to pretrain the model on a desktop first

sharp geyser
#

Well with my project I can't really avoid ML

#

I'll likely just use websockets or something to relay data back and forth between the client (being the microcontroller) and the server.

#

Idk how well that would work performance wise

wheat mesa
#

with what you're building I don't see how you would do that given the issue of an internet connection

#

plus sending visual data like that is really expensive

#

you'd probably want to try to do the processing onboard, but idk much about this

sharp geyser
#

its an option, one I don't want to take

novel snow
#

Running into such an odd issue, spent a day or so trying to find the issue however I am clueless;

name: Could not interpret "{'name': 'axodouble-21', 'type': 'GUILD_TEXT', 'topic': 'ticket|244173330431737866', 'parent': '985654630652469318', 'permissionOverwrites': [{'id': {'guild': '750209335841390642', 'icon': None, 'unicodeEmoji': None, 'id': '750209335841390642', 'name': '@everyone', 'color': 0, 'hoist': False, 'rawPosition': 0, 'permissions': '109951162777600', 'managed': False, 'mentionable': False, 'tags': {}, 'createdTimestamp': 1598934243880}, 'deny': ['VIEW_CHANNEL']}, {'id': '818499512410701845', 'allow': ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'ATTACH_FILES']}, {'id': '244173330431737866', 'allow': ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'ATTACH_FILES']}]}" as string.
#
{'name': 'axodouble-21', 'type': 'GUILD_TEXT', 'topic': 'ticket|244173330431737866', 'parent': '985654630652469318', 'permissionOverwrites': [{'id': {'guild': '750209335841390642', 'icon': None, 'unicodeEmoji': None, 'id': '750209335841390642', 'name': '@everyone', 'color': 0, 'hoist': False, 'rawPosition': 0, 'permissions': '109951162777600', 'managed': False, 'mentionable': False, 'tags': {}, 'createdTimestamp': 1598934243880}, 'deny': ['VIEW_CHANNEL']}, {'id': '818499512410701845', 'allow': ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'ATTACH_FILES']}, {'id': '244173330431737866', 'allow': ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'ATTACH_FILES']}]}
#

And I have checked through, but only issue I have is that it cannot interpret the channel as a string, I am confused and honestly just lost.

quartz kindle
#

well

#

it says it cannot interpret the channel as a string

#

like, thats the full channel object

#

if you want the channel name, get the name from the object, dont pass the full channel object

novel snow
#

Oh my god

#

I am special

lyric mountain
#

/curseforge.*safe/gi

#

do note tho it'll match anything in-between too

rocky dagger
#

i have a command with a subcommand with an autocomplete string option but for some reason interaction.isAutocomplete is never becomes true in my interactionCreate file, i see there has been quite a few updates since last time i worked on djs so might be just some simple changes but cant seem to find out what

spark flint
#

read my username

frosty gale
#

@sharp geyser what microcontroller are you planning to run it on?

#

i heard tensorflow lite runs very well on raspberry pi/arduino (full ones) and can do video processing like classification and object detection

#

but really depends on hardware and capabilities like vector processing instructions

#

rpi and arduino are basically mini pcs tho so it kinda doesnt count

slender wagon
#

Heya guys so what am i supposed to use on node to mess around with images like add watermarks etc etc

quartz kindle
#

canvas?

slender wagon
#

oh

#

that

quartz kindle
#

lel

slender wagon
#

I haven't used it in ages

#

this is gonna be a pain

quartz kindle
#

i mean, for simple image compositing, you can try sharp

slender wagon
#

It's not gonna be too simple i guess

#

i have to make sure the watermark is dynamic etc

quartz kindle
#

canvas is only really needed if you need full drawing capabilities

#

ah then yeah i guess you need it

slender wagon
#

it's gonna be a pain

frosty gale
#

canvas is finnicky but its okay

slender wagon
#

real

#

i used it back in 2019

#

when i knew none about coding

#

it took like 40 seconds for a little processing

frosty gale
#

do you need to do anymore processing other than a watermark?

slender wagon
#

without the watermark cutting off

frosty gale
#

cutting off?

slender wagon
#

like only half of the image

frosty gale
#

you dont want something like this happening?

#

being extra sure lol

slender wagon
#

yes

#

in the corners or in the bottom

#

and basically i want it very dynamic no matter the size of the pic

frosty gale
#

is the watermark an image or text?

slender wagon
#

image

frosty gale
slender wagon
#

yes

frosty gale
#

and you want the watermark to adjust its size based on the image size or something like that?

frosty gale
#

first you probably need to work out the size of the watermark image, probably can just do some multiplication and then resize the length and height based off that

#

but to make it fit you need to calculate the pixels used by the watermark and offset it at one of the corners so it never cuts off

#

sounds more complicated but easier in practise

slender wagon
#

yes i am noting that

#

cuz i surely understand nothing atm

frosty gale
#

something like watermarkStartOffset = rightBottomCornerX - watermarkLengthInPixels - someValueSoTheresSomeSpaceBetweenTheEdge

#

getting pixel length of image tho uhhhhhhhh brb

slender wagon
#

okay

frosty gale
#

you literally just do imgElement.width / imgElement.height and id imagine canvas recognises the width and height as pixels

#

assuming youre using browser js

slender wagon
#

This will be done through a bot

frosty gale
#

so you're using node canvas and stuff like that?

slender wagon
#

I haven't fully started it yst

#

But prolly something using node

#

I will start it tomorrow

#

Which npm do u suggest

frosty gale
#

yeah it's the same image.width / height

frosty gale
slender wagon
#

Okay dope

#

I'll keep u updated tomorrow if u dont minddd

frosty gale
#

it's annoying to install sometimes because it uses hardware acceleration and c++ stuffs so the build can fail sometimes and you may need to do some debugging (if you're unlucky)

frosty gale
slender wagon
sharp geyser
#

I’ll also need to find a camera module to use

frosty gale
#

yeah you'll be absolutely fine using tf lite

#

20 different libraries which wrap around doing this sort of thing

sharp geyser
#

what kind of rpi board do you recommend?

frosty gale
#

but I'd say at the very least one of the computer ones that have like proper cpus and not one of the microcontroller ones

#

because for video processing I don't think you even have enough ram for that

sharp geyser
#

I’d prefer something small as they will be attached to glasses

frosty gale
#

bro what are you cooking lmao

sharp geyser
#

Don’t worry about it trollface

frosty gale
#

even the microcontroller ones are pretty big you'd really need like a custom designed circuit board for stuff like that

sharp geyser
#

I’m cooking up a unicorn company idea

#

I’m fixing to be making the big bucks

sharp geyser
frosty gale
#

honestly your best bet is to have a tiny microcontroller board like the nordic and have it connect to a central controller that does the actual processing wordlessly

#

wireless delays might be an issue tho

sharp geyser
#

Won’t there be latency issues

#

With the thing I’m doing it’s quite literally a matter of life and death

frosty gale
#

yeah esp since these tiny boards have limited computing power so they can't push as many bytes over a network as a computer cpu

sharp geyser
#

Don’t want deaths because of my project

#

It’d have to be something capable of doing it onboard to limit latency to a minuscule amounts

frosty gale
#

what kind of ml are you planning to do on video anyways and what kind of resolution of the video camera

sharp geyser
#

Mostly object detection and text to speech to start out with

frosty gale
#

what I would do is get as small of a powerful controller as I could and maybe for the time being having a cable run off it into your pocket or something so you can get your inputs or something from the glasses

#

maybe later try to improve and get it more integrated

sharp geyser
#

I see

frosty gale
#

ram is also a concern

sharp geyser
#

Yea

#

This entire project is an ambitious project

frosty gale
#

but honestly it's just playing around and see what works

#

After a ml model is trained it isn't that expensive computationally to get a prediction but that all depends on size of data

sharp geyser
#

I mean the stuff would be done in real time at a constant rate

#

Or that’s the plan anyway

#

The plan is to be able to identify everything in frame and if the frame moves to then identify everything in that frame

frosty gale
#

you're going to at least need a very generous delay between predictions but you'll need to test it in action to see how much it can push

#

machine learning jargon wise you'll need to have a model optimised for limited hardware

#

ones that have less layers and neurons and faster activation functions at a trade off on a little worse prediction accuracy

#

but it's usually not a deal breaker

sharp geyser
#

As long as it doesn’t mistake a fence for a dog I’m fine

#

Anyways thanks for this information I’m heading to bed now

#

If I ever get around to it I’ll look at my options

frosty gale
#

well anyways you can always ping me and I can help if I have time :)

sharp geyser
#

Tyty

frosty gale
#

im not that strong on machine learning but I have experience with limited hardware and environments like that

sharp geyser
#

I have no knowledge so

#

On either machine learning or limited hardware

frosty gale
#

I'd try getting it working on desktop and normal tensorflow and getting comfortable with it before moving to more embedded and fit for purpose stuff like this

sharp geyser
#

Oh yea for sure

#

I have a webcam idk if I can use that temporarily

#

To attempt object detection

frosty gale
#

yeah definitely you can feed input from that into your program

sharp geyser
#

Bet

eternal osprey
#

hey guys i have the trainer.py, i am trying to access the model.py however my fucking math isn't found when i use Model/model.py.

#

i know it is because it's in the resource folder, and that i need to use my whole path file.

#

however, i don't want to do this, as i want my teacher to be able to run it as well, and else the file path will be coded to my own pc's absolute path

lyric mountain
#

<class>.getResource("path/relative/to/current/file") or <class>.getClassLoader().getResource("path/relative/to/root")

#

the "whole path" wont exist once you create a jar, as it'll be packed inside it

#

using resource accessors is the correct way of interacting with that folder

wheat mesa
#

(Also trying to dynamically read metadata about directories inside of a jar is like fucking impossible, so make sure you’re not trying to get file names dynamically unless you’re down to beat yourself up)

tulip ledge
#

Got back to developing my bot from 2 years ago, first launch gives me this:

      throw new DiscordAPIError(data, res.status, request);
            ^
DiscordAPIError: Missing Access

Any idea why?

cursive musk
#

what is this error?

/home/container/node_modules/discord.js/src/util/Util.js:361
  const matches = url.match(
                      ^
TypeError: Cannot read properties of undefined (reading 'match')
    at parseWebhookURL (/home/container/node_modules/discord.js/src/util/Util.js:361:23)
    at new WebhookClient (/home/container/node_modules/discord.js/src/client/WebhookClient.js:49:22)
    at Object.<anonymous> (/home/container/src/index.js:74:21)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47
#

I'm only getting it on linux, not mac

lyric mountain
#

url is undefined

cursive musk
lyric mountain
#

show where ur defining url

cursive musk
#
if (global.config.webhooks.error_logs.enabled) {
  const logs_hook = new WebhookClient({url: global.config.webhooks.error_logs.webhook});
  const embed = new EmbedBuilder()
  .setTimestamp();
  process.on('uncaughtExceptionMonitor', (err, origin) => {
    embed.setTitle("Uncaught Exception Monitor")
    embed.setDescription(`\`\`\`${err}\`\`\``)
    embed.setColor(`#FF0000`);
    logs_hook.send({embeds: [embed]});
  })
  process.on('unhandledRejection', (reason, promise) => {
    
    
    embed.setTitle("Unhandled Rejection")
    embed.setDescription(`\`\`\`${reason}\`\`\``)
    embed.setColor(`#FF0000`);
    logs_hook.send({embeds: [embed]});
  });
  process.on('uncaughtException', (err) => {
    embed.setTitle("Uncaught Exception")
    embed.setDescription(`\`\`\`${err}\`\`\``)
    embed.setColor(`#FF0000`);
    logs_hook.send({embeds: [embed]});
  });
}
lyric mountain
#

it's not there

tulip ledge
lyric mountain
#

oh wait, it's inside webhook client

cursive musk
cursive musk
wheat mesa
#

His error is inside of djs itself

lyric mountain
#

global.config.webhooks.error_logs print this

#

also, wouldn't recommend the usage of global

tulip ledge
cursive musk
#

Exact same code working on my local mac though

#

which is weird

lyric mountain
tulip ledge
#

ye

#

just trying to launch my application again

lyric mountain
#

did u update djs?

tulip ledge
#

its 13.16 I think

#

is that latest?

cursive musk
tulip ledge
#

nvm 14.11 is latest ;-;

lyric mountain
#

v13 shouldn't error still

#

did u refresh the token?

tulip ledge
#

ye I just did cuz I forgot my token

#

but I replaced it

#

so no worries

#

that shouldnt be the issue

#

its not a wrong token

lyric mountain
#

hm, show how ur instantiating the client

tulip ledge
#
  private setup(): void {
    console.log(chalk.keyword("orange")("INFO") + " | Setting up the bot...");

    // Variables
    this.ready = false;
    this.database = new Keyv(this.topazOptions.database);
    this.profileHandler = new ProfileHandler(this);
    this.dropHandler = new DropHandler(this);
    this.experienceHandler = new ExperienceHandler(this);

    // Setup the base events for the client
    this.setupBaseEvents();
    // Setup the commands
    this.setupCommands();
    // Setup the contextmenus
    this.setupContextMenus()
    // Setup the events
    this.setupEvents();

    // Login!
    this.login(this.topazOptions.token);
    // Load all item files.
    this.loadItems();

    console.log(chalk.keyword("orange")("INFO") + " | Logging in...");
  }
lyric mountain
#

this this this this

tulip ledge
#

ye it's old code

#

I'm gonna redo the whole thing

#

but I need to get this to work first

lyric mountain
#

put login before everything else

#

none of the interactions will work if the bot is offline

#

at least above this

tulip ledge
#

same error

lyric mountain
#

but preferrably, before anything else

lyric mountain
tulip ledge
#

ye

lyric mountain
#

does the error show the line where it ocurred?

tulip ledge
#
C:\Users\Yarne\Desktop\Topaz\Topaz\node_modules\discord.js\src\rest\RequestHandler.js:350
      throw new DiscordAPIError(data, res.status, request);
            ^
DiscordAPIError: Missing Access
    at RequestHandler.execute (C:\Users\Yarne\Desktop\Topaz\Topaz\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at RequestHandler.push (C:\Users\Yarne\Desktop\Topaz\Topaz\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
    at GuildApplicationCommandManager.fetch (C:\Users\Yarne\Desktop\Topaz\Topaz\node_modules\discord.js\src\managers\ApplicationCommandManager.js:108:18)
[nodemon] app crashed - waiting for file changes before starting...
#

Whole error

lyric mountain
#

hm

#

run the app in debug mode, put a breakpoint in your entrypoint

#

step line by line until the error happens

#

see if it's really happening at login

tulip ledge
#

alr

lyric mountain
#

oh wait

#

yeah it's happening during slash registration

#

it must happen after client login

#

put await before login

#

so it waits for bot to come up

#

and put the login line in the start of the function

tulip ledge
#

ye its not happening during login

lyric mountain
#

yes, because it's not waiting for login

#

login is an async operation, without await it'll simply keep going before login has finished

tulip ledge
#

didn't fix it

lyric mountain
#

show current code

tulip ledge
#
  private async setup(): Promise<void> {
    console.log(chalk.keyword("orange")("INFO") + " | Setting up the bot...");

    // Login!
    await this.login(this.topazOptions.token);

    // Variables
    this.ready = false;
    this.database = new Keyv(this.topazOptions.database);
    this.profileHandler = new ProfileHandler(this);
    this.dropHandler = new DropHandler(this);
    this.experienceHandler = new ExperienceHandler(this);

    // Setup the base events for the client
    this.setupBaseEvents();
    // Setup the commands
    this.setupCommands();
    // Setup the contextmenus
    this.setupContextMenus()
    // Setup the events
    this.setupEvents();
    // Load all item files.
    this.loadItems();

    console.log(chalk.keyword("orange")("INFO") + " | Logging in...");
  }
lyric mountain
#

do u have anything in the outer scope?

tulip ledge
#

ye it's a 500 line file with different things to set up stuff

#

events, contextmenus, etc

lyric mountain
#

see if anything is running before setup

tulip ledge
#

but it shouldn't cuz it's the first thing that's called

lyric mountain
#

it's an async function, are u awaiting it?

tulip ledge
#

oh 🤦‍♂️

lyric mountain
#

yk, part of the reason I dislike js async

tulip ledge
#

ye well

#

it's kind of annoying to make it await

#

cuz it's called in the constructor

#
  constructor(options: TopazClientOptions) {
    super({
      intents: new Intents(["GUILD_MESSAGES", "GUILDS"])
    });

    if (!options.commandsDir) options.commandsDir = "commands";
    if (!options.eventsDir) options.eventsDir = "events";
    if (!options.development) options.development = false;

    // if (!options.development && !options.database) throw new Error("Database not found while in production!");
    // else if (options.development) options.database = "mysql://topazdev:NKw1rb8A17zf3VK@144.172.75.142:3306/topazdev";
    
    this.topazOptions = options;
    this.inDevelopment = options.development;

    // Setup the client
    this.setup();
  }
#

but then again

#

it's the only thing called

#

so nothing else should run

lyric mountain
#

where are u constructing it?

#

like, the callee of the constructor

tulip ledge
#
let client = new TopazClient({
  token: process.env.BOT_TOKEN,
  commandsDir: "./commands",
  eventsDir: "./events",
  contextMenuDir: "./contextMenus",

  database: process.env.DATABASE || undefined,

  development: process.argv.includes("--dev"),
  devGuildId: "867781117126115328"
});
#

In my bot.ts

#

which is what runs when I run the bot

lyric mountain
#

remove setup from the constructor, call it after constructing

#

make bot.ts an async scope

tulip ledge
lyric mountain
#

yep

#

as async is contagious

tulip ledge
#
async () => {
  let client = new TopazClient({
    token: process.env.BOT_TOKEN,
    commandsDir: "./commands",
    eventsDir: "./events",
    contextMenuDir: "./contextMenus",

    database: process.env.DATABASE || undefined,

    development: process.argv.includes("--dev"),
    devGuildId: "867781117126115328"
  });

  await client.setup();
#

like this?

lyric mountain
#

ig so

tulip ledge
#

ye it doesn't work

lyric mountain
#

make sure there's nothing outside that scope

tulip ledge
#

now nothing is ran

#

2 imports

#

should they be inside?

lyric mountain
#

no

#

btw

#

hm

#

u should be able to await in the outermost scope without using an async function

#

but well, it isn't ran because u never called it (u made it a function)

tulip ledge
#

ye

#

but how do I call it

lyric mountain
#

()

tulip ledge
#

cuz if I call it I won't call it with await

#

ye doesn't work

lyric mountain
#

() => { ... }()

tulip ledge
lyric mountain
#

lemme check how people are making their bots in djs

tulip ledge
#

ye I'm planning on making a whole new handler

#

but I just wanna get this to work

lyric mountain
#

try making a barebones starter, to see if it even logins

#

start putting the methods again one by one after that

tulip ledge
#

yeah I'll try I'll figure it out

#

thanks for the help

lyric mountain
#

yw

#

the trick is making anything else only happen after login

#

u can use something like client.login(token).then(() => doeverythingelse())

tulip ledge
#

you got a repo of a handler someone made with new discordjs by any chance?

lyric mountain
#

so u dont need an async outer scope

tulip ledge
#

cuz I only have knowledge from 2-3 years ago

lyric mountain
#

by handler do u mean command handler?

tulip ledge
#

yeah and events and stuff

wheat mesa
#

That’s how you get that syntax to work

tulip ledge
#

ah I thought I forgot something

lyric mountain
#

I hate how most langs are adhering to that async shit

tulip ledge
#

ye still missing access

lyric mountain
#

people bash java for java try { asyncFunction().get(); } catch (InterruptedException e) { ... } but are fine with having to change the entire upstream for a single await

tulip ledge
#

yeah it has to do with the slashcommands

lyric mountain
#

the handler is very likely trying to use the client for registering commands, but it cant yet as it's not logged in

tulip ledge
#

but the handler for registering slash commands called in my ready event

lyric mountain
#

hm

tulip ledge
#

you wanna see the handler?

lyric mountain
#

did u add the slash scope?

tulip ledge
#

euh

#

where

#

this is what I got when I tried to

#

like I said

#

I showed it before

lyric mountain
#

dev dashboard

tulip ledge
#

it sais A private application cant make use of a default authorization link

lyric mountain
#

where are u trying to set it?

tulip ledge
#

I just made it public

#

now it works

#

maybe it logins now

lyric mountain
#

no no

#

go to url generator instead

#

default url is for this

#

which makes no sense for priv bots

tulip ledge
#

ah ok

#

am in url generator

lyric mountain
#

select bot and application.commands

#

access the url even if the bot is already in ur server, to update the scopes

tulip ledge
#

same error

lyric mountain
#

now give slash permission to ur bot in the server

#

and check if the handler isn't trying to register slashes to the wrong server

tulip ledge
#

he has admin perms

#

it does say he is in 6 guilds for some reason

lyric mountain
#

those guilds also need to update the scope

tulip ledge
#

ye I don't know which guilds these are

lyric mountain
#

make it leave them then

tulip ledge
#

I just make it leave all the guilds?

lyric mountain
#

or filter all where the id is not yours

tulip ledge
#

ye same error

#

I'm getting annoyed

#
if (typeof devGuildId === "undefined") existingCommands = await this.application.commands.fetch();
    else existingCommands = await this.guilds.cache.get(devGuildId).commands.fetch();
#

this is the line where it errors btw

lyric mountain
#

is that in your code?

tulip ledge
#

yes

lyric mountain
#

log what devGuildId is

tulip ledge
#

I changed it to this existingCommands = await this.application.commands.fetch();

#

and it still errors

#

but devguildid is my guild's id

#

867781117126115328

#

it's not allowed to fetch the commands

lyric mountain
#

I'll need to defer this to someone else, if you added the scope and permission I dont see why it'd error

tulip ledge
#

is it weird that the bot does not appear on the integrations tab in the server?

lyric mountain
#

did u select the correct server when adding the scope?

tulip ledge
#

ye

lyric mountain
#

just for removing all doubt do it again

#

see if the server still appears in the dropdown

tulip ledge
#

ok

#

so I tried a different bot

#

and it worked

lyric mountain
#

same code, different tokens?

tulip ledge
#

yup

#

maybe because the bot I tried it with is from a group

desert verge
#

Pfff, maybe tupperbox is just good, maybe it doesn't need more functionnalities. So i'm ending the work of my bot Better Roleplay. Ask me in DM if you want to see the code/reuse

lyric mountain
#

kick the bot and reinvite

tulip ledge
#

not my private application?

#

it's not under this tab on my dev panel

#

but thanks for the help

lyric mountain
#

kick the bot and reinvite, maybe it's discord caching getting in the way

#

this will force a full refresh

tulip ledge
#

alr ty now it's time to figure out why none of the commands are being loaded...

lyric mountain
#

it worked?

tulip ledge
#

the kicking

#

havent tried yet

#

hold up

#

nope

#

it really is the bot

#

if I use a different token it works

lyric mountain
#

weird

#

well, if it's a private bot u can just create another with the same name

tulip ledge
#

I don't even need all the await stuff if I use this bot

#

well that's an hour wasted

lyric mountain
#

you could go deeper to see what's the difference between both bots

#

that way it'd at least not be a total waste

tulip ledge
#

ye well I should've started studying for my math exam 45 mins ago

#

so maybe I should go do that first

lyric mountain
#

eh

tulip ledge
#

I'm just confused rn why my commands aren't getting registered

#

they're being loaded

#

but not registered

lyric mountain
#

if they're being registered globally it might take a while for them to appear

tulip ledge
#

it loaded the commands but didn't register them

lyric mountain
#

added scope and permission?

tulip ledge
#

ye

#

lemme see permission

#

maybe that's the issue

#

it has admin perms

lyric mountain
#

really have no idea in this case

tulip ledge
#

oh nvm I found the issue I think

#

if you have an error in your comand if it gets called it doesn't get registered right?

lyric mountain
#

idk, but probably

tulip ledge
#

ye thats probably the issue cuz I don't have a db connected to it rn

#

but ty for the help

#

time to study maths now

last tapir
#

is discord.js v15 gonna release or be a thing?

lyric mountain
#

simply because of this warning

frosty gale
#

istg bro if youre using discordjs you better be developing your bot 24/7 because you cant just forget about the bot and update it every once a while bc discord js has to break something with a new update

#

kinda discords fault too

last tapir
#

there's usually a website to view the changes they've made

lyric mountain
last tapir
lyric mountain
#

read "npm"

#

it's likely in alpha phase since it has a major version of zero

last tapir
lyric mountain
#

my bet is that they'll modularize d.js

#

in a way that you can choose what u get

#

stupid design as they already dumped 2 major breaks this year alone

#

poor bot devs having to migrate for a third time KEKW

feral aspen
#

Just greys out everything with no failed or something.

deft wolf
#

It's not ephemeral response?

#

Looks like

feral aspen
#

I have no idea, I've just never seen an interaction return blank and grey out.

deft wolf
#

And only you can see this response

feral aspen
deft wolf
#

They've been on discord for a good year now kapp

feral aspen
#

Yeah, but it's not the same as the one I'm seeing. :>

solemn latch
#

👀 is that your bot?

feral aspen
solemn latch
#

I see nothing in the discord api changelog about it

feral aspen
#

Well, I have no clue what that interaction return is in the first place. 😂

#

I'm not sure if it means the interaction failed or what.

solemn latch
#

I wouldn't think that's what it means, super weird

feral aspen
#

Ah, just tried the same command from an alternative account, it's an ephemeral message.

#

However, it's not displaying its contents for me.

lyric mountain
#

an ephemeral failure

solemn latch
#

I wonder if it just has no content?

#

oh

lyric mountain
#

no no, I was joking

solemn latch
#

lmao

feral aspen
solemn latch
#

Like I wonder if they just put a zero width space or something?

#

Honestly, poke the bot dev and ask 👀

pale vessel
#

it's greyed out, so the bot itsef didn't respond

#

might just be discord

solemn latch
#

failed to show the error I guess?

feral aspen
feral aspen
solemn latch
#

It had to have responded then right?
Since that was less than three seconds

lyric mountain
#

do you know what it looks like? a discord issue

feral aspen
lyric mountain
#

all commands are ephemeral (nobody can see the command message, only the result of it), so I think something gone really bad in their response endpoints

#

basically got stuck between "command answered" and "render to clients"

#

try opening discord in the browser and seeing if any error pops in the console

neon leaf
#

why is postgres doing this? its a float btw

lyric mountain
neon leaf
#

what should I use

lyric mountain
#

integer

neon leaf
#

I need 2 decimal precision

pale vessel
#

round it

lyric mountain
#

u don't, simply multiply by 100 and do whatever u want to do

#

39.99 can be represented as 3999

#

if u buy an item for $ 1.65 for example, and have a balance of $ 100.00, u can simply 10000 - 165

#

floating points are not only slower but also much more prone to rounding errors

feral aspen
lyric mountain
#

POPOUT_CLOSE is likely the event related to hiding eph messages

neon leaf
lyric mountain
#

that's an option too

#

personally I'd just use int as it's supported by all databases

neon leaf
#

yeah, I dont really want to process any data before sending it to the user, I do all of it in the query

lyric mountain
#

it's not really processing, all you'll do is balance / 100 for adding the 2 decimals

neon leaf
#

yeah, but then id add like 10 lines for each time I send user infos

lyric mountain
#

???

neon leaf
#

im passing the query result directly to the user

lyric mountain
#

yes, but it's literally changing 'Balance: ${balance}' to 'Balance: ${balance / 100}'

#

internally you'd just use integers

neon leaf
#

Im not in a discord bot

lyric mountain
#

regardless

#

you can use money type sure, but it's needlessly adding more database processing to your queries

neon leaf
#

alr, found a neat way of doing that int stuff but is it any faster than money?

tulip ledge
#

I got this db query:

SELECT
         'key'
       FROM
         keyv
       WHERE
         \`key\` LIKE 'keyv_user-%'

Querrying this into the db itself using mysql workbench works like it should but when I make my bot query this it gives me error:

    const localErr = new Error();
                     ^
Error: Unknown column 'key' in 'where clause'
    at PromisePool.execute (C:\Users\Yarne\Desktop\Topaz\Topaz\node_modules\mysql2\promise.js:369:22)
    at C:\Users\Yarne\Desktop\Topaz\Topaz\node_modules\@keyv\mysql\src\index.js:32:42
    at C:\Users\Yarne\Desktop\Topaz\Topaz\node_modules\@keyv\mysql\src\index.js:45:19
civic scroll
#

it could be reading as key LIKE 'keyv_user-%'

tulip ledge
#

but I got these `

civic scroll
#

it could be the column doesn't exist, idk
idk much, sorry

lyric mountain
#

almost nothing will be faster than INT

tulip ledge
lyric mountain
#

money is also less space-efficient as it has a bigger ceiling

tulip ledge
civic scroll
civic scroll
lyric mountain
frosty gale
civic scroll
#

in SQL

#

actually data type is "Currency"

lyric mountain
#

in postgres it's unironically called money

hushed robin
#

hi development

#

im going to try postgre today

#

wish me luck

#

also guys I have another question

pale vessel
#

are we supposed to guess your question 🤔

#

I don't have my magic ball on me at the moment

hushed robin
#

why http server need port forwarding

#

but websocket don’t

#

sounds rigged

hushed robin
#

I sent

#

^^^^^^

#

@pale vessel

proven lantern
lament rock
#

unsigned decimal floating point looks like

stuck dawn
#

I am using framer motion for an animation but the exit animation is not working only enter animation is working i don't know why

<AnimatePresence initial={false} mode='wait'>
  <div className='notification-container'>
    {notification && (
      <Notification
        data={notification}
      />
    )}
  </div>
</AnimatePresence>
------------------------------------

<motion.div
  className='notification'
  data-locked={false}
  initial={{ opacity: 0, y: -50 }}
  animate={{ opacity: 1, y: 0 }}
  exit={{ opacity: 0, y: -50 }}
  drag='y'
  dragConstraints={constrained && { top: 0, bottom: 0 }}
  dragElastic={{ top: 0.2, bottom: 0.0 }}
  dragMomentum={false}
  onDragEnd={(e, info) => {
    if (info.offset.y < -50) {
      setConstrained(false);
      Func.remove();
    }
  }}
wheat mesa
#

Well… seeing as framer motion is designed for react, I’d probably say javascript/typescript…

sick agate
civic scroll
#

that might require the motion component to be a direct child of AnimationPresence for it to work

#

so why don't you try

<div className='notification-container'>
  <AnimatePresence initial={false} mode='wait'>
    {notification && (
      <Notification
        data={notification}
      />
    )}
  </AnimatePresence>
</div>
#

AnimatePresence itself doesn't render into actual dom elements so don't be afraid of layout changes

stuck dawn
civic scroll
#

yw

maiden gazelle
#

does somebody know why im getting this error with this

const Discord = require('discord.js');
const Canvas = require('canvas')

exports.run = async (bot,message,args) => {
  const canvas = Canvas.createCanvas(540, 500)
  const ctx = canvas.getContext("2d")
  
  const target = message.mentions.users.first()
  if(!target) return message.channel.send("Please mention someone.")
    
  const bg = await Canvas.loadImage("https://i.imgur.com/zb20YGY.jpeg")
  ctx.drawImage(bg, 0, 0, canvas.width, canvas.height)
    
    
    const avatar = await Canvas.loadImage(target.displayAvatarURL({ extension: 'png' }))
    ctx.drawImage(avatar, 100, 100, 200, 200)
    
    
let atta = new Discord.AttachmentBuilder(await canvas.toBuffer(), { name: 'gayshark.png' })

let embed = new Discord.EmbedBuilder()
.setImage(`attachment://${atta.name}`)
.setColor("#B468FF")

message.channel.send({ embeds: [embed], files: [atta] });
}
  
exports.help = {
name: 'gayshark'
}

its image manipulation

frosty gale
#

const bg = await Canvas.loadImage("https://i.imgur.com/zb20YGY.jpeg")

#

what i would do is download the image then reference the file so you dont have to contact imgur servers for it each time

#

besides you should load the image outside of the command anyways its a waste loading it each time a command is ran if the background is always the same

lament rock
#

You can also clone the canvas

solemn latch
#

Ideally you would download it, but you can also just use ctx.save and ctx.restore too.

ie;

// at the top of the file
const canvas = Canvas.createCanvas(540, 500);
const ctx = canvas.getContext("2d");
const bg = await Canvas.loadImage("https://i.imgur.com/zb20YGY.jpeg");
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
ctx.save();
  
function run(ctx) {
    ctx.restore(); // this will restore ctx to the saved state
    const avatar = await Canvas.loadImage(target.displayAvatarURL({ extension: 'png' }))
    ctx.drawImage(avatar, 100, 100, 200, 200);

    //use the image as normal

    
}

frosty gale
#

imgur said no to bro 💀

#

how many requests to even have that happen

solemn latch
#

imgur ratelimits are a bit strict iirc

#

12,500 per day if you're using an api token it seems, which they are not using

frosty gale
#

very generous and graceous of imgur 🙏

#

can ip ratelimits even be relied on anymore

#

i think they can be changed and masked so easily now automatically

#

id have to ask some colleagues at work

#

noted on my agenda

spark flint
#

returns 429 even if not ratelimited

#

its annoying asf

frosty gale
#

💀

spark flint
#

429

lyric mountain
#

Why not use cloudflare?

spark flint
#

for what

lyric mountain
#

Cdn

#

The limits are fairly decent

#

Just dont ditch caching entirely

frosty gale
#

the world if rate limits did not exist and everyone was abiding in harmony and respecting limits

lyric mountain
#

They're necessary so everyone gets their fair share, if ur hitting yours you're doing something very wrong

#

For images for example, you're supposed to cache 'em

frosty gale
#

that's why the world would look like the above if everyone lived in harmony

raven raptor
#

bot.topggpy = topgg.DBLClient(bot, toptoken, autopost=True, post_shard_count=True)
Give me this error
TypeError: DBLClient.__init__() takes 2 positional arguments but 3 were given
Am I doing something wrong? this is what the pypi page porvides as an example

lyric mountain
#

Press ctrl space to see what's wrong

wheat mesa
#

@lyric mountain is there any way to get Intellij to format a file with a quick shortcut (kind of like a VSC formatter when you save a file)?

lyric mountain
#

I think, tbh it's mostly muscle memory at this point

#

Press shift twice and type format, see what shortcut is it bound to

wheat mesa
#

👍 thanks

lyric mountain
#

U can set it to autoformat ig, see settings

#

Type format in the searchbox (settings), see the results that pop

hushed robin
#

how do i use an api if cloudflare keeps denying me

lyric mountain
#

Depends, what's the reason for your block?

#

If u received the 24h ban, trying again will only make it worse

hushed robin
#

but i wanna use it

lyric mountain
#

Then you simply don't

hushed robin
#

why

lyric mountain
#

Because you're not the main character of the world

#

If someone doesn't want you to use something, you don't

hushed robin
#

sad

#

imma try using it still

#

i think it's ok

lyric mountain
#

Do note cloudflare bans are ip-bound

hushed robin
#

it's not a ban

lyric mountain
#

Yet

hushed robin
#

😮‍💨

lyric mountain
#

You need to learn when to take the L and abide to the rules

hushed robin
#

and they openly share it in their Discord server

#

and mods don't do anything

#

so i think it's fine tbh

lyric mountain
#

What api is it

hushed robin
#
#

🙃

#

why is puppeteer taking forever to install

lyric mountain
#

Yk, I saw a ton of "most rewarding" streaming platforms

hushed robin
#

kick is pretty big tbh

lyric mountain
#

None survived very long, or are long forgotten in a moist corner

hushed robin
#

considering the ass changes Twitch is making it might overtake them

lyric mountain
#

Doubt

hushed robin
#

😵‍💫

hushed robin
#

many big streamers have switched to it

lyric mountain
#

Buddy, I heard that countless times already

hushed robin
#

cus it's true

#

kick is the future of streaming 🚀

lyric mountain
#

Except it didn't last long in every previous case

#

Why is kick any different?

hushed robin
#

what previous case

#

mixer?

lyric mountain
#

I long stopped livestreaming

hushed robin
#

do you know if it's normal for puppeteer to take a long time to install

#

usually packages don't take this long

lyric mountain
#

Puppeteer uses a whole browser internally

hushed robin
#

When you install Puppeteer, it automatically downloads a recent version of Chrome for Testing (~170MB macOS, ~282MB Linux, ~280MB Windows) that is guaranteed to work with Puppeteer. The browser is downloaded to the $HOME/.cache/puppeteer folder by default (starting with Puppeteer v19.0.0).

#

is this why

lyric mountain
#

As I said, a whole browser

hushed robin
#

280mb is so much

#

wtf

#

why a whole browser

lyric mountain
#

Wait until you see the ram usage

hushed robin
lyric mountain
hushed robin
#

i think this is the only way\

#

tbh

lyric mountain
#

You will need to cope with the ram usage

hushed robin
#

i'll be doing a lot of stuff

lyric mountain
#

You're paranoid about 100mb, expect at least 5 times as much depending on your usage

#

That's lowballing tbh

#

Especially if you access many pages quickly

hushed robin
#

is that with a lot of stuff?

lyric mountain
#

Browsers cache pages and assets

#

Chrome regularly go into gigabytes of ram, headless will be smaller but not much smaller

hushed robin
#

ok wow

#

it works

#

i can now access the api

#
const puppeteer = require('puppeteer');

const url = 'https://kick.com/api/v1/channels/';

const fetchUserStats = async (user) => {
    const browser = await puppeteer.launch({ headless: 'new' });
    const page = await browser.newPage();
    await page.goto(url + user);
    
    const stats = await page.content();
    
    browser.close();

    return stats;
};

(async() => {
    console.log(await fetchUserStats('adinross'));
})();```
frosty gale
#

@hushed robin you can actually make puppeteer use an existing browser

#

you don't have to use the one it provides

hushed robin
#

wot

lyric mountain
#

Remembered it, nimo tv

hushed robin
#

let me try accessing lots of pages

#

and see how many ram it uses

lyric mountain
#

One of the supposed "most profitable gaming livestream platforms"

#

Dead 3 months later

hushed robin
#

i mean it still exists

#

but kick is much different

lyric mountain
#

Nimo was also different

#

All the 94667 twitch killers were different

#

In the end of the day twitch remains

hushed robin
#

ok

#

ok

#

you lied

#

it's only using 34mb of ram

lyric mountain
#

Except you barely started using it

#

Usage accumulates over time, it won't be high from the get-go

hushed robin
#

do i need to access different pages everytime to see the full ram usage

#

or can i just access the same one

lyric mountain
#

Just let it work for a few days

hushed robin
#

a few days?

#

no

#

i'm not testing for that long

lyric mountain
#

I don't care, you want to see peak ram usage you're gonna wait

hushed robin
#

tbh i think your capping

#

it's only using 40mb

lyric mountain
#

From 34 to 40 in 2 minutes

#

Yet I'm capping

hushed robin
#

it's fluxuating

#

right now it's at 35mb

lyric mountain
#

Like your brain in its own echo

hushed robin
#

what does this mean

#

did they get angry at me

lyric mountain
#

This is why I never believe in "X is the new killer of Y"

hushed robin
#

Mixer literally only had 1 popular streamer

#

Kick has numerous

lyric mountain
#

He doesn't know what cache is

hushed robin
#

and Mixer tried taking over Twitch in it's peak

#

Twitch is literally being clowned on rn

#

🤑

hushed robin
#

stop capping

#

i learned a few weeks ago

lyric mountain
#

Buddy if clowning was a reason of a platform death reddit, discord, youtube, facebook, instagram, tiktok, etc would be all dead

frosty gale
#

what is this conversation bro 💀

lyric mountain
#

See, radio silence

frosty gale
#

cache is cash

#

cash is money and money is time

raven raptor
#

i think its something to do with positional args and keyword args

#

but im only passing 2 positionals?

jaunty basalt
#

Can anyone please tell me how can I display nitro badge if a user has nitro, and also if he has booster badge how can I display that also. And, how can I display only nitro badge if the user is not a booster but have nitro?
(in my bot's user info command)?

Please tell!

pale vessel
#

there's no way to check for a user's nitro state using a bot token

#

for boosting level, you could find a property for that under guild member

#

though it wouldn't match the one shown on your client since that would be their longest boost

jagged fable
#

dang it

civic scroll
rustic nova
#

you'd need to do the same with bot, toptoken too

frosty gale
#

python is weird

#

actually it makes sense just only if the error was clearer

#

dont mix keyword and positional

earnest phoenix
#

Python trying to be special by being one of the very few programming languages that allow keyword arguments

frosty gale
#

no wonder its so slow

wheat mesa
#

Mostly slow because it’s a stack based VM which requires a lot of memory shuffling shenanigans in the bytecode instructions. It also doesn’t JIT afaik

strong lark
#

Currently looking to restructure my files for discord bot any suggestions to make this more organized?

├── Delete.js
├── LICENSE
├── README.md
├── app.js
├── bot.js
├── checkOptions.js
├── commands
│   ├── count.js
│   ├── help.js
│   ├── ping.js
│   ├── play.js
│   ├── setinvitechannel.js
│   ├── setjoinmessagechannel.js
│   ├── setleavemessagechannel.js
│   └── voteSkip.js
├── config.js
├── database.js
├── features
│   ├── countingGame.js
│   ├── inviteTracker.js
│   └── musicPlayer.js
├── index.js
├── package-lock.json
├── package.json
├── public
│   └── css
│       └── styles.css
├── secret-key.json
├── slashCommands.js
└── views
    ├── about.html
    ├── dashboard.html
    ├── index.html
    └── login.html
pale vessel
#
  1. use a consistent naming convention (Delete.js should be named delete.js, setinvitechannel.js should be named setInviteChannel.js, secret-key.json should be named secretKey.json, etc.)
  2. I personally do this since it'll look much more organized: move all your code to the src folder to make your project root not cluttered (an example: https://github.com/cheeriojs/cheerio)
pale vessel
#

I love src so much

#

one of reasons why I'm not a fan of golang

#

src folder is not really a convention for go

lyric mountain
#

I particularly like java's default structure of src/java and src/resources, I use it for everything I do when I can

#

if I have more langs in a single project, src/<lang>

#

having all assets inside a dedicate folder makes everything much cleaner

frosty gale
#

java feeling the need to make projects start with com. or net. or whatever for no fucking reason

wheat mesa
#

It’s convention

spark flint
#

java is just bad KEKW

wheat mesa
#

It’s a legacy thing, it doesn’t really matter a ton but it’s definitely conventional

#

Java is great until you try to do graphics

#

My dude that’s an optimization mod for minecraft

#

Doing graphics from the ground up in Java sucks

rustic nova
#

only ever made guis with swing trol

wheat mesa
#

OpenGL is difficult to do with Java efficiently because of the garbage collector, there’s a ton of memory fuckery you have to do with it, LWJGL makes it a bit easier but still

blazing nexus
#

hey

#

i had a hosting related question..

#

so how do you all host your bot's 24/7 rather than Heroku, idk cuz i dont have a credit card with me

quartz kindle
#

well, most of us have credit cards

sharp saddle
#

i tried install it

quartz kindle
#

but without one, your best bet would probably be repl.it

sharp saddle
#

i'll test later

quartz kindle
#

didnt they ahve a repl.it domain as well?

sharp saddle
#

idk

quartz kindle
#

they do, it redirects to .com

sharp saddle
quartz kindle
#

lel

sharp saddle
#

yeah

hushed robin
#

is it possible to check my projects

#

total number of lines

#

in visual studio code

rustic nova
#

vscode does not have it built in

hushed robin
blazing nexus
#

railway deployment pepeStraightStare

hushed robin
#

you said you don't have a credit card

#

use your parents

quartz kindle
hushed robin
#

also

#

hasn't herokus free tier been gone for like

#

a long time now

#

🗿