#development
1 messages Β· Page 1298 of 1
You arent allowed to store it nor share it
WOoo stop breaking the law
Reported @solemn latch
And in your code, disableEveryone: true should be disableMentions: "everyone"
I need to disable everyone
havent because i would need to actually do stuff
and that sounds like work
I disabled it lmao
Does here count as everyone?
I assume it does
In d. Js at least
I think so
Feels bad, in a party and im replying in #development rather than going around lmao. #devLife
When u make ur client
ah I see
There are optional options u can initiate it with
lmao
alright thanks
Someone throw em the docs on Client pls
imma got to bed and finish the legend of going to bed at a reasonable hour
@solemn latch ty
Wdym?
Does here count as everyone?
yeah according to dapi docs its@hereand@everyone

what is shard
bot.shard
Huh???
.shard
Shard helpers for the client (only if the process was spawned from a ShardingManager)
Type: ?ShardClientUtil
it is not recommended to start using it unless you are getting close to around 1k servers
LOL
tl;dr come back when you have 1k servers that your bot is in
@fluid basin discord development is like playing a game, BUT the floor is on fire, the walls are errors and the compiler works 30% of the time
and random sprites glitch
ok time to finish the legend of going to bed at a reasonable hour
gn
tbh sharding at 1k isn't considered late at all
what even is sharding
Just gonna flex that im doing my own cluster
1 glass, you drop it, it breaks into shards
so basically
its breaking up your bot into multiple smaller ones (with the same functionality)
well yes
but the most important one is for discord to balance messages that your bot get
Its basically splitting X amount of channels to be processed by a core
message.author.send(`I'm Missing IMPORTANT permissions to send messages: ["SEND_MESSAGES", "VIEW_CHANNEL", "EMBED_LINKS", "ATTACH_FILES"]. In ${message.guild.name}`)
Rather thsn have ALL of them onto the same channel
well, some bots shard on the same thread.
Isnt the whole point of sharding splitting work between threads so it doesnt clutter just one?
i thought so
Sounds off but must me my lack of knowledge
how can I test if the bot can send messages to the user
you can't
can I catch the error
how
try/catch + await
await message.author.send().catch()
^^
so when i do html <style> body { background-color: #696969; } </style>on my bot page, nothing happens, tryna set a background color and i think i may have done it wrong π³
why 696969
what color is that
why not
"why 696969" 
@opal plank using tim.
https://discordapp.com/channels/264445053596991498/272764566411149314/747845035319361537
you need to override the default css
@fluid basin sounds fancy how do i do it
what color is that
@solemn leaf light grey iirc
@solemn latch funfact im doing the same
Just re-emitting everything onto main process
internal sharding is great but dumb
I've never used dank memer, and honestly have no idea what people are talking about when they refer to it's functionality
My text-to-speech got butchered there
Im fairly certain the way im doing is not the most optimal but really decent
so just html <style> body { background-color: #696969 !important; } </style> ?
yup
you'll need to explore then
there might be a few background-* stuff on the site
you need to make sure you remove and overwrite all of them
π€·ββοΈ internal sharding sounds great. problem is my bot likes to destroy the cpu so internal would never make sense.
yeah lmao internal sharding is dumb unless you have a beefy cpu with great single core perf
also if you really want to scale your bot
thats the thing tho, internal sharding uses 1 core per group
Should be using it on a good vps
make sure cpu-bound tasks are not within the bot process
Or good cpu, at least
so internal makes no sense
not internal sharding woo
nodejs only uses 1 core/1 thread for cpu-bound tasks
which is also the main thread
nodejs spawns threads only for IO-bound tasks
libuv balances it
https://gyazo.com/70c112eabf60ef41b1afac1f4e6f3288 how do i change the color of this
wtf lmao
IO including http?
while those waiting will take up the worker threads
Just looked, without knowing i did something similar to d.js lmao
yes IO include disk reading (NOT sync ofc), networking (sockets + http + whatever)
IO => input/output
data basically
all code/logic runs on the main thread
ive not seriously loaded my bot down yet, i wonder if its not as bad as it looks
because http loads have been maxing my cpu out if theres more than 4 at a time
I have a small question related to setting up webhook stuff (not asking in #topgg-api because it's not directly related to the DBL API)
basically, I'm trying to use the aiohttp Python module (feel free to shun for for using discord.py) to set up a small web server thing for handling DBL votes
however, upon loading the DBL cog, aiohttp doesn't actually run async and prevents the bot from starting... what should I do?
also, code snippet:
self.app = web.Application()
self.app.add_routes([web.post("/dblwebhook", self.handleDBLVote)])
web.run_app(self.app, port=10215)```
What im doing is dynamically spawning them as needed with a variable and adding them as needed
If your channnel count is bigger than 500 channels per 'shard' it spawns more as needed
They redirect onto client
So you dont notice a difference
main thread: hey we have an async line that does http request
main thread: creates network connection and throws to worker thread to await the network response
main thread: meanwhile lets work on the following lines after that async
worker thread: I'm ready! slots the response back into the internal queue in nodejs
main thread: OH the worker is ready, lets process that (e.g. json parse etc whatever)
main thread: ok we're done, lets continue where we left off (from the queue)
basically how nodeJS works
heyyy can someone help me with my code
not without more info
heyyy can someone help me with my code
@clever beacon you need an async context to make it run async afaik, and usually inside of a thread
a band?
if you just do <app>.run_app it will block
can someone help me
actually that would make sense now considering itβs in __init__
which isnβt async
no, you are not giving enough info for us to help @lucid prawn
yeah your best option is to start a thread @clever beacon
ensure_future or smth
can someone help me with my code const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('chill bot 2 is online');
});
client.login('NzYyODU3NTEwMTAwNzk1NDAy.X3vQaw.RnbuyZuzlMLwhiZPm0H_HSkP_bE');
@lucid prawn refresh token
kek
And delete that shit
did you just get a link from discord @lucid prawn
no
discord should auto-refresh your token once it figures out that you just leaked it
and you should get an email
github does
but delete that and refresh your token
ok
π€·ββοΈ
so can u help me
code
what do i do when i type node . it just popup black
@clever beacon this should be helpful: https://stackoverflow.com/questions/52336409/discord-py-rewrite-basic-aiohttp-webserver-in-a-cog
so you either use the bot's loop to "async" it
or you create the server and add the bot into its "async" loop
how do i change the buttons background color on my bot page, what do i use? html <style> body { button-color: #696969 !important; } </style> not sure what to do
find the responsible class/tags of the button, then change those
it is recommended to learn css/html if you don't have prior knowledge on that
where can i find those
inspect element
it is recommended to learn css/html if you don't have prior knowledge on that
mainly css actually
you need to know accessors (class, id, element) and attributes
button-color is not a css attribute
Do you know a better cloud than heroku?
any vps
thanks
How to Give a bot command to randomly generate work
**rask
Task
Like If I have many options like
What is your age? Your name? Your favoirite bot? And the bot will type it randomly
have an array, get a random number between 0 and the number of elements - 1 and thats your output
age can be the random number
Just like a conversation bot that talks
chat bot?
Yes You can say
@solemn latch how to use it I am a noobie so I dont know π π
chatbots are typically extremely expensive to research if they are anything more than randomized lines
which is what i suggested before that you denied
i want to learn neural networks for this sole purpose but i donβt think discord would be too happy
Isn't there any code to generate?
yeah, if you are a pro
Random words
@solemn latch can you tell me a Sample
Guys I tried RR not commands it didn't Respond
i told you how to choose random lines...
@solemn latch can you please type again
How do I Make Reaction roles respond I tried the commands it didn't Resond
welp, I'm a little bit lost
I'm trying to open my AWS instance's ports so they can be POSTed to via DBL webhooks, however I must have done something wrong here
I have my instance's security group set up here to open port [redacted, no DDOS for you], but when I try to post to it, I get connection refused (indicating that the port isn't open)
and the cURL error
and yes, the security group is associated with the instance
is anything on that port when your posting?
iirc, ports are still considered closed if nothings on the other side.
@solemn latch I have tried but he is getting fed
i haven't pulled changes yet but it should just be a 404 or something, not a full connection refused
He is replying many times
404 only happens if you have a webserver up right?
it happened earlier when I was testing locally and had my port set incorrectly on my webserver
it gave a 404
actually
i could be wrong
psh i could be wrong too
lemme try again with cURL
How can I make my bot to randomly generate a no from 1 to 200. Can you type the code?
huh okay I think you're right actually Woo
i'll try pulling changes to my instance
the reason I got a 404 earlier was because the webserver was running but I wasn't going to the endpoint
and I don't have an endpoint on root
idk what programming language your using, cant really help @earnest phoenix
@solemn latch java
java and javascripts random number generation is the same?
yee
Math.random()
@sonic lodge I want from 0 to 200
no Java has the Random class
then multiply it by 200 π€
oh yeah, math.random() is just one way
Math.random() * 200
this isnt a teaching server btw
nor a spoonfeeding server
@sonic lodge yeah ok What is math.floor?
we are glad to help, we can point you in a direction, but dont expect us to sit here for hours answering every question
@solemn latch no I am sorry If I asked to much questions
floor -> round to next lowest integer
round -> round to nearest integer
ceil -> round to next highest integer
@sonic lodge ok
galaxygate
does it support py?
well for free
free servers? not really a good idea imo
You can get bluefox free version its good for starters
if you ask me, storing other users data is a bad idea if you dont trust the provider
presuming your doing that of course
Code to generate random words is word.random legit?

we dont spoonfeed here, but yes using the method we explained it will work
You could put all the words in a array and randomzize the array technically
@hazy sparrow what? Can you explain it
just put the words, or sentences you want in an array.
With an example
we dont spoonfeed here man
this is not a spoonfeed server
What is an array? { ? Or (?
wowie
["first thing","second thing"]
Oh thanks
@earnest phoenix It's super easy to generate random numbers within a range in JavaScript using METH i mean math
Umm am I supposed to write math.random or anything else
yes
Math.random()
Ok thanks brother
if you multiply the number Math.random() gives with your max value it will NEVER be bigger than that because 1 * anything is always the number and Math.random() only generates numbers between 0 to 1 (decimals)
@earnest phoenix I dont want numbers I want random words
you can get random indexes from an array
you need numbers to get things from an array
^
Array has an index
yes
Just make sure its within maximum rage
you can do arr[Math.floor(Math.random() * arr.length)] to get the random value
kinda like:
Math.random() // returns a number between 0 and 1
Math.random() * maxValue // will always be smaller than maxValue but never zero
Math.floor(Math.random() * maxValue) // rounds the number upwards so it's a whole number NOT a decimal
try replacing maxValue with the length of the array (array.length)
Range*
you can do
arr[Math.floor(Math.random() * arr.length)]to get the random value
@vital lark spoonfeed
it's not huge chunks of code
smh
if it's just a line, it's not considered spoon-feeding
How are you guys coding here
pc
Its showing wrror
Oh
what is the error
How are you guys coding here
@halcyon shore how does one code on discord with only bot eval commands and Chrome Dev Tools
absolutely is spoon-feeding.
Everything he needed to do it was given to him
What error @earnest phoenix
@hazy sparrow its showing ; is an error
@earnest phoenix WHY IS THE PREFIX !
aaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaa
over-used as fuck prefix
@earnest phoenix because its easy
wha-
then your bot will clash with 100 other bots
because 99.99999% of bots on discord have the same prefix ! and if someone sends !help in a server with a lot of bots they'll get fucked
That's not how you do it @earnest phoenix
@earnest phoenix I am not using !help command
That's not how you do it @earnest phoenix
@hazy sparrow then?
@earnest phoenix you can do array[indexNumber] to get the specific value from an array at that index
arrays are indexed from 0
array[0] returns the first element array[1] returns the seconds element and so on
You can pass a random number as the index
Also why the fuck are you using a seperate event for each command
@hazy sparrow thanks
@earnest phoenix you 100000000000000000% need to learn JavaScript before trying to make a bot
Yes please do that
it's a fucking necessity
look at my pull request on discordjs.guide
i added a bunch of extra links to learn javascript
Or you could make your own language
Or you could make your own language
@hazy sparrow that'll need you to learn machine level language first
put the words you want in a array
@hazy sparrow its till showing an error
Please fucking learn js before making a discord bot
@hazy sparrow but its showing error
I-
Glitch error messages ahh
its like developing on a platform with a ball and chain around your ankles
window?
Aaaa learn js
woo who?

Also @earnest phoenix you dont need to do client.on on every single command
do you need to create a canvas element to use d3.js or will it automatically create one?
@silver lintel ok
d3.select("body"); does nothing?
d3.select("body").style("backgroundColor","#FFFFFF");
this ain't working. D3 uses camelCaseWhichJavaScriptUses or dashed-case-which-CSS-uses?
the page i linked to
"d3.select("body").style("background-color", "black");"
π °οΈ
What if I have given my bit 4 words to type randomly and these Words are A,B,C,D but My Bot is Is only Typing D not The others
whats your code?
What if I have given my bit 4 words to type randomly and these Words are A,B,C,D but My Bot is Is only Typing D not The others
@earnest phoenix maybe just a coincidence? send the code please
Ok
msg.reply(("Nice","Poty","Muut","OP"));
we can use element.append() to add an element inside it but how do we remove one?
@earnest phoenix PLEASE LEARN ACTUAL FREAKING JAVASCRIPT


















@earnest phoenix I haven't used this
do you realize what that does
it sees ("Nice","Poty","Muut","OP"), and decides to evaluate the strings inside
so you clearly have no clue what you are doing
and you're refusing to learn even the basics
can you use IDs in d3.select();
why did i randomly put a semi colon at the end of the message 
Is there a way for a bot to leave a server without being kicked/banned?
guild.leave
library?
or depending on lib
D.js
oki thanks
on most libs it's Guild#leave(), that's what I can say
I wanna make a leave command thats why lmfao
@earnest phoenix make an array with the values, and generate randomnum and do array[num]
make it say itll make the bot leave, but make it kick the user @hazy sparrow ;p
LMAO
@silver lintel ?????????
ugh learn javascript
these are very basic programming concepts
yep
array[Math.floor(Math.random() * array.length)]
basic
how do i make the command stop after .catch(err ) stuff is executed
for example im making a nickname command and whenever it catches an error cus it cant change nickname i cant get it to break
nickuser.setNickname(nick).catch(err => {
if(message.guild.me.hasPermission("ADD_REACTIONS")) message.react('β')
message.channel.send(nickerror)})
message.channel.send(`β
Changed ${nickuser}'s nickname to ${nick}`)```
array[Math.floor(Math.random() * array.length)]
@silver lintel yaar
go learn it, you will not be spoon fed
@mild flower return?
Did I said?
not working
sstop speaking hindi
lol
wb shiv
Google how to create an array and how to get a random element from it @earnest phoenix
@mild flower do you mean you dont want the stuff in catch to run? or do you not want things after the error to run?
@silver lintel how did you know that I am speaking Hindi??? Huh?
@mild flower do you mean you dont want the stuff in catch to run? or do you not want things after the error to run?
@solemn latch after the error
i tried bypassing that with an if statement to check whether the nickname of thet user is same as inputted
but doesnt seeem to work
@earnest phoenix B)
i tried this if statement:
if(user.displayname === nickname) return message.channel.send('success')
(dont worry about those variables)
if your in a function you can just return at the end of catch right?
your other option is use try catch rather than .catch
if ur using d.js, User#displayname prop doesn't exists
that too
then what should i use for that
use User#nickname instead
i just ignored it because he said the vars didnt matter
nicknames are attached to members, not users
it sends null if the member don't have any nick
let me try usint try:catch
Can someone join my test server and see if my welcome message works?
You can leave afterwards
This is my code
client.on("message", msg=> {
if (msg.content === "!character") {
msg.reply ??? What should I type ahead?
send it in dm @sand sparrow
Okie
For random words
@earnest phoenix people gave you copy paste code even tho its against rules π€·ββοΈ
@solemn latch no they didn't!
if you actually knew js, you would know exactly how to do it
^^
I know they did π€
hey
the try and catch is not working
whenever i get an errror
it doesnt catch it
π€¦ββοΈ
f
try {
nickuser.setNickname(nick)
}
catch(err) {
return message.channel.send(nickerror)
};```
what am i doing wrong
its not catching anything?
yea
no clue
setNickname is a promise
anything that does a REST request is a promise
you can't make asynchronous code magically work as synchronous
o, yeah 
you cant return if lol
ah yes
if(condition) return x
else return y
ternary operator
it just gets interpreted as if else so it's still not return if 

i think i got it
can anyone give me guides on how to play spotify links for my music bot
you can't
eh?
you're not allowed to stream from spotify
but
no bots stream from spotify before you say they do
i mean
but other bots do accept spotify links
still getting both outputs
aaaand there it is
ah
the bots just scrape the spotify link and then search it on YouTube ^^
Any help me
so does anyone have docs on how to get the info of a spotify song / playlist
google it
i did
there's a plethora of guides on how to scrape spotify
and it take me to the spotify dev page
there's a plethora of guides on how to scrape spotify
can u give me one
they said something about ouath and user tokens
client.on("message", msg=> {
if (msg.content === "!character") {
msg.reply ??? What should I type ahead? For random words?
and i have no idea where to get my user token
@earnest phoenix u make a array of words and randomise it
(thats how i do it)
@amber thistle how?
Did I tell you to Google it yet
@slender thistle yes
we have been telling him the same thing all night,
"create an array javascript"
and
"get random element from an array javascript"
past 4 hours
But it's not giving what I want
wdym it's not
var things = ['Rock', 'Paper', 'Scissor'];
var thing = things[Math.floor(Math.random()*things.length)];
source: https://stackoverflow.com/questions/13237421/how-to-generate-random-words-in-javascript
what are you getting
I just gave you the search queries
client.on("message", msg=> {
if (msg.content === "!character") {
msg.reply
I have just typed thus
This**
its not like we magically know because someone told us...
Read the stackoverflow link above
we learned from the internet π€
not everything will straight up give you what to mindlessly copypaste in your code
learn to use your brain and think about what you need to do
the point of programming is to logically resolve problems
^
Not harsh at all
Its the truth
Shouldve been
client.on("message", msg=> {
if (msg.content === "!character") {
var things = ['Rock', 'Paper', 'Scissor'];
var thing = things[Math.floor(Math.random()*things.length)];
You wont get muted
Ive sworn at these guys and nothing happens to me
π€·ββοΈ hes been asking the same question for what feels like 4 hours
Using var 
var poggers
that's not even their code 
client.on("message", msg=> {
if (msg.content === "!character") {
var things = ['Rock', 'Paper', 'Scissor'];
var thing = things[Math.floor(Math.random()*things.length)];
they did a ctrl c ctrl v with the snippet shared above
client.on("message", msg=> { if (msg.content === "!character") { var things = ['Rock', 'Paper', 'Scissor']; var thing = things[Math.floor(Math.random()*things.length)];
???
Is this right?
please dont copy paste code. youll never learn to code just by copy pasting like this.
@earnest phoenix well I am not mature
Help vampirism be like
why isnt it punishable
okay, 2 30am, time for an emergency sandwich and bed. gn lads and laddeets
tfw there's so many help vampires that you're happy once somebody who knows what they're doing asks a question
magic
@slender thistle can you pull out the ban hammer yet?
i was gonna send the gif but android does not like it apparently
dont forget to cache
Imagine caching lol
wrong person
at validChunk (_stream_writable.js:265:10)
at StreamDispatcher.Writable.write (_stream_writable.js:299:21)
at StreamDispatcher.Writable.end (_stream_writable.js:582:10)
at Client.<anonymous> (/app/index.js:384:43)
at Client.emit (events.js:196:13)
at MessageCreateAction.handle (/rbd/pnpm-volume/ce508b36-1345-4992-8429-90d810771830/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/ce508b36-1345-4992-8429-90d810771830/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/rbd/pnpm-volume/ce508b36-1345-4992-8429-90d810771830/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/rbd/pnpm-volume/ce508b36-1345-4992-8429-90d810771830/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/rbd/pnpm-volume/ce508b36-1345-4992-8429-90d810771830/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)```
How To Fix It ??
Pls Ping Me If You Can Help Me
So No Need To Fix It ??
Then why is your name βImMature YTβ
@earnest phoenix the name isn't even I'm mature, it's just "Immature"
What's the best way to make a simple tictactoe game?
Ah, but technically it's possible using else if statments right?
yes
ok im rolling with that then

check their presence
how?
what library are you using?
discord.js?
yessir
you can use member.user.presence.activities. member can be message.member or any member instance
this will return an array of games/apps that the member is playing
Flazepe, such a good person
ok
How often can I get a bot to edit a message without abusing the API?
same rate as sending a message afaik
Discord has a rate limit of 5 in each request.
GOOD MORNING
GAMERS
gm
Oh I just realized whoops
I'm doing a setInterval to edit a message every certain second
for what purpose/reason
why would u want to edit messages so fast?
if it doesn't need to be that often you shouldn't update it that often
to display the status of a minecraft server.
then you should only update when there is a change
or just change it ever 5 minutes
or at least, every 30 seconds/1 minute
Need someone to test my welcome message again, who's kind enough?
@void bone
Hey! You can update your message up to like 5 per second iirc.
However, I think instead of trying to update something over and over again the best way to implement it would be to update the message, only when you have a different status. You should be mindful of how you implement your features so that you contact discord as little as possible, and that you don't create wasteful processing for your bot.
Need someone to test my welcome message again, who's kind enough?
@sand sparrow use an alt
I don't have a alt
shaden dm me
create one
make one then
and it's agaisnt tos
no
its not
ill joinn
show me where in the ToS
so we all should be banned then?
even tonkku and oliy has an alt
most mods too
smh
next time, just make an alt
-_-
you can use another browser or an incognito tab to have both accounts open
do that instead of bothering people
or just a second screen
Bruh
Β―_(γ)_/Β―
well we did tell you what to do and you insisted not to, and now you're complaining
How do u write like that
cool
how did u do that with out getting the text like that?
smh imagine asking for help but not willing to listen
You're then crying over me asking
@sand sparrow kinda rude ngl
Imagine caring about nothing big
Imagine caring about nothing big
@sand sparrow ikr? Imagine getting toxic though
hey hey, we're trying to be helpful here, you asked, so we helped and told you what to do
Ikr?
anyways keep this channel on topic
good idea
bruhh
where do i type if i need help with a code?
do u get an error?
client.on("guildMemberAdd", (member) => { //This is a welcone message code
const guild = member.guild;
if (!newUsers[guild.id]) newUsers[guild.id] = new Discord.Collection();
newUsers[guild.id].set(member.id, member.user);
if (newUsers[guild.id].size > 10) {
const userlist = newUsers[guild.id].map(u => u.toString()).join(" ");
guild.channels.find(channel => channel.name === "general").send("Welcome our new users!\n" + userlist);
newUsers[guild.id].clear();
That wont work
I don't get any errors or anything
case 'rpink':
message.react('')
break;```
its giving me errors,
Not for me
please show me your error @tardy hornet
^^
shaden are you using v12
v12?
discord js?
ye
discord js 12?
please show me your error @tardy hornet
@fluid basin
if so, you need to use cache for channels
Is there any indication in the user endpoint that a user has 2FA authentication enabled? Would I need OAuth for that?
Cache?
shiv why do you need that anyways
id?
guild.channels.cache
1 sec
I'd say "something" but it's literally nothing but curiosity π
@sand sparrow member.guild.channels.get('channelID').send("Welcome") u can also just do this
yes, you can get it through the api, the 'identity' scope will suffice to obtain it @slender thistle
more info here: https://discord.com/developers/docs/resources/user
Mhm, OAuth gang
reeee
thanks qt β€οΈ
though the field might not be present, which in that case means its not 2fa enabled
np
bot.on('guildMemberAdd', member => {
member.guild.channels.get('channelID').send("Welcome");
});``` @sand sparrow
@tardy hornet are you sure the error is coming from that line of code?
hmmm
if not, its likely that its not coming from there
Where should I add that?
thats up to you to try and figure it out
-_-
can't expect us to spoonfeed all the way
K
@ashen yarrow dont spoonfeed ty
when did I?
Who me?
Uhh
bot.on('guildMemberAdd', member => { member.guild.channels.get('channelID').send("Welcome"); });``` <@ !297017395267108874>
@ashen yarrow this ig....?
oh my bad
message.delete?
do msg => { msg.delete({timeout: 5000}) }
is it js?
What?
Javascript?
what i sended?
Doctor asked it it's gonna get deleted
is not
Is is "js" or something else?
it is js
wtf
Are we even talking about the same thing?
is there a way to remove the highest rank of a guild member?
message.channel.send("bla bla").then(msg => {
msg.delete({ timeout: 10000 })
})
Is it a command or a actual message?
@sand sparrow his syntax was wrong, since he's not talkin anymore I guess he solved it
Prob
mate... thats just a piece of code to delete a message after being sended
lol
is there a way to remove the highest rank of a guild member?
@carmine summit role?
is there a way to remove the highest rank of a guild member?
@carmine summit the top role?
And what are you writing your bot in @carmine summit
@earnest phoenix god fix your fucking avatar
Is it broken
Or something
?
ΒΏ
no it's weird
U
Well... he got a point
Sigh
lib?
@carmine summit check his roles and order them from highest to lowest. Then remove the first one
and take in mind that the bot only can remove top roles if he have a role over all the rest
how do i know which roles a member have?
list them
member.roles.map
ok lemme test
undefined

@ionic dawn cache
bruh
it's GuildMemberRoleManager
mate im in class im just typing by memory aigh
you need to get the cache of the member roles / fetch them if you want instant updates
why the if statements?
imagine having a "category" role and removing it instead of removing the actual staff role

so im thinking
if (member._roles.includes(roleid)) return member.roles.remove(roleid)
demoting by "top role" isnt the best way to do it
message.member.roles just returns a manager
you can add .cache at the end to get from cache or .fetch() if you wanna spend a good few seconds (and rate limits) to fetch the whole member roles (but INSTANT UPDATES with fetch)
prob checking by role perms and removing those are best
that looks correct
that looks correct
@pale vessel which
like.. check if the user have ban perms and remove all the roles that allow him to ban
yours
ok
I'll go for cache unless I want it to be in sync with the member roles not the cache
message.member.cache
This'll return a Collection which you can sort from highest to lowest then get the first role
w h a t
Collection.sort(filter?: function);
what the fuck is _roles
list the roles
of a member
because thats what the json said
Β―_(γ)_/Β―
uhh
roles.highest exists
_roles is an array of role snowflakes

bot.on("messageReactionAdd", async (reaction, user) => {
if(message.reaction) await reaction.message.fetch();
if(user.bot) return;
if(!reaction.message.guild) return;
if(reaction.message.channel.id === "channel_id") {
if(reaction.message.id === "message_id") {
if(reaction.emoji.id === "emoji_id") {
await reaction.message.guild.members.cache.get(user.id).roles.add("role_id");
await reaction.message.guild.members.cache.get(user.id).roles.add("role_id");
}
}
}
});
So in the code above I'm trying to make a role reaction system, but every time the bot reboots, it loses its previous listeners so it needs a newly generated message, and to solve that I thought maybe adding a listener for the message id would help with if(reaction.message.id === "message_id") {...FUNCTION...} , but for some reason it still needs a new message after restart - (Discord.js btw)
I am using partials
uh ok
reaction.message.id is an ID
not "message_id"
an ID is a snowflake
e.g. 307854775699898368
so you need to check if its "307854775699898368" and not "message_id"
yes I know, but I just replaced it in my question with "message_id"
yea I replaced all of my id's with words in the question
you need to check if both message and reaction is cached
so you need to fetch both reaction AND message
right now I only see you fetching the message
look at the example over here: https://discord.js.org/#/docs/main/stable/topics/partials
I don't see that in your code?
if you're using partials, it will not automatically fetch
ads
My bot plss take in your server
@slender thistle uwu ^^^
@glossy lantern if you want to submit your bot on top.gg, https://top.gg/newbot
thanks 
please don't send the invite link in this server
@slender thistle thx sit
@junior turtle so you can basically fetch the reaction, to get the guild and other information
actually doody, do you have the exact error when you restart the bot?
I don't see that in your code?
@fluid basin well I don't really need to fetch the reaction on application restart, I just need a listener for the message so if reaction was added do this....
oh okay
which is why I'm asking if you have any errors
or the code is just not working
I tried debugging and checking bot permissions, and even the memory dump
bot alzheimer
lol
member.user.presence.activities I want to give out a role when someone plays a game, what event do I us
e
presenceUpdate @ashen yarrow
if (message.author.id != '487511010886942720') return
if (!args.length) return message.channel.send(`Error: No user specified\nUsage: ${prefix}demote ${message.guild.member('748128531174785035')}`)
let member = args[0]
let roles = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]))
console.log(roles.roles.highest)
roles.roles.remove(roles.roles.highest)
message.channel.send(`${roles.roles.highest.name} has been removed from ${roles}`)
}``` 
So here it is. The first time when I trigger the command that 1) sends the embed then 2) awaits msgEmbed.send, and adds a reaction
it works fine the first time, but after the reboot, it won't listen to the same message and needs me to trigger the command again
so it requires the embed to be regenerated on reboot
LΓ© Captcha
https://i.imgur.com/gMkxi3L.png
mongoose.connect("mongodb://localhost:port/db", {
useUnifiedTopology: true,
useNewUrlParser: true,
useFindAndModify: false
})
help me 
@junior turtle ok I think I know whats the problem
you need to have both REACTION AND MESSAGE in your partials
So here it is. The first time when I trigger the command that 1) sends the embed then 2) awaits msgEmbed.send, and adds a reaction
it works fine the first time, but after the reboot, it won't listen to the same message and needs me to trigger the command again
@junior turtle I have no idea if this issue could be caused by PM2 Module, or not... but if it makes a difference, the bot is running a PM2 Script
@stuck scaffold
- don't need to hide/censor your port
- make sure your mongodb server is running, on that port
mongodb server is running
then make sure your port is correct
const bot = new Discord.Client({ partials: ["MESSAGE", "CHANNEL", "REACTION"]});
yes
you're making life difficult by hiding it
correct
then why is it not connecting?
idk 
that means either you're connecting to the wrong port
no
or your mongodb server isn't actually running
or the application isn't connecting to that port
@limber agate http://top.gg/bot/new
-bots
then wait for it to be approved
@fluid basin
https://i.imgur.com/iYgIGIo.png
https://i.imgur.com/UPF0KfP.png
https://i.imgur.com/usdCuNT.png
@stuck scaffold
yes I saw
off topic but LMAO
make sure your mongodb is on that port
check your mongodb logs
usually at /var/log/mongodb/mongodb.log
if you didn't touch any mongodb server config when you installed and ran it
off topic but LMAO
@pale vessel lmao
its likely to be on the default port 27017
hrm
try using 127.0.0.1 instead of localhost
in your code
you need to have both REACTION AND MESSAGE in your partials
@fluid basin I do! It's on a client.on:const bot = new Discord.Client({ partials: ["MESSAGE", "CHANNEL", "REACTION"]});
I have a feeling it might be because of pm2, but not sure
that is unlikely though
cause it works... or used to work fine on nodemon
OH
if(message.reaction) await reaction.message.fetch();
look at this
there isn't a message variable in the first place

so your bot will never fetch the reaction message
oh and @junior turtle you need to fetch the reaction if you want to use reaction.emoji
reaction.emoji is not given
you might want to change that to reaction._emoji
(since each emoji has a guild and other info which might not be cached)
wasn't that changed in v12 tho?







