#development

1 messages · Page 157 of 1

deft wolf
#

I'm using it right now

sharp geyser
#

Honestly might try and make detritus2.0 but the shitter version cause I will never reach the level of cakedan

grizzled raven
# deft wolf I'm using it right now

how does paying for servers and renewals work? it's not really clear and i don't wanna make a mistake

it says the servers are "prepaid" and when buying a server it tells you your duration, this makes me believe you pay for your time upfront and it doesn't renew after the specified duration, but in the tos it's talking about renewals?

rustic nova
#

You pay for it upfront

#

if you decide not to pay again, they'll just yeet your server

#

So that means you pay in advance for that month

deft wolf
#

Yea, after paying for first month you can extend this time

sharp geyser
#

It’s a method to prevent people from using and leaving before paying I assume

rustic nova
#

yup

deft wolf
#

You can also upgrade your server at any time

rustic nova
#

this also allows you to use stuff like paysafecard or paypal to make one-time payments every month

#

which isnt possible on a recurring payment

#

so I'm guessing they have some sort of account you can add balance to, and it'll take that to pay for the next month

#

I must admit though, their dedi pricing is shit KEKW

deft wolf
#

Yes but I'm not sure if it's automatic

#

I'm always doing it manually

grizzled raven
#

how long have you had your server @deft wolf

deft wolf
#

4 days

grizzled raven
#

oh

grizzled raven
wheat mesa
#

I might try to make a game engine in C++ but with Raylib for rendering because I'm too lazy to learn opengl at an advanced level

rustic nova
#

the worst that can happen is they'll remind you about it before it runs out

scarlet raptor
#

Who plays dbl

deft wolf
#

I know there is "trafic notification" via e-mail

#

Idk about payment

grizzled raven
# deft wolf Well

ah okay, i'm assuming your server is €4.95 right, and there's no like extra fee for extending

rustic nova
deft wolf
rustic nova
#

you're on the wrong server

earnest phoenix
#

👍

#

I like this one

#

but I'm searching cheaper I'm broke

deft wolf
#

It is cheap

earnest phoenix
deft wolf
#

I have 4 vcpu and 12gb of ram for 5 euro

grizzled raven
#

which plan did you get

earnest phoenix
#

Hetzner and DigitalOcean are absolutely the best if you can afford them, Hetzner is quite cheap

deft wolf
#

This one

earnest phoenix
#

per month 5€ 💀

#

That's cheap

#

ok sorry

deft wolf
#

Yea, that is like 4-5 lays chips packs in Poland XD

earnest phoenix
#

I'm so broke ahahahah

grizzled raven
earnest phoenix
#

What kind of verification do you mean?

grizzled raven
sharp geyser
sharp geyser
#

Honestly just go with contabo

#

:)

rustic nova
#

mfw locked myself out of my dedi again

#

using rescue to add a crontab that starts wireguard

#

because I forgor to autostart wireguard

earnest phoenix
spark flint
#

this is cool

#

its good 👍

#

i have a reseller acc too

grizzled raven
#

ah, i just asked bc i needed to ask a question about it, thanks

sharp geyser
#

not done yet but you can at least make a connection to the gateway!

#

minus presence

sharp geyser
#

Any idea on how to effectively mitigate rate limiting on the gateway?

#

I was thinking of using a queue system so that way priority requests get sent first

#

but idk

wheat mesa
#

PriorityQueues are fun to use 😉

sharp geyser
#

this is foreshadowing

wheat mesa
#

They’re easy

#

It’s like a line but it’s sorted by order of importance

sharp geyser
#

I see

#

how do I determine whats important tho

#

obviously any reconnect/heartbeat requests are priority

wheat mesa
#

I’m not sure about js but in Java PriorityQueue determines the sorting arrangement via the compareTo method on the type being stored

#

You could assign a different level of importance to each request with a property and sort by that property

sharp geyser
wheat mesa
#

Yes that’s a pretty standard way of implementing things

#

Heaps are commonly used in tandem with priorityqueues and are usually implemented on an array to be more memory efficient/cache friendly

#

Don’t worry too much about the implementation, it’s more important to know how to use it

#

The implementation isn’t too hard once you’ve learned about what a heap is (max/min heap) and how to implement one

sharp geyser
#

yea

#

idk any of that

earnest phoenix
wheat mesa
#

A heap is just a special tree, a max heap is when the greatest element of the tree is the root node, and each parent element is greater than their children

#

And a min heap is the opposite, when the smallest element of the tree is the root node, and each parent element is smaller than their children

sharp geyser
#
queue.push(1, 10);

what df does this mean, I assume one of this is the priority

wheat mesa
#

However this isn't the same as a binary search tree, since that implies that the nodes are sorted in a particular order where the (usually left) child is less than the parent and the (usually right) other child is greater than the parent

wheat mesa
#

It all depends on the implementation

#

Oh you're looking at heapify

#

anyways, gotta go to work now

#

cya misty gl

sharp geyser
sharp geyser
earnest phoenix
sharp geyser
# earnest phoenix Sure

Okay so, when it comes to using a priority queue what would be the best way of setting the priority of requests being sent over the gateway and even if its queued, I still need to make sure its not rate limiting by sending too many requests

#

Should I just assign priority numbers to specific requests and when they are being made just load them into the queue and process the queue that way?

earnest phoenix
#

Yes, that's exactly what you're using the priority queue for

#

The requests that are the most important should have the highest priority

sharp geyser
#

Okay

#

I’m wondering how I should do this then cause obviously just doing it how I’m currently doing won’t work with a queue system

#

I think I have an idea

#

It’s probably not the best though

covert ingot
#

Question, with box-shadow there is a tiny bit in the corner where, well, it acts like a shadow and isnt shadowd

#

any idea how i can replicate this ?

#

tiny bit in left corner

#

is missing

#

need to fill it

lyric mountain
#

It's not missing, think about the shadow as if it was a paper you're holding next to a light source

#

So in the same way there's a tiny gap there, there'll be a tiny excess on the other side

desert verge
#

Because I have poor explaining (due to autism+ Not English Native), I need a native English to rewrite all my commands description/ Parameters description and success error messages that may not explain everything important

tulip ledge
tulip ledge
tulip ledge
#

Also is it possible to translate command descriptions per server?

marsh lark
#

Not per server (unless you use guild commands which is not recommended if it's a public bot), if you're trying to accomodate for different languages Discord has i18n support

desert verge
desert verge
#

Alright I tried to do myself

civic bloom
#

hi I'm not able to get topgg webhooks working on AWS

#

It used to work when I used to host my bot on railway

#

It does not show any errors and I have enabled all ports in aws settings

marsh lark
#

Can you try going to the webhook url in your browser? (even if its a 404)

civic bloom
marsh lark
#

Does your vps have a firewall of any kind? Like iptables

#

Apart from the aws one

civic bloom
#

how do i check

rustic nova
#

try using iptables or ufw

#

ufw status to check if you have any ufw rules set
iptables --list if you have iptables set

civic bloom
civic bloom
#

Still no clue why it isn't working

rustic nova
#

then its an issue with your aws instance, can you even visit a normal webserver to begin with?

#

such as by just installing apache2 and visiting that

rustic nova
civic bloom
rustic nova
# civic bloom

well then visiting your webserver like that here will obviously not work

#

not providing a port defaults to 80

#

you need to append :5000 if you're visiting a webserver under that port

civic bloom
rustic nova
#

at least you can connect to it, that error means that you're trying to make a get request to your webserver (aka directly visiting it on your browser) and not a post request

#

which is intentional

#

top.gg makes post requests to it

civic bloom
#

So it should be working right

#

But it's not

#
0|bot      | Error handling request
0|bot      | Traceback (most recent call last):
0|bot      |   File "/usr/local/lib/python3.10/dist-packages/aiohttp/web_protocol.py", line 332, in data_received
0|bot      |     messages, upgraded, tail = self._request_parser.feed_data(data)0|bot      |   File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
0|bot      | aiohttp.http_exceptions.BadStatusLine: 400, message:
0|bot      |   Bad status line "Invalid method encountered:\n\n  b'\\x02\\x01'\n    ^"
0|bot      | Error handling request
0|bot      | Traceback (most recent call last):
0|bot      |   File "/usr/local/lib/python3.10/dist-packages/aiohttp/web_protocol.py", line 332, in data_received
0|bot      |     messages, upgraded, tail = self._request_parser.feed_data(data)0|bot      |   File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
0|bot      | aiohttp.http_exceptions.BadStatusLine: 400, message:
0|bot      |   Bad status line "Invalid method encountered:\n\n  b'\\x16\\x03\\x01'\n    ^"
0|bot      | Error handling request
0|bot      | Traceback (most recent call last):
0|bot      |   File "/usr/local/lib/python3.10/dist-packages/aiohttp/web_protocol.py", line 332, in data_received
0|bot      |     messages, upgraded, tail = self._request_parser.feed_data(data)0|bot      |   File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
0|bot      | aiohttp.http_exceptions.BadStatusLine: 400, message:
0|bot      |   Bad status line "Invalid method
#

I got this error

#

I think it's from viewing from the browser

earnest phoenix
earnest phoenix
civic bloom
#

That's not the problem here

earnest phoenix
#

i didn't read sorry

civic bloom
#

I just want to get the webhook working

lyric mountain
#

Issue is ur using the wrong method

#

Says right there

civic bloom
#

Yes understood

lyric mountain
#

What are u trying to connect to?

#

Discord webhook?

civic bloom
civic bloom
lyric mountain
#

Do you get that error if you receive a vote?

#

Or only when trying to visit it?

civic bloom
#

when I try to visit on browser

lyric mountain
#

Then simply make a custom error endpoint to handle it

#

You shouldn't even log 4xx error to the console

#

As those are request issues

civic bloom
#

I'm not going to visit it on browser

#

I just checked because he asked to

lyric mountain
#

Yes, but helps sanitizing your log

civic bloom
#

He wanted to check if the webserver is working

lyric mountain
#

Else someone could spam your log with it

civic bloom
#

I have no clue why it's not working

lyric mountain
#

Are u trying to test with test button?

civic bloom
#

yes

lyric mountain
#

Did they fix it at all?

#

Cuz it wasn't working from what I remember

civic bloom
#

really?

lyric mountain
#

Iirc, yes

#

Try voting to your bot to test

#

Or use postman to mimic the request

civic bloom
#

Still doesn't work

lyric mountain
#

Is the port open?

#

Nvm, u did access it on the browser

#

Do you have any logging inside the endpoint?

#

To know if the request is being received

civic bloom
#

Yeah I have

#

It sends DM to the user who voted and also logs it

lyric mountain
#

Logs at what moment?

#

Like, how far from the start of the function is it?

civic bloom
lyric mountain
#

Not what i mean

lyric mountain
#

Do you check anything or do database operations whatever?

civic bloom
#

Top.gg sends a post request to the endpoint when someone votes

lyric mountain
#

Ik

civic bloom
#

Nothing is wrong with the code it was working with my other host

lyric mountain
#

Put a log message at the very first line, before anything else

civic bloom
#

wdym

lyric mountain
#

print("here")

#

Right at the first line of your endpoint

#

To be extra sure it's not code issue

civic bloom
#

I'm sure it's not

lyric mountain
#

Won't hurt to assert

civic bloom
lyric mountain
#

Programming isn't something you can be sure of anything, little apparently unrelated changes sometimes kill whole sections of code

lyric mountain
civic bloom
#

I don't believe it's the code

lyric mountain
#

Perhaps, but probably not as I'm receiving votes normally

#

Use postman to try to mimic the request sent by topgg

#

Also, ur not running the bot locally are you?

civic bloom
#

I did tell that I'm running the bot on aws

lyric mountain
#

I wasn't here before

#

Btw, isn't aws too expensive for a 24/7 application?

civic bloom
#

should've read what I said from the beginning

lyric mountain
#

Your last resort is postman, if it fails we have a case

#

Else I don't really know what could be happening

lyric mountain
rustic nova
#

that is why it cannot figure out the status code

#

can you post your full url you've set within top.gg

civic bloom
#

I tried with https too

#

Idk I tried many times with and without the ports

rustic nova
#

well using ports is required

#

as your webserver does not run on port 80 or 443

#

keep in mind that:

  • if your webserver is only able to serve http, visiting https://example.com:3000 will not work, as using https will have top.gg assume that your webserver is using ssl
#

which will have top.gg initiate a SSL connection to said domain, which your webserver will not understand and will assume its some sort of status code unknown to it

#

"Invalid method encountered:\n\n b'\x02\x01'\n ^"

#

is an indicator of that

civic bloom
#

oh yes

#

I visited https on browser and it showed the error again

#

But nothing when I change the url on top.gg

rustic nova
#

what happens if your visit http://example.com:3000 on your browser

#

aka with your full url, using http and :3000

civic bloom
#

With https it shows ERR_SSL_PROTOCOL_ERROR

#

And with http it shows 405: Method not allowed

rustic nova
#

then your webserver cannot handle https connections

#

using http should work

#

yes that works

#

method not allowed is again intentional, as your webserver doesn't allow get requests

#

put that url on top.gg and see if it works

civic bloom
#

yes I did

#

doesn't work

rustic nova
#

post your full url here

#

and have you pressed save before testing it

civic bloom
#

Yes I have

rustic nova
#

aka save before using the test button

rustic nova
#

are you also providing the authorization to top.gg?

rustic nova
#

Whats the authorization so I can test that too

civic bloom
#

I'll send in dms?

rustic nova
#

you can also just change it to something different now or later on

civic bloom
#

okay

#

||moyai||

lyric mountain
#

Laughed a little

rustic nova
#

works fine

#

are you sure you have pressed save on top.gg, then used the test vote button

#

keep in mind depending on the library you're using, theres separate event listeners for both handling normal votes and handling test votes

#

a test vote will not show up on a normal vote

civic bloom
#

i got this on logs

#

Received a test vote by: None (12345)

rustic nova
#

And you are 100% sure you have correctly set it on top.gg

civic bloom
#

yes

rustic nova
#

screenshot the webhook section please

civic bloom
#

and yes i have saved

earnest phoenix
rustic nova
#

did you receive another test vote?

civic bloom
#

Nop

rustic nova
#

cant help then

civic bloom
#

damn

#

so whats exactly wrong

rustic nova
#

no clue

civic bloom
#

Probably an issue from top.gg's side right?

rustic nova
#

am not able to reproduce the issue on my end

slender steeple
#

#support check your channel? @rustic nova

rustic nova
#

wait for someone who is available?

civic bloom
#

Is it some DNS issue

rustic nova
#

I mean you could try testing it again later, possibly the dns is not being propagated yet

civic bloom
#

I'll try using the ip address

rustic nova
#

is your servers ip under that domain?

#

yeah try it

civic bloom
#

Oh that works

#

💀

civic bloom
#

Because this has been happening for 2 days

rustic nova
#

shrug no clue who your dns provider is, if you have just added aws.* to your domain, maybe 24 hours

#

I always suggest just using cloudflare instead as your dns provider

civic bloom
#

I am using cloudflare DNS

#

1.1.1.1

rustic nova
#

not what I'm referring to

#

I am referring to the provider who manages your domain

#

aka your stooby.tech domain

civic bloom
#

oh

civic bloom
#

Transfer the domain?

rustic nova
desert verge
#

When my bot profile updates on top gg?

deft wolf
#

When you click "refresh data" and then "edit" and "save"

#

If you mean bot name/profile avatar

desert verge
#

ok thx

oak vector
#

hoi

covert ingot
#

im not the best with css, n was wondering how i can put the text to be at the bottom of the image

#
.desc {
    background-color: rgba(0, 0, 0, 0.5);
    bottom: 0;
    left: 0;
    box-sizing: border-box;
    color: #fff;
    margin: 0;
    margin-left: 2.5%;
    margin-bottom: 5%;
}``` margin botom made it go up, as expected, so i tried margin-top but it didnt work, it just stayed in the same position. Any ideas?
covert ingot
#

^ fixed

deft wolf
#

I am sure that everyone who is active on this channel can write a bot

peak drum
#

So trueKEKWDisco

cobalt torrent
#

Maybe There Are Those Who Can't

peak drum
#

Yea not in a discord server that is almost all about discord bots KEKWSlide

cobalt torrent
#

so

peak drum
#

Maybe you have better luck somewhere else xD

#

Maybe top.gg will ask a fee for it KEKWSlide KEKWSlide

cobalt torrent
#

I'm trying my luck everywhere

#

xNick Me Turkish bro okah

deft wolf
#

Cool

#

Are you broke?

peak drum
#

Maybe try some small community’s

cobalt torrent
#

maybe because it's something like advertising

#

Do you think I might have a chance in new communities?

deft wolf
#

No

cobalt torrent
#

?

peak drum
#

I have a free discord bot hosting for your special bot KEKWSlide

#

Not for 10$ xD

deft wolf
#

No one will pay you $10 for a bot

peak drum
#

Try like 2$ tops

#

Well it difference for what type of bot it is

cobalt torrent
#

I'm Turkish so I don't know much so what are the prices here?

deft wolf
#

It's literally downloading files from github, typing npm install and you have a bot that has 500+ commands

#

That's 10 minutes max

peak drum
#

Yeah but most of them are outdated

deft wolf
#

I'd still rather have a bot that is outdated than pay $10

peak drum
#

Since you have the bot dev role I’m sure you can create one yourself KEKWDisco

cobalt torrent
#

chahaha so funny @deft wolf

peak drum
#

But for somebody who what’s a custom bot for their community with a lot of commands and functions 10$ isn’t that bad ig

deft wolf
#

Yea but you need host it somewhere

cobalt torrent
#

Maybe I'm selling a very good boat for $10, how do you know?

peak drum
#

There are a lot of free options and paid ones for like 0,25 cents xD

#

I would buy a boat for $10 KEKWSlide

deft wolf
#

Holy fuck

#

10$ for a boat?

#

NOWAY

cobalt torrent
#

@peak drum you devepoler

#

??

peak drum
#

Yea but you spelled bot wrong so now we make fun of you

cobalt torrent
#

Are you selling Minecraft hosting or something or do you have a server?

peak drum
#

Yea I sell lots of hostings xD

#

I can sell you a discord bot hosting for your special bots KEKWDisco

cobalt torrent
#

No I don't want to Xd

peak drum
#

I got a free option too xD

lyric mountain
#

UwU is this advertising

cobalt torrent
cobalt torrent
peak drum
#

LolKEKW

cobalt torrent
#

polent

peak drum
cobalt torrent
#

sosiee

#

me bots ad declinde

quartz kindle
#

godzilla had a stroke trying to read that

peak drum
cobalt torrent
#

m@L

quartz kindle
#

lmao wat

lyric mountain
#

Smh my head

#

Time to go back to topic

cobalt torrent
#

Toic?

lyric mountain
#

No, development

earnest phoenix
peak drum
rustic nova
#

@cobalt torrent keep it sfw

cobalt torrent
#

I don't know what sfw is dude I don't know much

marsh lark
#

safe for work

lyric mountain
#

Aka common sense

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

make a football/sports manager game

lyric mountain
sage bobcat
hallow lotus
#

help me

peak drum
#

If somebody is going to help you they need a bit more context

hallow lotus
#

i want to show it here on our website

peak drum
#

Make sure your website allows iframes and you’ve correctly set the property’s of the iframe

#

Like the domain

hallow lotus
#

i did it all right, but it just doesn't happen

#

will you help me?

frosty gale
#

a lot of probabilities and events

#

and stuff you can upgrade

lyric mountain
#

see on the console why it didn't load

warm surge
frosty gale
#

i swear this is the first and only website i found that actually respects the browser "privacy opt out" header

peak drum
#

Lol

frosty gale
#

gdpr and other countries should make it law having to abide by the header

#

it would also help solve the "mandatory cookie notice" annoying problem

wheat mesa
#

not like it would solve any issues tbh

hallow lotus
wheat mesa
#

I feel like most companies would just ignore it

#

Unless it's actually heavily enforced

deft wolf
lyric mountain
#

there it is

#

oh, btw

#

.tk domains are blocked in like 98% of the internet

#

and u never actually get to own it

#

freenom simply embeds your site in an iframe, and put a bunch of trackers in it

sage bobcat
#

One message removed from a suspended account.

frosty gale
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

frosty gale
#

I remember putting my freenom site on cloudflare

sage bobcat
#

One message removed from a suspended account.

frosty gale
#

but yeah basically all freenom free domains are blocked by a lot of services bc it can be abused so easily

#

this is why we can't have nice things

#

domains should be free or at least some of them

#

for personal uses

#

but there needs to be restrictions so a person doesn't just acquire a lot of domains and resells them

#

and I just realised we've come full circle back to not having nice things

lyric mountain
#

basically, you never link domain -> server directly, like other providers

#

the domain itself is borrowed to you, but the page is never directly linked to the domain

#

also they reserve the right to reclaim the domain at any time

peak drum
#

Yea once you get an decent amount of traffic they will xD

sage bobcat
#

One message removed from a suspended account.

peak drum
#

Last time I wanted to get a free domain freenom didn’t even work xD

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lyric mountain
#

.site is $2

#

I think

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

frosty gale
#

since when does chromium make use of windows's efficiency mode

#

i only really see windows programs using it only

sage bobcat
#

One message removed from a suspended account.

frosty gale
#

thats actually a good thing

#

w

#

it marks certain processes as not requiring as much of a priority or timely execution which improves system speed and responsiveness

slim heart
frosty gale
#

thats the first time ive seen it

sharp geyser
#

Since when did you need a reconnect url to perform a gateway reconnect

sage bobcat
wheat mesa
#

Imma be real I’ve never used brave but if the product is good who cares about the owner?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
radiant kraken
#

hate the guy, not the browser iara_yawn

quartz kindle
#

brave is alright, but i like ungoogled chromium better

#

its not as polished tho, some things dont work on it

#

but it does feel lighter to use

radiant kraken
#

i heard firefox is good

wheat mesa
#

I use firefox

#

It's pretty nice

#

It's not exactly light on resources if that's what you're looking for, but it has a good feel to it

sharp geyser
#

dang

sharp geyser
#

@quartz kindle hey buddy :)

radiant kraken
#

hey buddy (:

earnest phoenix
quartz kindle
#

v8 >>> spidermonkey, sad but facts

kind lily
#

th I do ,_,

frosty gale
#

spidermonkey is such a goofy name

kind lily
deft wolf
#

No one will help you with this, you have to wait until everything calms down

spark flint
#

cheapest tlds

#

spaceship </3

peak drum
#

Wtf I paid like 3 euros for a .xyz domain xD

spark flint
#

lol

marsh lark
#

Arent their renewals a bit more expensive

eternal osprey
#
 gibsonChurch() {
    let randomIndex = Math.floor(Math.random() * 2);
    if (randomIndex === 0) {
      return "../.././src/IMG_4744.MOV";
    }
    return "../.././src/IMG_4745.MOV";
  }```
I am trying to access the src from a file in the  listings folder
#

it returns me undefined as the path is wrong?
I was thinking like this;

../ -> escapes from listings to commands.
../ -> escapes from commands to root.
./src -> from root to src.

marsh lark
#

You don't need the ./ so just ../../src/file.mov

eternal osprey
#

but would that be the issue?

#

I found that ./ and none just returns the same result.

marsh lark
#

Well then how are you getting the file

#

require()? fs.readFileSync()?

eternal osprey
#
 const attachment = new AttachmentBuilder(path, {
      name: "church-of-gibson.MOV",
    });```
#

where path = "../../src/IMG_4744.MOV"

#

still errors

#

am i doing sometwhing wrong

quartz kindle
#

if attachmentbuilder uses fs to read the file, it might be interpreting the file path wrong

#

or trying to use it from its node_modules location and not your file's location

#

so you might need to be more specific and provide an absolute path instead of a relative one

digital swan
#

anyone know how i can fix this issue? google just doesnt seem to want to index my pages

digital swan
#

that just shows the list of pages

marsh lark
#

What does learn more point to? Or is it just a generic help page

digital swan
#

yeah exactly that

marsh lark
#

Yeah so I would wait a few days/weeks

#

Yeah I think there's no request indexing button on yours so you can't re-request that

digital swan
#

i can request indexing on specific pages

#

but theres over 500

marsh lark
#

If your site is correctly linked (i.e. all your pages link to each other) then as long as you re-request indexing on the root page it should appear (slowly, but you shouldn't have to request indexing on 500 pages either)

digital swan
#

i had to make a sitemap for google to discover the pages

#

i can try reducing the amount of pages to see if that helps but i doubt it would

marsh lark
#

Sitemap works too

sharp geyser
#

You dont need to await an async function if you don't care about the using the return value?

#

just checking to make sure im remembering correctly

marsh lark
sharp geyser
#

well yes I know that

#

let me rephrase my question then

marsh lark
#

Oh I see what you're asking

#

Yes it'll still run

sharp geyser
#

good enough for me then

marsh lark
#

But if it rejects you can't handle it unless you use .catch()

sharp geyser
#

yep

north cairn
#

hey so,i am currently trying to make a ticket system on my bot(discord.js v13)
i want to first do the channel setup command which would setup the channel and then do send panel command

but i am having some issues with db

#
    let channel = message.mentions.channels.first()
    if(!channel.isText) return message.reply(`Please mention a text channel`);
    if(!channel) return message.reply(`Please mention a valid channel`);
    db.set(`ticketPanel_${message.guild.id}_${channel.id}`)
    message.reply(`Successfully setted <#${channel.id}> as ticket ```
#

this is how i registered the channel id of the channel setupped of a server

#

i am trying to access it in send panel command like this

#
 let channel = db.get(`ticketPanel_${message.guild.id}`)```
#

can someone tell what am i doing wrong

sharp geyser
#

Not without you first telling us what is happening that you aren't expecting, or showing us any errors you're getting

north cairn
sharp geyser
north cairn
#

well channel cant be defined in send panel command

sharp geyser
#

then dont save it using both the guild and channel id?

north cairn
#

i said that i want that user to setup the channel once

#

then i register it in database

sharp geyser
#

okay but like

north cairn
#

and send panel there

sharp geyser
#

you are saving it as ticketPanel_guildid_channelid

#

without channelid its going to return undefined

north cairn
#
if(!channel) {
 
      const nochannelembed =  new MessageEmbed()
        .setTitle("Error")
        .setDescription("There is no channel setuped")
      .setFooter("Run the \ `channel` \ command to set a channel!")
      .setTimestamp()
      .setColor("RED")
      message.reply({embeds: [nochannelembed]}) }
    else{
      const pe = new MessageEmbed()
      .setColor(`#303136`)
      .setTitle(`${message.guild.name}'s Ticket Panel`)
      .setThumbnail(client.user.displayAvatarURL({dynamic: true}))
      .setTimestamp()
      .setColor("BLUE") 
      .setFooter("Making Unnecessary Tickets Is Against Our Terms Of Service!")
        message.reply(`Successfully sended panel to <#${channel.id}>`).then(async () => {
     const tsc = await client.channels.cache.get(channel)
          tsc.send(`test msg`)```
sharp geyser
#

so figure out a way to not need the channelid or find a way to get thechannelid

north cairn
quartz kindle
#

doesnt quick.db automatically nest objects for you if you use a dot as a separator?

marsh lark
#

yes

quartz kindle
#

so for example

north cairn
#

@earnest phoenix come here

quartz kindle
#

ticketPanel_${message.guild.id}_${channel.id} this will not work if you use ticketPanel_${message.guild.id}

earnest phoenix
#

Yes?

quartz kindle
#

but if you use dots, it should get you an object with all its children

north cairn
quartz kindle
#

like this
ticketPanel.${message.guild.id}.${channel.id} and ticketPanel.${message.guild.id}

quartz kindle
#

idk if quick.db still does that

#

but i remember it did that at some point

north cairn
#

it should ig

sharp geyser
#

quick.db hardly changes

north cairn
sharp geyser
#

I honestly don't know why people even bother using it over conventional methods

quartz kindle
#

well, its quick and easy for beginners

sharp geyser
#

fair enough

#

but so is mongodb apparently trollface

quartz kindle
#

even tho its not efficient, most projects where its used are small, so its fine

north cairn
#

oh cmon it isn't

#

mongo is way hard than quick db

sharp geyser
quartz kindle
#

nice

sharp geyser
#

Going horribly rn

quartz kindle
#

xD

sharp geyser
#

Honestly debating on just not even helping the end user mitigate gateway rate limits

#

and leave it up to them

#

😭

north cairn
#
let channel = db.get(`ticketPanel.${message.guild.id}`)```
so this should work
quartz kindle
#

gateway rate limits are easy tho, rest rate limits are the hard ones

sharp geyser
#

I mean

quartz kindle
#

it will give you EVERYTHING that is inside that guild id

sharp geyser
#

discord with its gateway/bot endpoint gives me all the data I need

#

but I don't know what would be the best way to use it

quartz kindle
#

you mean gateway command rate limts right? the ones that you send via websocket, like request guild members

sharp geyser
#

This is what it gives

quartz kindle
#

those are per-shard, so its easy to implement

#

ah you mean the session start limit?

sharp geyser
#

yea

#

I wanna help them not accidentally login 2000 times ahem glitch.com shenanigans

quartz kindle
#

session start limit is basically every 5 seconds you can send 1 IDENTIFY request, multiplied by max_concurrency

sharp geyser
#

icic

quartz kindle
#

it also needs to be divided into buckets

sharp geyser
#

huh

quartz kindle
#

moduled by max_concurrency

sharp geyser
earnest phoenix
#

If i saved as this

db.set(`ticketPanel.${message.guild.id}.${channel.id}`)```
quartz kindle
#

but basically, you will always have max_concurrency = 1 until you have like 150k guilds

earnest phoenix
#

It should work?

sharp geyser
#

So uh, yea lets just not give any fucks like discord.js :)

quartz kindle
#

then you suddenly get max_concurrency=16

#

so when you get max_concurrency=16

#

its basically like this

#

shard id modulo 16 = 5 seconds cooldown

#

for example, shard 1 and shard 2 can login at the same time

#

but shard 1 and shart 17 cant

#

because they share the same modulo id

sharp geyser
#

icic

quartz kindle
#

1 % 16 === 17 % 16

#

so you can send 1 identify per 5 seconds per shard modulo id

north cairn
sharp geyser
#

So would I just need to save a timestamp of their last identify attempt, and anytime a new attempt is made just compare it to the old timestamp

#

or is it more complex than that

earnest phoenix
quartz kindle
#

pretty much yeah

#

as long as you're aware of each shard's modulo id

sharp geyser
#

I don't even know what that means

#

😭

quartz kindle
#

for example

#

if you have 150+ shards

#

and you have max_concurrency = 16

#

shard 0 and shard 16 and shard 32 and shard 48... all have the same modulo id

#

because shard_id % max_concurrency === same number

#

0 % 16 = 0
16 % 16 = 0
32 % 16 = 0

#

so those shard ids

#

you can only login one of them every 5 seconds

#

regardless of order

sharp geyser
#

Okay so I would have to check the shard(s) that is trying to identify?

quartz kindle
#

so login shard 0, wait 5 seconds, login shard 16, wait 5 seconds, login shard 32

#

but you can also login shard 16 first, then wait 5 seconds, then login shard 0

#

for example

#

what matters is their modulo id

sharp geyser
#

Doesn't matter the order

#

Hm

quartz kindle
#

now shard 1 for example

#

1 % 16 = 1, not 0

#

its a different modulo value

sharp geyser
#

I can login shard 1 and 16 at the same time then no?

quartz kindle
#

so it doesnt share the same limit as the first set of shards

#

it can be done concurrently

sharp geyser
#

I see

quartz kindle
#

so if you have max_concurrency = 16

#

you can login 16 shards at the same time

#

as long as they are all in different modulos

sharp geyser
#

I see

#

Okay wait

#

So this here is the identify payload that you would send to discord over the websocket

#

If there is sharding, you would put the current shard's id there as well as the total number of shards the bot is going to use right?

quartz kindle
#

ye

sharp geyser
#

so each time a shard is spawned the id sent will be different

quartz kindle
#

yup

sharp geyser
#

Okay okay

#

now let me figure out how to formulate my next question

#

okay off topic real quick

#

so all shards wouldn't receive the same events?

quartz kindle
#

each shard only receives events pertaining to the guilds assigned to it

sharp geyser
#

huh

quartz kindle
#

except DMs, which are always sent to shard 0

#

for example you have 3 shards, with 1k guilds each, total 3k guilds

#

events about a guild that is assigned to shard 1, will only be received on shard 1

#

never on other shards

sharp geyser
#

well yea that makes sense

quartz kindle
#

and if your bot receives a DM, it will always receive it on shard 0, never on other shards

sharp geyser
#

I thought it meant that certain events wont be received because of the split connection

quartz kindle
#

nah

#

all events work normally

sharp geyser
#

nvm then

#

:p

quartz kindle
#

just not sent to all shards

#

only the relevant shard

sharp geyser
#

Okay so then should I put shards into queues?

#

Cause it seems to me that you want to connect the shards that have different modulo ids first and then connect the next batch but idk

quartz kindle
#

basically the way i did it on tiny-discord is simple

#
const bucket = Array(max_concurrency).fill(0);

// shard login
const shard_bucket = shard_id % max_concurrency;
const previous = bucket[shard_bucket];
const current = Date.now();
if(current - previous < 5000) {
  // wait and try again
} else {
  bucket[shard_bucket] = current;
  login()
}
sharp geyser
#

Hmm

#

So basically you just make an array with the max size of however many shards can be connected within 5s

#

wait

#

so you're really only storing the time it was connected?

#

so the key is the shard connected, value is the time it was connected

#

and you're substracting the current time minus the previous shard that was connected and seeing if it has been 5s before logging in

sharp geyser
#

as I assume i'd put this in a method of a class

quartz kindle
#

so its possible it will need to wait more than once

sharp geyser
#

icic

#

Also

#

sorry took so long to respond to my "also" message

#
async connect() {
        if (this.sockets > 0) {
            let num = 0;
            while (num < this.sockets) {
                const socket = new Socket(num);

                this.socketStore.set(num, socket);

                num++;
            }

            // once it breaks out of the loop do the bucket thing and connect shards as they are supposed to be
        }

        const socket = new Socket(0);
        await socket.connect();
    }

This is my current plan on connecting shards if they wanna do sharding

#

this.sockets will be the number of shards they wanna spawn which will be set in the client options

#

I am basically doing a while loop that will create all the shards needed until it reaches the max and then sets them in a socket store. if they don't supply a number of shards they wanna spawn it will default to just one and connect normally

#

Do you think this is ideal?

#

or should I just treat it as if they are going to spawn multiple shards anyway

quartz kindle
#

its easier to always treat it like multiple shards, even if you only have 1

#

so you dont need to maintain two sets of code for the same thing

#

code for single and code for multiple

north cairn
#

still says undefined

sharp geyser
#

Is it efficient? hell no

#

does it work? probably not

quartz kindle
#

since you know the exact number of shards, its more appropriate to use a for loop

#

while loop is more for something irregular or dynamic

sharp geyser
#

I see

#

honestly I haven't even used a programming language in a while

#

so ye didn't know that

#

ofc you can use a for loop my god im stupid

north cairn
#
 let channel = db.get(`ticketPanel.${message.guild.id}`)```
#

it still returning undefined

#

can someone say any othe metods

#

methods*

quartz kindle
#

or use a more complex key

sharp geyser
#
for (let id = 0; id < this.sockets; id++)
  this.socketStore.set(id, new Socket(id));
#

ez :)

quartz kindle
#

how many ticket channels do you have per guilds? only 1?

north cairn
#

AH

quartz kindle
#

how many other things do you have in a guild? only a ticket channel, or more things?

quartz kindle
#

then you can do something like ticketPanel.{guildID}.channel

#

and use .set and .get with the same key

sharp geyser
#

Okay I think its time to actually make the client

#

and see if identifying even works

north cairn
#

i think that only works in get?!?

quartz kindle
#

do you need to store multiple things in that channel id?

#

or its only the id

#

are there any things like timers, limits, etc

north cairn
#

nah nah
only the server and the channel chosen

quartz kindle
#

so just use .channel

north cairn
#

bro channel isn't defined in send panel

quartz kindle
#
// set
db.set(`ticketPanel.${message.guild.id}.channel`, message.channel.id);

// get
 let channel = db.get(`ticketPanel.${message.guild.id}.channel`);
north cairn
#

lemme try hold up

quartz kindle
#

honestly you dont even need the .channel if you dont store anything else

#

you can just do this

#
// set
db.set(`ticketPanel.${message.guild.id}`, message.channel.id);

// get
 let channel = db.get(`ticketPanel.${message.guild.id}`);
earnest phoenix
#

We dont store anything else

north cairn
#

thats what we are doing

#

and we are getting undefined

#

anyway lemme try again

quartz kindle
#

you were doing this js db.set(`ticketPanel.${message.guild.id}.${message.channel.id}`, ...); not this ```js
db.set(ticketPanel.${message.guild.id}, message.channel.id);

earnest phoenix
#

We tried js db.set(`ticketPanel_${message.guild.id}`, channel.id)

quartz kindle
#

try again then

earnest phoenix
#

Ok

north cairn
#

hm diff error

#

so when we are doing get thing

#

what are we actually deriving?

quartz kindle
#

hmm?

#

show code/error

earnest phoenix
#

Ah it shows

north cairn
#
let channel = db.get(`ticketPanel.${message.guild.id}`);```
#

tell what are we deriving from here

#

only the server id??

quartz kindle
#

you should be getting a channel id

earnest phoenix
north cairn
#

yes

#

but

#

when i do

#

channel.send("some msg")

earnest phoenix
#

We are getting undefined

north cairn
#

it says its not function

quartz kindle
#

because its a channel id, not a full channel object

#

you need to get the channel object from djs

#

client.channels.cache.get(id)

deft wolf
#

You need to fetch this channel

earnest phoenix
north cairn
#

ig i did it before,lemme try again

#

there are two things here

#

first this

#
 const ugay = client.channels.cache.get(chl.id)```
#

if we doing that ryt

#

and second is that

north cairn
quartz kindle
#

if chl is what you get from the db, then chl itself is the id, there is no .id

#

const ugay = client.channels.cache.get(chl)

earnest phoenix
#

Oh

#

We getting
ch = object Promise

quartz kindle
#

is quick.db async now?

#

then you have to await all the db.get and db.set

earnest phoenix
#

Will remove async

#

Yeah it worked ig

earnest phoenix
quartz kindle
#

👍

north cairn
#

thanks bro!

#

it works!

#

🙂

#

any thanking system here?

deft wolf
#

I guess "thanks" is enough

sharp geyser
#

@quartz kindle you think its worth doing this for every dispatch event

export declare interface Client {
    on(event: 'ready', listener: (client: Client) => void): this;
}

so that way each specific event is intellisensed to what the data will look like when listening to the event

#

I feel like I could probably do this more effectively by using generics but idk

quartz kindle
#

sure, you can define types for every single event

#

but you can also use the discord types library

#

instead of doing everything yourself

sharp geyser
#
export interface IClientEvents {
    ready: [data: GatewayReadyDispatchData];
}
#

rn only ready cause thats the only event im handling rn but shhh

quartz kindle
#

ye

sharp geyser
#

God this is interesting

#

I am learning quite a bit about ts that I never knew

#

So when sending intents to the gateway, discord expects it to be a number which is the sum of all the intents bitfields they wanna send right?

#

So say they wanted the Guilds intent as well as GuildBans it would be 5 Guilds = 1, GuildBans = 4

quartz kindle
#

ye

sharp geyser
#

gotcha

#

and is it faster to use reduce on an array to get the sum of the numbers in it or would it be faster to use standard for loop

#

actually doesn't reduce use a loop internally

#

wait wait wait, no way I have to emit events like this: this.socketManager.client.emit('debug', () => message);

#

nvm

#

I did a goof

#

forgor to edit the emit override in my declare statement as I copy and pasted the on one

quartz kindle
#

afaik array reduce is supposed to use a special reduction algorithm, but idk if js actually implements that

#

most of the time for loops are faster

sharp geyser
#

I see

#
export function parseIntents(intents: Array<GatewayIntentBits>) {
    return intents.reduce((partialSum, a) => partialSum + a, 0);
}

this looked so clean tho 😔

neon leaf
#

I mean if it doesnt run very often does it matter?

sharp geyser
#

Not really

quartz kindle
#

just keep it

#

it doesnt really matter

sharp geyser
#

k

quartz kindle
#

even in a hot code, the performance difference is usually negligible

#

also

#

its better to use the OR operator than a plus sign

#

a plus sign will fuck it up if they have duplicate intents

#

the OR operator wont

sharp geyser
#

oh?

#

How does || work here?

quartz kindle
#

bitwise OR operator is a single pipe

#

partialSum | a

sharp geyser
#

tf

#

didn't know that was a thing

neon leaf
#

did you atleast know & was a thing

quartz kindle
sharp geyser
#

I don't know much about the bitwise operators tbh

#

never found myself in a situation that needed it, or at least one that I knew would be more efficient to use it

quartz kindle
#

bitwise is awesome

sharp geyser
#

I never really understood it

neon leaf
sharp geyser
#

took a hands off approach

quartz kindle
quartz kindle
neon leaf
#

ah

#

doesnt the example say 10

quartz kindle
#

lmao

#

they fucked it up xD

#

js uses signed integers for bitwise

neon leaf
quartz kindle
#

and the NOT operator also flips the sign bit

lyric mountain
#

ah yes, -110 my favorite binary

quartz kindle
#

so basically internally js uses 32 bit ints

#

so 5 is actually

#

00000000000000000000000000000101

#

and ~5 becomes
10000000000000000000000000000010

#

the first leftmost bit is the sign bit

#

defines if the number is positive or negative

#

but it could also be represented as
11111111111111111111111111111010

#

idk which representation exacly it uses

#

there are two different ways of dealing with signed bits, twos complement and signed

#

up to the lang/compiler/cpu to decide

neon leaf
#

I pretty much only ever use & and |

quartz kindle
#

yeah same

#

actually, i also use << and >> a lot

neon leaf
#

& for checking bitfield permissions, | for creating them

neon leaf
quartz kindle
#

extracting subsets or binary

#

for example you have an 8 bit number: 00000000, and you decide that you want to use 4 bits for one thing, and another 4 for a different thing

#
const first = n >> 4;
const second = n & 31;
#

and then lets say you want to update the value of first in n

sharp geyser
#

this all makes no sense

quartz kindle
#
n = (newfirst << 4) | second
neon leaf
quartz kindle
#

lmao

quartz kindle
#

and then decompose the number into sections

#

for example the number 88, equals 01011000 in binary

#

if you do 88 << somenumberhere, it will move those bits to the left

#

for example 88 << 2 will move them all 2 places to the left, resulting in 0101100000

sharp geyser
#

but how does 88 equal that number in binary

quartz kindle
#

0 = 0
1 = 1
10 = 2
11 = 3
100 = 4
101 = 5
110 = 6
111 = 7
1000 = 8
.... until you reach 88

neon leaf
#

oooh, makes sense

#

didnt get what they were used for before

quartz kindle
#

you go 1 2 3 4 5 6 7 8 9 10

sharp geyser
#

yea

quartz kindle
#

when you reach 10, you cannot represent it as a single digit anymore

#

so you have to start using 2 digits

#

10 11 12 13 14

#

binary is the same, but you cant go up to 2

#

everytime you reach 1 and beyond, you have to add another digit and start over

sharp geyser
#

cause binary is just 0's and 1's no?

quartz kindle
#

ye

sharp geyser
#

I see

quartz kindle
#

so you have 0, you can just write 0

#

for 1, you can just write 1

#

but for 2, you cant use 2

#

so you add a new digit, and go back to 0

sharp geyser
#

how does it jump from 11 to 100

quartz kindle
#

it becomes 10

#

because after 11, you have to add a new digit

#

imagine this

sharp geyser
#

would itn ot become 110 ?

quartz kindle
#

like

#

binary usually needs a fixed "size" to work

#

lets say our number is always 8 bits in size

#

00000000 = 0
00000001 = 1
00000010 = 2
00000011 = 3
00000100 = 4
00000101 = 5
00000110 = 6
00000111 = 7
00001000 = 8

#

the left side zeroes are always there, to determine the fixed size of the number

#

but you can omit them

#

wait there was a perfect gif for this, let me find it

sharp geyser
#

but why does the 1 disappear when going from 3 to 4 if we are adding numbers to the end

quartz kindle
#

whydoes the 9 disappear when you reach 10?

#

because it starts over again

sharp geyser
#

I see

#

I don't quite get it fully but I understand it better now

quartz kindle
#

let m find that gif

rustic nova
#

This video contains content from UMG, who has blocked it from display on this website or application
Watch on YouTube

quartz kindle
#

it works for me if i watch on youtube

#

lmao

sharp geyser
#

Okay that makes more sense but still confusing to get used to at first

#

Ima just keep researching more about it until I understand it fully

quartz kindle
#

ye

#

you can also think about it as an array

#

for example, 00000000 > [0,0,0,0,0,0,0,0]

#

just that the values in the array can only ever be 0 or 1

#

but you can still manipulate them individually

#

just the way you use indexes is different

#

for example the OR operator: | is literally, change the value at that specific index to 1

sharp geyser
#

so say a number is 8 bits then the length of the array would be 8 right?

quartz kindle
#

ye

sharp geyser
#

can't a number also be more than just 8 bits

quartz kindle
#

it can ye

sharp geyser
#

how would that effect things

quartz kindle
#

you always need to define the size of the number beforehand

#

only bigints have no limit

#

because they use a special algorithm for that

#

otherwise in all languages, all numbers always have a fixed bit size

#

in low level languages you can specify the size you want, for example int8, uint32, long, etc

#

in js you cant

#

js always uses double precision floating point for all its numbers, which is 64 bit in size

#

except when doing bitwise because js is stupid

#

when using a bitwise operator, js will secretly convert the number to int32

#

which is 32 bits

#

and convert it back to double precision before giving you the result

sharp geyser
#

ic

quartz kindle
#

thats the reason why discord uses bigint permissions and shit

#

because there are more than 32 permissions, so it wont fit into a 32 bit number

#

doing bitwise on a js number bigger than 32 bits, will simply cut the excess off, causing data loss lol

sharp geyser
#

ooo data loss dont we love that

rustic nova
#

same

sharp geyser
#

it doesn't actually identify

#

No errors at least!

#

Now I just need to find out why

#

Ic its not actually creating any shards

#

OOO IM DUMB

#

why the fuck did I set the default of the amount of sockets to spawn to 0

#

no wonder it wasn't working