#development

1 messages · Page 1984 of 1

quartz kindle
#

xD

fallen holly
#

huh

earnest phoenix
quartz kindle
#

@fallen holly

earnest phoenix
rose warren
earnest phoenix
#

You could either push your commands to the commands array or I think you can just use the client.commands collection/map

fallen holly
#

yea i was just using client.commands let try just using folder > file

#

insteade of > commands > folder > file

earnest phoenix
#

So it is just using an empty array thus no commands are actually pushed to discord

#

Also tim I might use tiny-discord it looks interesting

quartz kindle
#

good luck

#

i do need testers xD

earnest phoenix
#

Lmao

#

I might bug you about the code it uses internally tho

#

I am interested in how the bot keeps a connection alive

quartz kindle
#

im still planning to add a standalone cache some time

#

but i got sidetracked

earnest phoenix
quartz kindle
#

if theres any specific part you dont understand i can try explaining

earnest phoenix
#

I am mainly looking at the connect method in the Websocket file, I assume that makes the initial connection right?

earnest phoenix
#

I won't lie a lot of it is rather confusing to grasp

#

that is only cause I am not used to using half of what tim is using tho so

quartz kindle
earnest phoenix
#

I don't understand websocketing

quartz kindle
#

the request contains an upgrade header telling the server to upgrade the connection

#

then once the upgrade is established, the raw socket can be used

#

basically

#

you know more or less how http works right?

#

there is headers, then data

earnest phoenix
#

yea

quartz kindle
earnest phoenix
#

hello please gimme socket
yes here's socket
*shake hands*

quartz kindle
#

every single request needs to create a new connection, send a new copy of headers and the data

#

a websocket basically is an agreement with the server to not close the connection, and instead keep using it

#

so both client and server start sending and receiving only the data part

#

without headers

#

without methods

earnest phoenix
#

how does heartbeating work

quartz kindle
#

without any extras

earnest phoenix
#

I see

quartz kindle
earnest phoenix
#

no websockets in general

quartz kindle
#

its up to the server and client to agree

#

its basically just a way to check for inactivity

#

for example both server and client agree that the socket should be closed if there is no activity for X time

#

so if they wish to keep it open, they will periodically send something every X time to prevent it from being closed

#

usually its the client's job to send it to prove its still connected and alive

#

the server will usually just watch for inactivity and close inactive sockets

earnest phoenix
#

So it could be anything?

#

Or do you have to send something specific

quartz kindle
#

it can be anything

#

the websocket protocol defines how the data is organized

#

each message contains a small header identifying what type of message is being sent, how big is it, etc

#

and the protocol includes a "ping" message type

#

which is what is usually used

#

the ping message type may contain optional data

#

but discord doesnt use the ping message type, it uses normal messages

earnest phoenix
#

Ah I see

#

I am trying to figure out where to go from where I am now to reach my end goal

quartz kindle
#

what is your goal?

earnest phoenix
#

Well i've talked to several people about this and i've gotten a lot of good answers but I am still unsure of what to do exactly. My end goal a project I want to do whenever I am ready is to make a platform for people to get exposure and make money for what they do (not disclosing the target audience anymore as I don't trust people not to try and rip my idea)

quartz kindle
#

well, you need a database, a login system, a payment gateway, and the usual stuff

earnest phoenix
#

Yep

#

Security is also a big factor here

quartz kindle
#

security has a lot of factors, you'll need to spend some time on it

earnest phoenix
#

indeed

quartz kindle
#

its not hard to make a secure website, just annoying

earnest phoenix
#

I am just not sure where to start and what to focus on learning first

#

With a project this scale I have a lot to learn

#

especially when I am doing it alone

quartz kindle
#

start with the basics, for example a simple login page

earnest phoenix
#

How do you think I should handle auth?

#

simple email password or?

crimson vapor
#

I think you should handle it securely

earnest phoenix
#

So no storing plaintext passwords?

quartz kindle
#

you can use email and password, or you can use several existing oauths like google facebook etc

earnest phoenix
#

I prefer to not use any existing oauths

#

While it would make my life easier

#

I just don't want it to be a sign in option

quartz kindle
#

for passwords, pick one of argon2, scrypt or bcrypt

earnest phoenix
#

I usually use argon2 but I heard it isn't really good to use

#

they never gave a reason to why tho

quartz kindle
#

it had a couple vulnerabilities found, but has since been updated

earnest phoenix
#

Also how should I handle protecting endpoints?

quartz kindle
#

its currently the recommended one for new projects

earnest phoenix
#

That was my issue when I was making a prototype then I realized I needed to step back and learn a bit more

quartz kindle
#

either use something like an api key, or use sessions

fallen holly
#

my head. hurts now

#

gonna work on it tmmr

earnest phoenix
#

I was planning on using sessions so they have persisting logins without aving to login every single time they visit the site

quartz kindle
#

person logs in, create session, store it in a cookie, check and validate the cookie on every endpoint request

#

you also need to track the sessions in your database

earnest phoenix
#

yea I would use a session store

#

Should I use expressjs you think?

quartz kindle
#

if you want

earnest phoenix
#

I want to try and do smth without nestjs as it holds my hand too much

#

Mmm ima use express then or at least try to without hurting my head

#

Also if I wanted to protect a endpoint i'd have to use middleware right?

quartz kindle
#

its an option

earnest phoenix
#

What other options are there?

#

I thought middleware was the only way to do it

quartz kindle
#

doing it inside the request code for example

earnest phoenix
#

Mmm

#

I would honestly like to find a way to make it so I don't have to keep defining it in every request

#

If I could pass it down to all requests that'd be nice

quartz kindle
#

middlewares are just a way to organize it

earnest phoenix
#

yea

#

If I can somehow make it so I can pass the protection middleware to all the routes in that group e.g users, posts, etc then that would be nice

quartz kindle
#

you can do that with express Routes

earnest phoenix
#

Oh?

quartz kindle
#

check their docs

#

it allows you to define middlewares for specific paths

earnest phoenix
#

oh damn I can use router.use

quartz kindle
#

for exampe different middlewares for /html and /api

#

ye

earnest phoenix
#

That is very nice

quartz kindle
#

welp i g2g sleep, see ya

earnest phoenix
#

Cya thanks for the talk

old cliff
#

whats the difference between proxy url and url of an attachment?

small tangle
#
com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message
    at com.mongodb.internal.connection.InternalStreamConnection.translateReadException(InternalStreamConnection.java:701)
    at com.mongodb.internal.connection.InternalStreamConnection.receiveMessageWithAdditionalTimeout(InternalStreamConnection.java:579)
    at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:415)
    at com.mongodb.internal.connection.InternalStreamConnection.receive(InternalStreamConnection.java:374)
    at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:216)
    at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:152) 
    at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
    at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
    at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
    at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
    at java.base/java.net.Socket$SocketInputStream.read(Socket.java:976)
    at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
    at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
    at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)]
    at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1444)
    at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1048) 
    at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:109)
    at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:131)
    at com.mongodb.internal.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:718)
    at com.mongodb.internal.connection.InternalStreamConnection.receiveMessageWithAdditionalTimeout(InternalStreamConnection.java:576)

so im using MongoDB Atlas as my DB and my bot is running on my raspberry pi and i get these errors randomly and im not quite sure how i should fix these peepoThink because most of the time everything works fine (and after this error it reconnects automatically) but i would like to prevent these errors

dry imp
#

java topggPensive

small tangle
#
final CodecRegistry pojoRegistry = fromProviders(PojoCodecProvider.builder().automatic(true).build());
final CodecRegistry codecRegistry = fromRegistries(MongoClientSettings.getDefaultCodecRegistry(), pojoRegistry);

final MongoClientSettings settings = MongoClientSettings.builder()
                .applyConnectionString(new ConnectionString(Env.get("DB_URI")))
                .codecRegistry(codecRegistry)
                .build();

final MongoClient client = MongoClients.create(settings);
final MongoDatabase db = client.getDatabase(Env.get("DB_NAME"));
``` my connection config is mostly default (the env string only contains retrywrites=true and w=majority)
crystal wigeon
#

is there a way i can send DMs without having to client.login? like can i use the client id directly to make some api call and send dm to a specific user?

boreal iron
#

You will still need a created application but no gateway connection to send a message

#

But as discord states, this endpoint is heavily rate limited especially if you’re opening multiple DMs

crystal wigeon
#

mmm

#

i only need this to send dms when someone votes

#

but if too many people vote at the same time, it'll be a problem ig hmmm

#

any idea on the number of calls to this endpoint per second?

spark flint
#

What are the chances many vote at once

crystal wigeon
#

very slim but still possible

#

well one could argue, i could process the votes but just fail to send dms

#

even if i got rate limited how long will i be blocked? etc wanted to check that

boreal iron
#

Well a queue and timeouts are your solution then waiting between any DM

cinder patio
#

you could put dms in a queue, and send 1 per 30 seconds, for example

boreal iron
crystal wigeon
#

mhm, that works ig, but it would still be helpful if could see the numbers given by discord xd or atleast the requests they expecting

cinder patio
#

you could test it yourself

crystal wigeon
#

so that i can push 5 - 6 dms in 30sec

cinder patio
#

make a bot which spams DMs and see how many DMs you can send before you get ratelimited

crystal wigeon
#

but will i be unblocked after sometime tho?

boreal iron
#

You will get rate limited yeah

#

It should contain the duration until you can use this endpoint again

crystal wigeon
#

got it

#

thanks

sterile olive
#

!p dj slow

#

-p dj slow

spark flint
split hazel
#

@sterile olive why not fast

#

@quartz kindle bro

#

can you resume an interrupted git clone

#

I kinda stopped the chromium clone because it took way too long

#

the object file is still there tho

#

17gb in size

boreal iron
#

How can Tim still sleep after 6h

#

smh

carmine summit
#

anyone here that worked with chart.js before?

split hazel
#

yesss just ask your question

carmine summit
#

bruh no way i asked that question in here i just found the answer in google after searching for 8 hours

lyric mountain
#

try simply doing git pull

earnest phoenix
#

How can I check if it's me (the developer and owner) accessing my chrome extension when it's downloaded?

carmine summit
#

just maybe

#

or mac

#

can mac be even exposed to websites?

neat ingot
#

^chart.js

earnest phoenix
quartz kindle
#

ping pong peng

neat ingot
carmine summit
#

Why is three?

neat ingot
#

because four was scared to go out by himself?

carmine summit
#

Why is thrreeeeee

#

Also why is latency so high

#

100ms average?

neat ingot
#

its running on my pc atm

#

~ latency

#

there are three because ping now, 5 min average, and 15 min average 🙂

carmine summit
#

why not use separate charts for all three?

neat ingot
#

I have over 20 charts worth of datas...

#

i dont need more. i need consolodation.

carmine summit
neat ingot
#

... but im not?

rigid maple
#

Anyove know Svelte ?

carmine summit
neat ingot
#

i dont need to ask for permissions to know how many guilds my bot is in.

rigid maple
#

I'm sending a request to the API to get the data from the back-end. After the data comes, I assign the object to a variable and display it on the front-end but the loading screen should appear until the data comes otherwise I won't be able to get the data from the object and it will return undefined

carmine summit
rigid maple
#

it should show the loading screen before retrieving the data

carmine summit
#

what is happening now?

#

is there no loading screen?

rigid maple
#

Is there a way to check if data is coming?

#

I also have no idea how to show the loading screen until the data comes in.

carmine summit
#

wdym

#

can you show what you already have

rigid maple
#

asd.username is undefined

#

because the site loading before the data arrives

carmine summit
#

what does response log?

#

did you try logging asd?

rigid maple
#

i put it to check if data is coming

carmine summit
#

what does it output?

rigid maple
#

yes i tried it and it gives 2 outputs (strangely) one is undefined and the other is object (asd)

carmine summit
#

which one is undefined

lyric mountain
#

does svelte have something akin to <head>?

#

if so, try fetching the data there

rigid maple
wheat mesa
#

or, when your data comes in, change the visibility of an html element within your js

rigid maple
#

just a second i will run my code and send the output

#

both outputs are output of asd

#

but my code has one console.log(asd)

lyric mountain
#

that's cuz it's acessing the data before you receive the payload

#

async issue

rigid maple
#

yes my aim is to solve this problem

carmine summit
rigid maple
#

but i don't know what i can do

#

Before defining the asd value, the front-end is also trying to enter { asd.username } in the div

carmine summit
#

why do you have a function called post but its main function is to GET?

lyric mountain
rigid maple
#

but its value is undefined because it doesn't equate asd value to object yet

carmine summit
#

try .then()?

rigid maple
#

I forgot to edit it, but I don't think the problem is caused by that. 😁

lyric mountain
#

await is only blocking this

rigid maple
#

yes

#

my aim is to display the loading screen until the asd object is defined

carmine summit
#

ok I think what happens is, when the DOM loads, it gets asd gets consoled. then it will GET, then log response. When asd changed, the div updates, so it is being logged again.

#

you need to set asd to loading.

rigid maple
#

yes here is how i can do that

carmine summit
#

let asd = "Loading..."

#

when the dom loads

rigid maple
#

oh yes that makes a lot of sense

carmine summit
#

or set the div default to be hidden

#

then modify it once the data has arrived

rigid maple
#
  <div>
    { asd.username ? asd.username : "Loading..." }
  </div>
#

can't i use it like this?

lyric mountain
#

asd.username ?: "Loading..."

rigid maple
#

unexpected token xd

lyric mountain
#

elvis isn't supported?

carmine summit
#

dont do anything in the div

#

just try to let asd = "Loading..."

#

on mount

lyric mountain
#

no need for an extra variable tho

#

a ternary will work just as fine in his case

rigid maple
#

asd is not an object, it will return undefined because there is no username value in it.

carmine summit
#

isnt it going to automatically update when variable changed

lyric mountain
carmine summit
#

let asd = { username: "loading"} put this onmount

carmine summit
lyric mountain
#

yes

carmine summit
#

yes? there isnt any loops or anything to check

rigid maple
carmine summit
rigid maple
#

oh

rigid maple
#

thanks

spark flint
#
const axios = require("axios")
const users = ["935943222411292692", "941521375938642013", "935943222411292692", "941521375938642013", "941519376211935245", "941514790625501194", "941524029066579979", "941517557863686154", "941514790625501194", "941522289864896564", "941521677777526814", "798324345638092863", "941519526846156902", "941523682487062579", "941516578938323024", "941524200181620757", "941523525376811068", "941523945369260042", "941524848876871701", "941525837931491329", "941524815955759106", "941525464080609340", "941525998049034311", "941527422690541658", "941524392813400085", "941531113820655616", "941529411361079377", "941525139126902826", "941531654109921330", "941532802959147058", "941474989641695263", "941531610405298236", "941531268129124353", "941531610405298236", "941531550338646107", "941531235019276311", "941532403023884339", "941527739490500688", "941532678983942186", "941534397063135242", "941534373021360148", "941534296139776032", "941535170933170176", "941526712003461130", "941534730040520704", "941535387229257728", "941511860673466398", "941512335380611132", "941511860673466398", "941512446143787069", "941514475926872074", "941512651475918878", "941507798246756403", "941510543783628810", "941512751036125206", "941512014684106825", "941512205789188196", "941509301225279569", "941510109962567701", "941510716064694364", "941516383739584572", "941508015054524436", "941514761802227752", "941509610358054982", "941514269688741950", "941515671718740068", "941512626452713522", "941510061988139089", "941513783262724138", "941510051938566185", "941510963583143946", "941508375513030696", "941510261649600522", "941508964804358174", "941509054633750569", "941507261946265651", "941509023952425001", "941505075015192576", "941504717958307850", "941507513961041942", "941508790728130580"]

users.forEach(async function(user) {
    axios.post(`https://api.blacklister.xyz/add/${user}`, {headers:{Authorization:"api key"}, body:{reason:"Discord phishing scam", "evidence":"https://capy-cdn.xyz/no-evidence.png" }})
})``` why does this give unauthorized but when making the post request myself it works? I replaced api key of course
lyric mountain
tulip ledge
#

The reason that worked is due to the ? Behind the asd which checks if the key exists or not. If it’s a required key I’d suggest doing a check before that so you don’t run into later issues

lyric mountain
#

they basically listen to anything that's visible

tulip ledge
#

@rigid maple

rigid maple
#

?

spark flint
#

its not that

#

its my api

#

and i know there are no rate limits

sacred aurora
rigid maple
carmine summit
sacred aurora
#

Im on mobile and can't test it

#

In axios there's no body

#

its data

carmine summit
rigid maple
#

understood thanks

carmine summit
#

it is like the parameters for a function

sacred aurora
#

Yeah i know

#

But in axios you set it via the data

#

not body

#

@spark flint you solved it yet?

spark flint
#

no

carmine summit
#

@sacred aurora

axios.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
#
axios({
  method: 'post',
  url: '/user/12345',
  data: {
    firstName: 'Fred',
    lastName: 'Flintstone'
  }
});
carmine summit
#

maybe without .post() it requires to be sent as data

carmine summit
# spark flint no

is the authorization string a-z with 0-9 or is there any special chars?

#

cany you also try to set content-type as x-www-form-urlencoded or application/json?

sacred aurora
earnest phoenix
#

also why are you using axios

sacred aurora
spark flint
#

i got it working

sacred aurora
#

okay nice

spark flint
#
const axios = require("axios")
const headers = { Authorization: "apikey" }
const users = ["935943222411292692", "941521375938642013", "935943222411292692", "941521375938642013", "941519376211935245", "941514790625501194", "941524029066579979", "941517557863686154", "941514790625501194", "941522289864896564", "941521677777526814", "798324345638092863", "941519526846156902", "941523682487062579", "941516578938323024", "941524200181620757", "941523525376811068", "941523945369260042", "941524848876871701", "941525837931491329", "941524815955759106", "941525464080609340", "941525998049034311", "941527422690541658", "941524392813400085", "941531113820655616", "941529411361079377", "941525139126902826", "941531654109921330", "941532802959147058", "941474989641695263", "941531610405298236", "941531268129124353", "941531610405298236", "941531550338646107", "941531235019276311", "941532403023884339", "941527739490500688", "941532678983942186", "941534397063135242", "941534373021360148", "941534296139776032", "941535170933170176", "941526712003461130", "941534730040520704", "941535387229257728", "941511860673466398", "941512335380611132", "941511860673466398", "941512446143787069", "941514475926872074", "941512651475918878", "941507798246756403", "941510543783628810", "941512751036125206", "941512014684106825", "941512205789188196", "941509301225279569", "941510109962567701", "941510716064694364", "941516383739584572", "941508015054524436", "941514761802227752", "941509610358054982", "941514269688741950", "941515671718740068", "941512626452713522", "941510061988139089", "941513783262724138", "941510051938566185", "941510963583143946", "941508375513030696", "941510261649600522", "941508964804358174", "941509054633750569", "941507261946265651", "941509023952425001", "941505075015192576", "941504717958307850", "941507513961041942", "941508790728130580"]

users.forEach(async function(user) {
    axios({
      method: 'post',
      url: `https://api.blacklister.xyz/add/${user}`,
      data: {
         reason:"Discord phishing scam",
         evidence:"https://capy-cdn.xyz/no-evidence.png"
      },
      headers:headers
    });
})
pearl trail
#

afaik it must be
axios.post('uri', {body goes here}, {headers: })

carmine summit
#

That doesn't make sense but if it works, it works

sacred aurora
carmine summit
#

Theres nothing changed

sacred aurora
#

wut

#

try see it again

carmine summit
#

I mean the .post disappeared

pearl trail
#

its in the method option

spark flint
sacred aurora
#

aren't you guys see this while code?

#

its basically there

#

you just need to follow it

carmine summit
pearl trail
#

config

sacred aurora
#

in the config

sacred aurora
carmine summit
#

But didn't she removed the .post()?

sacred aurora
#

yeah thats another way to write it

pearl trail
#

there are two ways to make a request

sacred aurora
#

but its just axios(config)

pearl trail
#

axios.post or axios({method: "post"})

sacred aurora
pearl trail
#

it can be get, patch, delete, etc

sacred aurora
#

axios.get, post, delete, head

#

...

pearl trail
#

...

sacred aurora
#

lol

carmine summit
sacred aurora
#

well its up to you

pearl trail
#

both are same ig

carmine summit
#

Then why did she remove .post()???

cinder patio
#

why does it matter it's the same thing regardless

worn sonnet
#
 let desc = ""
      new Promise(function (resolve, reject){
        request.get(`SOME_URL`,
          (error, response, data)=>{
            if(!error && response.statusCode==200){
              // console.log(data)
              data = JSON.parse(data);
              // desc = data.data.article.body.content[1].children.children[0]
              desc = data.data.article.body.content[1].children[0].children[0]
              console.log("Hello WORLD "+desc)
              resolve(desc)
            }
            reject(error)
          }
        )
      })
      // let desc = item.content
      console.log("NO MORE"+ desc)
#

Why does this NO MORE get printed first instead of HELLO WORLD

sudden geyser
#

because promises resolve some time later in the future

#

Would probably be better you wait for it to resolve first and then print that

#

e.g. .then or await

#

Or just moving the console log inside the promise

worn sonnet
#

so await new Promise(function (resolve, reject){

#

like this?

sudden geyser
#

If you can await it, yes.

#

Though, are you using request?

#

Aka that old npm library

worn sonnet
#

is it no good or something?

sudden geyser
#

That library's been deprecated for a while.

#

You could use a newer library, like node-fetch, which has async built-in.

worn sonnet
#

I normally program in python

#

oh I see

#

lemme try it

woeful pike
#

pip install requests -> npm install requests pog

sudden geyser
#

chop off the s

woeful pike
#

chop off the requests

worn sonnet
#

...?

#

what does it do?

#

and I got this error
when using node-fetch

Uncaught Error [ERR_REQUIRE_ESM]: require() of ES Module d:\Upwork\rss-cramer-headlines\node_modules\node-fetch\src\index.js from d:\Upwork\rss-cramer-headlines\index.js not supported.
sudden geyser
#

try using import fetch from "node-fetch"

worn sonnet
#
(node:13628) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Waiting for the debugger to disconnect...
d:\Upwork\rss-cramer-headlines\index.js:4
import fetch from 'node-fetch';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47
#

Here's the full error

sudden geyser
#

that's wack

#

go to your package.json file and try specifying "type": "module"

cinder patio
#

don't bother with node-fetch if your type is not set to module

#
#

with a very similar API

worn sonnet
#

Ah... node sucking me at it's finest just cs I dunno basics of it

cinder patio
#

Also you could use utils.Promisify to make the request function return a promise

#

so u don't have to do it yourself

worn sonnet
#

npm install got same as npm i got ?

cinder patio
#

yes

worn sonnet
cinder patio
#

what's the error?

worn sonnet
#

Error [ERR_REQUIRE_ESM]: require() of ES Module d:\Upwork\rss-cramer-headlines\node_modules\got\dist\source\index.js from d:\Upwork\rss-cramer-headlines\index.js not supported.

#

code: 'ERR_REQUIRE_ESM'

cinder patio
#

...they also switched to ESM

#

welp

worn sonnet
#

can you tell me how can I change this to ESM way?

#

or module way

cinder patio
#

You'll have to set type to "module" like someone said earlier, you'll also have to rename all your .js files to end with .mjs. Honestly just use a lib which doesn't use ESM

#

I can't fathom why all these libraries are making such a breaking change

worn sonnet
#

Currently I get this TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".json" for d:\Upwork\rss-cramer-headlines\information.json

sudden geyser
#

you'll also have to rename all your .js files to end with .mjs
really?

#

that sounds awful

cinder patio
#

Not sure if it's required for ALL files, but files which use import need to have the .mjs extension

#

And I'm guessing also for files which require that file and so on

worn sonnet
#

I want to a JSON file

sudden geyser
#

but wouldn't files requiring mjs files also have to be mjs files

worn sonnet
#

which is information.js

sudden geyser
#

like how using promises goes

lament rock
#

you cant code in a json file

cinder patio
#

ye that's what I said

sudden geyser
#

ah didn't see your followup

worn sonnet
#

var information = require('./information.json');

cinder patio
#

that could be causing the issue?

worn sonnet
lament rock
#

Could I just suggest using centra as an http lib

#

no dep minimal lib

cinder patio
worn sonnet
#
import Discord from 'discord.js'
const bot = new Discord.Client()
import information from './information.json'
import fetch from 'node-fetch'
sudden geyser
#

would've probably been better they stick using request for now

worn sonnet
#

currently this is how it is

cinder patio
#

yeah you can't use import to import json files

lament rock
#

also, fetch is being added to node natively

cinder patio
#

use require

#

or fs.readFileSync

worn sonnet
#

So I get it require cannot be used in modules
and import cannot be used outside modules

#

so I'll just have to use fs.readFileSync as you said to read JSON file

#

right?

cinder patio
#

mhmm. Or just get rid of modules and use another http library which doesn't require ESM

wheat mesa
#

you can import json files

#

import * as config from '../../config.json';

#

and I use fetch with import just fine as well

#

import fetch from 'node-fetch'; seems to work

cinder patio
#

but you can't use it with require

heavy marsh
#

In d.js v13 how can the bot play on a stage channel
As my bot joins but says its playing but it does
Also no errors

lament rock
#

bots aren't allowed to speak in stage channels iirc

slow ibex
#

Kay.. i have an Var that i can only feed with an object in the "ready" event.
So, how the f. can i export this object for use in differend .js files?

#

I tried exporting it.. it stays undefined

lament rock
#

you need a file which only exports an empty object and then assign values to it later.

spark flint
#

how can i check if message author has ban permission etc

spark flint
lament rock
#

weird

spark flint
#

i tested with a simple music bot code, it worked

lament rock
#

Well. They need special perms to speak

heavy marsh
lament rock
heavy marsh
spark flint
lament rock
#

are you using a lib which handles permission mapping? I'm talking about raw api since that's what I use

spark flint
#

ah

#

i'm using discord.js

#

i should probably have specified that KEKW

lament rock
#

msg.member.permissions.has("BAN_MEMBERS") iirc

#

check the docs for GuildMember

slow ibex
#

Okay, i created a module with an empty object called "manager" i also exported it.
Then i loaded it into my ready event.. but i guess.. it doesnt get "saved"?

#

Because outside of the ready event, the object still is empty

spark flint
#

Error: TypeError: message.member.hasPermission is not a function

#

ahh its message.member.permissions.has() now

slow ibex
#

oh ffs.. i guess i wait until discord.js-lavalink gets updated

lament rock
#

?

#

discord.js-lavalink is deprecated. Superseded by lavacord

slow ibex
#

Well.. than i will take it down on April 30.

#

i don't understand anything from that lol

lament rock
#

What's difficult to understand?

slow ibex
#

So.. i use my "lavacordManagerObject.js" for creating the empty object.. required it as a var on the top of my index.js.. so i can export it with all the other Vars/Const/etc
Feeding obj. "manager" in ready.js with data.

#

Something like that

Manager (index.js): {}
Manager (events/ready.js): {"_events":{},"_eventsCount":1,"nodes":{},"players":{},"voiceServers":{},"voiceStates":{},"shards":1,"expecting":{},"user":"1234567890"}
Manager (structures/Queue.js): {}
lament rock
#

and when are you trying to access obj.manager elsewhere? After the ready event?

slow ibex
#

Jup

lament rock
#

Actually. I have a good idea. The token of your bot contains the user ID

#

One sec to figure out how to reverse it

slow ibex
#

Uh.. is there a PHP lib for Discord and Lavalink? lol
Thats a scripting language i really know how to use. xd

lament rock
#

for Discord, yes. For LavaLink? mmmm. idk

slow ibex
#

i think i will get cancelled if i use php for that kind of stuff

lament rock
#

@slow ibex

const userID = Buffer.from(token.split(".")[0], "base64").toString("ascii");
slow ibex
#

😮

#

Gimme a sec

#

or two

lament rock
#

it has been 2 seconds

slow ibex
#

Maybe a few more

#

Okay.. looks good so far

lament rock
slow ibex
#

Yup, this seems to work. Now my ```js
send: (packet) => {
let guild = this.client.guilds.cache.get(packet.d.guild_id);
guild.shard.send({op: packet.op, d: packet.d});
}

Is the only think that makes some problems
lament rock
#

just do guild.shard.send(packet)

slow ibex
#

Still no guild defined

#

And if i remove the whole send thingy.. it cries that this.send is not a function

quartz kindle
#

cant read shard or cant read send?

slow ibex
#

Just ReferenceError: guild is not defined

quartz kindle
#

then its not cached

#

or not logged in

slow ibex
#

i mean.. i call that directly under client.login();

lament rock
#

Just add a check for if (!guild) return

quartz kindle
#

do you wait for the ready event?

lament rock
#

Tim. I need you to review my slimmed down version of your ws shard code

quartz kindle
#

guilds take time to arrive, they wont be there immediatelly after connecting

#

thats what the ready event waits for

lament rock
#

fyi, all of the actual Discord logic is handled elsewhere

slow ibex
#
let { Manager } = require("lavacord");
//var { manager } = require("../lavacordManagerObject");
const manager = new Manager(config.nodes, {
  user: userID,  
  send: (packet) => {
    if(!guild || guild == null) return;
    client.cache.guilds.shard.send(packet)
  }
})

Idk why... but.. i cant catch get.

#

Feels like the Movie "Catch me if you can"

lament rock
#

You had to add the if (!guild) return underneath the definition of guild

#

now its never defined

quartz kindle
#

is client even accessible tjere?

split hazel
#

whats the point

slow ibex
#

But.. i never define guild o.O

lament rock
split hazel
#

stack?

lament rock
#

gateway, rest, cache, bot code

#

memory heap

split hazel
#

oh right

#

interesting

lament rock
#

each part should be separate from another imo so that you can take services offline as necessary

slow ibex
#

infact... its the first time i directly call guild in "index.js"

lament rock
#

now its gone

slow ibex
#

ffs..

spark flint
#

is there an easy way to have an imap server lookup the incoming email address and forward to a specific email?

slow ibex
#
| STACK STRACE:
| TypeError: Cannot read properties of undefined (reading 'guilds')`
lament rock
#

now client is undefined

#

Gotta have access to your client

slow ibex
#

Yup.. the old problem

quartz kindle
#

you will need to show more code

#

where are you defining this entire Manager thing? in what context?

lament rock
#

I told them to do it in the ready event, then they said they needed the ref in other files and when I showed my solution, they didn't understand

slow ibex
#

oh fck

lament rock
#

reset your keys

slow ibex
lament rock
#

personally speaking, I don't think a bot should be your first or one of your first projects in a new language because there are tons of nuances

timber fractal
#

in a js file

#

like require() doesnt work

lament rock
#

require isn't valid in webjs iirc

#

require is a node thing

timber fractal
#

yes so what would i use

lament rock
#

import

timber fractal
#

not valid outside a module

lament rock
#

might need to look at the specification for import in webjs

timber fractal
#

alright

#

thanks

earnest phoenix
#

Hello, could you please tell me how to make a message in which you forgot to specify who you want to bite in embed ?

module.exports.run = async (message, client) => {
  if (message.channel.type == "dm") return;
let member = message.mentions.members.first();
  if (isNaN(member)) return message.reply('You forgot to mention who you want to bite.');

let embed = new Discord.MessageEmbed()
    .setColor(`#303030`)
    .setDescription(`<@${message.author.id}> made a bite ${member}`)
    .setImage(`https://i.imgur.com/Bdf5EKT.gif`)
  message.channel.send(embed);
};```
boreal iron
#

how to make a message in which you forgot to specify who you want to bite in embed

#

W H A T

earnest phoenix
#

I need to do it in the embed

coral sigil
#

You can message.reply with an embed too

earnest phoenix
boreal iron
#

return message.reply({ embeds: [{ description: "You forgot to mention who you want to bite." }] });

#

There you go.

coral sigil
#

yes, just reply with an embed rather than a message

boreal iron
#

An embed with just a description.

coral sigil
#

i wonder what version of discord js they have... message.channel.send(embed);

boreal iron
#

Oh I see

#

Probably v12 yeah

lyric mountain
#

ok, sql time:
let's say I have a record ((1, 2, 3), obligatory to be a record) and want to retrieve all rows where array_agg(x.column) contains all values in said record

boreal iron
#

That wont work then

lyric mountain
#

is there a way to convert a record to array?

boreal iron
#

return message.reply({ description: "You forgot to mention who you want to bite." }); // djs v12

earnest phoenix
#

Okay thanks, I'll give it a try.

boreal iron
#

Or with a specific color... { color: 0xff0000, description: "You forgot to mention who you want to bite." }

earnest phoenix
#

Neither the first nor the second option works

boreal iron
#

It should... on which djs version are you?

earnest phoenix
#

12.5.3

#

js

coral sigil
#

could you send your current code with the addition fake gave you?

boreal iron
#

Ah I see I forgot something

#

Looks like I didn't remember the old syntax correctly

#

return message.reply({ embed: { color: 0xff0000, description: "You forgot to mention who you want to bite." } });

#

There we go

earnest phoenix
#
module.exports.run = async (message, client) => {
  if (message.channel.type == "dm") return;
let member = message.mentions.members.first();
if (isNaN(member)) return message.reply({ embed: { color: 0xff0000, description: "You forgot to mention who you want to bite." } });

let embed = new Discord.MessageEmbed()
    .setColor(`#303030`)
    .setDescription(`<@${message.author.id}> made a bite ${member}`)
    .setImage(`https://i.imgur.com/Bdf5EKT.gif`)
  message.channel.send(embed);
};
#

Is that correct?

coral sigil
#

should be

boreal iron
#

that should work, yeah

earnest phoenix
#

Let's hope for the best

coral sigil
#

how did you reply with multiple embeds in djs v12?

#

is that even possible

boreal iron
#

by separating the options

#

with a comma

earnest phoenix
boreal iron
#

But I'm not sure tbh

earnest phoenix
#

Yes it works thank you very much

boreal iron
#

np

#

my gosh, look at the horrible embed padding

#

Discord fucked it up once again

coral sigil
#

it doesn't like desc only

boreal iron
#

Since a few weeks, it did before

earnest phoenix
#

Is it worth upgrading to version 13 of js?

boreal iron
#

You will have to anyways

lament rock
#

@quartz kindle did you notice any issues btw

coral sigil
earnest phoenix
boreal iron
#

They fucked up the padding for description embeds only for some reason, it was okay like 1 month ago

coral sigil
#

:D

boreal iron
#

I noticed my self, too a few days ago

boreal iron
earnest phoenix
coral sigil
#

how does the api versioning work with djs, for example does v12 use some older version of the api or does all versions of djs start to use the latest api version?

austere surge
#

i think 12 uses api v6 or someting

boreal iron
#

I dont think it does automatically use the latest API version, that would cause things to break they can't fix within their version

austere surge
#

^

coral sigil
#

well what is the point then to start creating a bot with an old discordjs version

boreal iron
#

There's no point anymore as older API versions will be shutdown soon anyways

coral sigil
#

yea

lament rock
#

v7/6 will be decommissioned and will no longer work. v8 and v9 will work for the time being, but they'll both be deprecated

#

funny because v9 didn't come out too long ago

earnest phoenix
#

@boreal iron Where to get more colors with this designation 0xff0000, I just use a color with # and it is different

quartz kindle
#

v10 will become the default version after the april deadline i believe

woeful pike
#

man mvc pattern is so much typing

#

I've been writing code the entire day and I'm barely 20% migrated from all the stuff the library I was using autogenerated for me

boreal iron
#

You should see the pattern freerealestate

earnest phoenix
#

🙂

coral sigil
neat ingot
#

wait, so a new version of discord js will be coming soon?!

boreal iron
#

anything will change, you gotta change your entire code soon

neat ingot
boreal iron
#

I mean regarding their package v14 is in development

neat ingot
#

I havent even finished updating my junk to v13 😦

boreal iron
#

You don't have to finish it

#

You can go on updating it to v14 then :D

neat ingot
#

lol yea i may have to

boreal iron
#

Doubt there will be many breaking changes compared to v13... but I literally got no clue

neat ingot
#

hopefully nothing too crazy

boreal iron
#

If I'm not wrong you can check their github

neat ingot
#

I have enough of my own code to be sifting through though 😛

boreal iron
earnest phoenix
#

are js { hello } js {hello} js {hello } ```js
{ hello}

boreal iron
#

Yes and non of it is a valid object

neat ingot
#
const hello = "hi";
console.log({[hello]:hello})
#

cause why not.

lyric mountain
split hazel
#

mogus

cinder patio
boreal iron
#

hax

#

how dare you to blame me

earnest phoenix
boreal iron
#

very suspicious

split hazel
#

@boreal iron @quartz kindle speedyos board meeting

#

so uh

#

how would i implement streams lmao

quartz kindle
#

events

split hazel
#

i want to implement something similar to the linux virtual file system with the /dev/xyz

split hazel
#

how does linux do it

#

but i will do it through events if i have to

quartz kindle
#

well

split hazel
#

something like cat /dev/random

quartz kindle
#

on a low level, streams are probably made with a circular buffer

rough current
#

If I host my bot on github -> heroku can I use json files and modify them for economy commands?

quartz kindle
#

the writer writes at whatever speed it can until the buffer is full

#

the reader reads at whatever speed it can until the buffer is empty

quartz kindle
rough current
#

ty

azure lark
#

how do i make my bot join a voice channel and play a youtube videos audio with djs?

boreal iron
split hazel
quartz kindle
#

theres 2 pointers in a circular buffer

#

one tells you what has been written, the other what has been read

#

its this thing i showed you before

split hazel
#

I see that's interesting

#

the bit that probably writes to the circular buffer would have to be a process since it would have to stop and wait for the reader to read

round cove
#

mutex

quartz kindle
#

streams are usually IO anyway

#

between two processes

#

if you want a stream inside the same process, just use events

earnest phoenix
#

can I?

#

finally stopped being lazy and made a event handler

heavy marsh
#

in d.js v13 is it not possible to set the voice volume and bit rate?

connection.subscribe(player, { volume: 1, bitrate: 64000 });
split hazel
#

@quartz kindle so streams are kinda only for data where:

  • you might only want a certain chunk of data or want to do something one by one without having the whole thing
  • you want the data upfront no matter if its complete or not
  • you dont know the total size of the data upfront
  • theres an infinite stream of data and you only take what you want
#

for small data like a struct perhaps (information about a process) you could really just return a pointer to a chunk of memory containing that data couldnt you

#

i mean you could do that for everything in my os since there is no network or disk io

quartz kindle
#

pretty much

earnest phoenix
#

Can I add data to users profile in mongo later with the schema?

#

I don't want to add all at once (a 50% of things aren't added in the bot anyways)

earnest phoenix
#

oh

#

then it can update all the profiles available in the bot?

heavy marsh
#

Yes but make sure you handle errors

earnest phoenix
#

ok

#

tysm

heavy marsh
#

no worrires

earnest phoenix
#

I will be here in some time when I add the rest of the things and need help updating profiles, moved to mongo yesterday

#
MongoParseError: option usefindandmodify is not supported
    at parseOptions (/home/runner/Clash-Chest/node_modules/mongoose/node_modules/mongodb/lib/connection_string.js:289:15)
    at new MongoClient (/home/runner/Clash-Chest/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js:62:63)
    at /home/runner/Clash-Chest/node_modules/mongoose/lib/connec
#

why?

round cove
#

Probably deprecated.

azure lark
#

how do i use ytdl-core and djs to make my bot play a youtube videos audio?

earnest phoenix
earnest phoenix
#

Can I push items in mongodb?

spark flint
#
root@mail:~# node app.js
/root/node_modules/sender-rewriting-scheme/dist/srs.js:20
            throw new TypeError('Missing secret');
            ^

TypeError: Missing secret
    at new SRS (/root/node_modules/sender-rewriting-scheme/dist/srs.js:20:19)
    at new ForwardEmail (/root/index.js:389:16)
    at Object.<anonymous> (/root/app.js:5:13)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Node.js v17.5.0```
eternal osprey
#

hey, how do i get all the user who reacted to a message, without the reactionevent?

#

Might be possible using fetchmessages? I in fact only will need the emoji, and who reacted to that emoji

lament rock
fallen holly
#

it's saying client.on is not a function

    name: 'interactionCreate',
    async execute(client) {
        client.on('interactionCreate', async interaction =>{
            if(!interaction.isCommand()) return;
            const command = client.commands.get(interaction.commandName);

            if(!command) return;

            try{
                await command.execute(interaction);

            }catch(err){
                if(err) console.error(err);
                await interaction.reply({
                    content: 'an err',
                    ephemeral: true
                })
            }
        })
    }
}
earnest phoenix
#

to get a new joined member's id was member.id?

#

inside GuildMemberAdd event

lament rock
#

Yup

earnest phoenix
#

ok

fallen holly
split hazel
#

yo guys so what is a good server side rendering react framework that isnt nextjs

#

because nextjs has a stupid thing where the session arent long lived

#

so you constantly have to reconnect your db and write your code in a way that it expects restarts

boreal iron
marble juniper
#

Although its not mainly meant for react

#

And I never used it but I heard its good

#

just so you know its all gonna be server side only

#

so you can't mix client side and server side like in nextjs

split hazel
#

react isn't a strict requirement for me lol

split hazel
#

can you like write code to submit form data?

marble juniper
#

Idk

split hazel
#

lmao

#

you probably can

#

otherwise it wouldn't be a good framework

sudden geyser
#

just so you know its all gonna be server side only
so you can't mix client side and server side like in nextjs
not to sound rude, but how is that different from a traditional web server?

split hazel
#

they meant as in how you can mix client and server side code in nextjs

#

and it kind of just works

#

it's very buggy

#

you can accidentally import server side libs to the client just by not using a library

lament rock
#

wtf

marble juniper
#

Here is a video of it

#

If you wanna know more

vivid fulcrum
#

why is node so oversaturated with overcomplicated web libs

split hazel
#

🔥🚢

split hazel
#

but ima try remix

lyric mountain
round cove
lyric mountain
#

compared to maven universal repo

#

it looks like a breeze

sudden geyser
#

watched a bit of the video. looks interesting, though I personally don't like the idea of using a file structure as a router

split hazel
marble juniper
#

Like I said I never used remix lol

#

Anyways gn

sudden geyser
split hazel
#

yeah nvm its my dns server

#

idk why but on my arch installation the dns is always fucked up

#

it says a website doesnt exist when it does or loads forever on some websites

spark flint
#

docker run -p 3000:3000 --env EENGINE_REDIS="redis://:THISISAVERYSECUREPASSWORD@localhost:6379/0" andris9/emailengine:v2

#

why idn't that working

marble juniper
sudden geyser
#

That's true of every most framework though.

split hazel
sudden geyser
#

Speedy I think you're being a bit too rude

split hazel
#

are you being sarcastic

#

i hope so

sudden geyser
#

No

split hazel
#

why

sudden geyser
#

Feels like you're laughing at link to put them down

split hazel
#

no?

#

that was more of a headless statement

#

its true in general

#

most new frameworks try to solve different things in different ways

sudden geyser
#

It's less about the statement and more how the response is perceived

#

That's just what I think

split hazel
#

uh im not going to consciously try to soften my responses just because it may offend someone

#

if you're not happy you can always ignore me

sudden geyser
#

Softening does not require laughing in one's face

#

On the subject of solving problems, I was considering learning Svelte more recently after watching a video on multi-page apps vs. single page apps. Did some tutorials, then realized it was very similar to existing solutions in other ecosystems

split hazel
#

you obviously do not understand my sentiment but okay i dont want to talk anymore about this

#

anyways ima try remix

boreal iron
#

Choose PHP, it will solve all your issues Sir

sudden geyser
#

I think JS is having this round trip moment where libraries try to solve simple problems in the most "fabulous, fantastic" forms, which points people away from the fundamental problem.

split hazel
#

thats why i dont like the ecosystem

#

it becomes very saturated and gives you many decisions

#

good thing in essence but too many simple decisions

#

i think someone explained in a video i watched it leads to decision fatigue

sudden geyser
#

I'd argue it actually gives you less choices.

#

Since you have to adopt some framework's system and have no flexibility to choose other things.

#

i.e. coupling

vivid fulcrum
split hazel
#

php is the key to everything why use all the modern and flashy frameworks

#

when you have something thats been reliable for decades

#

what do you mean you dont like the syntax? its beautiful

crimson vapor
#

Actually have scheduled therapy? Must be nice having someone to talk to

split hazel
#

i just talk to my body pillow

#

my arch linux body pillow

#

it understands

crimson vapor
#

yeah but that doesn’t help for everything

split hazel
#

what more do you need

crimson vapor
#

A response

boreal iron
#

And with v8 pretty much state of the art

split hazel
#

body pillow:

warm cuddles tickYes
beautiful tickYes
available 24/7 tickYes
cost: one time investment
can sleep on tickYes
shoulder to cry on tickYes

therapist:

warm cuddles topggDotOrange depends
beautifultopggDotOrange depends
available 24/7 tickNo
cost: hefty recurring fee
can sleep on tickNo
shoulder to cry on tickNo tears do not get absorbed by skin

#

and yes i did just spend 3 minutes writing that

boreal iron
#

lmao

#

All my efforts to get you into PHP…

#

I think we need a group exorcism in this channel

#

As we now know a therapy doesn’t help, too - thx for that cry freerealestate

split hazel
#

@marble juniper i think remix suffers from the same issue as nextjs unless im doing something wrong

#

data does not persist between sessions

#

or at least not reliably

woeful pike
spark flint
#

oh

#

well

#

i gave up (like usual) and moved to wildduck instead

woeful pike
#

if you want to run multiple containers like that in the future the correct way to do that is by connecting the containers with a docker network and referring to the other containers on the network by their name instead of localhost

spark flint
#

idk how docker works so i was relying on the email server docs

woeful pike
#

if you host a lot of infrastructure stuff you might wanna look into something like saltstack or ansible btw

#

so your deploys are reproducible and run with a single command

quaint rampart
#

anyone know if its possible

#

to

#

make a batch-like javascript app

#

like

#

with pop ups saying for example choose 1 or 2 to go to (whatever) or (whatever)

boreal iron
#

Wut?

#

You’re speaking about a formular?

lyric mountain
#

Or was it just me who always started with libraryless CLIs when starting a lang?

#

In university we made so many "press X to do Y"-kind projects

quaint rampart
lyric mountain
#

Just do it normally, using stdin and stdout

#

How u access those on js is a different story

quaint rampart
#

yeah i can get the input my thing is how should i handle what gets displayed

#

should i just do a check for the input

#

if input === 1 do whatever
else if input === 2 do whatever

lyric mountain
#

Just how you'd do with a bot

#

Bots are CLI applications

quaint rampart
#

i see

lyric mountain
#

Except they are interacted with on a third-party site

#

You'd do exactly the same but interacting on ur pc

earnest phoenix
#

I made it so that my bot sends a message when it joins a new server, but realized it won't send the message if the channel perms disable it from sending messages.

#

I thought "SEND MESSAGES" permission would override it

#

What permission apart from ADMIN would fix this?

crimson vapor
#

just check perms

#

of the channel

#

using permissions override

lyric mountain
boreal iron
#

What a bad practice to send a message in a random channel

#

I would respond with some instructions when somebody run a command the first time or if someone mentioned the bot the first time

#

Of course in the channel it happened

fallen holly
#

it's saying client.on is not a function

    name: 'interactionCreate',
    async execute(client) {
        client.on('interactionCreate', async interaction =>{
            if(!interaction.isCommand()) return;
            const command = client.commands.get(interaction.commandName);

            if(!command) return;

            try{
                await command.execute(interaction);

            }catch(err){
                if(err) console.error(err);
                await interaction.reply({
                    content: 'an err',
                    ephemeral: true
                })
            }
        })
    }
}```
#

and it is in event handler

boreal iron
#

Show how import that module

fallen holly
#

eventEvent Handler

#

my messsageEvent works fine it's just that

boreal iron
#

Oh no that gets complicated on mobile

lyric mountain
#

first parameter isn't client

#

it's ...args

#

so inside that export what ur getting isn't a client but an arbitrary amount of args

boreal iron
#

Not only that

#

He’s already creating the event listener and tries to create another one inside its execute method

fallen holly
boreal iron
#

client.on(event.name, (...args) => event.execute(...args, client, Discord));

#

That already creates the event listener

#

You execute method includes another creation of the same event

#

It includes another client.on("event"…)

lyric mountain
#

ye you're supposed to respect the full signature

#

that's one of the 412749 reasons I find js weird

#

it doesn't enforce declared signatures

fallen holly
boreal iron
#

No

wheat mesa
#

client.once is for events that are only fired once per time you run the program

boreal iron
#

You don’t change the event handler but your event file

#

Removing the line completely

fallen holly
#

putted this in my interactionCreate and it's not console logging

module.exports = {
  name: "interactionCreate",
  async execute(client) {
    client.on("ready", async () => {
      console.log(`${client.user.tag} is Online`);
      // await mongoes.connect(config.MONGO_URL ,{
      //   keepAlive: true
      // })
    });
  },
};
wheat mesa
#

Oh dear god

#

Please never, ever, ever, ever, EVER create an event listener inside another event listener like this

fallen holly
#

aight

lyric mountain
#

you want a stackoverflow? because that's how you get a stackoverflow

boreal iron
wheat mesa
#

That’s just memory leak city

fallen holly
#

i did

boreal iron
#

As I explained above

#

The file (code) you shared in pastebin above

#

Errr sourcebin I mean

boreal iron
#

Remove the event listener from your event file

fallen holly
#

aight

boreal iron
#

What you’re doing when calling your execute method is:

client.on("interactionCreate", (args) => { client.on("same event", (args) => …

#

If that’s done you need to get your arguments in the right order

#

Ok great my screen is dying

#

Great… back to a different phone as my screen died

split hazel
#

remixjs is my new favourite

#

its awesome

lyric mountain
#

make the error get angrier for each successive retry

split hazel
#

thats either server side error generation or a state hook where you keep track of the amount of errors

#

anyways its 3am goodbye

lyric mountain
#

by

boreal iron
#

Not sure whats happening to my screen but it doesnt look about right

lyric mountain
#

you mean that weird gradient on the top?

boreal iron
#

Lemme try to

lyric mountain
#

that looks like a broken crystal

boreal iron
lyric mountain
#

note how the top right is excessively bright

#

ye, broken crystal probably

#

(and display)

boreal iron
#

That was yesterday

#

Didn’t really think about it

#

Thought it would be a software issue

split hazel
#

if it makes you feel better my lcd pixels on my phone are starting to burn in

boreal iron
#

Turns out it isn’t topggSob

split hazel
#

if you stay on something bright for like a minute or so it becomes visible after you get out of it for like 2-3 minutes

#

I prefer amoled displays

#

the true black is so mesmerising

lyric mountain
#

amoled, cathode rays and idkled are prone to burn-ins

boreal iron
#

Anyways seems like I should backup and transfer my data soon

lyric mountain
#

just change ur display

boreal iron
#

Before it goes black forever

lyric mountain
#

unless it's iphone

#

then ur egged

boreal iron
#

Not really hard to change an iPhone display but impossible to save my data when it goes black in cases unexpected things happen KEKW

#

Fuck this, gonna buy a Nokia 3310 again

#

lol there must be more wrong with the phone

split hazel
boreal iron
#

Different app settings have been reset completely

#

Oh no

lyric mountain
#

that's a virus in ur screen

sudden geyser
#

has it gone black yet

boreal iron
#

I think this thing may have a short

lyric mountain
#

oh true

#

that might pop some display leds

#

and explains random data wipes

boreal iron
#

ffs

lyric mountain
#

best is to shutdown ur phone and take it to technical assitance

boreal iron
#

Best is to make a backup real quick

#

Then throw it away

lyric mountain
#

r/FirstWorldIssues

boreal iron
#

Well let’s hope it lasts for a few more hours until I’m done sleeping

#

Aye

#

See ya

#

my gosh English is also broken

green pebble
#

is this or smthg similar to this possible?

#

(for custom css i mean)

boreal iron
#

That’s no valid way how to include a css file

#

Remove the style tags

#

The link tag has to be a children of the head not of a style element

#

Also I’m not sure if that will work anyway

#

Guess you will have to find out after fixing your html syntax

green pebble
#

like this?

#

iirc you can use @bleak crane in topgg soo.. ig this shld work

boreal iron
#

The CSS file never contains the style elements

#

You told your html site already the included file is some CSS

#

you gotta use style tags only if you wanna write some css code directly into your html code without importing a style sheet file

neat ingot
#

does discord js, or discord api in general, have or recommend some way of generating a snowflake like id for things?

boreal iron
#

djs has a snowflake util

#

To generate snowflakes

neat ingot
#

oh hey dang thats awesome, ty ❤️

neat ingot
#

yea im reading up on it now ❤️

#

that 'times out' the member...

#

is that like, muting them for x duration?

boreal iron
#

It disables any possible action the member can have in the guild

#

Writing, joining channels, reacts etc

neat ingot
#

so like a more powerful mute 😄

boreal iron
#

Yeah

#

Without the need to overwrite permissions

neat ingot
#

you think it should replace a mute command entirely, or work alongside it to act as a more powerful mute?

boreal iron
#

Idk that’s up to you

#

It’s indeed more powerful

neat ingot
#

yea ill just implement both. upto the user if they want to setup a mute like role etc

boreal iron
#

The member can literally do nothing like if he got kicked

neat ingot
#

lol, savage

neat ingot
#

hey, thats pretty dope.

austere surge
#

yes

neat ingot
#

rip mute command 😂

boreal iron
#

Hmm not all discord features are terrible

neat ingot
#

I'm so confused as to how the {limit:10} option actually works for fetching channel messages when it isnt used?

#

or wait... its passing the {limit:10} as the message object?

#

ahhhh ok ok i see now. im dumb. leave me alone its 7am and i havent slept 😂

boreal iron
#

You’re basically passing objects as arguments anywhere in v13

#

Makes way more sense imo

bright hornet
#

why findOneAndDelete is not working?

boreal iron
#

I mean the past was a desaster, you could pass a string here, an array there, sometimes both etc.
Not really intuitive

boreal iron
#

How about some context, code and errors if you ask a question?

dry imp
#

Why Fake exists?

boreal iron
#

To give you the possibility to ask this question

#

And to save the world

#

And to keep up the local economy

#

And so on

bright hornet
#

The guildID and LogID should be deleted after executing the command

#

Okay i found the real error so yea

#

I'll try to fix this to myself

#

XD

#
DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `useFindAndModify````
dry imp
#

deprecated

bright hornet
#

yep that's why its not working, i fixed it thanks