#development

1 messages · Page 243 of 1

lyric mountain
#

it's supposed to be your domain, not that

desert verge
#

Mmmh ok well

#

I'm gonna upload the edits with the sdk

sharp geyser
#

its cloudflared

#

when locally testing you have to use smth like ngrok or cloudflared

#

you can't use localhost directly

#

you need some sort of tunnel / reverse proxy

desert verge
#

I have cloudflare and a domain name

#

Still doesn't work....

sharp geyser
#

Are you leaving the activity and joining back?

desert verge
#

Yes

#

Always

#

Still doesn't working

sharp geyser
#

Are you sure its not actually rendering something

#

and its just off page

desert verge
desert verge
#

Maybe it just doesn't find

sharp geyser
#

maybe

desert verge
#

And it seems it takes so much time to update

#

Lol it works now

#

I deleted the app and re-created it

#

Wait.... websocket doesn't work

frosty gale
#

bit useless if this doesnt support websockets

#

youll have to stick with the old fashioned manual polling

#

(if it even allows that)

sharp geyser
#

websocket should certainly work

desert verge
#

Or I create another webapp that embeds my app with an iframe PainsChamp

#

it only support secure web sockets

sharp geyser
#

obviously

desert verge
#

yes, but...

#

Why it doesn't work with cloudlflare ?

#

it is enabled

#

Look

#

It works there

#

but not on the Activity

#

first

#

(yes I downloaded experimental PTB Discord Client

rustic nova
#

Yeah you wont be able to externally load these

#

because content policy on these sandboxes discord uses

desert verge
#

It blocks js

#

I must turn everything into type=module

#

No, set the type of the file imported

#

I think I have to download the external libs

#

Bruh let's go make an external app I suppose ?

#

that embeds the game?

desert verge
#

Yeah guys you're right

#

I've set black background

#

Found this

#

An Aussie's guide to creating a discord activity using Unity and Sveltekit

Thumbnail made with Thumbnado.
https://github.com/Chizaruu/thumbnado

💰🔗 Feel like Supporting The Channel 🔗💰
ᐅ Github Sponsor
https://github.com/sponsors/Chizaruu
ᐅ Patreon
https://www.patreon.com/thesleepykoala

🔗 Relevant Links 🔗
ᐅ Svelcordity
https://github.com/The...

▶ Play video
#

Good night

sharp geyser
#

I thought all people used was unity

#

So you can export to webgl

#

and use that

pearl trail
sharp geyser
#

@lyric mountain what you think about this image?

#

What does it give off

lyric mountain
#

Would

#

But well, some sort of night dweller like a vampire or some sort of necromancer

sharp geyser
proven lantern
#

they are called dark elves

lyric mountain
#

Doesn't look like an elf

proven lantern
#

dark elves warhammer

#

basically

sharp geyser
#

I was going for a fallen angel type thing

lyric mountain
#

Hm, i can see that

sharp geyser
#

Vaksam was the race name I chose

lyric mountain
#

If it's a celestial race, perhaps a name ending in -el or -im would feel more natural

sharp geyser
#

maybe

#

I dont want to copy something from somewhere tho

lyric mountain
#

I mean, just invent a name and append either suffix

radiant kraken
crystal wigeon
#

does topgg have any api that lets me send vote data? like if somebody votes can i make an api call to topgg to update the vote on my bot?

pearl trail
#

im too noob to understand cmake errors

#

i almost got my keyboard bricked KEK

crystal wigeon
#

bump

pearl trail
#

no

#

otherwise it'll be abused

proven lantern
#
const res = await fetch(`https://discord.com/api/${API_VERSION}/applications/${APPLICATION_ID}/guilds/${guild_id}/commands`, {
// const res = await fetch(`https://discord.com/api/${API_VERSION}/applications/${APPLICATION_ID}/commands`, {
    method: "PUT",
    headers: {
        "Content-Type": "application/json",
        "Authorization": API_KEY
    },
    body: JSON.stringify(commands)
});
lament rock
desert verge
#

But It's not what I want to do lol

eternal osprey
#

hey guys i don't understand typescriopt

#

like, how do i fucking run the ts program gang

desert verge
#

then run tsc your-file.ts

#

it will convert into js

#

and then run ur js file

#

otherwise

#

Use bun

pearl trail
#

you forgor tsc --init trolley

desert verge
#

For the tsconfig yes

pearl trail
#

well uh that's to setup ts project yes

desert verge
#

or you can use tsnode

#

but it's not very good

#

it's just using tsc internally and execute the compiled ts to js internally

#

it seems

neon leaf
#

bun uses esbuild

desert verge
#

Bun, the code

desert verge
#

It removes the burden of the esm and common js modules lol

#

it's just bound together

neon leaf
#

and memory leaks on the http lib

desert verge
#

esbuild seems fast?

neon leaf
desert verge
#

You mean bun makes memory leaks with the http lib ?

#

Or it solves that?

neon leaf
#

bun causes leaks when using streams to respond with data

desert verge
#

Ah maybe

#

But it's still better

neon leaf
#

pretty crazy how slow bun.serve is

desert verge
#

It seems

pearl trail
neon leaf
#

their parent, uws is still over 3x faster

desert verge
#

Uws ?

desert verge
neon leaf
desert verge
#

Like they fake their numbers you mean ?

neon leaf
#

no they are real

#

just slow

desert verge
neon leaf
desert verge
#

It sounded like uwus

#

lol

#

when u send uws

desert verge
neon leaf
#

??

desert verge
#

If it can work like engine.io it would be so great

neon leaf
#

it has http and websockets

desert verge
#

does it do both only?

#

Or it can do http ?

#

(and https?)

neon leaf
#

it can do all at once

desert verge
#

Yeah but, I mean.... Discord seems to blocks websockets from my webapp

#

It also blocks their own sdk lmao

eternal osprey
#
/Users/apple/.zprofile:2: no such file or directory: /usr/local/bin/brew
 *  Terminal will be reused by tasks, press any key to close it. ```
tryna run this bitch but i keep getting this error
#

i am for sure homebrew is downloaded

frosty gale
frosty gale
#

you should be able to just install it?

eternal osprey
#

yessirr

#

it just worked

#

mb

frosty gale
#

darn macos amateur

desert verge
#

@neon leaf

neon leaf
#

thats not a standards compliant http server lmao

desert verge
desert verge
#

But I use NodeJS server anyway

#

For express

radiant kraken
earnest phoenix
#

nodejs beloved

radiant kraken
#

c/c++ and rust my beloved

earnest phoenix
radiant kraken
#

no u

earnest phoenix
#

no u

radiant kraken
#
  • makes tizentube
  • makes tizenbrew
#

true tizentv nerd

earnest phoenix
#

and

radiant kraken
#

therefore you are a nerd 🤓

bitter granite
earnest phoenix
radiant kraken
#

how

earnest phoenix
radiant kraken
#

not nerdy

earnest phoenix
#

sure

radiant kraken
#

damn some of these issues are older than me

#

🫠

neon leaf
#

mmmm

sharp geyser
#

mmmm

pearl trail
#

mmmm

earnest phoenix
#

mmmm

deft wolf
#

mmmm

sharp geyser
#

2prayge thank you for joining in on the bullying of 0x7d8

radiant kraken
#

OH MY GOD AFTER 4 HOURS OF ENDLESS GOOGLING I REALIZED ITS AN ACTUAL BUG THAT NO ONE HAS REPORTED IN THE GITHUB REPO

#

wtf when i compiled the first time it works but when i recompile it without any changes it causes a segfault 😭

#

what the fuck is THIS

radiant kraken
radiant kraken
#

a workaround that works

frosty gale
#

is it just me or is OOP inheritance a bit useless?

#

i never see myself using it at all

#

inheriting a single class, maybe, maybe you have a base class and other classes which need those base properties, but apart from that i dont see any more use for it

#

can make the code more complicated since you have to figure out from which class something came from

#

extending library methods too but usually in OOP inheritance is displayed as a much more important and vital concept

sharp geyser
#

Isnt that the entire point of inheritence though?

#

To extend properties from one class to another

quartz kindle
#

so its more of a mental/psychological thing than actual code efficiency/readability advantage

scenic kelp
#

in my plavm project i do use some inheritance but it's mostly 1 layer deep and in reality it's pretty much all abstract classes that could just as well have been interfaces

#

most of the time it's a matter of "i want polymorphism, how will i do it"

sharp geyser
#

I mean sure

scenic kelp
#

go ahead and implement Platypus extends Mammal hehe

#

you CANT!!!!!

#

just a lot of the things you represent in code are inherently abstract

#

i think it works the other way as well with people portraying inheritance as something that's academically very evil where every class will have a 500 layer deep inheritance tree when in most applications in the real world that will never happen

sharp geyser
#

is a Platypus not a mammal

deft wolf
quartz kindle
#

i would use classes in cases where it makes sense to model something like that

#

i guess in the platypus example it wouldnt make sense

scenic kelp
#

the average joe would say live birth is a classifying trait of mammals!!

sharp geyser
#

doesnt matter if its one of the few that lays eggs

scenic kelp
#

if your code assumes mammals do live births

#

womp womp you gotta go change everything

sharp geyser
#

Why tf are you modeling out live births in code

#

Thats a bit weirdchamp

frosty gale
#

rust doesnt have inheritance at all

#

although its not really an oop language

#

they let you have structs with methods but thats about it

#

thats really all i use classes for anyways

wheat mesa
#

Rust has “inheritance” at a certain level but treating it as such leads to painful consequences

frosty gale
#

no inheritance shall protrude thy sacred rusted code

scenic kelp
#

I'm sure there's certain things that are more painful to model in Rust, it's all a matter of tradeoffs

sharp geyser
#

rust is the epitome of complicated and pain

green kestrel
#

<someonesaidrust> "i gave you the chance to code in C++, willingly.... but you.... have elected... THE WAY OF PAIN!!!!"

surreal sage
#

hi chat

#

currently struggling with something

#

high chance nobody can help

#

but will just try

#

im using coolify x docker compose atm

#

docker compose builds the local dockerfile, which exposes port 3000

#

docker compose has ports: - 3000:3000

#

thing is, i cannot connect to that port at all

#

even withouut the :3000 after the domain it still 👎s

#

it just shows the debian 404

#

just gonna do a different method nvm

sharp geyser
#

Are you allowing port 3000 through the firewall?

surreal sage
#

no firewall on server

sharp geyser
#

check and make sure

#

you should 100% have a firewall

surreal sage
#

what's the cmd for debian

sharp geyser
#

ufw typically

surreal sage
#

not found

sharp geyser
#

hm

#

oh god

#

debian uses iptables by default

#

it has no ufw

surreal sage
#

howwww do i view it

#

oop -L

sharp geyser
#

Oh yea you can open a ssh tunnel via -L too

surreal sage
#

i love ssh tunnels

#

but i dont see anything for system firewall

#

it's just docker docker docker

#

who even needs a firewall in 2024 smh

#

yeah okay coolify just implements compose really really weirdly

#

i had a db service and api service

#

i just moved the db service to a different instance

#

connected to it internally from the api service

#

and gg

#

weird shit

#

wait

#

i think i might know why

sharp geyser
surreal sage
little cosmos
#

does anyone has any suggestion to solve this error in my bot
it has 42k servers and the error shows randomly or when starting and stops the bot

sharp geyser
#

429 means you hit a ratelimit

little cosmos
sharp geyser
#

Stop spamming the api

little cosmos
sharp geyser
#

There is

little cosmos
sharp geyser
#

but not spamming it.

#

Ima be real bro, you posted a vague error

#

It does not tell me what endpoint is being called, so i can't tell you if there is a better way to handle it.

#

When does the error occur

little cosmos
sharp geyser
#

What library are you using

little cosmos
lament rock
sharp geyser
#

do you fetch all members on login?

little cosmos
#

discord-hybrid-sharding for sharding

little cosmos
#

and the bot data

lament rock
#

you dont need to fetch the guilds if you have the guilds intent. All of the guilds are sent via GUILD_CREATE

sharp geyser
#

Don't do that, you dont need to fetch guilds

#

They get cached anyway

lament rock
#

or they're all ready per shard when shardReady hits

sharp geyser
#

partial data ofc, but you can fetch for the rest of the information as you need it

little cosmos
#

i do other wise how am gonna get the messages sent in the guilds?

little cosmos
sharp geyser
#

you do not need to fetch all guilds to do that

lament rock
#

No. The full object is there. GET /guilds/:guild_id doesn't include some fields like channels, etc

little cosmos
#

look guys i manually dont do any of that its just djs login way

sharp geyser
#

djs does not fetch all guilds on its own

#

it stores partial data in cache once it hits GUILD_CREATE

lament rock
#

You might be globally rate limited if it's preventing you from logging in

little cosmos
sharp geyser
#

or if yo uare sharding the ready event ofr that shard

#

Also yea, what Ophidian said, if you got too many 429 you likely got a global rate limit and even a CF ban

little cosmos
sharp geyser
#

which if thats the case you have to wait 24h

little cosmos
#

do discord give whitelist for bots above 10k server?

lament rock
#

Global rate limit isnt based off how many 429s you receive. There is an error limit temp ban, but you can only make so many requests within a day before you hit your global rate limit.

#

As your bot grows, so too does the limit

#

As well as your max_concurrency when starting your bot from GET /gateway/bot

little cosmos
#

ok ty

lament rock
#

I know you probably get this a lot, but I really do not recommend discord.js at your scale. I'd say it's high time to consider modular solutions which do just what you want so you can separate logic and narrow errors as well as manage your own cache logic since discord.js is. a. memory. hog.

#

🐖

#

Honestly, I think back to when I used it because I thought the class based approach was helpful - it isn't. Its design only serves to cause suffering. Did you know that unless you cache a message, you cant receive reaction events? I mean, now there's partials but lol

proven lantern
#

🙂

sharp geyser
#

no

#

zig is worse and once again is nothing like rust

#

so I would have no benefit

proven lantern
# little cosmos ok ty

you'll receive a retry-after header that you can use to know how long to wait for

if (response.status === 429) { // Handle rate limit response
    const retryAfter = response.headers.get('Retry-After');
    console.log(`Rate limited, retrying after ${retryAfter} seconds`);
    await pause(retryAfter * 1000); // Convert to milliseconds
    attempt--; // Don't count this as an attempt
}```
proven lantern
#

i can

#

wait, you just compared rust to zig

#

you can't do that!

#

zig has a better icon

radiant kraken
#

took me days just to write a simple GUI

proven lantern
#

if I make this API only can I update it to be available via the store later?

proven lantern
radiant kraken
#

what's a SKU?

proven lantern
#

i'm trying to find the SKU ID now. i think it might only be available via the api

#

A SKU, or stock-keeping unit, is a tool used to keep track of inventory. In the context of Premium Apps, premium features can be thought of as "products" that an App offers. These “products” can be tracked through their own SKU and managed in the Developer Portal of your application.

radiant kraken
#

oh interesting

proven lantern
#

i have no SKUs!!!

lament rock
proven lantern
lament rock
#

Both what?

proven lantern
#

headers

lament rock
#

The X- prefixed header should be used as headers not prefixed with X- not defined in the HTTP spec are the result of bad practices

#

Pretty sure Retry-After was slated for removal at some point anyways

proven lantern
#

oh, youre just talking about the missing prefix?

#

yeah use the prefix

proven lantern
rustic nova
#

didnt discord stop providing skus

#

oh nvm thats app monetisation

proven lantern
crystal wigeon
#

guys can someone help me? how can i fix circular deps. So basically my flow rn is file1 calls a function in file2. file 2 calls a function in file3 and then laslty a file3 needs to call a function in file1. for example I have buttons players can click. now lets say player clicks a button to view something, and then in the view embed there a button that allows players to join it. now when you join something i want to automatically show the users what they joined which is the "view" function. And then in the view i want to give players the option to join it

#

how can i split this logic

sharp geyser
#

Well the problem is, you have

File 1 -> File 2 -> File 3 -> File 1

#

So eventually it will all loop back to the start

#

You can move the function that file 2 & 3 relies on from file 1 so that way you can export it as needed.

#

That will help

#

Put it into a separate file

crystal wigeon
#

so i need to duplicate it is what you're saying

sharp geyser
#

Not duplicate it, but move it out

crystal wigeon
#

well there is only 1 function in file1

#

and after file3 does something i need to call this function which is in file1

sharp geyser
#

wait let me re-read your problem

#

I may have misunderstood

crystal wigeon
#

it is a cyclic dep issue

#

you got the problem right

sharp geyser
#

I see yea so file 1 calls a function in file 2, then 2 in 3 and then 3 in 1.

So basically file 1 imports file 2,
file 2 imports 3
3 imports 1

crystal wigeon
#

yea

sharp geyser
#

So the problem is still importing file 1 unless I am mistaken

crystal wigeon
#

yep

#

its a cyclic dep issue

sharp geyser
#

as when you import another file it is reading the imports of that file as well afaik

crystal wigeon
#

yeah

sharp geyser
#

You have a design flaw

crystal wigeon
#

so like how can i fix it in that case. whats a better solution

#

i dont want to pass callbacks to all the functions

#

so that file 3 uses some callback to go back to file2 and then file1 to call the function

sharp geyser
#

I mean without know what each file does, you likely could just combine the functions into 1 file. As it sounds like its just a function per file

#

and they all rely on each other

#

You breaking them up into 3 files and then importing each file all the way back to importing file 1 (which starts the import loop) sounds like a bad idea

crystal wigeon
#

the functions are huge and they do have specific roles they do.

sharp geyser
#

I mean, I don't see any other way to get around this

#

Maybe someone smarter than me can.

#

I use rust and its hard to get a circular dependecy error if at all

crystal wigeon
#

i was thinking event emitters

sharp geyser
#

so any JS problems are a little beyond me as I haven't used JS in ages

crystal wigeon
#

ok so let me explain what im trying to do maybe you can offer a better solution. this isnt related to any language just a design flow im thinking

#

so i have a button that says "fight" the player clicks on it and it starts the fight after the fight ends i show some kind of result that relies on the fight data. now in this result embed i want to show the "fight" button again. which is the same function as the initial one from file1

#

does that make sense?

sharp geyser
#

Yea

#

This all sounds like it can be achieved easier than what you have

crystal wigeon
#

yeah so what do i do here to fix this cyclic dep

sharp geyser
#

Is this in the web

#

or discord

crystal wigeon
#

i mean the actual fight function and result function are big. so i cant just put everything into 1 file. that wont be readable.

#

discord

#

discord buttons

sharp geyser
#

Okay

#

Also, if your functions are massive you are doing something wrong imo

crystal wigeon
#

wym

#

the logic lol

#

the logic is obv split as well

sharp geyser
#

maybe its a me thing, but I hate writing massive functions. I usually abstract it further.

crystal wigeon
#

yeah that is there

sharp geyser
#

Breaking it up into chunks so its easier to edit

crystal wigeon
#

but again the problem here is. how do i show the fight button again

#

yeah i've done that

sharp geyser
#

Well, you can keep track of some sort of state

#

When they start the fight set some value to true, and wait until its false again then show the button once more.

crystal wigeon
#

right, ig thats the only other way

sharp geyser
#

As for your dep issue its beyond me

#

I am not used to JS anymore

crystal wigeon
#

thanks

sharp geyser
#

rust doesn't have circular deps or at least I have never ran into it

crystal wigeon
#

i see

radiant kraken
#

c++ when i add a trailing comma

sharp geyser
#

but idk how use statements are processed in rust

#

so maybe not

sharp geyser
#

if thats clang im kinda surprised

#

clang is useually more descriptive

radiant kraken
#

uhm that's Microsoft Visual C++ (MSVC)

quartz kindle
crystal wigeon
#

the code is pretty complex to share tbh. it does a lot of things before calling the function in a diff file. but anyway for now i figured i'll use something like events or just remove it entirely

#

im also busy rn maybe i can share some other time

quartz kindle
#

are you using import or require?

crystal wigeon
#

import

#

weird part is my eslint isnt complaining that its cyclic

#

and everything works fine

quartz kindle
#

if you absolutely cannot move the function from file1 to another file, what you can do is to use an async import in file3

crystal wigeon
#

i see

quartz kindle
#

in file3, inside the function, you call import(file1).then(run function code)

#

of course the function needs to be async

#

but that will make the importing happen only after all the files have been processed

#

so file1 is free from the cycle

crystal wigeon
#

gotcha, i'll give that a shot

crystal wigeon
#

import("./file1").then(() => func1(options)) doesnt make sense

quartz kindle
#

no, move the import to inside trhe function

crystal wigeon
#

ok nvm

#

yeah i've done that

quartz kindle
#
async function func1() {
  const file1 = await import(...)
}
crystal wigeon
#

func1() {
import("file2").then((t) => t.function2)
}

#

i think this should work

#

?

quartz kindle
#

ye

sharp geyser
#

cool

quartz kindle
crystal wigeon
#

ig thats expected? since it is still cycling

#

just during compile time it wont pick it up right?

quartz kindle
crystal wigeon
#
            if (!raidId) return;
            options.args = [ `${raidId}` ];
            const { joinRaid } = await import("./join");
            joinRaid(options);
            return;
        }```
#

something liks this

#

there is a function in file1 which joinRaid func calls

#

I also did the same there

quartz kindle
#

so which file is this and which file is /join?

crystal wigeon
#

this is file1. join is another file. File1 has a function which join needs to call which creates a join button

#

vice versa. the join button created needs to call the join func when clicked

#

so its in file 1

#

madge still says its cyclic which is ok but let me see if the function is available during compile time

quartz kindle
#

so file1 has an export function something() {}

#

and join.js has export function joinRaid()

crystal wigeon
#

yeah

#

async func

quartz kindle
#

and joinRaid() has await import("./file1")

crystal wigeon
#

yep and file1 has await import("./join")

quartz kindle
#

is file1 and join.js imported in any other way?

crystal wigeon
#

nop

#

only that 1 func

quartz kindle
#

but do any of them have the top level import statement?

crystal wigeon
#

nop

quartz kindle
#

like import abc from "..."

crystal wigeon
#

i got rid of that

quartz kindle
#

then if i understand correctly it should work

#

but it would be easier if i could see the code

crystal wigeon
#

i the code works. i dont get or run into errors

#

its just that cyclic deps are bad. and i want to see if i can do seomthing to fix it

quartz kindle
#

the only way to truly fix it is to not do it

#

move the functions to other files

#

so that 2 functions can never depend on each other simultaneously

crystal wigeon
#

mhm thats what ive been trying to do

crystal wigeon
#

how do i achieve this without cyclic dep

#

all the function in file 1 does is send a embed with button which when clicked needs to joinRaid

quartz kindle
#

but idealy you would separate the logic into self-contained pieces

#

if a part of it cannot be self-contained, it should not be there

crystal wigeon
#

got it. let me see if i can send code by breaking them down

#

but the thing is, its a common function

quartz kindle
#

also, do you use classes? or its all functions

crystal wigeon
#

its all functions

quartz kindle
#

this could be a use case for classes

crystal wigeon
#

it will run into same problem no

quartz kindle
#

also, its a good idea to have buttons be self-contained as well

#

on the discord side, a button click is an independent standalone interaction

#

its a good idea to model your code in the same way

#

so have a dedicated functino for a button click that does not depend on the code trhat created the button

#

thats why the uniqueid property is there for

crystal wigeon
#

yeah i have that

quartz kindle
#

you can use the unique id to store the state in some global object or map, and then use the button's unique id to get the correct state and update it accordingly

crystal wigeon
#

but in the callback i need to call some func right?

quartz kindle
#

are you using discord.js?

sharp geyser
#

I heard they are using oceanic /j

quartz kindle
#

well, same thing mostly

sharp geyser
#

Im kidding

#

oceanic blow

crystal wigeon
#

i abstracted the button creation

quartz kindle
#

these libraries all have functions like createMessageComponentCollector and awaitMessageComponent

crystal wigeon
#

so i have all that

#

yea

#

i have abstracted them and using them

quartz kindle
#

but in realiy, using those functions is not always ideal

#

because it breaks away from how discord actually works

#

sure it makes it easier to do a lot of things

#

but depending on the case, i wouldnt use them

#

but i mean, if i could see your code, i could suggest which way would be easier for you to do it

#

because doing it without collectors and such would require a lot of rewriting

crystal wigeon
#

so here's the full flow,. when i type a command a function in file1 is called which creates a button. now when a button is clicked it calls joinRaid func. which then calls the function in file1 to attach the join button again

#

so makes it cyclic

#

i tried moving the button attachment code to a diff file and call it in file1 but still same thing

#

since button attachmend code will call join

#

and join indirectly calls attach buttons again

quartz kindle
#

how about separating join and attach buttons?

crystal wigeon
#

attach button is wat creates a "join" button and adds it to embed.

#

if i want to show this button i need to call it right?

quartz kindle
#
function onJoinButtonClick() {
   join();
    attachButtons()
}
crystal wigeon
#

right i could do that yea

#

thats one way to do it ig

#

but was tryna find a way if i cann call attachButtons() inside of join()

quartz kindle
#

if you were using classes, you could do something like ```js
class Raid {
join() {
this.attachButtons()
}
attachButtons() {}
}

#

but using functions, the only way is to pass stuff through a function argument/parameter

crystal wigeon
#

that makes sense

#

but like the join() func itself is big so its in another file

#

ig i can pass this

quartz kindle
#

well, you can also use a context switch by using join.call()

crystal wigeon
#

got it

quartz kindle
#

but at that point it would be the same as passing an additional parameter

sharp geyser
#

idk, writing massive functions just makes no sense to me, I abstract as much as possible. Maybe im just weird

crystal wigeon
#

thanks

#

i'll try it out

sharp geyser
#

At the end of the day my function has like 4-5 different functions being called in it

#

💀

crystal wigeon
wheat mesa
sharp geyser
#

Indeed

wheat mesa
#

I shouldn’t have to read 30 different functions to figure out what one function does, but good abstraction is a mix

sharp geyser
#

Well I would never abstract that deeply

#

but I abstract the different logic out.

#

If a function is doing 4 different calls to an api, I abstract those calls out

#

maybe thats just a me thing

wheat mesa
#

It’s all very nuanced and situational anyways

sharp geyser
#

@quartz kindle help

#

someone just told me they were going to brute force my 2FA pins

#

What shall I do

quartz kindle
#

idk im no security expert, but it shouldnt be possible

sharp geyser
#

I mean

#

It is

#

but its all down to luck

#

you have to hope the pin you tried was the right one at the right time

quartz kindle
#

but you also need to know user/pass to even get there no?

sharp geyser
#

Yea but thats not nearly as hard to get past as 2FA

quartz kindle
#

i mean, if they somehow got it from some breach, just change password

quartz kindle
#

finally making some progress but holy shit this is so annoying to work with

sharp geyser
#

Still using protobuffers?

quartz kindle
#

ye

#

i still cant decode this one tho, nothing i tried returned any valid data

sharp geyser
#

maybe its junk meant to throw you off

quartz kindle
#

it has to contain something

#

i have the events for when i enable/disable cam/mic, but i dont have the data for the cam/mic current state when i join

sharp geyser
#

where is this coming from

quartz kindle
#

RTCDataChannel.send()

#

my browser sends this when i click "join" in a google meet call

sharp geyser
#

interesting

#

Does google not give you any specifications

#

do they literally just hang you out to dry?

quartz kindle
#

no for this no, since this is not a public api

#

this is basically reverse enginneering google meet

sharp geyser
#

That sounds against tos

frosty gale
#

google violates our privacy more than anyone could ever violate their terms of service

#

were good

sharp geyser
#

fair enough

#

keep at it soilder

#

🫡

quartz kindle
#

holy shit i did it

#

it was compressed with gzip but also had 3 bytes added as a header idk why, thats why my decompression wasnt working, had to do buffer.slice(3) first

neon leaf
#

What if they change every message to 4 byte headers

#

And change it randomly

quartz kindle
#

xD

sharp geyser
quartz kindle
#

lmao

#

for now i added a check like this:

const check1 = d.indexOf(0x1F);
const check2 = d.indexOf(0x8B);
if(check1 > -1 && check1 < 10 && check2 === check1 + 1) {...}
#

1F and 8B are gzip magic numbers

#

i check for their index and see if they are within the first 10 bytes and if they are next to each other and in order

#

tbh i could check for the entire gizp header tho, its 10 bytes

quartz kindle
#

ye

quartz kindle
#

indexOf checks the index of a number in the array

#

0xF1 and 0x8B are "magic numbers" indicating that the file type is gzip

#

to check whether the uint8array is gzipped or not, i check if the gzip magic numbers exist and where they are

#

so i can slice correctly before unzipping

sharp geyser
#

oh thats cool

frosty gale
#

havent considered that scenario have you

sharp geyser
#

Well he doesn’t need em there

#

So slicing them is fine no?

neon leaf
#

What if that data is confidential

#

And he'll get sued

sharp geyser
#

Then he gets sued

#

Idfk

frosty gale
frosty gale
#

i think he'll be fine

sharp geyser
sharp geyser
#

He's already removing it

quartz kindle
#

im checking for 3 bytes rn

#

2 gzip magic numbers and 1 deflate byte

quartz kindle
#

also, im gonna publish this in the chrome store

#

if they dont like it, they'll just remove it from there

sharp geyser
#

What are you making exactly'

quartz kindle
sharp geyser
#

Nice image

quartz kindle
#

tracking user activity in a google meeting, like how much time they talked, had cam on, send texts, etc

sharp geyser
sharp geyser
quartz kindle
#

:^)

sharp geyser
#

Alt text boi

quartz kindle
#

na

#

the image is served locally from the extension files

#

i just didnt set the image path after i moved it

radiant kraken
#

good job on it!!

#

this is my type of project hahaha

pearl trail
# quartz kindle

do you store the data in your db (server) or does it saved locally?

eternal osprey
#

hey guys,
i have a /setup command:
this embed shows a lot of buttons:
when i click on a button, it edits the embed and then when i click another button it simply says that the interaction has already been replied to, or is unknown.
could this be where it comes from?

#

its driving me crazy

#

like is it not possible to send a message, accept a button click, edit the message with a new button and then add a click?

lament rock
#

I usually discourage adding/removing buttons. The usual way to do things is to disable the buttons locally and through Discord. To replace the select menu, I'd use a form probably

vivid fulcrum
# quartz kindle

😮 that's pretty rad, congrats. is the extension open source? I'd love to take a look how you tackled webrtc

real rose
#

Was a bit of a robust setup

eternal osprey
#

ahh i see

#

i got the exact same setup i think!

#

well i will set that up then!

frosty gale
# quartz kindle

this is the first time I've ever seen Tim design anything that involves a frontend

#

I am proud

supple relic
#

hey

#

i have to ask a about problem

#

see my bot dont have any slash commands

#

but when i

#

or any user

#

uses

#

the slash cmds

#

this came up

sharp geyser
#

Please send it in a coherent message instead of 3 words at a time

supple relic
sharp geyser
#

Is your bot called Universal

supple relic
supple relic
sharp geyser
#

You uploaded slash commands then

#

What library are you using

supple relic
#

my bot was having slash cmds back then but not now

sharp geyser
#

Then you will have to send an empty dictionary or however else discord.py instructs you

#

Look at their docs on how to remove slash commands

quartz kindle
quartz kindle
#

still thinking if i wanna add something like cloud sync to it or not

neon leaf
quartz kindle
#

i will add the rtc branch later when its more polished

quartz kindle
quartz kindle
# vivid fulcrum 😮 that's pretty rad, congrats. is the extension open source? I'd love to take a...

but basically, this is how i intercept the rtc datachannel

const ___onmessage = Object.getOwnPropertyDescriptor(RTCDataChannel.prototype, "onmessage");
const ___send = Object.getOwnPropertyDescriptor(RTCDataChannel.prototype, "send");

Object.defineProperty(RTCDataChannel.prototype, "onmessage", {
    get() {
        return ___onmessage.get.call(this);
    },
    set(val) {
        const fn = async function(d) {
            if(d.target.label === "collections" || d.target.label === "reactions") {
                document.dispatchEvent(new CustomEvent('@_@', { detail: { type: d.target.label, data: d.data } }));
            }
            // console.log(d.target.label, d.data)
            return val(d);
        }
        return ___onmessage.set.call(this, fn);
    }
});

Object.defineProperty(RTCDataChannel.prototype, "send", {
    value: function(d) {
        document.dispatchEvent(new CustomEvent('@_@', { detail: { type: "send", data: d } }));
        return ___send.value.call(this, d);
    }
});
#

very hacky xD

neon leaf
#

oh god

pearl trail
#

@_@

vivid fulcrum
quartz kindle
bitter granite
#

Just makin sure
You dont need manage server right for bot to see server icon/banner/name

quartz kindle
#

for bot to see? nah only for bot to change them

bitter granite
tacit lagoon
#

Uncaught exception: Error: Unsupported client
Exception origin: uncaughtException why am i getting this when i try to use autoposter?

neon leaf
#

do you use discordjs?

tacit lagoon
#

yes discordjs

neon leaf
#

which version?

tacit lagoon
#

14.14.1

neon leaf
#

can you show your code

tacit lagoon
#

sure

#
const TuningClient = require("./src/structures/TuningClient")
const dotenv = require("dotenv");
const bot = new TuningClient();
const express = require("express");
const Topgg = require("@top-gg/sdk");
const discord = require("discord.js");
const { AutoPoster } = require("topgg-autoposter");
require("./src/structures/Logger");

dotenv.config({
    path: __dirname + "/.env"
});

["EventHandler", "LavalinkHandler", "AntiCrash"].forEach(handler => {
    require(`./src/handlers/${handler}`)(bot);
  });
  
bot.on("raw", (data) => bot.music.packetUpdate(data));
bot.start(process.env.TOKEN)

const app = express();

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

app.post(
  "/dblwebhook",
  webhook.listener((vote) => {
    const embed = new discord.EmbedBuilder()
    .setTitle("New Vote")
    .addFields([
      { name: "From User", value: bot.users.cache.get(vote.user).username },
      { name: "Type of vote", value: vote.type }
    ])
    .setColor("DarkRed")
    .setTimestamp(new Date().toUTCString());
    bot.channels.cache.get("1267451243731750923").send({embeds: [embed]})
  })
);

AutoPoster("tokenhasbeenremoved", bot).on("posted", () => {
  console.log("[@TopGG] Posted bot stats!");
});

app.listen(3000); 
#

i removed from code before sending cause yeah, those are credentials that aren't meant to be sent in discordxD

neon leaf
#

what is TuningClient

deft wolf
#

Yea, same question

tacit lagoon
#
const { Client, Collection, GatewayIntentBits } = require("discord.js");
const fs = require("fs")
const path = require("path")
var botconfig = require("../config/botconfig")
const { MoonlinkManager } = require("moonlink.js");
class TuningClient extends Client {
    constructor() {
        super({
            intents: [
                GatewayIntentBits.Guilds,
                GatewayIntentBits.GuildVoiceStates,
                GatewayIntentBits.GuildMessages,
                GatewayIntentBits.MessageContent,
                GatewayIntentBits.GuildMembers
            ],
            sweepers: {
                messages: {
                    interval: 3600,
                    lifetime: 1800,
                },
                users: {
                    interval: 3600,
                    filter: () => user => user.bot && user.id !== this.user.id,
                    },
                },
        });
        this.bot = this;
        this.snek = require("axios");
        this.owners = botconfig.owners;
        this.commands = new Collection();
        this.events = new Collection();
        this.categories = fs.readdirSync(path.join(__dirname, "../../src/commands/"))
        this.music = new MoonlinkManager(
            botconfig.nodes,
            {
                clientName: "TuningThunder/1.0.0"                
            },
            (id, sPayload) => {
                const guild = this.guilds.cache.get(id);
                if (guild) guild.shard.send(JSON.parse(sPayload))
            },
        );
        this.haste = async function haste(text) {
            const req = await this.snek.post("https://haste.ntmnathan.com/documents", { text });
            return `\`\`\`https://haste.ntmnathan.com/${req.data.key}\`\`\``   
          }

    }
    start(token) {
        this.login(token);
        require("../database/MongoDB")(this);
    }
      
}
module.exports = TuningClient;

``` i am using custom client stuff
#

is that why it's not supported?

neon leaf
#

I mean you are extending client, it should technically work

tacit lagoon
#

hm

#

i wonder why it doesn't

#

well nvm, i modified it a bit and works now 💀

#

sorry for wasting time

#

😭

frosty gale
#

you have to diversify

#

fun fact lack of new experiences can lead to an increased chance of developing dementia

untold nymph
#
class AnimeBot(commands.Bot):
    def __init__(self, *, intents: discord.Intents):
        super().__init__(command_prefix=commands.when_mentioned_or('>'), intents=intents, owner_id=757618515451838546)

    async def on_ready(self):
        await self.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="/help"))
        logger.info("Logged in: %s | %s", self.user, self.user.id)
        logger.info("Votes : %s", await self.Topgg.get_bot_votes())

    async def setup_hook(self) -> None:
        # Register the persistent view for listening here.
        # Note that this does not send the view to any message.
        # In order to do this you need to first send a message with the View, which is shown below.
        # If you have the message_id you can also pass it as a keyword argument, but for this example
        # we don't have one.
  
        self.Topgg = topgg.DBLClient(bot=self, token=TOPGG_TOKEN)
        await self.sync()

    async def sync(self):
        await self.tree.sync()

intents = discord.Intents.all()
bot = AnimeBot(intents=intents)

@bot.event
async def on_dbl_vote(data):
    print(data)

bot.run(TOKEN)```
YO
can u explain me why on_dbl_vote dont work
solemn latch
untold nymph
quartz kindle
sharp geyser
#

Right

#

So hear me out

#

How do I make a taser

#

Not like a zappy zappy you go on the ground for a napy napy

#

but an uncomfortable shock

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

sharp geyser
#

Right i was hoping you guys knew that so Ididn't have to google and possibly get on a wanted list

sage bobcat
#

One message removed from a suspended account.

sharp geyser
#

I suck at googling, i'd end up finding out how to make a fucking bomb or smth

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sharp geyser
#

hm

#

would that be enough for a shock collar

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sharp geyser
#

Oh its nothing weird

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sharp geyser
#

but thats no fun

#

I want to make a custom fence

#

using hand made parts

#

and when you go out of bounds it shocks ya (dog)

#

Im not using this on humans trust me

#

I feel like i've been in the rust discord so much I have to explain myself

sage bobcat
#

One message removed from a suspended account.

sharp geyser
#

But none of those I would easily be able to interact with remotely

#

If I made my own it'd be easier

#

I dont want to figure out how ot make use of a pre-made one

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sharp geyser
#

Well not remotely accessible but interactive from the outside

sage bobcat
#

One message removed from a suspended account.

sharp geyser
#

from the different nodes

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.

sharp geyser
#

well

#

I had to clarify

#

that I wasn't wanting something powerful enough to literally hurt someone / something

#

but something that was more annoying

#

Could I have worded it better? Yea but im also tired

#

I also never said for a human

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.

past field
#

i think i messed up my bingo game 😬

sharp geyser
#

Well

#

time to become the next Michael Reeves then

#

Make dumb shit

sage bobcat
#

One message removed from a suspended account.

sharp geyser
#

Yea now he does

#

But before he was quite literally just making dumb shit and hoping it worked. with a lot of testing ofc

untold nymph
# quartz kindle yes

like this

class AnimeBot(commands.Bot):
    def __init__(self, *, intents: discord.Intents):
        super().__init__(command_prefix=commands.when_mentioned_or('>'), intents=intents, owner_id=757618515451838546)

    async def on_ready(self):
        await self.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="/help"))
        logger.info("Logged in: %s | %s", self.user, self.user.id)

        logger.info("Votes : %s", await self.Topgg.get_bot_votes())

    async def setup_hook(self) -> None:
        # Register the persistent view for listening here.
        # Note that this does not send the view to any message.
        # In order to do this you need to first send a message with the View, which is shown below.
        # If you have the message_id you can also pass it as a keyword argument, but for this example
        # we don't have one.
       
        self.Topgg = topgg.DBLClient(bot=self, token=TOPGG_TOKEN)
        self.ToppggWebhook = topgg.WebhookManager(self)
        self.ToppggWebhook.dbl_webhook(route="/dbl", auth_key=TOPGG_AUTH)
        self.ToppggWebhook.run(6000)
        await self.load_all()
        await self.sync()

    async def sync(self):
        await self.tree.sync()

intents = discord.Intents.all()
bot = AnimeBot(intents=intents)

@bot.event
async def on_dbl_vote(data):
    print("ererer")
    print(data)```
vast cobalt
#

anyone know how to add this

deft wolf
#

It's automatic

vast cobalt
#

nice

deft wolf
#

As soon as your bot is verified and Discord has enough data, it will display this

untold nymph
quartz kindle
untold nymph
quartz kindle
quartz kindle
untold nymph
#

local, on my server

quartz kindle
#

do you have a static ip address?

untold nymph
#

nop

quartz kindle
#

then you cant

#

it will stop working every time your ip address changes

untold nymph
#

if i have it, how i do

quartz kindle
#

the top.gg url should be your.public.ip.address:6000/dbl

#

and you need to port forward in your router

#

to unblock port 6000

untold nymph
#

hmmm

quartz kindle
#

its easier if you host your bot in a vps

untold nymph
#

is there another solution

quartz kindle
#

you can try using a service like noip.com

untold nymph
quartz kindle
# untold nymph what is it

Dynamic DNS makes a dynamic IP address act like it is a static IP address, meaning it does not change. It does this by utilizing a hostname and our Dynamic Update Client to keep your hostname updated with the correct IP address.

#

you make an account and install an app

#

the app detects your ip changes

#

and auto updates the address they give you

untold nymph
#

ohhh okay

#

I'll try

untold nymph
quartz kindle
distant smelt
#

Hello

quartz kindle
#

as long as its not used by something else

untold nymph
#

okay

distant smelt
#

Can someone tell me how to make a bot please

quartz kindle
distant smelt
quartz kindle
#

well, either learn how to code first, or try using one of those "bot makers" thingies out there

frosty gale
# sharp geyser but an uncomfortable shock

it depends on a lot of factors including whether the skin is wet, composition of your skin, how well the individual is grounded (if at all), etc
but in general for DC (which is what you would wanna use) it takes around 30-50 volts to penetrate the human skin, for AC oscillating at 60hz its usually less
for current youd usually keep it at single digit milliamps otherwise it can become dangerous

-# Disclaimer: Chloe is not responsible for any malice that may be done with this information, for more accurate information and readings, a professional should be consulted.

quartz kindle
#

-# Error: this message failed to load

proven lantern
earnest phoenix
#

sell

deft wolf
#

I don't think you can pay with crypto

lyric mountain
#

they already said it - sell the crypto then pay with the money

quartz kindle
#

lmfao

pearl trail
deft wolf
#

Sometimes I wonder what moderators think when they read these automod alerts

radiant kraken
neon leaf
#

hello guys can I send my code here? its related to crypto

#

see, works

#

send crypto paypal

#

you send me pay for 200%

radiant kraken
#

maybe it's from discord's automod system

neon leaf
#

i doubt it

radiant kraken
#

send crypto pay with paypal 200% fee

#

damn

pearl trail
#

hmm

radiant kraken
#

hmm

neon leaf
#

you send me your crypto

#

you send me your crypto, but i charge 200% conversion fee

#

you send me your crypto, pay with paypal, but i charge 200% conversion fee

pearl trail
#

is it regex or what 💀

neon leaf
#

you send me your crypto, pay for you with paypal

pearl trail
radiant kraken
#

crypto paypal conversion

#

send crypto pay paypal conversion

neon leaf
#

you send crypto for you pay with paypal

radiant kraken
#

this chat is like me testing my regexes

neon leaf
#

you send me crypto

#

pay for you with paypal, conversion, crypto

deft wolf
radiant kraken
#

send crypto pay with paypal conversion

#

send me crypto pay with paypal conversion

lyric mountain
#

put you

neon leaf
lyric mountain
#

nvm

radiant kraken
#

pay you paypal conversion crypto

neon leaf
#

pay for you with paypal, conversion, crypto

lyric mountain
#

comma?

neon leaf
#

wait what

#

why does it work now

lyric mountain
#

wait, does automod consider edits?

neon leaf
#

pay for you with paypal, conversion, crypto

lyric mountain
#

yep, it does

neon leaf
#

pay for you with paypal conversion your crypto

#

ok idk anymore

radiant kraken
#

lmao

quartz kindle
#

inb4 mods reading these alerts thinking we all got our accounts hacked

proven lantern
#

<id:customize>

#

oh it does stuff here

#

cool

quartz kindle
#

oh, never saw that

proven lantern
#

me neither

#

<id:customize>
<id:browse>
<id:guide>

rustic nova
#

Click me to know where free nitro pogu (troll pls no ban mods)

rustic nova
#

Damn

#

imagine sending someone the protocol link to delete the server

quartz kindle
#

:^)

#

is there even such a link?

rustic nova
#

there is discord://-/guilds/<guild_id>/settings/delete

#

LMAO it actually does directly delete a server

#

pls dont try it thanks

lyric mountain
#

discord when try not to allow catastrophic exploits (HARD)

deft wolf
whole knot
bitter granite
quartz kindle
rustic nova
#

yeah

#

I think

#

or am stupid, wait

#

nevermind, just makes it look like it lmao

#

lemme try deleting topgg

bitter granite
rustic nova
#

oh yeah nvm it just switches the view away from the server

radiant kraken
#

thats a lot of monitors

pearl trail
radiant kraken
sharp geyser
quartz kindle
sharp geyser
#

For some reason ima say that's not screen monitors

#

If that's not the case its 100% a bug cause no one has that many monitors

quartz kindle
#

:^)

pearl trail
#

damn

frosty gale
sharp geyser
#

Why you have such an insecure password

quartz kindle
#

some of my league of legends smurfs still use this password lmao

frosty gale
#

its impossible for data breaches to leak passwords this way because you authenticate by proving you own a private key by signing a challenge

sharp geyser
frosty gale
#

all major browsers and operating systems already support it

#

and it has built in 2fa

quartz kindle
sharp geyser
#

nah password

quartz kindle
#

ah xD

radiant kraken
#

nah its your discord account's password tim

frosty gale
#

thats the only bad thing about it

#

they made it a bit too complicated

#

you need to spend time learning and implementing it to do it properly

#

but theres libraries that can do it for you

sharp geyser
#

So basically webauthn uses biometrics to register and authenticate

frosty gale
#

it can do if you want it to be more secure but its not required

#

can be as simple as storing it on the computer

#

im going to be using it as my primary authentication gateway for accessing resources on my server

#

you losers can stick to using passwords

frosty gale
quartz kindle
#

you use your phone as the authenticator sort of, right?

#

what if you lose your phone?

frosty gale
#
  • you strictly dont have to use your phone unless a website demands it, but you can store it locally on your computer, or use a security key/phone which basically bundles 2fa with normal login
  • you can also setup multiple passkeys to mitigate the risk of losing your phone (so one may be on your computer locally)
#

didnt know discord had bullet points

radiant kraken
#

markdown™️

quartz kindle
#

no option to store locally on windows

frosty gale
#

thats probably because they disallowed it in the options which lets them control whether the key has to be stored off platform or if it can be stored on device

sharp geyser
#

nah

quartz kindle
#

this is what shows up

sharp geyser
#

It lets me save the passkey to 1password

#

L tim

#

so that means any of my devices with 1password on it can use it

frosty gale
#

not much you can do if the website doesnt allow it, but you could thereotically write a mod which lies to the website that its off platform when it actually isnt

quartz kindle
#

also, when i select a phone, it shows this, does it mean its locked to brave browser only? and if i use another browser this specific key wont work?

sharp geyser
frosty gale
#

well thats internally

#

if its cross platform your phones os stores it

quartz kindle
#

so request coming from brave.exe doesnt mean anything, its just a security warning about what is asking to create keys

sharp geyser
#

Seems like it

frosty gale
#

yeah its brave calling the windows api for registering a passkey

sharp geyser
#

Its just letting you know what is calling it

quartz kindle
#

and in the phone, the keys are stored in the google account right?

#

so if i lose google acount, rip me?