#development
1 messages · Page 953 of 1
Is there any internal way of doing it?
Like shards communicating?
I'm not sure about how to use that
i mean it sounds like djs has broadcastEval
Discord.js sharding already uses IPC
yos
yeah it looks like broadcastEval already does it for you
fetchClientValues etc
fixed it yayy
glitch has been down for the past couple of days
just cleared the elements
i would also recommend getting a vps or self hosting
heroku is bad
why?
because it is lol
can't argue with that lol
also @earnest phoenix you spelt repository wrong
user id
because i made 2 bots
but nice css
also #memes-and-media
o
To test with the new rate limit for channel updates, I renamed a channel to 1, then 2, until 5 using eval command. The name was 1 and then it was waiting for the rate limit. Then, it renamed to 5 and then 4. Isn't that really weird?

It renamed to an earlier given name
:0
thats WS latency btw
so it is good in someway
Hello
Does anyone know how to get your bot online 24/7
get a vps
Without that
impossible
yes it is good
Try it , it’s from your cmd or powrshell and then your set
Maybe that’s I
I didn’t try it yet
But it processes our bot
What else
Hello guys
Add my bot to test it pls
Codelyon
It’s not online now
It will be in 20mins
approval can take 2 weeks
I know but pls add to test it
no
lol
-faq 2
Why
because you're not alone
-upto
The FAQ clearly states that it will take UP TO 1 week or more.
This does not mean it will take a week and does not mean it will take less than a week.
There is no set time for how long bot approval will take.
There is a queue and you're not first, nor are you last.
other bots are waiting to be reviewed before your bot
No
there is a queue.
But my friends don’t have discord
Generally, we don't test people's bots on request here. Chances of finding someone willing to test your bot here are quite low
Ok 😕
i made a bit of a mistake with my bot. i am using the outdated way for commands. i am trying to make these work with the commands extension. In the docs it says to add await bot.process_commands(message) on the end of the on_message event. do i have to do this after every message.content.startswith or just that one on_message event?
Are you doing your commands in on_message
yep. thats the issue. and i have too many to go back and change them all
plus a few of them wont work on the command extension
bot.process_commands is for internal commands created by discord.py's commands extension
You don't even need it if you are using on_message for commands 
oh ok. but i want to add some more commands using the commands extension along side it if possible
is there not a way for that?
I don't see a reason to use both at the same time tbh
You can do that though, just put the process_commands thing in the end of your on_message event
thanks
yep. thats the issue. and i have too many to go back and change them all
@ripe epoch I had too many, I changed them all xD
I didn't mind using on_message but I needed to make the prefix cutomisable
fair enough
is there a way to get the time your bot was offline? Or better: is there a way to know when the client is not active anymore (isn't reacting to commands etc.)? And for that, I also mean things like the host that goes offline etc.
use some bot which tracks other bots uptime (that bot can have downtime too so keep that in mind) or use a professional service like sentry
okay thank you
in the guild invites thing is it total uses or uses of people still in the server
wait nvm
i needa do the tracking and everything myself
how can i solve this error ('SSL is not supported.') in python
do research on the issue
i searched i dont found anything useful
tldr certs on windows expired and you need install new ones
i know but where i need to install is it root certifaces or something
yes
oh
root certifaces
Hello
hello
https://discordapp.com/channels/264445053596991498/272764566411149314/717345220123033670
You can use Microsoft toolkit to activate windows for free if your windows expired
uhh
how can i get the access token (discord oauth2)?
what do you mean wtih accsess token
i want to make a 'login with discord' button, and i read some articles in thze web. And there stans something with access_token
idk
i use the discord-oauth2 api for node.js
I believe you get the access_token as a query parameter after the person authorizes
Try follow the discordjs.guide tutorial on it
Actually you get granted an authorization token which then you must exchange for an access token
This post describes OAuth 2.0 in a simplified format to help developers and service providers implement the protocol.
and remember that discord oauth2 does not accept json as request, but an url encoded string
There is a useful discordjs tutorial on it
You may not use discordjs
But it's still valud
implicit grant tho
for a site, implicit grant is a bad idea
^
Wdym by implicit grant
an implicit grant is an oauth2 request withing the url
the difference between implicit and normal grant is basically GET vs POST
one is easier, the other is more secure
@ocean socket
Hey
so I’d assume it’s just a dB of all guild IDs and a prefix
def func(bot, msg):
return bot.prefixes[msg.guild.id]
bot = commands.Bot(command_prefix=func)```
discord.py internally calls func and gives it the bot and msg arguments respectively
bot.prefixes is a dictionary that you create right after declaring bot
Oh command.Bot does that itself?
discord.py internally calls
funcand gives it the bot and msg arguments respectively
Yeah, it uses the function object and calls it
All you need to do is return the prefix you need
Nvm figured it out myself
how can i limit the amount of songs in a playlist so people can only play playlists with like 6 songs in them and not 200, so i dont get ratelimited
i use erela.js for my lavalink client btw
check the length of the playlist
ik but how do i check if they play a playlist
try using yt-search
ok
wrong channel
Sorry.
np
i (was) know
?
youtube-playlist will returns an array with the items, then you can just do
if (array.length > 6) // do something. [@hardy vector]
@earnest phoenix isnt that for ytdl?
i use lavalink
@grand dagger No I meant just text, since embed.addField requires two arguments, a header and the bottom text.
just set the title to a zero width space
that's that addBlankField do in v11
oh
you have to do it manually now because it was removed in v12
ah
how is that possible to put reactions so fast as @earnest phoenix? try §help
Bots don't have bots, silly
ping me if anybody answer
im using quick.db but like version 6.3.2 or 6.3.1 and im trying to get something using db.fetch('userItems', { target: ".achievements" }); but it returns as [object Object]
show part of code
@earnest phoenix hold on
@earnest phoenix the rate limit for reactions is 1 per 250ms
but most discord libraries dont let you fully use this

to prevent potential timing issues that could cause it to hit the rate limit
okay may i edit src of lib? xd
@quartz kindle What about discord.py?
I see.
im trying to get this to semd the stuff in the achievememts table
[ { achievements: 'Noobie' } ] is what it returns
I want it to return just Noobie, etc
I gave up on db and use json :)
how do if fix this
Oh well I made a currency system using json
and you'll have many problems later down the line
true
mainly corrupted data and slow response times
mainly corrupted data
Hmm
@quartz kindle hey man u usually help me out could u help me with somethin
I think you exaggerate
No
you're thinking wrong then
Didn't encounter any problem
you're writing to a file which is a blocking I/O operation
bal, give, rob, made everything
@unborn steeple fetcher[0].achievements
dont use json
Got it
plus good luck maintaining size on disk with a json database lol
actual databases compress their data
Damn, Ty for enlightening me
i had like 12 prefixes and it corrupted
Never happened but I got it.
ive been playing around with mongodb and mongoose and its great
I will rewrite everything to work with a db ×_×
tbh saving to mongoose is easy.
"MongoDB stores data in JSON-like documents"
yes but mongo isn't json
the chances of mongo corrupting are very low
mongo stores in bson iirc
mongo is bson iirc
json files corrupt very easily
mongo stores in bson iirc
@earnest phoenix yeah that's what gets exported if you mongodump
also mongo is easy to manage
plus, since mongo is an actual database, it does more than just store data, it handles concurrent connections and more
I will start right away then, ty for suggesting me that.
Good that I didn't face any corruptions yet xD
@quartz kindle fetcher[0].achievements would only show the first achievement tho wouldnt it?
im tryna get it to list all
use loop
That would be the first fetcher's achievements
If you want all of them use a for or forEach loop
Or map them
for...of
lol i think ima map them
like fetcher.map(f => f.achievements)
^
It's an array right?
who can help me
What do you need help with
I want people who don't have 1 command or 2 invitations on my bot
Wdym
your ⛵
lol
Lel
i am changed message content
It's fine man, it is just a joke
What do you mean by 1 command of 2 invitations
wdym by "don't have 1 command"
@flat pelican are we allowed to talk in other languages here?
I want people without 2 invitations not to use my bot's commands
huh
i am translating xD
what invitations
people without 2 invite links?
people who hadn't invited 2 other people?
what language do you speak
sen Türksün?
i am turkish
Ah
no
Oh ok
No other languages here
English only
#memes-and-media then
Or dms
hey, does anyone know how to make a progression bar using canvas (in js) ?
who can help me
We can't really understand you
google translate sending error xD
what do you want to do
check if a user has invited 2 other people
or check if a user has 2 invite links
We need someone who speaks Turkish
ı want people with 2 invitations to be able to use the / js command, how can I do
Is it like an invite manager thing?
That tracks invites
And you get rewarded with a command?
hey there!! I need some help quick. I got 1 stable bot and 1 beta bot. The stable one is currently offline because the code keeps logging in with the beta bot. But there is no other token than the stable one's in the code! how to fiw that? is that cache? thank you!
and the token isn't from another file
read your token from an environmental variable / .env file
Where do you store the token?
in the code.
@golden condor it throws an error Cannot read 'map' of null or something like that
is that bad?
show code @unborn steeple
kind of
Please could someone help me ? I get this error when running this script : Cannot send an empty message
https://pastebin.com/8Fu21sWC
im on discord.js v11.6.4
it's not suggested to hardcode tokens because you might leak your token when sharing code
you're sending an empty message
oh ok
simple: js token = 'token....'
yes but where
the array you're mapping is null, just saying
and is there a token there
What is it defined as @unborn steeple
in the top of the code
also refresh it
the map?
so stop the code @spice smelt
I mean the thing you are tryna map
should be an array/collection
im tryna map this hold on
should be an array/collection
^
the fetcher
I wasn't editing the right document XDDDDD
still null though
Log the thing your tryna map (debugging 101)
with discordjs v12, how can I get the channels that are in a category? Do I have to hard code it and check for every parentID of every channel in the guild or is there a property somewhere that I missed?
i said fetcher and edited it to award and then changed it back to fetcher lmao
with discordjs v12, how can I get the channels that are in a category? Do I have to hard code it and check for every parentID of every channel in the guild or is there a property somewhere that I missed?
I'll check docs sec
You can get all the channels and filter by category name or id
you can filter them by channel type
Actually, you could filter the channels with the parentID of the category
ok
Wait you can get this
just get parent name
<CategoryChannel>.children
nah
Which is a collection of GuildChannel
previous one was easier
They both work
what?
Surely if you have the Category object you should use that
it's less work than filtering
^
we're not filtering
just check the channel
but they wanted all channels
Yeah but Lumap wanted all channels inside a category
that's one channel
how can I get the channels inside a category?
you can easily use map for that
and that's less work than client.channels.get(categorychannelid).children?
<GuildCategory>.children is easier
yes
It's djs V12 btw
https://oliy.is-just-a.dev/2opwmm_4096.png see it does the same thing in the back anyways
but instead it's just a function call instead of coding it yourself

dude
It works kthanksbye
message.guild.channels.cache.filter(x => x.parentID) no?
What
those are channels that is inside a category
filter needs to run the condition for each channel
you have a point
get(..).children is a cache lookup
^
Anyway this is pointless Lumap is gone anyways lel
even that uses filter
no wonder why d.js is so poor in performance 
It's literally the same thing lmao
You are the one who was arguing to use a filter this whole time
?
i fixed my mapping issue but ifo rgot how to add spaces inbetween each think in thr map
In map you can do .join at the end to add spaces
map returns an array
so get(..).children would actually be slower since it's O(1) lookup 
what
it is
No it's the same
wtf
Surely it's the same no?
you're doing that for every category instead of just ONCE
how to get an emoji from id ?
get it from guild/client
get(..) needs to find the channel first which is one lookup
children is another lookup
It really doesn't matter anymore
instead of calling filter directly on the channels collection which is O(n)
^
TypeError: Cannot read property 'users' of undefined```
i tried working with "klasa" package but it gave me this error inside the package
oh performance matters especially when using d.js
klasa?
yeah
Like commando
const { Command } = require("klasa");
ic
i wonder why people still use d.js 🤔
Cos it's well maintained and has good support
And that
Discord.js makes a lot of things easier to work with. It's also JavaScript and that shit's popular.
it's easy for people who have little to no programming knowledge and their goal is "if it works it works"
won't ur host like
everybody gangsta until discord.js eats 50% of your memory
eris is much simpler
there are libs to stop d.js' aggressive caching
discord.js-light
there are libs to stop d.js' aggressive caching
@earnest phoenix excuse me what
not that node.js should be used at all if you're targeting performance lol
i want to switch to detrtius, but i kinda am liking eris, its cool
v13 the end of caching
discord enforcing intents will kill most of caching in all libs
if they remove it people r gonna be so pissed lol
all libs will pretty much have to switch to stateless design
i would honestly prefer no caching
sometimes not
it prevents you from hitting ratelimits and blocking on your commands for example
if the lib has shitty caching and performance
well that's a you problem
const embed = new MessageEmbed()
.setTimestamp()
.setAuthor(`${role.name} | ${role.id}`)
.setColor(role.hexColor)
.addField("Position:", (message.guild.roles.cache.size - role.position), true)
.addField("Hex Colour:", role.hexColor, true)
.addField("User Count:", role.members.size, true)
.addField("Hoisted", role.hoist, true)
.addField("Managed", role.managed, true)
.addField("Mentionable", role.mentionable, true)
.setFooter(message.guild.name, message.guild.iconURL());
message.channel.send({embed});
Cannot read property 'size' of undefined
i wonder what that could mean
Good
undefined lmao
theres 'size' 2 times ee
you forgot something
o yes
oh
i wonder what that is
You on discordjs v12?
he knows
Just checking
oh shit
nah it returns a collection
i'll have a look, i always mess things up
by the way you can just use send(embed); since you used the embed builder
oh yeah ik
It's .cache.size iirc
it doesn't return a manager
oh I'm just stupid then
Then members is undefined
or role no
I wonder if it's partial for some reason
I don't think roles return partials though
so I have no idea why that'd happen
yeah i'm checking oof
roles can be partial
you have to check it manually then
i just don't know how, because even if you fetched the role from REST, it would still be in cache from the gateway so i am confusion 
Usually partials have the partial property then right?
yeah but role doesn't
d.js doesnt say role has partial
how tf do i define role
XD
inb4 they somehow created a new instance of a role manager
shit i forgot abt the rolemanager
at least i got it to work by removing the thing that was giving th errors, now i just have to define the roles
oh
That's something
i doubted that would happen because it didn't say id of undefined or something
looks like i was wrong
Try console log role
that's a nice ready message
mhm XD
oh
you literally used the role string hoping it'll get every property
by magik
it's big bran time
is there any way to get emoji info with something like msg.mentions.emojis.first() in discordjs? or i have to use a package or to hardcode it
lmao
right so i read documentation
await member.ban(user, { reason: reason }); this bans but doesnt provide a reason
use ``
show the reason
reason works, but even if i do await member.ban(user, { reason: "test" }); it doesnt work
i need help making an invite command, i cant figure out what im doing wrong but what i have so far is not working
message.channel.send("invite here")
.setTitle(":6093_Animated_Checkmark: Invite Glitch")
.setColor(#6f00ff)
.addField("[Click me to invite Glitch!](https://discord.com/api/oauth2/authorize?client_id=716538261572419625&permissions=8&scope=bot)"
.setFooter(message.member.user.tag + " | Created By Jeremy#6414")
if (!list.includes(message.member.user.id)) {
return message.channel.send(embed).then( () => {
message.react('717201156681629737');
}).catch( () => {
message.channel.send(embed).catch(() => {
return message.channel.send("> :n: i may be lacking permission: 'EMBED_LINKS'");
});
});
}
message.channel.send(embed).catch(() => {
return message.channel.send("> :n: i may be lacking permission: 'EMBED_LINKS'");
});
}```
@honest perch hmmmmm i have no idea why it dont work
thats what i have
@river terrace what exactly dont work
it says at the end a , was epxected and when i run the command it doesnt work at all
ok
^
SyntaxError: missing ) after argument list```
error
thats the error i get
uh what am i looking for
you forgot a )
erm no
oh
not )"
here are the parentheses https://cdn.lumap.me/ry080vqz.png
^
SyntaxError: Unexpected token '}'```
ok now what
lol
what on earth does it want
Screeen of the code
ok
Where is the error
what the fuck is the } at the end supposed to close
lmao
delete the } at the end
ok
and try
it marks things like that with the red underline
usually means you have an error, but dont trust that with css
^
ok wtf is it doing, its telling me MessageEmbed is not defined
Use Math.floor
i m using this addField("🤖 API Latency", ${this.client.ping}ms)
@river terrace learn how to use js
Define the MessageEmbed
well im trying
use Math.round @river terrace
lol
idk what that is
learn how to use an ide
@river terrace how are your other commands coded?
not very good
const { MessageEmbed } = require("discord.js")
@river terrace
can you show me a screenshot of, let's say, your ping commabd?
i just want to check smth
well the help one?
ye
idk where it starts and ends i forgot
ello
hi there
but how to use math.round in this code ````${this.client.ping}ms`)```
learn js
any idea why guild is undefined? js getMember(guild, query) { guild.members /* irrelevant stuff */ } ? i do client.getMember(message.channel.guild.id, 'user'); but it returns undefined
and im completely serious @surreal notch
Remove id @digital ibex ?
oh yes, 🤦♂️
ok, now i do client.getMember(message.channel.guild, 'part of the users name') but it returns undefined
even w/ all of the username
@river terrace its Discord.MessageEmbed() not just MessageEmbed()
oh is it
let me try that
what do i define const discord as
const Discord = require('discord.js')
is that right?
yes
kk ty
do i put it in single quotes
or double
bc the other const has double quotes
it doesnt matter lmao
ok cool thanks
"" '' are the same thing
^
yes i know but for now im asking them bc im trying to learn
in order to learn u ask questions
its apart of learning anyways
ur making a discord bot which is throwing everything at u at the same time
which is why its not recommended to make a bot for learning js
and it also says it on the documentation on the welcome page
tf is a hbs file
start with something simple, learn js a bit more, node.js and then make a bot
no
please just let me do this 1 command
then ill learn
i just wanna make this one single command
ok
please
make it more simple for your self, just make a single embed
u can still finish it once u learn
so just
let embed = new Discord.MessageEmbed()
// the embed stuff here
message.channel.send(embed)
i mean yea but its not clickable text is it?
dude
yes i know
also this happened
.setTitle("Invite Glitch!")
.addField([Click here to invite Glitch!](https://discord.com/api/oauth2/authorize?client_id=716538261572419625&permissions=8&scope=bot))
message.channel.send(embed)```
says thats wrong
yet agian
ugh
why cant this just be easier
""
in the field
why cant this just be easier
@river terrace it is easy
just have to learn js
("[Click here to invite Glitch!](https://discord.com/api/oauth2/authorize?client_id=716538261572419625&permissions=8&scope=bot)")
youre trying to make a bot without any knowledge of js
ok i did that now
anyone know how to resolve my issue? js getMember (guild, query) { guild.members /* irrelevent stuff */ } guild is undefined for some reason when i do client.getMember(message.channel.guild, 'member here')
fields require a title and a value
message.guild*
thats the url text
@digital ibex log message and see
hm
just message?
excuse my handwriting
sure
its good lol misly
message and message.channel, i guess
name, value, inline?
yes
yeah
wait
yes but you can just do "invite"
addField("YOURTITLEHERE","YOURCONTENTHERE")
and then paste the link where the word "reason" is
basically that
oh
what tim said
ok
just a . before addfield
try channel next
.setTitle("Invite Glitch!")
.addField("Invite", invite)
message.channel.send(embed)```
it logs message.channel
dont bother defining it just add the invite in ""
can you show me the output?
kk
let embed = new Discord.MessageEmbed()
.setTitle("Invite Glitch!")
.addField("Invite", "[Here!](https://discord.com/api)")
message.channel.send(embed)
just define MessageEmbed if you only use that
(or use an object and don't define anything)
no guild?
thats only part of it
that's fine but can you find guild?
lemme get it
message is still not defined
i dont get what the hell its asking
it said that on the last one
code?
code???
what???
it said that on the last set of code where i had the bigger message embed
that was more complex
and finally; can you find members in guild?
yeah
damn bro that's crazy
how is members undefined
can you show the function + where you execute it?
kk
let embed = new Discord.MessageEmbed()
.setTitle("Invite Glitch!")
.addField("Invite", "[Click Here!](https://discord.com/api)")
message.channel.send(embed)```
asking for message
what the fuck do i define message as
misly wont respond
they are "busy"
they said to send them the code
oh my god
what to use in quick.db to show balance
jeremy can you show the whole file?
/* where i execute it: */
client.getMember(message.channel.guild, args.join(' '));
/* and what 'getMember' is: */
getMember(guild, query) {
guild.members.find((e) => e.username === query); /* <--- error and some extra stuff which is irrelevant */
}
its litterally called invite.js and its supposed to send an embed with clickable text to get redirected to a link that will invite my bot
and its not working and i don get it
do you have a command handler?
uh
isn't it client.getMember(guild, query) {}?
im bad at coding, i want a discord bot, idea pops into my head, copy a bot and edit it since i understand how to EDIT code, and then turn it into something of my own by adding other unique things making it different fromt he original
i did that
now i cant code a simple invite command
no, i just made 'getMember' but idk why its not working properly
then why is client.getMember(message.channel.guild, args.join(' '));?
flazepe please can u just help me fix this
i can't, sorry
is args.join(" ") exactly the username of the person? including case?
Go to stackoverflow @river terrace
tried that
@river terrace show your code
cuz guild is the guild its executed in, and query is which args to look for
already did tim ill just DM u bc everyone else here says they wont help
its not tim,
but even when i put the name of a normal members username, it returns undefined as well
@digital ibex your function is looking for an exact match
oh my
i'm using a class
whats why i'm using classes cuz i don't want to do that every time for when i'm looking for a member
@digital ibex return
2 dms and they both said to send code and neither responded
read this
they don't even have a command handler and they have a file named invite.js
not even an export
then go do your chores and come back later
oh god
i just dont know what the hell it is
oh... i'm so dumb. thanks a lot guys :)
flaz
Hi
i told u i copied a bot
i told u that
i cant code worth shit and i copied a discord bot ok, i also am trying to figure this out
i just want help on this 1 command and then im litterally gone forever
please read https://anidiots.guide/v/v12/
If you copy without knowing what you're doing, the issue you're having will come back for you like a ghost.
or you should learn a programming language first
yes i know
congrats man
congrats
it doesn't look like it
congratulations
So why i dont get bot developer role?
@river terrace the code you showed me is not the problem. the problem is that you're trying to use message somewhere where it doesnt exist. All code that is based on message must be placed within the context of message for example inside the client.on("message") event, which is the only place where a message is generated and processed by your code
-bots 705864187695333378
Thanks every one
luca borked
Luca is broken
ok and thats really cool tim but i dont understand what that means
what is the issue
to put it simply
message is not defined
client.on("message", message => {
// message exists here
})
// message does not exist here
🤦♂️
he has another file
tim i dont know where to put that
it should be an export and he said he "has" a command handler
yeah im sure i do
so you have to check that, and you have to see where that message is being sent to
you need to get it to show up in your file
thats essentially what a command handler does
im trying to send an embed in a channel though
all commands start from a message
you're trying to make a command where message doesnt exist, thats the problem
i dont have a clue what any of that means tim, im a shitty coder, and im bad at this, i just want to figure out an invite command and this is so stupid bc i cant code a simple fucking command
i hate everything
why do i even try
well you have to figure it out
if you want help, you will need to show more code
thats all the code i have in that file
i know i have an idea
DM me tim i got an idea
why u need an invite command 
Who has best music bot code ??
thank u @quartz kindle @pale vessel, it works :)
If I have a try...catch can someone point me in the right direction to throw an error that will add data to the error so I can catch it if it fails?
idk what I'm trying to do
I'm trying to do this currently but I'd rather throw an error and be able to catch it in the function
should I use new Error()
oh wait
its a promise
@river terrace what you're doing is kinda unnecessary, if you're giving admin perms to your bot why are you even checking if it has a permission, that's just unnecessary
Honestly not sure whats wrong here, all of the files are formatted the same, anyone know whats wrong?
at C:\Users\Samst\IdeaProjects\ClockMaster\index.js:64:41
at Array.forEach (<anonymous>)
at C:\Users\Samst\IdeaProjects\ClockMaster\index.js:61:16
at FSReqCallback.oncomplete (fs.js:155:23)```
```js
jsfile.forEach((f, i) => {
let props = require(`./Commands/${f}`);
console.log(`${f} loaded!`);
bot.commands.set(props.help.name, props)
})
});```
```js
module.exports.help = {
name: "wcsetup"
}
module.exports.help = {
name: "convert"
}```
im not?
no

I just wanna make a callback it sounds like
