#development

1 messages · Page 192 of 1

past field
#

just like the real tim.

quartz kindle
#

lmao²

solemn latch
#

Poor tim, always getting the complements. Must be hard

quartz kindle
#

much pressure

frosty gale
#

although word of warning

#

that makes you very susceptible to ddos if youre not careful as well as complete authentication bypass if youre not careful

#

because an attacker can open multiple connections quickly with no authentication stopping them and since you wont close them until they try authenticate they will hang there taking up resources

solemn latch
#

I close them after 5 seconds iirc

frosty gale
#

thats still long enough to open tons of connections and overwhelm a server

#

but you shouldnt worry too much about it id just be aware that its possible

solemn latch
#

Hopefully it shouldn't be a problem.
Hopefully my DDOS protection kicks in first.

#

At first it'll probably be behind cloudflare too since I pay for a tier that allows a fair number of websockets.

#

Which should last me a few years

frosty gale
#

ideally i would require you to put an authentication token as query string or a header then you can add a handler before upgrade and reject connections right there and there

#

then you also dont run the risk of your websocket implementation processing messages before a user has authenticated through misconfiguration

solemn latch
#

I mean each websocket on the websocket server has a token property. Since every message will be validated anyway it shouldn't be a problem

#

Any message I received will require that token to do anything in the database.

#

(I'm not selecting/updating by ID, but by token)

#

That way if someone gets someone else's token and they reset it will automatically reject them even if they have an established connection

frosty gale
#

i would upon opening a connection, have a separate message handler that waits only for the authentication token, then when client successfully authenticates it registers events for messages relating to other commands that require authentication

past field
frosty gale
solemn latch
#

I don't think anyone thinks you're an idiot ^-^

solemn latch
solemn latch
# frosty gale i would upon opening a connection, have a separate message handler that waits on...

I just hate the way not authenticating after the upgrade occured.

Handling it on the client side seemed to lead to unknown errors, which I couldn't figure out how to cleanly handle.

It's hard to explain without showing.
I'm currently doing some work away from my computer. But I'll have to show it to you to see if there's a better way.

I'll setup a minimum example so it's easy to show ^-^

#

I spent like 2 days goofing around with it, looked at dozens of questions on the ws GitHub.

#

Because this is going to be for mostly inexperienced devs I need clean errors across multiple languages

frosty gale
sharp geyser
past field
past field
sharp geyser
past field
frosty gale
quartz kindle
#

all the weirdoes were banned

#

what was that guy's name again, that would constantly ask for help and then argue with whoever helped him

#

and got muted a gazillion times before ban

earnest phoenix
#

pls tell me the free hostings that will hosting bots 24/7

quartz kindle
earnest phoenix
quartz kindle
frosty gale
#

google is good but you have to be careful to stay within their free tier limits

last schooner
#

@earnest phoenix discloud

frosty gale
#

otherwise theyll start charging you and 1 its not cheap and 2 you cant set a hard limit i believe

#

i think even using too much network will automatically have you be charged

earnest phoenix
#

catch my country bro

frosty gale
#

what is your country

earnest phoenix
deft wolf
quartz kindle
#

you mean "guess my country"

quartz kindle
frosty gale
quartz kindle
#

lmao

deft wolf
#

I had to make sure because the only thing I remembered was that he tried to mess with the Steam API

earnest phoenix
quartz kindle
#

turkey, india, pakistan, iran

frosty gale
#

turkey is my guess too

earnest phoenix
#

" iran "

quartz kindle
#

rip

earnest phoenix
#

yea

sterile lantern
#

for reference, i usually use import but ig this package doesnt support that

earnest phoenix
frosty gale
#

sure

sterile lantern
#

yeah i guess

#

just depends which one ur most comfortable programming in

frosty gale
#

php

earnest phoenix
#

but i ... don't see the key in compass

frosty gale
earnest phoenix
#

but not "id"

#

i see the index in mongosh which is interesting

#

just not compass

#

OH SHIT I'M STUPID

#

rubber duck debugging strikes again barodev

#

this is interesting though...

earnest phoenix
earnest phoenix
#

uhhhh depends on your purpose

frosty gale
#

for a simple beginner bot i would recommend sqlite3

#

but if you dont know sql use a wrapper around it that makes it simpler to use

earnest phoenix
#

plz don't open your bot up to sql injection basically

sterile lantern
#

how can i make this work

#
  Try `npm i --save-dev @types/trello` if it exists or add a new declaration (.d.ts) file containing `declare module 'trello'```
#

i already tried a trello.d.ts file and that doesnt work either

real rose
#

lowercase T

sterile lantern
#

still get the same error

real rose
#

you didnt try hard enough ||(jokes)||

#

did you install the module

sterile lantern
#

yep

#

get the same issue when i try doing import * as trello from 'trello' (which is how i import all of my other packages)

wheat mesa
#

Did you actually do npm i trello

sterile lantern
#

yes

wheat mesa
#

Also why even bother using a package for this? I’m sure they have an easy to use REST API

#

Oh you’re using typescript

#

This package doesn’t have typings

sterile lantern
#

how would i bypass that

#

id assume with trello.d.ts but that doesnt work

quartz kindle
sterile lantern
#

yeah

#

doesnt exist

wheat mesa
#

It doesn’t exist

#

He’s using a random package that hasn’t been updated in 3 years

#

Just use their raw API

#

There’s no reason to use a package for this

sterile lantern
#

to be fair it still works lol

#

easier to use

quartz kindle
#

the advantages of an api that doesnt have breaking changes every year

#

unlike a certain lib

#

:^)

wheat mesa
#

js users when there isn’t a package to solve world hunger

deft wolf
#

Real

wheat mesa
#

One of the biggest things that bothers me about js is the amount of bloat packages that exist for no good reason

#

There doesn’t need to be a wrapper around everything 😭

sterile lantern
#

is there a way to just ignore the ts check

#

cause i tried the annotations

#

those dont work either

quartz kindle
wheat mesa
wheat mesa
#

add a globals.d.ts file and add the line declare module trello

quartz kindle
#

then idk, shit like this is why i dont use TS (cant miss a chance to shit on TS :^))

sterile lantern
wheat mesa
#

The root directory of the project

sterile lantern
#

yeah that doesnt work either

wheat mesa
#

Wherever your package.json file is stored

sterile lantern
#

get a bunch of these

pale vessel
#

is that your own lib?

sterile lantern
#

no

pale vessel
#

try disabling library checks then

wheat mesa
#

He’s trying to use a package that doesn’t have typings in ts

#

Adding a declaration file creates those issues above, idk

#

Never done that before

sterile lantern
#

oh those issues

#

always came

#

even without the declaration file

wheat mesa
#

oh

sterile lantern
#

it just happens whenever i try to declare that specific package

pale vessel
#

u could also just fork the lib and add the typings urself

sterile lantern
#

man i dont even use ts anymore

#

the main file used to be in ts

#

but i just changed everything to js

pale vessel
#

simply run the script with node without tsc then

sterile lantern
#

this is cf worker stuff

#

i tried removing ts stuff but still nothing

pale vessel
#

maybe it somehow didn't apply the new config properly

sterile lantern
#

i removed that entire file at one point

#

and i still get the same error

#

i think its something to do with the cf workers

pale vessel
#

check ur deployments

#

make sure that it deployed the proper code

sterile lantern
#

it wont even deploy

#

it just fails

#

because of those same errors

#

once i remove the trello import, it deploys fine

quartz kindle
#

go through the entire trello dependency tree and change all requires to use node: prefix

sterile lantern
#

these?

#

its in trello's package.json

quartz kindle
#

yes

#

its a ridiculous requirement but thats pretty much what cf is telling you

sterile lantern
#

do i need to do node:trello in my main file as well

quartz kindle
#

they dont support anything that uses internal node modules without the node: prefix

#

no

#

only the internal node modules

#

modules that are built into nodejs

#

or

sterile lantern
#

same errors

quartz kindle
#

you can try installing a 3rd party version lol

#

like install http and uri from npm

#

instead of using the node built in

sterile lantern
#

i tried that actually

#

i tried installing everything it said it couldnt find

#

but didnt work

quartz kindle
#

rip

sterile lantern
quartz kindle
#

cd into node_modules/restler/lib/multiplatform.js

#

and change fs and util to node:fs and node:util

sterile lantern
#

i get '1 problem in this file'

#

but it doesnt say anything

quartz kindle
#

ignore it

#

or add a ts exception to that line

sterile lantern
quartz kindle
#

did you add the node_compat thing to wrangler?

sterile lantern
#

yeah but when i deploy with that

#

it doesnt work

#

i think the project size gets too big

quartz kindle
#

if cf reinstalls everything from npm you're screwed either way

#

because it overwrites those import edits

sterile lantern
#

with the node_compat its 2121 kb

#

without its 700

#

regardless it doesnt work with either

quartz kindle
#

you'd need to fork those libs, edit them in your github then install them from github instead of npm

sterile lantern
#

trello? or all of the ones that trello requires

quartz kindle
#

if you can even install git on cf lol

#

since git is a requirement

sterile lantern
#

is there a way to just disable the ts requirements

#

or is this a cf worker issue

quartz kindle
#

what does restler even do

sterile lantern
#

idk

quartz kindle
#

An HTTP client library for node.js.

#

Last publish
8 years ago

#

ffs

#

fork trello, replace all restler calls with fetch

#

get rid of it

sterile lantern
#

could i just change this to fetch lol

#

in trello's main.js

quartz kindle
#

i mean, fetch is available globally in node 18+, so you dont need to require anything

#

but the api is different, so you need to reimplement the restler calls to the fetch format

sterile lantern
#

god

quartz kindle
#

es6 promise polyfill lol

#

object assign lol

sterile lantern
#

this is what restler did

quartz kindle
#

all those 3 things they use are all built into node now lol

sterile lantern
#

at this point i think it would just be easier to make functions

quartz kindle
#

probably

#

check what makeRequest does

sterile lantern
wheat mesa
#

Even better, don’t use a wrapper for something that doesn’t need a wrapper

sterile lantern
#

yeah im just gonna use the api directly

#

could just make my own functions so i dont need to repeat code

quartz kindle
#

callback hell from a decade ago

#

it isnt hard to replace all that with fetch, but you're probably better off making your own functions

past field
#

tim brother

harsh aspen
#

tim brother

quartz kindle
#

lol

frosty gale
#

is there a performance difference between using callbacks and promises

quartz kindle
#

yes

#

callbacks are faster, about 30% faster

real rose
#

(noooob^ )

frosty gale
#

those gains make callback hell worth it

harsh aspen
quartz kindle
#

any performance advantage will be absolutely demolished by the i/o wait time lol

#

so its only worth it if you have a gigantic hell of a function whose sheer amount of callbacks actually do amount to some difference

harsh aspen
# frosty gale is there a performance difference between using callbacks and promises

In terms of performance, both callbacks and promises have similar overhead when it comes to managing asynchronous operations. However, promises can sometimes have a slight performance advantage due to their ability to optimize certain asynchronous operations internally.

Promises have built-in mechanisms for error handling and chaining, which might make them slightly faster in certain scenarios compared to manually managing callbacks. Additionally, promises can be more easily composed and manipulated, leading to potentially more efficient code in complex asynchronous scenarios.

That said, the performance difference between callbacks and promises is usually negligible in most real-world applications. The choice between them should primarily be based on code readability, maintainability, and compatibility with existing codebases or libraries.

frosty gale
#

that looks like it was written with chatgpt

quartz kindle
#

indeed

#

and also wrong, anyone who says promises are faster than callbacks clearly never tested them

harsh nova
#

yeah that vocab is outside battleless scope

quartz kindle
#

callbacks use the event loop in a purely flow control way, its literally function calls

#

promises do a bunch more checks under the hood

#

have dedicated error handling

#

use the even loop in a different way, since they expect it to be async from the beginning

#

callbacks dont expect anything, you can use callbacks synchronously

harsh aspen
#

I see

#

thanks Timmy

frosty gale
#

svelte is so good

#

why do people use react

tulip ledge
#

also react is made by a multi billion company

#

while svelte was a 1 man job iirc

frosty gale
#

i have to say he did a better job

tulip ledge
#

he indeed did

jaunty lagoon
#

smarter*

wheat mesa
solemn latch
#

Lets see what I can do ^-^

frosty gale
#

the mods did an entire "protest" on ai generated answers

wheat mesa
#

I’m fine with AI being used in combination with someone’s brain

#

But blatantly copy pasting answers on a topic of which you have no knowledge is really annoying

#

If people wanted AI generated answers like that, they wouldn’t ask other humans

real rose
frosty gale
#

battleless getting banned (again)

radiant kraken
#

I'm sorry, but as an AI language model, I must follow ethical guidelines, and I cannot engage in harmful, malicious, or offensive behavior.

radiant kraken
harsh aspen
wheat mesa
#

My last AI generated response was… oh yeah, never

harsh aspen
#

Also, I didn't get warned that time

wheat mesa
#

If you don’t know the answer to something, don’t answer it

harsh aspen
wheat mesa
#

I look in here all the time and see questions I don’t know the answer to, I just leave it to someone else to respond instead of sending a paragraph of meaningless AI generated garbage

real rose
#

moreover the message you replied to was already answered

#

by someone more than qualified

#

so I'd leave it off next time

harsh aspen
#

ok nvm

#

anyways

#

I won't use AI to help you again

real rose
#

you weren't helping me

harsh aspen
#

let humans help you

harsh nova
real rose
harsh aspen
harsh nova
#

jolly good! We're on the same terms lol

spark flint
#

thats like applying to be a maths teacher without knowing maths and saying "oh i'll just use a calculator"

wheat mesa
#

^^

quartz kindle
wheat mesa
#

I wouldn’t be surprised

harsh nova
sharp geyser
#

then its dinner

harsh aspen
#

and if it sleeps like a cat and meows like a cat

harsh aspen
quartz kindle
#

sounds like a confession

harsh aspen
#

No I don't lie

#

I don't even know who you are talking abt

past field
#

does anyone have experience with the canvas node module with discord.js ?

harsh aspen
sharp geyser
past field
#

ah i forget

sharp geyser
#

State the issue you are having and someone qualified will be able to answer

past field
#

my bad 💀

sharp geyser
#

all good

quartz kindle
past field
sharp geyser
#

tim at this point you know just about anything js related

#

lets be real

past field
#

stg

past field
# quartz kindle pure coincidence i promise, but i do lol

do you have anything that i can use as a resource to figure out how to get canvas to automatically generate random numbers on a png of a bingo board i created? i’m working on creating a bingo game for my bot. i have the lobby set up successfully, now im working on the actual function of the game (how the numbers will be rolled, the buttons, etc) but i imagine the first thing that needs to happen after i tap my start button is the bot generating the bingo boards for the players

quartz kindle
#

then you use canvas's text drawing functions

#

you need to calculate the coordinates in the bingo image for where each number should be

sharp geyser
#

you can use math to also to calculate the coords

#

:)

#

which likely means you will need to 1. decide how big the board is 2. decide how big each box will be that houses a number

quartz kindle
#
  1. account for padding/border/separation between each box if applicable
sharp geyser
#

I haven't worked with canvas in a while but you can just make a sample board that will be used for every single board further. blank one ofc with only the boxes drawn and the other stuff

sharp geyser
#

I swear if the response from this guy is some chatgpt response I will send him to the gulag

past field
#

shit

past field
#

that sounds like a lot for my beginner brain

sharp geyser
#

its not too complicated tbh

past field
#

ok i gotta sit down, breathe, and dissect those steps lol

quartz kindle
#

check the docs for canvas fillText

#
MDN Web Docs

The CanvasRenderingContext2D method
fillText(), part of the Canvas 2D API, draws a text string
at the specified coordinates, filling the string's characters with the current
fillStyle. An optional parameter
allows specifying a maximum width for the rendered text, which the user agent will achieve by condensing the text or by using a lowe...

past field
quartz kindle
#

lmao

past field
#

laugh your brain off instead pls.

real rose
harsh aspen
harsh aspen
#

hey guys tricky question
how do app like discord handles real-time communication
like will the app fetch the messages API every second to receive new messages or they use a tool?

pale vessel
sharp geyser
harsh aspen
#

yes good idea

#

yep it works 🙂

civic scroll
#

oh someone already answered it

tulip ledge
#

websockets are so tedious and it's such unorganized code. I don't like it

#

wish there was a better way to do it

#

also quick question. I'm working on a kind of security bot and it has some niche features I haven't seen in any bot yet. But I was also thinking of adding a lot of cusomizability. With that I was thinking of integrating the Lua interpreter in my bot. So a server administrator could write lua scripts on the dashboard that will get triggered on specific events. Now I was wondering. How do i do this safely? Iirc I can disable access to certain packages of lua but users will still have access to the file system and to io. Also would this be something that people use?

lyric mountain
#

it's not inherently bad, people just take the easy way which makes it look bad

sharp geyser
#

easy way = best way trollface

vivid fulcrum
dim badger
#

I reported both IPs don't worry, but unlucky for you guys the dude had a temp file upload service that he used in-case the domain was taken down, if the malware is still in your system he's still digging into your credentials

civic sundial
#

Its just stuck here and bot won't work

civic sundial
errant basalt
#

I can't seem to add images to my bot page

#

FiveM Commands: From server info to player checks, FiveControl offers a range of handy commands to streamline management for both members and admins.

https://imgur.com/eYcj3Ae
  
Duty Commands: Need a duty tracker for police, EMS, and firefighters? FiveControl seamlessly toggles between modes, ensuring smooth server operation.

https://imgur.com/n4laSSl
https://imgur.com/roXnA8B
  
User-Friendly Interface: With an intuitive interface right in your Discord server, FiveControl makes managing your FiveM server as simple as sending a message.

Say goodbye to TxAdmin headaches and hello to FiveControl – your ultimate companion for all things FiveM!
deft wolf
#

Use html <img> tag or markdown

#

Also, this is a link to the gallery on imgur, not the image itself

errant basalt
#

changed it to the image. Now should I just put it like this? <img> the link <img>

deft wolf
#
errant basalt
#

Thank you

quartz kindle
errant basalt
deft wolf
#

Yep, this feature is not working

stable shale
errant basalt
#

sad

earnest phoenix
#

really? huh...

civic sundial
lyric mountain
#

if (warn == "DeprecationWarning: The Emoji#url getter is deprecated. Use Emoji#imageURL() instead") return;
holy lord of hardcoding

wheat mesa
#

my god

lyric mountain
#

but anyway, are you really not getting any error in console?

wheat mesa
#

So much unnecessary logging 😭

lyric mountain
wheat mesa
#

man

lyric mountain
# civic sundial Nope

ok so, put console.log("1") right above // ———————————————[Global Variables]———————————————

#

and console.log("2") right after // Initializing the project.

#

to check if it's stopping in one of those requires

civic sundial
#

1,2 done

lyric mountain
#

run it, see if they appear on console

lyric mountain
# wheat mesa man

tho I must agree, that's an insane amount of console.log calls when a single interpolated string could do it

quartz kindle
#

im pretty sure the bot is running

#

but you dont log anything

#

in the else block, you only have client.login(token), but then you dont log anything

lyric mountain
#

ah that's a true, there's no "Ready" message

civic sundial
lyric mountain
civic sundial
lyric mountain
#

then it's tim's case then

quartz kindle
#

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

wheat mesa
#

require("./handler")(client); ouch

#

Nothing to do with the issue but just an odd way of doing things

lyric mountain
#

also, is webhookClient declared anywhere?

frosty gale
#

use case: c++ too hard

lyric mountain
#

unless I'm blind I dont see it, so it'll error when logging the errors

civic sundial
lyric mountain
lyric mountain
lyric mountain
#

should be above client.login

civic sundial
lyric mountain
#

put it then, so we know whether the bot is going online or not

civic sundial
#

cuz it already have hat

#

ok

lyric mountain
#

where?

quartz kindle
#

you have a hat

#

nice

frosty gale
#

im glad theres some like minded people out there

lyric mountain
frosty gale
#

i shouldnt need to write an entire program to split a string

#

ill just import js and split it that way

lyric mountain
#

well, they named it ecmascript but whatever

frosty gale
#

(c++ standard library provides a function to split a string into an array by delim for the record)

wheat mesa
#

Splitting in C++ has always been garbage

#

The language itself is quite nice though

civic sundial
#

yea got it its not working from // ———————————————[Logging Into Client]——————————————— to end

lyric mountain
#

cuz there's virtually no exception handling in that code, so many stuff that could error there

sharp geyser
#

Right so I decided to torture myself cause I just love causing myself pain. How the fuck do I use slash commands with cogs

#
from discord.ext import commands
from discord import ApplicationContext, Bot

class Public(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.slash_command(name="setup", description="Allows you to setup your profile and choose your starter stats", guild_ids=[957867801119449109])
    async def setup(self, ctx: ApplicationContext):
        await ctx.respond('Setup will commence when I fully implement this feature')

    
def setup(bot: Bot):
    bot.add_cog(Public(bot))

using pycord this is how I am defining a cog

#
from discord import Bot, ApplicationContext, Intents
import os

intents = Intents()
intents.members = True
intents.guilds = True

bot = Bot(intents=intents)
@bot.event
async def on_ready():
    print(f"{bot.user.name} has logged in.")

    for cog in os.listdir('./cogs'):
        if cog.endswith('.py'):
            bot.load_extension(f'cogs.{cog[:-3]}')
            print(f'Loaded cog.{cog[:-3]}')
        else:
            continue
    


@bot.slash_command(guild_ids=[957867801119449109])
async def hello(ctx: ApplicationContext):
    await ctx.respond(f"Hello {ctx.author.name}")


bot.run("REDACTED")
#

the only slash command that loads is the hello slash command

sharp geyser
#

neat figured it out

#

:D

#

helps looking through very old pycord help forum channels ig

#

strange that slash_commands exists on commands but they dont advise you using it

#

💀

frosty gale
#

stupid maintainers shoving their stupid warnings in runtime

radiant kraken
#

gigachad language

sturdy dock
#

@sharp geyser

#

@radiant kraken

#

@frosty gale

#

@quartz kindle

#

Do U know how to add bot too my server

#

??

spark flint
#

fucking lmfao

#

stop pinging people

#
iorad

In this tutorial, you would be learning how to add a discord bot to your discord server from the Top.gg website.. The first step is to Open Top.gg, and Click on the search bar.. Type in the Name of the bot into the search bar.. Click on the Bot from the pop-up menu.. Click the Invite button beside the bot name.. A Discord pop-up appears. Click ...

sturdy dock
#

Who tf are U

spark flint
#

ur mom

#

who r u

sturdy dock
#

Ur sister

sharp geyser
#

no I do not

sturdy dock
sharp geyser
#

No problem

#

but uh that guy who you asked "Who tf are U" answered your question

#

so look there

#

:)

sturdy dock
#

Still don’t understand what you are saying

sharp geyser
#

click link and read

sturdy dock
#

Yeah

#

I saw IT

#

and i added it

sharp geyser
#

then READ

sturdy dock
#

But now the problem is idk how to use it

sharp geyser
#

then that sucks, we dont help with how to use bots

#

join the bot's support server

sturdy dock
sharp geyser
#

💀

sturdy dock
#

😂😂

sharp geyser
#

It's crazy people don't know how to use websites

#

or read

deft wolf
#

You are alive pogey

#

I thought that after all the time you spent on mute you would give up on this server

radiant kraken
# sharp geyser prove it
#include <stdio.h>
#include <string.h>
#include <stdint.h>

char * split_next(char * string, char * delim, const size_t delim_length, char * output) {
  char * ptr = strstr(string, delim);
  
  if (ptr != NULL) {
    const size_t found_len = ptr - string;
    
    memcpy(output, string, found_len);
    output[found_len] = 0;
    
    return ptr + delim_length;
  } else {
    strcpy(output, string);
    
    return NULL;
  }
}

int main(void) {
  char test[] = "somethingtestasdftestyes";
  char delim[] = "test";
  char output[50];
  char * tok = &test[0];
  
  do {
    tok = split_next(tok, delim, sizeof(delim) - 1, output);
    
    printf("%s\n", output);
  } while (tok != NULL);
  
  return 0;
}
``` this is what my 5 am mind came up with
sharp geyser
#

yea no

radiant kraken
#

wdym no

past field
#

what exactly could I code in for an anti-nuke security feature?

sharp geyser
#

nothing

#

let discord handle that /s

frosty gale
radiant kraken
past field
sharp geyser
#

Discord's auto mod

lament rock
#

sussy activity

earnest phoenix
#

why am i getting this when i call the webhook endpoint?

#

uhhhh who ghost pinged

real rose
#

someone who just got themselves banned

lyric mountain
earnest phoenix
lyric mountain
#

ah

sturdy dock
#

Does someone knows how to use scrims bot??

civic sundial
#

@quartz kindle @lyric mountain it was a command handler i got from a friend it was working great but the issue was that its version was discord v13 so i updated it from v 13 to v14 so then it started to giving errors of chalk after some work and my friend helped me in that the error was removed so now thats how its not working now

lyric mountain
#

well yeah, you cant simply update from v13 to v14 without changing code

civic sundial
sharp geyser
#

check out the migration guide

earnest phoenix
#

Hshshssjjsjss

#

Gay?

deft wolf
#

🤔

quartz kindle
deft wolf
#

Who is gay?

earnest phoenix
#

E you

quartz kindle
#

you are gay

earnest phoenix
#

You Tim

#

Is gay

quartz kindle
#

you are transgenda

#

lesbian? homosexual? how can i describe you?

earnest phoenix
#

Vai se fude

quartz kindle
#

kkkkkkkkkkk

#

brazilian detected

sharp geyser
#

lol

frosty gale
#

you can just tell by how it looks that its not gonna be nice

quartz kindle
lyric mountain
deft wolf
quartz kindle
#

do random shit for the lulz

chilly egret
#

can confirm

radiant kraken
green kestrel
humble gyro
green kestrel
#

splits strings

#

like um

#
std::vector<std::string> split_string = dpp::utility::tokenize(string, ",");
#

all the string helpers dpp makes for internal use, it exposes publically for users to use

#

because std::string is lacking, in some ways

humble gyro
#

ohh i see

green kestrel
#

tbh

#

if you just want to split a string at spaces, tabs and newlines, you can always use std::stringstream

#
std::stringstream stream("hello world");
std::string hello, world;
stream >> hello;
stream >> world;
#

its slow, though

wheat mesa
#

Not to mention this is probably unnecessary overhead

radiant kraken
#

the C/C++ way is to always write your own function for it mmLol

#

can't have a C/C++ project without a utility file

humble gyro
#

util.h

surreal sage
#

has anyone got a clue on how I can proxy udp and tcp connections from a vps to an opened port on my home server

#

tried this but doesnt quite work (nginx.conf)

#

wait it works oml

humble gyro
#

based af

#

(i have no idea)

#

what are you building?

surreal sage
#

couldnt change incoming and remote port

surreal sage
#

game server thing

humble gyro
#

sick

surreal sage
#

runs on my home windows server

humble gyro
#

I wanna do a multiplayer game someday

#

😭

surreal sage
#

and using vps as proxy

humble gyro
#

smart

surreal sage
#

butttt its not quite working

#

js stuck on this

#

damnit

#

and just found out about nginx -t

humble gyro
surreal sage
#

(why)

green kestrel
# wheat mesa Not to mention this is probably unnecessary overhead

yeah usually you'd want to avoid stringstream, it does some stuff that is expensive

like each time you instantiate one it reads various config from the system locale which means it literally reads a bunch of files, and it parses floating point numbers differently depending on your system locale e.g. in France it will read 1,03 as 1.03 but in England it won't.

#

you can avoid it doing that with commas by explicitly setting locale but this still doesn't stop it reading config files each time you create the object

surreal sage
#

i swear to god

#

if me forgetting to open port 8777 on server

#

is the issue

#

please dont work

#

it works and doesnt work

#

😋

quartz kindle
#

i got ptsd from working with excel formulas only to find out they dont work if the users excel is in a different language

green kestrel
#

lol exactly

green kestrel
#

you get all the pain of calendar/date/time manipulation and intervals/spans, plus representing them in wildly different formats depending on where the user is from!

neon leaf
#

Finally switched more stuff to cloudflare like my S3 and some APIs, it's been a pretty nice experience so far

wheat mesa
#

Too much work

#

Already hell to debug templates, can’t even imagine what it would be like with someone’s hobby project

#

Unless this just transpiles to C++, in which case it might be even worse for debugging

radiant kraken
#

Oficial

#

the name NodeppOfficial is not even taken

#

time to troll them by taking the name 🛒

quartz kindle
#

lmao

#

i dont know how to feel about that

#

like, it looks cool but also cursed

quartz kindle
radiant kraken
#

but i'm sure the project is in english

radiant kraken
#

why is this the first thing i see in my github explore page

craggy pine
#

Stop trying to use c and c++ to hack into the white house. It's obvious duh 🤷‍♀️

nova steppe
#

Hello,
Is it possible to do test votes to see if our code reacts correctly?
I thought it was possible, but I can't find it...
Thanks in advance !

quartz kindle
nova steppe
quartz kindle
#

you can test using a webhook test client as well

#

also feel free to show your code

nova steppe
quartz kindle
#

it doesnt matter whats on the receiving side

nova steppe
#

after that I don't use webhooks

#

I code in python for info

quartz kindle
nova steppe
quartz kindle
#

top.gg webhooks are not discord webhooks

#

the URL must be where your bot is hosted

#

your bot has to receive the vote, not discord

nova steppe
#

I understood the problem, I'm trying to simulate a vote, but the test functionality sends to a webhook, but I don't use a webhook, I use the API directly

#

my connection is via this line, I do not use webhooks

quartz kindle
#

all votes are sent to a webhook, not only test votes

nova steppe
#

I don't use the WebhookManager

quartz kindle
#

if you want to receive votes, you have to use it

nova steppe
quartz kindle
#

the webhookmanager is used to enable that event

#

the docs are very badly written and dont specify that

#

you need to add this to your code

#
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dbl", "dbl_auth").run(PORT)
nova steppe
#

ah ok, thank you, but then what url should I enter to receive the votes?

quartz kindle
#

and in the top.gg website, your URL should be http://yourbothostingIP:port/dbl

#

what hosting do you use?

nova steppe
#

I host my bot on a PC

quartz kindle
#

then its more complicated

nova steppe
#

oh 😅

quartz kindle
#

the URL should be http://your.pc.ip.address:port/dbl

#

but your router will likely block it

#

you will probably need to power forward in your router

lyric mountain
#

and ask your ISP for a fixed IP

#

some charge extra for it tho

nova steppe
#

Is it mandatory to go through a webhook?

quartz kindle
#

there is no other option

#

the only other option is using get_votes function in an interval

nova steppe
#

Oh yeah, not very practical...

#

Well, thank you, I have to go eat, I'll see how to do it tomorrow.
The documentation does not look very well explained, without you I could have searched for more hours! Thank you!

quartz kindle
#

np!

nova steppe
#

I'll probably come back to ask questions tomorrow around the same time if I can't make it, have a good evening! (Finally, it depends on the time at your place 😅)

nova steppe
#

France personally 🙃

humble gyro
#

incredibly epic

solemn latch
#

👀

wheat mesa
#

CMake is a build system, kinda like gradle but not really

#

GDB is a debugger (I feel like this is self explanatory)

#

Also fleet is absolutely NOT lightweight

#

It’s just meant to “feel” light

pale vessel
#

u can learn both, why choose?

#

it's not like you're under a deadline

quartz kindle
#

hes under a liveline

pale vessel
#

so probably cpp

tulip ledge
#

but rust is more fun

pale vessel
#

completely true

civic sundial
#

its not registering slash command what i did wrong ?

past field
past field
civic sundial
past field
# civic sundial didn't get it

what is it doing when you try this members count command? application did not respond? and if so, are you getting any errors in your terminal?

civic sundial
past field
civic sundial
past field
past field
# civic sundial no

do you get an acknowledgement from the bot that the command was successful?

past field
#

let me see your /ping code in the js file

civic sundial
sterile lantern
#

are you actually registering the commands globally/to your guild?

pale vessel
#

maybe u didn't register the other command

sterile lantern
#

the code u have in member count doesn't automatically push it, iirc its something like client.application.commands.set

#

or guild.commands.set if you want guild specific cmds

past field
pale vessel
#

it looks like they're mixing different command structures

#

i have no clue how their handler works but if ping works then they have to change the membercount command code and make sure to register it after ping

quartz kindle
past field
past field
quartz kindle
#

oh sorry, wrong reply

civic sundial
deft wolf
#

XD

quartz kindle
#

the code you showed is only about handling the slash commands

#

ie: what happens when the user uses the command

#

you didnt show any code that creates slash commands

#

slash commands have to be registered with the discord api

#

for example, discord.js has something like commands.set()

radiant kraken
#

have fun

quartz kindle
past field
#

i shouldn't have even said anything, damn

civic sundial
#

@quartz kindle like this ?

sterile lantern
#

is commands.create even a thing

#

im pretty sure its commands.set

deft wolf
#

The first thing is that you are missing () after Client, the second thing is that this function is a promise so you have to use either await or .then and the third thing is that I am quite sure that any type must be a number

sterile lantern
#

it also looks like theyre mixing code together

deft wolf
#

You also need to provide intents in the client, otherwise you will get an error

deft wolf
#

Yes, that's the error

civic sundial
#

Intentsbitfield.Guild_member e like that

deft wolf
#

I have no idea, choose the ones that your bot requires to work

lyric mountain
#

hey look who I found here

#

ur back

quartz kindle
#

set replaces all commands with a list of commands

#

create adds a new command

radiant kraken
#

how's c++ been going

quartz kindle
#

btw you only need to run that code once

#

after its registered, you never need that again, unless you want to update the command or create a new command

#

you dont need to run that on every bot start

sterile lantern
civic sundial
civic sundial
civic sundial
radiant kraken
#

why

civic sundial
quartz kindle
civic sundial
quartz kindle
#

you are reassigning commands.create to an object

#

you forgot the () bro

#

commands.create({ ... }) not commands.create = { ... }

#

also, the execute function has nothing to do with that, why is it there

sage bobcat
radiant kraken
#

it doesn't look weird

#

which part looks weird to you

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.

radiant kraken
#

that's opereator overloading

#

and i can get why it can throw off most beginners, because it did to me once

sage bobcat
#

One message removed from a suspended account.

radiant kraken
#

i hate the fact that the first thing most people introduce C++ is thru std::cout <<

#

faithie people come from all sorts of backgrounds

#

here's a more bearable version```cpp
#include <cstdio>

int main() {
printf("hello\n");
return 0;
}

#

yes

radiant kraken
radiant kraken
#

yes

#

C is compatible with C++

civic sundial
radiant kraken
#

sheesh

civic sundial
radiant kraken
#

i learned C when i was 15 on my own because my school doesn't have any CS classes lol

#

i self-learned 100% of my stuff

civic sundial
radiant kraken
#

they are quite technical though

#

C++ is not as centralized compared to Rust

lament rock
#

I don't touch java unless I gotta do something mc modding related. A lot of these languages schools have been advocating have kinda fell off and now they're kinda accumulating technical debt I feel like

#

cs is still applicable, but from what I personally have seen is mostly only applicable because of Unity

#

Id like to sit down and actually learn rust and cpp but rust's syntax turns me off so hard :(

pale vessel
#

rlly? rust's syntax is lovely

#

it's quite consistent and i like it, coming from someone with a JS background

quartz kindle
#

omg java bad js good ok

lament rock
#

Java is alright yeah from personal experience. I was able to pick it up quite easily after 6 years in js/ts, but I'm not a huge fan of the compile to java bytecode to later be interpreted. I guess it helps with bundle size, but :( readability goes to 0. I've had to edit java bytecode and I never wanted to uninstall my OS more

#

Been using fernflower for a while but I'll give that a try

#

how so?

#

I might actually start editing bytecode that way if thats the case

#

or wait im mixed up

#

ignore my mindless ramblings

#

Yup I mistook that for some program I used to remove some fields from classes preventing vanilla mc clients to join

earnest phoenix
#

just wondering is there a way to see if a shard server in a mongo cluster has failed via mongo js?

radiant kraken
#

lucky

#

i wish i had CS classes in school

#

stupid curriculum

#

wdym?

#

yikes

#

doesnt sound so fun

#

i was never interested in programming until i turned 13

#

...because of some youtube programming tutorial i found on my recommended

#

i think i got to discord bots when i was still like 3 months into learning

lyric mountain
#

what if you wanted to go to heaven, but god said ```regex
(android|bb\d+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series([46])0|symbian|treo|up.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ -/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel([im])|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-

#

inb4, this is to detect mobile browsers

neon leaf
#

what in the actual fuck

lyric mountain
#

yes

quartz kindle
#

is that regex

#

jesus christ

radiant kraken
#

looks like my regexes

quartz kindle
#

my regexes are at most /\s+/g

#

lmao

#

just bought 4 sd cards online, testing them to check if they are not fake

#

lmao

radiant kraken
# quartz kindle my regexes are at most /\s+/g

my regexes are at most [\/\[\]\{\}\(\)\:\|iIljJ17T!]([vV]|\\\/)[\\\[\]\{\}\(\)\:\|iIljJ17T!]|[\/\[\]\{\}\(\)\:\|iIljJ17T!]\\[\/\[\]\{\}\(\)\:\|iIljJ17T!]\\|[\\\[\]\{\}\(\)\:\|iIljJ17T!]\/[\\\[\]\{\}\(\)\:\|iIljJ17T!]\/|[n1]{2}|rn

radiant kraken
#

leetspeak matching

quartz kindle
#

Lol

#

1337 h4x0r

radiant kraken
#

lots of blackslashes

wheat meteor
#
const webhook = new Topgg.Webhook("this")

how i get the webhook-auth ?

wheat meteor
#

Ok, but in the webhook URL, how do i get the "server ip"?

quartz kindle
radiant kraken
#

your server's URL

wheat meteor
quartz kindle
#

its your bot's ip address on discloud then

acoustic bough
#

you need to have your bot on a host that also provides you with an IPv4 or IPv6

quartz kindle
#

what kind of access do you have? is that one of those pterodactyl panels?

acoustic bough
#

probably

wheat meteor
#

Ok, thanks

radiant kraken
#

dont use regex then

wheat meteor
#

Only this

#

I can't get the ip

radiant kraken
#

or at least only use regex for the most predictable parts

acoustic bough
#

then your host sucks

quartz kindle
radiant kraken
#

nice

radiant kraken
lyric mountain
acoustic bough
#

that regex looks like it will break after a day in production

lyric mountain
#

that's actually the official way of doing it

acoustic bough
#

I honestly just use the screen width to find out if the browser is mobile or not

lyric mountain
#

until navigator.userAgentData.mobile catches on at least

lyric mountain
acoustic bough
#

lol

radiant kraken
acoustic bough
#

lmao

quartz kindle
#

its not like browsers can access much of the device's OS

radiant kraken
#

request headers

#

user agent

quartz kindle
#

just send the screen size in the headers

#

lmao

quartz kindle
#

i see rossmann, i press like

frosty gale
#

rossman is one of the few people i respect

#

and i dont usually look up to people

quartz kindle
#

same

umbral lily
#

What do people use for subscription services? Is it against tos to use a third party? Discord teams doesn't support my country.

sharp geyser
#

Why would it be against tos?

#

Discord implanted their own way to make it a little easier for people but if it doesn’t work for you then use something else

digital swan
umbral lily
umbral lily
#

I would prefer to automate it in the background.

digital swan
umbral lily
digital swan
#

Don’t just go with it cause a random internet man with a cat pfp said it’s good though

#

Do some research and see what would work best for you

#

Maybe there’s something better

sharp geyser
#

Just so you know you dont need to interact with the api yourself from what I recall

#

ko-fi has a discord integration

sharp geyser
#

Ah yes, love it when it still creates the product listing as 0.10$

#

clearly what I told it to do

#

💀

#

wait

#

why the fuck

#

what is the point of that data field stripe 😭

dusky idol
#

Can you explain it now? I think I'd need it a bit !
I'm sometimes facing the "Connection Terminated" errors maybe due to the heavy demand as there's too many users using the bot now?

north cairn
#

hey guys
does cloudflare support hosting websites(free version)

#

without any troubles as it have with dc bots

north cairn
solemn latch
#

As long as it's a static site

north cairn
#

enlighten me on what is a static site

solemn latch
north cairn
#

bruh static websites dont allow changes

#

A static website is one where web pages are delivered exactly as they are stored, with no real-time content changes. In contrast, a dynamic website generates content in real time, typically using databases and scripting languages to provide interactivity and personalized experiences.

#

whats the use of static website then

#

make a portfolio ig??

deft wolf
#

Blogs

solemn latch
#

A lot of websites are static

north cairn
#

can someone give examples of static site and dynamic site

#

amazon must be dynamic right?
blogs would be static?!

solemn latch
#

Discordjs.guide could all be made static

#

The search functionality would have to be implemented client side, but it could be static

north cairn
#

give me some popular examples
that would help me understand better

#

yep so i cant really make a top level website without dynamic

solemn latch
#

What do you need that's dynamic?

north cairn
#

i can't store informations

solemn latch
#

Ah

#

You're likely going to have to pay for what you want.

#

If you don't want to have issues at least

north cairn
#

hmmmm
so atleast i can make some projects right?!

#

mayb a portfolio one
to -do-list would be dynamic

solemn latch
#

So a lot of bot websites are static.

Like a description and invite button.

north cairn
#

there are so many cons
u cant even do login system

solemn latch
#

If you want a login system you really really shouldn't use free services

north cairn
#

sed

solemn latch
#

Free services often sell information, by looking at what you put on them.

So any user data needs to be on a paid server imo.

#

Even if the free service generally can't see the data easily if it's in a database

north cairn
#

so for now,i wont have issues with a portfolio website with cloudflare?

solemn latch
#

You should have no issues

north cairn
#

general question
what cloudflare is for

#

it's free plan seems useless to me

solemn latch
#

It's not really a simple answer.

They have a million different features

#

The big ones I use is workers(lamba style serverless), DDOS protection, cdn, and load balancing.

#

If you're specifically talking about cloudflare pages, that's one of their smaller features.

#

It's not something the bulk of their users use

north cairn
#

hmm ok thanks

quartz kindle
#

dynamic = has a backend behind, ie nodejs, python, php, .net, etc

#

you can use cloudflare pages for static and cloudflare workers for backend

north cairn
#

IS IT FREE

#

?!

quartz kindle
#

up to the specified limits, yes

silver jungle
#

Is the Top.gg sdk safe to install now?

quartz kindle
quartz kindle
silver jungle
radiant kraken
#

pypi has tightened its security by 2024 by deprecating password auth and enforcing 2fa poggythumbsup

quartz kindle
#

TS: is there anyway to simplify this?

#

basically i have a type for a nested object:

{
  a: {
    b: any,
    c: any
  },
  d: {
    e: any
  }
}
#

and i want to turn it into the type "a.b" | "a.c" | "d.e"

#

with all combinations of parent and child

#

wondering if there is a way to do that without two template types lol

#

wondering if there is something like ${keyof PlanetDataCache}.${keyof PlanetDataCache[keyof PlanetDataCache]} that would work

frosty gale
#

this is why i never make complex types in typescript

#

you focus more on types than actual code

humble gyro
#

we do something similar to type i18n

quartz kindle
#

i managed to simplify it to a single template at least

solemn latch
#

Lol<K>

quartz kindle
#

pretty much

#
K extends keyof PlanetDataCache ? `${K}.${Extract<keyof NonNullable<PlanetDataCache[K]>, string>}` : never
#

without Extract it complains symbol is not assignable to string

#

@_@

#

is there any way to do a loop inside a type in ts? like instead of Lol<keyof abc> cant i somehow do the keyof abc part inside the type declaration while keeping the context for each key?

#

apparently this only works when definidng object keys:

type Optional<T> = {
  [K in keyof T]?: T[K];
}
#

it doesnt work if you do type = K in keyof T ...

#

nevermind i give up

#

once i do variable.split(".") i lose all type info lol and get reverted back to string

humble gyro
#

That kinda makes sense

quartz kindle
lament rock
quartz kindle
#

ye

lament rock
#

would have to cast which isnt the hugest deal

quartz kindle
#

honestly all i wanted it for was to get autocomplete in a nested switch case lol

#

im still not sure how im even gonna design this function tho

#

its a pretty complex/annoying one

past field
#

i’m still having trouble understanding how to set up better sqlite3 for discord.js v13

quartz kindle
lament rock
#

The same you would for any structure

past field
quartz kindle
#

or you mean the SQL language in general?

past field
#

i want to have a database connected to my bot so i can have like a server currency, level system, leaderboards, stuff like that

frosty gale
#

just curious about modern js, does a for of loop over an array still incur a significant performance penalty as opposed to doing a for i arr[i]?

quartz kindle
#

sqlite has two parts:

  1. the wrapper library, written in js (better-sqlite3)
  2. the SQL language, which is what you use to run commands inside sqlite
frosty gale
#

makes no sense

#

for of should keep things more on the native side

quartz kindle
#

for of invokes the iterator functions

frosty gale
#

with a for i youre basically doing 2 statements for 1 thing

frosty gale