#development
1 messages Β· Page 1158 of 1
async run(message, client, args) {
let argsC = message.content.split(" ").slice(1);
let ftext = argsC.slice(1).join(" ");
const member = message.mentions.members.first() || message.member;
const userFlagsA = await member.user.fetchFlags();
const userFlags = userFlagsA.toArray();
let url = member.user.avatarURL();
const embed = new MessageEmbed()
.setColor('#ea6ef1')
.setTitle(`Floor Text`)
.setImage(await alexclient.image.floor({image: url, text: ftext}))
message.channel.send(embed);
}
};
``` Someone knows why the error is coming?
@fringe axle lemme see
what
you're making a dropdown?
oh honey
good luck lol, that's a div element that's anchored, shown when you click on the arrow
@fringe axle lemme see
@earnest phoenix okay
Ok
message.channels.get(744497498881654784).send(Embed);
this outputs error TypeError: Cannot read property 'get' of undefined can anyone lmk what im doing wrong
a message only belongs in 1 channel, not many channels
so do i remove messaage?
client.channels.cache.get(744497498881654784).send(Embed);
snowflakes are also not numbers
they're too big for js to handle them as numbers
Html Code:
<%=console.log(user)%>
<img src="<%=user.displayAvatarURL()%>">```
Console:
```xl
{
id: '712276770216476684',
username: 'πRκ²κκκκκ¬Rπ',
avatar: '67026a7bf324993b452cf7c95783d377',
discriminator: '6422',
public_flags: 256,
flags: 256,
locale: 'en-US',
mfa_enabled: true,
provider: 'discord',
accessToken: 'Censored',
guilds: []
}```
Error: user.displayAvatarURL() is not a function```
are you on v12
yea
thonk
"discord.js": "^12.2.0",
It is avatatURL
Not displayAvatarURL
F i can't mention y'all shitty non qwerty names
no
i will try that
it doesn't exist
yes it doss
does
Tf
the docs lied to mr
part of v12

they protec
they attac
But most importantly
They li
Tf
Error: user.displayAvatarURL() is not a function```
Any Fix?
what's user
what is user
where did you define it
{
id: '712276770216476684',
username: 'πRκ²κκκκκ¬Rπ',
avatar: '67026a7bf324993b452cf7c95783d377',
discriminator: '6422',
public_flags: 256,
flags: 256,
locale: 'en-US',
mfa_enabled: true,
provider: 'discord',
accessToken: 'Censored',
guilds: []
}```
user is logged in user
there is no function
is this oauth
called displayAvatarURL
yea
msgreact.react('white_check_mark');
msgreact.react('x');``` so ive got this code and its outputing ```(node:12868) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji```
there is no displayAvatarURL in OAuth
Hm
@cosmic robin that isn't unicode
Unkown emoji
how can i get avatar?
how can i get avatar?
@small zenith with api call
Copy and paste every emoji with ΔΕΈβΒ no apps required. ΔΕΈΛΕ ΔΕΈΒ₯ΒΊΔΕΈΛβ°ΔΕΈΛΒΔΕΈΛΛΔΕΈΛΕ‘ΔΕΈΛΕΔΕΈΛβΔΕΈΛΒΔΕΈΛΒ³ΔΕΈΛΒΔΕΈΛΒ£ΔΕΈΛΒ’ΔΕΈΛΒΔΕΈΛΒ°ΔΕΈΒ₯Β°
and x isn't either
u can get all emoji u want
\β that is unicode
i was just using the discord names
no
you need unicode
how can i get avatar?
@misty sigil
idk
Ok
yessir
yea, thats a way
Wait min, im working with java
@earnest phoenix note this is oauth
how to construct
@earnest phoenix note this is oauth
@misty sigil its same method
What's a constructor
Is it basically smth that takes a lot of options and stuff and returns an object
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
yessir
@small zenith Have u got
user id?
https://cdn.discordapp.com/avatars/265925031131873281/a_8e76de012e3927e2b5e03596b5bd08c9.gif?size=2048 is my avatar link
exact
Ookk
so its /avatars/id/thing.gif
won't work
you should leave out the extension if you want it to automatically resolve
keep in mind this wont do anything if the user has no avatar
What's a constructor
Is it basically smth that takes a lot of options and stuff and returns an object
halp
lel
Pretty sure displayAvatarURL
@earnest phoenix why
parameters for creating an object @earnest phoenix
I tried it once and it wasn't working for me
it returns /id/imagename.png
parameters for creating an object @earnest phoenix
@earnest phoenix imagine not realizing you nailed smth's definition without ever searching it up
ok then
i will resize it later
@small zenith u can resize with discord url
yep
So I'm working on hosting my own MongoDB cluster, but I can't seem to get authentication working
Any time I add it using db.createUser() it gives out an ERRCONNREFUSED
show ur code
Any time I add it using db.createUser() it gives out an
ERRCONNREFUSED
Connection refused
check username and password
are all IPs allowed to access?
yea
Please don't ever allow all IPs to access ur database, thats highly suicidal
Hello so i dev a bot thats is currently on 100 server and has 40k members. I waited 2 weeks and i still have a error message that says its not organicly grown
Any1 has experienced it ?
yes and wait
Wrong server, you should be asking in https://discord.gg/discord-developers
@earnest phoenix ^^
@delicate zephyr Im sorry ty
No problem! π
@delicate zephyr hey
@misty sigil If you have problems, pass the code of your connection to the database
π
@earnest phoenix hi
how to make the discord.js bot send a user profile picture
<user>.displayAvatarURL()
how can i do it in a ${}
bruh
you literally just put it in there
${user.displayAvatarURL()}

Hello, I have a Music bot on my "Linux / Ubuntu" server. But when I enter the music to be played, the bot enters the channel and then exits immediately. If there is a solution, what is it?
Hmm
@cinder sandal In an embed?
Or message
You rude.
how i get the id of the second role that i mention?
<Why was i told to get in here then>
@dreamy cedar js <Message>.mentions.roles.map(r => r)[1]
ty
@earnest phoenix The way we can resolve this is that you need to show code
So I want to display things from an API in a website should I use express for this?
Yes
alright
Express can work with it but you can use anything that can fetch the needed data from the API
my api is working with express π
There's nothing wrong 
express and ejs right?
Yeah
Express and EJS is a good start yea
I am sometimes getting user.displayAvatarURL of null π
I am sometimes getting
user.displayAvatarURL of nullπ
@earnest phoenix Could be a webhook.
meaning you're have to use user.defaultAvatarURL
@pallid igloo no. its what you get when a user has no avatar
@delicate zephyr bruh, Thats for avatarURL
but displayAvatarURL not just avatarURL
How are you defining user
so i am redirecting to login page when someone enter the page..
req.session.user
Ah, so if no user is logged in it errors?
???
for our site we just use user.avatarURL ? user.avatarURL : user.defaultAvatar
so
Display avatar url works just fine.
Yeah
@earnest phoenix just use avatarURL / defaultAvatarURL from the api
No, displayAvatarURL() can't return null, you have misread the error, user.displayAvatarURL of null
Just Check if it is not null
@earnest phoenix this is for a website
One doesnt use discord.js
Can't read property of null is typically a problem of
Null.property

it can be
@earnest phoenix check if user exists
default avatar?
There's a difference between avatarURL() and displayAvatarURL()
it can be
@misty sigil In a server I collect all the avatars, from the api and in no case has it given me an error.
of null-
gah im just making a fool of myself
@delicate zephyr but.. i am redirecting to login page :/
Doesnt matter, you should check if the user exists first
^
if no user?
There's a difference between
avatarURL()anddisplayAvatarURL()
@earnest phoenix You realise that the web side oauth doesnt return a function and youre basing your experience off of discord.js
if no user?
@earnest phoenix redirect them to the login page
and if there is a user
home page with correct data
Alright! Thank you guys.
didn't know defaultAvatar is a thing, i thought you need to calculate it manually using the discriminator lmao
Kinda nice for djs
Oo
avatar from the api is null if its default
at which point you have to use defaultAvatar
@earnest phoenix You realise that the web side oauth doesnt return a function and youre basing your experience off of discord.js
@delicate zephyr So fetching the info from where? Official discord api?
yes, oauth
When they login through oauth
discord JS just caches it and makes it a function since it allows you to set image type ect
since you can do u.displayAvatarURL({ format: 'png' })
SyntaxError: Unexpected token '.' in C:\Users\User\Desktop\TestWebsite\views\pages\index.ejs while compiling ejs
Κ°β±
Someone being surprised djs caches everything?
mmlol
<Bruh i don't see djs caching url in it's source code>
<!DOCTYPE html>
<html lang="en">
<head>
<% include ../partials/head %>
</head>
<body class="container">
<header>
<% include ../partials/header %>
</header>
<main>
<div class="jumbotron">
<h1>This is great</h1>
<p>Welcome to templating using EJS</p>
</div>
</main>
<footer>
<% include ../partials/footer %>
</footer>
</body>
</html>
SyntaxError: Unexpected token '.' in C:\Users\User\Desktop\TestWebsite\views\pages\index.ejs while compiling ejs
change
<% include ../partials/footer %>
to
<% include('../partials/footer') %>
<?php require("../partials/footer.php"); ?> /s
flaze
Alright ty its working now
get that php shit outta here
I'm not using PHP
lmaooo
I'm using EJS and Express
i never wanna use php again
Ive learnt react now which is nice
since now I have
React
EJS
PHP

get that php shit outta that list
okay
yes
IS tehre a way to make this look more "pretty" so it's actually readable
==*
"why"."is"."it"."like"."this"

there's many better (and more secure) languages which have web servers made for them
@tulip ledge yea, get an ejs vscode extention
should i use bodyparser or helmet for API?
Alright ty
@earnest phoenix using == is not a good idea, not identical type comparison is kind of an issue
there's many better (and more secure) languages which have web servers made for them
@earnest phoenix i agree, but then again. PHP is so old that companies that use them still need it to be maintained and PHP developers are starting to π
which is amusing
=== is strict
I was referencing another language, lol, should have made it clear, perhaps I shouldn't have since this isn't #memes-and-media & I was being dumb

=== => 2 === 2[true], 2 === "2"[false]
== => 2 == 2[true], 2 == "2"[true]
@earnest phoenix
ok so I want to have an input and then based on that input I want to get data from an API and then send it back how would I do that?
When == is used, the first element/object to compare tries to get into a type identical to the second element/object @earnest phoenix
@earnest phoenix #memes-and-media
I see
How come when I do this:
res.render("pages/index", {
data: data
})
It gives me an error inside the .ejs file that data is undefined?
Yeh it logs data
<main>
Data:
<% data %>
<div class="jumbotron">
<h1>This is great</h1>
<p>Welcome to templating using EJS</p>
</div>
</main>
Not getting an error anymore but it's just not showing data now
Still doesn't show
Oh ok ty
Source https://ejs.co/
'E' is for 'effective'. EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. It's just plain JavaScript.
So how would I use a delimiter to get info for example: localhost:3000/stats?user=USER
I need to get the USER
To pass through a function
// gets the user from the URL query
const user = req.query.user || null
res.render(file, { user: user })
and then you can do
<%- user %>
and it should render that
Well I dont need to render it but it should work I think
what would req.query.user return if it doesn't exist?
@tulip ledge with express you can easily get params and query
I just have to pass it through a function
@tulip ledge how are you currently rendering you page with express??
It's working tho
yea
app.get("/stats", async function(req, res) { // http://localhost:3000/stats?user=Vigintillion
let user = req.query.user || null;
let data = await getUserData(user)
console.log(data)
let visualizeData = JSON.stringify(data)
res.render("pages/index", {
visualizeData
});
});
its my first time using ejs and express tho
oh ok
It doesnt need to be JSON
No I know that
So
But if I do data it shows [object Objet] and for seeing if it works I stringify it so I see the object
@tulip ledge yea but then you cant used the object within the code
I know
so you can do this for example
It's just for seeing if it works
Can I host a sort of "central" server for my app where people connect and can send text messages to eachother? Idk if socket can work like this or if I need a separate thing to use it
<%- JSON.stringify(user) %>
as long as
res.render("pages/index", {
user: data
});
you can use java script functions in EJS rendering
oh thats dope
Oh ejs is really cool
so rather than fucking with your backend to work on the front end you can do it within the .ejs file
But if I were you I'd send the params individually, so you have a fallback if there are any errors
ah ok
But if I were you I'd send the params individually, so you have a fallback if there are any errors
@pure lion nah
You can do things like
@pure lion What stack do you know?
I have a question
how to make a discord.js bot say the status/presence of the user
<% if (user) { %>
<a> this renders if user exists </a>
<% } else { %>
<a> this renders if user doesnt exist </a>
<% } %>
res.render("pages/index", {
user: data
});
Still sais user is undefined
There's multiple stacks
how to make a discord.js bot say the status/presence of the user?
SetActivities
no, it should the status of a user
@tulip ledge can you show me the output of data when console logged
can you not spoon feed

@modern sable spoon feed alert
Nvm I wasn't passing a user I'm stupid
oh ok
Bobe
@cinder sandal are you using discord.js?
yes
12| <main>
13| Data:
>> 14| <% if (user) { %>
15| <a> this renders if user exists </a>
16| <%- JSON.stringify(user) %>
17| <% } else { %>
user is not defined
do <% console.log(user) %>
It works if I do ?user=Vigintillion but if I do ?user= it doesn't work
@cinder sandal https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=presence
I cant remember exactly how but this documentation can show you where to find it
12| <main>
13| Data:
>> 14| <% console.log(user) %>
15| <% if (user) { %>
16| <a> this renders if user exists </a>
17| <%- JSON.stringify(user) %>
user is not defined
brb
@tulip ledge ok, so where you have
let user = req.query.user || null;
let data = await getUserData(user)
do
let user = req.query.user || null;
let data = user ? await getUserData(user) : {}
@ChickenDev#6181 btw mern full stack
data then checks if user exists and if it does it will do the fetch
and if it doesnt it will return an empty object
Smart
Clearly
Oh thats so smart lmao
Learning is fun
I was hoping to use a ternary operator somewhere in my code
Yea
It is fun
EJS is nice
kinda which I learnt React before helping make DBLStats tho
So mongo express something and node right?
I mean
for dblstats.com we use:
mongo - database
redis - sessions / caching
EJS - render engine
node is just the thing that runs it
Β―_(γ)_/Β―
12| <main>
13| Data:
>> 14| <% console.log(user) %>
15| <% if (user) { %>
16| <a> this renders if user exists </a>
17| <%- JSON.stringify(user) %>
user is not defined
Thats it
app.get("/stats", async function(req, res) { // http://localhost:3000/stats?user=Vigintillion
let user = req.query.user || false;
let data = user ? await getUserData(user) : {}
console.log(data)
res.render("pages/index", {
user: data
});
});
oh right
ok
try
<% const _user = user || false %>
even though that should work
Wait
what is the console.log(data) outputting
the data the API returned
can you show me the function?
// Load the package
const nodeWynn = require("node-wynn");
module.exports = async function run(IGN) {
try {
let res = await nodeWynn.getPlayer(IGN);
let data = res.data[0];
return data;
} catch(err) {
// Logs error on failed request
console.error(err)
}
}
hmmm
that should be working
cause for example we have
try doing
res.render("pages/index", {
user: data || false
});
idk why its not working for you though
12| <main>
13| Data:
>> 14| <% console.log(user) %>
15| <% if (user) { %>
16| <a> this renders if user exists </a>
17| <%- JSON.stringify(user) %>
user is not defined
app.get("/stats", async function(req, res) { // http://localhost:3000/stats?user=Vigintillion
let user = req.query.user || false;
let data = user ? await getUserData(user) : {}
console.log(data)
res.render("pages/index", {
user: data || false
});
});
Yeah I was gonna say
nothing
{ user: '' }
do
I'm so sorry
im sat here like
I am unable to can
"My brain is about to hit desk"
I'm so sorry π¦
@tulip ledge glad I could help though
nah its fine
happens to the best of us
and like you said, you're starting out
no need to get mad at someone who's learning π
Yeah firsy time doing express and ejs
Been doing JS for 3 years tho so kinda sad I forgot to restart it
I recommend sometime like nodemon when editting files like that
It would help you in case you forget to restart
use gulp
Hope everything else goes well though!
Actually nvm I'm not going to ask for help here
why
Because
I don't have a valid reason fuck
Okay basically I want to host a server for a chat app that allows users to connect from an electron app
yes, and you need help with?
No idea how to connect to said server
Idk if I can:
Load the URL to the window
Connect to the server
When send emit message
When recieve message display
Wait I think I just figured it out
Oops
Okay
Will come back if I have issues tho
New question
How to fix too many redirects on cloudflare when using nginx
that means there is a redirect infinite loop
Sounds nasty
you need to check your config
What am I looking out for
if you're using ssl on nginx, turn cloudflare's ssl off
ok
Matt go do that
Is offline
Hmmmmm
why dont u just turn off nginx
In my current bot rewrite, I'm abstracting everything as interfaces
That way, I can load up 2 classes that fulfill the interfaces and target both Discord and Nertivia at once
No
Yes very
{
"compilerOptions": {
"module": "CommonJS",
"target": "es2018",
"outDir": "dist",
"lib": [
"ESNext",
"ESNext.Array",
"ESNext.AsyncIterable",
"ESNext.Intl",
"ESNext.Symbol",
"DOM"
],
"sourceMap": false,
"inlineSourceMap": true,
"inlineSources": true,
"incremental": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}
``` Anyone knows why it's not working?
Are you sure it's off?
Show
The tricky part of what I am doing is that Nertivia does not support Voice.
If I were to support more chat clients later on, there would be a chance that they don't even support servers.
Therefore, I have to design my rewrite (attempt 4) with the fear that any given feature does not exist.
At the same time, I shouldn't just not support voice
Or webhooks (which Nertivia does not support either)
I'm pretty sure my last attempt had well over 100 files
Just look at the number of folders alone
And that well over 100 files means in the src/main/java folder
It excludes any build or resource files
Attempt 4 might take forever to catch up with Attempt 3
are you talking to yourself or asking for help from us
^
I'm talking to anybody who will respond with anything
To ask the certification, the bot need 75 or 76 server pls ?
(official discord certification)
discord is going to message you when you're qualified for verification
so i want a command that increases a variable by 1 each time someone does the command
discord.js
so i do
execute(message, args){
var variable = 0
variable = variable + 1
message.channel.send('Added a point! Currently we have ' + variable + ' total! keep doing this command to raise this number!')
}}
or no?
Nobody responded with feedback on my actual set of posts ):
can someone help me im new
the command adds one point but doesnt add any more when the command is done again
idk what to do
btw im not trying to make this local to each user, im trying to make it a variable all the users can work towards
not like a currency system
if you're using ssl on nginx, turn cloudflare's ssl off
@quartz kindle if you're using full strict you need both
you turn on full strict under cloudflare ssl settings and nginx also has an ssl certificate set up
normally flexible will be fine for most people
ok thx Cry
just depends if you want to go through the effort or not
database
Oh hey it works
Typically, in a database.
and how would you then clear it per user every 12 hours
Ah but the www doesn't work
www is wack
You have to add a www record to everything
Sites should still support it
Depends on your database @honest perch
mongo
with mongoose?
You said mongo not mongoose.
I know there's some differences between mongodb and mongoose, not sure if this one one of them.
I just googled it, probably would be pretty fast to just google this for mongoose
yeah ive tried but no luck
used different wording ):
also ddg
One of the first few results was pretty good
thanks
what licence should I use if my software isn't open source
then you dont need one
Id reccomend putting something still
Theres a few comments(under op) that discuss the reasoning for including it.
how i can fix this problem
let first = message.mentions.roles.first();
let second = message.mentions.roles.map(r=>r)[1]
message.channel.send(` (first mention:${first})
sencond mention${second} `)
if(!message.member)message.member == message.guild.members.cache.get(message.author.id)
Cannot read property 'members' of undefined
can any1 help ?
message.guild is undefined somehow?
message is not a d.js Message structure
idk
Just be aware, a lot of open source libraries licenses do not let you use their libraries if whatever your making is closed source.
log message and see what it is
ok can u share it
im trying to make a discord.py invite manager and I keep getting this error:
TypeError: 'Invite' object is not subscriptable
then message is a collection of users
you did something in ur code to make it tjay
that*
How can i restart all shards without process.exit() or client.destroy()?
you did something in ur code to make it tjay
@sand condor yes
if(!message.member)message.member == message.guild.members.cache.get(message.author.id)
if (!message.member.hasPermission("MANAGE_GUILD") && message.author.id !== "349095859859881984") {
no you made your message variable something else
and message.member is always defined
run: async (message, args, bot) => {
message.member = message.guild.members.fetch(message.author.id) π
There's no problem with it
no in server
if it's in a server message.member should exist already
then what's wrong?
if you logging message returns a collection of users (from this screenshot https://discordapp.com/channels/264445053596991498/272764566411149314/744576658320654406) then you might need to remove whatever your making message or sort out your variable passing
How can i restart all shards without
process.exit()orclient.destroy()?
@earnest phoenix what?
mean this right ? run: async (message, args, bot) => {
that or something else
how i can fix this problem please
it always give the same result
let first = message.mentions.roles.first();
let second = message.mentions.roles.map(r=>r)[1]
message.channel.send(` (first mention:${first})
sencond mention${second} `)
d.js?
yes
read the docs, the mentions property does not return the mentions in order
@dreamy cedar you want mention a user or role ?
role
ok ty ill check
use something like regex if you need the order
Link
how i can fix this problem please
it always give the same result
@dreamy cedar what the problem ? Again
yes, do this instead:
use something like regex if you need the order
@dreamy cedar you dont tag the same role ?
@dreamy cedar you dont tag the same role ?
@low shard there is 2 roles
Yes ,
use something like regex if you need the order
@fluid basin ill search and see
"discord mention regex"
am mentioning 2 roles
but it give the same result
if you logging
messagereturns a collection of users (from this screenshot https://discordapp.com/channels/264445053596991498/272764566411149314/744576658320654406) then you might need to remove whatever your making message or sort out your variable passing
@sand condor i removed message from run, now its not defined
@dreamy cedar you wanna give me link to try it on dms ?
but it also could be something else
In /on
u said remove what makes message like the image
@viral iris Cannot read property 'members' of undefined?
that means message.guild is undefined
which means message is not a d.js message
wot
i said remove the message.member part
you can't get a member if you don't have a guild
Which event is fired in discord.js when the guild the bot is in, is deleted.
i was thinking it might do guildUpdate aswell
i said remove the message.member part
@sand condor ok
but what about if (!message.member.hasPermission("MANAGE_GUILD") && message.author.id !== "349095859859881984") {
im confused, because i have deleted the guild and my bot hasn't done anything
i don't see a problem with that
hasPermission underfined
then permissions.has() or something on v12
@viral iris what are you trying to do?
hasPermission exists on 12
message.member is undefined
oh
@viral iris what are you trying to do?
@fluid basin if the member don't have permission bot send message
check if message.member exists first
in guild
if(message.member && the rest of your checks)
then message.member should not be undefined
also, your doing
so only doif (!message.member.hasPermission("MANAGE_GUILD")) {
missing a )
message.member would still be undefined sometimes
can you put the full code on hastebin or something
howo do i un-lock myself out of my mongodb server acc
yea sure
try mongod
i cant access the shell
it'll try starting the cluster
no
i cant access the shell
no
???
root@vps36084:/# mongo
MongoDB shell version v4.4.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:362:17
@(connect):2:6
exception: connect failed
exiting with code 1
try running mongod
@viral iris i dont see you checking if member exists before doing the check in this code
did
what did it say
@viral iris i dont see you checking if member exists before doing the check in this code
@solemn latch i'll do
okay. do that
the mongo server is not started
big json
1min
restart the vps
that crap always happens with mysql
I usually use systemctl to start it manually
whats the status
f
How do I explain to my friend that he's pretty gay for yoinking some kids code while being 'tech support" for him and using the code for himself.
ok so first
what the hell
so he scammed
stealing code is super shitty
That's what im saying
code theft is real
But he says "it's still custom since im modifying it"
@solemn latch only console.log(member); ?
not exiting but still cant connect
off topic but i wouldn't recommend using the word gay as a derogatory term in 2020
off topic but i wouldn't recommend using the word gay as a derogatory term in 2020
@sand condor i'll rephrase that then
not exiting but still cant connect
@pure lion thats because you need to auth
ah
i get what you mean, it's just that it could be offensive to some people
member is not defined
mongo --username "username" --password "password" --authenticationDatabase "admin"
afaik
yeah, we have determined that.
now you need to not use message.member.property unless its defined.
it works
still cant connect externally
now you need to not use message.member.property unless its defined.
@solemn latch how to defined it ?
you cant, if message.member doesnt exist, then it makes no sense to define it.
so instead of defining it, just ignore any request that doesnt have message.member
i gave an example, and explained where it probably should go. π€·ββοΈ
Someone knows why custom reaction emojis won't work?
having an error?
how are you checking for reactions
With a collector
can i get an example of the code?
hastebin plox, i dont download message.txt's
Okay
i know why its not working
thats id afaict
The ID's
reaction.emoji.id then right?
@solemn latch
i did u mean this ?
message.member = await message.guild.fetchMember(message);
@solemn latch I have a little problem with it. Sometimes the reactions aren't working.
if (!message.content.startsWith(prefix)) return;
if (!message.member)
what about this ?
probably want to do it in the command, not in the command handler
the guide covers changing stuff
probably want to do it in the command, not in the command handler
@solemn latch so how to fix that ?
i feel like ive explained what you need to do as clearly as i can
what?
anything i say at this point will be a repeat
@fleet hornet https://discordjs.guide/additional-info/changes-in-v12.html#commonly-used-methods-that-changed
@solemn latch how to fix it ?
check if message member is defined before using it
console.log(message.member);
thats just logging it, it doesnt affect anything
then how to check if it defined ?

i have this in message.js
if (!message.member)
your using find wrong @fleet hornet
gotta return
if(!message.member)
does nothing by itself
honestly, the error sounds extremely undescriptive, really its the libs fault in this case imo.
@solemn latch got this message.guild.fetchMember is not a function
if (!message.member) return;
message.member = await message.guild.fetchMember(message);
message.guild.fetchMember doesnt exist
it is
in message.js
you cant just make up properties and expect it to work
so remove it ?
yes.
this returned Cannot read property 'hasPermission' of undefined
oh yea that
well, the root problem the whole time
is your effectivly doing
message = client
:0
just pasting code in chat and that shits gone
bot is also args
https://hastebin.com/aropuqoyiz.js
pls use switch case
kek
sorry
np
lets say we have 2 roles x, y
In a channel x has certain perms and i wanna give the same to y to
if it has the / perm in a channel it should remain that
is there any way to do that?
d.js v12
client is not defined
@viral iris show code
i dont know much about perm overwrites, but im pretty sure you can just get one roles permission overwrites and put it where you assign them
i had a pretty hard time oding that
await channel.createOverwrite(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
SEND_TTS_MESSAGES: false,
ATTACH_FILES: false,
SPEAK: false,
});
for example this is perms overwirte for Mute role
@earnest phoenix
https://hastebin.com/ilamubamik.js
wasnt able to exactly do it
run: async(client, message, args, prefix)
@viral iris ^^^
1sec
@misty sigil poo
now it's Cannot read property 'hasPermission' of undefined
message.member
ok 1min
not client.member
np
if tim was here, that woulda taken 3 minutes
it's ok thx anyway β€οΈ
find takes a function now
return member.roles.cache.find("name", roleName);
return member.roles.cache.find(r => r.name === roleName);
effectively the same
will give you the first thing where the function returns true;
lets you have a lot more complicated finds
can you post your new code?
U cant mentoin in title
your also not closing this line
let membersWithRole = message.guild.members.cache.filter(member => {return member.roles.cache.find(role => role.name === roleName)
})
and use .join("\n")
also, does filter work like that π€
π€¨
i feel like theres a much cleaner way of doing this
Hi
use ${} or remove ` and .join("\n")
let array = ["a", "b", "c"]
let string = array.join("+");
console.log(string); // result = a + b + c
role.members
will be a collection of all the cached members will the role
i cant type
LoL
anyway
<Role>.members.map(m => m.tag);
pretty sure will do pretty much what you doing
in all those lines
m.user.tag
^
you get the idea tho
;p
you cant tag things in titles
iirc
oh
message.mentions.roles.first() or something similar
doing it like that could be quite annoying, since everyone with that role gets tagged by the user doing the command(unless role mentioning is disabled)
the other thing you might want to check for is number of users.
if someone does it for the everyone role or a role with a ton of users(like here, someone doing it for bot developer)
and you try and send a message with split: true or with more than 2k chars, youll start getting errors.
Thats spoonfeeding ig so deleted
also probably would have actually gotten the role in the section after ||
since it would be either a role or a string at that point
ok guys, im making a webpage and idk what kind of embeds discord uses
custom?
you mean like one of these embeds?
This image url https://emoji.gg/assets/emoji/Think_Big.png is not showing if I set it as a embed's image, is the problem with discord itself not being able to view the url?
https://www.youtube.com/watch?v=dQw4w9WgXcQ this type of embed
Rick Astley's official music video for βNever Gonna Give You Upβ
Listen to Rick Astley: https://RickAstley.lnk.to/_listenYD
Subscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/subscribeYD
Follow Rick Astley:
Facebook: https://RickAstley.lnk.to/f...
ah ok thanks bro
heyo
I cant run my bot online
hello
i keep getting mongodb connection timeout after setting the bindIP to 0.0.0.0
I did exactly same things like a guy from yt, but the process stops when I am typing node . In the consile
youtube is a bad source for learning how to make bots
the vast majority of discord bot guides on youtube are outdated and useless
This tutorial is from may 30 2020
π€·ββοΈ
You can learn from YouTube tutorials, but there are better and more reliable ways of learning how to use a library. The most basic would be http://discordjs.guide, which is better than what any video will ever teach you.






