#development
1 messages · Page 192 of 1
lmao²
Poor tim, always getting the complements. Must be hard
indeed
much pressure
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
I close them after 5 seconds iirc
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
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
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
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
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
meawhile, with the questions i ask, he probably thinks i’m an idiot 😭😂
thats a good idea also
I don't think anyone thinks you're an idiot ^-^
I had a feeling you'd stick with programming the first time you asked something here just based off your questions and problem solving. I don't think anyone thinks you're an idiot. Just a beginner
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
you mean its difficult to handle authentication errors before the upgrade on the client side?
oh yea I bet
you and @deft wolf are the only reasons i stick with it lol
you never make me feel like an idiot and @deft wolf ‘s patience with me is unbelievable
100%%%%%%%%
most of #development anyways
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
pls tell me the free hostings that will hosting bots 24/7
lmao he was my favourite
repl.it probably
google compute engine free tier
repl.it
oracle compute free tier
replit's security is 0%
i forgor his name tho
k thx
you suggesting oracle is like leading him to his demise
google is good but you have to be careful to stay within their free tier limits
@earnest phoenix discloud
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
thx
but i can't acces to them services in my country 
catch my country bro
what is your country
catch my country
battleless?
you mean "guess my country"
yeah him lmao
brazil
lmao
I had to make sure because the only thing I remembered was that he tried to mess with the Steam API
no
turkey, india, pakistan, iran
turkey is my guess too
rip
yea
python is good for discord bot development ?
sure
php
but i ... don't see the key in compass
not sure what you're trying to do here but in mongodb the id field already exists for all records and is automatically indexed
yeah, _id_ exists
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 
this is interesting though...
sqlite3 or mysql ?
??
which one is better for discord bot's database
uhhhh depends on your purpose
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
plz don't open your bot up to sql injection basically
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
lowercase T
still get the same error
yep
get the same issue when i try doing import * as trello from 'trello' (which is how i import all of my other packages)
Did you actually do npm i trello
yes
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
did you try npm i @types/trello
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
the advantages of an api that doesnt have breaking changes every year
unlike a certain lib
:^)
js users when there isn’t a package to solve world hunger
Real
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 😭
is there a way to just ignore the ts check
cause i tried the annotations
those dont work either
did you try creating a declaration module .d.ts and including it in your tsconfig?
like this?
if so yeah
add a globals.d.ts file and add the line declare module trello
then idk, shit like this is why i dont use TS (cant miss a chance to shit on TS :^))
in the project or in the same folder as the file
The root directory of the project
yeah that doesnt work either
Wherever your package.json file is stored
is that your own lib?
no
try disabling library checks then
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
oh
it just happens whenever i try to declare that specific package
u could also just fork the lib and add the typings urself
man i dont even use ts anymore
the main file used to be in ts
but i just changed everything to js
simply run the script with node without tsc then
maybe it somehow didn't apply the new config properly
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
it wont even deploy
it just fails
because of those same errors
once i remove the trello import, it deploys fine
have you tried doing what i mentioned before?
go through the entire trello dependency tree and change all requires to use node: prefix
do i need to do node:trello in my main file as well
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
same errors
you can try installing a 3rd party version lol
like install http and uri from npm
instead of using the node built in
i tried that actually
i tried installing everything it said it couldnt find
but didnt work
rip
cd into node_modules/restler/lib/multiplatform.js
and change fs and util to node:fs and node:util
did you add the node_compat thing to wrangler?
yeah but when i deploy with that
it doesnt work
i think the project size gets too big
if cf reinstalls everything from npm you're screwed either way
because it overwrites those import edits
with the node_compat its 2121 kb
without its 700
regardless it doesnt work with either
you'd need to fork those libs, edit them in your github then install them from github instead of npm
trello? or all of the ones that trello requires
restler primarily, then edit trello to use your github restler
what does restler even do
idk
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
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
god
all those 3 things they use are all built into node now lol
Even better, don’t use a wrapper for something that doesn’t need a wrapper
yeah im just gonna use the api directly
could just make my own functions so i dont need to repeat code
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
tim brother
tim brother
lol
i have an interesting question for you
is there a performance difference between using callbacks and promises
battleless?
(noooob^ )
tf
those gains make callback hell worth it
I'm a good human 👀
the thing is
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
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.
that looks like it was written with chatgpt
indeed
and also wrong, anyone who says promises are faster than callbacks clearly never tested them
yeah that vocab is outside battleless scope
AI never gives wrong answers
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
cause it was made before svelte and most existing apps were made in react
also react is made by a multi billion company
while svelte was a 1 man job iirc
i have to say he did a better job
he indeed did
Petition to ban AI generated answers from #development
Lets see what I can do ^-^
is this stackoverflow
the mods did an entire "protest" on ai generated answers
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
havent you been warned before for using stupid AI generated responses constantly
battleless getting banned (again)
I'm sorry, but as an AI language model, I must follow ethical guidelines, and I cannot engage in harmful, malicious, or offensive behavior.
artificial intelligence meets natural stupidity 
Bro, my last AI generated response was on 3/3/2024, where is constantly
My last AI generated response was… oh yeah, never
Also, I didn't get warned that time
If you don’t know the answer to something, don’t answer it
Chatgpt really helps me in development, thats why Im encouraging to use it like me
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
you were not encouraging.
If users want to use AI, they will do that as opposed to asking in here.
moreover the message you replied to was already answered
by someone more than qualified
so I'd leave it off next time
let humans help you
I wont do the thing you told me not to do
how dare you
"you" was not meant only to you sorry
jolly good! We're on the same terms lol
...you are giving guidance to people on stuff you don't know ☠️
thats like applying to be a maths teacher without knowing maths and saying "oh i'll just use a calculator"
^^
is that actually him? lmao
I wouldn’t be surprised
well shit if it walks like a duck and talks like a duck...
and if it acts like a fish and swims like a fish
then its dinner
and if it sleeps like a cat and meows like a cat
(no)
sounds like a confession
does anyone have experience with the canvas node module with discord.js ?
Im sure someone does, but they wont just ask you your problem.
ah i forget
State the issue you are having and someone qualified will be able to answer
my bad 💀
all good
pure coincidence i promise, but i do lol
thank the lord, tim the code god knows all i stg
stg
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
generating is easy, just use Math.random() and stuff
then you use canvas's text drawing functions
you need to calculate the coordinates in the bingo image for where each number should be
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
- account for padding/border/separation between each box if applicable
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
👀
I swear if the response from this guy is some chatgpt response I will send him to the gulag
shit
like that?
that sounds like a lot for my beginner brain
its not too complicated tbh
ok i gotta sit down, breathe, and dissect those steps lol
check the docs for canvas fillText
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...
it’ll much easier if you just disconnect your brain from the stem and switch brains with me for a few mins
lmao
laugh your brain off instead pls.
💀
lmao
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?
can't u ask ur chatgpt that question?
why did I have that same thought to ask this question 😭
WebSocket
the application establishes a duplex (two-way) communication pipeline to the chat server after a successful upgrade request (handshake)
think like when you make a cellular call
oh someone already answered it
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?
depends, you can make a well-organized websocket if you spend enough time on it
it's not inherently bad, people just take the easy way which makes it look bad
easy way = best way 
i don't remember where i exactly read this, but quite an innovative approach is to run untrusted code inside of a docker container. you can let the user do whatever with the file system and memory as it is all virtualized and gets cleaned up
useful article: https://hmarr.com/2013/oct/16/codecube-runnable-gists/
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
Its just stuck here and bot won't work
No error or anything
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!
Use html <img> tag or markdown
Also, this is a link to the gallery on imgur, not the image itself
changed it to the image. Now should I just put it like this? <img> the link <img>
Thank you
show your index.js
Yep, this feature is not working
same issue
sad
really? huh...
here is it
if (warn == "DeprecationWarning: The Emoji#url getter is deprecated. Use Emoji#imageURL() instead") return;
holy lord of hardcoding

my god
but anyway, are you really not getting any error in console?
So much unnecessary logging 😭
Nope
that's a template, they're usually pretty verbose to help forkers troubleshooting
man
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
1,2 done
run it, see if they appear on console
tho I must agree, that's an insane amount of console.log calls when a single interpolated string could do it
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
ah that's a true, there's no "Ready" message
Nope bot no even showing its activity
neither 1 nor 2 appeared on console?
it did
then it's tim's case then
add client.on("ready", () => { console.log("bot is ready") })
require("./handler")(client); ouch
Nothing to do with the issue but just an odd way of doing things
also, is webhookClient declared anywhere?
for some reason this line gave me the idea of a c++ library that lets you import and use javascript functions
use case: c++ too hard
unless I'm blind I dont see it, so it'll error when logging the errors
there's already a library for that
lmao
where did you put the code tim sent?
^
should be above client.login
i didn't
put it then, so we know whether the bot is going online or not
where?
why
im glad theres some like minded people out there
yeah, they named it JavaScript
i shouldnt need to write an entire program to split a string
ill just import js and split it that way
well, they named it ecmascript but whatever
(c++ standard library provides a function to split a string into an array by delim for the record)
yea got it its not working from // ———————————————[Logging Into Client]——————————————— to end
do you have a file named main.json inside botconfig folder?
cuz there's virtually no exception handling in that code, so many stuff that could error there
yupp
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
what if you remove require("./handler")(client);
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
💀

what in the absolute fuck
thats my favourite line of js by far
stupid maintainers shoving their stupid warnings in runtime
Splitting in C is 💪 
gigachad language
prove it
@sharp geyser
@radiant kraken
@frosty gale
@quartz kindle
Do U know how to add bot too my server
??
fucking lmfao
stop pinging people
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 ...
Who tf are U
Ur sister
no I do not
Thnx for your response
No problem
but uh that guy who you asked "Who tf are U" answered your question
so look there
:)
Still don’t understand what you are saying
click link and read
then READ
But now the problem is idk how to use it
How?
💀
😂😂
You are alive 
I thought that after all the time you spent on mute you would give up on this server
#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

yea no
wdym no
what exactly could I code in for an anti-nuke security feature?
world dies if a split token is larger than 49 characters
just malloc + realloc 
no way 😭
whatcha mean?
Discord's auto mod
sussy activity
someone who just got themselves banned
this what? the embeds thing?
got it sorted, i was using the wrong api version
ah
Does someone knows how to use scrims bot??
@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
well yeah, you cant simply update from v13 to v14 without changing code
what should i do now ?
check out the migration guide
🤔
why are you gay?
Who is gay?
E you
you are gay
Vai se fude
lol
this is the funniest shit
you can just tell by how it looks that its not gonna be nice
xD
impressive gtranslate could understand it
I wonder what the motivation is for people to go to this exact server and this channel to write something like this
its called being a kid on the internet
do random shit for the lulz
can confirm
this excretory system is not designed to receive!!!! it is only for exit!!!!!
this is why dpp provides dpp::utility::tokenize 😄
what does that do? 👁️
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
ohh i see
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
Still quite verbose compared to a built in method
Not to mention this is probably unnecessary overhead
the C/C++ way is to always write your own function for it 
can't have a C/C++ project without a utility file
util.h
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
couldnt change incoming and remote port
sick
runs on my home windows server
and using vps as proxy
smart
butttt its not quite working
js stuck on this
damnit
and just found out about nginx -t


seems like tcp is working but not udp
(why)
wut.
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
nah please
i swear to god
if me forgetting to open port 8777 on server
is the issue
please dont work
it works and doesnt work
😋
holy shit locale-dependent code is a programmer's worst nightmare
i got ptsd from working with excel formulas only to find out they dont work if the users excel is in a different language
lol exactly
the only thing worse is locale dependent dates
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!
Finally switched more stuff to cloudflare like my S3 and some APIs, it's been a pretty nice experience so far
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
Oficial
the name NodeppOfficial is not even taken
time to troll them by taking the name 🛒
maybe its in another language, thats how you write "official" in portuguese btw lmao
but i'm sure the project is in english
why is this the first thing i see in my github explore page
Stop trying to use c and c++ to hack into the white house. It's obvious duh 🤷♀️
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 !
yes its possible, there should be a test button somewhere in the webhook settings page
I tried but nothing happens on my bot side, after that I don't use the webhook, maybe the problem comes from this side
if nothing happens on the bot side, then it probably means its not receiving correctly
you can test using a webhook test client as well
for example https://webhook-test.com/
also feel free to show your code
after that I may have made a mistake, I used a test bot and not the one that is on the site, so it may not receive the votes...
the votes go to the webhook url you specify
it doesnt matter whats on the receiving side
what URL did you put in your top.gg webhook?
I put the url of a discord webhook
thats wrong
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
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
I don't use the WebhookManager
if you want to receive votes, you have to use it
this event does not work to receive votes? Well it doesn't work for tests, but for normal votes?
it only works if you use the webhook manager
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)
ah ok, thank you, but then what url should I enter to receive the votes?
and in the top.gg website, your URL should be http://yourbothostingIP:port/dbl
what hosting do you use?
I host my bot on a PC
then its more complicated
oh 😅
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
The thing is that it's a friend's PC, so I don't have access to the box 😅
Is it mandatory to go through a webhook?
there is no other option
the only other option is using get_votes function in an interval
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!
np!
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 😅)
brazil 💀
France personally 🙃
👀
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
hes under a liveline
so probably cpp
but rust is more fun
completely true
its not registering slash command what i did wrong ?
do you have other commands that register with slashcommandbuilder?
ping
do you have the proper intents enabled?
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?
his is what its doing no other command then ping
but when you use /membercount, what happens? do you get an error?
nothing happend
do you get “application does not respond” ? or any errors in your terminal?
no
do you get an acknowledgement from the bot that the command was successful?
no
so when you use the /ping command, it works?
let me see your /ping code in the js file
yea it dose
are you actually registering the commands globally/to your guild?
maybe u didn't register the other command
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
and does it matter that the memberscount is using slashcommandbuilder and the ping command doesn’t?
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
did you do this? https://discordjs.guide/creating-your-bot/command-deployment.html#command-registration
that’s what i was going to suggest
yes i personally have, it was @civic sundial i think may need to take a look
oh sorry, wrong reply
can you summery it that to long to read
XD
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()
have fun
i shouldn't have even said anything, damn
@quartz kindle like this ?
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
it also looks like theyre mixing code together
You also need to provide intents in the client, otherwise you will get an error
client missing intents
Yes, that's the error
which intents do i use
Intentsbitfield.Guild_member e like that
I have no idea, choose the ones that your bot requires to work
Me either
it is
set replaces all commands with a list of commands
create adds a new command
how's c++ been going
something like that yeah
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
oh ic, I’ve only ever used set lol
@quartz kindle what the hell is this now ?
why
dafuq is this code lmao
💀
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
same error
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.
that's opereator overloading
and i can get why it can throw off most beginners, because it did to me once
One message removed from a suspended account.
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
like beginners might interpret function calls as function << arg1 << arg2; which is absolutely wrong
is it C ?
i learnd it when i was in 9 class at school
sheesh
then python, then html css for web dv and js lilbit
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
Damn
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 :(
rlly? rust's syntax is lovely
it's quite consistent and i like it, coming from someone with a JS background
omg java bad js good ok
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
just wondering is there a way to see if a shard server in a mongo cluster has failed via mongo js?
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
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
what in the actual fuck
yes
what the hell
is that regex
jesus christ
looks like my regexes
wtf is that
my regexes are at most /\s+/g
lmao
just bought 4 sd cards online, testing them to check if they are not fake
lmao
my regexes are at most [\/\[\]\{\}\(\)\:\|iIljJ17T!]([vV]|\\\/)[\\\[\]\{\}\(\)\:\|iIljJ17T!]|[\/\[\]\{\}\(\)\:\|iIljJ17T!]\\[\/\[\]\{\}\(\)\:\|iIljJ17T!]\\|[\\\[\]\{\}\(\)\:\|iIljJ17T!]\/[\\\[\]\{\}\(\)\:\|iIljJ17T!]\/|[n1]{2}|rn
jesus
the hell is that for
leetspeak matching
lots of blackslashes
const webhook = new Topgg.Webhook("this")
how i get the webhook-auth ?
in your top.gg bot webhook page
Ok, but in the webhook URL, how do i get the "server ip"?
where is your bot hosted?
your server's URL
Discloud
its your bot's ip address on discloud then
you need to have your bot on a host that also provides you with an IPv4 or IPv6
what kind of access do you have? is that one of those pterodactyl panels?
probably
Ok, thanks
Wait
dont use regex then
or at least only use regex for the most predictable parts
then your host sucks
do you have any way to contact the admins of discloud? if so, ask them
Ok, thanks Tim
nice
or just make a separate web server
yep
mobile browser detection
that regex looks like it will break after a day in production
that's actually the official way of doing it
until navigator.userAgentData.mobile catches on at least
I also need to include tablets so...
lol
wait until i squeeze the browser window
lmao
i mean, what other use case would there be for detecting mobile devices besides screen sizing?
its not like browsers can access much of the device's OS
👉 https://www.vultr.com/legal/tos/
👉 https://old.reddit.com/r/selfhosted/comments/1bouuv7/warning_vultr_a_major_cloud_provider_is_now/
https://youtu.be/AddtrV6UFFs
👉 https://techcrunch.com/2024/03/05/roku-disables-tvs-and-streaming-devices-until-users-consent-to-forced-arbitration/
👉 https://www.techzine.eu/blogs/infrastructure/118134/vultr-merg...
that is fucked up
youre basically paying them to let them reproduce the things you host and make money off it
i see rossmann, i press like
same
What do people use for subscription services? Is it against tos to use a third party? Discord teams doesn't support my country.
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
Patreon is a popular one but I’ve found ko-fi has a wayyy simpler api and allows you to sell items/one off purchases and memberships
I really wish it did work for me.
Thanks. I'll probably be using node to interface if possible. Any suggestions?
I would prefer to automate it in the background.
I use ko-fi personally so that’s all I can speak on but it’s a simple webhook like with topgg for receiving votes
thanks. I'll roll with ko-fi. I hope they support Canada.
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

Just so you know you dont need to interact with the api yourself from what I recall
ko-fi has a discord integration
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 😭
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?
no way he's back
hey guys
does cloudflare support hosting websites(free version)
without any troubles as it have with dc bots
@quartz kindle sorry for the ping,but u will be able to tell better coz u know my situation
As long as it's a static site
enlighten me on what is a static site
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??
Blogs
A lot of websites are static
can someone give examples of static site and dynamic site
amazon must be dynamic right?
blogs would be static?!
Discordjs.guide could all be made static
The search functionality would have to be implemented client side, but it could be static
give me some popular examples
that would help me understand better
yep so i cant really make a top level website without dynamic
What do you need that's dynamic?
i can't store informations
Ah
You're likely going to have to pay for what you want.
If you don't want to have issues at least
hmmmm
so atleast i can make some projects right?!
mayb a portfolio one
to -do-list would be dynamic
So a lot of bot websites are static.
Like a description and invite button.
there are so many cons
u cant even do login system
If you want a login system you really really shouldn't use free services
sed
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
so for now,i wont have issues with a portfolio website with cloudflare?
You should have no issues
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
hmm ok thanks
static = html+css+js
dynamic = has a backend behind, ie nodejs, python, php, .net, etc
you can use cloudflare pages for static and cloudflare workers for backend
up to the specified limits, yes
its never been unsafe if you install from package managers
Okay thanks!
ok thanks
the malware was never uploaded to pip/pypi
pypi has tightened its security by 2024 by deprecating password auth and enforcing 2fa 
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
this is why i never make complex types in typescript
you focus more on types than actual code
check kotoba repo in top.gg
🗺️ Re-organize your translations into multiple files and turn them into typescript declarations - top-gg/kotoba
we do something similar to type i18n
i managed to simplify it to a single template at least
Lol<K>
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
That kinda makes sense
it does, im just dumdum
pretty sure there is no split type so cant expect split to understand
ye
would have to cast which isnt the hugest deal
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
i’m still having trouble understanding how to set up better sqlite3 for discord.js v13
what are you not understanding?
The same you would for any structure
can you send me the resource again? so i can look at it again
like, the library docs?
or you mean the SQL language in general?
i have no knowledge in sqlite, query language or anything lol
i want to have a database connected to my bot so i can have like a server currency, level system, leaderboards, stuff like that
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]?
sqlite has two parts:
- the wrapper library, written in js (better-sqlite3)
- the SQL language, which is what you use to run commands inside sqlite
it should impact a bit ye
for of invokes the iterator functions
with a for i youre basically doing 2 statements for 1 thing
javascript has iterators?
