#development
1 messages · Page 1929 of 1
dont
protocol will always either be http or https
Why not
bad
Reasons?
sounds like too much effort
i dont need reasons
also check any domain for non english characters
no you cant
well you can't click the link
you can have emojis too
but someone could still search for it
without the unicode
lol
thats assuming someone would even go that far to bypass a filter
such url would sabotage itself actually
It's quite easy and probs cheaper
u can if u use codepoints
A high level introduction to how multilingual web addresses work. It is aimed at content authors and general users who want to understand the basics without too many gory technical details.
I will just convert the string before running the regex on it
like, [a-Z] doesn't match letters from a to Z, it checks if the codepoint is between those two
emotes have an specific codepoint range
so u could match from the start to the end
@marble juniper straight up block any non english domain
then make it an option to disable
u could grab the site's metadata
it's the url itself rather than what the site has
devs who care abt their sites will put enough metadata on the head
like language, author, og:tag shit, etc
and do what with that
how do I check how much authenticity it has though
how do I measure that lol
also what if ur a development focused server
and someone shares their wip website
lol
I mean, make it a multi-step verification
first check metadata, then url, then something else
that way u reduce possible false-positives
about WHAT to check in metadata idk, there is probably some standard or convention regarding what u need to put on a site
I would probably check the url first
lol
and even then if I checked metadata
my bot is open source
you gotta remember that
anyone can see how I filter messages lol
tf a sweater
I don't really understand
you said you wanna make a sweater
you wanna make this?
Check url, web scrape it and find any malicious text
Click on some of those steam scams and etc
Take the content of that and try and filter against that
500mb used, bruh.
What does this command, do? curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
I did setup_17.
Downloads and installs nodejs 11 via bash not the package manager
While v11 is a little bit outdated 
That’s not nodejs fault
Obviously the JSON file is corrupted
op
Oh lol that’s what he’s wondering about
you're trying to access json data from a website
but the website is returning html data, not json
corrupted json file
its pretty corrupted considering its the wrong file type
json was a pretty good idea
i have
but
i still have no motivation, im just forcing myself.
or well, i dont know how to get motivation on what i already created.
Like updating/improving stuff you have made?
thanks, ill try
404 Motivation Not Found
anyone know if there's a way to fire an action upon my account being followed on tiktok?
you probably have to monitor your follower count regularly and check for changes
ooh that's actually not a bad idea, my idea would work better if I could get the username of a person when they follow, but I might be able to do without
they have webhooks, but i didnt see anything related to follows
yeah I've been looking online for a while and haven't gotten far
tiktok doesn't really want you using its data from what I remember
well that's unfortunate
I thought you pinged nom for programming help for a second
i mean i'm trying to get a file from a post request and save to a folder
if you have the buffer, literally just write the buffer using fs
if you have a stream, then you have to read it first, or you can also stream it directly to a file, also using fs
are you on js? if you're getting files from a post request chances are they're already being written to disk unless you're specifically choosing the in-memory option
does the built in http lib write to disk?
I have gone through every single js multipart form parsing library in this god forsaken earth. The only one that doesn't automatically try to write files to disk is multer and you have to specifically tell it not to do that
dafuq
the built in lib doesn't parse attachments in multipart forms
where do they write to disk? http libs give you a stream, up to you what you do with it
most libs give you an option to download it in various formats
which http lib does that aside from multer?
multer is not an http lib, its just a stream parsing library for multipart formdata
well I'm assuming they're using express
says post request here
yep
EEE
how did you end up solving it?
micro (nextjs) doesn't have anything for parsing multipart forms so I had to plug in multer in the most disgusting way possible
let uploadfile = req.files.file;
const imgid = makeid(8)
uploadfile.mv('./static/' + `${imgid}.png`);
res.send({"url":`url to the site /${imgid}`});```
i dont like multer, idk
yeah it sucks. The js ecosystem is just terrible I hate it
like it's convenient but.. yeah
not when you need control of stuff
possible that ClientApplication is null
might want to log

idk then. Everything should be a-o-good in the ready event
wait an hour
you are loading global commands
you aren't loading guild specific commands so you have to wait an hour
if you don't wanna wait just load em specific to a guild
how you do that no idea
mhm
djs right?
if so
https://discordjs.guide/interactions/registering-slash-commands.html#guild-commands this is one method ig
idk if there is another
this one uses rest directly
GuildApplicationCommandManager exists
mmm that works then ig
imagine loading all commands for every guild that bot is in instantly
i'd guess it has part of it being that it would spam it too much trying to do that
could be other reasons tho
No because the server (guild) backend doesn’t query the database each second to figure out if you have registered a command or not
So anything is cached and has its own refresh time
Guilds are requesting global command once each hour
Ah I see
Some things are always cached, some need to be pushed just in time
I thought it had an issue with spamming the api to register the commands
No you register them in Discords backend and frequently any guilds ask the backend if there’s something new they should know
To say it simplyfied
And yeah I also believe this prevents spam registering and deleting commands, too
you cannot get a token before approval
You don't need vote rewards to get approved.
How about disabling it until your bot is approved?
not as bad as the way you decided to show your code
Sorry, i am on my mobile.
I hv been warned that react hooks should not be called conditionally. So what should I do?
mmm blur
if you need user to be non-nullable you should be accepting it as a prop instead of rendering an empty component
rendering a null component is the wrong choice 99.9% of the time. You should instead use that data in a parent component to decide whether you should render anything at all
Ok. 👍
b = int(input("Enter second Number: "))
List = []
list = []
for i in range(1, a+1):
if a % 10 == 0 or b % 10 == 0:
print("Invalid Input")
break
elif a % i == 0:
List.append(i)
for k in range(1, b+1):
if b % k == 0:
list.append(k)
sum1 = sum(List)//a
sum2 = sum(list)//b
if sum1 == sum2:
print("Friendly")
else:
print("Not Friendly")```
idk whats happening
it always shows Not Friendly
so sum1 never equals sum2
try printing sum1 and sum2 before py if sum1 == sum2:
see what the values are
lemme show you an exmaple
For example, numbers 6 and 28 are friendly as the abundancy of 6 = (1+2+3+6) / 6 = 2, is same as abdunancy of 28 = (1+2+4+7+14+28) / 28 = 2.
also
why is one of your for loops inside another for loop
that's probably your issue
coz Whole numbers are not allowed
looping inside a loop oof
yeah you're looping inside a loop
nested loops?
that's a problem because you're running the second loop more than once
which i dont think is what you meant to do
should'nt i use them
looping inside a loop is just slow and useless imo
well that's not the point here
bruh i am learning rn, for me solving is first
not very helpful then
ok wait lemme modify
b = int(input("Enter second Number: "))
List = []
list = []
for i in range(1, a+1):
if a % i == 0:
List.append(i)
for k in range(1, b+1):
if b % k == 0:
list.append(k)
sum1 = sum(List)//a
sum2 = sum(list)//b
if sum1 == sum2:
print("Friendly")
else:
print("Not Friendly")```
now?
ya it's working
but i also want that if anyone inputs a whole number it should so INVALID INPUT
any ideas for doing so?
if you're using an int, it'll always be a whole number
Has been like that for weeks if not months...
bruh no one asked you
ye shiv no one asked u
if you have such a great PROBLEM with my questions ask mod to ban me :)
eh?
you can't really get banned based on a question
unless it breaks one of the rules ig
Oh this is where everyone is
just a few people
all of you gotta stop with the random ass underhand comments
especially you @earnest phoenix
what?
I should probably divide my large exponents into lots of smaller ones and multithread them to speed up my program
The question is, how many threads should I limit myself to? 
I guess so. Wonder what algorithm can help me out for that though
Exponents as in math, or something else?
Mhm, math
looking around, dont really think there is one
especially not one to include multithreading
rip
i mean there's algorithms for fast exponential computation but at that point, you'd slow it down trying to split the exponent apart and divide it between threads i think
Not really sure myself
I guess I'll worry about it when I actually have time for it
Time to use Wolfram
depends on how you'd implement coroutines. What language are you using?
and where, ofc.
pythong
Almighty Rust
hey everyone, anyone has recommendations for discord api libraries for javascript? I use discordjs but I've heard is not the best when it comes to performance
if there's something like a job that needs to be done every interval imho that's where you'd use coroutines
Eris and Detritus
It's a hard pass I think
It really isn't, it's just that I'm a lazy motherfucker right now
but just in mind, only use threading for a job you'd do after the main thread, cause the main thread would always run first.
LMAO
same tbf
I mean if my threads rely on, say, p and q, which I pass to a function
I don't think I'm spamming threads first 
ofc not.
ty I'll take a look
I'm wondering how that's possible though
I mean, running additional threads before the main one
idk if you can do that
Same lol
all i know is that you can pass values between threads which is useful
My multithreading in few words: "Arc clones and fuck you!"
How to show people a warning thingy if the extension isn't latest version
chrome extension ^
Maybe I should work with references a bit more in those cases
May i know why are some bots with wayy lower votes showing above other bots with higher votes.

probably not posting / posted count with dev bot
because search does more than just order by votes
otherwise there wouldn't be any point to having a search feature at all
anyone mind reading through a page I wrote to explain a complicated library thing?
https://dpp.dev/lambdas-and-locals.html
I wrote it informally to try an explain a quite abstract issue
what else does it do. Why are others anime bots lower than some even though all belong to same tag
Even though they have more votes
relevance of content, tags, etc. I couldn't tell you because I don't work on search so I don't know
i understand. But i don't understand why would that make you place lower. And if relevance of content was indeed a thing why are some bots with anime names and moderation features in top lists
If all it should also be sorted according to ratings and votes. I don't know what kind of wierd algorithm is being used but i can definitely say it's not effective at all and it's way worse than the old design. Its really flawed. You're saying that it depends on the relevance of content. Thats subjective. Lets say it isnt. How are you judging the content other than the ratings of the bot. No way you're just jugding the content of the bot by the name.
bots with
Less Votes and less than 4.2 ratings are listed above the ones with More votes and 4.8+ ratings. Thats a really flawed algorithm there
Relevance of content. Hmm, Bots with tags like moderation and Music are being listed on anime. Thats the relevance of content
a 10k vote bot is placed above 33k vote bot
Same thing with auctions feature which i reported in the other channels. Oh well. All i want to do is convey the things to the person who's responsible for the search. And get the right answers or get things fixed
man writing an entire essay just to have their bot on top of search
I dont need my bot on top. I buy auctions for that. I just dont understand the algorithm which places the bots wierdly.
Earlier in this new design , There wasn't even any sorting done in the search. Now its being done but not accurately and if its done accurately i need answers on why bots with lower ratings + lower votes are placed above bots with higher ratings + higher votes so i can improve.
were still growing and there will eventually be a team responsible for dealing with search alone
since it's not an easy problem to tackle
there needs to be some kind of heavy handed approach for the time being. People were just as mad about only sorting by votes
no matter how search is handled someone will be unhappy.
Thank you for answering. All i want is to get the word across to the actual people who work on search. Also, i think people would be more mad if some bot with lower votes + lower ratings being above them.
Thats my question how is it handled atm.
relevance is an important metric but also difficult to get right. It's a small factor for now so votes are still the big one, it just doesn't account for 100%
why not use something like algolia
because algolia is unfathomably expensive
I don't understand how any company has the budget to pay for it
use google's search widget :^)
I don't understand how any company has enough fucks to give accessibe one and their money to make their site less accessible
what
^
oh that's a saas company for accessibility
accessibe is a website that claims to make your site more accessible but it actually makes it worse
missing some context there
*sus company
seems like some cringe enterprise wordpress B2B company
L
the kind of company that makes money by tricking businesses into thinking they need them
lol
because business heads are stupid
top.gg allows your bot to gain more servers
99% of bots are not businesses tho xd
If votes based sorting are no longer a thing and some unknown metrics are used for search. What should one aim for to reach upper spots
auctions
¯_(ツ)_/¯
auctions are temporary ( a week)
i mean what should one aim for to reach upper search level spots
don't really work
if no of votes and 4 .8 + ratings are no longer a big factor
how to get better seo:
- don't use
<div class="button">use a fucking<button> - accessibility
- ads
- don't use
<div class="button">use a fucking<button> - accessibility
well, keyword searching should always be based on title+description revelance, heavily weighted by title
other than that theres not much factors you can use besides like top by votes, or top by invites, if top.gg tracks invite clicks
dunno, probably can't reveal that either way
add relevant keywords in your description to pop up in search results
you could also have a "surprise me" option with randomized bots
that sounds fun but I doubt anyone would use it
AAHH ok it's weekend I'm done talking work
Nice idea
when the source of income for the website is broken
you could also ( if possible ) if votes are being done through same ips

you could lower that bots position
doesn't it return the message?
const message = await interaction.reply();
idk I haven't used djs since I acquired brain cells
xD
btw auctions are also fuc*ed up in this new design
everything is fucked up robin
BETRAYAL
haha
top.gg rewritten in roblox
Well i can give u how fucked it is in numbers
googolplex
googolplexianth
aleph null

140$ went in trash
christ mine wasn;t that bad
it was 240$ actually
mine was like $10 and i got 64 views
i never paid for ads
240$ ad for ( 1 click ) epicness
i got it free for being certified
its sad that i only got a refund because i contacted the bank
same and h bot reached 75 servers in a month
^:)

can I buy your account pwease 🥺
nu
whyyyyyy
Lol
consumer laws in the uk state that a company must refund within 14 days of me contacting them, if i contacted within 14 days of purchase
its complicated but they have to follow it
you can lawsuit a website for not having accessibility
Their Head Company is...
if they don't respond then try the bank 😉
my favorite lawsuit is accessibility lawsuit
dumbcord
ty
also it shouldn't take nearly 15 days just to tell me that they are looking into it
i havent gotten a reply in 2 weeks now
this convo made me search for stupid lawsuits.. was not disappointed
Inmate Sues State for His Flatulence/Gas
Unfortunately, silly lawsuits are overwhelming many state and federal courts. Consider Case No. 9650302 in Michigan where the prisoner sued the State of Michigan stating that the food in prison was causing his flatulence problem.
yeah
They can automate the refund system
they should
i'll dm u
can't wait to be warned for exposing their shit refund process 
did you try to await it?
this means it does return a message, but in some cases a raw message or nothing
for example, ephemeral messages might not return a message, since well, they are not visible except to the command user
so await it and check what it returns
Will discord.py forks be compatible with the top.gg api? If so, when?
const Topgg = require("@top-gg/sdk")
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("your webhook auth")
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(80)
How to use it from heroku webhook?
See messages from Norizon the other day in #topgg-api
step 1: don't use heroku
Lol
this is why i dont like these automatic webhook poster libraries
they assume you have a compatible environment
I have win7
i have win69
if you can support internet explorer why not support win7
or use win7 to write apps that support win7/IE
Because your site probably sucks
I chose the second one
if you support IE
how do i listen for the webhook in my discord bot?
unless you are a piece of shit and don't care about people with disabilities try googling this
You can support people with disabilities while not supporting archaic software.
whats a programming language blind people would love to use
c
that was quite deep ngl
i think its time for a ban 
Blindly poking into the dark with that humor I see...
I guess no one could've seen it coming
let cmduser = message.author;
let menuoptions = [
{
value: "role1", description: "Get Role 1",
replymsg: "This is the message for Role 1", emoji: "❌" //optional
}, {
value: "role2", description: "Get Role 2",
replymsg: "This is the message for Role 2", emoji: "✅" //optional
} , {
value: "role3", description: "Get Role 3",
replymsg: "This is the message for Role 3", emoji: "✅" //optional
} , {
value: "role4", description: "Get Role 4",
replymsg: "This is the message for Role 4", emoji: "✅" //optional
} , {
value: "role5", description: "Get Role 5",
replymsg: "This is the message for Role 5", emoji: "✅" //optional
}
]
//define the selection
let Selection = new MessageMenu()
.setID('MenuSelection')
.setMaxValues(1)
.setMinValues(1)
.setPlaceholder('Click me to make a Selection!'); placeholder
menuoptions.forEach(option => {
let row = new MessageMenuOption()
.setLabel(option.label ? option.label : option.value)
.setValue(option.value)
.setDescription(option.description)
.setDefault()
if(option.emoji) row.setEmoji(option.emoji)
Selection.addOption(row)
})
//define the embed
let MenuEmbed = new Discord.MessageEmbed()
.setColor("BLUE")
.setAuthor("Bot Help", client.user.displayAvatarURL())
.setDescription("***Select what you need in the `Selection` down Below!***")
//send the menu msg
let menumsg = await message.channel.send(MenuEmbed, Selection)
//function to handle the menuselection
function menuselection(menu) {
let menuoptiondata = menuoptions.find(v=>v.value == menu.values[0])
menu.reply.send(menuoptiondata.replymsg, true);
}
//Event
client.on('clickMenu', (menu) => {
if (menu.message.id === menumsg.id) {
if (menu.clicker.user.id === cmduser.id) menuselection(menu);
else menu.reply.send(`:x: You are not allowed to do that! Only: <@${cmduser.id}>`, true);```
Discord.js v12 btw
Is there anything wrong with that?
I think you should get v13
I don't like djs v13 lol, So I will stick with what I know. Thanks tho.
v12 is deprecated I don't think people would help you
Its worth a shot. :)
💀
Step 2: it’s free
Free != Decent
is there a way i can clone the djs interaction or message object?
@woeful pike does the /bots?search=Luca api endpoint still work?
changing the search bit or removing entirely doesn't change the results
MessageEmbed.attachFiles is no longer a thing on DJS?? wtf?
How to make this code
You need to add attachments to the message create payload and then use attachment://filename.ext which you define in the attachments array in the field you want it in
I've been using messageembed.attachfiles all along and this worked fine, but upgraded to djs 13 and the entire thing is fked
man
Umm
major versions change many things, it was always like that
v11 to v12 also broke tons of shit
understandable but mannnnn
its all explained in the update guide docs
well slash commands are not even djs's fault, its discord itself lul
but yes, everyone feels the same way about them
ye i mean. if i dont have to use slash commands. i dont have to update djs to 13. im happy with 12.5,
plus slash commands are gonna be pain for mobile users
v12 uses api v8 and v13 uses api v9
v8 will be deprecated
surprised v6 is still functional
v8 and v9 were released quite fast
v6 was standard for several years, v8 wasnt even standard for a full year
and v7 was never standard
for it kinda makes sense they decided to keep v6 around for a while
v6 = windows xp
v7 = windows xp black edition
v8 = windows vista
v9 = windows 7
Brb
Has "guild.region" discord.js v13 been removed as well?
Hope v10 won't be the Windows 8 of Discord
Nice joke
yes since v9 either does not or will not have that data be there since region is a vc property
Okay thanks
can I do something like this?
//IN A BLANK FILE
let objectt = {
"name": {name:"HI", level: "10"}
....
...
..
.
}```
```js
//IN MY CODE
const { objectt } = require("../file.js")
let newobject = objectt
my question is can I store objects and then reuse it in other codes?
because I have a object that occupies like 200 lines of code and it has left more things so I don't like to have a 1000 lines file and then add another 200 lines
Yes you can. You can even Object.assign(object, newValues) to the file that only exports an Object and that'll appear in other files.
That way is a super easy way to store db connections or your client
This is what I do in my bots
https://github.com/AmandaDiscord/Amanda/blob/main/passthrough.js
keep in mind that objects are passed by reference and not by copy, meaning if you copy the object to another variable, then make changes to it, the changes will also affect the original object
so if I don't need to change the object in my code it's fine to do it like I showed before?
I just need to change the original object
but how do I store it in another file? json?
yes as long as you dont change it, you can simply assign it
wdym other file?
if you mean at runtime, you just require it
ik
but i need to define the object, no?
where do i define it
to require it later
the file that has the object has to export it
then in all other files, you just require that file
it gives me error when i define it in a blank file, there is a method or something?
Go ahead and show code where you export and require it
now somehow works
that's the scariest part of development
the errors maybe were replit's code intelligent thing bug
or i put something badly and somehow it fixed
now i'm saving 300 lines of code in every commands
:')
@lament rock nah
now it's undefined
and where it works, I can't console.log it
idk why
I did this:
let { chh } = require("../../object.js")
where it works i used this:
console.log("HI",Object.values(chh))
``` the console log has all this because only chh doesn't work, then i used object.values and doesn't work and now with a string is same
nothing appears in the console
and in other commands it's undefined when i console log it
show object.js
Are you exporting chh?
If you are not exporting chh then chh can't be destructured iirc
show how you export it
I am curious if they are exporting at all if it shows undefined no?
thats not exporting
Show how you export chh in object.js
?
this is object.js
Alright so ima guess you aren't exporting at all if you don't know what we are saying
i only have the object there
When you are going to destructure something from a file
you have to export it
module.exports = { chh }
oh
i seen that many times but i don't know to use it completely so that's how I export it
that is a basic way of exporting something yes
my english sucks
its fine
ok
that is half of top.gg

you can only use require on stuff that you export
if its not exported, then require will not find it
ah ye that as well 
Unless you are requiring the whole file that is and not trying to get a specific thing right?
I haven't used js in ages so I am unsure anymore
but you can just do
let numbers = require('numbers.js')
number.variableInNumbersjs
and access that variable in the file right?
nope
numbers.js has to export something
the default exported value is an empty object
so if numbers.js doesnt export anything, numbers will be {} and numbers.variable will be undefined
Ah I see
I thought you could access variables if you just require the whole file
does someone know how I can prevent someone from bypassing my regex filter by doing this:
s c a m . d o m a i n
using javascript
like im trying to scan discord messages for such domains and stuff
I thought about removing any spaces from the message but then links that are in the message could become invalid if you know what I mean
can't you just also include ignoring whitespaces?
Mmm, that is true actually.
Ignoring whitespaces would only work ig if they only send a link
ignoring whitespaces would only work if they only send a link or the link is at the end of the message
yea
but if its anywhere in the message outside of that it would become invalid
Yep, hm
berry has something like this in censorbot but for me its more difficult to implement
since im not just looking for words
lol
yea, I myself am kind of unsure how to do it for any case
because rn I can detect domains or links and I can also convert unicode to normal already
would suck if I couldn't detect links because of someone just using spaces
github breaks quite often
yeh
more so since it all got moved to azure
they should call it gitgudscrubhub.com
more so since it all got moved to azure
they actually did it?
never thought they would
thanks
i tripped my fat legs over the power cord
Welcome to GitHub's home for real-time and historical data on system performance.
its dead jim
damn I need github now
decipher probably
Anyone know if there is an easy way to make VSCode not destructure autoimports? ie instead of autocreating pic 2 from the 1st pic, create pic 3?
how can I get my bot to reject commands if they are sent by dm?
check if the channel is a DM
that is the thing
thx
TypeScript is epic:
export default exports as typeof import("./currentFileName");
no more issues about a mod not having a default export
so github have found the issue, it's a one line fix.
problem is they have to wait for github to be back up to merge the PR. 
if(message.channel.type = "DM") return;
====
okay but if i put a command in the dm i have an error of the custom prefix
let p = prefixdb.has(message.guild.id) ? await prefixdb.get(message.guild.id) : "?";
^
TypeError: Cannot read properties of null (reading 'id')
at module.exports (/app/events/guild/message.js:11:38)
at Client.emit (node:events:390:28)
at MessageCreateAction.handle (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (node:events:390:28)
at Receiver.receiverOnMessage (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/node_modules/ws/lib/websocket.js:983:20)

=====
======
= =
= =
= = =
=
= = ===
=
Whata bit sequence?
A sequence (collection) of bits (ones and zeros)?
=========== =========== =========== ===========
=========== =========== =========== ===========```
...hear?
let channel = db.fetch(`setuped_${message.guild.id}`, channel.id);
db.subtract(`setuped_${message.guild.id}`, channel.id);
message.reply(`Reports channel deleted from the Database. `)
}}
Error:
```let channel = db.fetch(setuped_${message.guild.id}, channel.id);
^
ReferenceError: Cannot access 'channel' before initialization```
I also tried this:
db.delete(`setuped_${message.guild.id}`);
message.reply(`Reports channel deleted from the Database. `)
}}
Then it did reply and said that it was deleted, but didn't delete from quick.db's db
you accessed channel in one of the parameters but it wasn't declared
How would I fetch what the current channel is set to?
But you're also declaring a new variable called the same thing
this code makes absolutely no sense
fetch does not have 2 parameters, its only one, the key you want to fetch
you cant subtract an id, its not supposed to be used as a number
subtract is for math only
yes, delete is correct
but idk how to fetch channel and define it.
fetch only takes 1 parameter
So just a wee confused there lol
Ah
Is there a way that I can do something like:
.snippet add <command_name> <command_description> and have it save in quick.db?
db.add(`snippets_${message.guild.id}`, `${command_name}_${command_description}`)?
Is there something as such or close to that?
depends what you want to do with it
do you only want to save the name and description?
like just that piece of text?
nothing else?
can one guild only have one snippet?
or can it have multiple?
Yeah, so when a user uses:
for example. .snippet <command_name> it comes out with <command_description>
Multiple.
will you need to list available snippets in a guild?
Just got back to coding after a straight year of not, so getting back used to it.
Most likely yeah
so best use an array
pretty sure quick.db supports them
or an object might be better
let me check if quick.db supports what im thinking
db.add('snippets.${message.guild.id}', '${snippet_output}')```?
add is for math
o-o
wouldn't set replace the already there snippet?
from what i undestand, quick.db should support this
db.set(`snippets.${message.guild.id}.${snippetName}`, snippetDescription);
const description = db.get(`snippets.${message.guild.id}.${snippetName}`);
const allSnippets = db.get(`snippets.${message.guild.id}`);
Oh sweet, will go try it now, thats awesome, thanks! I will get back to you in like 30 mins "ish"
would the "allSnippets", contain the command name and description?
yes, all of them
db.set(`snippets.${message.guild.id}.${snippetName}`, snippetDescription);
message.reply(`Snippet ${snippetName} added!`)
const description = db.get(`snippets.${message.guild.id}.${snippetName}`);
const allSnippets = db.get(`snippets.${message.guild.id}`);
const embed = new Discord.MessageEmbed()
.setDescription(`All of ${message.guild.id}'s Snippets\n> - ${allSnippets}`)
message.reply({ embeds: [embed] })
}
}```
JSON.stringify(allSnippets)

That's what needs to go in ${}?
yes
It works!
How might I spiff that up a bit tho?
Cause I would eventually want to fetch 1 of them, like
.snippet THIS sends in a embed: IS A TESTING COMMAND
or well
.snippet <command_name> returns <command_description lmfao, I am bad at explaining things.
Ah.
So that "description", just to clarify, when I use it in the command .snippet <command_name> will return the description of the snippet too?
in my example, the description line shows how to get a single command description with a command name
the allSnippets line shows how yo get all commands and their descriptions with only a guild id
you dont need to have both lines at once, just use the line that is appropriate for each command
did you log it?
Wym by both lines at once?
did you await it?
is it ephemeral?
show code
try adding fetchReply: true
.reply({ embeds: [embed], fetchReply: true })
probably best to check the database, or code you wrote to save xp to the database
Can i show you my code?
sure, but I may not be able to help. someone else may be able to
Ok!
XP code
const db = require('quick.db')
const { getInfo } = require("../../handlers/xp.js")
const canvacord = require("canvacord");
const Discord = require("discord.js");
module.exports = {
name: "level",
aliases: ["lvl", "rank"],
description: "Get the level of Author or Mentioned",
usage: "level [user]",
category: "info",
run: (client, message, args) => {
const user = message.mentions.users.first() || message.author;
if(user.id === client.user.id) { //IF BOT
return message.channel.send("😉 | I am on level 100")
}
if(user.bot) {
return message.channel.send("Bot do not have levels")
}
let xp = db.get(`xp_${user.id}_${message.guild.id}`) || 0;
const {level, remxp, levelxp} = getInfo(xp);
const rank = new canvacord.Rank()
.setAvatar(user.displayAvatarURL({dynamic: false, format: 'png'}))
.setCurrentXP(remxp)
.setRequiredXP(levelxp)
.setLevel(level)
.setStatus(user.presence.status)
.setProgressBar("#00FFFF", "COLOR")
.setUsername(user.username)
.setDiscriminator(user.discriminator)
.setRank(1, "a", false)
.setBackground("IMAGE", "https://cdn.discordapp.com/attachments/787340979148947466/801140313132367872/PicsArt_01-19-10.54.56.png");
rank.build()
.then(data => {
const attachment = new Discord.MessageAttachment(data, "automodRankcard.png");
message.channel.send(attachment);
});
}
}
Can you wrap that in a code block?
```js
code here
```
Sure
const db = require('quick.db')
const { getInfo } = require("../../handlers/xp.js")
const canvacord = require("canvacord");
const Discord = require("discord.js");
module.exports = {
name: "level",
aliases: ["lvl", "rank"],
description: "Get the level of Author or Mentioned",
usage: "level [user]",
category: "info",
run: (client, message, args) => {
const user = message.mentions.users.first() || message.author;
if(user.id === client.user.id) { //IF BOT
return message.channel.send(":wink: | I am on level 100")
}
if(user.bot) {
return message.channel.send("Bot do not have levels")
}
let xp = db.get(`xp_${user.id}_${message.guild.id}`) || 0;
const {level, remxp, levelxp} = getInfo(xp);
const rank = new canvacord.Rank()
.setAvatar(user.displayAvatarURL({dynamic: false, format: 'png'}))
.setCurrentXP(remxp)
.setRequiredXP(levelxp)
.setLevel(level)
.setStatus(user.presence.status)
.setProgressBar("#00FFFF", "COLOR")
.setUsername(user.username)
.setDiscriminator(user.discriminator)
.setRank(1, "a", false)
.setBackground("IMAGE", "https://cdn.discordapp.com/attachments/787340979148947466/801140313132367872/PicsArt_01-19-10.54.56.png");
rank.build()
.then(data => {
const attachment = new Discord.MessageAttachment(data, "automodRankcard.png");
message.channel.send(attachment);
});
}
}
there
but i have 2 files for XP levels
this doesnt appear to be the xp saving code, which is probably the thing you want
class Util {
static getLevel(xp, extra = true) {
let level = 1;
//WHILE LOOP
while(xp >= Util.getLevelxp(level)) {
xp -= Util.getLevelxp(level);
level++
}
if(extra) return [level, xp];
else return level;
}
static getLevelxp(level) {
return 5 * Math.pow(level, 2) + 50 * level + 100;
}
static getInfo(exp) {
let [level, remxp] = Util.getLevel(exp, true);
let levelxp = Util.getLevelxp(level);
return { level, remxp, levelxp}
}
static addexp(message) {
let toadd = Math.floor(Math.random() * 3 + 3);
let oldxp = db.get(`xp_${message.author.id}_${message.guild.id}`)
let oldlvl = Util.getLevel(oldxp)
let newxp = oldxp = toadd;
let newlvl = Util.getLevel(newxp);
if(newlvl > oldlvl)
message.channel.send(`${message.author}, You just reached level ${newlvl}`)
db.add(`xp_${message.author.id}_${message.guild.id}`, toadd)
}
}
module.exports = Util;
file 2
I don't understand why its not showing the XP
are you calling addexp?
Ok I think i forgot that where would i add that i forgot
@solemn latch Would I do let addexp =
nope, in the location you are exporting util youd call addexp as a function
So im confused where do i put it
depends on the location you want it to run
if you wrote the code you would be the only one to know
hmm, well when do you want to give xp to users?
After 10 messages
youll need to track how many messages they have then
ok
How do i do that
In a json file or database
youll need to store it in your database, then if the number is divisible by 10 then give them xp
Ok
or dont even store it I guess, could just take the inaccuracies and only cache it.
doesnt need to be 100% perfect
if it resets who cares 😄
you only care if its every 10th message anyway
you gave an example up above, just look at your old code to see how it works
I found a way
@solemn latch I wrote this code would this work
const profileSchema = require('./schemas/profile-schema')
module.exports = (client) => {
client.on('message', (message) => {
const { guild, member } = message
addXP(guild.id, member.id, 23, message)
})
}
const getNeededXP = (level) => level * level * 100
const addXP = async (guildId, userId, xpToAdd, message) => {
await mongo().then(async (mongoose) => {
try {
const result = await profileSchema.findOneAndUpdate(
{
guildId,
userId,
},
{
guildId,
userId,
$inc: {
xp: xpToAdd,
},
},
{
upsert: true,
new: true,
}
)
let { xp, level } = result
const needed = getNeededXP(level)
if (xp >= needed) {
++level
xp -= needed
message.reply(
`You are now level ${level} with ${xp} experience! You now need ${getNeededXP(
level
)} XP to level up again.`
)
await profileSchema.updateOne(
{
guildId,
userId,
},
{
level,
xp,
}
)
}
} finally {
mongoose.connection.close()
}
})
}
module.exports.addXP = addXP```
Ik
ok
just out of curiosity, what does this line do? 🤔
const result = await profileSchema.findOneAndUpdate(
tbh i forgot
can you find out please
sure
@solemn latch here it is
You are using it fine. Async/await works like this. You have a function that performs a task but you don't want to wait till it completes the task before it can continue another task.
Then you use the async statement to show it is a asynchronous function then you use the await when you want to perform a task that returns data so that it doesn't block the other tasks.
that doesnt explain what it does
all i could find
are you sure you wrote this code? 🤔
stack overflow has nothing on it
@solemn latch i used https://github.com/AlexzanderFlores/Worn-Off-Keys-Discord-Js/blob/master/32-Leveling-System/levels.js
so not really but i did a few things
You may want to contact the owner of that github if you want support for it.
will do better than we can do
Yeah iim going to
Hey I need some help again
@solemn latch How tf do i set this up
receive a message from messageCreate event, store a messageCount in your db. then, when messageCount reaches 10, reset it to 0, add xp to user.
I sent one message and now it spams the embed.
let array1 = []
if (array1.includes(message.channel.id)) {
let e = new Discord.MessageEmbed()
message.channel.send({ embeds: [e] });
}```
Djs v13, any help? lol
client.on("messageCreate", message => {
let prefix = config.prefix;
let array1 = ["873762714311360512", "873762322039058462", "873763309160132690", "873766382569914490", "873766289821290537", "873761652351328286", "873763556867313705", "873763455096750082", "873766526052868106", "873762046364233730","875270685684023356", "875270328132190220", "875270287258701855", "875270245948989530", "875270207948603552", "875270774016061450", "914254220042067998"]
if (array1.includes(message.channel.id)) {
let e = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(`Thank you for using Promotion Network!`, client.user.displayAvatarURL())
.setDescription(`\ Please make sure that your advertisement is in the right category, has a description, and an invite link.\n
\ We’re [hiring staff]([#908053979022364743 message](/guild/873712642185895967/channel/908053979022364743/)) join us!\n
\ If you want to boost EA, read #┇:sparkles:﹒perks-guide and you’ll get awesome perks!\n
\ Subscribe to our [youtube channel!](https://youtube.com/channel/UCvRwE8eachcVdVwAHkz7mzQ)`);
message.channel.send({ embeds: [e] });
}```
Thats it lmfao
Every time your bot sends a message, it triggers that event since it created a new message
Oh yeah
if (message.author.bot) return;
I may or may not have been testing their knowledge of the code they wrote 👀
Got it, ty.
Though with application commands you won't have to worry about that
oh makes sense

What library?
Slay spoiling woo trials tsk tsk

was mostly just curious
You could use <MessageReaction>.users.cache.has(...) (https://discord.js.org/#/docs/main/stable/class/MessageReaction)
i mean it coulve been like a message partial or something
oh no 😭 my man is recreating a connection pool for every single query
⬆️
Import discord
Import DYNO
form discord.ext import command
Bot = command.prifix(['!','?'])
Bot.command()
Asyns def dyno(ctx):
Self = ctx.self
Await self.devolopment_DYNO
Bot.run(token=token)
I saw a web
Name dyno code
And i click on it
Looks a bit off
And this is the fake code
🤣 😂
Who made that fake web
Everyone can understand that is fake
lol
Better here than anywhere else, can someone briefly explain what are the rate limits? Cause i keep hearing about it but want to make sure what im hearing is right 😅
Discord has no concrete list of rate limits as they're dynamic and may change.
If you're using a library, there's a good chance it handles rate limits for you.
But Discord expects you to be "reasonable" with the number of requests and how often you hit the API.
For example, a command that modifies every channel to update some role's permission will probably get rate limited, but people do it anyway since it's not an operation they'll do often.
Do you know if Discord.JS does it for me then?
It does.
Awesome, thanks a ton for the info
Hey, i am using discord.js and have a problem:
Whenever i get a DiscordApiError: Missing Permission the shard that throws the error restarts. I would like the shard to keep on going after such an error. How would i do that?
its not like i get an uncaught primise rejection or something
That is also what i want to do additionally, but i also want it to not restart if such an error is thrown anyways
thats an example event
should i make a console.log here instead of a reject?
you don't need to wrap this inside a promise constructor
a try catch that rejects with the error it catches is equivalent to not having a try catch at all. Exceptions bubble up the call stack by default
you're getting unhandled promise rejections because you fire and forget event.execute() and when that errors ur program dies because theres nothing to catch it
db[id_number] = config["setup"]["default"]
anyone know why this specific line is sending a discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: string indices must be integers?
id_number i've tried to make a str and int.
config and db are dictionaries.
what's config['setup']
the status of my bot is not working?
Looks fine to me
Hey @wheat mesa! Do you have any open source detritus bots?
its against discord tos
no, its against discord tos.
yeah
I cant run node in my vsc(fixed)
i think woo said no to not encourage them doing it 
^
/home/runner/noahs-testing/node_modules/discord-buttons/src/v12/Classes/APIMessage.js:9
class sendAPICallback extends dAPIMessage {
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (/home/runner/noahs-testing/node_modules/discord-buttons/src/v12/Classes/APIMessage.js:9:31)```
**__CODE:__**
const config = require("../config.json");
const Discord = require("discord.js");
const db = require('quick.db')
const { v4: uuidv4 } = require('uuid');
module.exports = {
name: "help", // Command Name
description: "List all of my commands/info about a specific command.", // Description
aliases: ["h"], // Aliases
usage: " ", // Usage
guildOnly: false, // If Command In DMs return
admin: false, // Bot Admin only
async execute(message, args, clientMessageMenuOption, MessageMenu) {
let prefix = config.prefix
let cmduser = message.author;
let menuoptions = [
{
value: "role1", description: "Get Role 1",
replymsg: "This is the message for Role 1", emoji: "❌" //optional
}, {
value: "role2", description: "Get Role 2",
replymsg: "This is the message for Role 2", emoji: "✅" //optional
} , {
value: "role3", description: "Get Role 3",
replymsg: "This is the message for Role 3", emoji: "✅" //optional
} , {
value: "role4", description: "Get Role 4",
replymsg: "This is the message for Role 4", emoji: "✅" //optional
} , {
value: "role5", description: "Get Role 5",
replymsg: "This is the message for Role 5", emoji: "✅" //optional
}
]
//define the selection
let Selection = new MessageMenu()
.setID('MenuSelection')
.setMaxValues(1) //OPTIONAL, this is how many values you can have at each selection
.setMinValues(1) //OPTIONAL , this is how many values you need to have at each selection
.setPlaceholder('Click me to make a Selection!'); //message in the content placeholder
menuoptions.forEach(option => {
let row = new MessageMenuOption()
.setLabel(option.label ? option.label : option.value)
.setValue(option.value)
.setDescription(option.description)
.setDefault()
if(option.emoji) row.setEmoji(option.emoji)
Selection.addOption(row)
})
//define the embed
let MenuEmbed = new Discord.MessageEmbed()
.setColor("BLUE")
.setAuthor("Bot Help", client.user.displayAvatarURL())
.setDescription("Select what you need in the Selection down Below!")
//send the menu msg
let menumsg = await message.channel.send(MenuEmbed, Selection)
//function to handle the menuselection
function menuselection(menu) {
let menuoptiondata = menuoptions.find(v=>v.value == menu.values[0])
menu.reply.send(menuoptiondata.replymsg, true);
}
//Event
client.on('clickMenu', (menu) => {
if (menu.message.id === menumsg.id) {
if (menu.clicker.user.id === cmduser.id) menuselection(menu);
else menu.reply.send(:x: You are not allowed to do that! Only: <@${cmduser.id}>, true);
}
});
}}```
Learning/Testing our Dropdown Menu's and this error has been there for the longest time 🤣
maybe a little ^_^
just to double check, in that file are you requiring discord-buttons
the error seems to be related to the discord-buttons library, but i dont see it being used
I seem to be having errors with my code that I cannot debug, does anyone know why this is happening?
Code & json file attached
I did, still the same erorr.
What errors?
I think your error is happening in another file, that question was just information gathering
I have this in my main file:
const dbs = require("discord-buttons");
dbs(client);
const { MessageMenuOption, MessageMenu } = require("discord-buttons")
As soon as I just took that out, it worked.
Lemme go test the command*
Try const { dbs, MessageMenuOption, MessageMenu } = require(“discord-buttons”);
It’s because I’m on mobile
Buttons is using 12
oh
I needa downgrade
After I transfer EVERYTHING to djs v13
kill me now
fr lol 🤣
Try a different button library
Its alr, I shall just re-downgrade.
One which is v13 compatable
Use the inbuilt djsv13 methods...
Nah, those are always so extra
I don’t use discord.js but some errors are easy to tell
discord-components on discord.py is godly I stg
No, but Erwin’s repo that flazepe linked you is a good start, and this repo is really good (made by the creator of detritus) https://github.com/cakedan/notsobot.ts
Isn't djs v12 going to stop working not far in the future anyway?
Or can you make it work with third party libs
^
Or can you make it work with third party libs
The nonsense is to work with additional libraries if your main library already includes all possibilities.
But what’s easier
Thinking about to downgrade is just a big face palm.
Learning how to program to understand the library you're already using.
I mean the fucking docs of djs do explain things really good, also providing examples
It's not really complicated at all to understand how to deal with message components
But already using the library for things you understand copy & paste doesn't require an additional library for doing the same things you can do with the main one
easier today? or easier overall.
there will be a day when v12 isnt maintained by even third party libraries.
djs v15 could be out by then, and then you need to learn v13, v14, and v15.
while staying back might save some dev time today, devs may have so many more issues down the road.
-someone who hasnt learned v13 
typeerror: string indicies must be integers
Try using a different library in general
THIS VIDEO IS SPONSORED BY DETRITUS
Lol
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
const row = new MessageActionRow()
.addComponents(
new MessageSelectMenu()
.setCustomId('select')
.setPlaceholder('Nothing selected')
.setMinValues(2)
.setMaxValues(3)
.addOptions([
{
label: 'Select me',
description: 'This is a description',
value: 'first_option',
},
{
label: 'You can select me too',
description: 'This is also a description',
value: 'second_option',
},
{
label: 'I am also an option',
description: 'This is a description as well',
value: 'third_option',
},
]),
);
await interaction.reply({ content: 'Pong!', components: [row] });
}
});
Am I doing something wrong? I am so confused, this is straight from the DIscord Guide, yet there is still no slash commands in the server popping up.
this appears to be the code for responding to slash commands, not registering them.
if you are using the guide, probably best to read the whole thing about slash commands(here and the next few pages).
https://discordjs.guide/interactions/registering-slash-commands.html#registering-slash-commands
Ohh, I didn't notice that reply was for me, thanks!
I did see that, but that only is for a certain guild.
Thanks!
I want it multi-guild.
if you read from there, youll see on that page it covers global commands too.
Ah nvm, the Guide has it all.
Yeah just saw that. 🤣
It's as simple as;
Routes.applicationCommands(clientId),
{ body: commands },
);```?
yep, just note the text above that code block includes important information
So confused, but lemme go try a few things and read the docs over 200 times not even joking lmfao
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token } = require('./config.json');
const fs = require('fs');
const commands = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '9' }).setToken(token);
await rest.put(
Routes.applicationCommands(client.id),
{ body: commands },
);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();
So, that should theoretically work.... right?
looks like thats for guild specific commands
oh wait
const { Routes } = require('discord-api-types/v9');
const { token } = require('./config.json');
const fs = require('fs');
const commands = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '9' }).setToken(token);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationCommands(client.id),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();```
o-o
looks right to me, but I havent used djs v13 before
Im just learning it lmfao
const { MessageActionRow, MessageSelectMenu } = require('discord.js');
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
const row = new MessageActionRow()
.addComponents(
new MessageSelectMenu()
.setCustomId('select')
.setPlaceholder('Nothing selected')
.setMinValues(2)
.setMaxValues(3)
.addOptions([
{
label: 'Select me',
description: 'This is a description',
value: 'first_option',
},
{
label: 'You can select me too',
description: 'This is also a description',
value: 'second_option',
},
{
label: 'I am also an option',
description: 'This is a description as well',
value: 'third_option',
},
]),
);
await interaction.reply({ content: 'Pong!', components: [row] });
}
});
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const commands = [];
const rest = new REST({ version: '9' }).setToken(config.token);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationCommands('701018283603918869'),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();
It still does not create the slash command.
global commands take an hour to show up
In 1 server?
yeah, they refresh at random times iirc
They always used to be instant... wowza
so whenever it refreshes next(1 time an hour)
which is why the guide suggests using guild commands during development
Okay, imma just to guild based ones, since it is for 1 server.
TypeError: Cannot read properties of undefined (reading 'toJSON')```
Now I just get that.
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}```
one thing after another 🤣
seems like you don't have a prop exported called data
Also, commands show up instantly in DMs
I'm just going off the guide.
are you sure you updated all your commands in the command folder to follow the guide?
Wym?
Im trying to do a drop-down menu
const { MessageActionRow, MessageSelectMenu } = require('discord.js');
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
const row = new MessageActionRow()
.addComponents(
new MessageSelectMenu()
.setCustomId('select')
.setPlaceholder('Nothing selected')
.setMinValues(2)
.setMaxValues(3)
.addOptions([
{
label: 'Select me',
description: 'This is a description',
value: 'first_option',
},
{
label: 'You can select me too',
description: 'This is also a description',
value: 'second_option',
},
{
label: 'I am also an option',
description: 'This is a description as well',
value: 'third_option',
},
]),
);
await interaction.reply({ content: 'Pong!', components: [row] });
}
});
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const commands = [];
const commandFiles1 = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
const clientId = '701018283603918869';
const guildId = '914203218416914462';
for (const file of commandFiles1) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '9' }).setToken(token);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();```
Thats my index.js
I see, so the code you are using above isnt compatible with the code in the guide in the section you are in
sure, but you skipped steps
I'm not sure what steps tho..?
probably best to go to the beginning tbh
at least to back here. https://discordjs.guide/creating-your-bot/#creating-configuration-files
every page should be read and understood before moving to the next
Okay okay, so its getting easier.
To create, delete, set (update) interactions
client.commands = new Collection();
^
ReferenceError: Collection is not defined
at Object.<anonymous> (/home/runner/djs-v13/index.js:23:23)```
Now its just that error and I fully understand it lmfao
Just use a map or the associacted discord constructor



