#development

1 messages ยท Page 753 of 1

quartz kindle
#

is the height fixed or dynamic?

grave mist
#

This is my first website ever so I'm not sure about what you mean by fixed or dynamic

#

Devices viewing the site will change so I guess height will change

quartz kindle
#

i think it would be best to switch to flexbox then

#

vertical centering is a bit complicated with dynamic heights

#

but you can play around with stuff like css height: 80vh; margin 10vh auto;

#

another option is display:inline-block and vertical-align:center

#

but thats old fashioned and depends on a few other factors

grave mist
#

The code I gave above does exactly what I want tbh

#

But the problem is when I zoom in to make it like mobile or view mobile site using inspect element, it is lot messy

quartz kindle
#

it will be messy regardless, responsive design is not easy

#

most people use media queries when designing responsive

#

media queries let you define specific css based on screen size

#

other than that, try using flexbox (display:flex)

grave mist
#

And btw, I saw a lot of websites using filenames like u3h43iu4h234njsdjanhd.js kj34hj23uih4.css why are they like that? And also, the js file is not like the js I type. All of them are hard to read

quartz kindle
#

they are minified files

mossy vine
#

also obfuscated

quartz kindle
#

minified files are basically just a way to save space

grave mist
#

Ik minified

#

But they aren't like that

#

Let me send an example

quartz kindle
#

possibly obfuscated yes

grave mist
#
!function(e){function t(t){for(var n,a,i=t[0],o=t[1],s=0,u=[];s<i.length;s++)a=i[s],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&u.p
quartz kindle
#

most likely transpiled and minified

grave mist
#

There are like tonnes of lines so I definitely doubt that

#

Idk what is transpiling but will google it

quartz kindle
#

transpiled js is basically modern js converted to old js for compatibility with old browsers

mossy vine
#

if you want to you can waste a few days of your life reverse engineering and deobfuscating that code

#

and by the time youre done, new versions will be deployed

quartz kindle
#

there are plenty of deobfuscators out there lul

mossy vine
#

sounds like a dumb way to avoid the grind ๐Ÿ’ช

grave mist
#

I don't want to get that code back to js version like we use to read and copy

#

I want mine to go to that so it'll be hard to read

quartz kindle
#

dont bother, it doesnt add any security to it

grave mist
#

But my files are like so open

#

All the things I type, they can get with inspect element

quartz kindle
#

all js files are open

#

client side code is impossible to protect, its been like this since always

#

the most you can do is annoy people

topaz fjord
#

client side rendering mmLol

grave mist
#

Yea, but many won't bother to use the code if it's too messy like that

quartz kindle
#

you can use an obfuscator, there are many out there

#

or you can convert to JSFuck

#

:D

topaz fjord
#

what's the point in that tho

quartz kindle
topaz fjord
#

just slap a license on it and call it a day

grave mist
#

Just some space sucking

quartz kindle
#

yeah, put a license on it, and sue people who steal it

grave mist
#

kk

quartz kindle
#

thats the best protection

grave mist
#

And I also will be making an api from my bot that should only be used by me

topaz fjord
#

you wont get everything from a license but you'll get a decent portion

grave mist
#

But you know, anyone can use it if they read the source

quartz kindle
#

but if you wanna use an obfuscator, you can just google "js obfuscator" and you'll get dozes of results, like this one https://obfuscator.io/

grave mist
#

And even if I use an api key, they can still use the api key

topaz fjord
#

validate the request ip

quartz kindle
#

never use api keys on client side

#

never ever

#

just dont

grave mist
#

I heard ip are static

topaz fjord
#

or just like block all other ips to your vps

#

except trusted ones

grave mist
#

Does domain work?

quartz kindle
#

nope

grave mist
#

Instead of ip

#

Why not

quartz kindle
#

referers and origins can be spoofed

grave mist
#

Wut

quartz kindle
#

when you make a request from the browser, the browser sends origin and referer headers, informing the server where the request came from

#

those headers can be faked

grave mist
#

So only IP works?

quartz kindle
#

ip can also be faked basically

grave mist
#

Then what am I supposed to do

quartz kindle
#

but it does provide some degree of protetions

#

what you should do is put all your api code in the server side

#

and then make requests to it

grave mist
#

Well what is the server here

quartz kindle
#

for example

grave mist
#

I thought my vps is the server

quartz kindle
#
instead of
browser -> api

do
browser -> server -> api```
#

server is the server that is serving the webpages

#

so basically, you connect to another page

#

and this page should make the api connection

grave mist
#

Ok, can't any user connect to the other page which then will make the requests?

quartz kindle
#

they can

#

but at least they wont steal your api keys

grave mist
#

Then isn't it same?

quartz kindle
#

and wont see the api code

#

plus it is protected behind a webserver

#

subject to ddos protection and rate limits

grave mist
#

I just thought to use 1 api key which gonna get data from my bot

quartz kindle
#

your api is not hit directly

grave mist
#

The api key is some random encrypted text which is decided by me

quartz kindle
#

yes, but this key and the entire api logic should be in the server side, not sent to the client

grave mist
#

What I wanted to do is not give/get data to/from users if it's not me

quartz kindle
#

the only way to reliably do that is to use sessions

#

and a login/auth system

opaque eagle
#

how about jwt

grave mist
#

Bye "me" I mean the website

#

The website say example.com should only be able to give/get data

quartz kindle
#

the website yes, in the server side

#

servers usually have a static ip, which you can use to restrict ips

#

while clients are mostly dynamic ips

#

so you can use ip restrictions from server to server

earnest phoenix
#

jwt is good enough

quartz kindle
#

plus an api key

earnest phoenix
#

i used jwts to serve content from my cdn

#

a big plus is using an auth system though

quartz kindle
#

i havent used jwt, but they still cant be used from client right?

#

its just server2server

earnest phoenix
#

jwt is sent in the headers

#

sometimes stored in sessions

#

the good thing about jwts is that you can store your password in them which becomes encrypted

quartz kindle
#

yeah but if you generate jwts client side thats probably a nope

earnest phoenix
#

yeah

#

jwts are mean to be created on the server

#

never on the client

#

anything confidential shouldn't be created on the client

grave mist
#

Well I still can't get how this client to server to api process works

#

if the client makes a request that it needs a to server then server will request the api to get a and return it to client

#

Can't another user request the same a using same code

earnest phoenix
#

the user won't see how the request is made and where

#

the whole point is hiding the api source

grave mist
#

Yea that will be hidden but making a request to the server is still visible right

earnest phoenix
#

a request to your server, yeah

grave mist
#

The server gives the data to those who requests the data

earnest phoenix
#

yeah, it's why all of this auth/login/jwt stuff's been mentioned

grave mist
#

The request to server code is on client side right>

earnest phoenix
#

yes

#

client makes request to somewebsite.com/some/path, the server receives the request to /some/path and you can decide what to do there

grave mist
#

Yea, I get that but I just can't get how I'm going to hide this auth code or whatever the client needs to send to the server to verify itself

earnest phoenix
#

have the client send a jwt

#

or simply, sessions

#

sessions are cookie based so they can't be faked

grave mist
#

That jwt is random each time?

earnest phoenix
#

a proper jwt implementation, yes

#

everytime the client hits the server, the server sends the jwt to the client

#

and it's regenerated everytime

#

if the jwts don't match, throw away the request

modest maple
#

why do u need to have this sort of api setup anyway Stickz?

grave mist
#

jwt is encrypted data that the client needs?

quartz kindle
#

the thing is, there is no way to prevent people from accessing data on a website, because websites are built to serve data. whatever you put there will be accessible one way or another. what you can do is try to prevent it from being accessed by non-browsers

#

which is where sessions, tokens, and jwts come into play

grave mist
#

@modest maple I thought like no one can access if I put api key but they can still get it from client side

modest maple
#

what do u even need todo tho?

grave mist
#

I'm very unclear about jwt. Can anyone give me a good link about how to do that

#

I just need to get and post data to my bot's server

earnest phoenix
#

just an api key is enough for that then

quartz kindle
#

you are looking into using ajax for that, correct?

modest maple
#

god ajax is a pain

earnest phoenix
#

i'm confused whether this is just backend or front & back

grave mist
#

Let me tell it very clearly wait. Like if I request for /guilds the bot will send a JSON like { "guilds": 100 } and that 100 is what I use in my webpage

quartz kindle
#

im assuming its front and back, since the whole client side api key

#

so your page makes a request to /guilds to get the data and then display it to the user visiting?

grave mist
#

Yea

quartz kindle
#

does it request it server side or via ajax?

grave mist
#

Hard to understand :/

#

Idk what is ajax tho

quartz kindle
#

ajax = javascript requests without page reload

modest maple
#

aka a massive pain in the ass to scrape

quartz kindle
#

ie: click a button, display loading spinner, render the data

grave mist
#

Yea, like that

#

But for some sites, it'll load along with page itself. Like in that example, it'll say Bot is in x guils when the page reloads

quartz kindle
#

so your javascript code should make a request to /ajaxguilds and the /ajaxguilds should internally make a request for /guilds

#

this is ajax

grave mist
#

Ok

oak imp
#

It depends on how/where you make thr API request.

modest maple
#

wouldn't it be simpler just to update the count every X minutes or when the bot gains a guild. rather than making a request on every page visit

earnest phoenix
#

i feel like the best thing here would be to do server side rendering if that's the only purpose

quartz kindle
#

if your page directly makes a request to /guilds and then loads then full content, that is a server side request, and its much safer

grave mist
#

I said that's an example

#

Ok, what is server side doing

quartz kindle
#

person accesses /
the / page makes an internal request to /guilds

grave mist
#

Ok I get it

oak imp
#

I would HIGHLY suggest you make all requests on your server before it sends the page to the client. Why? Because in order to make requests on the client side, the client also needs to have the API credentials, which the client can then see if theyre smart enough.

quartz kindle
#

then returns the content with the guild data already loaded

grave mist
#

The server is the server which hosts the website or what?

quartz kindle
#

server side requests are much safer and simple than ajax, the only reason for using ajax is if you're loading heavy/slow data, or for cool user experience

#

yes

oak imp
#

@grave mist yes, as in, your website server.

grave mist
#

That is what I'm referring to as client side so far tbh

quartz kindle
#

client side is the browser the person is using

oak imp
#

The client is the end user viewing your page

grave mist
#

Ok where would the code for that be placed?

quartz kindle
#

are you using a node server? like express?

grave mist
#

Well, I don't have a server tbh. Since this is my first website, I'm using glitch.com

#

Yea, express

quartz kindle
#

ok

#

so

oak imp
#

You have 3 parts basically.. client (the website viewer), server (web host for your site), and services (the APIs).

quartz kindle
#

EVERYTHING you code in express, is server side

#

client side is EVERYTHING you put in res.send()

#

everything you send to the viewer

oak imp
#

What you wanna do is:

Client makes request for your page -> server receives request -> server makes requests to services -> services return data to server -> server generates page with data baked into it -> server sends page to ient -> client sees page

grave mist
#

So should I use another glitch project right here to get data from and api and send to my website project?

oak imp
#

No, build it into the page code.

quartz kindle
#

you can do it from the same project

grave mist
#

like add a file called server.js and do things there?

#

I'm really confused. Sorry if the question is too dumb

oak imp
#

...what language are you using to write the site?

quartz kindle
#

you can do it however you want, as long as you dont send the js code to the viewer

grave mist
#

html

#

Wait what

#

js

quartz kindle
#

having cleared the whole server/client misunderstanding, the way you were doing it since the beginning is probably the correct way

oak imp
#

I mean personally I write all sites with PHP, including requests, and output from thay, so, the way you're doing it is like Tim ssid, probably correct (?)

grave mist
#

I do like this mainpage.html ->

<html>
...
...
<script>request</script>
...
</html>
oak imp
#

Oh

#

No

quartz kindle
#

oh

#

no

#

lmao

grave mist
#

I know that's why I said it is so unsafe

oak imp
#

LMFAO yeah so thats sending the request to the client

grave mist
#

I shouldn't add the script file there right?

quartz kindle
#

yeah because that way you are sending the js code to the viewer

#

you should process the script inside the express code

oak imp
#

I can just do an inspect element and grab your API key with that kind of code

quartz kindle
#

and only send the resulting html

grave mist
#

That's what idk how

earnest phoenix
#

that way would only be secure if the backend required the user's cookie to be signed in

grave mist
#

Make a js file -> request, send to page -> load page?

oak imp
#

Yeah except he's using just flat HTML...

quartz kindle
#

you know, html is basically a text file that the server sends to the browser right?

#

so you can literally code an html text in js

#

and use express's send functions

#

no need to literally send an html file

grave mist
#

I never tried that

earnest phoenix
#

oh, yeah, you can't have anything secure without an actual backend server running

quartz kindle
#

there is also something like EJS, which lets you weave html and js code together

oak imp
#

I eould suggest looking into learning either PHP or JS to generate the page, then send the resulting HTML that way tbh

earnest phoenix
#

php pls it's almost 2020

#

i mean the newer versions are good

oak imp
#

PHP still powers 87% of all sites

quartz kindle
#

whatchu mean, php 7.3+ is quite alright

grave mist
#

Ok so I put like
main.html

<html>
<script src.... file.js />
</html
```?
quartz kindle
#

no

oak imp
#

No

quartz kindle
#

remove it completely from there

grave mist
#

That still lets them use the file ig

#

Ok

#

What to do about main file naming

earnest phoenix
#

that's the same as having the code right inside of the script tag

grave mist
#

Yea

oak imp
#

@earnest phoenix I did mean v7+ btw lolz

earnest phoenix
#

ah

#

yuck

#

python is slow

oak imp
#

Eww

modest maple
#

python is only slow if you dont give it UNLIMITED POWER

oak imp
#

Py is also not the easiest to learn for a beginner lolz

#

So there's that hurdle as well

modest maple
#

try clojure

grave mist
#

Can you send me a basic example of what files I need to put, what I have to insert in which file to display hi in my main page

quartz kindle
#

@grave mist js app.get("/", function(req,res) { put your js code here. call your api using something like node-fetch get the result build an html text let html = `<body><div>${api result}</div></body>`; res.send(html); });

grave mist
#

Ah

#

Like that

#

...

earnest phoenix
#

i've personally had best experience with h2o, atreugo, and asp.net core for webservers

oak imp
#

I can give ya a simple PHP example as well later, if ya don't wanna deal with the BS that is Express

modest maple
#

php is just a ded meme at this point

quartz kindle
#

hes already running a node server, moving to php will be a pain in the arse

grave mist
#

But what about the css and aren't those html things needed

quartz kindle
#

plus does glitch even support php?

grave mist
#

I can't go to php tbh

#

I'm good in js in my point

oak imp
#

@quartz kindle true, true. Conversions are difficult for the inexperienced.

quartz kindle
#

yes, you can put your links to css files in the html text

oak imp
#

@modest maple lel not really but okay

earnest phoenix
#

php is widely used

modest maple
#

it has its ups and downs

earnest phoenix
#

but there are much better alternatives out there

grave mist
#

Like this?

html = `<link rel='styleshee' ....>
quartz kindle
#

i use php in most of my websites

#

yes

#

basically just rebuild your entire html file as a string

grave mist
#

I see

oak imp
#

Thing is, basically all frameworks are either PHP or JS wrappers.

PHP is still the dominant language for web, with over 85% of sites online.

grave mist
#

Thanks for the help

quartz kindle
#

or you can look into EJS, which is a way to write html files and add server side js code to them

grave mist
#

Which is better

quartz kindle
#

its the same, just EJS lets you stay with separate files for pages instead of working on them as strings

oak imp
#

(you could always combine all three lolz)

quartz kindle
#

could always design your own framework

oak imp
#

could always hire me to make it for you

quartz kindle
#

i'll hite you

grave mist
#

Ok now my things are safe. The last one I can't get is dynamic loading of pages. If you can waste your time to help me, then ok but if you don't want, you can just give me good link so I can learn from it

quartz kindle
#

what do you mean with that

grave mist
#

Like discord

oak imp
#

You're just loading certain page elements dynamically, or...?

grave mist
#

Each time you click a channel

#

Instead of loading another page

quartz kindle
#

that is basically either ajax or websockets

#

discord uses both

grave mist
#

Aren't they called as dynamic webpage loading?

quartz kindle
#

idk, doesnt ring a bell

grave mist
#

Like when you click a link, instead of loading whole page, just replace the contents

quartz kindle
#

yes, you can do that with ajax

earnest phoenix
#

you're thinking of a single page app

grave mist
#

Like for example, this channel link is /a and you go to /b that won't reload page but just edit the part and set the contents of /b

oak imp
#

Yeah that would be able to be done via AJAX

quartz kindle
#

basically ajax with history state hacks

#

a pain in the arse for SEO

#

lul

grave mist
#

Ok, I'll see ajax then

#

Thank you all for helping

#

me

quartz kindle
#

good luck

grave mist
#

I guess you guys wasted 30 mins for me

quartz kindle
#

god will repay me

#

or cthulhu

grave mist
#

It is an hour tbh

oak imp
#

That'll be 47.50 USD plus tax for consultation services @grave mist :V

grave mist
#

I'll pay in future. Ping me after 10 years

#

I haven't even started working

oak imp
#

*setreminder 10y repayment request from stickz

#

๐Ÿ‘Œ

quartz kindle
#

will discord even exist in 10 years?

oak imp
#

I sure hope so lolz

#

Its one way I make monies soooo... let's keep it around haha

quartz kindle
#

same lul

grave mist
oak imp
#

eww mee6

earnest phoenix
#

you can't really reverse engineer something like that

#

half of the code is in the backend

grave mist
#

Did they do the obfocust or whatever the process you called to make the file hard to read

#

What is the process they did

#

I also do that so no one ever can read the code

earnest phoenix
#

publishing which is minimization and obfuscation

quartz kindle
#

isnt that basically a react app?

earnest phoenix
#

yeah

#

i also have that running on a project i'm working on

#

https://uwavy.com/ - i just don't really obfuscate since i don't care about people getting the front code because what's special is the backend

grave mist
#

And searching up on google said that those files name are like that cuz

#

of stopping page loading from cache

quartz kindle
#

yes, every time you update your js file, its likely that the client will not get the updated version until their local cache expires

#

but if you rename your files, it will bypass that

grave mist
#

What about the cache they stored

#

It will go after it expires?

#

Or will go automatically if the page doesn't use that resource in the cache

quartz kindle
#

cached files expire after their expiration timer is reached

grave mist
#

Ok and my website embed isn't showing image. I used

<meta property="og:image" content="logo.png">
lusty dew
#

Hey Tim, what did you say the point of adding an id field to my ships table was for?

grave mist
#

@earnest phoenix your files looks like obfuscated tbh

lusty dew
#

I canโ€™t remember

earnest phoenix
#

it's just minimized

#

the method names and all are still the original

grave mist
earnest phoenix
#

yeah that's just the react app reference

grave mist
#

Ok, isn't this right

<meta property="og:image" content="logo.png">
earnest phoenix
#

should be yeah

#

if you want the embed to display, discord requires opengraph data for the title and description

grave mist
#

Yea, but I want it to display the image too at the right

#

Like it did for mee6

#

And other websites

earnest phoenix
#

i know

#

i'm just saying if you want to display the embed you need the title and the description too

lusty dew
#

@quartz kindle what did you say the Iโ€™d field in my ships table was for again

earnest phoenix
#

you also might have to wait a bit for discord to scrape the website for og tags

grave mist
#

It has them too

#

It displays title, description but not image

#

Well, it displays now

#

Idk how

topaz fjord
#

react >>> *

earnest phoenix
#

it takes a while to update

#

eh turtle

#

i like react

grave mist
#

I tried right after inserting that a few hours ago

earnest phoenix
#

but react routing is messy

#

and a bit slower than angular

#

i still have yet to try angular

#

i heard angular's routing is heaven

topaz fjord
#

I think preact is adding vue style routing

surreal sage
#

isnt 5 sec for each status not allowed?

unique nimbus
#

yes its to quick

opal halo
#

there are also no errors

earnest phoenix
#

that's not how if else works

#

read up your language's basics

#

also

#

instead of doing that

#

just make a map

opal halo
#

wait, so should I remove the else's and then it would work

#

?

#

damn it im finna get a try_it_and_s.ee

earnest phoenix
#

that's not what i said

opal halo
#

i know

#

and wont choose random

lusty dew
#

I am assuming to use the methods inside a class I must first make an instance of that class>

#

?*

earnest phoenix
#

can i ask a problem with quick.db here?

lusty dew
#

I don't see why not

#

But you might find better luck in Plexi Devs server (the people who made quick.db)

earnest phoenix
#

i asked there before 2 hours and no answer yet

#

so

#

any help why not setting prefix

const db = require("quick.db")
module.exports= {
    config: {
        name: "prefix",
        description: "Change the prefix of the guild!",
        usage: "<prefix>",
        category: "moderation",
        accessableby: "Moderators",
        aliases: ["pr", "prfx"]
    },
    run: async (bot, message, args, prefix) => {
    if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("You dont have permission to perform this command!")
      let prfx = args.join(' ')
      db.set(`guildPrefix_${message.guild.id}`, prfx)
        message.channel.send(`Successfully set the prefix to **${prfx}**`);
    }
}```
Sorry, im new to quick.db
summer torrent
#

do you get any errors?

earnest phoenix
#

no

west raptor
#

I'm going to be straight up, quick.db is pretty bad

lusty dew
#

^

topaz fjord
#

Straight-Up

#

you're spitting facts

west raptor
#

since you're using javascript I recommend mongodb https://www.mongodb.com

MongoDB

We're the creators of MongoDB, the most popular database for modern apps, and MongoDB Atlas, the global cloud database on AWS, Azure, and GCP. Easily organize, use, and enrich data โ€” in real time, anywhere.

#

it's a good beginner db

#

and has good javascript support

topaz fjord
#

hmmmmmmm

#

I would say sqlite would be easier to start off with

#

then transition to mongodb

west raptor
#

valid point

lusty dew
#

How can I save the values from a class to a database

native geode
#

in many cases sqlite3 is a good beginner db

flat pelican
#

or JSON if itโ€™s a small bot like for less than 50 guilds (and if youโ€™re afraid to begin with a DB)

#

sqlite is still better

earnest phoenix
#

please avoid file collation "databases"

empty owl
#

Go use quickdb

flat pelican
#

He needs to save values, not really to create a database

empty owl
#

itโ€™s a sqlite wrapper and beginner friendly

earnest phoenix
#

ok

flat pelican
#

Often devs are using it for saving something like custom prefixes per guild on small bots

#

And itโ€™s nice tho

#

I donโ€™t use quickdb, canโ€™t help sorry

earnest phoenix
#

np

#

i will just stay and wait xD

#

like in plexi

#

3 hours

#

=

#

no answer

empty owl
#

Hey

earnest phoenix
#

hi

empty owl
#

@earnest phoenix is prfx a number

earnest phoenix
#

no

empty owl
#

Well you only can store numbers

earnest phoenix
#

oooooo

empty owl
#

Yea

#

so do like if (prfx === โ€œsomethingโ€) prfx = 1

#

and set it to one

earnest phoenix
#

ok

quartz kindle
#

what

#

that makes 0 sense

earnest phoenix
quartz kindle
#

do console.log(db.get(`guildPrefix_${message.guild.id}`)) right after you set it

#

and show the console output

#

also show how you check for prefixes

earnest phoenix
quartz kindle
#

hmm

#

show your full message event

#

and since we're already here, also console.log(await db.fetch(`guildPrefix_${message.guild.id}`))

lusty dew
#

Oh shoot

#

I forgot

#

Tim do you know how I could give myself ore?

#

Like through eval

#

so I can test some stuff out

quartz kindle
#

you can do user.resources.iron = 3874508

lusty dew
#

Okay thanks

#
[2019-12-22 16:28:51] TypeError: User.sync is not a function
[2019-12-22 16:28:51]     at StarReady.run (C:\Users\Aj\Desktop\StarGaze\events\ready.js:13:14)
[2019-12-22 16:28:51]     at StarReady._run (C:\Users\Aj\Desktop\StarGaze\node_modules\klasa\src\lib\structures\Event.js:101:15)
[2019-12-22 16:28:51]     at KlasaClient.emit (events.js:198:13)
[2019-12-22 16:28:51]     at module.exports.run (C:\Users\Aj\Desktop\StarGaze\node_modules\klasa\src\events\onceReady.js:49:22)
#

I seem to be having trouble making a table

#

but I set User as a global variable

native geode
#

i looked everywhere and i can't find what this error means

quartz kindle
#

thats an empty collection lol

native geode
#

how

#

lol i have none

quartz kindle
#

check your try/catch/.catch statements

native geode
#

it always happens when someone uses a commadn

#

so im guessing it has something to do when i grab commands

lusty dew
#
[2019-12-22 16:33:35] Uncaught Promise Error:
[2019-12-22 16:33:35] SequelizeConnectionError: SQLITE_CANTOPEN: unable to open database file
[2019-12-22 16:33:35]     at Database.connections.(anonymous function).lib.Database.err (C:\Users\Aj\Desktop\StarGaze\node_modules\sequelize\lib\dialects\sqlite\connection-manager.js:61:34)
#

This is an odd error

#

I fixed the other one

grizzled raven
#

would there be a way to save a collection to a database

#

or a class

#

of some sort

vital lark
#

wot

earnest phoenix
#

use an ORM framework

#

you can map your class as a database entity

sick comet
#

need help on this thing

#
ReferenceError: help is not defined
    at Client.client.on.message (C:\Users\Tails Era\Documents\GitHub\Tattles-News-Bot\Tattles-News-Bot\bot.js:30:46)
    at Client.emit (events.js:198:13)
    at MessageCreateHandler.handle (C:\Users\Tails Era\Documents\GitHub\Tattles-News-Bot\Tattles-News-Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\Tails Era\Documents\GitHub\Tattles-News-Bot\Tattles-News-Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (C:\Users\Tails Era\Documents\GitHub\Tattles-News-Bot\Tattles-News-Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\Tails Era\Documents\GitHub\Tattles-News-Bot\Tattles-News-Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\Tails Era\Documents\GitHub\Tattles-News-Bot\Tattles-News-Bot\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (C:\Users\Tails Era\Documents\GitHub\Tattles-News-Bot\Tattles-News-Bot\node_modules\ws\lib\websocket.js:789:20)
    at Receiver.emit (events.js:198:13)```
lusty dew
#

Wait updating the resources won't do anything. They don't get saved to the database do they? @quartz kindle

earnest phoenix
#

@sick comet read the error

sick comet
#

I do have help defined

earnest phoenix
#

you don't

#

you do have an object that's called embed defined

#

which has a help property

sick comet
#

so i do embed:help?

earnest phoenix
sick comet
#

testing

#
SyntaxError: Unexpected token :
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)```
earnest phoenix
#

read the error

vital lark
earnest phoenix
#

you maybe shouldn't copypaste from a tutorial and instead learn the language

dusky marsh
#

That's too hard for most apparently

sick comet
#

๐Ÿคฆโ€โ™‚๏ธ

#

i coded this myself

earnest phoenix
#

doubt

dusky marsh
#

X

vital lark
#

it's dot notation, not colon notation

sick comet
#

i based my first bot off of tutorials and self learning

vital lark
#

use a dot instead of a colon

sick comet
#

oh

#

let me try that

earnest phoenix
#

you dont know how to get a property on an object and you have all of the more advanced stuff perfectly set up

#

people here have a good bullshit-o-meter ๐Ÿ‘€

sick comet
#

hey

#

i made this and it works

#

open source to boot

#

(and I did give credit where it is due)

earnest phoenix
#

yes and

sick comet
#

back from the BR

#

and i spend 2 months on it

smoky quartz
#

how do you know when someone has voted for your bot and use it for daily rewards

lusty dew
#

Well

#

Use dbls api

#

And use the webhook or method

smoky quartz
#

is there a tutorial or something online

#

like a quick crash course

lusty dew
#

Not that I know of

smoky quartz
#

so where/how do i connect to dbls api through dicord.py

opaque eagle
#

In JavaScript, is there a way to add something at a certain index of a string instead of having to slice into arrays, splice, then join?

amber fractal
#

substrings?

opaque eagle
#

it extracts part of a string

#

i need to add a character in the middle

amber fractal
#

that's the only way I can think of that isn't like what you said

opaque eagle
#

ok

lusty dew
#

How can I save the values of a class after a new instance is made to a database

#

I have this class with a build method that makes a ship. And I need to save the ship to a database

#

I already have the table made

golden raven
#

My bot isn't send message in this server

#

it show Missing Permissions error

#

I have tested in this server only my bot isn't working but online

#

anybody know?

smoky quartz
#

it doesnt have permissions in the channel its trying to message

#

lack of message sending, image sending or embed

golden raven
#

embed only

smoky quartz
#

check the channel perms

#

make sure it has perms for messages and whatever else it needs

golden raven
#

ok

#

thnks

smoky quartz
#

how to use get_user_vote/get_bot_upvotes for getting info about votes

slender thistle
#

I don't think I understand that question

#

You just call that function on an DBLClient instance

earnest phoenix
#

AI porn & object detection

#

with OCR

west raptor
#

ok?

lusty dew
#

How would I update multiple things at once using sequelize

west raptor
#

v5?

lusty dew
#

Yes

#

Would I just use bulkUpdate

#

Wait a sec

#

Iโ€™m not using v5 of sequelize apparently Iโ€™m using v4

west raptor
#

update

#

then

lusty dew
#

Yea

#

That means ima have to rewrite the database structure doesnโ€™t it?

west raptor
#

depends on how massive the change was

#

v4 to v5 shouldnt be too difficult i assume

lusty dew
#

Wait how can I check which version Iโ€™m using, it looks like Iโ€™m using v4 but it also looked like v5

west raptor
#

im assuming package.json

#

what's the version set to

lusty dew
#

Okay never mind

#

5.21.3

#

Okay now thatโ€™s cleared up back to figuring out how to update multiple things at once

#

Would this work?

lusty dew
#

@west raptor

vital lark
lusty dew
#

Oh wait

#

How would I get the user's id who bought the new ship?

abstract turtle
#

hey, does anyone know of any guides / tips on setting up a bot with k8s?

west raptor
#

@earnest phoenix

abstract turtle
#

i wasn't really able to find anything on google, apologize if i just missed it.

west raptor
#

Uber knows a lot on docker and k8s

#

I'm sure they'll be able to help

valid frigate
#

holup

abstract turtle
#

Thanks April.

valid frigate
#

how big is your bot

abstract turtle
#

o hi

valid frigate
#

hello

abstract turtle
#

like 5k servers but i like overcomplicating things ok

valid frigate
#

honest question tho

#

oh then not a bad place to start

#

its worth learning

abstract turtle
#

yeah i dont have like 8 severs ๐Ÿ˜‚

valid frigate
#

honestly the resources on learning how 2 k8s is really confusing but yeah

west raptor
#

lol imagine using k8s with a 1 server bot

valid frigate
#

could be done

#

but realistically, would anyone with a 1 server bot know what k8s are

craggy herald
#

ravy does it

abstract turtle
#

who dat

valid frigate
#

some cool dude

abstract turtle
#

oh.

valid frigate
#

yeah as april said, ask uber about it

#

he has el notes

abstract turtle
#

thanks ๐Ÿ˜„

outer niche
#

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)```


How would I make this work in my main file
earnest phoenix
#

Save it as for example index.py.
But make sure its saved in the same folder with your main.py File.

main.py

import index
# your code here
#

@outer niche

outer niche
#

So if I put it in my main file it should work

earnest phoenix
#

There is still some coding

outer niche
#

What do I need to change because I cannot figure it out

earnest phoenix
#
import index

var = index.TopGG("BOT", "TOKEN")
index.DBLClient()
``` @outer niche
#

im not sure cause i dont really code or have coded in py

outer niche
#

So instead of the class I should put that

earnest phoenix
#

Thats what should go in your Main File

outer niche
#

Lol this is confusing

earnest phoenix
#

ikr

outer niche
#

So instead of the stuff I put up there that is what goes in the file

earnest phoenix
#

Yes

outer niche
#

Ok

earnest phoenix
#

Make sure you save the index and main file in the same folder @outer niche

outer niche
#

Okay so let me see if I'm comprehending this right I put what you sent in the main file and what I sent in another file

earnest phoenix
#

exactly.

outer niche
#

Okay I'm going to try

#

Now this isn't all in the same program will all work because I run everything off of ideal

golden raven
#

@outer niche

import index

var = index.TopGG("BOT", "TOKEN")
index.dbl.DBLClient()```
outer niche
#

Ok

earnest phoenix
#

wow i was not that much wrong

slender thistle
#

@outer niche Are you using cogs

sick cloud
#

so i'm working on clustering my bot

#

this is.. depressing

#

anybody got tips?

vital lark
#

@sick cloud yea

#

use Kurasuta

#

for discord.js

#

if ur getting started with clustering

sick cloud
#

i'm doing it from scratch

vital lark
#

hm

#

yea, don't overload it

hushed glacier
#

Anyone Use Glitch?

vital lark
#

I recommend using Veza for IPC related stuff

#

no because I have my own money 02cool

hushed glacier
grave mist
#

That is the header of the website I'm creating and see the left end and right end, the color doesn't take the full space of header. I mean it should be like a full rectangle that covers the header space instead of being like a part in the website

#

That color is not that different from the color below, so it would be hard to see I guess

#

The color is same for the whole header but in my site, it isn't like that so I wanna do like that

lusty dew
#

Have you tried setting width to 100% of the header

grave mist
#

Nope

lusty dew
#

That might help

grave mist
#

And it doesn't work

lusty dew
#

What does it do

#

Show me

grave mist
#

Same

#

Leaves some space in all side

lusty dew
#

Hm

grave mist
#

no change tbh

earnest phoenix
#

@grave mist just css

lusty dew
#

What do you have the width set on the body

grave mist
#

Ok I'll just css but HOW

earnest phoenix
#

put the element outside of nesting or absolute it

#

play around with cas

#

css*

lusty dew
#

That could work too

grave mist
#

Didn't set width on body

lusty dew
#

I forget absolute positioning is a thing sometimes

compact oriole
#

scss best xd

lusty dew
#

Scss is complex for a beginner

compact oriole
#

its css

#

but with some more features

#

its not harder than css

#

as its css

lusty dew
#

Depends really

compact oriole
#

the basics are the same

grave mist
#

I'm not that good in positioning with absolute

lusty dew
#

Doesnโ€™t absolute just position to the parent element

#

I forgot what it does exactly

compact oriole
#

you should position your header with absolute

grave mist
#

No parent element there

compact oriole
#

use fixed or just normal

grave mist
#

normal gives output same as the one I gave up

#

absolute and fixed looks same here

#

My code is like this

compact oriole
#

well html has margin (and you need to remove it)

#

and some other stuff

grave mist
#

Ah margin

compact oriole
grave mist
#

K thanks

compact oriole
#

I learned css from looking at templates

grave mist
#

From there?

compact oriole
#

And also I watched some videos

earnest phoenix
#

i learned it by playing around

#

it's not that hard

compact oriole
#

Just search "html landing page template"

grave mist
#

It's hard for me to learn lol

#

Lemme watch that vid

#

And you can help with this header thing only? lol

#

Click open original and see it

#

Can anyone answer this quick question? Where should I use id attribute and where to use class attribute in tags

quartz kindle
#

ids are unique, classes are not

earnest phoenix
#

how can i check if a object in a database exists?

quartz kindle
#

depends on the database, but basically just try to access it

grave mist
#

I know that ids are unique but idk what they mean by unique. Like I can just use it once?

quartz kindle
#

yes, a given id should only be used once

grave mist
#

Ok thanks

quartz kindle
#

ids are also faster than classes

grave mist
#

Every tag can have id and class?

lusty dew
#

Usually you want to only use one of the two at least I found you do other people are different

#

Really depends what you are trying to do

earnest phoenix
#

@quartz kindle i use enmap,

let object = this.client.db.get(`object_${message.guild.id}`)
if(object === null) object = true

i tried that but wont work

lusty dew
#

As tim said ids are unique and classes aren't

quartz kindle
#

@earnest phoenix if(!object) { //object doesnt exist }

earnest phoenix
#

oh

silent cloud
#

Wtd

#

My name

#

Nooooo.....

#

xD

grave mist
#

Also, you said that server side doings things and sending the pages from express to the client side is better for me. I should send the whole file as html for each webpage request like index, about etc. in one express file. How would I do requests from client side

#

Like if they click a button, I have to request to my server which then sends a request to the API and then display it?

lusty dew
#

Display what?

earnest phoenix
#

@silent cloud Lmao

grave mist
#

data

lusty dew
#

Well

grave mist
#

Like if they click a button after page loads which needs to get the data from api what should I do?

lusty dew
#

request to the api when the button is clicked then render the data recieved from the api on the page

#

or do whatever you wanna do with it

grave mist
#

But I said I want to hide the api link

lusty dew
#

then use a click event

#

or something

grave mist
#

That's why I asked like if they click a button, the website should send a request to itself which then will send request to the api

valid frigate
#

just curious this means you dont want your api to be public

grave mist
#

Yea obviously

valid frigate
#

i see

grave mist
#

It is for personal use only

#

Idk how I can tell even more clear about this

valid frigate
#

what endpoints are being protected, like file upload or

#

do you just not want people to have access to it

lusty dew
#

I will let someone else take over I have to go eat dinner

grave mist
#

Yea that

#

Ok np

lusty dew
#

Also one thing you could do to prevent such a thing from happening

#

use api keys

#

but that is a crude way of doing things

#

there is better ways but that is just one of em

grave mist
#

I do use it to make request but what I mean is my site is example.com and they click a button called a which then requests to b.com which will return b as response then the example.com should say b

valid frigate
#

ok look

#

if only you are going to use it, just pass something in your request headers

grave mist
#

I want this to happen in server side that's why I asked like whether I should make my example.com request to example.com/a which will request to b.com and ....

#

So that I can hide that the request is being made to b.com

quartz kindle
#

in example.com you click button a
button a makes an ajax request to example.com/getdata
example.com/getdata makes an internal request to api.com
api.com returns data
example.com/getdata returns data
button a receives response

grave mist
#

Yea, that's what I asked

#

Thanks :)

valid frigate
#

tim why so many redirects

grave mist
#

Web development with some bit of securing data is hard

#

Cuz I want to hide api.com here

valid frigate
#

???

quartz kindle
#

its not so many requests lol, its standard procedure for ajax apis

valid frigate
#

mk

grave mist
#
  1. api.com shouldn't be known by users that I'm using api.com to get data
  2. Even if they get they can't use cuz of api token
#

The above procedure does the 1st thing

lusty dew
#

Well we know

#

๐Ÿ˜‰

#

jk

grave mist
#

But I got a small doubt like when I load a site, it'll say waiting for example.com

#

Will it say api.com ever?

quartz kindle
#

no

grave mist
#

Ok then there should be no way to get the link then

lusty dew
#

Wouldn't it be smart to put your api token in a .env file?

#

or will they not be able to see it either way

grave mist
#

Idk how to use .env files apart from glitch.com tbh and I don't wanna use it cuz I somewhat can't trust that it is completely hidden

lusty dew
#

They aren't hard

quartz kindle
#

server to server requests are invisible to the user, no matter what

valid frigate
#

????

quartz kindle
#

unless they hack/break into your server

lusty dew
#

Ah okay

quartz kindle
#

or if they intercept your connection and you're not using https

valid frigate
#

wouldnt it be possible to eventually stumble upon api.com by some curious user

lusty dew
#

intercepting connection is a worry these days

valid frigate
#

like im pretty sure inspect element has a waterfall view that allows you to view requests

quartz kindle
#

server to server requests will never be shown there

grave mist
#

The reason I want to hide api.com is cuz I don't want users to update data. Getting data won't be of much problem but if they can change it, then that's it

valid frigate
#

is that really true

quartz kindle
#

yes

valid frigate
#

mmm

quartz kindle
#

thats the whole point of server2server

#
SERVER -> SERVER2 (API)
  ^
CLIENT```
#

client never sees server2

grave mist
#

Well btw, if example.com/getdata sends request to the api.com when a request is sent to example.com/getdata, can't I just paste that url in my browser and then it'll send request to api.com and returns data?

quartz kindle
#

yes

#

which is again the same conversation we had yesterday

#

use sessions and tokens to make sure the request came from a browser

valid frigate
#

would it not be effective to use a simple login system for this

quartz kindle
#

yes

grave mist
#

Can I do like this

#

You said ip can be faked right

quartz kindle
#

everything can be faked basically

grave mist
#

I better get off from computer

quartz kindle
#

lul

grave mist
#

Hard to protect data in my side

quartz kindle
#

look into how to protect ajax endpoints

#

there is not much you can do

#

but you can do stuff like CSRF tokens

#

which are easy to implement

grave mist
#

Ok, you said those request from client to server to api but this still comes the same way as yesterday

#

That request from client to server code is in html

quartz kindle
#

same as yesterday, manually build the html as a string in your express endopoint, or use EJS

grave mist
#

I mean like I have index.js

app.get('/'....
res.send(`<body><button>a</button><script>button click event requests to example.com/getdata </body>`)
....
#

So that I can make it send request if a button is clicked

earnest phoenix
#
const { MessageEmbed } = require("discord.js");
const { get } = require("superagent");

module.exports = class extends Command {
  constructor(client) {
    super({
      name: "trigger"
    });

    this.client = client;
  }

  async exec(message, args) {
    let disabledEmbed = new MessageEmbed().setFooter(
      "Sorry, the Module where the Command is in, has been disabled!"
    );
    let checkAvaiblity = this.client.db.get(`funModule_${message.guild.id}`);
    if (!checkAvaiblity) checkAvaiblity = "true";
    if (checkAvaiblity === "false") return message.channel.send(disabledEmbed);

    let user = message.mentions.members.first() || message.author;
    const { body } = await get("https://emilia.shrf.xyz/api/triggered")
      .query({ image: user.displayAvatarURL })
      .set(
        "Authorization",
        "Bearer Mjg1NDE4MDAwNzM0MDkzMzEy.uM7sovZdzFBtyRn9hoLv691KM5JnRAem7AUirrj8cA"
      );

    const embed = new MessageEmbed()
      .attachFile({ attachment: body, name: "trigger.gif" })
      .setImage("attachment://trigger.gif");

    message.channel.send(embed);
  }
};
#

why

quartz kindle
#
FILES
somefolder
  scripts.js
  style.css
index.js
package.json


index.js
app.get(/, (req,res) => {
   res.send(`<html>
<head>
<link rel="stylesheet" type="text/css" href="somefolder/style.css">
<script src="somefolder/scripts.js"></script>
</head>
  <body>
  <a href="getdata"></a>
</body>
</html>`)
})

app.get(/getdata, (req,res) => {
  // make api request here
  // res.send(result)
});



scripts.js (this is what the client sees)
add handler do the a, and make it an ajax request, google it```
grave mist
#

<a href="getdata"></a> is the button right

quartz kindle
#

its a link, you can make it a button with css, or you can use a button element and put the getdata part in the script file

#

theres a million ways to do it

vital lark
#

couldn't you use onclick="js"?

grave mist
#

Yea, but where would I place the onclick event

vital lark
#

with js being the JavaScript code

grave mist
#

Wherever I place, it is visible to client afaik

vital lark
#

it has to be added in the script element iirc

quartz kindle
#

@earnest phoenix try catching errors in the get request

grave mist
#

And that's where the code requesting to example.com/getdata will be place right

quartz kindle
#

yes you can use onclick

#

or you can use element.addEventHandler("click")

grave mist
#

Use this where?

quartz kindle
#

in the client side js, scripts.js

grave mist
#

I think everything is visible except index.js so the code requesting to example.com/getdata should be in there too right

quartz kindle
#

yes

grave mist
#

"in there" is index.js?

quartz kindle
#

index.js will receive the request to getdata

#

scripts.js will send the request

haughty night
#

I cannot add my server in discord server list

grave mist
#

scripts.js is visible right. So can't they see which site I'm making request to?

#

I'll be back in 2 mins

quartz kindle
haughty night
#

Tim Can you check my discord channel dm me

quartz kindle
#

why cant you add it?

grave mist
#

How can they not see the website? Can you send a small example of scripts.js pls

#

Sorry for wasting all your time

#

Googling this won't be of much help than asking to a real person

quartz kindle
#

you cannot hide /getdata

#

you can use either an xmlhttprequest or use fetch

grave mist
#

And thanks for all the help

heavy void
#
2019-12-23T08:49:58.274776+00:00 app[worker.1]:     at Client.<anonymous> (/app/xolo.js:74:11)
2019-12-23T08:49:58.274778+00:00 app[worker.1]:     at Client.emit (events.js:210:5)
2019-12-23T08:49:58.274782+00:00 app[worker.1]:     at GuildMemberRemoveAction.handle (/app/node_modules/discord.js/src/client/actions/GuildMemberRemove.js:20:62)
2019-12-23T08:49:58.274785+00:00 app[worker.1]:     at GuildMemberRemoveHandler.handle (/app/node_modules/discord.js/src/client/websocket/packets/handlers/GuildMemberRemove.js:9:38)``` I'm having this error
#

Here's my code ```let t = member.guild.channels.find(c => c.name.includes("good") || c.name.includes("left") || c.name.includes("leave") || c.name.includes("bye"))

if (t){
var messages = [
***${member.user.tag}*** just left us.,
***${member.user.tag}*** left and jumped in the cliff,
***${member.user.tag}*** left the server and died,
***${member.user.tag}*** will just feed the chickens and he'll come back,
***${member.user.tag}*** went to Pluto,
***${member.user.tag}*** forgot to flush the toilet,
***${member.user.tag}*** has been eaten by a shark,
***${member.user.tag}*** went back to Pre-Cambrian Era,
Goodbye to ***${member.user.tag}***,
We hope you comeback ***${member.user.tag}***,
RIP, ***${member.user.tag}*** left the server
]

    t.send({embed: {
        title: `User left`,
        color: 15158332,
        description: messages[ Math.floor( Math.random() * 11 ) ],
        timestamp: new Date(),
    }
    }); 
}

});```

grave mist
#

Basically, you're doing member.guild.channels.find(c => true || false)

#

Array.includes() return either true or false

late hill
#

That's not the problem

#

guild.channels should be a Collection of GuildChannels

#

a GuildChannel doesn't have a send method

#

So that could be why

grave mist
#

Then which channel has send method uh?

#

ClientChannel?

late hill
#

idk if the collection would include the extensions

#

TextChannel

#

But yeah

grave mist
#

...

late hill
#

Your code should be aware

#

That not all channels that match your find

#

Will be TextChannels

grave mist
#

Ye

#

The problem is finding channels with name true or false

late hill
#

No

#
member.guild.channels.find(c => {
  c.name.includes("good") || c.name.includes("left") || c.name.includes("leave") || c.name.includes("bye")
})```
grave mist
#

Can you explain me what c.name.includes("good") return?

#

You thinking it'll return the name?

late hill
#

true or false

#

the find method

#

requires a function

#

that returns true or false

#

so

#

like

#

ok chief

restive furnace
#

message.guimd.channels(c => c.name === "string") return channels

#

channel*

grave mist
#

Ye

late hill
#

Yeh

#

what do you think c.name === "string" returns

#

๐Ÿง 

#

true or false

#

..

restive furnace
#

true if the channel name is string

#

else false

grave mist
#

You confused 100% or you confused me 100%

late hill
#

You're confused

#

His function is right

#

It's supposed to return true or false

#

Which it does

restive furnace
#
  • on d.js v12 collection#find ONLY accepts function
grave mist
#

Ok yea, I'm confused

#

That was right

quartz kindle
#

the channels collection includes all channels, text, voice, categories, etc... if a voice or category channel passes the find function, it will cause that error

restive furnace
#

you can do c.name === "string" && c.type === "text"

late hill
#

yes

#

could also put the names in an array to make that find function shorter

restive furnace
#

ye if u want to find multiple and see if one of them exists

quartz kindle
#

he can use array.some()

earnest phoenix
#

how to get users by their name?

warm marsh
#

Library?

heavy void
#

What will be the full code @restive furnace

#

member.guild.channels.find(c => c.name.includes("good") || c.name.includes("left") || c.name.includes("leave") || c.name.includes("bye") && c.type === "text") Like this or no

warm marsh
#

You don't need the braces {}

heavy void
#

oh ok

#

It's now fixed thanks

quartz kindle
#

mixing && and || is not a good idea

#

better to separate them like this (something || something) && somethingElse

grizzled raven
#

what i do

#

also because i have anxiety

restive furnace
#

do ur array like let urArray = ["channame1", "channame2"]
msg.guild.channels.find(c => urArray.includes(c.name) && c.type === "text) @heavy void

#

sry spuunfeed

pearl jasper
#

is there a server boost event?

restive furnace
#

I think so

pearl jasper
#

Hmmmmm

#

howw

winged thorn
#

I'd expect it to be part of member update

pearl jasper
#

Ohhh

grizzled raven
#

you could check for when a member gets added the role nitro boosters

earnest phoenix
#

i make my bot wow

pearl jasper
#

2 possible ways

steel tinsel
#

TheNoob27
you could check for when a member gets added the role nitro boosters
i don't think that would work well, since a person can boost a server multiple times and there's no sure way to know which is the booster role (as far as i know)

grizzled raven
#

i said you could

#

never said you should

steel tinsel
#

the discord api docs don't say very much on boosts

#

but i'm sure that either the guild member update or guild update events can help

lusty dew
#

What is even going on

earnest phoenix
#

there's no sure way to know which is the booster role (as far as i know)

the role is managed, all you have to do is search for a manged role named server booster or whatever the role name is

quartz kindle
#

djs master has member.premiumSince

#

stable doesnt

steel tinsel
#

i think i have an idea: listen for the boost system messages and the booster is the message author

earnest phoenix
#

how to get the last user that just boosted the server?

lusty dew
#

I donโ€™t think there currently is a method of doing so

#

You might have to manually track this yourself

quartz kindle
#

you'd have to loop over all members and check each of their premiumSince property

#

with djs master

lusty dew
#

^

#

I was thinking of a more crude way

#

But that way is better

#

Whatโ€™s the ratelimit on looping through all the members in a guild

mossy vine
#

arent they cached by your library anyways

#

so there wouldnt be a ratelimit

compact oriole
#

yea

restive furnace
#

not all of them

compact oriole
#

most of them are cached

restive furnace
#

ye

lusty dew
#

Mmm right

#

Wouldnโ€™t it be smart to loop over all the members then every few days to get the most recent

restive furnace
#

or you could check someway is the member cache, or simply add on start up fetchAllMembers

#

^ the 2nd choice makes ur bot ram & cpu usage bigger

#

^^ and ur bot slower

lusty dew
#

It also is a big no no in some cases

#

Xd

restive furnace
#

d.py does fetch all members even tho you had like 5m members

quartz kindle
#

as moonlight said, you can listen to the boost system message

restive furnace
#

but if the server disabled em

lusty dew
#

D.py probably handles it better xd I was told never to use fetchAllMembers unless I had to as it was api spammy

quartz kindle
#

you can listen to memberUpdate events

lusty dew
#

Also Super has a point

quartz kindle
#

in djs master, memberUpdate should provide updated premiumSince

restive furnace
#

yeah, memberUpdate would be better

restive furnace
#

should this work, for me it doesnt js const filter = m => m.content.startsWith( "2" || "3" || "4" || "5" || "6" || "7" || "8" || "9" || "1" || "10" ); await message.channel .awaitMessages(filter, { max: 1, time: 60000, errors: ["time"] }) .then(collected => console.log(collected.message.content)) .catch(collected => console.log(`After a minute, only ${collected.size} out of 1 voted.`) );

late hill
#

No it shouldn't

warm marsh
#

async and sync code

#

yikes

late hill
#

Your code will resolve "2" || "3" || "4" || "5" || "6" || "7" || "8" || "9" || "1" || "10" and pass the result to startsWith()

#

Which will simply be "2"

restive furnace
#

@warm marsh if i wont use await, then my whole command screws up

late hill
#

๐Ÿ‘€

warm marsh
#

If you use await the .then won't be called

restive furnace
#

@late hill okay, ill try it different way

#

it does?

warm marsh
#

Use regex for it?

restive furnace
#

i use regex for links

warm marsh
#
const filter = m => /^[1-9|10]/.test(m.content);
restive furnace
#

kk

#

this is my output so how i access into content, cuz collected.message.content and collected.content wont work

late hill
#

Because it's a Collection

warm marsh
#

<Collection>#first

glacial mango
#

Could anyone help me with my website?
When I try to store json from it it stores something else

#

ping me pls

warm marsh
#

Show code

abstract crow
#

routes.MapMvcAttributeRoutes();

west raptor
#

hmm

#

is it supposed to take a parameter?

abstract crow
#

No

west raptor
#

what's this for btw

abstract crow
#

If it helps I can click start live share session lol

earnest phoenix
#

what's the problem here

abstract crow
#
System.InvalidOperationException: 'A direct route for an action method cannot use the parameter 'action'. Specify a literal path in place of this parameter to create a route to the action.'
#

Got it. Apparently I can't use the word "action" in a route therefore it was causing an issue

rugged minnow
#

ok quick question, whenever i try to do

message.attachments.url```
the value is null even if i attach an image to the message
west raptor
#

attachments sounds like an array of Attachment