#development
1 messages ยท Page 1711 of 1
where
my computer
hi Tim and Erwin
lol
your own pc? heroku? repl?
vps? your own pc? phone? glitch? heorku?
Ok, thanks!
frick, tim had more options
lmao
if you're hosting at your own home pc, you can chose whatever port you want, BUT, you have to portforward that port in your router
basically this ```ts
let count = 0;
express.get('./myFancyEndpoint', (req, res) => {
if(req) count++;
})
That simple, then just fetch that count on another endpoint
vps? phone? pc? glitch? repl? heroku? heorku? dedi? rpi? nas? vm on nas? router?
earth? moon? mars? jupiter?
express.get('./usage', (req, res) => res(`Api used ${count} times`))```
universe?
vps? phone? pc? glitch? repl? heroku? heorku? dedi? rpi? nas? vm on nas? router? linux? windows? wii? fridge? brick phones? blackberry? ios? iphone?
modem
fuck amd but their drivers are pretty pog
look at this install @opal plank
intel legit died after that
client.channels.cache.get(interaction.channel_id).permissionsFor(interaction.member.user.id)```
doesn't intel still have better clock speeds?
ads at this point why not try a good lib, like detritus? wink wink
Well that's definitely the correct code, so if it says null, it probably means that there's no permission overrides available
do you like my logs Erwin?
i dont like the spacing, but thats good
though tbf at this point you should probably take the convo to discord.gg/djs
let run mine rq
so i need to ask for the guild instead?
this?
does anyone know
how to recover a thing
like
the F2F codes
or turn it off
without the code?
I kinda lost my phone
and cant sign in anywhere
litilary
You can get your 2FA backups codes
how
Discord settings
To disable 2FA yes
what is that ?
its just terminal logs
one sec I got some code for you
no even better

I HATE INSTALLING DRIVERS
write your logs to a printer and print them on paper
lol
print your logs onto a screen on the street's billboard and then attach a camera hooked onto a CVS camera monitor which is pointed at the billboard.
Then you simply use OCR to read whats on the screen and then print it to your terminal
that simple
defenetly.
step 1: be rich
I use the rotating billboard things
u havent said what you think bout my logs million
The one with triangle things
Bitch where do you think I got my format from
Oh?

ok I have returned
redirects me to chrome then to discord stable
but does it actually direct you to the server?
mhm
okay good
yesterday someone was saying ti didnt work
shame
@crimson vapor #general message
here
i wonder if development/canary isnt redicrecting it
likely
development is just canary with a fancy name
development IS canary
worked
you just look fancy cuz its black icon
meh as long as it actually redirects somehow it should be fine
don't worry about the 2 different discords
i have the same, not like i can bitch about it
on 2 different monitors?
got ptb, canary and development installed
yes, and one on chrome too
on chrome i have my alt
I don't have ptb
here i got my pmain on ptb
man
and i got canary on my spam acc
having branches for testing is good
specially playing with the SDK
actually
i think its recommended to dot hat
yup
canary is supposed to be my alt that owns my bot and server
but discord logs me out
idk wym
why wouldnt you want to link your main acc to your bots?
ah that

saferโข๏ธ
hmmmmm
remember the shit they pulled with nsfw servers a while ago
I also know about someone who almost got their acc deleted due to a "virus"
like he sent one by accident
A
@opal plank teach me detritus
you want to? unironically?
ok
just look at nsb
Erwin has never been so happy
Anyone here got a bunch of free time and is willing to help manually input data into a json file for an api? ๐
Detritus looks cool, just need to test it out some more
i am trying to make an error handler but this says "commands has no attribute to AttributeError"
how can i fix this?
That's because AttributeError is native Python, not part of the commands module
isinstance(error, AttributeError):
or just
isinstance(AttributeError):
Couldn't help but notice; checking if something doesn't have a send accessor seems like faulty logic rather than efficient handling. Errors which are in your control shouldn't have to be handled if you can logically make things graceful
Yeah, I'm not sure about that error handler
i don't have experience with error handlers
Well, why do you have it?
The errors emitted which are a result of your own logic are there to help you improve your logical abilities
i am trying to make my bot easier to use
Exactly, that error would only happen if you did something wrong in your code
yea..
Just because you remove the stacktrace doesn't mean the error won't happen :)
An error handler should usually be used to help users, like if your command needs a number but a user inputs a character, you should have something that tells the user they did something wrong, rather than just printing an error in the console
this is my code, i am trying to make this an announcement command that will send to all the servers my bot is in.
is it possible that the bot will choose one channel from each server's channels and send it there?
oh yea
can you edit a description of an embed once built?
from the code, yes
how?
you just change whatever you had and run it again
test = embed.description.slice(mention.length + 1)
then send test is only the description value?
your using python, right?
no but go ahead i can translate
oh ok
im srry
your selecting a channel, from a list of channels, if a guilds announcement channel is in a different language or dosen't use a name you have listed it won't work, you need to use a loop for all channels and find a channel with the type you want
oh thx
Hey urmm probably just an easy solution but how do you react to a message with number emojis ๐ Whenever I do \1๏ธโฃ Literally doesn't do anything
use their id
I'm pretty sure you should be able to edit an embed the same way you edit any other message, just pass a new embed as the parameter in the edit method
ctx.guild.text_channels lists all of the guilds text channels
Plus yea you can edit a embed description once it is built.
You do message.embed[0].description
using the edit function? or creating a new embed and passing that?
I don't use js, but I would guess both would work
No No No you can retrieve the data from the Embed and edit that message.
so if the embed is defined as message, it would be message[0].description = 'text'
correct?
First line retrieves the Embed Title.
Second Line gets the Embed (and turns it into an array based on each new line)
Uh
Because I only need to edit one specific line in my Embed and then I edit that message.
const sentMessage = await channel.send(embed);
sentMessage.embeds[0].description = newDescription;
sentMessage.edit({ embed: sentMessage.embeds[0] });```That simple
yeh not as simple as that for me but thx
don't ping random people
Does anyone have experience sending images generated by pillow(PIL) in a discord channel via bot?
They could be lurking right now
what does this mean?
Error: listen EADDRINUSE: address already in use :::19132
I am trying to fix it
but cant
how do i send images without saving a file to disk? right now i use image.save('filename') w/ PIL.Image class and it works but obv. it would be better to not save to disk every time i send a copy of the game board image
My code for the line is this
const dbl = new DBL(apiToken, { webhookPort: 19132, webhookAuth: 'BTSsucks' });
Isnโt 19132 for bedrock servers?
Issue is that you already have something running on that port
So I need to make new portforwarding?
but doesnt it not matter tho?.... Or it does...?
answer please....
why that tho
I am using 19175 now..
alr thanks anyways.
Well now its not responding at all when stats are posted...
Well its not even posting em..
| Error: The module '/root/bharat-v3/node_modules/canvas/build/Release/canvas.node'
3|bharat | was compiled against a different Node.js version using
3|bharat | NODE_MODULE_VERSION 83. This version of Node.js requires
3|bharat | NODE_MODULE_VERSION 88. Please try re-compiling or re-installing
3|bharat | the module (for instance, using `npm rebuild` or `npm install`).
3|bharat | at Object.Module._extensions..node (node:internal/modules/cjs/loader:1151:18)
3|bharat | at Module.load (node:internal/modules/cjs/loader:972:32)
3|bharat | at Function.Module._load (node:internal/modules/cjs/loader:813:14)
3|bharat | at Module.require (node:internal/modules/cjs/loader:996:19)
3|bharat | at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
3|bharat | at require (node:internal/modules/cjs/helpers:92:18)
3|bharat | at Object.<anonymous> (/root/bharat-v3/node_modules/canvas/lib/bindings.js:3:18)
3|bharat | at Module._compile (node:internal/modules/cjs/loader:1092:14)
3|bharat | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
3|bharat | at Module.load (node:internal/modules/cjs/loader:972:32) {
3|bharat | code: 'ERR_DLOPEN_FAILED'
3|bharat | }
๐
๐
I have node-:15.12.0
did you recently update?
try npm rebuild
all right delete your node_modules folder and run npm i
if that still doesn't work, try downgrading to v14 and repeat
okay
I want to make an AI powered chatbot in javascript
What is the best library to work with for ml
since there are not many for JS use tensorflow.
but be Aware ML can be quite taxing on your CPU, if possible get a GPU for ML stuff since it will greatly acclerate it
and what i can say for Running Tensowflow now for a few Months:
a singlecore VPS with slow Clock speed will not be fast enough for it
ok
yes
I suggest having a vps with high cpu clock speeds @delicate shore
lol
and at least not single core
I run my image ai on a dedicated server
has about 4ghz and 8 cores
You don't really neeed that much power for a text ai
but mine is an image one which is why it takes up more perfomance than a text ai
i have mine also running on a 6 Core Dedi with fast speeds, sure its text based but ive tryed to run it on a 10$ DigitalOcean Droplet, took a hot minute to make the Classification with Tensorflow also the CPU Usage spiked to 100%, Causing also the Resource Alerts ive set to trigger all the time
also Digital Ocean Droplet for CPU Optimized stuff cost like 40$/Month
node.js runs single threaded generally unless you code it like explicitly to make use of multiple threads (such as the worker_threads module)
and for 40$/Month its already better to get a Dedi with stuff like a ryzen 3600
which is why I suggest having high cpu speed
yea i have my AI running with Worker Threads and loadbalancing
i know
this is why ive got one
sure its a bit more than 40$ But i wanted also the ECC RAM upgrade
nah just saying in response to what u said with the cpu droplet thing
anyways having high clock speed is recommended anyways
even tensorflow will print it to the console if the cpu clock speed is low
such as 2.4 ghz
lol
also tensorflow has a seperate package for nodejs just so you know @delicate shore the main one is meant for the browser lol
6|bharat | Require stack:
6|bharat | - /root/bharat-v3/bharat.js
6|bharat | at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
6|bharat | at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:61:29)
6|bharat | at require (node:internal/modules/cjs/helpers:92:18)
6|bharat | at Object.<anonymous> (/root/bharat-v3/bharat.js:1:45)
6|bharat | at Module._compile (node:internal/modules/cjs/loader:1092:14)
6|bharat | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
6|bharat | at Module.load (node:internal/modules/cjs/loader:972:32)
6|bharat | at Function.Module._load (node:internal/modules/cjs/loader:813:14)
6|bharat | at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
6|bharat | at Module._compile (node:internal/modules/cjs/loader:1092:14) {6|bharat | code: 'MODULE_NOT_FOUND',
6|bharat | requireStack: [ '/root/bharat-v3/bharat.js' ]
6|bharat | }
I have bharat.js file๐
Hey guys, curious if anyone out here has experience with mongo+docker. I've got a bot in one container and my mongodb in it's own container which is supplied by docker. Whenever I restore the data dumps into the container it dumps fine into the test db but I can never get it to restore to any other db I want. Any ideas? The error above is before of it trying to place the same into test so there's "duplicates"
Still it
I know there is a web hook section of top.gg am I able to use a Discord pre-built webhook?
discord Webhooks wont work
๐ I see that's a lot of work though
how did you make it persistant? syslinks or Volumes?
yes I figured that out
How can I get the time of when an user left? (java jda 4.2.1)
cough cough what
cough cough what
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.
๎บง does anyone know what i have to do or do i just wait
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
There's nothing you can do other than waiting
do u know how long?
because my bot is on top.gg and i dont want them to take it off because it is offline
It depends on what ratelimit you exceeded through the API
And they're dynamic, so we don't know
ok
429 responses are avoided by inspecting the rate limit headers documented above and by not making requests on exhausted buckets until after they have reset this was the one
That doesn't tell which ratelimit you exceeded, it probably gave you a URL pointing towards the endpoint you were trying to make a request to
If not, the library you're using probably has a ratelimit event which you can listen to
That doesn't make any API requests
oh ok
a guild
you could listen to the memberdeleted event or how its called in jda and check the current time
Can someone help me with JavaScript?
provide the code, issue you have, what the intended behaviour and what have you tried. Then maybe someone can help you
have you tried docker cping the backup into the container first or mounting a volume you can move the backup into if you're doing it manually?
Does anyone know why I don't exist in guild.members.cache collection?
did u enablle intents?
If you're not cached, just fetch
or that
await guild.members.fetch("some id")
good morning. and yes i haven't solved the yesterday issue
you can do fetch()
enable intents
or you can also request every chunk_member from discord and cache everything on startup after identify
i think d.js does that by default iirc tho
Add await guild.members.fetch() on the top of your code if you want to cache all members
show code
hang on
members.cache.fetch is indeed not a function
But Erwin is wrong. DO NOT cache all members pointlessly
You don't need it
just fetch one member when you need them
yeah
await guild.members.fetch("some id") is fine
d.js does that by default tho
No, it doesn't
it does?
d.js does not autofetch missing uncached members.
Hi, can anyone help me please. I dont know what i have to do its working on my own computer but not on cloud vps
update discord.js to the latest version
nvm it is false by default
let DaGuild = client.guilds.cache.get(interaction.guild_id)
let DaMember = await DaGuild.members.cache.fetch(interaction.member.user.id)
console.log(DaMember);```
i could've sworn they did it by default
no they don't
in fact they disabled it
i will try it.. thanks
now, yes
That's removed in master
here's my code
but im certain they did cache chunks on startup for members
d.js hasn't auto-fetched all members by default since before my time starting to use it
you've always had to fetch members that weren't cached.
clearly you're not listening
Read this again and pay attention
how about guild.member(user)
it actually worked! thank you!

const vip = await guild.roles.create({
data: {
name: 'MB10',
color: 'BLUE',
},
reason: 'role for the game attenders',
})```cannot read property roles of undefined??
guild is already defined
it might be a variable that's been declared, but its value is undefined
I can finally get perms from the user thank you!
I updated but nothing changed.
same problem
and @opal plank you too :)
hmm strange
why tho
Then it clearly didn't update correctly, that problem was caused by stage channels being added. It 100% broke discord.js v11 which is no longer useable, and requires discord.js 12.5.3 and higher
probably guild is not cached or id invalid
where is this code? in your ready event? or what other event?
in my message event
Then yes definitely that ID is not a proper guild ID
huh
just right click on a server right > copy id
734123033782124575 this is what it returns
ok well, either you're not doing it correctly, or this isn't actually in the message event.
show more code
and try to use codeblocks not images, it's easier to read and help.
There ya go.
it's just at the top of my code
won't work, it needs to be inside an event.
aha
h
could I know how to make sure if something in an api works using code?
https://api.slothpixel.me/api/players/willowspeony <--- player with no wins, go towards stats.BedWars.gamemodes.solo (this doesn't have BedWars.gamemodes.solo.wins)
https://api.slothpixel.me/api/players/willowsrose <--- player with wins, go towards stats.BedWars.gamemodes.solo (this has BedWars.gamemodes.solo.wins)
so if the api doesn't include stats.BedWars.gamemodes.solo.wins, it would just return 0
What code do you have now that we can help you with?
or should this be in #topgg-api
@umbral zealot yeah my bad, its indeed set to false by default . How did it used to cache them then if its not lazily cached?
No #topgg-api is for the top.gg api only
let solowins = player.stats.BedWars.gamemodes.solo.wins;
.addField("Wins", `${solowins.toLocaleString()}`, true)
main code ^
members can be automatically cached if they are online and send a message, since the discord API sends member payloads on some incoming events.
ah that explains it
that part of the api isn't there
but if they have one
it would return a digit
aka 153 wins
so i want it to return "0" if player.stats.BedWars.gamemodes.solo.wins doesn't exist
how do i deny read messages of @everyone ?
solowins || 0 would work fine. it'll be undefined if it's not in the payload, and that triggers the "or" which is 0
it would return this error if the player doesn't have a win
TypeError: Cannot read property 'toLocaleString' of undefined
(solowins || 0).toLocaleString()
@umbral zealot This mean's i have to make the bot one more time ?
you need to read this: https://discordjs.guide/additional-info/changes-in-v12.html
okay thanks
k
how to i deny @everyone to check a certain channel?
i have another question, if i had this digit 2342.23154 but i only wanted it to have 2 decimal points, but also have the comma for the thousands, what would i need to use?
my current one is ${test.toLocaleString()}
(test is the number)
but it returns a 3 decimal place
use channel permission overrides
yeah i already saw that in the docs
but how do i get the @everyone role then
owwh okay
TypeError: (solofinalkd || 0).toFloat is not a function
f
i added the (2) at the end
worked but didn't add the comma for the thousands
i searched, but it would always just return 2 decimal points but not the comma
lmao
Maybe use both these things, chained ๐
tried
${test.toLocaleString().toFixed(2)}
or would i have to do it like
${((test || 0).toFixed(2)).toLocaleString()}
I mean, you're using toLocaleString, how does javascript know which locale you want
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString the docs indicate how this is supposed to be done.
it works for other values, just this
@umbral zealot Will work this if i dont want to replace it at all ?
let embed = new RichEmbed().setTitle("Works the same");````
Read the link I sent you and follow it.
You have a lot of work to do, a lot of changes, so you need to take the time to read through and understand all these changes.
js should know the locale, i already did that, just the part where i'm not sure how to chain those two together
Invalid bitfield flag or number. uhhhm:
const channel1 =message.guild.channels.create('MINIBOSS MATCH', {
type: 'text',
permissionOverwrites: [
{
id: vip.id,
allow: ['READ_MESSAGES']
}, {
id: message.guild.roles.everyone,
deny: ['READ_MESSAGES']
}
]
});```
what am i doing wrong?
yeah I think I know. toFixed and toLocaleString both only function on numbers and return strings, so, you'd have to do like a triple conversion.
huh?
and how would the triple conversion function?
getting the number, doing the toLocaleString, then putting it in the final embed with toFixed?
so do i do it the exact same way?
why... wouldn't you just literally use message.guild.id ?
yeah try it
okay
i am trying to create a new channel?
no I mean instead of id: message.guild.roles.everyone,
just use the guild id directly
evie
${((test || 0).tofixed(2)).toLocaleString()}
i'd have to use this?
for the or function
it's time to start trying things and figuring things out instead of asking me to handhold you, my friend.
you have all the pieces, you can figure it out.
ty

it still gave me the same error tho
also READ_MESSAGES is not a valid permission
maybe that is where it's coming from
err, sorry for asking again, but after doing what you told me, the whole command just stopped functioning
oh, returned an error
TypeError: (test || 0).tofixed is not a function
;-;
wait
shit
really just proves how idiotic i am sometimes lmao
still doesn't work aaaa
not the camelCase part
something else
${(test.toFixed(2)).toLocaleString()}
lmao
still doesn't add commas
am i stupid or am i stupid 
changing a number
Number(test.toFixed(2)).toLocaleString()?
so what would we put then?
if that returns a string then the .toLocaleString is trying to get test, what would we do?
what would Number be?
...the Number constructor?
because ${test} is the var with the number
๐ฉ
oh yes try putting Number(test.toFixed(2))
number.toFixed() returns a string
It doesn't matter if number is a number or not
string.toLocaleString() will return the same string
is there a certain way to have a reaction collector without a time limit?
Yes, but why?
as users can determine whenever they want to close the channel
so no time limit wanted
const collector = message.createReactionCollector(filter, { time: 15000 });``` like that time indication is not really wanted in my code
You'd want to use the messageReactionAdd event since collectors die after restart
okay so that's a cool event, but is it possible to put that event within my message event?
What do you mean?
because this is a new event right?
Yes
Is it possible to put this event inside of my message event?
Why? It's an entirely different event
okay yeah nvm
@earnest phoenix
okay
just replace the random numbers with the test variable don't change *100)/100
wait
but how do i make the reaction event work on only 1 specific message defined with the variable message1
Question.
const object = { name: "HamoodiHajjiri" };
If I try finding a property in this object called age and there was no property.
What does it return?
undefined?
If I want to make an if statement that checks for this, do I simply do if (!object.age) return;
Yes, but be careful with numbers
If the property's value is 0, it will also return true
It's better to use if (!("age" in object)) return;
or if (obj.age === undefined) return;
Yes, wanted to ask about this.
You don't need to do that every time, just for properties that potentially have 0 or false as value
.. but sometimes that property doesn't exist at all, so?
"property" in object returns a boolean
Keep in mind that if you put "toString", it will also return true. If you want to purely check for the object's properties, use obj.hasOwnProperty("prop")
.. well this is better, to check for the object's property.
For instance, "toString" in obj returns true while obj.hasOwnProperty("toString") returns false
okay now i am getting confused. js const channel1 = message.guild.channels.cache.find(c => c.name === 'miniboss-match1') let s = await channel1.send('**The match will begin shortly! Please react with :skullemoji: to accept the battle!**' + "<@"+`${vip.id}`+">")so why is this returning: TypeError: Cannot read property 'send' of undefined
channel1: Discord.GuildChannel|undefined
check if it returned undefined
it did indeed send me undefined
does your guild have channel named miniboss-match1?
yeah
i am creating it
message.guild.channels.create('MINIBOSS MATCH1', {
this translates to miniboss-match1
ohh
is this line of code located in the same event with this?
Show your code
yeah under the same command and scope
okay let me bin it
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
line 39 is where the channel1 is defined
await the method
put await
You can just use const channel1 = await guild.channels.create();
and use the returned value. don't get from guilds.cache
okay i put await there
still returns me the same error
const channel1 = await message.guild.channels.cache.find(c => c.name === 'miniboss-match1') ```
no
no?
use this
and then remove this line
okay
const channel1 = await guild.channels.create('minibos-match1')
await channel1.send('...')
wouldn't this create a channel?
But i already have that channel created above it
yes
But this also creates a channel...?
you can do a check
cache.find() ?? await channels.create()
this parse-ms package doesnt want to work for some reason
const channel1 = guild.channels.cache.find ((c) => c.name === 'miniboss-match1') || await guild.channels.create('miniboss-match1')
normal MS package should do it just fine
it can convert into both ways, ms to human readable and the other way
if you want to make it more fancy you can add a option to it
ok
Bruh, this Dank Memer bot owner says this ...booting the entirety of node 2.
What do they mean by node?
since its a large bot they probably hve the bot running across mutiple servers, and node 2 is probably one of them
yeah could be that, yes
Hello, anyone know the best way to shuffle a json object?
Example:
{
"Item 1": "Value 1",
"Item 2": "Value 2",
"Item 3": {
"Sub-Item 3": "Sub-Value 3"
}
}
Should shuffle into something like:
{
"Item 3": {
"Sub-Item 3": "Sub-Value 3"
},
"Item 1": "Value 1",
"Item 2": "Value 2"
}
why did you need this?
Shuffling an object will be a lot harder than shuffling an array
theoretically, it's the same
Oh, thanks! :)
you can just create a new object
My guildMemberAdd event is not firing
But other events are working fine
Do I need intents for that too ?
which one ?
guildMember ??
GUILD_MEMBERS
https://discord.com/developers/docs/topics/gateway#privileged-intents
and
https://discord.com/developers/docs/topics/gateway#guild-member-add
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
My bot is on discord.js v12 and just throws messages about joining the server twice. Is there a solution?
you probably have two listeners for the same event
how so?
i don't know, it's your code
let me see now
I'm trying to use a specific API, but part of the api uses digits, how could I use it?
??
player.stats.BedWars.gamemodes.3v3v3v3.items_purchased;
that's the api part
3v3v3v3
uses digits
player.stats.BedWars.gamemodes["3v3v3v3"].items_purchased;
no
Go ahead and ask your question
im making a command that has a cooldown for each server but when i add the server id to a set it doesn't work
bot.cooldowns.add(message.guild.id);
if i do a normal string it works tho and message.guild.id is defined
show us some more code
bot.cooldowns = new Set();
You need to show us more code: where you're handling and invoking the cooldown
ok
im doing it in a command handler and the code is
console.log(bot.cooldowns)
if(bot.cooldowns.has(message.guild.id)) return message.channel.send('Cooldown active โฑ');
var bumped = bot.bumps.find(s => s.id == message.guild.id)
if(bumped) bot.bumps.splice(bot.bumps.indexOf(bumped), 1); //remove already bumped and add it again
var query = await db.query(`SELECT * FROM servers WHERE id='${message.guild.id}'`);
if(query.rowCount == 0) return message.channel.send(`${message.guild.name} isn't published!`);
const server = query.rows[0];
bot.bumps.push(server);
bot.cooldowns.add(message.guild.id);
message.channel.send(`Bumped **${message.guild.name}**`)
setTimeout(() => bot.cooldowns.delete(message.guild.id, 1800000)); //30 minutes
}```
You're immediately removing the cooldown because you put the time in the wrong method call.
OHHHH
It's in .delete(A, B) where B is the time.
im so dumb thanks
setTimeout(() => bot.cooldowns.delete(message.guild.id), 1800000); //30 minutes
Just so you know, if your bot crashes or restarts the cooldown will be removed
In my opinion you're better of caching or saving it to a database
yeah im aware
i have the servers stored in a database i just couldn't be asked doing the cooldowns and bumps too
(:
Just finished porting one of my bots to my discord lib! The results are in ๐
https://media.discordapp.net/attachments/825407339254644779/833343438560559135/unknown.png
https://media.discordapp.net/attachments/825407339254644779/833343505253269554/unknown.png
Aegis (old lib): 331mb RAM, 1117mb virtual, 0.7% cpu, 15 threads
D++ (new lib): 187mb ram, 820mb virtual, 0.0% cpu, 8 threads (2 are spdlog)
Online Users 450,617```
44% less ram ๐
ayyy awesome
and bearly registerable cpu
if this proves stable i'll make that live, and then work on porting triviabot
nice
im gonna do what you did eventually, idk when but i will
i have a few ideas like that
its running on test mode atm... runs just like live, except all outbound messages are squelched so i dont get 2x output
but in js
what, make your own more efficient js lib?
ye
More efficent again?
ye
nothing like discord.js
discord.js is an abomination
djsl only makes it marginally better, but its still a clusterfuck
Ya
i heard that eris is better in efficiency?
what
is redis faster or vars on cache?
depends what you're using it for
just to cache some objects
if it's using predictable keys, redis is good for that
Why can't the bot be used?

we'll see :^)
variables will always be faster than anything else
because they are inside the program's own memory
redis is a separate program, with a separate memory, so accessing the memory of a different program will always be slower
okay
hi Tim
hi Million
hi Erwin
Hi flazepe
hi Woo
Say no to hi!
can I put false in message.guild.members.fetch() to make it not save the cached members?
Yes
OK
200
my bot has his members intents verified but it shows cached users :/
Specifically, it has to be passed as an object with cache set to false. js // Fetch a single member without caching guild.members.fetch({ user, cache: false }) .then(console.log) .catch(console.error);
Do you have your intents enabled on the dashboard and enabled in your source code?
๐
Wait I have it verified on the Dev portal
How do I enable in the code ??
What library are you using?
And you need to enable fetch all members(in most libraries now)
Djs
You should be able to enable intents from your source code like so:
const client = new Discord.Client({
ws: {
intents: [...]
}
});
You can then specify the intents as strings in the array (see https://discord.js.org/#/docs/main/stable/class/Intents?scrollTo=s-FLAGS)
oh thanks
Is it possible to fetch all members of a guild without caching?
Yes.
How?
Look through the docs before asking here because most of the time the docs have the solution. Another option is stackoverflow which I am sure someone has asked the same question.
hi
its the official server for top.gg which is a discord bots list
hey @sudden geyser my bot stopped replying :/
Make sure you're subscribing to the intent for new messages
disableEveryone: true,
ws: {
intents: [ `GUILD_MEMBERS` ]
}
});```
we have to do this
right?
aka GUILD_MESSAGES and DIRECT_MESSAGES
If you want to receive events for when a message is sent in a DM
If you don't want it, you don't need to include it
this one
That's not an error. That's some source code
not that
i m saying when i used that
Seems it's coming from the discord.js and discord-logs dependencies.
i know
i tried reinstalling
it
but no reply
and same thing
@sudden geyser u gone?
hmm
Lite is Typing ๐
I'm still here. The error is a bit vague up front, but jumping into the library source code brings up this:
return this.guild.roles.cache.filter(role => this.member._roles.includes(role.id)).set(everyone.id, everyone);
Notice the role.id and everyone.id accessors. Maybe everyone is undefined for some reason, but this is internal library code.
owo
where should i add this?
Maybe the error is fueled by a missing intent, such as GUILDS
that shouldnt be the case
as my intents are already verified
GUILDS accounts for a number of intents.
Try adding it to your intents array and see if it solves your problem
ok
GUILDS is needed iirc
wdym by iirc
iirc = if i remember correctly
common phrase used between developers
ohk
lemme try
i dont know these things as i m not a dev
this is my brother's account
thanks for ur info
It's commonly used in general.
Show the code for index.js?
disableEveryone: true,
ws: {
intents: [ `GUILD_MEMBERS` ]
}
});```
pretty sure it's GUILD_MEMBERS
Usually I don't enable GUILD_MEMBERS intent via the client and just enable them on the developer portal.
thats already done
hmmmm trying to think why.
you need to enable it on the portal and in your client and its GUILD_MEMBERS
i doubt its got ` around it
its probably a numeric constant
but i dunno, not a js guy
You need to do both to get the data
Only that intent?
You need GUILDS too
Works perfectly for me if I only enable on the developer portal but mk.
i m using ${client.users.cache.size}
I would just advise use <Intents>.ALL
Your library most likely handles that for you then
That's inaccurate
and don't use all intents
It would be a waste of memory
Use only what you need
i have to use another code rather than ${client.users.cache.size} ?
for fetching the amount of members
Yeah since the library won't cache all users
You'd have to loop through all the guilds and fetch all members which is not recommended
You can use guild.memberCount instead
that will take huge amount of resources ig
If it's small like 10 guilds or so it should be fine but once it goes to 50+ it's gonna take too long.
Yes and WebSocket calls
ew
what should i do
why not just keep a counter
count all the members youre interested in, keep that count and adjust it as people come and go
yea but they are not unique users
their not?
also isnt that cached ?
ive seen the member count be very different from visual and actual cached
in my discord, my bot see's 49 member count, and when i do a the math of what i can see, thats not the correct number, so i have no idea how it does this
my bot see's 8 mystery members in there
if a guy have 5 guilds with only him and the bot, the bot will say that he has 10 users
so idk
rly confusing
const levelInfo = score.level;
const card = new canvacord.Rank()
.setUsername(user.username)
.setDiscriminator(user.discriminator)
.setRank(rank)
.setLevel(levelInfo)
.setCurrentXP(xpInfo)
.setRequiredXP(nextXP)
.setStatus(user.presence.status)
.setAvatar(user.displayAvatarURL({ format: "png", size: 1024 }));```
```js
(node:16864) UnhandledPromiseRejectionWarning: Error: Level data must be a number, received object!
at Rank.setRank (C:\Users\gamin\Downloads\leveling-bot-main\leveling-bot-main\node_modules\canvacord\src\Rank.js:322:45)
at Object.execute (C:\Users\gamin\Downloads\leveling-bot-main\leveling-bot-main\commands\rank.js:58:6)
at Client.<anonymous> (C:\Users\gamin\Downloads\leveling-bot-main\leveling-bot-main\index.js:117:13)
at Client.emit (events.js:323:22)
at MessageCreateAction.handle (C:\Users\gamin\Downloads\leveling-bot-main\leveling-bot-main\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)```
i tried this but ```const client = new Discord.Client({
disableEveryone: true,
intents: [ GUILDS_MEMBERS ]
});```
users are still cached
i m using client.users.cache.size
Hown to downupgrade node
Use node version manager
downupgrade downgrade
it is GUILD_MEMBERS and are you using master branch?
what is the master branch?
Guessing that's a no
and yes i m using guild members only
the in development branch
not guilds
You still need GUILDS
Instead of fetching all members, create a counter like Brain said for unique users
You can use message event so add GUILD_MESSAGES intent too
How many servers is your bot in?
100 something
Yeah you shouldn't fetch all members
They even removed that option in ClientOptions on master
but why?
Because it's a heavy task + you can get rate limited easily
i want to see how many users are in total number of servers
Is it really worth all the hassle?
earlier i used client.cache.users.size ad it worked
The bot isn't going to fetch all members on startup
from the PR of new in development guide `ClientOptions#fetchAllMembers
The ClientOptions#fetchAllMembers option has been removed.
With the introduction of gateway intents, the fetchAllMembers Client option would often fail and causes significant delays in ready states or even cause timeout errors. As its purpose is contradictory to Discord's intentions to reduce scraping of user and presence data, it has been removed.
`
If you don't care, then just add this to your ready event: js for (const guild of client.guilds.cache.values()) await guild.members.fetch();and use client.users.cache.size
That'll fetch ALL members throughout your guilds and cache them
ok
and I don't recommend you doing that
But if you don't care, then fuck it
Do it, I don't care lmao
You need these intents: GUILDS, GUILD_MEMBERS
lol
yes it slowly loads
and after that it loads
hi is there anyone who can help make a welcome message for my bot
if your using discord.py. Read the docs on how to use the on_member_join event
i use discord.js
then guildMemberAdd
yea
it will be like this
client.on('guildMemberAdd', member => {
console.log('test')
})
and btw
thx
If I had an array like so:
[
{
"name": "hello bob",
},
{
"name": "hello rob",
},
{
"name": "bye rob",
},
{
"name": "bye bob",
},
{
"name": "rob bob",
}
]
How would I use js to remove all the items that don't contain the word bob in the name property?
u need to activate Privileged Gateway Intents from discord developer portal
wtf
ok
it always gives me that error and i cant find the problem
I don't know if anyone has touched 3D rendering libraries for node, but if for some miracle anyone knows about it, let me know. Please, I'm desperate
please
did you tried to fetch to discord api
?
k
use Array#filter
<Array>.filter(item => item.name.includes("bob"))
thanks it working ๐
i forgot this =)))
np
just ping me when need
anyone knows how to use the three.js library for node?
is there a way of me turning google.com into a url?
does it turn the string into a valid url?
Yeah
ight bet thx
what to do when the lighbot is offline?
any example?
Like google.com to https://google.com?
its not always going to be google, i used that as an example
its empty
That was just an example
I'm not sure what you mean by "a string to valid URL"
trying to turn whatever the argument is into a valid url
its not there yet so i've putted everything that realted to that in //
or i missed something?
Can't you do const url = new URL(string.startsWith("http") ? string : `http://${string}`);It'll error if the URL is invalid
bet thx
hey so i have a text file that contains multiple usernames like the picture above. The variable is called haha: let haha = filtered.map((x) => x[0]); and i am searching the id using: let z = haha.map(name => client.users.cache.find(({ username }) => username === name)). Would that give me all the ids of everyone in the text file?
Example of URL objectURL { href: 'https://google.com/', origin: 'https://google.com', protocol: 'https:', username: '', password: '', host: 'google.com', hostname: 'google.com', port: '', pathname: '/', search: '', searchParams: [Object], hash: '', cannotBeBase: false, special: true, [Symbol(context)]: [URLContext] }
idk show the code
what do you mean
what if the url is http://somethingveryshitthatsnotvalid.com
I'm stating the source of your error.
where you used dblapi
Use node-fetch
It's coming from the .setRank method call.
which lines?
let rank = top10.sort((a, b) => {
return b.totalXP - a.totalXP;
});
if (!await fetch(url).catch(() => null)) return "invalid";
oh yeh thx
where you used dblapi
That's still going to be some kind of collection. It expects a number, but you're giving it an object (most likely an array)
@fierce ether Actually, you don't even need URL for that, just use fetch
const url = string.startsWith("http") ? string : `http://${string}`;
if (!await fetch(url).catch(() => null)) return "invalid";```
just fetch and check for invalid?
Yeah
Node.js has a module for handling URLs appropriately.
did you checked your dbltoken?
in what website i can recheck it?
They also want to check if the URL is accessible, which can only be done by fetching the URL (if it's invalid/inaccessible URL, it will error anyway)
this is what haha returns:


