#development
1 messages · Page 1503 of 1
!args ? message.author.displayAvatarURL({ dynamic: true }) : args.join("")
so I can do that as a value>?
hm? xD
if the user sent a link
and args joined by "" is weird
you're right
what is shards
...?
ok
/*
The following code goes into it's own file, and you run this file
instead of your main bot file.
*/
// Include discord.js ShardingManger
const { ShardingManager } = require('discord.js');
// Create your ShardingManger instance
const manager = new ShardingManager('./YOUR_BOT_FILE_NAME.js', {
// for ShardingManager options see:
// https://discord.js.org/#/docs/main/v11/class/ShardingManager
// 'auto' handles shard count automatically
totalShards: 'auto',
// your bot token
token: 'YOUR_TOKEN_GOES_HERE'
});
// Spawn your shards
manager.spawn();
// The shardCreate event is emitted when a shard is created.
// You can use it for something like logging shard launches.
manager.on('shardCreate', (shard) => console.log(Shard ${shard.id} launched));
@misty sigil this is shades?
no that’s code
this is a fancy djs sharding method
that’s the way I use
where i find a code of shades
shade.toString()
Each shard handles its own set of guilds that are assigned to it
Say, shard 1 handles guilds with IDs ranging from 1-2500, while shard 2 handles guilds with IDs from 2501 to 5001
what does the public key do?
can I do many things a string can end with with string.endWtih()
You can use an array find(r => [id1, id2].includes(r.id))
The way you're doing is incorrect
you probably want to create that array outside of the find though
micro optimization ™️
cry
yeah?
can I do many things a string can end with
i do not understand what you're trying to say
if (!x.endsWith(/\.(jpeg|jpg|gif|png)$/))
yea
First argument to String.prototype.endsWith must not be a regular expression
edge
yeah material design
cringe
"poop.jpg".test(/\.(jpeg|jpg|gif|png)$/)```
edge = chrome
chrome = not a pain to dev with
You mean regex.test(string)?
but anyways cool
@pale vessel yep
wdym test isnt a thing
/\.(jpeg|jpg|gif|png)$/.test("poop.jpg")```
can I if that
yes
if(/\.(jpeg|jpg|gif|png)$/.test("poop.jpg")) ...```
I'd do js /\.(jpe?g|gif|png)$/.test("poop.jpg") instead tho
if you're testing for file names to verify they're actually that type... sorry to break your bubble but that doesn't do that
you can rename a file to have any extension you want
you can even fake mimetype right?
yup
yea yuou can
cringe
but linux type shows true type lol
how can I test if the website url doesnt end with a .jpeg etc
the only reliable way to verify the file type is downloading the first few bytes and checking the file header
Asking about your attempted solution rather than your actual problem
what do you actually want to do
I want like a function maybe that will return if the link contains an img tag
Like the magic number from the buffer?
correct
what...?
if the url returns an image you meant?
interesting
sure
you need to make a request to the url and check the mime type of the content
it's not 1995 anymore, images can be served without the extension
yes they can
@earnest phoenix whats the problem
Make your role ids strings
Member or roles?
instead of numbers, make them strings
js cant handle unsigned longs
lol
What am i doing wrong
https://cdn.discordapp.com/attachments/792746302311628850/796384735286263848/unknown.png
client.on('guildMemberAdd', member => {
member.send("Welcome to the server!");
});
what is wrong?
It looks like it's sending it twice when a member joins?
Do you have two instances of the bot running?
Well it looks like both instances are reacting to the same event
Do you need the event on both instances? I'm not too familiar with shards
Well, I think someone more experienced in JS will have to help you out, sorry ^^
aw oki
you cant send a member, you send a user
member.user.send()
ill try
you can send a membr
look at screenshot
I don't think that's the issue
Message @DynamicBot
you can send to a member, it implements textbasedchannel
can anyone tell me if i need to make my documentation better
@harsh blade you could try to return
?
Hola
idk how 2
?
your loss
to a bot my friend helped with me
noob
says you?
yeah
if you dont know js you shouldn't be making a discord bot
Shush
He's not wrong
i have this huge problem
so not a lot of time ago i started to have this of a mess when systematic guildMemberAdd messages didn't work
my code looks like this:
bot.on('guildMemberAdd', async member => {
let welcomeChannel = await db.get(`welchannel_${message.guild.id}`);
let welcomeRole = await db.get(`constRole_${message.guild.id}`);
member.roles.add(welcomeRole)
if(!welcomeChannel) return;
const embed = new Discord.MessageEmbed()
.setAuthor('New Member!')
.setTitle(`Member ${member.user.username} has joined!`)
.setDescription(`Hello ${member}, have a great time in ${message.guild}!`)
.setColor('#5f18ff')
.setImage('https://images-ext-1.discordapp.net/external/4c13WC2375LbsiTq1pbtXLlMjkHzHGOBb179EX1wt98/https/media2.giphy.com/media/j1soPQE95y0eXhMwKT/source.gif')
.setThumbnail(member.user.avatarURL())
.setFooter(`Have a nice day and enjoy your time in ${message.guild}!`)
.setTimestamp();
bot.channels.cache.find(welcomeChannel).send(embed);
member.roles.add(welcomeRole);
});
oh wait
@tribal siren still use get
if you use the channel frequently maybe load it once on Startup with fetch into the cache
i think you should check if theres a role before you try to add it too @tribal siren
it'll cause an error tho
how can I get the url of an emoji that is in a message not reacted
Is this legal or not... It's sending everything that people says to a private channel in my private server.
https://swyrene.is-inside.me/WQZKQQAj.png
there is no concept of law on discord unless you're doing actually illegal shit lol
what code edittor is that
VS Code
brb gonna rewrite some c of vs
@solemn leaf
you have to alert your users of what data you're collecting
otherwise you're breaking the tos
cry
?
Emoji for everyone. https://twemoji.twitter.com/. Contribute to twitter/twemoji development by creating an account on GitHub.
That emoji doesn't have a url cause it's a default one
Yes
only custom emojis do
And may return an error
https://discord.com/assets/da3651e59d6006dfa5fa07ec3102d1f3.svg
there's probably some lib you can find that parses the unicode into a twemoji github url
https://static.emzi0767.com/misc/discordEmojiMap.json there's also this
Is not possible for the bots
https://cdn.discordapp.com/emojis/${emoji.id}./* extension of the emoji e.g: .png */
m
how should I get the id
you will never receive emojis in the colon representation
always their unicode string
I did
only for custom emojis shall you receive colon representation
bitch
ayo chill
it's stan twitter language
i didn't actually call you a bitch
lmfao
can I get the emoji name?
Yes
:smiley\:
it breaks tos to log thing like that I think
Not if the users know
yeah but why log it
Who knows
you gonna be api blocked
So my bot doesnt throw errors for no reason
How would that throw an error
Sometimes they use a command,
//pseudo code
if(arg.match(/^<a?:(\w+):(\d+)>$/))
//it's a custom emoji here
else if(emojiMap.find(x => x.surrogates === arg)
//it's a unicode emoji here
else
//it isn't an emoji at all here
And it bugs
Uh huh
And my bot crashes
And I need to know what command bugs
@solemn leaf
I seen
That's so frikkin mean
how can I get the id of the custom emoji
process.on()
that regex takes care of it:
make your own error handler
const emojis = require('https://static.emzi0767.com/misc/discordEmojiMap.json');
if(emojis.map(r => r.emojiDefinitions.primaryNameWithColons).filter(r => r == mB[1)) {
let emojiUrl = emojis.filter(r => r.emojiDefinitions.primaryNameWithColons == emojis.map(r => r.emojiDefinitions.primaryNameWithColons).filter(r => r == mB[1))
}
Lol
that is wrong
Overcomplicating stuff is my part
It was a joke imo
People who doesn't understand would literally laugh
you aren't being helpful, you aren't being funny, you're just being annoying
gottem
No "."
cant we clone a repo in replit
Iirc yes
it shows to subscribe for plan
Are you sure
When you need to create a new repl
Dosent it give an option to use a github repository
it does
but when i click on it
Uh huh
says subscribe
so cry
get a decent Paid VPS
digital ocean
or the 1 year free plan from AWS Google
@earnest phoenix how do I pass through the match then>?
what do you mean
Vultr is pretty okay for its price, $5/month
hak
Digital Ocean is actually pretty Decent Priced if you plan to use K8 Clusters
yas
how do you make a channel specific command using javascript?
compare channel ids
check the current channel id with the id of the spezific channel
no, like something like p!lock #support
think about how you would do that @solemn leaf
and if we dont mention a channel it'll tell you to mention a channel

if youre using discord.js, you have message.mentions.channels
okay
Do i add first();?
if you want the first mention, yes
ok
help me i forgot how to make the bot not do an ateveryone
should be a client option
the msg.s is a custom function but it take the smae options as .channel.send
you can also provide it to the send method
why not
how to create page for bot pretty nice
@earnest phoenix its saying .find isnt a function
what's your code
isnt find deprecated? atleast for the managers
} else if (emojiMap.find((x) => x.surrogates === mB[1])) {
URL = emojiMap.find((x) => x.surrogates === mB[1]).assetUrl
@pale vessel tried to set the client.options.disableMentions to "everyone", apparently didnt worked
hmm
k thnaks it worked
worked
can you help me fix my ifs?
if (mB[1] && mB[1].match(/^<a?:(\w+):(\d+)>$/)) {
URL = `https://cdn.discordapp.com/emojis/${mB[1].match(/^<a?:(\w+):(\d+)>$/)[2]}.png`
} else if (emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1])) {
URL = emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1]).assetUrl
} else if (!message.attachments.array()[0]) {
URL = mB[1]
} else if (message.attachments.array()[0]) {
URL = message.attachments.array()[0].url
}
but why is disableMentions not working
disableMentions: "everyone"
i just wanna make the bot not ping @everyone and still ping users
but discors.js is being wack
cancel the ping
according to the docs it's supposed to
with a \
@\everyone?
@everyone
but it does not work
first move the match in a variable
const match = mb....
then you can
if(mb && match)
URL = `...${match[2]}`
then we're moving into an else clause, just an else and doing the same thing except for our emojiMap
else {
const emoji = emojiMap....find(....);
if(emoji)
URL = emoji.assetUrl;
else
//it isn't a valid emoji here
}
got it
for my ping command i use client.ws.ping but for api latency for whatever reason i get NaNms
message.channel.send(`Pong! Latency is ${Date.now() - message.createdTimestamp}ms
API Latency is ${Math.round(client.ws.ping)}ms`)
you can also make this prettier with ternary operations if you want to
if (mB[1]) {
if (mB[1].match(/^<a?:(\w+):(\d+)>$/)) {
URL = `https://cdn.discordapp.com/emojis/${mB[1].match(/^<a?:(\w+):(\d+)>$/)[2]}.png`
} else if (emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1])) {
URL = emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1]).assetUrl
} else if (!message.attachments.array()[0]) {
URL = mB[1]
} else if (message.attachments.array()[0]) {
URL = message.attachments.array()[0].url
}
}
eh, fuck it, imma just do this
you didn't do over half of what i said to do
I did that before I seen your message
@tight plinth use ```js
string.replace(/@everyone/g, "@\u200beveryone");
the last replace is useless
it's a ping of the actual @everyone role
it doesn't work
const mB = message.content.split(" ");
const match = mB[1].match(/^<a?:(\w+):(\d+)>$/)
let URL = message.author.displayAvatarURL({
dynamic: true,
size: 1024,
format: 'png'
});
if (mB[1]) {
if (match) {
URL = `https://cdn.discordapp.com/emojis/${match[2]}.png`
} else if (emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1])) {
URL = emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1]).assetUrl
} else if (message.attachments.array()[0]) {
URL = message.attachments.array()[0].url
} else {
URL = mB[1]
}
}
yes
yup
@earnest phoenix what else
?
?
all right then
ty for help
How do I style the description's CSS to be different for light/dark users?
https://this-is-a-really.questionable.link/Syia18 this looks a bit shit
so
(node:273) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
i use env file
idk why this is comming
huh?
ypeError: Cannot read property 'match' of undefined
const mB = message.content.split(" "), match = mB[1].match(/^<a?:(\w+):(\d+)>$/);
you're trying to match before verifying that mB[1] exists
ok
didnt errror
now to fix this
} else if (message.attachments.array()[0]) {
URL = message.attachments.array()[0].url
} else {
URL = mB[1]
}
I dont know why it doesnt do it
share your current code
const mB = message.content.split(" ")
let URL = message.author.displayAvatarURL({
dynamic: true,
size: 1024,
format: 'png'
});
if (mB[1]) {
const match = mB[1].match(/^<a?:(\w+):(\d+)>$/);
if (match) {
URL = `https://cdn.discordapp.com/emojis/${match[2]}.png`
} else if (emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1])) {
URL = emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1]).assetUrl
} else if (message.attachments.array()[0]) {
URL = message.attachments.array()[0].url
} else {
URL = mB[1]
}
}
you can easily make this one line with ?. and ||
no he's dead

How can a bot react to a message in the bot dms? So if i dm a bot with "Hello" he answer with "Hi".
Pls help me
that's a mess but it seems it should work
thx for answers :I
@solemn leaf Hangout
The developer special help you
the same way as any other message
@solemn leaf donate nitro
what
I'm sorry if this is a bit of a dumb question, but when I'm editing the detailed description on my bot's page, I'm not able to force a theme. I'm using an external stylesheet, but I don't think its recognized as "highly customized" CSS. Is there anything I can do about this?
im confused
you mean reply?
you don't need to screeenshare
client.on message doesnt work
just screenshot the result of the command
do you use intents?
"intents"?
i'll take that as a no
where did it even get that image
because you check if mB[1] exists, in this case it doesn't, so it never gets to the attachments
client.on('message', async (msg) => {`
}
wsait
That doesnt work in dm
if you dont use intents, it does work in dm
are you high
ohhh
what are intents?
yes I am
weeb domain
but if you dont use intents, you can ignore that
Ok
const mB = message.content.split(" ")
let URL = message.author.displayAvatarURL({
dynamic: true,
size: 1024,
format: 'png'
}), match;
if (mB[1]) {
match = mB[1].match(/^<a?:(\w+):(\d+)>$/);
}
if (match) {
URL = `https://cdn.discordapp.com/emojis/${match[2]}.png`
} else if (emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1])) {
URL = emojiMap.emojiDefinitions.find((x) => x.surrogates === mB[1]).assetUrl
} else if (message.attachments.array()[0]) {
URL = message.attachments.array()[0].url
} else {
URL = mB[1]
}
an alternative that I could think of is channel.awaitMessages
although I'm not sure if that's practical
what even is that code anymore
good enough
refactor it
make it one line if you were to refactor it
wha
TOKEN=NzU1OTg1Mjc2ODczOTk4NDg2.X2 rest of tokrn
uh
one liner for this amount of checks is super ugly
proccess.env.TOKEN
you probably dont wanna share your token
that's just the bot id in base64
ok
why dont work?
why isnt the env working
look at what the error says
how did you set it
why dont work bcs file sint declared
this'
'file' is not a variable
process.env.TOKEN.toString('utf8')
so what should i put there?
Hello
you should define file
wait i have to write that lol
I’m good developer 🙂 xD
ok
what type of token are you providing?
also its client.login(process.env.TOKEN)
it's not the worstjs if (mB[1]) { const match = mB[1].match(/^<a?:(\w+):(\d+)>$/); URL = match ? `https://cdn.discordapp.com/emojis/${match[2]}.png` : emojiMap.emojiDefinitions.find(x => x.surrogates === mB[1])?.assetUrl || message.attachments.first()?.url || mB[1]; }
if you're logging into a discord bot
if you're trying to make a command loader from a directory, I recommend checking out discord.js's guide on it: https://discordjs.guide/command-handling/
I give the exact name of the ping.js file and it shows the same
ok
that's because when you do ${thing} the program will look for a variable called 'thing'
if you removed the ${} it would work
but only for that one file
but let me help you here: do you think you could vc?
i won't spoonfeed but i will try to guide you through it
@urban pelican ?
use better command handler vro
ik
sorry but I don't really understand English I can only write 😦
he was asking why ping.js hardcoded wasnt working
lol
ok, so in that case
lets step through your code
what does the first line (the fs.readdirsync) do
before anyone responds, i know what he has to do but im tryna show him
for my ping command i use client.ws.ping but for api latency for whatever reason i get NaNms
message.channel.send(`Pong! Latency is ${Date.now() - message.createdTimestamp}ms **API Latency is ${Math.round(client.ws.ping)}ms**`)
I believe that you may have quotes around that
potentially something like this: '``'
when you want this: ``
for mine i immediately send a response message and then get the time difference between the command and the response
yeah, but his braces arent being parsed
its just outputting a string
not replacing the var
i think he might have the `${var}` surrounded in quotes
I dont
@shadow crag can you show your code inside a codeblock
can anyone help me with .env
use ```
it seems to not working for me on replit
oh yes
ok i'm back 🙂
I'll let you handle this flazepe sorry
Are web back to the same conversation as yesterday? Have you not even gotten it working in 24 hours? 😕
also verko
so lets run through ur code line by line starting from the fs.readdirsync
tell me what that does first
lol yeah
lmao yep
It's literally placing THING=blah in the .env and then doing process.env.THING in your code, it shouldn't require that much time to get working
you escaped the backticks
why?
yep there we go
oh because i wanted them to be shown but that was before i made them in a code block
its not like that in the actual code
ah
now its how it should be
well make the path to the folder from the command
(for info I am not a good programmer I started yesterday) 😦
xD
that works fine on pc
idk whats wrong on replit
this is NaN?
ok, you're on the right track
great I'm glad
so essentially, that first line is getting all files in ./commands/ that end in .js
this is NaN
TOKEN=NzU1OTg1Mjc2ODczOTk4NDg2.X2LQJw.CWdrx rest of prefix
process.env.TOKEN
not works

is that your full token?
ok ( file.endsWith('.js')); )
You shouldnt have your token in here
its not a full token
"rest of prefix"? You mean "rest of token", right?
and it's putting that value into a variable called commandFiles
This is what I have.
hmm
now what does the next line do, @urban pelican?
@shadow crag add console.log(client.ws.ping) somewhere in your code
(the for loop)
And I can access process.env.CLIENT_TOKEN anytime I want.
And also const prefix = process.env.PREFIX; works fine
have it
CLIENT_TOKEN = “(token)”
No, you do'nt need that
ok
thats how mine is works fine
for(constfile of commandfile){ this??
I mean it's fine if you have those (though, "normal quotes" not “these fucking word versions”) but it's not necessary to have quotes.
Take a look at https://anidiots.guide/first-bot/a-basic-command-handler
Is there a developer build of discord.js as an npm package? something like discord.js-dev?
I gave them a link to the discord.js guide for a command handler, but I'm trying to lead them to the solution
you mean pre-release versions? like, alphas and such?
step by step
no you need to use npm i discordjs/discord.js
yeah that
Yeah that's literally what the guide does, lead someone to the solution, with explanations and examples.
im on mobile so thats what it uses 😅
I mean if you want to just repeat what the guide says that's fine, but it's properly explained in there 😛
alrighty, I just wanted to offer a person to person thing 😅
In console i still got NaN
try restarting your bot
npm i discordjs/discord.js#branchname
do you mean just off and then back on
but @urban pelican, here's a hint: look very very closely at the for loop, and then look at the code inside it. notice anything?
you can use the guide that evie gave, just letting you know
yes
ok i did that and still got NaN
yeah
I do not know 😢
look at the variable names... still nothing?
no 😦 but I noticed that I missed commandfile with s
The fact that they can access client.ws.ping and have it be NaN is a start. That's not supposed to be correct unless they were trying to access it before the client entered a ready state
pretty sure WebsocketManager.ping is a getter
your for loop says for constfile of commandFiles
the code in your for loop says const command = require('./commands/${file}.js\')
did you got dotenv installed and call it?
There you go!
you had a different problem, but you solved both
@pale vessel links dont work anymore
yes 🙂
readdirSync returns Array<string> of file names, not paths
you did write commands.name instead of command.name, but you also wrote constfile instead of const file!
good job on figuring it out!
I'm glad I could help to some extent
suggestion for developers which use vscode: turn on checkJS in settings
yessir
cant believe i lived without it for so long
according to man I will be here many more times 🙂
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'assetUrl' of undefined
when trying to do !invert link
show code
URL = match ? `https://cdn.discordapp.com/emojis/${match[2]}.png` : emojiMap.emojiDefinitions.find(x => x.surrogates === mB[1]).assetUrl || message.attachments.first().url || mB[1];
Your find is returning undefined. You should not attempt to access properties of potentially undefined accessors. If you're using node 14, you can use optional chaining to remove the necessity to check for if the value of the find is undefined
didn't you copy my code https://discordapp.com/channels/264445053596991498/272764566411149314/796429825207435276
you removed the ?
nice my VCS doesnt know this setting. but it knows it for TS for some reason.
on the attachment too
It would be under TypeScript settings since VSC uses TS for checkJS
are you using node below 14
run node --version
i'm assuming they are since they removed the ?s
jsconfig ftw
its not unlikely
yep as in youre below v14
whats up
Does VSC even look at a jsconfig by default unless a setting which would require some config is turned on?
yeah pretty sure
jsconfig only applies to .js files tho, of course
Strange. All of the supported config values would at least have to have checkJS turned on for any of the config to be there to make sense
tsconfig for good .ts users
of course
how do I update node
r u shore ?
download it from the site
Pretty sure. Only config value I can think of is actually checkJS: boolean
other than that, what comes to mind is strictNullChecks amongst other things checkJS related
I recommend you should RTFM: https://code.visualstudio.com/docs/languages/jsconfig
VSCode reads JSConfig in a directory, regardless of anything else
jsconfig.json is tsconfig.json with "allowJs" attribute set to true
if you use native modules yes
kk
pls do
I have read that before. All of the config values it states there would make sense if checkJS is turned on in settings. If not, it wouldn't make sense to try to do any of those config settings unless it was checking in the first place. Unless it just shadow turns it on and ignores it's other features and only provides what you the file declares
normal people: yes
programmers: y
checkJs: Enable type checking on JavaScript files.
it can be turned off and you'll still get type references regardless
Yes. I did mention that config property existed which would make sense
it won't yell at you though
ohh its the type check thing. it where already enabled for me
yea, it's type checking for the lazy (read: no ts)
use C#
fair
coffeescript
never heard of it
coffeescript + typescript
its quite popular iirc
Is it building off of TypeScript or is it it's own thing
it's its own thing
but if you want some more efficent resource usage i guess you wont get around using a compiled language
Rust is much nicer imo
c is good to know but soo annoying to code in
Rust syntax is kinda horrific
lmfao
tryed to learn GO, failed at step 1, Setup a Enviroment
LMAO rip
Go is budget Rust
GO is nice, not bound to any platform, and some other nice stuff
budget Rust is bad
i mean, you aren't wrong...
but is that a bad thing..?
Pug is good
good is objective
doesn't require an absurd install size
lacks decency though
hmm
Rust = I am Speed
GO = I can compile faster
JS =
bad
It's more comparable to scss imo
no programing language is bad
yea, but the only people who use scss are psychopaths
im just joking about how it doesn't compile nor is fast
Guess I'm psychopathic
they eat icecream holding the chocolate dip instead of the cone
doesn't compile 
Rust got faster Running Code over GO, while GO is more towards faster Creation of code / compiling, Rust Compiler always try to get the most Efficent Machine Code while GO just goes for fastest compile speed
my node no workie
hmm maybe i should give up on learning C# and learn Rust instead.
or atleast postpone C#
https://github.com/AmandaDiscord/Amanda/tree/rained-in/website
Pug/SCSS made website. Live at
https://amanda.moe
I do not believe it to be psychopathy if the code is that clean.
laughs in webpack
pug 
amanda is open sourced?
only Psychopaths write extremely clean code.
http://www.jsweet.org/ for writing better JS code
Yes
shift alt f
amanda pog code
Needs a core framework rewrite. Somewhat messy ever since I moved from discord.js to modular interfaces.
The multithreading gains too strong though
node doesnt work anymore
did you get an error?
did you copy the node_modules folder somewhere else and then ran it?
I've got the perfect library
no
anyways just delete the node_modules folder and run npm install
just run npm install
didnt owkr
you dont need to delete node_modules
I did that already
deleting the folder is just for preventing stupid errors
Throw it at me, I guess
This awfully looks like mixin
i gift someone 1 year Discord Nitro if he writes a Working Discord bot with atleast 5 Commands in COW
it's a dependency injected framework
I saw. Just the nature sounds a lot like mixin bytecode injection
My download speed is 10 bytes a sec
all the time?
so much stuff
broke
(node:17692) Warning: Accessing non-existent property 'func' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
if you have this slow speed all the time it can cause npm to timeout
does it say if its a module?
(node:17692) UnhandledPromiseRejectionWarning: Error: Could not locate the bindings file. Tried:
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\build\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\build\Debug\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\build\Release\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\out\Debug\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\Debug\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\out\Release\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\Release\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\build\default\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\compiled\14.15.4\win32\x64\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\addon-build\release\install-root\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\addon-build\debug\install-root\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\addon-build\default\install-root\better_sqlite3.node
→ C:\Users\Owner\Desktop\Idk\node_modules\better-sqlite3\lib\binding\node-v83-win32-x64\better_sqlite3.node
¯_(ツ)_/¯
ok, one sec
yea sqlite is fucked
can I update
you got Build Tools installed right?
rebuild sqlite
npm rebuild?
or just delete the entire node_modules folder and install all dependencies new (if you havent done this)
wait
learn nodejs and js™
js has nothing to do with node not working
bcs this is the stuff i know that happens if you try to fix one damaged package. for some reason npm fucks it up and you get more modules that are done
no its that your modules are all outdated
ok
well nodejs does
Deleting the node_modules folder can indeed help
c path?
in your project folder
no just npm i
okay good
your dependencies should be in your package.json
ik
usually if i get a broken node module i dont brother with trying to repair it. i just delete the entire folder and get them all new and fresh.
this gonna take a bit
npm ci
this is just my test bot
usually is faster than trying to search throu 10 years old Stackoverflow pages in why this one module breaks
my main bot has so much
what is the issue, preferably add your Language to it (Programming Language)
he wants to delete a channel
that specific channel?
Is this discord.js v11 or Eris?
isnt djs11
store the channelid in a database if you want to delete it later. if you want to Delete the channel get or fetch the Channel and call .delete() on the Channel object.
messagechannel is 11
you may want to cache/store the channel id inside the .then
yes
this
oh nvm. I looked at the create thinking it was a cache op but it isn't
youll need to introduce a db
sql or mongo i'd say
my go to
unless you already have one
you could store in memory but it will be gone if the Process restarts
json
use $create Test
well did you want to be able to delete the channel after your Bot Restarted?
ok then you dont need a database
You don't need to store since channel data is sent over GUILD_CREATE which is emitted for each guild your client is in on gateway READY. You can just filter over cache by channel name
you can also just do a channels.fetch where name = argument
thats what i did for one of my comands
i would get the channel id from the mention
yeah
using names is flaky
i have an option for both
if you give an id it parses it
otherwise it searches by name
channels.fetch is completely useless unless you delete stuff from the cache. Discord.js handles all cache ops and stuff is guaranteed to be cached unless affected by intents
yeah intents is kinda screwy so i use fetch
vanilla d.js should get all guilds and channels with the ready event
if its possible without intents then i generally do it w/o
Like I mentioned, GUILD_CREATE data includes complete channel data
guilds, roles, channels and emojis are 100% always cached if you're using discord.js
i thought cache was impacted by intents?
That would not Be using discord.js
my user cache didnt work correctly until i chose the intent for it
some stuff that requires intends
cache would not be impacted unless you've disabled those. By default, no.
huh.
User cache is not part of the list I mentioned
or just dont use any framework and connect barebones over Gateway and API
users and member caches are impacted by intents. You need the GUILD_PRESENCES intent if you want access to full user/member caches
it will take some time
then i'd probably do something like message.guild.channels.cache.foreach
it just started to build a module
ok
you don't need indents if you only fetch one user though
never seen it like this
yep
lmao
but not as long as installing Build Tools on a Potato
what kind of modules do I have on my main bot
generally speaking, GUILD_MEMBERS and GUILD_PRESENCES is useless unless you absolutely need to track membership status such as moderation/dashboard
sudo rm -rf node_modules
yeah, that's what I needed
lmao
its been minutes
nice
you're trying to install at the same time as you're trying to delete?
that's not gonna help
im installing for my testing bot rn
well you're hardcoding the deletable channels
im deleting the modules for my main bot
and youre creating a channel instead of deleting it
having the folder open in another program would give that message. I forget if terminals hold locks on dirs
looks like a list of Users with permissions
they do
fantastic
just to delete this
i read that as macros lmao

did you have your work directory in your Boot drive?
lmao
on the root directory?
@lament rock just thought of something
Lets hear it
there's always a chance discord could reuse a channel id per guild right
you'll wanna fetch a channel from the channel cache that has the id the user gave, and delete it instead of creating it
No. Never will any resource have the same ID
oh
they are snowflakes
well you're cute
rn you have message.guild.channels.create(msgArgs)
until they run out of ids i guess
me when i have 32 billion channels
They'll overflow the ID character count. They'll never run out
me when i have 32 billion infinity channels
Which is why I dislike it when devs specify ID lengths in regular expressions
this will delete the message channel. get the channel you want to delete by its name and or id then call delete on the channel you get

