#development

1 messages ยท Page 996 of 1

earnest phoenix
#

^

quartz kindle
#

await client.users.fetch(userID)

#

fetch doesnt need cache

earnest phoenix
#

to get the owner of this server you have to fetch the owner's id (example)

#

because it's uncached

honest perch
#

so i figured out how to get a guilds id in eris but how do i get the name

#

on message

golden condor
#

@honest perch you need to fetch the guild

honest perch
#

could you provide me with the section of the docs

quartz kindle
honest perch
#

that also works lmao

#

thanks tim

golden condor
#

Oh you can do that?

quartz kindle
#

yes you can lol

#

why wouldnt you?

honest perch
#

eris seems pretty nice

earnest phoenix
#

bruh eris seems easy

golden condor
#

I didn't realise

#

I thought you had to do client.guilds.get(message.guildID)

quartz kindle
#

follow the objects chain :3

#

wtf lol

misty sigil
golden condor
#

Idek

misty sigil
#

why if i copy paste ![BOT](https://cdn.discordapp.com/emojis/629030492838166538.webp?size=128 "BOT") into my code it not show that emoji

honest perch
golden condor
#

There is no embed constructor

#

You have to use .createMessage({embed:{title, description etc.})

quartz kindle
#

@misty sigil is your bot in the same server as the emoji is from?

misty sigil
#

no

golden condor
#

But you can get external packages for it

quartz kindle
#

then thats why

misty sigil
#

:p

honest perch
#

would msg.channel.guild.iconURL also work

#

ah it does

quartz kindle
#

msg.channel gives you the full channel object

#

which in turn channel.guild gives you the full guild object

#

so yes, you can access all guild properties from it

honest perch
#

thanks tim

pure lion
#

Is there a way I can create a webhook from my bot?

#

Nvm found it

pure lion
#

Okay how do I create the webhook then make it send a message?

#

The guide is unclear

hollow void
#

TypeError: discord.client is not a constructor what dose this mean

opal plank
#

that its not a constructor

pure lion
#

^

opal plank
#

which lang you using?

#

guessing js

hollow void
#

Visual studio code

opal plank
pure lion
#

OMG

hollow void
#

i followed this but i got stuck right at the end

opal plank
#

someone take this one

#

im out

pure lion
#

LMAOOOO

#

IM DEAD

#

I CANT

hollow void
#

u are not very help full

pure lion
#

IM OUT TOO

earnest phoenix
#

how much should ppl wait for the bot to get accepted

pure lion
#

2-3 weeks, please ask in #support in future

earnest phoenix
#

:0 so someone here gonna try my bot b4 it get accepted?

idle mountain
#

y'all, don't be rude to beginners

#

we all have to start somewhere

#

at least try to direct them to somewhere that will help

pure lion
#

:0 so someone here gonna try my bot b4 it get accepted?
Yeah

#

@hollow void please learn the basics of js

steep garnet
#

yeah.

#

there's a documentation.

#

๐Ÿ‘

pure lion
#

Visual studio code is not a language.

steep garnet
#

lol.

opal plank
#

y'all, don't be rude to beginners
its not a matter of being rude to begginers, im simply leaving this to someone. The least you should expect for a bot is learning a programming language, you are trying an intermediate level difficulty project without even knowing what a programming language is. I left my sarcastic comments for myself, i simply left /shrug

#

@idle mountain

steep garnet
#

anyway.

#

@opal plank, after learning promises.

#

now the error says translate.getText isn't a constructor.

earnest phoenix
#

@pure lion how to get bot dev role?

pure lion
#

Get verified

earnest phoenix
#

where

idle mountain
#

@earnest phoenix you'll get it automatically when your bot is accepted

pure lion
#

^

earnest phoenix
#

:0

pure lion
#

*inhales loudly*

earnest phoenix
#

does top.gg belong discord? like did discord made it

idle mountain
#

this is for programming help

pure lion
earnest phoenix
#

whats ur bots name?

pure lion
#

Did you not re-

#

Okay I'm gonna go and make a webhook command brb

steep garnet
#

lmao.

idle mountain
#

@earnest phoenix #general for general talk

#

this channel is for programming help

earnest phoenix
#

okay

steep garnet
#

ah sh, he's disconnected.

#

ohh well.

pure lion
#

Hey, why not use

#

Uh

#

Wait

opal plank
#

are you passing translate?

pure lion
#

@vitalets/google-translate-api

opal plank
#

also getText is a method, it requires params

steep garnet
#

it has param.

opal plank
#

send snippet here

#

lazy to type it out

steep garnet
#

lmao.

#
      const translatedMessage = new translate.getText(textToTranslate,{to: langToTranslation});
        const myMessage = function() {
          translatedMessage
            .then(function(text) {
              console.log(text)
            })
            .catch(function(error) {
              console.log(error)
            })
        }
#

oh well, that's the code.

opal plank
#

ok hold your tits right there

#

where is textToTranslate and langToTranslation?

#

well eitherway

#

the only problem on ur snippet is new

#
      const translatedMessage = translate.getText(textToTranslate,{to: langToTranslation});
        const myMessage = function() {
          translatedMessage
            .then(function(text) {
              console.log(text)
            })
            .catch(function(error) {
              console.log(error)
            })
        }
#

problem is, its still spaguetti

#

trying to rearrenge it

#

@steep garnet js async function myMessage(textToTranslate, langToTranslation) { await translate .getText(textToTranslate, { to: langToTranslation }) .catch((err) => console.log(err)); } myMessage(/* your params here */)

#

major problems on your code.
new is requiring a constructor.
function inside functions
unecessary constants
functions just to log console, just do console.log(this)
.then calls the promise right away, i told you yesterday to learn promises before doing calls like that

steep garnet
#

:(

#

ah yes, "BAD_REQUEST".

#

anywayyy, i think i'll learn more stuff before jumping into real stuff.

pure lion
#

Does anyone know how to create a webhook and then make it send a message?

steep garnet
#

i think i actually didn't applied something i always say "don't try to fly when you don't know how to walk".

pure lion
#

(from the bot)

hardy vector
#

https://hastebin.com/wagexamumu.js
(node:7964) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a constructor
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:21)

warm marsh
#

Have you checked the docs Dice?

hardy vector
#

pls help

pure lion
#

@steep garnet you flew, but you'll get higher every time

#

Have you checked the docs Dice?
@warm marsh the docs are hard to read

warm marsh
#

๐Ÿค”

steep garnet
#

@steep garnet you flew, but you'll get higher every time
@pure lion ah well, i just need to learn more stuff.

warm marsh
pure lion
#

But thats fetch, i wanna create too

warm marsh
#

There is both.

#

I sent two links.

pure lion
#

O shit

#

Ty

opal plank
#

to put it simply @steep garnet , translate does a call, though you are running it sequentially. Imagine this , on the example you gave above, even with new fixed, what would end up happening is that it would call translate.getText (this is a promise) and would immediately try to run .then without waiting for the promise. Basically it returns {promise:pending} not the actual result of the promise. then it would try to console.log({promise:pending} and error. Thats why you await promises to make sure they are fullfilled before the code continues

steep garnet
#

ohhhhhhhhh.

#

nice, sorry i have a rlly smol brain.

opal plank
#

we all start somewhere, dont worry, but please check mozilla or a js tutorial on promises,callbacks and sync/async stuff, its some of the most important fundamentals of js

steep garnet
#

ok, ty.

hardy vector
#

https://hastebin.com/wagexamumu.js
(node:7964) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a constructor
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:21)

slim heart
#

what's the easiest way to distribute something to 10% of guilds similar to how discord does it? ik they use some sort of equation on the guild id but what is it?

opal plank
#

wait what?

#

not sure i get your question, but if you want 10% of something, just do 2 functions. One returns guilds.cache.size and divide by 10, you'll now get the number of guilds you need to randomly generate to get 10% of total population. Next one runs a random picker on the guilds you are in picking the n number of guilds you got from before @slim heart

#

ยฏ_(ใƒ„)_/ยฏ

#

not sure i get what you are trying to do, can only get that much from the little info you gave

slim heart
#

i'm not talking about id arithmetic not like dividing it and doing it through stored guilds

opal plank
#

then?

quartz kindle
#

you could do something like id % 10 === 0 lol

opal plank
#

lmao

slim heart
#

mm okay i'll see how that works and if not i might just distribute on one cluster

opal plank
#

if (math.random() > 0.10) 300iq

clever garnet
#

guild.channels.create('test')
what do i do to send a message in it

im using discord.js

hasty lotus
#

hey, what is the permission for read messages ? (in djs v12, i tried READ_MESSAGES but doesnt look working :/)

#

guild.channels.create('test')
what do i do to send a message in it

im using discord.js
@clever garnet you can use an await

opal plank
#

its exactly that

#

READ_MESSAGES

clever garnet
#

@hasty lotus i have exactly no idea how to use await xd

misty sigil
#

i just do not understand this use id for grabbing user id

hasty lotus
#

like

let channel = await guild.channel.create("name")
channel.send("message")```
#

but to do this you have to be in an async function

#

at the begging

#

when you put your options

#

you must set async juste befor the options

opal plank
#

....?

#

options?

hasty lotus
#

like

client.on("message", **async** message => {
//code
})```
#

params

#

sry

opal plank
#

there we go

hasty lotus
#

not verry good english speaker

#

:/

opal plank
#

or simply make it an async function

#

ยฏ_(ใƒ„)_/ยฏ

misty sigil
#

how do i grab user object from id (or just the avatarurl)

hasty lotus
#

yep

#
client.users.cache.get("ID")```
quartz kindle
#

from cache or?

hasty lotus
#

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

opal plank
#
async function newChannel() {
let channel = await guild.channel.create("name")
channel.send("message")

}```
misty sigil
#

idk, probably not cached

hasty lotus
#
async function newChannel() {
let channel = await guild.channel.create("name")
channel.send("message")

}```

@opal plank also works ๐Ÿ™‚

quartz kindle
#

so fetch

misty sigil
#

it wouldn't be cached

clever garnet
#

@opal plank how

quartz kindle
#

await client.users.fetch(id)

opal plank
#

we basically spoonfed you the code my dude

hasty lotus
#

READ_MESSAGES
@opal plank i tried it didn't set the permission

opal plank
#

setting permissions?

hasty lotus
#

i've set SEND_MESSAGES and READ_MESSAGES both to false

#

overwrite

#

in a channel

opal plank
#

for channel?

#

figured, lemme fetch docs, one sec

hasty lotus
#

and it worked for SEND

#

but not read

#

:/

#

ok np

misty sigil
#

@quartz kindle I've tried that but
(node:32244) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'avatarURL' of undefined

quartz kindle
#

did you await it first?

hasty lotus
#

what version ?

quartz kindle
#

show code

hasty lotus
#

of djs ?

misty sigil
#
const Discord = require("discord.js")
exports.run = async(client, message, args) =>{    
    let member = message.mentions.members.first() || await client.users.fetch(args[0]) || message.member,
    user;
if (member) user = member.user;
    console.log(user)
    var randomColor = Math.floor(Math.random()*16777215).toString(16); //randomizes colour, use this for every embed.
    const HelpEmbed = new Discord.MessageEmbed() //creates the embed
    .setColor('#' + randomColor) //various settings (including using the randColour)
    .setImage(user.avatarURL())
    .setFooter(`Requested by ${message.author.tag}`, message.author.avatarURL()); //footer
    return message.channel.send(HelpEmbed)
    }``` v12
hasty lotus
#

and yes show your code

#

ok

quartz kindle
#

you're doing mentions.members

opal plank
#

you are passing a collection onto the channel nini?

quartz kindle
#

thats a member object, not a user object

misty sigil
#

ohgod

quartz kindle
#

and then you do users.fetch(), thats a user object not a member object

hasty lotus
#

you are passing a collection onto the channel nini?
@opal plank ๐Ÿคจ

quartz kindle
#

then you do member.user

hasty lotus
#

what do you mean by that ?

quartz kindle
#

which turns a member into a user, but a user into nothing

opal plank
#

you are setting one at a time or are you bulk changing it?

clever garnet
#

@opal plank didnt work

hasty lotus
#

uh

#

let me check

#

but at once i think

hardy vector
#

https://hastebin.com/kukibujopi.js
(node:15304) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)
pls help

opal plank
hasty lotus
#

that is what i used

quartz kindle
#

@hardy vector show models/ReactionRole.js

hasty lotus
#
            c.updateOverwrite(guild.id, {
            READ_MESSAGES: false,
            SEND_MESSAGES: false
            })

            c.updateOverwrite(staff, {
            READ_MESSAGES: true,
            SEND_MESSAGES: true
            })```
#

c being a channel

opal plank
hasty lotus
#

and staff is a valid role

clever garnet
#

@opal plankit didnt work

opal plank
#

overwrite is fine

clever garnet
#

what do i do

quartz kindle
#

what didnt work

clever garnet
#

my code

quartz kindle
#

explain how it didnt work

clever garnet
#

no errors

#

just didnt work

quartz kindle
#

what was it supposed to do and what did it do

opal plank
#

VIEW_CHANNEL

#

thats why

clever garnet
#

async function newChannel() {
let channel = await guild.channel.create("name")
channel.send("message")

    }
#

was the code

opal plank
#

@hasty lotus use permission VIEW_CHANNEL

hasty lotus
#

ok

quartz kindle
#

and you copy and pasted that code literally without understanding it

hasty lotus
#

i'll try

#

๐Ÿ™‚

opal plank
hasty lotus
#

nah

quartz kindle
#

that code creates a function. functions need to be executed, they do not execute themselves

opal plank
#

i dont see a READ_MESSAGES permission on the portal docs, only VIEW_CHANNEL

clever garnet
#

ok

hasty lotus
#

i don't want members to be able to read at all

opal plank
#

they cant access channel if they cant view it

clever garnet
#

so how do i do that

hasty lotus
#

it's for tickets so if anyone can see the channel :/

quartz kindle
#
// this is how you create a function
function bla() {
  // do something
}

// this is how you run a function
bla()
opal plank
#

thats all i got for you

clever garnet
#

i dont understand

opal plank
hasty lotus
#

VIEW_CHANNEL is working fine ty

#

๐Ÿ™‚

opal plank
#

๐Ÿ˜‰

quartz kindle
#

@clever garnet functions are a basic component of all programming languages, its like the basics of the basics

opal plank
#

^^

hardy vector
#

@hardy vector show models/ReactionRole.js
ok

opal plank
hardy vector
#
module.exports.run = async () => {
  const mongoose = require("mongoose");
  const schema = new mongoose.Schema({
    Guild: String,
    MessageID: String,
    Reaction: String,
    Role: String,
  })
  const model = mongoose.model("ReactionRole", schema)
  module.exports = model
}```
#

tim

opal plank
#

would highly recommend reading that

quartz kindle
#
// create a function called myFunctionName that does 10 + 10 and returns the result
function myFunctionName() {
  return 10 + 10;
}

// run the function you created
myFunctionName() // returns 20
console.log(myFunctionName()) // logs 20 in your terminal/console
var test = myFunctionName()
console.log(test) // logs 20 in your terminal/console
``` @clever garnet
#

@hardy vector wait so you export a run function

#

and the run function exports the model

#

wat

honest perch
#

I dont use functions

#

They're for boomers

hasty lotus
#

anyone good in vanilla JS ?

opal plank
#

define vanilla JS

hasty lotus
#

web JS

#

HTML+JS

opal plank
#

i rarely use HTML, so no

pure lion
#

Is there an easy way for me to get rid of npm packages that go unused?

hasty lotus
#

i would like to make something to show the exact current number of server that my bot has

opal plank
#

uninstall it

#

@pure lion

#

npm uninstall (pagacke)

hasty lotus
#

i've already made an express server in my bot file

pure lion
#

Then?

opal plank
#

thats it, uninstall it

pure lion
#

But

opal plank
#

why bother keeping unused packages

hasty lotus
#

to post in json the bot stats

#

but idk how to get them ๐Ÿ˜ฆ

pure lion
#

Uh

quartz kindle
#

do you have a website or a webpage hosted elsewhere?

#

or is the website itself run by the express server?

hasty lotus
#

the website is on an express server

#

but an other one

opal plank
#

i gave up on that, my isp makes my life a living nightmare with not being able to port foward my shit

hasty lotus
#

that isn't related to the bot

#

but i have a page to get the stats

quartz kindle
#

so your bot express is just an api to export those values

hasty lotus
#

so your bot express is just an api to export those values
@quartz kindle yep

#

in json

quartz kindle
#

then your website server needs to make a request to the bot server

hasty lotus
#

yep

#

but how ?

#

x)

quartz kindle
#

either from server side or client side, doesnt really matter, but from server side is safer

clever garnet
#

*--+jhiopjhgkl[iuh

opal plank
#

stroke

hardy vector
#

and the run function exports the model
@quartz kindle what no?

#

wait

hasty lotus
#

*--+jhiopjhgkl[iuh
@clever garnet ๐Ÿคจ

opal plank
#

having a stroke

clever garnet
#

nohno

quartz kindle
#

use an http lib such as http, node-fetch, axios, got, etc @hasty lotus

hasty lotus
#

how ?

opal plank
#

axios is my goto out of thsoe

hardy vector
#

by reading docs

hasty lotus
#

sry i accually never use web js ๐Ÿ˜ฆ

hardy vector
#

node-fetch gnag

quartz kindle
#

this is not web js

#

this is node lol

hasty lotus
#

well

#

the js

opal plank
#

axios squad

hasty lotus
#

i have to put it on the web page

#

๐Ÿ‘‰๐Ÿ‘ˆ

quartz kindle
#

that comes later

hasty lotus
#

mmh ok

quartz kindle
#

you can get the json before sending anything to the webpage

hasty lotus
#

is request fine ?

quartz kindle
#

request is deprecated

#

and bloated af

hasty lotus
#

uh why ?

solemn latch
#

things get deprecated

quartz kindle
#

they discontinued development lol

hasty lotus
#

๐Ÿ˜‚

#

ok

solemn latch
#

it just happens

hasty lotus
#

so

hardy vector
#

wait

#

what about me

#

xd

#

jkjkj

hasty lotus
#

in the server.js file

quartz kindle
#

well first explain why you have a run function that redefines module.exports

hasty lotus
#

what do i need to put ?

hardy vector
#

bc i have this in my main file

#
require("./Models/ReactionRole").run()```
#

so i export run function?

quartz kindle
#

but like. why export run in the first place? why not export model directly?

hardy vector
#

so can i just do module.exports without the run and have it not throw me a damn error and actually work?

quartz kindle
#
  const mongoose = require("mongoose");
  const schema = new mongoose.Schema({
    Guild: String,
    MessageID: String,
    Reaction: String,
    Role: String,
  const model = mongoose.model("ReactionRole", schema)
  module.exports = model
opal plank
#

ty, i was getting tired of scrolling back up

quartz kindle
#

then ```js
Role = require("./model.js");
data = new Role({bla}) // or whatever

#

it seems you also forgot the new keyword

#

i dont use mongoose, but this is what they docs show

#

@hasty lotus show your server.js

hasty lotus
#

sure

#
const express = require("express")
const path = require("path")

const app = express()

app.use(express.static(path.join(__dirname, 'website')))

app.listen(5000, () => console.log(`Started on :5000 !`))```
#

that's all...

#

and then i've got the website folder

quartz kindle
#

ah you're using static

#

you need a route without static

hasty lotus
#

in which i've got the css + js + html file

quartz kindle
#

at least for the json file

hasty lotus
#

mmh ok

#

how ?

#

๐Ÿ˜ญ

quartz kindle
#

something like this

hardy vector
#

\Frosty Rewrite\src\index.js:5
require("./Models/ReactionRole").run()
^

TypeError: require(...).run is not a function

#

why is this happening now

hasty lotus
#

\Frosty Rewrite\src\index.js:5
require("./Models/ReactionRole").run()
^

TypeError: require(...).run is not a function
@hardy vector you must defined a run module

#
module.exports.run = //function```
hardy vector
#

i did before but tim said otherwise

#

._.

hasty lotus
#

well remove the .run at the end then

#

require("./Models/ReactionRole")

#

without .run at the end

#

๐Ÿ˜‰

quartz kindle
#

try something like this js app.get("/json", async (req,res) => { let data = await fetch("bot's express server ip address and port").then(res => res.json()) res.send(`var data = ${JSON.stringify(data)}`); })

#

example using node-fetch

hasty lotus
#

but

#

this

quartz kindle
#

and you should see the data

hasty lotus
#

it will return a json

#

yes

#

i can already get the json data

quartz kindle
#

and you should get that var loaded

hasty lotus
#

hm ok

#

and then how can i put it in the html ?

#

๐Ÿคจ

quartz kindle
#

do you have an html file?

hasty lotus
#

yep

#

index.html

quartz kindle
#

then add it

#

add the script line to it

hasty lotus
#

yes

#

but

quartz kindle
#

<script src="/json"></script>

hasty lotus
#

how can i display the data

#

๐Ÿ˜ฆ

honest perch
#

Tim do be teaching doe

hasty lotus
#

x)

quartz kindle
#

first confirm that the data is available

hasty lotus
#

ok

digital ibex
quartz kindle
#

load the page in your browser, open the dev tools

#

and type the variable name

hasty lotus
#

yep yep sure

quartz kindle
#

in the console

digital ibex
#

i have: js app.post('/save', (req, res) => { console.log('save'); });

#

and in my html i have: html <form action="save" method="POST"> <button class="button is-success is-light save-btn">Save Changes</button> </form>

quartz kindle
#

you're posting to a relative url

#

post to /save

#

action="/save"

hasty lotus
#

and type the variable name
@quartz kindle which name ?

digital ibex
#

oh

quartz kindle
#

the one you defined in the /json endpoint

#

or whatever you did

hasty lotus
#

ok

digital ibex
#

hm, now it just loads and doesn't do anything..

quartz kindle
#

doesnt log to console?

hasty lotus
#

i've got an error in the console

digital ibex
#

nothing in the dev tool

#

doesn't log

quartz kindle
#

that console is not dev tool, its server console

hasty lotus
#

"SyntaxError: unexpected token: ':'"

digital ibex
#

o

#

nothing in the server console either

quartz kindle
#

@hasty lotus show code

hasty lotus
#

of ?

#

the html ?

quartz kindle
#

does it log in the server console?

#

well i mean its post, not get

digital ibex
#

nope, im doing that in the backend

#

and i go to the 404 page

quartz kindle
#

use reqbin or similar

digital ibex
#

kk

quartz kindle
#

just to see if it logs

#

@hasty lotus where did you get the unexpected token?

#

on which console?

hasty lotus
#

HTML require the json :

<script src="http://skypvp.fr:3001"></script>```

Website express server :
```js
const express = require("express")
const path = require("path")

const app = express()

app.use(express.static(path.join(__dirname, 'website')))

app.listen(5000, () => console.log(`Started on :5000 !`))```

3001 Port website (bot data in the bot index.js) :
```js
client.on('ready', () => {
  serverCount = {
        "servercount": client.guilds.cache.size,
        "memberCount": client.users.cache.size,
        "channelCount": client.channels.cache.size
}
  setInterval(function() {
    serverCount = {
        "servercount": client.guilds.cache.size,
        "memberCount": client.users.cache.size,
        "channelCount": client.channels.cache.size
}
  }, 5000)
})
  
app.get("/", async function(req, res) {
    console.log(serverCount)
    res.setHeader("Access-Control-Allow-Origin","*")
    res.send(serverCount);

});

var server = app.listen(3001, function () {
    console.log("Listening on port %s...", server.address().port);
});```
#

i've got the unexpted token in the firefox console

#

while watching the website

#

on :5000

neat ingot
#

whats that fast ws lib again?

#

i cant recall its name

#

the thing that replaces express and socket io

quartz kindle
#

uws?

neat ingot
#

yusss, ty tim โค๏ธ

quartz kindle
#

@hasty lotus so you're loading the bot data from client side, not server side

#

which means your bot server is public

hasty lotus
#

yes

#

but it doesn't matter

#

it's just a json

quartz kindle
hasty lotus
#

thoses numbers will be public anyway on the website so it sdoesn't change anything :/

#

and if you go to skypvp.fr/3001 you see the json data?
@quartz kindle yep

quartz kindle
#

ok

#

so the problem is

#

that browser js cannot load json directly

#

it can only load js

#

so the json data has to come through js

digital ibex
misty sigil
#

here i am with another probably stupid question
How do i fetch a guild member from ID?

quartz kindle
#

so you have to change your json output to a js-compatible output, like this res.send("var data = " + JSON.stringify(serverCount))

#

then your <script> tag should be able to load it

hasty lotus
#

hmok

quartz kindle
#

and it should be globally accessible in the client side through the data variable

hasty lotus
#

ok i havent got the error anymore

#

๐Ÿคž

#

whats the next step ?

#

:p

quartz kindle
#

open console in dev tools

#

and type data

hasty lotus
#

"undefined"

quartz kindle
#

hmm

#

what does it show if you open the 3001 in your browser?

#

directly

hasty lotus
#
var data = {"servercount":61,"memberCount":8520,"channelCount":2021}```
#

:/

quartz kindle
#

show your html

hasty lotus
#
<script src="http://skypvp.fr:3001"></script>```
quartz kindle
#

thats all?

hasty lotus
#

well i've got the whole page

#

but i can't send all

amber fractal
#

Is it possible for you to use fetch?

misty sigil
#

how do i fetch guild member from id?

amber fractal
#

await <Guild>.members.fetch(id) on d.js

digital ibex
#

so

#

any ideas why my post thingy isnt working

limber swan
#

Some that uses mongodb?

quartz kindle
#

@hasty lotus i just loaded your website and it works

amber fractal
#

Could be cache then

solemn latch
#

if your using chrome, you can disable cache while dev tools is open

amber fractal
#

@limber swan what do you need

hasty lotus
amber fractal
#

ctrl + shift + r

#

then try

quartz kindle
#

make sure you have disable cache turned on

amber fractal
#

or that

quartz kindle
#

idk how its in firefox

hasty lotus
#

ok i've restarted the server it's fine now for me

#

idk why but ok it works

quartz kindle
#

ok so now you can use data in client side js

#

for example

hasty lotus
#

yep

quartz kindle
#
<script src="http://skypvp.fr:3001"></script>
<script>
  document.querySelector("#someid").innerText = data.servercount
</script>
hasty lotus
#

hm ok i'll try this

quartz kindle
#

@digital ibex did you test with reqbin?

digital ibex
#

i cant because my site isn't public

#

im still making it

quartz kindle
#

not even an ip address?

hasty lotus
#

okkkk

#

it's working

#

ty !

digital ibex
#

lemme try with my ip

hasty lotus
#

just if you know, would you have any simple way to make the number count up ?

digital ibex
#

something ++

quartz kindle
#

lmao

hasty lotus
#

oh ty

quartz kindle
#

if you wanna do it manually, look into requestAnimationFrame()

hasty lotus
#

ok

quartz kindle
#

but you'd need to code your own easing function for the slowdown at the end

hasty lotus
#

does setInterval works in web js ?

quartz kindle
#

yes

hasty lotus
#

oh nice

quartz kindle
#

the only one that doesnt work is setImmediate

digital ibex
#

nope tim

#

i tried doing the things u told me to do before, but i got confused and just gave up

quartz kindle
#

ah if its a home pc it needs port forwarding

digital ibex
#

yeah, i tried doing that but no luck :/

#

im looking at the way i done it with my url shortner but it looks the exact same to me

hasty lotus
#

just

#

if i do this

#
<script src="http://skypvp.fr:3001"></script>
<script>
    setInterval(function() {
    document.querySelector("#channelsCount").innerText = data.channelCount
    document.querySelector("#serverCount").innerText = data.userCount
    document.querySelector("#userCount").innerText = data.serverCount

    }, 10000)
</script>```
#

will this really update every 10s ?

#

bcs the request for the data is only made once

#

so idk

quartz kindle
#

nope, that wont update

hasty lotus
#

๐Ÿ˜ฆ

#

how can i update it ?

quartz kindle
#

if you want it dynamic, then you need to change everything again lmao

hasty lotus
#

๐Ÿ˜ญ

quartz kindle
#

switch back to pure json in your 3001

#

and dont load anything on html

#

not directly

#

and use ajax instead

#

or fetch

#

for example, with browser fetch

#
<script>
  setInterval(() => {
    fetch('url here')
  .then(response => response.json())
  .then(data => {
    document.querySelector("...").innerText = data.channelCount
  });
  },10000)
</script>```
digital ibex
#

tim, is this is what im gonna have to do?```js
app.post('/:guildId/custom-commands/save', (req, res) => {
console.log('save');
});

hasty lotus
#

ok i'll try

#

:p

quartz kindle
#

@digital ibex idk

digital ibex
#

oh

quartz kindle
#

you're using a router middleware arent you?

digital ibex
#

yeah

quartz kindle
#

whats your middleware again

digital ibex
#
app.use('/login', require('file'));
app.use('/dashboard', require('file'));
app.use('/guilds/:guildId', require('file'));```
surreal field
digital ibex
#

thats not a custom status

quartz kindle
#

thats not custom status

#

thats WATCHING status

surreal field
#

oh

#

will discord allow it in the future then?

quartz kindle
#

they said they plan to, but it was pretty low in their priority list

#

they said that like 6 months ago

surreal field
#

ah ok ty

digital ibex
#

any ideas or

clever garnet
#
    async function newChannel() {
        let channel = await guild.channel.create("name")
        channel.send("message")
        
        }```

how do i use this function

im using discord.js
digital ibex
#

wut

hasty lotus
#

well

#

just put it in your code

#

๐Ÿ˜‚

digital ibex
#

just do newChannel() ?

hasty lotus
#

and create channels

clever garnet
#

i did

hasty lotus
#

๐Ÿคจ

quartz kindle
#

@digital ibex add a simple res.send("bla") on /save

clever garnet
#

    async function newChannel() {
        let channel = await guild.channel.create("name")
        channel.send("message")
        
        }
    
    

    
})``` this my code
digital ibex
#

kk

quartz kindle
#

see if it shows up

clever garnet
#

what do i do

hasty lotus
#
<script>
  setInterval(() => {
    fetch('url here')
  .then(response => response.json())
  .then(data => {
    document.querySelector("...").innerText = data.channelCount
  });
  },10000)
</script>```

@quartz kindle i've done this but the counter is still on 000 (default number)

quartz kindle
#

any errors in dev tools console?

clever garnet
#

what do i do

quartz kindle
#

try console.log(data)

hasty lotus
#

nope

#

ok

quartz kindle
#

also check the network tab to see if the requests are actually being made

digital ibex
#

nope tim

clever garnet
#

can someone help

quartz kindle
#

@clever garnet i already showed you how to run functions

clever garnet
#

how

hasty lotus
#

also check the network tab to see if the requests are actually being made
@quartz kindle there is

#

there is only one

#

๐Ÿคจ

quartz kindle
#

console.log something before the interval

#

test the code without the interval

#

do some debugging

hasty lotus
#

ok

#

is status 304 good ?

quartz kindle
#

@clever garnet ```js
// create a function called myFunctionName that does 10 + 10 and returns the result
function myFunctionName() {
return 10 + 10;
}

// run the function you created
myFunctionName() // returns 20
console.log(myFunctionName()) // logs 20 in your terminal/console
var test = myFunctionName()
console.log(test) // logs 20 in your terminal/console

digital ibex
#

this is my code rn: ```js
app.post('/guilds/:guildId/custom-commands/save', (req, res) => {
console.log('save');
res.status(200).send('hi saved');
});

quartz kindle
#

whats your form url?

digital ibex
#
   <form action="save" method="POST">
      <button class="button is-success is-light save-btn">Save Changes</button>
   </form>```
quartz kindle
#

@hasty lotus 304 is not modified, you still have caching turned on

#

you have to disable caching

digital ibex
#

do i need to update that too?

hasty lotus
#

how?

quartz kindle
#

@digital ibex and whats the current url of the page before you click the button?

hasty lotus
#

okey

quartz kindle
hasty lotus
#

the pb is on the fetch

digital ibex
hasty lotus
#

i've set a console.log juste before the fetch line

quartz kindle
#

and when you click the button what happens?

hasty lotus
#

it is the pb

#

๐Ÿ˜ฆ

digital ibex
#

it sends me to the cannot post page

hasty lotus
#

but the request are made

clever garnet
#

let channel = await guild.channel.create("name")
is my code

my error is
(node:25060) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'create' of undefined

digital ibex
hasty lotus
#

ok

#

when i console.log(data)

#

it says undefined

clever garnet
#

what do i do

hasty lotus
#

"SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"

#

uh

#

yes

#

the data is still in js

quartz kindle
#

@digital ibex its trying to post to /guilds/:id/save but your route is /guilds/:id/custom-commands/save?

digital ibex
#

oh

clever garnet
#

what do i do

hasty lotus
#

ok now the error is gone

digital ibex
hasty lotus
#

but the console.log(data) is still undefined

#

๐Ÿ˜ฆ

digital ibex
#

see fi ti works

#

holy shit, so, this is my backup if i cant get it to wor

#

k

quartz kindle
#

@clever garnet learn javascript and stop trying to blindly guess things, sorry

clever garnet
#

bruh

quartz kindle
#

plus, its channels, not channel

clever garnet
#

ko

digital ibex
#

why star? Thonk

quartz kindle
#

guild has multiple channels, so guild.channels makes sense. guild.channel doesnt make sense because there isnt any specific single channel in a guild

digital ibex
#

i feel like an actual coder person now, them memes of the backend is shit but the frontend is nice, i can finally relate

#

but both backend and frontend r shit tho

quartz kindle
#

@hasty lotus response.json() needs to be returned

#

response => response.json()
or
response => { return response.json() }

hasty lotus
#

it's already done

digital ibex
#

okay, so i have this endpoint: ```js
app.post('/save', (req, res) => {

});``` how would i start to ratelimit users?

quartz kindle
#

you added console.logs but you didnt return it

hasty lotus
#
fetch('http://skypvp.fr:3001')
  .then(response => {
      console.log(response)
    })
  .then(data => {
      console.log("fetched")
      console.log(data)
        document.querySelector("#channelsCount").innerText = data.channelCount
        document.querySelector("#serverCount").innerText = data.userCount
        document.querySelector("#userCount").innerText = data.servercount
  });```
#

i've got this

#

bruh

quartz kindle
#

you need to return the .json() promise

hasty lotus
#
fetch('http://skypvp.fr:3001')
  .then(response => {
      console.log(response)
      return response.json()
    })
  .then(data => {
      console.log("fetched")
      console.log(data)
        document.querySelector("#channelsCount").innerText = data.channelCount
        document.querySelector("#serverCount").innerText = data.userCount
        document.querySelector("#userCount").innerText = data.servercount
  });```
#

like this ?

quartz kindle
#

yes

hasty lotus
#

ok

#

okk perfet

#

ty

quartz kindle
#

lmao

hasty lotus
#

?

#

where ?

quartz kindle
hasty lotus
#

uh

#

id

digital ibex
#

hm so

#

with this endpoint

#

how can i get the guilds id? Thonk

#

req.params and req.body is an empty object and undefined

warm marsh
#

/save:id

#

?

digital ibex
#

wym?

warm marsh
#

the route

#

'/save:id'

digital ibex
#

hm, lemme try it

warm marsh
#

To get the body you need to pass body in the post request.

digital ibex
#

this is my form: js <form action="/save/:guildId" method="POST"> and this is the js: ```js
app.post('/save/:guildId', async (req, res) => {

warm marsh
#

Nah only inside the app.post

#

not on the form.

digital ibex
#

then it errors

warm marsh
#

But that should return a body with form data.

digital ibex
#

saying cannot post /save

warm marsh
#

oh wait

#

That's for a get request.

#

Just do a post like app.post('/save'd)

digital ibex
#

im confused

#

that was what i was doing before

warm marsh
#

I was confused, I just checked my API.

#

remove the :id

digital ibex
#

in the form or the post?

warm marsh
#

both

digital ibex
#

that was what i was doing before..

#

but i need to get the guilds id

warm marsh
#

Yeah, I had to check.

#

I'm unsure but I think you require a middleman in-order to access form data on server.

digital ibex
#

middleman?

#

whats that

warm marsh
#

an intermediary or agent between two parties

#

kinda thing.

sick cloud
#

dude no

#

@digital ibex if your .post is /save/:guildId then you need to post to /save/id, like /save/264445053596991498

#

then afaik its req.params.guildId

warm marsh
#

Oh I was right.

digital ibex
#

my post isnt that

warm marsh
#

He's posting form data.

sick cloud
#

app.post('/save/:guildId', async (req, res) => {

#

???

warm marsh
#

Do you have something like body-parser installed?

sick cloud
#

you don't need body-parser @warm marsh

#

express builds it in you just require it

earnest phoenix
#

Is it possible to code a functioning discord bot in pure html?

sick cloud
#

@earnest phoenix no

warm marsh
#

There was a cdn

#

Idk if they removed it.

earnest phoenix
#

what does html lacks that makes it unable to code a discord bot?

sick cloud
#

um, everything?

#

html is a display language

#

not a scripting lang

warm marsh
#

You can run a bot in the browser.

sick cloud
#
app.use(express.urlencoded({ extended: true ));```
that'll let you use `req.body` which is all the form params @digital ibex
#

if you have js you can

#

html on its own won't

digital ibex
#

oh ok

#

req.body is still an empty object

sick cloud
#

are you posting the form

digital ibex
#

my form is just action="/save" method="POST"

sick cloud
#

what inputs are in the form

#

and do they all have a name/id

digital ibex
#

this is all thats in the form: html <form action="/save" method="POST"> <button class="button is-success is-light save-btn">Save Changes</button> </form>

sick cloud
#

well its very obvious why it posts nothing??????????

#

there's nothing in the form

digital ibex
#

o

sick cloud
#

just a button that submits an empty form

#

it'll only submit inputs IN the form

digital ibex
#

how would i uh change that?

sick cloud
#

put all your inputs inside the form?

digital ibex
#

wait what

#

update the guild and stuff in the frontend??

sick cloud
#

?

digital ibex
#

im confused..

sick cloud
#

it'll only post data in the <form></form>

#

so put all your inputs you want saved in there

digital ibex
#

what how would i put the guilds id there then?

#

im confused....

sick cloud
#

oh for fucks sake

#

you already had it

#

/save/:guildId on the back end
make the form post to /save/guild id

digital ibex
#

okay

latent tundra
#

Can we simulate a (successful) vote?

sick cloud
#

using the test button

digital ibex
#

so, form: <form action="/save/:guildId" method="POST">
post method: app.post('/save/:guildId', async (req, res) => { like so?

latent tundra
#

Uhm where?

sick cloud
#

bot page -> edit

#

and no, you replace :guildId with the guild id on the form @digital ibex

digital ibex
#

oh

sick cloud
#

so action="/save/264445053596991498" for eg

latent tundra
#

Ah thanks I found it bud

digital ibex
#

how would i uhh, do that

sick cloud
#

are you using ejs

digital ibex
#

yeah

sick cloud
#

action="/save/<%= guildID %>"
then pass the guildID in to ejs as an option or such

#

ie res.render('whateverpage.ejs', { guildID: xxx })

digital ibex
#

yeah, just the how would i get it to that bit in the post method?

#

oh

sick cloud
#

<%= guildID %>
will get replaced

#

action="/save/<%= guildID %>"
so that will post an actual ID

digital ibex
#

but im so confused

#

im trying to get the guild id in the post request

sick cloud
#

i literally just showed you how

nimble palm
#

Hi

digital ibex
#

/save/:guildId?

sick cloud
#

yes

#

so posting to /save/264445053596991498 for eg would then pass the guild id on

#

then you have req.params.guildId

digital ibex
sick cloud
#

.... :guildId isnt an id

digital ibex
#

im trying to get the id

sick cloud
#

dude

#

read what i said

#

i'm not going to explain further

quick copper
sick cloud
#

i told you how, if you're not smart enough to understand then learn express before making a complex project

#

@quick copper show the contents of whatever this code is requiring

const reqEvent = (event) => require(`../events/${event}`);```
sick cloud
#

wait nvm

#

your code is wrong

#

reqEvent('disconnect')(client)
that won't work

#

use reqEvent('disconnect', client)

quick copper
#

ok

sick cloud
#

then just parse the args through

quick copper
#

i change all to that

sick cloud
#
const reqEvent = (event, client = null) => require(`../events/${event}`)(client);

then each event can receive client

quick copper
#

ok i did it

#

now my bot isnt executing commnds

sick cloud
#

each event needs to export a function

#

because you aren't parsing a msg

#

@earnest phoenix why are you asking heere

quick copper
#

the hell i do that?

sick cloud
#

it's your youtube channel do what you want

#

sigh

quick copper
#

srry im pretty rookie in this

#

i came from py

#

ik

sick cloud
#

then they won't watch

misty sigil
#

its your channel.

sick cloud
#

who cares

quick copper
#

ThatTony how i parse a msg?

sick cloud
#

@quick copper client.on('message', reqEvent('message'), client, message);
then modify your reqEvent:
```const reqEvent = (event, client = null, message = null) => require(../events/${event})(client, message);

should pass the msg through optionally
#

i was working on typing i can't type fast

quick copper
#

ok

digital ibex
sick cloud
#

its not an error, it's telling you to change your code because that function will be removed

#

and it's quite literally telling you what to use

digital ibex
#

no not that

quick copper
#

i got this error now

digital ibex
#

the cannot set headers bit

sick cloud
#

don't send content after you already ran send once

#

@quick copper you're fucking discord.js internally somewhere, look through your code

#

can't help you there

quick copper
#

ok

misty sigil
#

i can just eval()

latent tundra
#

How do I bounce my webhook to the external ip? in Node-JS

#

top.gg DBL: Webhook running at http://0.0.0.0:5000/dblwebhook is what it says now.

sick cloud
#

vps ip:5000/dblwebhook should work

#

unless you're using nginx or such

latent tundra
#

It's a windows server.

#

It doesn't works btw that's why I ask.

#

The server at IP is taking too long to respond.

sick cloud
#

go through your firewall and then your router (if you're locally hosting) to port forward

latent tundra
#

It's on a dedicated server.

#

running windows server

sick cloud
#

make sure external connections on that ip/port are forwarded to 0.0.0.0:5000

latent tundra
#

Lemme see

sick cloud
#

i don't have experience with win server past 2003 so i can't help

latent tundra
#

ahh

#

ah so listenport and connectport should be the same?

earnest phoenix
#

@latent tundra , How do I have all of it in an Message Embed?

#

On the website.

latent tundra
#

netsh interface portproxy add v4tov4 listenport=5000 listenaddress=0.0.0.0 connectport=5000 connectaddress=EXTERNAL_IP

earnest phoenix
#

Is that possible?

latent tundra
#

All of what?

earnest phoenix
#

Like

#

All the text.

#

In an embed.

#

O_o

quaint hound
#

what do you need?

earnest phoenix
#

I need help with this top gg thing

#

plz

#

Anyone who knows a fair amount of HTML Coding, DM me.

#

|| Ty ||

latent tundra
#

HTML?

earnest phoenix
#

Well

#

Whatever this is.

#

lol

#

๐Ÿ˜ญ

quaint hound
#

html isnt used in embeds

latent tundra
#

Whatever this is?

quaint hound
#

i can help tho

earnest phoenix
#

@quaint hound DM?

quaint hound
#

ok

latent tundra
#

There are lots of libraries for the discord API.

sick cloud
#

"top gg thing"

latent tundra
#

And HTML isn't a scripting language.

sick cloud
#

i love white names

winter basalt
#

lmao

latent tundra
#

It's a markup language.

#

XML format.

sick cloud
#

and the fun questions you get

latent tundra
#

Why not those last two if's on the same line?

#

you write ugly lol

#

Here are my elifs

#

Why blank lines

#

Blank lines are useless

#

You don't need blank lines

#

You need patterns

#

That's not easier

#

Just makes me scroll more

tepid canyon
#

๐Ÿ

latent tundra
#

I despise whitespaces and blank lines.

neat ingot
#

if you dont write code that others find readable ~ your doing it wrong. period.

hardy vector
#

https://hastebin.com/dadayozina.js
(node:12008) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)

#

help pls

earnest phoenix
#

i cant seem to fix this problem

#
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/home/runner/infernotest/index.js:1146:20)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47
exit status 1
๎บง ```
misty sigil
#

code

earnest phoenix
#

there is no code

#

its about the config.js

misty sigil
#

config.json?

earnest phoenix
#

yes

#

it doesnt read it

misty sigil
#

show the code

#

censor the other stuff

earnest phoenix
#

ok

#
module.exports = {
    TOKEN: '', 
    YT_API_KEY: '',
    devs: ['397451673842352130']}```
#

thats my config.json

#

the whole text is black

misty sigil
#

aaaah

#
{
"TOKEN": '', 
"YT_API_KEY": '',
"devs": ['397451673842352130']}
}```
#

i think

#

idk

#

works for me, but i don't use exports

opaque hawk
#

why does this throw about eight errors

#

return (permission || (_: any) => false)(message.member || message.author);

sick cloud
#

@earnest phoenix .json files aren't .js or .enf files

#

you need to use actual json

#
{
  "token": "..."
}```
earnest phoenix
#

ok

summer torrent
#

@opaque hawk show errors 393829565153411073

opaque hawk
#

ok...

hardy vector
#

https://hastebin.com/dadayozina.js
(node:12008) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)
help pls

earnest phoenix
#
internal/modules/cjs/loader.js:1170
    throw err;
    ^

SyntaxError: /home/runner/infernotest/config.json: Unexpected token ' in JSON at position 11
    at parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:1167:22)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/home/runner/infernotest/index.js:21:37)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
exit status 1```
#

im getting this error when i try to launch

opaque hawk
#

I mean, there is about three "; expected"s, two ") expected"s, one "Unreachable code detected"

digital ibex
#

hi um, does anyone know why this logs a as the prefix when the prefix is actually hi ? my code: js app.post('/save/:guildId', async (req, res) => { const guild = await guildModel.findOne({ id: req.params.guildId }); console.log(guild.prefix); await guild.updateOne({ prefix: 'a' }); console.log(guild.prefix);

#

and then i do aping nothing responds, i do hiping response

opaque hawk
#

@digital ibex prefix: 'a'

digital ibex
#

wut

#

?

opaque hawk
#

There is a line that literally defines "a" as the prefix

digital ibex
#

yes..

#

and then i do aping nothing responds, i do hiping response
@digital ibex

midnight pike
#

It says something is wrong in your config json file @opaque hawk can you paste it in chat just dont put ur token.

opaque hawk
#

ok

midnight blaze
#
    for(let i=1;i==test.length;i++){
      if(test[i]=="+"){
      testsliceAddition.push(test[i-1,i+1])

      console.log(testsliceAddition)
        

      }
    }
[ '3' ]
[ '3', '4' ]
[ '3', '4', '2' ]
[ '3', '4', '2', '3' ]
[ '3', '4', '2', '3', '9' ]
[ '3', '4', '2', '3', '9' ]

So this is the result. Can someone explain to me, why the first number is not pushed?
Here is the string, which I transformed into this(I filter the strings by + and join them to an array)

original array:

[
  '2', '+', '3', '+',
  '4', '+', '2', '+',
  '3', '+', '9'
]
opaque hawk
#

This is a .env, not a json

midnight pike
#

what does the file that holds it say like what s the name

opaque hawk
#

literally just .env

#

since it is in repl.it it can't be a .json file

midnight pike
#

oh wait I was looking at the wrong thing lol. Above where you said your error there was some guy who had the json problem.

opaque hawk
#

oh

#

lol

digital ibex
#

archigan, whats ur issue

midnight blaze
#

I need free help pls

#

with my arrays

opaque hawk
#

My issues is mainly "Unreachable code detected

misty sigil
#

free code pls
@tiny venture uuuuh no.

digital ibex
#

wdym?

opaque hawk
#

The line

tiny venture
digital ibex
#

which line?

opaque hawk
#

wait nvm

midnight blaze
#

nobody here who can help

#

?

opaque hawk
#
return (permission || ((_: any) => false))(message.member ? message.member : message.author);```
midnight pike
#

You have to put a ; after return

digital ibex
#

u wot

midnight pike
#

thats what sets that error off

opaque hawk
#

I have a fellow dev who is redoing the line in another way

digital ibex
#

im still a bit confused what ur trying to do lol

#

the code is unreachable?

#

show the code above it

opaque hawk
#

I have another dev who is redoing the line

digital ibex
#

so its fixed?

opaque hawk
#

Pretty much

digital ibex
#

noice

midnight blaze
#

can someone help me with my problem?

latent tundra
#

Using Windows Server 2016 I have added a TCP forward in my Windows Firewall for port 5000, when trying to visit it says that the server took too long to respond.

#

Any ideas?

earnest phoenix
#

Is there a function in discord.js similar to if(message.author.bot) return; but for reactions?

lyric mountain
#

Err.....what?

#

Give the docs a read, there is a way to get the user that reacted

earnest phoenix
#

no i meant like

#

a function similar if (message.author.bot) return; but it tells the bot to return if the reaction was added by the bot

lyric mountain
#

Read what I said

earnest phoenix
#

alright thx

latent tundra
#

reaction.users.cache to get all the users from reactions and what they reacted.

#

@earnest phoenix