#development
1 messages ยท Page 148 of 1
side note i was going to get contabo but i hate the fact they just add on random fees when youre just about to check out
You mean the setup fees?
contabo network is slow
DigitalOcean and Hetzner my beloved
hetzner actually looks really good
might switch from galaxy gate
hetzner swag
thats arm though
wont that cause compatibility issues?
last time i checked arm and x86 are completely different instruction sets
shit ton of registers too
or cores dont remember
dont think so, apt and so on handles it themselves
unless you're literally coding discord bots in assembly
hope so lol
might get it then
at one point i actually had an interview with arm but i turned it down
wild
You should use https://nvm.sh/
It'll setup both Node.js and npm for you and you can even manage multiple versions of them, run nvm install --lts to install the latest LTS release, or nvm install to install the latest non-LTS release (not recommended for production use)
nevermind
actually not sure if i can use arm
i have a c++ application that i need to run and its designed for x86
idk if i can compile it for arm/port it
actually should be able to
since its just linux so the system calls arent affected
Guys Ill verification my bot but I dont understand Presence Intent? Whats that?
https://gist.github.com/advaith1/e69bcc1cdd6d0087322734451f15aa2f
Guild Presences (Presence Intent) is used for getting member presences, which includes:
"Playing"/"Streaming"/"Watching"/"Competing" activities
Custom Status
User status: online, idle, dnd, or offline
What fees?
only fee they charge is a setup fee
and they do a lot of events where they just negate it anyway
I got mine when they charged 0 for setup
its like 6$
hey has anyone used cloudflare?
to host their static site
Im basically having this huge issue with dumb cloudflare adding a trailing slash at the end of all my urls causing major SEO problems,
you mean pages?
page rules, dunno why you're getting that issue tho
i tried everything, i tried using _redirects and some page rules but when i do that it sits in an infinite redirect loop
yeah its fkin weird, it keeps adding annoying "/" at the end like this https://genprose.com/blogs/convert-audio-to-content-with-genprose/
if i remove the slash manually in browser it again redirects it to the url with a slash
any idea?, i checked their forums and i see a lot of bugs reported on this issue. and no workaround
This is why I don't use cloudflare for static webpages
I just use a vps with nginx and have cloudflare's dns point to it
mm, its just so dumb why would they even do that
but im sure there are people who have solved this
Sorry for the second batch of links i mean to have www in it: https://booqnly.com/ โ https://www.booqnly.com/
this might help
There are numerous amounts of people who all have this problem on cloudflare's community forum
yeah I went through all of them, none of them are useful to me
ye im adding this exact rule
but it keeps crashing with redirect loop for some odd reason
fkin stupid this cloudflare
horrible
Wanna just use my vps?
I can make a nginx config for your site all you gotta do is have cloudflare point it to my server's ip
nah its okay, this is a company's website so cant use yours, i'll have to create one,
Ah
Well then I don't really know how to help beyond that as I dont use cloudflare pages
I can help you setup nginx though now that I know more about it myself
yeah its okay, i joined cloudflare discord server, lets see hopefully someone will help
hope so ๐ค
or maybe i find a workaround with astro highly not possible cause its only serving static content
They even fkin support this themself in the _redirects file, yet so buggy, jesus
https://developers.cloudflare.com/pages/platform/redirects/
They legit say this should work, fr
or your website is redirecting back to site/
nop, i ran the build myself locally
and there was no trailing "/" its coming from cloudflare
see, localhost serving from "dist" the build output dir, has no trailing slash
is it possible to send message on voting in top.gg with a bot
i want to send msg with bot
and add a role
You can listen for the vote webhooks tuff
I have a simple bot that on join, it creates 2 text channels. Now tho most of the time 'everyone' ,as the default permission on join, cant create channels
Error creating channels: DiscordAPIError: Missing Permissions
at RequestHandler.execute (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
{
method: 'post',
path: '/guilds/947687169647054869/channels',
code: 50013,
httpStatus: 403,
even thou the bot is invited with enough perms:
mainly this one
im trying not to 'admin' perms
coz that would work
but is there another way arounnd
I would use a /setup command and check for the permission there
Also don't think many would appreciate 2 channels being created on invite
Discord API been wild past hour
hi how do i fix this error, i finished coding my bot but it keeps giving me this error
the code you are using is incompatible with the version of discord.js you're using
meaning you're either using an outdated discord.js or following an outdated tutorial/guide
or you copied code designed for a different discord.js version than the one you're using
Discord api moment
No solution?
I have same errors so nothing wrong with your bot in my opinion

Oh okay thanks beb.
im using the updated one
14.10.0
No problem 
then your code is outdated
the guide you used or the code you copied is outdated
oh
how do i import my project to github im trying to change it from replit to glitch.com
that wont fix the issue
also pretty sure glitch.com does not allow bot hosting
unless you use the paid plan
fr
Hi
Yo
Yo
is it possible to make a button (messagecomponent) go to a link?
That's probably the only option
I mean, the button is made for that
Ah alright thank you
Trying my luck again
does deleting messages create an audit entry?
check the audit logs to see if they're there
Deleting OTHER peopleโs messages counts. Deleting your own does not
Keep in mind that if you wanted to track deleted messages, you would use the messageDelete event
iirc messages deleted by bots dont show up either?
doesnt matter if own or another users messages
Yeah they donโt
Is there anyway to post a custom audit log?
nope
how do scheduled events work when created via the api? When i create a Discord event through the UI it forces me to be in the channel until the event is over. do bot scheduled events not create a voice channel?
https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
yeah discord audit logs have tons of restrictions
deleted by bots dont show up, deleted by the author themselves dont show up,etc
you have to use messageDelete and make an educated guess
this is most fun when you're trying to make delete logs

oh they dont even include the message id so you cant be sure an audit entry actually belongs to the message lmfao
not sure if that changed though
it hasnt
Ur bot won't be able to log it again if it stacks, meaning if 2 messages were deleted in general and it stacked in logs, only 1 would show
I was messing with it and was confused why it only logged once
audit logs come with ids though
so the way I've tried to do it was:
- Keep a list of already processed audit logs
- check if that id is already processed, if it is, check if a new message was added to it (if a message audit log)
- fetch the user who has done said audit log (aka the moderator)
and shit still doesnt work
so i gave up
audit logs are also quite delayed ๐
its advised to wait half a second or something before querying audit logs for messages
There is an audit log event though
Which afaik also passes stuff like msg content
I would cache msg on delete, on audit log event find that message in cache
Same with ban events
Instead of scraping audits which 1. Isnโt accurate and 2. Is not advised
Nope
As if discord gives luxury like that
This sounds reasonable actually
โ ๏ธ
Watch them introduce audit logs that have everything user-related stripped
Fun times
Fr
{
status: 400,
statusText: 'Bad Request',
guild_id: '-------------', // removed
data: {
name: 'test title',
description: '**Description:** \n' +
'test desc\n' +
'Tournament starts in <t:1688945497:R> at <t:1688945497:t>',
privacy_level: 2,
scheduled_start_time: '2023-07-09T23:31:37.641Z',
scheduled_end_time: '2023-07-09T23:41:37.641Z',
entity_type: 3
}
}
{"code": 50035, "message": "Invalid Form Body", "errors": {"entity_metadata": {"location": {"_errors": [{"code": "BASE_TYPE_REQUIRED", "message": "This field is required"}]}}}}
any idea why i get this error with the above request?
https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
i need entity_metadata
now i'm getting a permission error even though i invited the bot with create event permissions.
{"message": "Missing Permissions", "code": 50013}
is create events even a real permission? it's not showing up under role permission at all
const response = await fetch(`${URLS.api}/webhooks/${application_id}/${token}/messages/${message_id}`, {
method: 'patch',
body: JSON.stringify({"content":"Test!"}),
headers: {'Content-Type': 'application/json'}
});
why would this give me a 400 error?
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
the message_id comes from the ${URLS.api}/webhooks/${application_id}/${token} post request
does anyone know why this is?
[ERROR] TypeError: Cannot read properties of undefined (reading 'cache')
This happened I guess because I wanted to get the channel error logs but before that this was normal
well that means you tried reading "cache" likely <something>.cache and it was undefined.
yes but before that it was running normally, when the bot was on suddenly like that.
I mean when it is turned on normally just a few hours or days it will be like that.
if it's a normal error I'll ignore it but it interferes with the bot process the bot will automatically shut down
If you know which line of code it comes from I'm sure that'll lead to answers aswell if posted here. I'm not exactly the person to assist with it as I've been slacking on the discord development side for a bit.
do you have autoupdating dependencies in package.json?
i have
maybe the version of discord.js updated on you
I still use discord.js@12.5.3
i have done the voting but it doesnot say to mission
Ok
ugh, i hate container orchestration
Kubernetes + Postgres + Rust + Redis
all together painful
why am i getting a cloudflare error?
Can't blame them ngl, are you on djs v500 already? 
i wish
is this endpoint just broken? i am deferring the webhook initially, then i followup. the part that is failing is when i try to edit the followup message
i think discord.js@12.5.3 better then 14.11.0
Not really because it misses out lot features
discord.js@12.5.3 is simpler than 14.11.0
For me discord.js@12.5.3 is pretty good compared to v14 which is very complicated
V12 is unsupported
Youโd need to upgrade to v14 to get slash commands xD
V13 has them as well
True but if you are going to upgrade you may just as well go to the newest version 
please do not suggest this
that is an awful idea
Ikr
Why limit yourself to a shitty interface that's unpredictable? Just use the raw api and build your own interface
Years of discord.js, but many major breaking changes involving rewrites
why am I getting this error? my code hasnt changed at all for that in the last week and it worked fine like 2 days ago
Im doing this
(from the discord-oauth2 npm package)
is it a valid refresh token
yes, it can if the user revokes the oauth application
Can I somehow know when the user revokes the app? Like a webhook
Except with just catching errors
I donโt think discord notifies you
In any way
Youโre kinda just left hanging on that iirc
You sure?
an API that gives you API ideas
an api that gives you no context of steve
Cats!
Ai generated animals
I'd not say no to yet another animal http status api
now that capy is down it only remains cats and dogs
the VPS died 
i dont think i have a copy anymore
also the domain expired, but porkbun is funny
usually, expired domains change nameservers to Porkbuns, but for some reason the domain is expired and has been renewed (auto by porkbun) for another year, and the nameservers are still mine
what even is version control amiright
this was just a folder of images
and it used a shit vps which i stopped paying for when its network kept dying
could the reason for buttons having 500ms delays be that I have 50 active react hooks on the page?
maybe

well, makes sense. what should be the max?
no idea 
copy http://endless.horse
I just want to reach the end
Me too
there you have it
it rlly goes on forever doesnt it
i should make something like setup a local stable diffusion instance and have it generate a custom image of my choosing on any topic every time someone visits
it would have to run on my pc though i cant imagine vps instances with good gpus are very cheap ๐
providers absolutely love to overcharge for relatively basic features
i want to make a npm stat card, any way i can get my user info from npm like username and pfp and all the packages i have, downloads if possible
check the npm api
if you are talking about api-npm it doesn't provide user info, and i cant find npm api's docs ๐
then have fun web scraping
it doesn't have definite classes so should be way too hard, but still imma try, thanks!
The npm cli has to do it somehow and I doubt they'd use web scraping
but lol I scrape just about everything
spotify, deezer, wafflehouse.gov, you name it

Love when I can't connect to my own vps for some reason
๐
connection keeps getting refused
Did u lock urself outside?
Like, did u mess with ufw?
Lmao
I can just VNC into it and do it that way
all I gotta do is open the ssh port
I think its 109
Actually wait
isnt ssh on 22?
it doesn't delete any files right?
Nope, there's a reserved partition for it
bet
Sda2 or smth
See their tutorial on how to find your files, as you'll be in another partition
The files are in sda1
ic
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
someKey
Please contact your system administrator.
Add correct host key in C:\\Users\\dyeaaronjr/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\dyeaaronjr/.ssh/known_hosts:1
ECDSA host key for 154.53.57.218 has changed and you have requested strict checking.
Host key verification failed.```
gotta love this
๐ฉ
Locking ssh is something everyone eventually does on mistake
Good thing most hosts are expecting it
we do a little ssh trolling
Why the fuck is it telling me my password is incorrect
tf did the system rescue do
did it delete my user entirely?
Try root login
root login worked
yea it completely removed my fucking user
fair enough
It didn't, ur logging in through another OS
It's like installing windows in dual boot, the users won't be the same on both sides
How is this useful?


that sounds like a pain in the ass
whats ufw 
At this point ima just re-install the entire vps
Ur currently in sda2, so first thing u need to do is mount sda1
linux firewall cmd line tool thingy
To access the original files
bascially allows you to manage the firewall rules easily
uncomplicated firewall
but looking at the convo it looks more complicated 
Only thing in the file thats in there is this
looks like "locking the door and throwing the key away" to me
no idea how to mount man Im a linux noob
it basiclly is
I accidentally reset all firewall rules


nice 
Many of you have already heard about it or even used it once in a while, but most of you have probably not been introduced to it yet: Our rescue system! While hopefully not being needed at all, it provides many possibilities to fix certain problems and to bring the machine back online as soon โฆ System Rescue CD: First Steps Read More ยป
Forgor to fix my mistake
Just follow that guide, it's not very complicated
Ah the main partition is the one called sda2
nice
im just reinstalling the OS
cant be asked to fuck with this shit
Lmao but it was a good opportunity to learn it
it was but I dont know what im doing
it already has an ssh port
System recovery doesn't change any files, it just installs a minimal OS into another partition so u can access the files again
Then you could've tried restarting it
I did try rebooting it
Or just deleting ufw from bin
and then it wouldn't even allow me to connect from 22
So im just reinstalling the OS and calling it a day
Eh
I'd rather re-setup everything then deal with the bs of ufw
Did u pick the nginx config file?
I should have a backup of my nginx and mailcow stuff on my pc somewhere
if not then 
I know how to do it now so its not a big deal and it'll give me practice if I did end up not backing up the latest
One message removed from a suspended account.
One message removed from a suspended account.
Can a StringSelectMenu have it's value "selected" when built? Or does it have to reset on every edit?
Okay so I am only slightly going insane 
I am following a tutorial for Next.js 13 (because I am dumb and watch tutorials, cry), and while trying to create a "blog" of sorts, I am getting a 404 error when I try to open a specific post.
The API endpoint is just fine, all the content is there when I fetch the data from the API (i.e going to http://localhost:3000/api/posts/somerandomidhere), but when I try to "open a post" (via the blogs route) it's giving me a 404 (i.e http://localhost:3000/blog/somerandomidhere)...
I have my source code below... And any help is appreciated
Thanks in advance!
https://srcshare.io/64acf46f5a4f12298cd1a5b6 <-- Src code
Easily share your source code with other developers.
yes
what does the fixed keyword do

i dm'd u
Hey everyone! I'm not sure if this is the right channel as its more of a statistics question, so feel free to point me in the right direction if so.
I'm curious to know if its possible to find out what the average server count is for bots? I know some are in 10k plus servers and some are in 100 so it would probably skew, and then there is also the fact that there are different categories of functions (e.g., moderation, information, games).
Its certainly not a straightforward question to answer but I am interested to know if anyone has tried to tackle this at all and, if so, how far they got?
https://dblstatistics.com/rankings/totalvotes
made possible by @delicate zephyr
It has an api, not sure if u can take the entire servercount of the bots and make a summary
View the historical performance of up to 39384 bots listed on Discord Bot List (top.gg). Updates hourly.
ofc this is for the bots listed on top.gg
most of them are tho
I can probably do a db fetch and get the average for you
probably better you join the support server though, be easier for me to post it there than here (since this channel is fairly active)
Very cool! Thank you both! I shall have a read and a dabble ๐ ๐
will top gg have an autovote feature for premium?
but disboard did it? im still supporting by voting and paying for auto vote is also supporting
but like
the point of voting is you supporting the bot and by autovoting you are only voting for the bot
also it just seems wrong
not a good feature to add
not me personally but i understand ur POV
disboard doesn't have autovote, it has autobump
they're quite different in purpose
๐
anybody got a good npm package or function to return the next x dates of a cron expression?
why do u need a package for that?
just split by space and add to new Date()
first value is seconds, then minutes, then hours
js ecosystem encouraging developers to use packages for every little problem instead of writing a solution in one line
I used to be in that trap so I had a shit ton of god forbidden npm packages ๐
that did one thing
it's a canon event I suppose
Wdym there's no way the ecosystem can function without things like https://www.npmjs.com/package/true and https://www.npmjs.com/package/false /j
best package https://www.npmjs.com/package/undefined
fixes the annoying "cant read x of undefined" problem
bro really defined undefined
Best package fr fr
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i think the webhook patch endpoint is broken. it's not my fault
${URLS.api}/webhooks/${application_id}/${token}/messages/${message_id}
lol
@proven lantern i would check every variable that is used i guess
i have no idea other than that
what's that last message_id for?
that's only for getting/editing/deleting
if you want to post a followup to the original message, use ${URLS.api}/webhooks/${application_id}/${token}
it's the colorscheme
i get the message_id from the followup post response i do on line 75. then i try to patch that followup on line 131, but ut fails
i want to help you but i honestly cant
i think discord is broken or doesn't support what i'm doing for some reason
no way i could be making a mistake
what error are u getting again?
this is the error text
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
i will check now
https://discord.com/api/v10/webhooks/[BOT_ID_HERE]/[INTERACTION_TOKEN_HERE]/messages/[MESSAGE_ID_HERE]
looks good for https
yup
what are u trying to do, again?
send a message or edit it?
edit an interaction response
this is the original response code
i save the message_id from that
and then try to patch and it fails
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
isn't this a weird error though'?
yup
usually it's json
i can delete the interaction response using the delete method, but patch always gives me that generic 400 error
https://discord.com/developers/docs/resources/webhook#delete-webhook-message
so it narrows to likely JSON body
this is failing too
I would try treating it as a dict and stringifying it
you also need bot auth iirc for interaction response editing
I think there is already that
Would be in the headers so no
i'll give that a try
why user-agent header? i dont see that in the docs here.
https://discord.com/developers/docs/resources/webhook#edit-webhook-message
yup
the bot token header didn't fix it. still getting a 400 html error
posting it without the user agent is already there
that's what would I try
You absolutely need to have a good base and all of the actual route docs should be built on top of the base
Alternatively, I've done all of the hard work for people in a low level wrapper called snowtransfer. (Discord REST is really hard) you can either use as reference (MIT) or just install it
like this?
here's the edit webhook message code
maybe i need to do multipart data
i did try that a bunch already
Have you looked at the request handler request method
multipart is only required for files
multipart shouldnt be used unless files are present
Then I'd just install an already existing library
Before you claim that, I'd try another library
i haven't used a library yet
snowtransfer or some other rest only lib is good
ok, i'll try it out and see if it has the same issue
What is the proxy icon url of a discord icon?
the main url is through cdn.discordapp.net
the proxy url is media.discordapp.net iirc
oh ok. Are you familiar enough with the JDA discord api library in Java to tell me how to get that proxyUrl from the User interface?
Why do you need the proxy url specifically
I'm trying to create an AuthorInfo object to use in a MessageEmbed
The proxy url is optional
beauty, ty
your library worked and i found out what the problem was!!!!
thanks!!!!
discord made a mistake imo
What was the issue
Yeah. global.fetch/undici doesn't do that for you for patch only
all other methods are fine
Don't ask why
follw-up question, what about the discord user url? Is that the same as the avatar url?
i blame Voltrex
wdym user url?
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
?
I mean, I guess so. There's a setAuthor() method that takes as parameters (userName, userUrl, iconUrl)
It can be any link
as defined by the Javadoc
url โ the url of the author of the embed
iconUrl โ the url of the icon for the author```
https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
Looks like that was recently added
Would be to make the author text clickable
you can extend MessageEmbed instead, I highly don't recommend passing a custom class to it as a param
lol I'll just send them to google
I use this to link reddit profiles
using builders is cringe
The AuthorInfo object is in the JDA package itself. I didn't create it. but I've realized I mistakenly thought it was used to add an author to a MessageEmbed. Now i'm just creating it using a different method.
If it's optional I'll just leave it out. I was under the impression that was something provided by the Discord API somewhere and could be added easily. but if it's something I'd need to manually provide I'll just omit it
ty guys
to add an author simply use setAuthor
ur supposed to use the builder for embeds, not the constructor
Yes, that's the method i'm currently using. That's the one that has the method options listed in one of my previous comments. Not trying to be rude ๐ I appreciate your help. The message is linked here: #development message
My curiosity was about the url parameter being linked to a discord user
I couldn't find a method in the User interface that provided such a url.
It sounds like I'd have to manually create one or something similar. If you know of another place I could get that url though that would be super helpful ๐ otherwise I'll just keep it null.
going by the documentation, proxyUrl is the cdn url
I'm not familiar with the cdn url. Where did you see the documentation?
like, instead of making a request to discord, getting the url from cloudflare
in the library
yes, the javadoc
however
it's likely not used for anything
here the actual usage for it
I see that method's name is for an icon, what about the user url? Or am I just mistaking the 2nd parameter of setAuthor()
public EmbedBuilder setAuthor(@Nullable String name, @Nullable String url, @Nullable String iconUrl)
url โ the url of the author of the embed
iconUrl โ the url of the icon for the author```
the second param is the redirect url when someone clicks the icon
don't bother with it
cool cool. I assume that url isn't provided by the Discord API anywhere?
i forgot to ask why?
I said don't ask why
it's not really related to them
like, if I wanted to redirect you to google when u pressed on the author avatar
as I said, just ignore it unless you have an actual use
if u dont define an iconurl, the url will be the iconurl
ok cool. ty for the help
yw
is it possible to see if a specific user id has left a review for the bot?
When you receive an interactionCreate event, how do you tell if the interaction is a subcommand or a normal command?
You cannot receive an interaction for a subcommand directly. the command name will be the root name and the options will include the subcommand
And I assume that subcommand groups cannot have the same name as a normal command
Why would that be the case?
if it has options that are subcommands, you need to process those
I mean that it wouldn't make much sense to allow a subcommand group to be named like permissions and then also have a command named permissions
it's still allowed regardless
is it?
nope you can totally do that lol
well that kinda sucks for processing
Sub command groups are children of commands and have no direct relation to the commands themselves
Where I define the commands
basically I'm trying to route commands to the correct method when I receive an interaction
Yes. Sub commands are just options of root commands
the interaction should still be routed to the main command it's under
oh?
it wouldn't be hard to check if the first option has type 1/2 and if it's a group, iterate through that option's options
You can use multiple sub commands at the same time
trying to do separate logic is a fallacy
wait really?
wait wtf that's annoying
how do u do that in the client I suppose I misunderstood
nvm I lied. I thought you could
yeah I was gonna say that doesn't make much sense
mb
It would be similar to the way you do multiple options
they're not in any particular order
and don't need to be linked to other options
Like what I do here
https://github.com/AmandaDiscord/Amanda/blob/restart/packages/runtime-website/src/music/music.ts#L218
this was my general idea
this is similar to how detritus worked, I'm kind of trying to recreate it in djs since detritus is no longer actively maintained
rip in pepperoni
Sub commands could technically be re-routed, you'd just have to check if the command has sub commands and if the sub command option is present and if there's a handler
const sub = interaction.options.filter(o => o.name === "subcommandname")
if (sub) reroutetohandler(sub)
something like that
idk if DJS indexes command options like I do in a Map
because having to filter every time is dumb af
I would imagine they do since they have a get method for options
Yeah I'm beginning to understand the appeal after working with djs
then you can use getSubcommand and getSubcommandGroup to verify they're the right type
djs has a method for getSubcommand() on the options prop, but annoyingly enough if there's no subcommand it throws an error
feels like it would be wrong to use a try catch for that sort of logic
provide false as first parameter to suppress the error
Simply make your own lib with your own handler

Then you dont have to deal with the idiocy that is djs
There are plenty of good libs to make it happen for js.
A little sad that ditritus isn't being maintained anymore. They were the main people I was going up against with my npm libs
Apparently using yarn makes it so discord.js can't be found 
discord lib is a lot of work
It is
which is why I opted to use discord.js for my current project cause I don't wanna deal with the voice gateway
esp since discord loves to push breaking changes to their apis often so you don't even know if it'll keep working
have they still not done that
nope
I swear vcs are a big part of bots now
just found out that its technically against the tos to receive voice data and use it but i've been told I won't get in trouble so 
only reason its considered against the tos cause they say you can't use any undocumented features
but I'd imagine it's similar to how it's done with the normal user account api so you'd have to analyse the network tab on how they do it
probably an opus stream or something knowing discord
there are plenty verified bots which record vcs lmao so it's fine I suppose
https://github.com/discordjs/voice/releases/tag/v0.6.0 you would be correct
lol
its just an opus stream that I can convert to a mp3 file somehow
Thats the thing I can't figure out
not good with audio stuff

true
(async () => {
const files = await this._getFiles(commandsDirectory, true)
for(const file of files) {
if(!file.endsWith('ts') || !file.endsWith('js')) continue;
const commandPath = resolve(commandsDirectory, file);
try {
let importedCommand = new (require(commandPath).default)
if(importedCommand instanceof Command){
this.commands.set(importedCommand.name, importedCommand);
}
} catch (err: any) {
throw new Error(err)
}
}
})()
@radiant kraken how well do you think this will work 
looks good to me
tho why use async
there are synchronous fs methods
Cause I have no idea how to use those
so
don't really feel like converting my old code to use those synchronous methods
although I probably should
๐ฉ
Not really

const commandsDirectory = resolve(join(__dirname, '../', '../', 'commands'));
const files = this._getFiles(commandsDirectory, true)
for(const file of files) {
console.log(file)
if(!file.endsWith('.ts') || !file.endsWith('.js')) continue;
const commandPath = resolve(commandsDirectory, file);
try {
let importedCommand = new (require(commandPath).default)
console.log(importedCommand instanceof Command)
if(importedCommand instanceof Command) {
this.commands.set(importedCommand.name, importedCommand);
}
} catch (err: any) {
throw new Error(err)
}
}
I am obviously doing something wrong because its not populating the commands collection
๐
does it log
fixed the issue
it was my if statement for checking if the file ends with .ts or .js
now I have a new issue thats related to yarn itself
๐
yaaaaaarn
I like using yarn
but currently hate it
Error: Error: Your application tried to access src, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound. this seems to be a yarn error but I don't quite know
all google searches result to it being a yarn error
yea wtf is going on with yarn
I can't even require my own folders/files
๐
Actually bout to make me give up on this shit can't be asked to swap to npm
pretty sure thats what yarn does
it also manages your project
not just your packages
Yea but like
how tf do I solve this
Cause I have to require command files to load them
๐ฉ
can't be asked to swap to npm
Why?
last time i tried using anything thats not npm it just caused more issues than it solved
^
well I swapped to npm but now im even more confused
why not use pnpm
/home/aaron/conference/src/core/structure/ConferenceClient.ts:40
throw new Error(err)
^
Error: Error: Cannot find module 'src/core'
Require stack:
- /home/aaron/conference/src/commands/public/PublicGroup.ts
- /home/aaron/conference/src/core/structure/ConferenceClient.ts
- /home/aaron/conference/src/core/structure/index.ts
- /home/aaron/conference/src/core/index.ts
- /home/aaron/conference/src/index.ts
at new ConferenceClient (/home/aaron/conference/src/core/structure/ConferenceClient.ts:40:23)
at Object.<anonymous> (/home/aaron/conference/src/index.ts:5:16)
at Module._compile (node:internal/modules/cjs/loader:1233:14)
at Module.m._compile (/home/aaron/conference/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
at Object.require.extensions.<computed> [as .ts] (/home/aaron/conference/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Function.Module._load (node:internal/modules/cjs/loader:938:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at phase4 (/home/aaron/conference/node_modules/ts-node/src/bin.ts:649:14)
this makes no sense.
I am not even requiring src/core
I am requiring commandPath which is /home/aaron/conference/src/commands/public/PublicGroup.ts
Show us the contents of your ConferenceClient.ts file
Try logging the files variable
[ 'public/PublicGroup.ts' ]
What's the contents of that file?
It means the server link to a Discord server that provides support/assistance to the bot's users, basically a Discord server dedicated to the bot
You're welcome
import { Command } from "src/core";
import { SlashCommand } from "src/core/decorators/SlashCommand";
@SlashCommand({
name: 'public',
description: '',
options: []
})
export default class PublicGroup extends Command {
}
The first line, ring any bells?
According to this error, there's no file called src/core
๐
You're basically importing a directory
yea I figured that out just now aha
Although I am curious why my class decorator isn't doing anything
I am most definitely doing something wrong
Which actually resolves to index.js if it exists, though I think you have an incorrect path, you probably want to jump back a directory?
Opaa
Auto imports be messing things up as usual
@SlashCommand({
name: 'public',
description: '',
options: []
})
export default class PublicGroup extends Command {
}
now it seems the decorator isn't actually doing anything sadly
๐
I really dont understand decorators
dont use npm, use bun's blazingly fast package manager!!!!! ๐๐ช๐ฅ
import { ISlashCommandMetadata } from '../'
export function SlashCommand(metadata: ISlashCommandMetadata) {
return function (constructor: Function) {
for(const [key, value] of Object.entries(metadata)){
constructor.prototype[key] = value
}
}
}
this definitely isn't the way to do it aha
Nah, switch to Rust and use its blazingly fast and safe package manager Cargo!!!!! ๐ฅ๐ฅ๐ฅ
rare voltrex W ๐๐
or just code your own package manager and make it even more blazingly fast
just hire tim
he can make anything more performant
congratulations, you are now a true Rustacean!!!!

i don't know it enough
i don't know it enough either
look at this basic rust i wrote
https://github.com/null8626/decancer/blob/main/core/src/codepoints.rs
nice
I dont see how this is helpful in terms of class decorators
introducing: Angular

Im just trying to make my own class decorators ๐ฉ
ngl angular looks promising
but its a bit overkill
Collection(1) [Map] {
'' => PublicGroup {
name: '',
description: '',
type: 3,
nsfw: false,
options: []
}
}
I don't understand why the name is empty
the decorator clearly states that the name should be public
and I am adding onto the constructor prototype like everyone else does
Command { name: 'public' }
Command { name: 'public', description: '' }
true
Collection(1) [Map] {
'' => PublicGroup {
name: '',
description: '',
type: 3,
nsfw: false,
options: []
}
}
I see its not actually being assigned to the PublicGroup class
its being assigned to the Command class
Hoho
@lavish fern test
?
Oh thanks for knowing me about that
no problem
Quick q for fellow devs
how many of you have monetized your discord bots? And how's your experience been
I'm thinking of using Patreon just not sure if ppl will subscribe
if u plan to give rewards for donations, patreon is the worst option
their api is just too bad to work with
i've been using patreon for about 3 years now
but i dont use their api
i do everything manually
i will eventually move into something else in the future tho
They haven't rolled out Discord bot premium yet, it's currently in closed alpha. Once they do (if lol), then its better to do that without going anywhere external
im planning on going full business mode with a dashboard and a payment gateway for subscriptions
but im more worried about the business side, if people will actually pay
so far my bot is on 250 servers and no patreon subs yet for premium features
on average you will have 1 paying user for every 1-5k users
users are probably more likely to use discords built in feature.
1-5k users you mean users as server owners, or regular members?
regular members, if you offer user-based premium
if its guild-wide premium, then its different
it's guild-wide premium, for more commands & customizations for server owners
maybe I should think about user premium
well, i guess you can expect around 1 paying guild for every 1k guilds
well, it depends a lot on the quality of your features
and how much people desire them
my bot is on 10k guilds, im getting like 25 bucks a month from patreon
@quartz kindle Are you advertising on top.gg? That's where most of my bot growth has been
but I think those might be low-quality users, hence not paying as often
i dont pay for ads no, but i do have a bot page there
im not really interested in growing my bot at the moment tho
i have so much other things to do that i dont have time to manage my bot
so i rather it stays as it is
@quartz kindle I see, thanks. So it seems like a discord bot is not a very viable business
it's not a reliable business, but u can make money off it
just don't hold your breath for it
if you want to make a living with a discord bot, you need well over 100k guilds
premium bot subscriptions should make it easier once they release that
@solemn latch
thanks, I really want to dm them now
yw ๐
why did you delete it!!!!
took me long enough to figure out that i couldn't log into postgres via the normal cmd
You are a direct third-party you never know what's gonna happen next, and they have full power to change it
Lots of the bots are being replaced with what discord is implementing in discord
such as timeouts
is there a reason that setTimeout returns an object in nodejs? is there a way to serialize the object and save to a DB and then deserializing it later and call clearInterval?
๐ I'm not sure if this is helpful.
Looks like clearTimeout can take a number
https://nodejs.org/docs/latest-v20.x/api/timers.html#cleartimeouttimeout
Getting the number for the timer
https://nodejs.org/docs/latest-v20.x/api/timers.html#timeoutsymboltoprimitive
anyone know of a free API to access real-time stock data? all of the options I've found suck ass for information that I would figure would be easily accessible to everyone
This looks like it has a lot of info.
https://www.alphavantage.co/
Alpha Vantage offers free stock APIs in JSON and CSV formats for realtime and historical stock market data, forex, commodity, cryptocurrency feeds and over 50 technical indicators. Global market news API and sentiment scores powered by AI and machine learning. Supports intraday, daily, weekly, and monthly quotes and technical analysis with chart...
I got suggested Oanda
I think I'll go with oanda because this api above has a ratelimit of 5 requests per minute and 500 per day
Whereas oanda has 120 req/second
welp turns out I can't use oanda because they only do forex and crypto, not real stocks
What are you looking for specifically? Just overall stocks?
Yeah, standard stock market data (preferably live data)
All of the APIs I've seen have some really shitty ratelimit
Either that or they're not free
I don't see why it's so hard to obtain public information like this
Make your own api
You could even offer it to others and charge a price for higher limits 
I can't make my own api without the actual data, I literally cannot find any api that doesn't have shitty ratelimits or doesn't cost 10 trillion dollars
Is this not publicly available information? Come on man
It might not be as public as it seems, yeah it can be found easily but the stock market is made of a lot of different 'exchanges' each one charges their own fees for access to their data.
Just the new york stock exchange charges thousands for basic access.
https://www.nyse.com/publicdocs/nyse/data/NYSE_Market_Data_Pricing.pdf
wow that is absolutely ridiculous
They are a company, so I guess its not that insane.
yippie guess my idea is dead now
what a giant waste of time
you would think that there would be some sort of api out there with a half decent free plan
most of them have limits of 250-500 requests per day which is absolute garbage
were you trying to make a stock bot?
Would 300/10s 2000/10m 50,000/d work?
When using the REST API for Time-Series, the following rate limits apply: Users who are not appending any API key to their Time-Series or Tables API call (ie. โanonymous usersโ) have a combined limit of 20 calls per 10 minutes and 50 calls per day. These limits are applied globally to all anonymous ...
Not sure if its real time however
it seems to have a real time api endpoint tho idk if falls under the same rate limits and or is accessible without paying
unfortunately this is only for access to their data tables
the real time data requires you to "contact a sales representative" aka 10 billion dollar fee
tf is Visual C++
same as C++
bout to say
im about to just use Visual Studio for game development, jetbrains is wonky with Unreal
man this is just capitalist inception, monetizing access to stock data
welcome to america
surprised you're surprised
@wheat mesa I have a bot idea if you wanna do it, I was going to do it myself but I lost motivation already

๐
I can dm it to ya
sure
When responding to a ModalInteractionEvent that originated from a ButtonInteractionEvent in the JDA library, should the deferReply() or deferEdit() method be used to defer?
And then when responding, Will it be just a reply() or a getHook().sendMessage()?
Depends on what you'll be doing
Reply is for when you plan to send a message, edit for when you plan to edit the message
It's also worth to note that there's a time limit to use reply()
What is the maximum amount of options you can put in a select menu?
25
console.log(statusEffects.get(victim));
console.log(statusEffects.get(victim).push({ effect: "sleep", turns: 3, startTurn: 1 }));
Anyone knows why this is happening???
I push to an array and it converts it into a number?
The %Array.prototype.push()% method returns a number
yeah I just found that out aswell
how can i fix this nextjs issue? ive checked on multiple different sources and cant find the solution
and i cant even figure out what file or line is affecting this
Hydration issues happen when things differ between the server render and the client render.
For example if you have a date/time rendered that time might be different for the server and client.
Things like jsx errors can cause it, or time could render different on the server.
It can be hard to find what causes it, typically the browser console is your best option.
Ah, I see
hmm, i can see the error but theres no way for me to find out which <a> tag lmao
๐ thats something I've never seen
Typically any IDE would be screaming about that
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Share your issue and someone who knows something about it will probably help you
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.
๐ง there you go
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
that should only happen if you salt the hash
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
did you just rubberduck in this chat?
One message removed from a suspended account.
One message removed from a suspended account.
you can combine some hashes with a random value known as a salt so that the resulting hash is different but can still be compared
not sure if that's what you're doing
One message removed from a suspended account.
One message removed from a suspended account.
@wheat mesa gotta love some backus-naur
Damn
need to learn how to work with ASTs to be able to parse my card formulas into readable descriptions
LAST
TRUE
xwass smells
better than u
what is ast
Abstract syntax tree
know what, I can get used to this
but I think I confused ast with parser tree
the latter is what I technically need
Itโs the same thing
ah, some people in SO were like "ast and parser tree are different yada yada"
what would be a good way to visualize a tournament bracket using discord embeds?
i guess the whole thing doesn't need to be shown like this. it could just show the current matches and wait until all matches have been recorded, then show the next set of matches until the tournament is over
image generated with canvas i guess
maybe for a summary of the tournament. i've never played with server side image generation
lambda should suport it though

Are you using dangerouslysethtml? ๐
dangerouslysetinnerhtml is a react thing
and like woo said has nothing to do with that image lol
https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
if i want to get every user that signed up for a scheduled event, would i call the Get Guild Scheduled Event Users endpoint and if i get back 100 users call it again with the after parameter being the last user until i get back less that 100 users?
i cant really test this, but it should work hopefully
i love how react made it as hard and verbose as possible to open yourself up to an xss attack lmao
Is there a way to like map a parent method?
eg.
class Parent {
public foo() {
return 2;
}
}
class Child1 extends Parent {
public foo() {
return Parent.foo() * 3;
}
}
class Child2 extends Parent {}
console.log(new Parent().foo()) // 2
console.log(new Child1().foo()) // 6
console.log(new Child2().foo()) // 2
because I have a parent class that has a method that runs a formula and in one of the child classes I want to double it
ah I asked good old gpt and apparently you use the super keyword
yea
I was just trying to figure out how it works in js

I wasn't sure if it was super().foo() or super.foo()
or if its done differently
yeah so It's like
class Parent {
public foo() {
return 2;
}
}
class Child1 extends Parent {
public foo() {
return super.foo() * 3;
}
}
class Child2 extends Parent {}
console.log(new Parent().foo()) // 2
console.log(new Child1().foo()) // 6
console.log(new Child2().foo()) // 2
but yeah thank you!
mmmmh don't think so actually


