#development

1 messages Β· Page 1158 of 1

earnest phoenix
#

@earnest phoenix

#

ok

fringe axle
#
  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?
earnest phoenix
#

@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
#

@fringe axle lemme see
@earnest phoenix okay

small zenith
#

Ok

cosmic robin
#

message.channels.get(744497498881654784).send(Embed);
this outputs error TypeError: Cannot read property 'get' of undefined can anyone lmk what im doing wrong

fluid basin
#

a message only belongs in 1 channel, not many channels

cosmic robin
#

so do i remove messaage?

fringe axle
#

client.channels.cache.get(744497498881654784).send(Embed);

earnest phoenix
#

snowflakes are also not numbers

#

they're too big for js to handle them as numbers

small zenith
#

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```
earnest phoenix
#

are you on v12

small zenith
#

yea

earnest phoenix
#

thonk

small zenith
#

"discord.js": "^12.2.0",

earnest phoenix
#

It is avatatURL

#

Not displayAvatarURL

#

F i can't mention y'all shitty non qwerty names

small zenith
#

displayAvatarURL() exists

#

but ok

earnest phoenix
#

no

small zenith
#

i will try that

earnest phoenix
#

it doesn't exist

misty sigil
#

It actually does

earnest phoenix
#

yes it doss

#

does

#

Tf

#

the docs lied to mr

#

part of v12

#

they protec
they attac
But most importantly
They li

misty sigil
earnest phoenix
#

Tf

small zenith
#
Error: user.displayAvatarURL() is not a function```
Any Fix?
earnest phoenix
#

what's user

misty sigil
#

what is user

earnest phoenix
#

where did you define it

small zenith
#
{
  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

earnest phoenix
#

there is no function

misty sigil
#

is this oauth

earnest phoenix
#

called displayAvatarURL

small zenith
#

yea

cosmic robin
#
        msgreact.react('white_check_mark');
        msgreact.react('x');``` so ive got this code and its outputing ```(node:12868) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji```
misty sigil
#

there is no displayAvatarURL in OAuth

small zenith
#

Hm

misty sigil
#

@cosmic robin that isn't unicode

earnest phoenix
#

Unkown emoji

small zenith
#

how can i get avatar?

misty sigil
#

white_check_mark isn't unicode

#

this is \βœ…

earnest phoenix
#

how can i get avatar?
@small zenith with api call

#
misty sigil
#

and x isn't either

earnest phoenix
#

u can get all emoji u want

misty sigil
#

\❌ that is unicode

cosmic robin
#

i was just using the discord names

misty sigil
#

no

earnest phoenix
misty sigil
#

you need unicode

small zenith
#

how can i get avatar?
@misty sigil

misty sigil
#

idk

small zenith
#

Ok

earnest phoenix
#

xD

#

Rockestar

#

you can construct the url yourself

#

javascript?

small zenith
#

yessir

misty sigil
#

yea, thats a way

earnest phoenix
#

Wait min, im working with java

misty sigil
#

@earnest phoenix note this is oauth

small zenith
#

how to construct

earnest phoenix
#

@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

#

yessir
@small zenith Have u got

#

user id?

misty sigil
#

https://cdn.discordapp.com/avatars/265925031131873281/a_8e76de012e3927e2b5e03596b5bd08c9.gif?size=2048 is my avatar link

earnest phoenix
#

exact

small zenith
#

Ookk

earnest phoenix
#

just replace

#

Pretty sure displayAvatarURL

misty sigil
#

so its /avatars/id/thing.gif

earnest phoenix
#

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

small zenith
#

Ty Worked

#

i will resize it later

earnest phoenix
#

ok then

#

i will resize it later
@small zenith u can resize with discord url

#

yep

small zenith
#

Thanks its working now

misty sigil
#

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

digital ibex
#

show ur code

small zenith
#

Any time I add it using db.createUser() it gives out an ERR CONN REFUSED

#

Connection refused

#

check username and password

misty sigil
#

yea i do

#

its the mongodb erroring

small zenith
#

are all IPs allowed to access?

misty sigil
#

yea

earnest phoenix
#

Please don't ever allow all IPs to access ur database, thats highly suicidal

misty sigil
#

its just testing it lmao

#

but its working so

earnest phoenix
#

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 ?

restive furnace
#

yes and wait

delicate zephyr
#

@earnest phoenix ^^

earnest phoenix
#

@delicate zephyr Im sorry ty

delicate zephyr
#

No problem! πŸ˜„

earnest phoenix
#

@delicate zephyr hey

#

@misty sigil If you have problems, pass the code of your connection to the database

#

πŸ™‚

delicate zephyr
#

@earnest phoenix hi

cinder sandal
#

how to make the discord.js bot send a user profile picture

misty sigil
#

<user>.displayAvatarURL()

cinder sandal
#

how can i do it in a ${}

misty sigil
#

bruh

#

you literally just put it in there

earnest phoenix
#

${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

cinder sandal
#

it's already solved

#

don't answer

#

in embed

earnest phoenix
#

You rude.

dreamy cedar
#

how i get the id of the second role that i mention?

earnest phoenix
#

<Why was i told to get in here then>

#

@dreamy cedar js <Message>.mentions.roles.map(r => r)[1]

dreamy cedar
#

ty

earnest phoenix
#

@earnest phoenix The way we can resolve this is that you need to show code

tulip ledge
#

So I want to display things from an API in a website should I use express for this?

earnest phoenix
#

Yes

tulip ledge
#

alright

earnest phoenix
#

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 pepowot

tulip ledge
#

express and ejs right?

earnest phoenix
#

Yeah

delicate zephyr
#

Express and EJS is a good start yea

earnest phoenix
#

I am sometimes getting user.displayAvatarURL of null πŸ˜”

delicate zephyr
#

yes

#

you will

pallid igloo
#

I am sometimes getting user.displayAvatarURL of null πŸ˜”
@earnest phoenix Could be a webhook.

earnest phoenix
#

What should i do?

#

webhook?

delicate zephyr
#

meaning you're have to use user.defaultAvatarURL

#

@pallid igloo no. its what you get when a user has no avatar

pallid igloo
#

@delicate zephyr bruh, Thats for avatarURL

earnest phoenix
#

but displayAvatarURL not just avatarURL

delicate zephyr
#

Yea

#

i get that sometimes too

solemn latch
#

How are you defining user

earnest phoenix
#

so i am redirecting to login page when someone enter the page..

#

req.session.user

solemn latch
#

Ah, so if no user is logged in it errors?

earnest phoenix
#

???

delicate zephyr
#

for our site we just use user.avatarURL ? user.avatarURL : user.defaultAvatar

#

so

pallid igloo
delicate zephyr
#

this isnt for a bot

#

its for a website

earnest phoenix
#

Yeah

pallid igloo
#

it works with my alt too.

#

oh wait

earnest phoenix
#

x)

delicate zephyr
#

@earnest phoenix just use avatarURL / defaultAvatarURL from the api

solemn latch
#

The problem looks like user is sometimes null, not avatar

#

πŸ€”

delicate zephyr
#

its when they login Woo

#

i mean tbf

earnest phoenix
#

No, displayAvatarURL() can't return null, you have misread the error, user.displayAvatarURL of null

#

Just Check if it is not null

delicate zephyr
#

@earnest phoenix this is for a website

earnest phoenix
#

Bruh

#

What's the difference can you tell

delicate zephyr
#

One doesnt use discord.js

solemn latch
#

Can't read property of null is typically a problem of
Null.property

delicate zephyr
earnest phoenix
#

Web and Bot take resources from discord api

#

avatar cant be null

misty sigil
#

it can be

delicate zephyr
#

@earnest phoenix check if user exists

earnest phoenix
#

user avatar*

#

user is null this is why

#

@misty sigil it can't

misty sigil
#

default avatar?

earnest phoenix
#

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-

misty sigil
#

gah im just making a fool of myself

earnest phoenix
#

@delicate zephyr but.. i am redirecting to login page :/

delicate zephyr
#

Doesnt matter, you should check if the user exists first

solemn latch
#

^

earnest phoenix
#

if no user?

delicate zephyr
#

There's a difference between avatarURL() and displayAvatarURL()
@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

earnest phoenix
#

Alright! Thank you guys.

pale vessel
#

didn't know defaultAvatar is a thing, i thought you need to calculate it manually using the discriminator lmao

solemn latch
#

Kinda nice for djs

delicate zephyr
#

defaultAvatar is directly from the api

#

lol

solemn latch
#

Oo

pale vessel
#

didn't realize that at all

#

i've only used the avatar hash

#

🧠

delicate zephyr
#

avatar from the api is null if its default

#

at which point you have to use defaultAvatar

earnest phoenix
#

@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?

pale vessel
#

yes, oauth

delicate zephyr
#

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' })

earnest phoenix
#

<It just constructs a url>... You cache a url?

#

Tf

tulip ledge
#

SyntaxError: Unexpected token '.' in C:\Users\User\Desktop\TestWebsite\views\pages\index.ejs while compiling ejs

delicate zephyr
#

they cache the url

#

i dont

spring wind
#

ʰⁱ

solemn latch
#

Someone being surprised djs caches everything?

pale vessel
#

mmlol

earnest phoenix
#

<Bruh i don't see djs caching url in it's source code>

tulip ledge
#
<!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

delicate zephyr
#

discord.js's source code is a mess

#

@tulip ledge its

#

include('path here')

solemn latch
#

Sometimes it looks like something I would do

#

Which is really sad

delicate zephyr
#

change

<% include ../partials/footer %>

to

<% include('../partials/footer') %>
pale vessel
#

<?php require("../partials/footer.php"); ?> /s

delicate zephyr
#

flaze

tulip ledge
#

Alright ty its working now

delicate zephyr
#

get that php shit outta here

tulip ledge
#

I'm not using PHP

pale vessel
#

lmaooo

tulip ledge
#

I'm using EJS and Express

pale vessel
#

yeye

#

πŸ˜” slash s moment

delicate zephyr
#

i never wanna use php again

#

Ive learnt react now which is nice

#

since now I have
React
EJS
PHP

pale vessel
#

get that php shit outta that list

delicate zephyr
#

If i get paid to do php

#

im ok with it

#

other than that

#

the lang can die

earnest phoenix
#

Oh no, PHP

pale vessel
#

okay

earnest phoenix
#

But why

#

can we abandon php

pale vessel
#

yes

earnest phoenix
#

I agree on this

#

wtf going on here !?

#

php === "gay"

#

true

tulip ledge
earnest phoenix
#

==*

pale vessel
#

"why"."is"."it"."like"."this"

spring wind
earnest phoenix
#

there's many better (and more secure) languages which have web servers made for them

delicate zephyr
#

@tulip ledge yea, get an ejs vscode extention

earnest phoenix
#

should i use bodyparser or helmet for API?

tulip ledge
#

Alright ty

earnest phoenix
#

@earnest phoenix using == is not a good idea, not identical type comparison is kind of an issue

delicate zephyr
#

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

earnest phoenix
#

What's the difference @earnest phoenix ?

#

== with ===

pale vessel
#

=== is strict

earnest phoenix
#

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

tulip ledge
#

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?

earnest phoenix
#

When == is used, the first element/object to compare tries to get into a type identical to the second element/object @earnest phoenix

delicate zephyr
coral trellis
earnest phoenix
#

I see

tulip ledge
#

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?

earnest phoenix
#

?

#

Console log data there

#

Like before the render

tulip ledge
#

Yeh it logs data

earnest phoenix
#

Keep data only in the {}

#

See what happens

tulip ledge
#
<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

earnest phoenix
#

Ok

#

<% is a scriptlet tag

#

Means no output

#

Use <%-

tulip ledge
#

Oh ok ty

earnest phoenix
#
tulip ledge
#

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

delicate zephyr
#
// 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

tulip ledge
#

Well I dont need to render it but it should work I think

pale vessel
#

what would req.query.user return if it doesn't exist?

delicate zephyr
#

@tulip ledge with express you can easily get params and query

tulip ledge
#

I just have to pass it through a function

delicate zephyr
#

@tulip ledge how are you currently rendering you page with express??

tulip ledge
#

It's working tho

delicate zephyr
#

yea

tulip ledge
#
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
    });
});
delicate zephyr
#

Im just curious if you using good practice tbh

#

you dont need to do that

#

lmfao

tulip ledge
#

its my first time using ejs and express tho

delicate zephyr
#

you can just do

#

res.render("pages/index", data);

tulip ledge
#

oh ok

delicate zephyr
#

It doesnt need to be JSON

tulip ledge
#

No I know that

pure lion
#

So

tulip ledge
#

But if I do data it shows [object Objet] and for seeing if it works I stringify it so I see the object

delicate zephyr
#

@tulip ledge yea but then you cant used the object within the code

tulip ledge
#

I know

delicate zephyr
#

so you can do this for example

tulip ledge
#

It's just for seeing if it works

pure lion
#

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

delicate zephyr
#
<%- JSON.stringify(user) %>

as long as

    res.render("pages/index", {
        user: data
    });
#

you can use java script functions in EJS rendering

tulip ledge
#

oh thats dope

pure lion
#

Oh ejs is really cool

delicate zephyr
#

so rather than fucking with your backend to work on the front end you can do it within the .ejs file

pure lion
#

But if I were you I'd send the params individually, so you have a fallback if there are any errors

tulip ledge
#

user is not defined

#

nvm

#

I did user: date not data lmao

delicate zephyr
#

ah ok

solemn latch
#

Your user got a date hype

#

Not single forever

delicate zephyr
#

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

cosmic agate
#

Hi

#

Im brazilian

tulip ledge
#

@pure lion What stack do you know?

cosmic agate
#

I have a question

cinder sandal
#

how to make a discord.js bot say the status/presence of the user

delicate zephyr
#
<% if (user) { %>
  <a> this renders if user exists </a>
<% } else { %>
  <a> this renders if user doesnt exist </a>
<% } %>
tulip ledge
#
    res.render("pages/index", { 
        user: data 
    });

Still sais user is undefined

pure lion
#

@tulip ledge r e a D t h e n a m e

#

@delicate zephyr me when the php

tulip ledge
#

There's multiple stacks

cinder sandal
#

how to make a discord.js bot say the status/presence of the user?

cosmic agate
#

SetActivities

cinder sandal
#

no, it should the status of a user

delicate zephyr
#

@tulip ledge can you show me the output of data when console logged

#

can you not spoon feed

misty sigil
delicate zephyr
#

@modern sable spoon feed alert

tulip ledge
#

Nvm I wasn't passing a user I'm stupid

delicate zephyr
#

oh ok

pure lion
#

Bobe

delicate zephyr
#

@cinder sandal are you using discord.js?

cinder sandal
#

yes

tulip ledge
#
    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
delicate zephyr
#

do <% console.log(user) %>

tulip ledge
#

It works if I do ?user=Vigintillion but if I do ?user= it doesn't work

delicate zephyr
tulip ledge
#
    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

delicate zephyr
#

@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) : {}
pure lion
#

@ChickenDev#6181 btw mern full stack

delicate zephyr
#

data then checks if user exists and if it does it will do the fetch

pure lion
#

Oh goody I can't mention

#

@pure lion

delicate zephyr
#

and if it doesnt it will return an empty object

pure lion
#

Smart

delicate zephyr
#

@pure lion You're clearly not a full stack developer

pure lion
#

Clearly

tulip ledge
#

Oh thats so smart lmao

delicate zephyr
#

Learning is fun

tulip ledge
#

I was hoping to use a ternary operator somewhere in my code

delicate zephyr
#

Yea

#

It is fun

#

EJS is nice

#

kinda which I learnt React before helping make DBLStats tho

tulip ledge
#

So mongo express something and node right?

delicate zephyr
#

I mean

#

for dblstats.com we use:
mongo - database
redis - sessions / caching
EJS - render engine

#

node is just the thing that runs it

#

Β―_(ツ)_/Β―

tulip ledge
#
    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
delicate zephyr
#

check ur console

#

did it return undefined?

tulip ledge
#

Thats it

delicate zephyr
#

oh

#

show me the render code

#

again xD

tulip ledge
#
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 
    });
});
delicate zephyr
#

oh right

#

ok

#

try

#

<% const _user = user || false %>

#

even though that should work

#

Wait

#

what is the console.log(data) outputting

tulip ledge
#

the data the API returned

delicate zephyr
#

can you show me the function?

tulip ledge
#
// 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)
    }
}
delicate zephyr
#

hmmm

#

that should be working

#

try doing

#
    res.render("pages/index", { 
        user: data || false 
    });
#

idk why its not working for you though

tulip ledge
#
    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
delicate zephyr
#

hmmm

#

idk try json stringifying it again

#

if that works im gonna blobmindblown

tulip ledge
#

Nop

#

Same error

#

It works if I specify a user

#

If I don't

#

It doesn't work

pure lion
#

What the fuc

#

Weird

#

Okay show where you're rendering

tulip ledge
#
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 
    });
});
delicate zephyr
#

OH

#

can you

#

console.log(req.query)

pure lion
#

Yeah I was gonna say

tulip ledge
#

nothing

delicate zephyr
#

Dice just let me deal

#

@tulip ledge does it not even output {}

tulip ledge
#

Wait no

#

I wasn't in /stats

#

{ user: 'Vigintillion' }

delicate zephyr
#

and if you just do

#

?user=

tulip ledge
#

{ user: '' }

delicate zephyr
#

do

tulip ledge
#

Oh I'm braindead

#

I noticed

#

I never restarted the server

delicate zephyr
#

dude

#

😩

tulip ledge
#

I'm so sorry

delicate zephyr
#

im sat here like

pure lion
#

I am unable to can

delicate zephyr
#

"My brain is about to hit desk"

tulip ledge
#

I'm so sorry 😦

delicate zephyr
#

@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 πŸ™‚

tulip ledge
#

Yeah firsy time doing express and ejs

#

Been doing JS for 3 years tho so kinda sad I forgot to restart it

delicate zephyr
#

I recommend sometime like nodemon when editting files like that

tulip ledge
#

Yeah

#

I prob should

delicate zephyr
#

It would help you in case you forget to restart

fluid basin
#

use gulp

delicate zephyr
#

Hope everything else goes well though!

pure lion
#

Actually nvm I'm not going to ask for help here

delicate zephyr
#

why

pure lion
#

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

delicate zephyr
#

yes, and you need help with?

pure lion
#

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

quartz kindle
#

that means there is a redirect infinite loop

pure lion
#

Sounds nasty

quartz kindle
#

you need to check your config

pure lion
#

What am I looking out for

quartz kindle
#

if you're using ssl on nginx, turn cloudflare's ssl off

misty sigil
#

ok

pure lion
#

Matt go do that

misty sigil
#

still

#

too much redir

pure lion
#

Is offline

misty sigil
#

it'd say 502

#

not too much redirs

pure lion
#

Hmmmmm

misty sigil
#

why dont u just turn off nginx

slate oyster
#

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

misty sigil
#

@pure lion dice

#

just turn nginx off

pure lion
#

No

misty sigil
#

wHy

#

just turn off the shitty ip goes to url rubbish

pure lion
#

I just did

#

Still broken

#

It's the same thing without ssl

misty sigil
#

aH

#

this is confuse

pure lion
#

Yes very

fringe axle
#
{
    "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?
pure lion
#

Are you sure it's off?

misty sigil
#

nginx is confusion

#

ssl is off yes

pure lion
#

Show

misty sigil
pure lion
#

Weird

#

Show full settings in DM

slate oyster
#

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

sudden geyser
#

are you talking to yourself or asking for help from us

honest perch
#

^

slate oyster
#

I'm talking to anybody who will respond with anything

pseudo garden
#

To ask the certification, the bot need 75 or 76 server pls ?

#

(official discord certification)

earnest phoenix
#

discord is going to message you when you're qualified for verification

hardy steeple
#

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?

slate oyster
#

Nobody responded with feedback on my actual set of posts ):

hardy steeple
#

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

topaz fjord
#

if you're using ssl on nginx, turn cloudflare's ssl off
@quartz kindle if you're using full strict you need both

pure lion
#

What is both

#

How do I use both

#

I mean the site is working now

topaz fjord
#

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

pseudo garden
#

ok thx Cry

topaz fjord
#

just depends if you want to go through the effort or not

honest perch
#

how do people here store votes?

#

for every 12 hours

misty sigil
#

database

pure lion
#

Oh hey it works

solemn latch
#

Typically, in a database.

honest perch
#

and how would you then clear it per user every 12 hours

pure lion
#

Ah but the www doesn't work

honest perch
#

www is wack

solemn latch
#

You have to add a www record to everything

#

Sites should still support it

#

Depends on your database @honest perch

honest perch
#

mongo

solemn latch
honest perch
#

with mongoose?

solemn latch
#

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

honest perch
#

yeah ive tried but no luck

solemn latch
#

Tried googling it?

#

πŸ€·β€β™‚οΈ lots of results

honest perch
#

used different wording ):

solemn latch
honest perch
#

also ddg

solemn latch
#

One of the first few results was pretty good

honest perch
#

thanks

wheat jolt
#

what licence should I use if my software isn't open source

honest perch
#

none

#

if its not open source

wheat jolt
#

oki

#

thanks

honest perch
#

then you dont need one

solemn latch
#

Id reccomend putting something still

#

Theres a few comments(under op) that discuss the reasoning for including it.

dreamy cedar
#
let first =  message.mentions.roles.first();
let second =   message.mentions.roles.map(r=>r)[1]
message.channel.send(`  (first mention:${first})
sencond mention${second} `)
viral iris
#
    if(!message.member)message.member == message.guild.members.cache.get(message.author.id)

Cannot read property 'members' of undefined

#

can any1 help ?

wheat jolt
#

message.guild is undefined somehow?

sand condor
#

message is not a d.js Message structure

viral iris
#

idk

solemn latch
#

Just be aware, a lot of open source libraries licenses do not let you use their libraries if whatever your making is closed source.

sand condor
#

log message and see what it is

viral iris
#

i did

#

it's like "user id" something like this

sand condor
#

ok can u share it

viral iris
autumn summit
#

im trying to make a discord.py invite manager and I keep getting this error:

#

TypeError: 'Invite' object is not subscriptable

sand condor
#

then message is a collection of users

#

you did something in ur code to make it tjay

#

that*

earnest phoenix
#

How can i restart all shards without process.exit() or client.destroy()?

viral iris
#

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") {
sand condor
#

no you made your message variable something else

#

and message.member is always defined

viral iris
#

run: async (message, args, bot) => {

earnest phoenix
sand condor
#

unless dm channels

#

remove the message.member part

earnest phoenix
#

There's no problem with it

sand condor
#

wym

#

if message.member isn't defined

#

then it's in a dm channel or something else

viral iris
#

no in server

sand condor
#

if it's in a server message.member should exist already

viral iris
#

then what's wrong?

sand condor
fluid basin
#

How can i restart all shards without process.exit() or client.destroy()?
@earnest phoenix what?

viral iris
#

mean this right ? run: async (message, args, bot) => {

sand condor
#

that or something else

dreamy cedar
#
let first =  message.mentions.roles.first();
let second =   message.mentions.roles.map(r=>r)[1]
message.channel.send(`  (first mention:${first})
sencond mention${second} `)
fluid basin
#

d.js?

dreamy cedar
#

yes

fluid basin
#

read the docs, the mentions property does not return the mentions in order

low shard
#

@dreamy cedar you want mention a user or role ?

dreamy cedar
#

role

low shard
#

Ah

#

K

fluid basin
dreamy cedar
#

ok ty ill check

low shard
#

@fluid basin how i can do

#

Link lije yours

fluid basin
#

use something like regex if you need the order

low shard
#

Link

restive furnace
fluid basin
#

oh

#

just click on the title of the field

low shard
#

how i can fix this problem please
it always give the same result
@dreamy cedar what the problem ? Again

dreamy cedar
#

it gives the same result

fluid basin
#

yes, do this instead:

use something like regex if you need the order

low shard
#

@dreamy cedar you dont tag the same role ?

dreamy cedar
#

@dreamy cedar you dont tag the same role ?
@low shard there is 2 roles

low shard
#

Yes ,

dreamy cedar
#

use something like regex if you need the order
@fluid basin ill search and see

fluid basin
#

"discord mention regex"

low shard
#

@dreamy cedar you try mention another roles ?

#

To*

dreamy cedar
#

am mentioning 2 roles
but it give the same result

viral iris
sand condor
#

i didn't say remove it

#

it might be a problem with the order

low shard
#

@dreamy cedar you wanna give me link to try it on dms ?

sand condor
#

but it also could be something else

low shard
#

In /on

viral iris
#

u said remove what makes message like the image

fluid basin
#

@viral iris Cannot read property 'members' of undefined?
that means message.guild is undefined

sand condor
#

which means message is not a d.js message

fluid basin
#

wot

sand condor
#

i said remove the message.member part

fluid basin
#

it is a djs message lol

#

just that its not from a guild/text channel

sand condor
#

if you receive a dm message.guild is null

#

not undefined

fluid basin
#

you can't get a member if you don't have a guild

solemn latch
#

did the djs docs website get updated

mystic sigil
#

Which event is fired in discord.js when the guild the bot is in, is deleted.

sand condor
solemn latch
#

i was thinking it might do guildUpdate aswell

viral iris
#

i said remove the message.member part
@sand condor ok

#

but what about if (!message.member.hasPermission("MANAGE_GUILD") && message.author.id !== "349095859859881984") {

mystic sigil
#

im confused, because i have deleted the guild and my bot hasn't done anything

sand condor
#

i don't see a problem with that

viral iris
#

hasPermission underfined

sand condor
#

then permissions.has() or something on v12

solemn latch
#

whats the actual error

fluid basin
#

@viral iris what are you trying to do?

solemn latch
#

hasPermission exists on 12

fluid basin
#

message.member is undefined

sand condor
#

oh

viral iris
#

@viral iris what are you trying to do?
@fluid basin if the member don't have permission bot send message

solemn latch
#

check if message.member exists first

fluid basin
#

ah ok, but the message is a dm message

#

not from a guild

viral iris
#

in guild

solemn latch
#

if(message.member && the rest of your checks)

fluid basin
#

then message.member should not be undefined

solemn latch
viral iris
#

so only doif (!message.member.hasPermission("MANAGE_GUILD")) {

misty sigil
#

missing a )

solemn latch
#

message.member would still be undefined sometimes

viral iris
#

i'll check first

#

still underfined

solemn latch
#

can you put the full code on hastebin or something

pure lion
#

howo do i un-lock myself out of my mongodb server acc

viral iris
#

yea sure

misty sigil
#

lUl

#

@pure lion just start without auth

viral iris
pure lion
#

how do i start tho

#

the connection keeps getting refused

misty sigil
#

try mongod

pure lion
#

i cant access the shell

misty sigil
#

it'll try starting the cluster

fluid basin
#

wait where is it even hosted

#

atlas?

misty sigil
#

no

fluid basin
#

i cant access the shell

no
???

misty sigil
#

you do know

#

like

#

you can host mongodb yourself

fluid basin
#

I know

#

why would I not

pure lion
#
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
misty sigil
#

try running mongod

solemn latch
#

@viral iris i dont see you checking if member exists before doing the check in this code

pure lion
#

did

misty sigil
#

what did it say

viral iris
#

@viral iris i dont see you checking if member exists before doing the check in this code
@solemn latch i'll do

solemn latch
#

okay. do that

copper cradle
#

the mongo server is not started

pure lion
#

big json

viral iris
#

1min

copper cradle
#

restart the vps

#

that crap always happens with mysql

#

I usually use systemctl to start it manually

pure lion
#

i did that

#

i checked the status too

misty sigil
#

whats the status

pure lion
#

oh

#

exited status 14

solemn latch
#

f

pure lion
#

well shit

#

always getting that now

misty sigil
#

yea

#

same when i added users

solemn latch
#

linked the same page as me πŸ€”

#

get rid of that friend

misty sigil
#

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

topaz fjord
#

so he scammed

solemn latch
#

stealing code is super shitty

naive shuttle
#

That's what im saying

solemn latch
#

code theft is real

naive shuttle
#

But he says "it's still custom since im modifying it"

viral iris
#

@solemn latch only console.log(member); ?

pure lion
#

not exiting but still cant connect

sand condor
#

off topic but i wouldn't recommend using the word gay as a derogatory term in 2020

solemn latch
#

thats not a check

#

thats a log

#

if(!message.member) return;

naive shuttle
#

off topic but i wouldn't recommend using the word gay as a derogatory term in 2020
@sand condor i'll rephrase that then

misty sigil
#

not exiting but still cant connect
@pure lion thats because you need to auth

pure lion
#

ah

sand condor
#

i get what you mean, it's just that it could be offensive to some people

viral iris
#

member is not defined

misty sigil
#

mongo --username "username" --password "password" --authenticationDatabase "admin"

#

afaik

solemn latch
#

yeah, we have determined that.

#

now you need to not use message.member.property unless its defined.

pure lion
#

it works

sudden summit
#

sea

pure lion
#

still cant connect externally

viral iris
#

now you need to not use message.member.property unless its defined.
@solemn latch how to defined it ?

solemn latch
#

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. πŸ€·β€β™‚οΈ

fringe axle
solemn latch
#

having an error?

fringe axle
#

I click on them and nothing is happen.

#

No

solemn latch
#

how are you checking for reactions

fringe axle
#

With a collector

solemn latch
#

can i get an example of the code?

fringe axle
#

Yes, you can. xD

misty sigil
#

@pure lion

#

yo

solemn latch
#

hastebin plox, i dont download message.txt's

fringe axle
#

Okay

misty sigil
#

i know why its not working

fringe axle
solemn latch
#

are those your emoji names?

#

look like ids

misty sigil
#

thats id afaict

fringe axle
#

The ID's

solemn latch
fringe axle
#

That are the emoji ID's of the custom emojis...

#

Oh

#

Okay!

#

Working! Thanks.

viral iris
#

@solemn latch

#

i did u mean this ?

#
   message.member = await message.guild.fetchMember(message);
fringe axle
#

@solemn latch I have a little problem with it. Sometimes the reactions aren't working.

viral iris
#
 if (!message.content.startsWith(prefix)) return;
  if (!message.member)
#

what about this ?

solemn latch
#

probably want to do it in the command, not in the command handler

#

the guide covers changing stuff

viral iris
#

probably want to do it in the command, not in the command handler
@solemn latch so how to fix that ?

solemn latch
#

i feel like ive explained what you need to do as clearly as i can

viral iris
#

what?

solemn latch
#

anything i say at this point will be a repeat

viral iris
#

@solemn latch how to fix it ?

solemn latch
#

check if message member is defined before using it

viral iris
#
console.log(message.member);
solemn latch
#

thats just logging it, it doesnt affect anything

viral iris
#

then how to check if it defined ?

solemn latch
#

ive said it twice now

ionic dawn
viral iris
#

i have this in message.js
if (!message.member)

solemn latch
#

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.

viral iris
#

@solemn latch got this message.guild.fetchMember is not a function

#
  if (!message.member) return;
    message.member = await message.guild.fetchMember(message);
solemn latch
#

message.guild.fetchMember doesnt exist

viral iris
#

it is

solemn latch
#

please tell me where

viral iris
#

in message.js

solemn latch
#

show me where in the docs

#

;p

#

you cant make up properties and expect it to work

viral iris
solemn latch
#

you cant just make up properties and expect it to work

viral iris
#

so remove it ?

solemn latch
#

yes.

viral iris
#

this returned Cannot read property 'hasPermission' of undefined

solemn latch
#

???

#

also, your assigning your client as message

misty sigil
#

oh yea that

earnest phoenix
#

:0

#

ye

viral iris
#

so it's client.member

#

i mean client

solemn latch
#

well, the root problem the whole time
is your effectivly doing
message = client

earnest phoenix
#

@solemn latch wait how did u get the run: ascync

#

he didnt share it

solemn latch
#

he did awhile ago

#

thats why i like hastebin

#

i can keep them open

earnest phoenix
#

:0

solemn latch
#

just pasting code in chat and that shits gone

misty sigil
#

bot is also args

earnest phoenix
solemn latch
#

kek

earnest phoenix
#

sorry

solemn latch
#

np

earnest phoenix
#

:0

#

switch case is not working in that code

small prairie
#

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

viral iris
earnest phoenix
#

@viral iris show code

solemn latch
#

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

viral iris
small prairie
#

i had a pretty hard time oding that

earnest phoenix
#
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

viral iris
small prairie
#

wasnt able to exactly do it

earnest phoenix
#
run: async(client, message, args, prefix)

@viral iris ^^^

viral iris
#

1sec

earnest phoenix
#

done

#

1 sec gone

#

:))

pure lion
#

@misty sigil poo

viral iris
#

now it's Cannot read property 'hasPermission' of undefined

earnest phoenix
#

message.member

viral iris
#

ok 1min

earnest phoenix
#

not client.member

viral iris
#

thx everyone ❀️

#

it's worked

earnest phoenix
#

np

solemn latch
#

if tim was here, that woulda taken 3 minutes

viral iris
#

it's ok thx anyway ❀️

solemn latch
#

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?

small zenith
#

U cant mentoin in title

solemn latch
#

your also not closing this line

let membersWithRole = message.guild.members.cache.filter(member => {return member.roles.cache.find(role => role.name === roleName)
#

})

small zenith
#

and use .join("\n")

solemn latch
#

also, does filter work like that πŸ€”

small zenith
#

🀨

solemn latch
#

i feel like theres a much cleaner way of doing this

small zenith
#
`membersWithRole.join + "\n"` ```
#

is it correct? i dont think

fluid basin
earnest phoenix
#

Hi

small zenith
#

use ${} or remove ` and .join("\n")

earnest phoenix
#

join("Something")

#

for example

solemn latch
#

role has the property members

earnest phoenix
#
let array = ["a", "b", "c"]
let string = array.join("+");
console.log(string); // result = a + b + c
solemn latch
#

role.members
will be a collection of all the cached members will the role

#

i cant type

earnest phoenix
#

yes u can't

#

i hope so :))

solemn latch
#

im on like 6 edits for that message

#

lmao

earnest phoenix
#

LoL

solemn latch
#

anyway
<Role>.members.map(m => m.tag);
pretty sure will do pretty much what you doing

#

in all those lines

pale vessel
#

m.user.tag

solemn latch
#

^

#

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.

small zenith
#

Thats spoonfeeding ig so deleted

solemn latch
#

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

dire obsidian
#

ok guys, im making a webpage and idk what kind of embeds discord uses

solemn latch
#

custom?

dire obsidian
#

hmmmm ok

#

is a <embed>?

solemn latch
dire obsidian
#

emm no

#

like you send a link and discord process a embed

#

like youtube links

regal raven
dire obsidian
solemn latch
#

those are just divs

#

and containers

#

and images

dire obsidian
#

ah ok thanks bro

pure lion
#

heyo

viral lynx
#

I cant run my bot online

dire obsidian
#

hello

solemn latch
pure lion
#

i keep getting mongodb connection timeout after setting the bindIP to 0.0.0.0

viral lynx
#

I did exactly same things like a guy from yt, but the process stops when I am typing node . In the consile

solemn latch
#

youtube is a bad source for learning how to make bots

viral lynx
#

It should say "(botname) is online!"

#

But nothing happens

solemn latch
#

the vast majority of discord bot guides on youtube are outdated and useless

viral lynx
#

This tutorial is from may 30 2020

solemn latch
#

πŸ€·β€β™‚οΈ

viral lynx
#

πŸ€”

#

Imma watch it again and also watch my script

sudden geyser
#

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.

pure lion
#

i keep getting mongodb connection timeout after setting the bindIP to 0.0.0.0
a q u h e m

#

do i need to pass anything through nginx?

misty sigil
#

you'd needa pass the mongodb port through

#

mongodb port is commonly 27017