#development
1 messages · Page 1130 of 1
But it's not very good at parsing html and stuff, only stuff presented that it likes, like JSON. But you can parse html with cheerio
no
You can install a package
Can you show me how
Like node-fetch, axios or others
@golden condor yo whats axios?
npm i node-fetch
Yes
ok
Axios is better imo
and then what
so I need to learn and rermber all of this
@lusty lintel you don’t need to remember it all
the guide is there to help you learn it
I need details on dm.
and apply it
You require it and use it in your code
hmmmm ok
@earnest phoenix You have basic knowledge of NodeJS
i need to have dinner
sorry
someone ping me on it
for an answer
/;
@earnest phoenix You have basic knowledge of NodeJS
@earnest phoenix wdym
so this all basic
hey is it possible for me to use the top.gg api on my website to display a total server count for my bot?
what the fuck
@fierce arch it is possible
how
By sending get request ofcourse
@fierce arch yes you just need to post to the api
@lusty lintel he is talking to someone else but yes it is basic
But one downside iz that you cant hife your discord token
everyone starts from somewhere
bruh then wher is advan
No you post, not get lol
advan?
Its gey
advanced discord.js
I have my bot posting its server count to top.gg just have no clue how to display server count
Wdym
That should show it
Oh wait i know
you just read the docs and apply what you know/have from the guide or other source
@fierce arch you use image
o
Lemme see
@earnest phoenix the image widget?
You can try use dblapi.js
Yah
If you don't already
Using py callum
Yoy want the server count on website?
o
@earnest phoenix yes
Then dblpy
Ic
my website is html btw
can i put my bot in top/gg
Spice up your Discord experience with our diverse range of Discord bots
If you edit your bot
I already have the widget
Scroll down
what that
maded the hacking command xd
can i put my bot in top/gg
@lusty lintel if it is online and approved when testing
which will be in 3+ weeks
once you add
bruh it do test then nvm
you can try dblpy [https://top.gg/api/docs#pylib]
Spice up your Discord experience with our diverse range of Discord bots
ohok
you can try dblpy [https://top.gg/api/docs#pylib]
@fierce arch
Spice up your Discord experience with our diverse range of Discord bots
yh
hwo you guys get bot dev in this server
Try the above ^^^
The bot is on topGG
but you see i dont want the widget just the server count
@lusty lintel Code a bot and submit it and then you get the role
Yeah
oh
I'm good with the widget
Lemme see if you can do that, I don't think just server count but lemme check
true programmers use the api instead of a lib
You want your bots server count on your widget ?
No
What's the best and cheapest VPS but windows oje
@ancient falcon I do that lol
Smfh
He want pure integer server count
o
@golden condor that was a joke please keep your sanity
I have a section on my website and i just want it to display in text the number of servers the bot is in
I use the api
can someobne explain what does mongodb do
You can use an API to your bot?
Make a small api
Like
That send the server count of your bkt
And then fetch it
And put it in the site
@lusty lintel It is basically just json but as a db so wont go courpt
Okay @golden condor
U can use flask I guess
pleas
Blxuu
yh
What is the problem
mk
You want to check it inside your bot?
No no no you don't need that
What library do you use?
you have to be authenticated with the gateway for this though don't you
node.js
how to get memory useage ?
yea
process.memoryUsage()
node.js isn't a lib
not working
Not to you
oh
That's to John
So
If you use v12 you can do this
i mean
client.guilds.cache.map(guild => //stuff here
)```
i need the actual code
use mathematics
Someone please help me
you need to convert the output to a readable number @viral iris
use mathematics
@ancient falcon ?
I'm getting a headache genuinely
/1024/1024
you need to convert the output to a readable number @viral iris
@lusty quest don't get it
oh
process.memoryUsage().heapUsed / 1024 / 1024;

My head hurts
Evaluated
58.76145935058594
Floor it to get rid of the excessive numbers
@viral iris that's how much memory your not is using
you can use Math.round
To round it to a whole number
Thanks sorted it as i remembered that the edit page allows you to get a widget size small of just your server count
process.memoryUsage().Math.round/ 1024 / 1024;
\ :emoji:
ok
so like
!veryfastpats <- like this
if reaction == "emoji": ?
bRuh
process.memoryUsage().Math.round/ 1024 / 1024;
@viral iris did you know basic js?
Evaluated
TypeError: Cannot read property 'round' of undefined
round()
I need to go lie down
if you want to use
you do""
no idea what you want to do, just fixed your line of code
how much ram did your VPS got?
how much ram did your VPS got?
@lusty quest 250
a got it
if reaction.emoji == '👍':
what
what lib is that
py
then its 61/250
since my bot doesn't use much memory, should I lower the limit and pay less money for the hosting?
Huh
no does I need to put my bot in top/gg pay money for put?
No
no
But you need to host it somewhere
i've used glitch before but it doesn't work now
@exotic prism if you want to pay less go for it, but if you're comfortable paying what you're paying you can keep the same vps for when your growth necessitates more ram
That's just my two cents
They banned uptime robot
That doesn't seem bad at all
so if i pay 512MB i would pay 0.44/mo
Then it's up to you really
https://discordapp.com/channels/264445053596991498/272764566411149314/741584871553630208
^ so I'm asking what is the recommended memory for discord bots
its a ticket bot which i added 30min ago
try {
message.reply(evaluate(message.content.substring(`${PREFIX}math `.length)));
} catch (err){
message.reply("sorry no algebra for security reasons");
};```
This is still getting me a throw.err and crashing the bot. How do i prevent that and send a message everytime a throw.err activates due to this
How many bots can I run in glitch at a time??
i guess no @mild flower
I'm currently running three bots they are running absolutely finr but my If my fourth bot enter it is turning off a bot @mild flower
bruh y u ping so much
what value should i use in
image:{}inside an embed object to change the size of the image?
@earnest phoenix i got rid of the variables and just copy pasted the try code but still not working?
bruh
evaluate(message.content.substring(`${PREFIX}math `.length)).catch(err => {
message.channel.send('NO')
})```
this work?
no it doesnt
it crashes as soon as it evaluates the equation
Hello, how do we know the number of servers in which and our bot (in the status) please
bot.guilds.cache.size @earnest phoenix
thank you but I my where?
hm
Learn js
in the client.ready
And read the docs
thank you ^^
how do i see if a variable has letters in it or not
i dont want to type every lettre in includes()
"abcdefghi...z".split("").some(x => text.includes(x));
that's really bad
don't do that lmao
@mild flower I have a TypeError: client.guilds.cache.size is not a function
if(var.includes("abcdefghijklmnopqrstuvwxyzz".split("").some(x => text.includes(x))))
@mild flower I have a TypeError: client.guilds.cache.size is not a function
@earnest phoenix replace client with bot
ok
that or regex (if (string.match(/[a-zA-Z]/)))
-botcommands @timid notch
@timid notch
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.
@mild flower I cannot put "bot" me because who replaces bot at home is "client"
you're error is because .size is not a function
@earnest phoenix ^, you should just do client.guilds.cache.size, without "()" after ".size"
ok thank you I test and I repeat
@wary flame hum low I don't know if it works because there is nothing that changes on the profile of my bot but on the other hand I have no error
What are you trying to use it for? Server count in status?
-botcommands 730124969132163093
Could you please use an understandable sentence
is this correct?
sorry i use google translate x)
im making eval so im making sure i dont fk up
@wary flame drop thanks anyway
@exotic prism if thats your userID code within the if statement will only be executed if you send the message
SUUUUUUUUUP so I'm trying to make an auth thing
like am i supposed to put <id> or id
But it can't parse the body of a req
The check is correct
try it and see
aEe
mobile :(
Fair
Yes?
express.json is a function, if you want to use it you need to do "express.json()"
@wary flame still returns undefined
Does app.use return anything?
Log it or what
Hi anyone selling good bot codes lol I’m buying
@earnest phoenix yes, dm me for resources that can help you with programming. And guess what? IT'S FREE
I mean
No ssssshhhhh I need nitro money
WHy isnt my try catch code not preventing throw.err
The error originated from outside it
Put a breakpoint
ok a code after the try was messing with it
but how do i make it so that it stops at the catch and doesnt execute code beyond that
thats my main problem
@pure lion if I look trough the docs app.use doesnt seem to return anything (as I thought), but that snippet will enable express.json for your server
Can you link the snippet?
I meant this
app.use(express.json())
Ye I'm doing that
I just need good codes lol
@earnest phoenix code it yourself then, or hire people on freelancer or fiverr to code for you

What is the minimum setinterval() seconds for changing statuses in bots? Is it 60?
@pure lion thanks the return fixed it
What is the minimum setinterval() seconds for changing statuses in bots? Is it 60?
@feral aspen There are no clear rate limits, generally you should not automate the api
What is the minimum setinterval() seconds for changing statuses in bots? Is it 60?
@feral aspen https://discord.com/developers/docs/topics/gateway#activity-object-example-activity-with-rich-presence
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
But I think you will be fine with 60 seconds, but youre responsible
refer to the gateway docs for ratelimiting
It's not woRking
router.post('/register', async (req, res) => {
console.log(req.body)
const User = new UserModel({
userID: userID(),
name: req.body.name,
email: req.body.email,
password: req.body.password
});
try {
const savedUser = await User.save()
res.send(savedUser)
} catch (e) {
res.status(400)
return console.error(e)
}
});
baccend^```
```json
{
"name": "1111111111111",
"email": "bsbsbsbs@h.com",
"password": "123456789"
}
body from postman^```
undefined
log body^```
app.use(express.json())
app.use(express.urlencoded({extended:true}))
yes^
what's the problem
Express.json doesnt seem to be working
^this
Is there a way to run a python file using Node.JS, if so, how does one do it?
look through https://npmjs.org
Hmm
confusing :/
okay weird
i tried sending the status as 200 but its still giving me bad req
Code them yourself
HMMMMMMMMMMMMMMMMMMMMMMMMM
Then you in da wrong place my budda 
help, i cant find a way to update arrays in MongoDB
code: https://hasteb.in/ricazomi.js
mongodb or mongoose or something else?
mongoose
Poll.updateOne({"pollmessageid":message.id,"votes.vote":vot},{$inc:{"votes.$.votes":1}});
``` this as example increments a value in the subarray votes in the array votes where vote is a string i define
I need help
With? Same problem still?
Yesterday i posted this problem but with a different error
rn im getting a new error that i have no idea how to fix
the error im getting is
if (!value) throw new RangeError('EMBED_FIELD_VALUE');
^
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
at Client.emit (events.js:310:20) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}```
this is the code https://hastebin.com/ibuvonumav.js
this was my problem
please @ me if someone answers thank you
> Henloo, so I changed from hosting on glitch to locally hosting my bot but for some reason, even after installing all the packages required, im getting a `MessageEmbed is not defined` error when its a global variable in the file. I tried to use a different command that used embed and it worked. I'm using discord.js v12.
> and I would like to say that i didnt change anything in the code when i started hosting locally.
> It was working fine on glitch.
Is that the whole stacktrace?
Wait I'm sorry, I see that's in your code
No nevermind
With? Same problem still?
Yup but I think it's an issue with postman
nope but i thought it was the most important part
but gimmi a sec i can post it
.map(category => stripIndent`\n${commands(`info`)}`)
.reduce((string) => string);```
Are you trying to use stripIndent as a function?
I'm not really sure what's going on in that line. It doesn't look like correct syntax to me but you should get a different error if it was :/
is not a funtion is more like its mapping it or like getting it from the folder
but yeah i should be getting a different error if thats the case
it was working fine on glitch
How does it work? variable"string" doesn't seem right.
I have tried this to update arrays but i get this error this (is in mongoose)
error:
(node:11268) UnhandledPromiseRejectionWarning: MongoError: Cannot increment with non-numeric argument: {Settings.messagelog: "723134799551922236"}
await Guild.updateOne(
{
guildID: message.guild.id,
},
{
$inc: { 'Settings.messagelog': args[0].id },
},```
read error lol
no
Make it a string column
I don't see how they would break but parseInt-ing then toString-ing to make it the correct type is inefficient.
How does it work?
variable"string"doesn't seem right.
@real niche stripIndent isnt the problem ; its just there to keep indent if theres an indent
its from a pack called common-tags
I just don't understand why it doesn't cause an error.
some dbs convert them to 7.3505588+eX instead of 73055588.....
they don't store the full number coz it's too big
that's also why discord itself store them as strings
bc its insignificant ; even if stripIndent wasnt there, code would work fine
its like it would me output prettier, if that make sense?
Looks like ` strings are given as an array to a function without parenthasis.
console.log(inp);
}
a`t` ```
outputs
``Array [ "t" ]``
How to make a voting system like this
partially #topgg-api partially #development
@earnest phoenix though you need to have a bot on top.gg first
get api key
Get the api token and read the dbl docs
you'll see
your bot is not approved yet, otherwise you'd have a green name
Spice up your Discord experience with our diverse range of Discord bots
yep
if your Language is not listed there, you'll need to write your own api wrapper for your language
But i really assume there's a wrapper for every language
understandable have a great day
yes?
#topgg-api is only for top.gg api
i want this code to update the value of messagelog to the mentioned channel id but instead of updating it it tries to create a new element why?js await settings.updateOne( { 'Settings.messagelog': args[0].id, }, );
#topgg-api is only for top.gg api
@tight plinth yes ik
k
Number is a number but it depends how you're interacting
So I'm using express to get the body of a post req (I am using express.json() in my app.js, as well as express.uriencoded({extended:true})) but it always logs undefined. Anyone have any ideas?
body-parser
yes, dont believe body parser is built into express anymore
Dam :(
how do i check if a message contains an invite in eris
just the same as you would do in discord.js?
and how do i do that in djs :fingerguns:
how do i check if a message contains an invite in eris
@honest perch I use regex patterns
regex is cursed
What and why
because yes
You check if it starts with discord.com/invite or discord.gg/invite
I mean discord.gg/
Not invite
contains seems better than starts with
Yeah
but regex would be better
My bad
yes regex
Then check for the length of invite
because without regex, there could be false positives
Regular Expression to Capture any discord link
It's still not working ;-;
fill it in
@lusty spade you dont search for the model you update first
where
no
?
r'discord(?:.com|app.com|.gg)[/invite/]?(?:[a-zA-Z0-9-]{2,32})'
@honest perch
i cant even click that box
/(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li)|discordapp\.com\/invite)\/.+[a-z]/g
i cant even click that box
which box
Just put it in ur bot
no
Then test
i want to click the box
use this
no but i cant click the box and its bugging me
Then press the left button
If you can’t then go get a good website
i cant click anywhere
Then you prob got a virus installed on ur pc or something
i have not
Then use other browser
nmw gave you the expression
How to make a bot at mobile?
use .match or regex.test()
How?
Hmm?
Then the site is broken
Why are you guys have verified bot developer badge?
no because the other guy did it
why not
-verifybot
Hi! It seems like you are looking for information on how to get your bot verified.
Once your bot reaches 75 servers or more, you are eligible for bot verification. On October 7, 2020, bots with 100 servers or more that are not verified will not be able to be invited to any more servers. You verify your bot on your bot's application page, under the "Bot" section in the sidebar.
If you need more information, check out this article written by Discord about The Future of Bots on Discord and you can ask questions in the Discord Developer Server.
We cannot provide support on how to get your bot verified.
^
And how to make bot at mobile?
it isnt even a fucking text box
Welp no one can help me?
LOL
Voltrex can just wait for him
@summer torrent explain
explain what
How are you supposed to make a bot in mobile
misly, uh
it's possible
what do you need on that site
how you did this
I made my bot on mobile using glitch
It’s possible but why would you do it
i found that on google 
You can’t host your bot on mobile
you can.
Really??? No one can help me???
your box have things in it
You can’t host your bot on mobile
@exotic prism you can
🤔
Welp i guess i have to watch it at YT
I just opened that website
the website is fucking rigged
https://cdn.hopefuls.de/yG7A works for me too
@earnest phoenix whats up
(node:43632) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined```
```js
// Route middlewears
app.use('/api/user', authRoute);
app.use(express.urlencoded({extended:true}));
app.use(bodyParser.json());```
```js
// Register Page
router.post('/register', async (req, res) => {
console.log(req.body)
const User = new UserModel({
userID: userID(),
name: req.body.name,
email: req.body.email,
password: req.body.password
});
try {
const savedUser = await User.save()
res.send(savedUser)
} catch (e) {
res.status(400)
return console.error(e)
}
});```
:l
req.body.name
name is undefined
https://cdn.hopefuls.de/yG7A works for me too
@rustic nova its rigged
yes
{
"name": "1111111111111",
"email": "bsbsbsbs@h.com",
"password": "123456789"
}```
body
Omg guys look I’m making a discord bot on iPad!
@pure lion req.body.name doesnt exist
console.log req.body.name
and show output
okay
does it wrok on capped, like DISCORD.GG/abakd77nnsmKa
well the thing is
No need to show output, it'll just make an error.
req.body logs as undefined
Omg guys look I’m making a discord bot on iPad!
@exotic prism wayyy ahead of ya, my discord bot is made on my fridge
@pure lion then you need to find out why its logging as undefined
I can't see why it would be
LOL
pedractyl panel i see
o
@lusty spade you dont search for the model you update first
@lusty quest i did what you told me to do but i still get the same error
(node:1852) UnhandledPromiseRejectionWarning: MongoError: Cannot create field 'messagelog' in element {Settings: [ { modlog: null, serverlog: null, messagelog: null, antilinks: false } ]}
await Guild.updateOne(
{
guildID:message.guild.id,
},
{
'Settings.messagelog': args[0].id,
},
);```
// Route middlewears
app.use('/api/user', authRoute);
app.use(express.urlencoded({extended:true}));
app.use(bodyParser.json());
to
// Route middlewears
app.use(express.urlencoded({extended:true}));
app.use(bodyParser.json());
app.use('/api/user', authRoute);
@pure lion
code execution is a pain
pedractyl panel i see
@restive furnace the host is cheap ok? it’s only $0:88/mo so don’t expect a custom panel
you'll get the hang of it eventually
I don't mean to interrupt, is there a method to add an array or multiple Roles? i think i figured out how to fetch roles by their id but i can't assign multiple roles at once
@lusty spade try this https://stackoverflow.com/questions/15691224/mongoose-update-values-in-array-of-objects
you can use an array of roles to roles.add()
@restive furnace the host is cheap ok? it’s only $0:88/mo so don’t expect a custom panel
yeah, i didnt say its bad
ahhh of course
@exotic prism the panel is not custom. its a open source Game Management panel that also offers the ability to host Discord bots. in the End you get a Docker Container where your bot is running ing
thanks!

he said dont expect a custom
@pure lion lemme know if it works!
@exotic prism the panel is not custom. its a open source Game Management panel that also offers the ability to host Discord bots. in the End you get a Docker Container where your bot is running ing
@lusty quest it’s not, it just a pterodactyl panel
it does, thanks luke :)
i used it for a few years
The word ‘custom’ means something made especially for an object
no problem
but its limiting what you can do within the bot
I don’t think
how would i see if a message contains something in eris
same like d.js
.includes()
@delicate zephyr u will help me?
Make a bot
@honest perch <message>.content.includes()
message event has not been changed on eris expect the name | not saying its fork lol
@earnest phoenix you can get a fairly easy start using https://discordjs.guide/
just be aware it isnt easy
if you use regex, use <expression>.test(message.content) or message.content.match(<expression>) @honest perch
it will take time to learn
@summer torrent just link the actual tutorial
instead of a message link
Does anyone know what is 1+1? I need it to finish my bot.
2
3

3
@real niche ok ty
wait no, 11
np
"1" + "1" = "11"
so like this @lusty quest ?
await Guild.updateOne(
{
guildID:message.guild.id,
},
{
$set: { 'Settings.messagelog': args[0].id },
},
);```
Ohhhh
what about if it is a number 
lets say its not
Nonono
Just use php and "1" + "1" = 2
I mean it’s not a integer
11
In Java
string + string = stringstring

okhe
who is math noob
@lusty spade try and see
it gives the same error also
i need help every command with values in my script are broken
yes?
What exactly does that mean?
wait
Maybe try putting debug lines around where it is called
@real niche this.
i had an issue with my command handler
Ok actually I gotta go to bed now gn
wait i am making a hastebin
and a few debug lines figured it was with the overwrite checking
Ok actually I gotta go to bed now gn
@real niche gn
how would i get a servers name from an invite
i can't save the hastebin
Use my bot
@lusty spade is your path correct?
Ok not yet 1 more question @honest perch what language?
it don't stop saying something went wrong when i try to save my hastebin
eris js
umm
@jolly wave aa!bin #development it works on files gogogogog
yeah time for sleep
?
should be cus the error shows the part
Oops wrong channel
just use pastebin instead if hastebin doesn't work
X)
should be cus the error shows the part
and when i add a $ between settings and messagelog it gives
The positional operator did not find the match needed from the query.
oof
aa!bin testing 1
@lusty spade it says it cant create the element this is why i think your path is maybe wrong
oof
@jolly wave https://paste.hopefuls.de/zukepokaxe.js
for the people who don't want to download the txt
oh ty
it is correct cus the messagelog is in the path Settings: [ { modlog: null, serverlog: null, messagelog: null, antilinks: false } ]}
my bot literally has a command for that >:(
ok so
so anyone can help me
can we just use 1 message event
your model?
@lusty spade extr }?
schema*
that was the error
Bruh
how would i check if a user has a role or not in eris, last question
and every message
it will send a profile embed as that if statement doesn't do anything
Jeremy add index.ts to your node turn to string package
wdym
if (msg.content === "?profile")
msg.channel.send(embedProfile);``` this here
yes
if you were doing this properly it'd be
if (msg.content === "?profile")msg.channel.send(embedProfile);```
but to be more efficient, that builds it every message
@lusty quest you mean this?```const mongoose = require('mongoose');
const guildSchema = mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
guildID: String,
guildName: String,
prefix: String,
Settings: Array,
});
module.exports = mongoose.model('Guild', guildSchema, 'guilds');```
can't understand
so it'd be better being js if(msg.content === "?profile"){ const embedProfile = new Discord.MessageEmbed() .setColor('#0099ff') .setTitle(`${msg.author.username}'s Profile`) .setAuthor(`${msg.author.username}'s Profile`) .setDescription(`${msg.author.username}'s User Informations`) .setThumbnail(msg.author.displayAvatarURL()) .addFields( { name: '\u200B', value: '\u200B' }, { name: 'ID:', value: `${msg.author.id}`, inline: true }, ) .setImage(`${msg.author.displayAvatarURL()}`) .setTimestamp() .setFooter(`Every stats of ${msg.author.username}`); msg.channel.send(embedProfile); }
ooooh
@lusty spade yes
isn't the script i showed my command handler?
Kinda, its more of just elseif spaghetti
Spoghetti
It'd be better having the owner only commands in the main message event
i tried to put it but it didn't worked
and using awaitMessages
@lusty spade iirc you need to set an array to update the stuff inside the array bcs you havent defined them in your schema
can't understand
how do i do that?
const filter = m => m.content.toLowerCase() === 'yes';
channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
.then(collected => thing you wanna do on collect)
.catch(collected => msg.channel.send(`cancelled`));``` and you can add the owneronly bit onto the filter if you want
@pale vessel how would i then get the invite out of that regex for example for it to only show the posted invite
define your stuff you want to update as a array like the way you set it to the config
time to learn some js
oh ok
use brackets and .match()
match will return the detected expression
console.log(content.match(...)) in that block
you should define it once
and check if (match) { console.log(match); }
i'm eating so gtg
@lusty quest like this?
const guildSchema = mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
guildID: String,
guildName: String,
prefix: String,
Settings: Array[{
modlog: String,
serverlog: String,
messagelog: String,
antilinks: Boolean,
}],
});
module.exports = mongoose.model('Guild', guildSchema, 'guilds');```
Sstt
if (command === 'yesorno') {
if (!args.length) {
return message.channel.send(`${config.no} the bot can't answer to emptiness, ${message.author.username}`);
}```
so somehow this is deleting the command, sometimes it doesn't delete it. I don't want it to delete the command at all
that's just a small part of my code
@pale vessel nvm got it
I'm currently trying to send a message to all servers my bot is in but I'm kinda stuck since it just sends it to 1 server.
guild.channels.forEach(channel => {
bot.channels.find(channel => channel.name === 'general').send('**THIS IS A TEST**' + 'Happy birthday to ' + '<@'+results[i].bdUser+'>' + ' Take a shot!' + '**THIS IS A TEST**')
})
})```
Any ideas?
You should avoid doing that.
why?
It's spammy and typically unwanted, unless it's a opt-in feature or something.
I mean it's kinda opt-in
since it actually checks if there is a birthday channel (well as soon as it works)
Djs 11?
ye
It looks like you're trying to find a channel by the name of general. Plus, it doesn't seem it matters on which guild(s) the user is from, which would cause it to go to all guilds. Anyway, it seems spammy for the API.
The issue is that you're trying to re-find the channel in an inner forEach loop with the same variable name as your forEach loop (.forEach(channel => { vs. .find(channel => ). You should just scrap that part and check if channel.name is equal to whatever birthday channel is supposed to be set.
I still don't recommend going through with it.
I mean I could also add a command to enable the birthday thing if needed, would make it easier I guess
@lusty spade did you got it working?
A few people reported their bots got banned from discord(and where told to contact discord) for having spammy features.
This happened earlier this week.
Theres a good possibility that a feature like this will result in you hitting ratelimits pretty quickly.
Potentially getting the same result
hmm
I mean I could also just add guild id's I guess that want it?
instead of sending it to every server
@lusty spade did you got it working?
@lusty quest no the array has now has _id but it still gives the same error when i try to update it
are you sure you dont have any spelling mistake?
hey there is there any bot that collects email from user when they join and assign a role after that ??
please help
why would you do this?
what
yea im pretty sure
Lysec in general, you should avoid doing an action that may or may not send several API requests in bulk, like how you're trying to iterate over all guilds channels and see if it equals general. Imagine if 20 channel names are equal to that.
why the hell would you need that
You can make servers with 500 channels names general
So your bot would send 500 messages for every birthday
it adds a new layer of protection the Hoster of the bot needs to do then (encrypting the Database)
For one guild
Imagine someone maliciously making 10 accounts with the same birthday
5000 messages
rat limit
In a short period of time
true
Its not only a bad idea, its a scary idea
how many 429/401/403s is it to get blocked for an hour
urgh ._. I liked the idea but didnt think that far
I think they changed it
@lusty spade did you tryed how they show it in the stackoverflow page?
Ok i tried to create a bot
error and code pls
code
ok
Is it possible for a 14 yearold to be a fullstack Javascript dev
I get a refrence erro: message is not defined
maybe u didnt define it
yes if you work hard enough
how would i check if a user has a role or not in eris
Is it possible for a 14 yearold to be a fullstack Javascript dev
yes
Thanks
yea i tried to put _id and it said it changed it but when i check nothing changed
but fullstack js dev makes no sense
oh
name: 'gay',
description: 'See how gay a person is lol',
execute(message, args){
let gayembed = new Discord.MessageEmbed()
.setDescription(${message.author}, you are + Math.floor(Math.random() * 100) + `% gay. :rainbow_flag:)
.setColor("#A4C9F6")
message.channel.send(embed)
message.delete()
}};
message.channel.send(gayembed);```
Whats with the obsession with becoming a fullstack dev anyway
I get a reference error with "message"
message.channel.send is outside of execute
oh
is that js
Yeah
cool
@solemn latch it apparently only sends it to 1 channel, no matter how many channels there are with the same name
so seems like that wouldnt be an issue
that's because you made a small error in your code
plus it still says the same message multiple times in that channel correct?
sorry to interrupt, i'm getting a "DiscordAPIError: Missing Permissions" error when i try adding roles using my bot, is that exactly what i think it is and the bot's lacking the perm to give roles out?
it is
uhm I tried it with a different command of mine, lemme see how it works with the birthday one
thats exactly what it is
huh
im scratching my head then
it has the ability to kick and ban but not apply multiple roles
Manage Roles is needed
ahhhahaha
@sudden geyser it sends it 5 times because it's on 5 servers currently
I guess it would send it once to every server if I did it right
also the bot needs to have a role that is a higher rank than the roles you want to give
higher literally in position?
add .cache
Yeah and I explained the issue up here: https://canary.discordapp.com/channels/264445053596991498/272764566411149314/741646731896422420
its message.guild.channels.cache
Yeah so that should work then
try updateOverwrite
did someone know if you can read stuff directly from a Github repo into javascript? like having a json stored in a github repo and then just pull it when the bot starts. (Translation for the bot)
Superbrain, moving the bot's specific Role physically above the roles it was granting in the List fixed the issue, thanks!
and its {
id:userid
deny:["SEND_MESSAGES", "ADD_REACTIONS"]
} for updateOverwrite
Probably something you can do with the github api
then its role id
time to read some docs
idk i don't do mine like that
message.guild.channels.cache.forEach(channel => {
channel.updateOverwrite(muterole.id, { SEND_MESSAGES: false, ADD_REACTIONS: false });
});```
(discord.js v11) how do i get a user object from another shard using their id
move to v12 for one
what is it in v12
discord.js v12
<client>.users.fetch(<id>)
v11 is deprecating this week iirc
that works across shards?
Its already deprecated isnt it?
yes because it fetches from the api
im not sure woo
doesnt matter if its on that shard or not
They are not doing any patches to it
ok
v11 breaks in october
well luckily i don't have many things that rely on discord.js v11's specifics
on the bottom, with a notification
October is when it doesnt work. Its already deprecated
v11 will die in october because it doesnt have the required features to run with discord's api
hi guys i have a question so there is something called bot designer for discord and i used it and made a good bot can that bot get verified too? for me to get verified bot dev
If it has custom commands
why not just learn to code
Thats part of the fun
hi guys i have a question so there is something called bot designer for discord and i used it and made a good bot can that bot get verified too? for me to get verified bot dev
@earnest phoenix afaik you cannot get verified
check with the lads in discord.gg/discord-developers
hard is just an obstacle.
hard makes it fun

#development message it is like learning another language but easier
now i wonder what would make more sense. grabbing my translation files from github and store them as json on my bot or make a collection and store the json in there. (pulls the files each time the bot restarts)
Is there a specific reason it has to be from github?
Do you not download the json from github when you get everything else?
i can make it open to translate for others
if they spot a spelling mistake make a pr and i can easy merge it
😔 can anyone dm me a good vid thats shows how to make a bot
dont follow youtube tutorials, as they are likely outdated
Videos are not really the best for development
oh ty
well what language do you want to learn
The emoji programming language
i want an easy language
js
Hello,
I am making a bot and everytime it sends a message I add a ❌ to the message in case they want to delete it. At the moment I have a reactionCollector running on it but it times out. Is there a way to not have a collector at all and just check on a messageReactionAdd event to see if the user reacted on the message of the bot?
(Using discord.js v12.2.0)
python
python is bae
Python or js
oki il look online for python tutos
@odd lichen u can
well I tried checking for the author of the message but i cant seem to get it
it appears as null
u have to use name
@odd lichen on the messageReactionAdd event, the second parameter is the user instance, which is who added the reaction
yeah but i also have to check for the author of the message that was reacted on
to make sure it was the bot
who owns the message that was reacted to
Shouldn't author only ever be null if the message was made by a webhook?
its made by the bot
- I probably also have to check if the bot itself also reacted on the message
well you could use reaction.message.author.id (reaction is the first parameter) to get the author ID of the message the reaction came from, which you can then compare the bot's user ID
is there also a way to check if the bot reacted with ❌ too?





