#development

1 messages · Page 255 of 1

earnest phoenix
#

would that make it so that the command isnt even visible or usuable in seperate servers

earnest phoenix
#

alright, ill send u after

past field
#

explains the difference between guild registration and global registration

solemn latch
past field
#

guild registration = only shows in your server
global registration = allows any guild the bot is in to see it

past field
earnest phoenix
past field
earnest phoenix
earnest phoenix
#

how do i make the ticket system

lament rock
#

That's for you to decide!

earnest phoenix
#

i dont know how

quartz kindle
warm surge
#

I got question for yall

#

has your bot been self restarting out of no where and you havent mess with it at all past few days

#

and there's no errors from self restarting

lyric mountain
#

Uncaught exception maybe

warm surge
#

but there's nothing

lyric mountain
#

Are u sure u aren't muting any exception?

warm surge
#

none muted

lyric mountain
#

How frequently is it restarting?

#

Also any hour pattern?

warm surge
#

every 1 hour or something

lyric mountain
#

Hm, that's very frequent

warm surge
#

it started from discord api error from earlier today

lyric mountain
#

Which error?

warm surge
#

that

lyric mountain
#

Well, did you shutdown the bot manually?

#

It might have been gotten into a restart loop

warm surge
warm surge
lyric mountain
#

That's odd then, I've not noticed that latency issue at all today, might be something local

#

Try enabling debug level logs

#

And waiting till it restart

warm surge
#

client.on("debug")?

lyric mountain
#

It'll be a hella big log tho, probably some performance loss

#

No, debug level on node

warm surge
lyric mountain
#

Oh wait, is the process restarting or the connection itself?

lyric mountain
#

I suppose you use pm2 then

warm surge
#

yup

lyric mountain
#

Check pm2 logs, it might list the cause there

#

You'll need to find by hour

warm surge
lyric mountain
#

Nothing there at all?

warm surge
lyric mountain
#

That's very weird, does it happen with any other pm2 process?

warm surge
#

nothing at seems

#

its just oliver been restarting

lyric mountain
#

How are you handling logging?

#

uncaughtException event?

warm surge
lyric mountain
#

Try listening to unhandledRejection too

#

Also I'm unsure if js works the same, but in java Errors cannot be caught by catching exceptions

warm surge
#

I have that too

lyric mountain
#

As they're supposed to crash

#

Like OutOfMemory or Stackoverflow

warm surge
lyric mountain
#

Might want to put an onExit listener to print the exit code

warm surge
lyric mountain
#

No swap?

#

But well, anyway spikes might happen and snowball into a OOM crash

lyric mountain
#

Only way to know why it exited is by seeing the exit code

#

There oughta be a way to see it in node, otherwise u could have a script call node then printing the exit code of the process

warm surge
lament rock
#

I genuinely don't think the solution is to use a process monitor to restart things for you. I think the correct solution is to make more stable software

frosty gale
#

bro gave him the reality check

lament rock
#

Not if there are errors killing your process pretentiouslyfunnycat

lament rock
#

How does that relate to what I said

chrome tree
#

where the restart should be like the very last "solution" in case something goes horribly wrong

radiant kraken
#

@lyric mountain @quartz kindle are constant pointers just pointers where you can't modify the value it's pointing to or pointers you can't modify the address itself?

#

gotta love these article titles

chrome tree
#

i think my teacher would've killed me for using , and and

radiant kraken
#

if constant pointers are not pointers to constant, does that mean that ```c
const int year = 2024;
const int* ptr = &year;

#

i've always defined constant pointers as pointers to constant

#

but my lecturer interpreted them as literal constant pointers

#

my lecturer said that arrays are example of constant pointers, but which one? thisc int* array = { 0, 6, 7 }; array[2] = 3; // crash or this? ```c
int array[] = { 0, 5, 4 };
array = NULL;

lyric mountain
radiant kraken
#

nooooooo

lyric mountain
#

but I believe the const keyword protect the variable itself

#

I mean, it makes the variable a constant, so const int* would prevent it from being changed, not the value pointed at

true ibex
#

Hello

radiant kraken
lyric mountain
#

idk, too confusing

wheat mesa
wheat mesa
#

You cannot reassign the pointer location of an array iirc

#

So the second one would crash, the first one is fine I believe

wheat mesa
#

oh yeah that’s right I forgot

#

For a compile time array that is true

#

(Why would you bother using pointers in a compile time array?)

#

For a dynamically allocated array, it wouldn’t crash

radiant kraken
#

obviously

frosty gale
#

i use it once a year

radiant kraken
#

i use const everywhere

#

if possible

frosty gale
#

i only use it for global variables but thats it

#

in javascript though i always use const unless i need to change it

radiant kraken
#

yeah that's why i also do it in C

#

though i rarely use const on pointers tho

hidden gorge
#

any reason i can't create a JavaFX Project?

wheat mesa
#

You don’t have a java installation path set

#

You need to set the JAVA_HOME env variable to point to your desired java binary location

lyric mountain
#

I strongly recommend using intellij

frosty gale
#

java for vscode is cursed

quartz kindle
#

xd

#

i use it but i have no idea what it does

wheat mesa
#

Constexpr evaluates expressions at compile time

#

(In the context of variable declarations)

lyric mountain
#

holy fuck @sharp geyser @quartz kindle

#

jetbrains now supports ai for query building

sharp geyser
#

yea I saw that in data grip I think

lyric mountain
#

just updated it, the features are quite good

#

wonder if the issues I opened last year were fixed in it

pearl trail
#

that thing doesn't work on my 3k lines database handler 😔

frosty gale
pearl trail
#

also it's quite dumb for now ig. idk how is it on other's

lyric mountain
#

I mean, with JB's case it runs locally

#

so it has to be trained on how you code

solemn latch
#

is github being slow for anyone else 😦

frosty gale
#

is this worth the upgrade

#

i dont really need it tbh i only want the extra ram because i run vscode server and on 1gb ram it starts shitting itself when it runs for too long

#

5x more upload is helpful though

frosty gale
solemn latch
#

I love it

#

swap is a good idea first yeah

frosty gale
#

the out of memory killer starts kicking in and kills my vscode server for being too fat

#

5 minutes after my server becomes unresponsive first

#

that swap is utter misery

lyric mountain
#

u can change it

frosty gale
#

i need to check if i have enough storage to spare first 💀

lyric mountain
#

ah, right, 15 gb 💀

frosty gale
#

i have gotten unbelievable value out of this server but at a more annoying experience

#

and i do have the money to spare so might as well upgrade eventually

#

im just being frugal

#

maybe ill just upgrade

#

im sure i could probably clean it up to use less but not sure if its worth it

solemn latch
#

Chuck your referal link for gg on your profile

#

It pays off quite a lot.

#

Sometimes I'll get enough referrals in a month to pay for all my servers for a few months.'

#

Shoutout to the person who gave me $20 a month for a few months with my referral ❤️

wheat mesa
#

That server is kind of not amazing for $3 a month, that’s like oracle free tier level perf

#

Then again, $3 a month to not have to deal with Oracle might be worth it

sharp geyser
frosty gale
#

i do not associate oracle with reliability

neon leaf
#

just host at home smh

frosty gale
#

the cloud is where its at nowadays

neon leaf
#

depends

#

I can put 99% of projects on cf workers/pages so no need to worry about that

#

all my game servers, dev servers and lab vms are hosted at home and basically free (like 15€/month power)

#

and the rest is on a cheap hetzner dedi

frosty gale
#

galaxygate himself replied

#

3/10 upsell attempt

#

im pretty sure i have at least a 90% io cap by now

#

i might move to something cheaper tbh but not sure yet

#

my main concern is my email server and its built up a bit of an association with the vps's IP

eternal osprey
#

i can't lie galaxygate fell of

#

their service goes offline every 1 week like waddafuck

#

lets not make it a habit now

delicate zephyr
solemn latch
#

I have been considering getting a digital ocean server for a bit just for webhooks.

eternal osprey
#

pff yeah

#

i completely switched over to datalix

spark flint
eternal osprey
spark flint
#

one of the providers i use

eternal osprey
#

this is datalix

spark flint
#

ddr3 tho

eternal osprey
#

pls compare this to galaxygate lmao

solemn latch
#

oh yeah, I bought datalix

spark flint
#

im moving from datalix because ddr3 is kinda slow and their vms are being so slow and unreliable for me atm

eternal osprey
spark flint
#

yeah but 16gb ddr4 vs 4gb ddr4

eternal osprey
#

huh?

solemn latch
#

I litterally bought datalix and didnt use it because it performed so bad 👀

spark flint
eternal osprey
#

owh wow that is awesome as well

spark flint
#

im using it for my main server atm since my hetzner one finally died after 2 years (python upgrade broke the network)

eternal osprey
#

imo galaxygate is literally nearing the end of the rat race, why are they not taking matters to make the cost lower and therefore the prices lower,?

#

everyone i know has switched away from that stupid provider

solemn latch
#

I think they just have good location

#

their ping to EU cant be outmatched because of location

eternal osprey
#

yeah that's true

solemn latch
#

they're right next to an internet exchange for EU.
So its 1 or 2 hops

eternal osprey
#

i can't lie sometimes datalix just starts tweaking.
I login to the vps and then out of nowhere the actual vps, not my ssh client, starts freezing lmao

eternal osprey
#

but i mean does that really even matter if their services are offline every week?

solemn latch
#

I havent had downtime since the last ddos

#

But yeah its not great :/

#

I dont get why they've been targeted so much

eternal osprey
#

I did, 2x. They sent an email saying that my vps was affected by a server change or whatever

eternal osprey
#

it's really strange.

warm surge
solemn latch
#

thank god for high availability ^-^

warm surge
#

wrong gif

wheat mesa
warm surge
wheat mesa
#

I don’t keep up with discord api stuff but that doesn’t sound right

lament rock
wheat mesa
#

Yeah I was gonna say

solemn latch
#

yeah, thats what I was going to ask.

lament rock
#

Your gateway library should already have resuming logic implemented and if not, switch immediately

lament rock
#

They definitely have resuming

wheat mesa
#

Yeah if your process is restarting constantly, something is wrong with your code, that’s not a discord requirement.

#

Either that or your hardware is super unreliable

warm surge
wheat mesa
#

I don’t know what you mean by “self restart”

harsh nova
#

Probably pm2 restarting the script

lament rock
#

You should never have to restart your app for anything to work unless you bump your dependencies or change core logic you can't hot reload with something like heatsync on npm

warm surge
#

it been restarting itself past 24 hours

warm surge
solemn latch
#

no errors?

#

invalidating important errors?

warm surge
#

no errors

solemn latch
#

or well voiding

warm surge
#

but either way it hasnt restarted itself since 9am this morning

wheat mesa
#

You sure your VPS is reliable?

warm surge
real rose
#

💀

wheat mesa
#

No outages or anything reported?

warm surge
#

no

real rose
#

imma fact check this guy right now

harsh nova
wheat mesa
#

And also are you actually checking the pm2 logs or are you just looking at the VPS

real rose
#

everyoone knows this

warm surge
#

Its weird to think about it

#

why tf is restart itself when its been up for a week

harsh nova
#

My bot ain't crashing also on novo so not novo probably

harsh nova
warm surge
harsh nova
wheat mesa
#

💀

warm surge
#

I didnt have my laptop

wheat mesa
#

Go look at your pm2 logs

warm surge
#

Thats when it started having erros

warm surge
#

shows nothin

#

all it shows

real rose
#

check the errors

#

should be a separate log or smth

#

pm2 can be weird like that

warm surge
harsh nova
#

Those is the standard output tho

warm surge
#

only errors ive been getting when shards die and it trys to post to topgg api

wheat mesa
#

CD into the ~/.pm2/logs dir and do ls

harsh nova
#

I honestly don't think vanilla pm2 has a command to see only errors. It's a weird little thing

wheat mesa
#

And better yet do ls -l

harsh nova
harsh nova
#

Ain't no way

real rose
#

pm2 logs defaults to OUT iirc hence Webster's screenshot shoting bot-out.log

#

if he did ERR it might show error

#

or better again pm2 logs all --lines 150 will show all output

wheat mesa
#

10 bucks says it’s a promise rejection

harsh nova
#

I don't think pm2 works like that

lament rock
#

Oh shoot. Almost been 1 month since my last dependency bump update

harsh nova
warm surge
harsh nova
#

Wtf

real rose
#

i use a flavour of pm2

#

mb bro

harsh nova
#

Stg I tried that

wheat mesa
#

Go to your logs directory and list the files

real rose
#

oh wait i got it

#

pm2 logs --err --lines 150

#

worked for me just now

warm surge
harsh nova
#

My money is on promise rejection

real rose
#

noonewillcare-log

lament rock
#

We're betting?

warm surge
#

for school

wheat mesa
#

y’all would rather trust pm2 commands to work properly than use a damn linux command 😠

real rose
warm surge
#

lowkey i trust Dylan more

real rose
#

bro 😭

harsh nova
#

Trust both

wheat mesa
#

Brother

real rose
#

remember when you ran rm -rf because Tim said it in here

warm surge
#

BROTHER he setup my server

lament rock
#

We don't interact with the raw system. We use wrappers like a boss amandasunglasses

wheat mesa
#

The ls command has existed since the dawn of fucking OSes

real rose
#

fr

warm surge
#

FOUND IT

wheat mesa
#

Don’t forget the --no-preserve-root

warm surge
#

just happen to

real rose
#

too many requests 😭

wheat mesa
#

Damn I was betting on a promise not a ratelimit

harsh nova
#

Ayyeeee unhandled promise! We win

wheat mesa
#

How tf do you run into a ratelimit on a bot with less than 2k servers

solemn latch
#

magic

harsh nova
#

Ah shit it was handled

warm surge
#

ill take a look wtf is goin on

#

jkkk

#

bully me whatever you want

#

but

#

at least we found damn problem

wheat mesa
#

loop with requests

#

probably the issue

warm surge
wheat mesa
#

You found the result of the problem, you haven’t found the actual problem yet 😉

harsh nova
#

Does the error not show the line the error happened?

solemn latch
#

likly just voiding the error

harsh nova
#

Ah

solemn latch
#

this is why you dont void all errors

wheat mesa
#

Honestly this is why you just let exceptions get thrown instead of having a catch all on the process

#

Yeah

#

Lmao

solemn latch
#

I ran into this issue recently. and it was so dumb of me

harsh nova
#

Not a big fan of how js does errors

warm surge
harsh nova
warm surge
#

damn this was hard to find

wheat mesa
#

This doesn’t tell you anything anyways

delicate zephyr
#

by chance

warm surge
delicate zephyr
#

how many servers

warm surge
#

i found the problem

warm surge
delicate zephyr
#

ah nvm then mmulu

delicate zephyr
#

curious now

wheat mesa
#

bro did not find the problem

warm surge
#

I had my bot status set to a min Woo said It might be a risk of ratelimiting so I changed that

#

thats only thing it could be it

delicate zephyr
#

status doesnt call gateway

earnest phoenix
#

how do i make a ticket system

warm surge
#

then idfk

#

but its watiting game

delicate zephyr
#

@warm surge have you set up sharding?

#

I know it's unlikely

#

but gotta ask

warm surge
#

ye

delicate zephyr
#

thats likely why

#

it calls /gateway/bot for sharding

#

@warm surge where do you host your bot

#

VPS or?

warm surge
#

my api uses gateways for sharding

#

and novonde

delicate zephyr
#

for every shard it called /gateway/bot

#

it's stupid and a flaw in d.js afaik

warm surge
#

ik

delicate zephyr
#

im not entirely sure why you're getting that tbh

harsh nova
#

Hard to guess without seeing the source code or a wider context

delicate zephyr
harsh nova
#

Good start might be to not force catch uncaught errors and just let it fail so you get the line the error happened on

harsh nova
delicate zephyr
#

but then

#

idk if they're just logging ALL errors lol

#

regardless of handling

quartz kindle
#

not all at once

#

but yeah, djs's sharding is pretty bad

delicate zephyr
#

they could you know

#

fetch it on the master shard and transmit to all the others

#

but that would be too easy mmulu

quartz kindle
#

yeah thats what i used to do

delicate zephyr
#

d.js really go for the "simplest" solution huh

quartz kindle
#

their target audience is bots in < 100 servers

#

xD

delicate zephyr
#

Touché

frosty gale
#

id probably buy for one month and migrate a few non-important services to see how it runs

delicate zephyr
frosty gale
#

and if its stable then sure

delicate zephyr
#

Ive been with hetzner for 2+ years

#

never had an issue

frosty gale
#

need a clean IP reputation as well ideally

frosty gale
delicate zephyr
#

want me to check any specifically

delicate zephyr
#

that must be old

#

I have zero issues

#

all OK

frosty gale
#

hmm thats good then

delicate zephyr
#

same for my vps

frosty gale
#

i know galaxygate had similar issues with ip ranges being blocked but theyve started cracking down on abuse so theyre all unbanned now

#

maybe they did the same

delicate zephyr
#

yea hetzner is pretty on it

#

their support is good too

warm surge
#

sorry i was texting my cousin girlfiend

delicate zephyr
#

if its only in 190 servers

#

dont shard

#
  1. use webhooks instead of an entire gateway
#

theres so many better ways to do it

quartz kindle
#

isnt hetzner still blocked by discord's voice servers?

delicate zephyr
#

old news afaik

quartz kindle
#

i know the last update was like 4 years ago

#

but i've never seen any confirmation about the block being removed

delicate zephyr
#

I had lavalink running like

#

1.5 years ago

#

and was fine

quartz kindle
#

eu or us servers?

delicate zephyr
#

EU

quartz kindle
#

cool then

#

im on heztner US

frosty gale
delicate zephyr
quartz kindle
#

but afaik their US servers are newer than that

delicate zephyr
#

they do that

frosty gale
#

let me guess its the half assed ip thing that oracle does

delicate zephyr
delicate zephyr
#

they're fairly quick about it

quartz kindle
#

i dont think they asked for mine

#

but i dont really remember

delicate zephyr
#

they asked me

#

4 times

quartz kindle
#

lmao

delicate zephyr
#

I asked support why after the 4th

quartz kindle
#

i guess i have european privilege

delicate zephyr
#

they stopped it happening again

frosty gale
delicate zephyr
frosty gale
#

oracle does that too and they block you without telling you if your ip is blacklisted lmao

delicate zephyr
#

im guessing its not an issue for you?

quartz kindle
#

if its ip based, then i have brazilian privilege

frosty gale
#

i only know because i tried on my work network and it let me register

quartz kindle
#

:^)

#

oracle still canceled me for no reason tho, fuck them

frosty gale
#

i can verify my id i just dont like giving it away in strictly unnecessary situations

delicate zephyr
#

generally unless you're me apparently its only done once

#

and they dont store it, simply just to verify you exist

quartz kindle
#

is it also backed by stripe?

delicate zephyr
#

Uhhh cant remember

#

lol

frosty gale
#

has hetzner never heard of immigration

#

driving license it is then

delicate zephyr
#

tbf any photo id works

#

I used my license

frosty gale
#

is it going to tell me to come in person to verify next

delicate zephyr
#

dw too much

frosty gale
#

nice and were in

#

this is what happens when websites use terrible automatic heuristics

delicate zephyr
#

Yea

#

btw its worth mentioning

#

their VPS are usage based charges

#

so if its shutdown

#

you wont get charged for the time its OFF

frosty gale
#

thats good actually

#

azure/gcp/aws but cheaper

#

nice and secure

#

galaxygate still uses passwords by default lol

#

although i wont use it because i always disable the root account

#

ill add the key to my account later

past field
#

speaking of which

#

i need some advice RSideEye1

frosty gale
#

ok

past field
#

so basically

#

my click war bot

#

i have lots of games on there

#

and they’re all globally registered

#

but i have checks on certain games that only allows certain UID’s to invoke the command to start them

#

i’m wanting to implement those certain games as like premium features

#

best way to go about doing that with just the bot? i don’t have enough experience to create websites or dashboards or anything 😅

#

unless website and dashboard isn’t too hard to venture into?

solemn latch
#

You could use the patreon api

#

but its a pain to use

#

last I heard at least

frosty gale
#

@delicate zephyr i keep allocating new ips but theyre all blacklisted lmao

#

not by majority but mainly by one source

#

"baracuda"

#

so im just creating and deleting ips until i get a non-blacklisted one

past field
past field
#

so patreon will add users to your server and assign them tier roles

#

and i can have my bot check the roles for the premium games

#

another buddy of mine is doing that

#

he’s breaking it down for me

lyric mountain
#

Also their cut is very high, best to search for a fairer option

earnest phoenix
#

any command ideas for my bible bot?

sharp geyser
#

a command that lets you meet jesus

pearl trail
#

sorry it's against ToS and law

deft wolf
#

AI voice of Jesus reading the Bible poggythumbsup

small tangle
#

Now with fancy error messages :^)

radiant kraken
#

DID I HEAR RUST

small tangle
#

Yes :>

radiant kraken
small tangle
#

Rust is really nice when you want to write a parser

crystal wigeon
#

i been learning rust hehe

#

been sitting in rust os

sharp geyser
#

Isn't this the 4th time you've posted this

harsh nova
#

No advertising pls

crystal wigeon
crystal wigeon
harsh nova
crystal wigeon
#

kk gotcha

earnest phoenix
#

yo

#

how do i get my bot verified

quartz kindle
frosty gale
#

i was expecting nothing useful from hetzner support but i was surprised

#

so this blacklist adds you on just because you dont have a valid reverse dns record?

#

so most of their ips arent blacklisted after all

earnest phoenix
quartz kindle
earnest phoenix
#

wow

quartz kindle
#

afaik you are allowed to ask a parent or family member to do it for you

earnest phoenix
quartz kindle
earnest phoenix
lyric mountain
#

ur lower than 13?

earnest phoenix
frosty gale
raven nexus
delicate zephyr
#

they literally told you how

#

love hetzner support

worthy oar
#

Hi - I’m looking for discord that will give me notifications to my phone when a specific user posts. Any help?

lyric mountain
#

dont know any bot that does that

#

in fact that'd be quite unsustainable given how many messages a user send

worthy oar
#

Trying to receive notifications from a specific user when they post on discord

lyric mountain
#

yes, I answered that

#

discord isn't like reddit or twitter where people post ever so often, people in discord often send dozens of messages per minute

#

a public bot would easily hit message ratelimit with a single subscribed user

worthy oar
#

Yes makes sense.. but the people in tracking don’t post that often.

#

I’ve heard of bots that do this

lyric mountain
#

well, then get those bots

worthy oar
#

Just trying to figure out where to get it

#

Came here first to ask

#

Is there anyone here that could make one

lyric mountain
#

make one no, you'll need to hire someone for that

#

you can try searching those bots you mentioned on top.gg, just type on the search bar there

#

but I'm very certain they aren't public, and are constrained to a single channel

deft wolf
#

And you must remember that you can "track" a user only on the servers where this bot is

worthy oar
#

I see.. so if it’s not your server, and you can’t get your bot in. It won’t work

deft wolf
#

Exactly, all "services" that can offer something like this are violating Discord's ToS afaik

quartz kindle
#

dude really wants to spy on someone lmao

wooden ember
#

is it just me or is github dieing for anyone else?

#

keep getting rate limit timers and 429 codes

solemn latch
#

I had issues last night.

#

I wasnt doing much on github, just checking some files for refrences.
So I'm not sure what was going on.

wooden ember
#

I was just searching stuff but its basically unusable

solemn latch
#

I ended up just downloading the repo locally to refer to it.

earnest phoenix
#

whats some commands i can add to my bible bot

sharp geyser
quartz kindle
#

invokes the power of jesus to smite someone

earnest phoenix
#

...

quartz kindle
#

sorry, that was a bad joke

lyric mountain
#

I mean, there's not much you can add to such a bot

earnest phoenix
#

all i have is /info /verse and /random

#

idk what to add

lyric mountain
#

Bots with it what?

#

I said there's not much YOU can add to such a bot, it's literally a book lookup bot

#

Those 3 cmds are pretty much all you can add without going off the rails

earnest phoenix
#

christianity relatted

lyric mountain
#

Sorry but christianity is kinda all about the book

#

Ig you could add a holiday tracker maybe?

#

Aside from that idk, use a payment service and donate 100% of it to charity?

#

You'll eventually reach a plateau of features, that's the destiny of all single-focus bots

#

At that point you just maintain it, basically a finished product

deft wolf
#

Your bot's users are your best source of feature ideas

earnest phoenix
#

i just have on ideas

#

no*

#

i added a support feature for suggestions

#

but my server is empty

#

besides a bible bot i dont have any ideas for bots

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

how do i make a command only available in one server

#

?

quartz kindle
#

for example if you're using discord.js, instead of application.commands, you use guild.commands

earnest phoenix
quartz kindle
#

if you're using discord.js rest, then its Routes.applicationGuildCommands

#

instead of Routes.applicationCommands

quartz kindle
earnest phoenix
#

i dont get how to do it

#

i would update my index.js correct?

#

i just dont get it

#

hm?

quartz kindle
#

did you use Routes.applicationCommands?

earnest phoenix
#

i have no clue

#

i could send u my script if youd like

quartz kindle
earnest phoenix
#

can i send it in dms?

quartz kindle
#

alright

earnest phoenix
#

sent

quartz kindle
earnest phoenix
#

yeah

quartz kindle
#

instead of client.application.commands.set
you can do client.guilds.cache.get(GUILD_ID_HERE).commands.set

#

that will register a command only for that specific guild

earnest phoenix
#

i only want a specific command to do this though

quartz kindle
#

and instead of commandsData you would use the specific command you want to set

earnest phoenix
#

so how do i do this

quartz kindle
#

then you can use a find to get only that command

earnest phoenix
#

umm

#

how do i do this

past field
#

this is what i was showing you in the docs i sent

#

register your command for the guild instead of globally

quartz kindle
#

so for each command in client.commands, either add it to the application, or add it to the guild

#

for example

#
const globalCommands = [];
const guildCommands = [];
client.commands.forEach(cmd => {
  if(command.name === "abc") {
    guildCommands.push(cmd);
  } else {
    globalCommands.push(cmd);
  }
});

client.application.commands.set(globalCommands);
client.guilds.cache.get(GUILD_ID_HERE).commands.set(guildCommands);
#

like add a category to all your commands, or something else

past field
#

@earnest phoenix

earnest phoenix
past field
#

wait a sec

earnest phoenix
#

i know im just trying to figure it out

#

i dont really get it

past field
#

i wanna be top gg verified!!!

tough condor
#

it's so easy to do that on Python with Discord.py or Nextcord

earnest phoenix
#

how do i set it up

tough condor
earnest phoenix
#

...

#

i already have the bot

#

its one thing

tough condor
#

If you do, maybe I could incorporate your commands into my template for you

earnest phoenix
#

i already have most of it done

#

its one thing to fix

tough condor
past field
tough condor
past field
tough condor
past field
tough condor
earnest phoenix
quartz kindle
# earnest phoenix like where do i even put this

look at it and compare it with your own code, and see what you need to change. its basically like building something with lego, its all building blocks that you put together in a logical way. if you still have trouble understanding, it would be wise to learn a bit more about how javascript itself works

tough condor
quartz kindle
#

like if you dont know what .forEach does, and what .push() does, you need to learn about it

quartz kindle
tough condor
earnest phoenix
#

i tried learning lua

#

learned a bitt

#

then stopped

quartz kindle
#

js is not much different from lua, many concepts are shared accross programming languages

earnest phoenix
#

my excuse is im too young!

quartz kindle
#

whenever you see something you dont know what it means or what it does, look it up and try to understand what its going on

#

age doesnt matter, its the motivation to figure it out that matters

#

motivation to understand what you dont understand yet

#

like whne you are in school, you are very good at subjects you like and have interest in

#

but if you dont like a particular subject and have no motivation to learn it, then you wont be very good at it

tough condor
#

Within reason.

earnest phoenix
quartz kindle
#

because that motivation drives you to look up and study on your own, not only when someone tells you

tough condor
earnest phoenix
tough condor
tough condor
earnest phoenix
#

im so lost

past field
#

what could be causing this api latency to be this high?

earnest phoenix
earnest phoenix
#

please

#

WAIT

#

I GOT IT

earnest phoenix
lyric mountain
#

I think u skipped some few too many steps when making ur bot

earnest phoenix
lyric mountain
#

I'll pass

earnest phoenix
#

k

lyric mountain
#

But try to go back to the fundamentals, you're missing a lot of core concepts

#

Mozilla has pretty good courses for js

#

Also codecademy

earnest phoenix
#

..

#

it just needs a database

#

and ill continue to add on cmds

tough condor
earnest phoenix
tough condor
warm surge
earnest phoenix
tough condor
earnest phoenix
#

its a database to save a ticket number...

#

also i need to make another command to display a panel

#

whick idk how to sync with my support cmd

#

no

tough condor
#

@solemn latch

earnest phoenix
tough condor
#

nvm

earnest phoenix
#

i have a support command to display a panel

#

privately

#

that anyone can do

solemn latch
earnest phoenix
#

i need a command to send that panel to a channel for a support channel

tough condor
tough condor
earnest phoenix
#

which syncs the ticket numbers since there is a ticket maker with the command

#

or wtv

tough condor
earnest phoenix
tough condor
past field
earnest phoenix
tough condor
earnest phoenix
#

u can leave after

tough condor
lyric mountain
lyric mountain
#

Adding a database without need will only waste resources

lyric mountain
# earnest phoenix no

Then do the courses, improve upon your projects and eventually you'll be proficient in programming

eternal osprey
#

Hey guys i am in need of some help.

I have a bunch of videos and need to use an ai model to categorise the videos.
Creating an ai model capable of that can cost a lot of time training etc.

Suppose that i do want to use that, what models would be the best?

Not only that, but i came with a solution.
What if i transcribe the video (aka extract the text from the video) and use that in a more simple model.

lament rock
#

That's how summaries of videos are done cheaply (using subtitles)

frosty gale
#

gpt 4 multi-modal model and just feed it the video

#

ez

wheat mesa
#

enjoy using 16 terawatts of electricity each video you feed it lmao

eternal osprey
#

I am srs guys

#

Whats the best option to do

frosty gale
#

hire a company in silicon valley to train rats to be able to identify video categories through reinforcement learning

frosty gale
#

thats about as good as it can get without going overkill

#

but transcribing audio even on half decent gpu hardware is still quite expensive computationally

eternal osprey
#

i see

#

Thank you very much

#

I think that is indeed the best

#

I could use chatgpt for sure

#

and just parse strings to it asking to clasify it

#

But would rather want to use my own implementation

past field
#

is there a node module i can install to create a translator command? or is that an api thing?

lyric mountain
#

api thing

#

you can technically use google translate module, but it's just a wrapper to gtranslate api

#

there's also yandex, in case you want to avoid google

#

both are paid btw

tough condor
lyric mountain
#

bing can barely get correct results, I doubt they'd properly translate slightly long sentences

past field
#

hm

frosty gale
#

looks ok only piece of advice is to avoid using tokio async mutexes if youre not going to be holding a lock across awaits/overly blocking code

#

they have a bit of a performance penalty and a standard mutex would be faster but wouldnt bother fixing that

#

oh right yeah

#

its probably because of this

#

still holds the lock as you call db.query and rust native mutex no no like working across threads

radiant kraken
#

looks pretty good! but rs let queue = app.queue.clone(); let db = app.influxdb.clone(); let hourly = tokio_schedule::every(1).minute().perform(move || { let queue = queue.clone(); let db = db.clone(); i believe you can just pass app as it's already an Arc here, so you don't have to pass two Arcs across threads

frosty gale
#

true although that will probably be optimized out anyways

#

unnecessary clones are common in rust so i would imagine thats on a focus list of things to optimize

eternal osprey
#

hey guys

#

i am learning about stacks and memory in c

#

suppose i have this:


int main(){

function_call():

return 0;
}

how can i know an estimate of how much memory function_call uses on the stack?

#

cuz some ppl told me to print a variable pointer before and right after the function call, but it does not make any sense?

#

all local variables of main are added to the stack BEFORE we call function_call..

proven lantern
# eternal osprey all local variables of main are added to the stack BEFORE we call function_call....

here's an AI response.

You're right to question that method - printing variable pointers before and after the function call won't give you an accurate measure of the stack usage for function_call(). Let me explain why and provide a better approach.
The stack grows downwards in memory on most systems. When you enter main(), space for its local variables is allocated on the stack. Then, when you call function_call(), additional space is allocated on the stack for this function's frame.
To estimate the stack usage of function_call(), you need to measure the difference in the stack pointer before and after the function call. Here's a way to do this in C:

#include <stdio.h>

void function_call() {
    // Your function implementation here
}

int main() {
    void* stack_pointer_before;
    void* stack_pointer_after;
    
    // Get stack pointer before function call
    asm volatile ("mov %%rsp, %0" : "=r" (stack_pointer_before));
    
    function_call();
    
    // Get stack pointer after function call
    asm volatile ("mov %%rsp, %0" : "=r" (stack_pointer_after));
    
    // Calculate and print the difference
    printf("Approximate stack usage: %ld bytes\n", 
           (char*)stack_pointer_before - (char*)stack_pointer_after);
    
    return 0;
}```
eternal osprey
#

i instead used this.

#

i knew what the code looked like, so i continously decreased the pointer in memory untill i reached the last local variable of the 2nd function

#

Assuming a stack looks like this

frosty gale
#

it has poopoo training on both

frosty gale
#

do you want the maximum stack memory a function will use? stack use will fluctuate as the function runs

#

in general the compiler will allocate space on the stack for variables that will live during the entire function call on the top and from there other variables are allocated and freed as the compiler sees as the most optimized approach

#

the only way i can really see you getting a half decent estimate is to output the function as assembly and then count the stack increments/decrements

eternal osprey
eternal osprey
#

it is supposed t be unsafe in this code tho

frosty gale
# eternal osprey yeah

the best person to ask this question is the compiler but there generally isnt a good use case for this

earnest phoenix
#

i need help with an error

frosty gale
lament rock
#

I don't have errors I have "Uncaught fatal exception"

earnest phoenix
#

i have my commands in seperate js files. if i use one to fetch a channel or role how can i save it for use in other commands

deft wolf
#

Most libraries operate on cache, i.e. informations such as channels, users, roles and so on are stored in memory until restart

#

So you fetch a given channel once and it is available in the cache without having to fetch it a second time

earnest phoenix
#

like i use a select menu to fetch a chanel and im using a seperate command to send an embed to that channel

#

how would i do that

deft wolf
#

You probably need a database

bold crypt
#

why u fetch instead of get? (if fetched already)

deft wolf
#

Fetch (at least in discord.js) checks the cache first

earnest phoenix
deft wolf
#

I'm not entirely sure what you want to do, but a database is a good idea in 99% of situations (unless you want to store everything in memory and lose it after a restart)

earnest phoenix
quartz kindle
earnest phoenix
#

in my bot it shows a slash command that was deleted. how do i remove?

#

help

#

sync

#

@solemn latch

quartz kindle
#

for example client.commands.delete(commandID)

earnest phoenix
#

it just shows a command that doesnt exist

#

and when u type it it shows an erorr

#

error

#

so idk whats up

quartz kindle
#

as i said, you need to run the delete code to remove it

#

slash commands are independent from the bot program, they are stored inside discord's servers, even if your bot is turned off

earnest phoenix
#

im so confused

quartz kindle
#

discord has a database of commands

#

when you create a command, it will be stored in discord's database

warm surge
#

tim is right

quartz kindle
#

even if your bot is off, the command is still in discord's database, and will still show up for people

#

of course, when peple run the command, the bot has to be on, or the command will fail

earnest phoenix
#

my bot is on

#

its just showing a non existent command

#

i dont get it

quartz kindle
#

at some point you added that command

earnest phoenix
#

i did

#

then i deleted it

#

from all my scripts

quartz kindle
#

once added, it will stay there forever, until you remove it

warm surge
earnest phoenix
#

how do i remove it then

quartz kindle
#

by running a code to request deletion from discord's database

#

like client.commands.delete(commandID)

earnest phoenix
#

how do i get the command id

quartz kindle
#

you only need to run that code once, you dont need to keep it in your bot's code

earnest phoenix
#

and do i just run it in shell?

#

oh

#

alright

quartz kindle
#

you can see all command ids by console.log(client.commands)

quartz kindle
#

for example, if you type node without any file.js, it will enter repl mode

#

where you can run code by typing in real time

warm surge
#

@quartz kindle

#

not always

earnest phoenix
#

where do i put console.log(client.commands)

quartz kindle
#

if you're not gonna use repl mode

quartz kindle
#

so you need to map

warm surge
#

ah

earnest phoenix
#

im so confused

warm surge
earnest phoenix
#

index.js?

warm surge
#

no

#

ready.js

earnest phoenix
#

ok

warm surge
#

wait do you have ready.js?

quartz kindle
#

wherever you have client.on("ready")

#

the file name doesnt matter

earnest phoenix
warm surge
earnest phoenix
#

im just lost

warm surge
#

sure

#

@quartz kindle question

quartz kindle
warm surge
# quartz kindle nani

const replayed = shard.sessionInfo.sequence - shard.closeSequence; will work for replays events when shard is Resume?

earnest phoenix
#

@quartz kindle

#

Logged in as Xorvian#8654!
Collection(1) [Map] {
'host' => {
data: SlashCommandBuilder {
options: [Array],
name: 'host',
name_localizations: undefined,
description: 'Start a Mag Game or Lob Game',
description_localizations: undefined,
contexts: undefined,
default_permission: undefined,
default_member_permissions: undefined,
dm_permission: undefined,
integration_types: undefined,
nsfw: undefined
},
execute: [AsyncFunction: execute],
buttonHandler: [AsyncFunction: buttonHandler]
}
}

#

this is what shows

#

i dont know where the other command is from

#

it shows this

quartz kindle
earnest phoenix
#

i dont believe so

quartz kindle
#

if so it should show up in client.guilds.cache.get(YOURGUILDID).commands

earnest phoenix
#

i can send u my scripts if youd like

#

im so confused

#

the command doesnt exist

quartz kindle
#

i looked at my code and the way i do it is to count the number of events in between hello and resumed

earnest phoenix
#

@quartz kindle check dms

warm surge
quartz kindle
# earnest phoenix what do i do

you see where you have this:

client.once(Events.ClientReady, () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

in there put the code that deletes all commands

earnest phoenix
#

what code

quartz kindle
#

for example

client.once(Events.ClientReady, () => {
    console.log(`Logged in as ${client.user.tag}!`);
    client.guilds.cache.get(YOURGUILDID).commands.set([]) // delete all guild commands
});
#

run the bot once with that, then close the bot, and remove that line again

#

that code only needs to be run once

earnest phoenix
#

ReferenceError: YOURGUILDID is not defined
at Client.<anonymous> (/home/runner/Xorvian-Bot/index.js:34:29)
at Object.onceWrapper (node:events:634:26)
at Client.emit (node:events:519:28)
at WebSocketManager.triggerClientReady (/home/runner/Xorvian-Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:381:17)
at WebSocketManager.checkShardsReady (/home/runner/Xorvian-Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:364:10)
at WebSocketShard.<anonymous> (/home/runner/Xorvian-Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:194:16)
at WebSocketShard.emit (node:events:519:28)
at WebSocketShard.checkReady (/home/runner/Xorvian-Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:184:12)
at WebSocketShard.gotGuild (/home/runner/Xorvian-Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:158:10)
at WebSocketManager.<anonymous> (/home/runner/Xorvian-Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:234:15)

Node.js v20.16.0

quartz kindle
#

well duh

#

you're supposed to put your guild ID there

earnest phoenix
#

i dont have a guild id in the bot

warm surge
#

guild means server just heads up

#

its discord term

earnest phoenix
quartz kindle
#

you have a guild that is your support server right? and you created a guild command there

quartz kindle
#

no?

#

how many servers is your bot in?

earnest phoenix
#

1

quartz kindle
#

and you're sure you never created a guild command?

earnest phoenix
#

i havent

quartz kindle
#

in any case run that code anyway

earnest phoenix
#

i might just remake the bot

quartz kindle
#

just copy your guild id

#

and put it in there

earnest phoenix
#

im just gonna redo it

#

its not working

warm surge
quartz kindle
warm surge
#

true but discord could use client.servers.cache.get

quartz kindle
#

you could if you wanna make your own lib

#

but the api itself will always call them guilds

#

so lib devs prefer to keep the same nomenclature

warm surge
#

ahh

#

im still figuring out how to make libs for topgg

quartz kindle
warm surge
earnest phoenix
#

whenever i do the extra command it says this
No command matching setup was found.

#

bro

#

what is wrong with my bot

quartz kindle
#

maybe your discord is just bugged

#

and still showing a deleted command

earnest phoenix
#

should i delete my application

#

make a new one

quartz kindle
#

restart/update your discord app

earnest phoenix
#

it shows the setup command for everyone

#

its not just me

quartz kindle
#

well you could always try fetching the commands from discord's database

#

and see if it shows up

#

await client.commands.fetch() for global commands
await client.guilds.cache.get(YOUR GUILD ID HERE).commands.fetch() for guild-only commands

#

console.log() each of those inside your Ready event

earnest phoenix
#

how can i host a replit bot 24/7

deft wolf
#

Replit has been blocking any means of hosting bots 24/7 on its platform for a very long time

deft wolf
#

They really don't like it and that's not the purpose of this platform I guess

earnest phoenix
deft wolf
#

You can probably download the code or you can simply copy it. As for free hosting, there are services that offer such a thing but they have quite significant disadvantages

#

I've never used replit but they probably thought about the option to download the code

deft wolf
#

What disadvantages or what services?

eternal osprey
#

In the dijkstra algorithm, is it still possible to change the distance of a certain vertex if it had already been dequeud (so explored)?

wheat mesa
#

Dijkstra involves exploring every possible path at some point or another, so you will likely pass over the vertex more than once iirc

#

(So I think that means yes?)

stiff dust
#

Hi is there any website or application which I code node js canvas there and it shows the output live?

eternal osprey
#

these mfs say that dijkstra doesn't reconsider a node once it marks it as visited?

wheat mesa
#

I’d have to look back in my discrete math notes to tell you for sure

quartz kindle
#

although its browser canvas, not node canvas, but they are 99% the same

stiff dust
quartz kindle