#development
1 messages Ā· Page 1885 of 1
youll need a database, and some very basic commands
im a beginner so idk how to do
Do you know how to make a discord bot with a programming language of your choice?
Or do you just not know how to implement such features with a language that you already know
what....
It's your code isn't it?
ah, yeah youll need to change things if you want to update to v13
as v13 has breaking changes
I will try to keep with the changes š„²
i have to
Also itās worth noting that a version of djs commando made for v12 probably doesnāt work on v13 š
indeed
I'm comming back to v12
š„²
But why...
v12 will stop functioning eventually
^^
at some point you will have to move to v13
Plus v13 is designed for complying with the new message intent features
š¢ then say clearly no...that I'm an idiot and I have to update it asap
ok
buttons
cool
If youāre gonna use djs, you might as well use djs v13
I dont think commando is updated yet, so if you want to use v13 youll need to
Alternatively, update commando yourself
data is undefined
it is defined
im trying to host on repl for the day or so why i fix my pi
but console is just waffling
how have u defined it?
idk im not the one tracking any data its my other dev lemme go ask him
problem is in code sir...run it where ever u want
sure
is there anything i can do if someone copies my bot?
Not publishing the code
?
if someone copies my bot
like they have already copied
but kinda made a replica of my code without me providing it to them
How can he make a replication of your code if he hasnāt access to it?
feature and design wise?
Even if he would take the same name for his bot and profile picture thereās not much you can do against
yes
Make something unique that's hard to replicate then
otherwise it just shows that your bot isn't anything "special"
Does anyone have the same problem as me that when I save changes on the page Top.gg It do not save them?
I'm trying to save changes to the bot long description
Do you have multiple webservers running? Or how does the site render if you have Apache removed?
How fix it?
Thatās what I thought. You donāt need Apache as second webserver then.
Does the website maybe rely on different source it fetches?
Then use your browser inspection tool, head to the network debugger and take a look how long each script you fetch takes.
I'm not allowed to take programming class in school anymore 
what did you do?
what shard are user dm's in?
or does it depend on what shard of a server they're in?
trying to make an autoposting command to user DM's but seems to send them it multiple times depending on if it finds them on a shard
So for example, it finds a user on shard 1 and shard 3, so it sends it to them twice
0
but only for receiving
for sending doesnt matter
So I can send the user a DM through any shard?
yes
cheers
What?
I'm too good
no
Looks like itās trying to find who is supposed to receive the credits but canāt find them
Ooohhh wait
I think it goes to your team member for the bot or whatever if you have one
hmm
Or like a split amount
is this real money?
To be honest I have no idea
uhh
where does it go? how to pick them up?
its used to pay for ads in the auctions system
hmm
where can I see how many credits I have?
thx
hmm
yea you need the auction role
i request access
hey!
if(message.member.roles.cache.some(role => role.name === "Yakuza Elite")){
po = "Yakuza Elite"
}
if(message.member.roles.cache.some(role => role.name === "Yakuza Aniki")){
po = "Yakuza Aniki"
}if(message.member.roles.cache.some(role => role.name === "Yakuza Shatei")){
po = "Yakuza Shatei"
}if(message.member.roles.cache.some(role => role.name === "Yakuza OG")){
po = "Yakuza OG"
}
if(!message.member.roles.cache.some(role => role.name === "Yakuza OG") && !message.member.roles.cache.some(role => role.name === "Yakuza Elite") && !message.member.roles.cache.some(role => role.name === "Yakuza Shatei") && !message.member.roles.cache.some(role => role.name === "Yakuza Aniki")){
po = 'Normal Member'
}
database[message.author.id].wallet = args[0][1]
database[message.author.id].type = po
fs.writeFile("./database.json", JSON.stringify(database), (err) => {
if (err) console.log(err)
});```this code needs to be restricted by return statements!
So it will only write the po to the user once
Owh wait!
3.2 min lol
python html

Whenever I try to check if an user used a button, it says āInteraction failed.ā When I log the collection, it says āCollected 0 items.ā
Why do you use a collector?
An interaction event is being send if someone is pressing the button
I want to check whether the button the user clicked is equal to a specific ID. Is there a better way to do this?
What does restTimeOffset: 0 do when defining the client?
Extra time in milliseconds to wait before continuing to make REST requests (higher values will reduce rate-limiting errors on bad connections)
Then check if interaction.costumId is the component which was interacted with
after checking if it's a button of course as you already do
thanks
Alr. Tysm!
If a button has been pressed you will receive a button interaction obj
is there a way in the newest discord.js to make my bot type and then stop typing when he sended the message?
Idk if Iām doing smth wrong but this:
if (interaction.customId === āsupportā) {
// create channel
}
Still says āinteraction failedā. No errors or anything (and I actually have code instead of the comment ofc lol)
thanks!
You need to defer the interaction
Iām confused on what deferring is sorry
KuuHaKu told you what defering is 2 days ago, i told you what defering is yesterday.
i think of it as a timer for responding back on another command sent right after
as said in the docs: As previously mentioned, you have three seconds to respond to an interaction before its token becomes invalid. But what if you have a command that performs a task which takes longer than three seconds before being able to reply?
Mb, sorry. Iām not very good at listening. Iāll take a look at what yāall said. Sorry for wasting your time
that's not a question, it was part of the sentence taken
for (const key in database){
z = await message.guild.members.cache.get(key)
if(message.member.roles.cache.some(role => role.name === "Yakuza Elite")){ // first one
all = (database[key].wallet);
d += `User: ${z.user.tag} Wallet: ${all} Type: ${database[key].type}\n`
}
}
for (const key in database){
z1 = await message.guild.members.cache.get(key)
if(message.member.roles.cache.some(role => role.name === "Yakuza Aniki")){ // second one
all1 = (database[key].wallet);
d1 += `User: ${z1.user.tag} Wallet: ${all1} Type: ${database[key].type}\n`
}
}``` hey how would i make sure that it will only get the highest role, as if a user now has these 2 roles it will fire the code twice!
it's not the highest in guild
I basically just want the code to stop after the first role in order was found
OMG WAIT I KNOW SOMETHING!
i can check if a user has a role and then use an if else!
no that doesn't work
I meant more like the first role that a user has
so in this order it would be Yakuza Elite, Yakuze Aniki
first as in, in the manager of the member, check the highest? because im pretter sure member.highest is that.
this thing i linked to
sorry, member.roles.highest, not member.highest
No, just the first that appears in the code
check the snippet, i have provided some info
š
it checks the position in discord though
https://github.com/discordjs/discord.js/blob/stable/src/managers/GuildMemberRoleManager.js#L66-L68
.first() is the first by insertion afaik, but highest checks the position
but i still don't want it that way ahahhaha
i want to stop once the first role is found
ordered by code
not discord hierarchy or postitions
cringe regex:
const emoji = text.match(/^:(.*?):$/)[1]
chad parsers
colon :: Parser Char
colon = char ':'
notColons :: Parser T.Text
notColons = takeWhileP (/= ':')
emoji :: Parser T.Text
emoji = colon *> notColons <* colon

because if i now have the elite and other role it performs the code twice
I want to stop the next cycle if the first role was found
do you understand?
let me show you another snippet:
for (const key in database){
z3 = await message.guild.members.cache.get(key)
console.log(z3)
if(message.member.roles.cache.some(role => role.name === "Yakuza OG")){
all3 = (database[key].wallet);
d3 += `User: ${z3.user.tag} Wallet: ${all3} Type: ${database[key].type}\n`
}
}
for (const key in database){
z4 = await message.guild.members.cache.get(key)
if(!message.member.roles.cache.some(role => role.name === "Yakuza OG") && !message.member.roles.cache.some(role => role.name === "Yakuza Elite") && !message.member.roles.cache.some(role => role.name === "Yakuza Shatei") && !message.member.roles.cache.some(role => role.name === "Yakuza Aniki")){
all4 = (database[key].wallet);
d4 += `User: ${z4.user.tag} Wallet: ${all4} Type: ${database[key].type}\n`
}
}
let g = d + "\n"+ d1 + "\n" + d2 + "\n" + d3 + "\n" + d4 + "\n"
fs.writeFile("./wallets.txt", (g), (err) => {
if (err) console.log(err)
});```
This should clarify it more.
so you dont care about order of submission, or where they appear in cache, just the first one you happen to find?
message.member.roles.cache.find(role => role.name === 'Bob' || role.name === 'jerry');
will return the first one it finds.
or are you just looking to break?
break; will stop executing the loop when you use it.
Lads anything I should make sure about before applying for discord bot verification?
Cause i have never done this so idk shit
Thats it?
pretty much
Lol
for example, not pushing your bot to the ratelimit just because "its the ratelimit"
im very ratty, so i cant submit for verification š
So its like 50 msgs per second right?
the global limit is 50 requests of any kind per second
The irony with your pfp
then each route has its own limit
kek
for example sending messages is 5 messages per 5 seconds per channel
Oh soo yea how do bigg bots handle that
Like mee6 and all
they dont
but you dont need to worry too much, the library you're using should handle it for you
they get it increased
upto about 500/s
Well thnx lads imma bore myself by reading the tos now lol
"hey dont do things with user info they dont expect!"
tbh, zuckerberg(facebook) probably would be allowed via discord TOS, as facebook privacy policy states most of what they do.
does it state they sell your data to the nsa/cia/steve bannon?
lmao
does it state zuckerberg is not human?
how would i remove duplicates in txt files? Like this: ```js
User: helloboys#9094 Wallet: etstsafa Type: Yakuza Shatei
User: ChittyKat#6366 Wallet: 25252 Type: Normal Member
User: helloboys#9094 Wallet: etstsafa Type: Yakuza Shatei
User: ChittyKat#6366 Wallet: 25252 Type: Normal Member
why are you using text files?
then the database should take care of avoiding duplicates
also why are you not using user IDs
kinda hard as my code loops through it and checks for roles.
what database are you using?
for (const key in database){
z3 = await message.guild.members.cache.get(key)
console.log(z3)
if(message.member.roles.cache.some(role => role.name === "Yakuza OG")){
all3 = (database[key].wallet);
d3 += `User: ${z3.user.tag} Wallet: ${all3} Type: ${database[key].type}\n`
}
}
for (const key in database){
z4 = await message.guild.members.cache.get(key)
if(message.member.roles.cache.some(role => role.name === "Yakuza Aniki")){
all4 = (database[key].wallet);
d4 += `User: ${z4.user.tag} Wallet: ${all4} Type: ${database[key].type}\n`
}
}
let g = d + "\n"+ d1 + "\n" + d2 + "\n" + d3 + "\n" + d4 + "\n"
fs.writeFile("./wallets.txt", (g), (err) => {
if (err) console.log(err)
});```
if someone has both roles, it will add the user to d4 and d3
because you have 2 loops
and it joins them
.cache.get does not need awaiting
so that's why i am asking how i can just remove the duplicates in the text file
you dont remove them
just dont write them in the first place
there is no reason to have 2 loops eitherway
txt.db 
I am just trying to make it easier for me, so i can just open the txt and see all the info's.
Instead of having a clusterfuck of arrays
for(key in db) {
if(member....some(...)) {
...
} else if(member....some(...)) {
...
}
}
You can visualize data of any db
You can't
in your discord developer portal
literally login into your discord developer portal
and open your bot app
and set description
Integrate your service with Discord ā whether it's a bot or a game or whatever your wildest imagination can come up with.
What issue are you having?
Same thing just came up again
What same "thing"?
401 error. Discussing in #topgg-api too
š¤ is there no status code to seperare no auth provided and unknown auth provided?
Would that just be a 400?
No auth provided I mean
@rose warren good for u, it's possible to respond with attachments on initial message now
Nice š That's probably not in the djs lib yet though right?
I've never looked at rose
Detritus probs has it already cuz cake is always fast with updates
I've already started my djs v13 rewrite anyway
Oof
š¤ couldnt you just do the request yourself to do this, while keeping djs
guess you could optimize it now that there's those cache factory or something
Yeah I could but I'd rather use the lib tbh
flashbacks to v12 client.api() for buttons
Yep that's a pretty nice feature
now they use @discordjs/rest or somethign?
Yeah
Even Tim was saying his lib will prob be obsolete when v14 comes out
djs caching is getting better
his djs lib?
is he even maintaining it anymore?
Yeah he updated it when v13 came out
I tried it out before I started my rewrite. I may or may not use it. Idk yet.
anyone know if there's like a limit on how many users can join a thread?
or any other known issue/bug that might be preventing using certain threads? š
hey im working on a starboard feature and does anyone know why im getting this error?
error:
if(reaction.emoji.name === 'ā') {
^
TypeError: Cannot read property 'name' of undefined
even though its supposed to be used like this?
code:
const db = require('quick.db');
const { MessageEmbed } = require('discord.js');
module.exports = async (reaction, user, message) => {
const handlerStarboard = async () => {
let SBChannel = db.get(`starboardop_${reaction.guild.id}`);
if (SBChannel === null) {
return;
}
const msgs = await SBChannel.message.fetch({ limit: 100 });
const SentMessage = msgs.find(msg => msg.embeds.length === 1 ? (msg.embeds[0].footer.text.startsWith(`${reaction.message.id}`) ? true : false) : false);
if(SentMessage) {
SentMessage.edit(`${reaction.count} - ā`)
}else {
const embed = new MessageEmbed()
.setAuthor(`${reaction.message.author.tag}`, reaction.message.author.displayAvatarURL({ dynamic: true }))
.setDescription(`**[Jump!](${reaction.message.url})**`)
.addField("Message", `${reaction.message.content}`)
.setColor("YELLOW")
.setFooter(`${reaction.message.id}`)
.setTimestamp()
client.channels.cache.get(SBChannel).send({ content: "1 - :star:", embeds: [embed] });
}
}
if(reaction.emoji.name === ':star:') {
if(reaction.message.channel.id === SBChannel) return;
if(reaction.message.partial) {
await reaction.fetch();
await reaction.message.fetch();
handlerStarboard();
} else handlerStarboard();
}
}
lol = discord.utils.get(guild.channels, name=f"{ctx.author.name.lower()}-ticket").id
Hey, im trying to get a channel by its name and turn it into an id. Im getting an error that is saying 'send' is not a valid request. So it makes me think that its not changing into an id. Anyone know whats wrong?
I donāt think thereās such thing as emoji.name
the docs use it
You would have to grab the emoji by itās ID
i could try that ig
Iām tempted to reply to that
With?
you're missing emote intent
š our issue tracker has so many things happening in it all the time.
rip
i thought i got all the intents weird ig
is it 'EMOJI' or something?
Pretty sure the limit is 50
or at least members will not be synced after 50
ill try it
guess that dont exist
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: REACTION_EMOTE.
but i have 'GUILD_MESSAGE_REACTIONS' so idk
that's the only thing I can think of
and you cant even get basic emojis with thier id so i cant even test that idea
why must v13 be this way
Am I like the only person having this issue? I literally went into the docs and my code should be working
show the code where you call that function
you might be passing your parameters wrong
hey what theme is that 
looks like intellij ide
Dracula Soft with Fira Code (and ligatures)
ooh neat ty :3

lol = discord.utils.get(guild.channels, name=f"{ctx.author.name.lower()}-ticket").id
Hey, im trying to get a channel by its name and turn it into an id. Im getting an error that is saying 'send' is not a valid request. So it makes me think that its not changing into an id. Anyone know whats wrong?
Do you have the full error?
postgress stores everything locally right?
if so why is that a good choice storing data on my own laptop
On a laptop? No local database is good(imo, due to no local backup ability)
But all databases can be remote. So if the concern is location the database probably doesn't matter.
Whatever database offers you the features you need is what you should use
You aren't supposed to use postgres on ur own machine for long-term data anyway
Actually, that's true for every single database out there
guys what are these called ? like the bars on top with text that you can x out of . and if you know how do i make it in html and css 
Here @quartz kindle
Border?
u need to check if the reaction is a partial
i see that u r checking it but u r only checking it at the last thing on ur code
put that if statement at first line of the function
Wouldn't that just throw a "cannot execute thing since it's under the code" error?
border?
What's the question here? I don't think anyone is gonna do your homework for you if that's what you're wanting š
...
How is a Byte code different from Native Executable Code in java?
i mean, the code that calls the function
something(reaction, user, message)
Arrange the following operator in ascending order of precedence
i)+ ii) * iii)++ iv) ?: v) <= vi) && v) = vi) ! vii) % viii) >
this is java pls help
precedence means which operator will be executed before the others
You can find a precedence chart easily online for Java, but if you're required to learn it for future assignments (I'm going to assume this isn't a test because you're already asking on discord), I recommend you study it
You have a math expression casted to a float, but assigned to an int type
Cast it to an int instead
(Or make the int a float, but I think the question is asking you to change the type itās casted to)
does anyone know of any npm libs that can decode and encode opus besides prism-media
This is for node. Not a web env
Bruh?
Just make the int a float or the float an int
Also that seems like an exam question hmm....
You need the application scope in your bots application and need to register the commands via code
yes
is there a way that i can detect specific words in embeds? my bad word filter ignores the embeds
this is my code:
async def badwords(message):
if 'bad word' in message.content.lower:
await message.delete()```
hey how can i make slash commands on discord.py on cog
i can host repl.it for free.
dpy is ded
use nextcord i heard its gud
nah bruh
please use github student developer pack
?
github student pack provides 6 month of repl.it hacker for freee
yes it is

it isnt
use google cloud or something
yes it is
NO. IT. ISNT.
end of discussion
does it say that its a hosting?
"and host in 50+ programming langs"
jk
YES IT IS.
its a IDE, not a hosting
YES IT IS
bet
"host" ur bot with 1k servers in repl.it
itll crash immediately
THATS THEIR PROBLEM
NOT MINE
bruh
repl.it doesny even have v16+ except if u use npx or some script
doesn't*
talking about djs bte
btw*
typo go brr
what's that method in JS which compares if at least a percentage of a string is like a another one
u mean like "5%"==="5%"?
nah
dont understand on wym
like "opress" = "apress"
similar words, but one has a typo
so probably "apress" is 90% similar to "opress"
but I know there's a method for this
nah there isnt afaik
probably a module
i dont even see a reason on why nodejs/js will add it
ye maybe
wait so u agree that its an IDE and not a hosting
aight thats fine to me 
no
no i say that replit is a hosting platform
u got fooled 
repl.it itself is not a hosting platform
but they have hosting services I think
wym by that
this is the top flaw of hosting ur bot in repl.it
main*

damn but
Did you know itās not designed for 24/7
and not exactly the best service
canot send an empty mesage
now whats wrong in my code
const command = require(`.././Structures/command`);
const {discord, Client, Message, MessageEmbed} = require('discord.js');
module.exports = new command({
/**
* @param { Client } client;
* @param { Message } message;
* @param {string[]} args;
*/
name: "avatar" || 'av' || 'pfp',
description: 'This command sends the author avatar.',
async run(message, args, client){
let member = message.mentions.members.first();
if(!member){
let member = message.user;
}
try{
const embed = new MessageEmbed()
.setTitle(`Avatar for ${message.author.username}`)
.setImage(`${message.author.avatarURL}`)
.setTimestamp()
.setColor('DARK_GOLD');
message.channel.send(embed);
} catch(e){
console.log(e);
message.channel.send(`There was an error executing the command.`)
}
}
})```
if thats d.js v13, you should do message.channel.send({ embeds: [embed] });
thats v13
and let me do that real quick
and
Invalid Form Body
is there a way to get a combined member count of all servers my bot is in?
why is this error showing up
weird
want me to send the the code again?
const command = require(`.././Structures/command`);
const {discord, Client, Message, MessageEmbed} = require('discord.js');
module.exports = new command({
/**
* @param { Client } client;
* @param { Message } message;
* @param {string[]} args;
*/
name: "avatar" || 'av' || 'pfp',
description: 'This command sends the author avatar.',
async run(message, args, client){
let member = message.mentions.members.first();
if(!member){
let member = message.user;
}
try{
const embed = new MessageEmbed()
.setTitle(`Avatar for ${message.author.username}`)
.setImage(`${message.author.displayAvatarURL}`)
.setTimestamp()
.setColor('DARK_GOLD');
message.channel.send({embeds: [embed]})
} catch(e){
console.log(e);
message.channel.send(`There was an error executing the command.`)
}
}
})```
That's at the top where it says module.exports
Bro we won't answer you examination questions... thats cheating
Nvm old message
thats where its exported, not where its called
where do you require this file?
In my event handler
then show that
The handler works if that's what you're wondering
I have like 7 other events in that folder
no im not wondering, just asking to see it
I'm on mobile so it'll take a sec
const evtFiles = await readdir('./events')
console.log(`Loading a total of ${evtFiles.length} events`)
klaw('./events').on("data", (item) => {
const evtFile = path.parse(item.path);
if (!evtFile.ext || evtFile.ext !== ".js") return;
const event = require(`../events/${evtFile.name}${evtFile.ext}`);
client.on(evtFile.name, event.bind(null, client));
client.log('EVENT BIND', `Event ${evtFile.name.green} was linked to file ${(evtFile.name + evtFile.ext).green}`)
});
}
utils/handler.js
š
....
use typescript and you will catch all of these errors
get good at communicating with a compiler, not being a God programmer who can catch all mistakes by themselves
I'd rather not switch to ts when I'm this far with js š
you can switch incrementally
youll catch stuff just by turning the typescript compiler on without even moving to ts files
so my bot is still running on discord.jsV11, whats the best way to get all the members of all the server my bot is in? rn using bot.user.size but that one is inacurate
yo guys when i give my bot for verification should i be worried if my bots code has stuff like this? console.log(`pinged in ${message.guild.name} in ${message.channel.name} by ${message.author.tag}`)
like its just to make sure that the cmd was passed
discord verification btw
hey i have a question, my bot is in discord.js -12,
what will happen if i wont make the bot discord.js -13?
will it make the bot unusable?
v8 of discord's api(the one that djs v12 uses) will "shut down" bc of the msg intent
and in general u should use the latest version of djs
but idk where to start to make it v13
v13*
how do i draw an image with a shape in canvas?
i wanna draw a circular image
I'm getting AttributeError: 'coroutine' object has no attribute 'get'
userid = await request.form.get('userid')
I have post data called "userid" which is sent over in a form post request
how do i get data from a post request in flask python
const ms = require("parse-ms");
^
Error [ERR_REQUIRE_ESM]: require() of ES Module
hello, does someone have code for massrole in js?
how can i make my bot always be deafened
have? yes
will give? no don't think so
why deafen a bot tho?
idk, why not
iirc, when deafened ur also muted
ah ye
and it's not like bots can hear anything anyway
you forgor š
bots can deafoned without being muted
Yes and it saves you bandwidth if it's server deafen
hm, ig so
const ms = require("parse-ms");
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\v13globaleco\node_modules\parse-ms\index.js from C:\v13globaleco\index.js not supported.
Instead change the require of C:\v13globaleco\node_modules\parse-ms\index.js in C:\v13globaleco\index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\v13globaleco\index.js:97:12) {
code: 'ERR_REQUIRE_ESM'
}
use import instead of require
oh wait
that's inside a package
welp, time to find an updated alternative
Sometimes checking the github PRs can offer a solution.
Welp
This is why I try and avoid packages if I can tbh. Looks like you're try to make a bot eco. Not that hard to just make it yourself.
You don't even need moment. I do that with a simple function in my code. It's just a few lines of code.
me 2, I also use that on postgres bcuz reasons
disgruntled database noises
I hate my db
well, if it makes you feel better, postgres doesn't have that by default
had to write it myself
Yeah
My db has just had stuff added to it little by little as my bot developed and it's just a bit of a mess. Needs a rehaul tbh and that's why I hate it š
lul
does someone know how can i check if the role is above bot?
check the first role index
first role is always the highest role user has
if index is higher then the role is higher
can anyone tell me how do it make the bot respond when someone mentions it ? i'm in cogs btw and discord.py
check for <@bot id> and <@!bot id>
i mean wanna see my code?
lol
hey how i can make my bot status to "Watching over 2000 peoples"
depends, bot library?
discord.js
dicksword.js
This may make me sound retarded ,but how do i get data from a dict as data["userid"] isn't working
Using Quart I get the data from request.form, then i try to get data but it says it is a coroutine
beaned!
{"g-recaptcha-response":"hidden output code","serverid":"858252051653197835","userid":"471409054594498561"}```
how do i get the userid from that
Imagine Tim would be banned off development only allowed to access general anymore.
chaos would begin
py?
could try dict.get("userid")
alr
AttributeError: 'coroutine' object has no attribute 'get'
love trying to debug languages I dont know kek.
new Date(ms).toLocaleString()
does that work
No that doesn't accomplish the same thing
client.on('ready', async() => {
let server = await client.guilds.cache.reduce((a, b) => a + b.memberCount, 0)
client.user.setPresence({
activity: {
name: '${server} members.',
type: "WATCHING"
},
status: "online"
})```
py throws errors for missing properties?
oh, does it need to be awaited? 
lemme try
I did link to the exact doc page that shows how to do it, but sure I guess you found it š

nope still doesn't work
You told him to use setActivity() not setPresence, Mr. Woo!
you helped me tooo
heck, musta miss clicked 
š¤ no idea then. maybe the py server would know quicker since no py devs seems to be on.
https://discord.com/invite/python
alr ill open a channel on it
turns out i needed to do await request.form and not await data.get
now i can't get it to dm
i get the userid from the request, then it does user = client.get_user(int(data.get("userid"))
then await user.send("Thanks for verifying!")
but im getting AttributeError: 'NoneType' object has no attribute 'send' as an error
hmmm using newton's 3rd law you should press alt+f4
good idea
ur welcome
does py require it to be an int?
i thought py uses strings for ids too
has to be an int for discord.py to get user
i do share a server with it before you ask
ok, but is the user cached 
try using https://discordpy.readthedocs.io/en/stable/api.html?highlight=fetch_user#discord.Client.fetch_user
this is also a coroutine so you'll need to await it.
const { Discord, Client, Intents } = require('discord.js');
const myIntents = new Intents();
myIntents.add(Intents.FLAGS.INVITE_CREATE);
myIntents.add(Intents.FLAGS.WEBHOOKS_UPDATE)
myIntents.add(Intents.FLAGS.INVITE_CREATE)
myIntents.add(Intents.FLAGS.MESSAGE_CREATE)
myIntents.add(Intents.FLAGS.MESSAGE_UPDATE)
myIntents.add(Intents.FLAGS.MESSAGE_DELETE)
myIntents.add(Intents.FLAGS.MESSAGE_REACTION_ADD)
myIntents.add(Intents.FLAGS.MESSAGE_REACTION_REMOVE)
myIntents.add(Intents.FLAGS.MESSAGE_CREATE)
myIntents.add(Intents.FLAGS.MESSAGE_UPDATE)
myIntents.add(Intents.FLAGS.MESSAGE_DELETE)
myIntents.add(Intents.FLAGS.MESSAGE_REACTION_ADD)
myIntents.add(Intents.FLAGS.MESSAGE_REACTION_REMOVE)
const bot = new Client({ intents: myIntents });
throw new RangeError('BITFIELD_INVALID', bit);
There are so many invalid intents. Read https://discord.js.org/#/docs/main/stable/class/Intents?scrollTo=s-FLAGS
Also quick heads up. Intents != gateway events
Well all intents are invalid 
what about now?
const { Discord, Client, Intents } = require('discord.js');
const bot = new Client({
intents: [
"CREATE_INSTANT_INVITE",
"MANAGE_WEBHOOKS",
"SPEAK",
"CONNECT",
"USE_EXTERNAL_EMOJIS",
"MANAGE_MESSAGES",
"SEND_MESSAGES",
"VIEW_CHANNEL",
"PRIORITY_SPEAKER",
"ADMINISTRATOR",
"ADD_REACTIONS",
"USE_APPLICATION_COMMANDS",
"USE_EXTERNAL_STICKERS",
],
});
o my bad
d.py is so weird. All of their IDs are ints
Litterally anything that supports u64 ints uses ints lol
Because they're considerably more memory efficient in bulk
So its a JS and lua moment to the people who use string ids 
aren't strings lighter than longs for that matter?
Server Lockdown
Hey guys, we've gone ahead and locked down this server due to a recent surge in bot accounts joining and spamming. If you get any scam ads in your DMs please DM a mod to report it. Once the raid has been mitigated we'll reopen the server.
sus
64bit int = 8 bytes
as a string = 18 characters = 18 bytes
how do i remove a json entry
for example, i would need to remove "testcode" from my json in python
{
"testcode": {
"userid": 471409054594498561,
"serverid":822059901568024616
}
}```
so that the entry is deleted
read the json and load in memory > update json > write the new json to the file
18+ bytes cuz ids are like 17 - 23 or smth like that
so fun fun
if strings were lighter
no one would use native ints lol
Hey all! š
I'd like to ask, how can I make a terminal finish its process before it closes, pause doesn't work, apparently.
Iām trying to check whether the user who clicked a button is not the person sending the command, however I get the error āInteraction has already been deferred!ā When another user clicks a button a second time (or when the user who clicked the button isnāt in the voided array).
Code: https://sourceb.in/JnZcVnEJvD
How can I prevent it from closing?
it'll close as soon as the script has finished running if you start it like that, so instead you could open up cmd or windows terminal or whatever your preferred console program is, navigate to the directory which the file is located in and run it from the command line
I have students who will go lost.
or you could just add a line to make the program wait for input
.. which, at the end, will ... ?
How can I do, so?
so if you add something at the end where it waits for user input etc then it won't close
how did you do it at the beginning of the program?
The PAUSE apparently pauses when waiting for an input.
.. but doesn't pause when it returns the output.
Unfortunately, I'm trying to figure out how it can "pause" when it returns the output.
i don't know of any way which you can do an indefinite pause safely
lots of console-based programs have something at the end where it says "click any key to close"
something like that could work
at least wait for starman to leave the chat smh
thats PAUSE
My god. š
Yes.
huh is that actual syntax?
.bat
17-19 afaik, it will take a few decades before it goes into 20 i believe
i saw the node_modules and assumed js kek
but yeah using the bat file to stop the program from ending sounds reasonable
it's because the interaction.deferReply({ ephemeral: true }); is the first thing you're doing
oh is this channel locked 
First back. š
no
Join "not" my server, please.
discord.gg/dbl
Wdym by that?
As in like why does that cause the issue
whenever that button is clicked, no matter what, you're trying to "defer" the reply
but you can only defer it once
so i think what you'd want to do is to do the check first, then defer after
Ohh I see. Tysm.
or even just do the check and straight up send the message, you don't appear to be doing any fetching so the stuff you're trying to do will take basically no time at all
Ah okay. Thanks for the help š
@quartz kindle come back
???
@quartz kindle come back
how does js include array method work thanks
sounds inefficient but it's more efficient than my morning routine
it iterates over the array and find the first match
@_@
really?
Yes
I thought google again had some kind of magic to make it lightening speed
Thats how all programming lanuages do it
there's not much u can do that'll be faster than first-match-exit method
If you want it for big massive lists then generally a set is used
well, except if it's a sorted array
or if its text-searchable
treeset ||I did read "for big massive tits"||
laughs in 20 different types in a single array
go back to pornhub
I love me some massive tits iteration
u can't force me 
Well actually
š© when people go "oh no its O(n)"
me doing your mother is usually o(1)
š¤£
my mother's dead
yeah
that's why it takes the same amount of time each time
there's no external factors
Well you do you ig
I better donāt ask whatās going on
š
help
data[verifycode]["used"] = 1
returns KeyError: None
ohhh
i returned verifycode
and its returning "none"
client.on('message', async message => {
const guild = client.guilds.cache.get('814988539334230017')
let vip = guild.roles.cache.find(r => r.name === "participants")
console.log(vip)```
while in fact 2 users have the role equipped atm
Really straneg!
If both users type a message it will show 2 users, otherwise only 1???
indeed straneg
straneg
strange*.
does anyone know the answer tho
let me know please
someone told me it's because i have no cache messaegs set
how would i ever do it tho?
https://dpp.brainbox.cc/build-a-discord-bot-windows-visual-studio.html
finished making an awesome tutorial today!
the idea is to guide a complete newcomer to configuring visual studio ready to make a bot
they can either spend 5 mins following the tut, or for the REALLY lazy i made a template project lol
for those of you who havent ever done C++ does it look reasonable or is anything about it too confusing and could be reworded/etc?
yay new error that doesnt make sense why its happening for star board!
error:
const msgs = await starboard.messages.fetch({ limit: 100 });
^
TypeError: Cannot read property 'fetch' of undefined
code:
const { MessageEmbed } = require('discord.js');
const db = require('quick.db');
module.exports = async (client, reaction) => {
const handleStarboard = async () => {
const starboard = db.fetch(`starboardop_${reaction.message.guild.id}`);
if (starboard === null) {
return;
}
const msgs = await starboard.messages.fetch({ limit: 100 });
const existingMsg = msgs.find(msg =>
msg.embeds.length === 1 ?
(msg.embeds[0].footer.text.startsWith(reaction.message.id) ? true : false) : false);
if(existingMsg) existingMsg.edit(`${reaction.count} - š`);
else {
const embed = new MessageEmbed()
.setAuthor(`${reaction.message.author.tag}`, reaction.message.author.displayAvatarURL({ dynamic: true }))
.setDescription(`**[Jump!](${reaction.message.url})**`)
.addField("Message", `${reaction.message.content}`)
.setColor("YELLOW")
.setFooter(`${reaction.message.id}`)
.setTimestamp()
if(starboard)
client.channels.cache.get(starboard).send({ content: '1 - š', embeds: [embed] });
}
}
if(reaction.emoji.name === 'ā') {
const starboard = db.fetch(`starboardop_${reaction.message.guild.id}`);
if (reaction.message.channel.id === starboard) return;
if(reaction.message.partial) {
await reaction.fetch();
await reaction.message.fetch();
handleStarboard();
}
else
handleStarboard();
}
}
the channel has messages so idk why its saying undefined
ok that error fixed now just this one:
(msg.embeds[0].footer.text.startsWith(reaction.message.id) ? true : false) : false);
^
TypeError: Cannot read property 'text' of null
msg.embeds.length === 1 ?
(msg.embeds[0].footer.text.startsWith(reaction.message.id) ? true : false) : false);
if(existingMsg) existingMsg.edit(`${reaction.count} - š`);
else {
const embed = new MessageEmbed()
.setAuthor(`${reaction.message.author.tag}`, reaction.message.author.displayAvatarURL({ dynamic: true }))
.setDescription(`**[Jump!](${reaction.message.url})**`)
.addField("Message", `${reaction.message.content}`)
.setColor("YELLOW")
.setFooter(`${reaction.message.id}`)
.setTimestamp()
if(starboard)
client.channels.cache.get(starboard).send({ content: '1 - š', embeds: [embed] });
}
makes a new embed
that's a useless ternary
check if footer.text exists first
i could try re-ordering it
honestly have no faith in this code working at this point
Hey! I am having an error with my wrapper, or axios. Cant exactly decide. I want to grab the final result of the request, and save it in a let variable so I can use it outside of the .then statement. Here is the code I am using:
const wrapper = require('./utils/wrapper.js');
let data;
wrapper.getUserData('http://127.0.0.1/', 'no peeking', 7358).then(res => {
console.log(res);
data = res;
});
console.log(data);
data is returning undefined
const existingMsg = msgs.find(msg =>
msg.embeds.length === 1 ?
(msg.embeds[0].footer.text.startsWith(`${reaction.message.id}`) ? true : false) : false);
this is checking if it exists so š¤·āāļø
looks like "embeds[0].footer.text.startsWith" just doesnt exist
why does it need to be outside
Would be easier on my small barin
Maybe itās the 2nd embed having a footer not the first?
well right no 0 embeds are in that chat but ill change it š¤·āāļø
msg.embeds.length === 1 ? (msg.embeds[2].footer.text.startsWith(`${reaction.message.id}`) ? true : false) : false);
^
TypeError: Cannot read property 'footer' of undefined
im botta give up with this
Hi
just to clarify its a message with atleast 3 embeds right?
arrays start at 0, so 2 = 3
I am also bet developer
If 2 embed are in embed number 2 has the key 1 not 2
@solemn latch how i get bot developer role?
1+ week
Uhh
Ok
I have uploaded it on top.gg
@solemn latch how will i get to know that its approved?
like i said 0 embeds in that chat and the actual embed im looking for is just 1 embed š¤·āāļø
youll get a dm
saying that it got approved
Oh ok
so basicly embed[0] says footer is undefined and embed[number above 0] says embed is undefined....
nice
Your statement doesnāt make any sense at all, if embed.length === 1 the key embed[2] canāt exist anyways
so just change the length value?
??
Iām not even sure what you wanna do anymore
hey tim shit still aint working kekw
wanna get the embed sent if one doesnt exist already to update
how many embeds did you send?
0 are in that channel rn
wut
you cannot check the footer of and embed that doesnt exist
Then check if !embeds || !embeds.length send embed else update the last
ill try
Iām sorry I hate mobile formatting
if(!msg.embeds || !msg.embeds.length) send embed else update one
embeds belong to messages, not to channels directly
you cannot check how many embeds are in a channel
you need to get their messages first
If the channel is empty there wonāt be a message obj anyways 
Keep that in mind
Whatever fetch returns⦠an empty collection or null
Idk
@boreal iron Youāre talking to yourself, Sir
I know nobody aināt here anymore
š«
just had to change it to:
const existingMsg = msgs.find(msg => {
if(msg.embeds.length === 1){
if(msg.embeds[0].footer.text.startsWith(`${reaction.message.id}`)) {
return true;
} return false;
} return false;
})
and it works now
Mmm spaghet
You will suffer the consequences if two embeds will exist once a beautiful day
2 embeds in so far so good
It will return false if thereās more than 1 embed
so if other bot embeds exist === error
if only starboard embeds exist === good working code
the channel will be locked to that bot only so it should hopefully be good
ill do a try catch and ez fix
It just doesnāt return false if thereās more than 1 existing embed
looks like channels with old messages is the issue
If a message ever has more than one, who knows
cant even make this code actually good
damn
Works fine here š¤·āāļø
But if it has older messages it has a stroke
Working fine here š¤·āāļø
can someone helpme with this
it makes it more complicated
why not use a self-invoking function ```js
(async () => {
const res = await wrapper.getUserData('http://127.0.0.1/', 'no peeking', 7358);
// do something with res
})();```
oh no hold on
nope
Is there anyway to check if the message is a image and then send that image in a embed?
theres an .attachments property in a Message class which contains files images etc.
I'll see if I can get what I want to work
I'm trying to make my starboard work like luca where it can be used on images
And got it
help me with logic here pls lol
py if user["gemstones"]["Ruby"] >= ((user["tools"]["pickaxe"]["tier"] + 1) * 20): user["tools"]["pickaxe"]["tier"] += 1 user["gemstones"]["Ruby"] -= ((user["tools"]["pickaxe"]["tier"] + 1) * 20) mongo["db1"]["gemstones"].update_one({"_id": ctx.author.id}, {"$set": user})
just logic
so:
if amt of rubies >= pickaxe tier
+1) * 20
which is the formula
then i make tier + 1
then make ruby count - formula for upgrade
but it goes into the negaitves sometimes
Iāve got no fucking clue what u wanna do but one thing.
pickaxe tier got increased by one,
After doing so Ruby is decreased by pickaxe tier (adding another 1 to it)
š
Yes HTML and CSS is the way to go.
Keep in mind JS isnāt available.
Including an external website is also possible using an iFrame for example
hmm
nvm working
The bot using the command????
Do I do if (interaction.author.bot) return; in the interactionCreate file?
In discord.js v13, guild.members.cache return max 2 member. Any one know why ?
Iām guessing here: have you got intents setup?
You need member intents for that
GUILD_MEMBERS right ?
Yeah
How can you prevent a bot from performing a command?
This has never made sense.
the bot can't execute a slash command by it self
When why I perform the command, it does so?
How can I prevent that?
You are sending a followUp with your Bot, which has been sent from your Interaction
where is the channel for queries?
@rustic nova
Damn.
Wdym?
I usually do interaction.followUp(), I didn't understand your point.
Yeah, that is the reason, why it is referring to the Initial Interaction in the 2nd message.
whats the best way of adding microsoft authantication to my Quart/Flask site?
I'm still confused dude, could you give me an example?
how do i make a channelr ead only for 1 user specific
and later on clear it for each user again
const filter2 = response => {
return array2[Random2].toLowerCase().replace(" ", "") === response.content.replace(" ", "").toLowerCase() && response.author.id == message.member.id;
};
this filter worked on v12 but now on v13 it isnt and i cant find why
i removed cogs and this is what happen. (discordpy)
Click here and you will see, that it will bring you back to the first interaction reply
I want it to return the first embed only, how can I prevent the second one from sending?
Since I don't understand why it does so.
remove the .followUp in your code
The style I did in the code works for all the other commands without having the second embed to show, not sure why so here. :/
.. but alright. š¤·āāļø
Thats a huge If/else Chain you have right there
Please fix this problem. There are no mentions that enter the history mentions. This has been happening since the last update yesterday.
I can't see who tagged me
This isn't discord support :c
Oh, so where i can get discord support?
Create a ticket.
maybe on the Discord.gg Discord
.. and where that?
How?
Thank you
š
is there a way to get the time a user reacted to a message collector? (WIHTOUT the use of collector.end)
Uuuh,.. How often does it happen that a bot literally freezes?
nvm.. a blow torch helped
TypeError: Cannot use 'in' operator to search for 'color' in Pong.
const { MessageEmbed } = require('discord.js');
const Command = require('.././Structures/command');
module.exports = new Command({
name: 'ping',
description: 'This command tells the bot ping.',
async run(message, args, client){
message.reply(`Pong!`).then( message =>
{
const embed = new MessageEmbed('Pong.')
.setTimestamp()
.addField('-> Client latency:', `${Date.now() - message.createdTimestamp}ms`, false)
.addField('-> Api latency:', `${client.ws.ping}ms`, false);
message.edit({embeds: [embed]});
})
}
})```
.././Structures/command
const Discord = require('discord.js');
/**
* @param {Discord.Client} client
* @param {Discord.Message} message
* @param {string[]} args
*/
function runFunction(client, message, args){}
class command{
/**
* @type{{name: string, description: string, run: runFunction}} CommandOptions;
* @param {CommandOptions} options;
*/
constructor(options){
this.name = options.name;
this.description = options.description;
this.run = options.run;
}
}
module.exports = command;
let interactedAt
collector.on("collect",c=>{
interactedAt=Date.now()
})
?
tbh why make a class when the structure is the same as an object

and also at .then message is already defined
oh fuck
hold up
ok
i am getting the error again @errant flax
const { MessageEmbed } = require('discord.js');
const Command = require('.././Structures/command');
module.exports = new Command({
name: 'ping',
description: 'This command tells the bot ping.',
async run(message, args, client){
message.reply(`Pong!`).then( msg =>
{
const embed = new MessageEmbed('Pong.')
.setTimestamp()
.addField('-> Client latency:', `${Date.now() - message.createdTimestamp}ms`, false)
.addField('-> Api latency:', `${client.ws.ping}ms`, false);
msg.edit({embeds: [embed]});
})
}
})
show the error
wait what does the in thing do anyways
it is up to date
show it
do
console.log(process.version)
@earnest phoenix ^
ah
k
so its like an .includes method but in an object
does it uses the index or the value?
k
@errant flax
Uh.
I use v14.17.1 and its working fine with embed
just saying
But my Embeds are a bit different.
v16.10.0*
what the fuck
just checked
?
const embed = new Discord.MessageEmbed()
.setTitle("DJ Strawdong // PLAYBACK ERROR")
.setColor(0x00AE86)
.setFooter(`DJ Strawdong - Version ${version}`, client.user.displayAvatarURL())
.setThumbnail(client.user.displayAvatarURL();
.setTimestamp()
.setDescription('I was not able to find any song! Maybe try playing it with the URL')
message.channel.send(embed);
Thats why i wondered why he has 'Pong' in the Head of his/her embed
stfu
@flat pelican
smh
lemme install it
install v16.10.0
oh ok
and its his*
idk if thats a problem.. but it works for me and i never saw it different than that.
client.on("guildMemberAdd", async (member) => {
console.log(member)```why is this code not logging?
it's v12
Do you have the intent for that?
probably one sec
I was thinking of a ranking command for my bot. it's based on the XP received. but the only way I see to make this command work, is through iterating the whole DB and ordering a top 10 into an object which caches this data. the iteration should be limited per hour.
Is there any better way?
Hi, do you know why, when inviting a bot, the redirect_uri parameter is ignored and instead it redirects to https://discord.com/oauth2/authorized
Nevermind, I just forgot the response_type=code parameter
Hi, I have a discord bot (https://github.com/Ladvace/WiseMan-DiscordBot), the main feature is that the rank of a user is based on the time he spends in a vocal channel and not only on how much he writes in a channel, right now the bot it's not online and I didn't work on it for a while but I'm working on it again, I also made a dashboard that can allow users to manage the bot directly from it, the dashboard is not completed yet but I already implemented the login and some basic feature such as changing the command prefix.
I'm would be happy to find someone that could be interested in helping me developing and supporting the bot, my plan is to add more features to the bot, fix all the bugs, and probably adding some premium plan through the dashboard.
The bot is written in nodejs and the dashboard in react + nodejs (the backend), if anyone is interested feel free to open an issue on the repo or contacting me š
So.. hey
uh
I have a kinda huge problem with one of my Bots rn.
It never happened before but.. yeah..
For some reason this happened rn
https://i.imgur.com/Nz5BvjY.png
First was the EPIPE Event
Then the bot didnt start playing the song so i called the skip function (Thats on line 36), called it again and checked the "Log"
show your index.js






