#development

1 messages · Page 1239 of 1

carmine summit
#

it works

#

and im an idiot

#

lol

#

why does it have to be 2 data???

earnest phoenix
#

@earnest phoenix how can i change the null message to no?
@clear arrow Basics of javaScript's syntax

clear arrow
#

@earnest phoenix how can i change the null message to no?

earnest phoenix
#

btw pm2 has error

#

i stop all pm2 process

#

but the bot still running for 1d

clear arrow
#

member.premiumSince || 'No'?

earnest phoenix
#

since yesterday

jovial nexus
#

yes

earnest phoenix
#

why does it have to be 2 data???
@carmine summit Because axios returns a promise object with the actual data being inside the data property

jovial nexus
#

thats why i hate pm2

earnest phoenix
#

but that is not the problem

#

pm2 still the best

#

@clear arrow

if(something == null) something = "No"
#

since yesterday
@earnest phoenix That can be used but there are other ways too, which what you showed is not efficient enough

#

Wait f u c k

clear arrow
#

ok

earnest phoenix
#

Wrong mention

#

._.

#

wrong quote

#

2

#

That was for you Petre

clear arrow
#

aw ok :))

earnest phoenix
#
<GuildMember>.premiumSince ? <GuildMember>.premiumSince : "No";```
clear arrow
#

thanks!

carmine summit
#
for (var p = 0; p <= api.data.data.children.length; p++) {
    if (api.data.children[p].data.data.url_overridden_by_dest.includes('.jpg' || '.png' || '.jpeg')) message.channel.send(api.data.data.children[p].data.url_overridden_by_dest)
}
```Cannot read property "0" of undefined ![think](https://cdn.discordapp.com/emojis/700226511227191397.webp?size=128 "think")
earnest phoenix
#

where

#

is that

#

O... M... G

#

wh

#

... bruh i said 2 data

#

USE i IN FOR LOOP

carmine summit
#

BRUH NVM

earnest phoenix
#

it is a rule

carmine summit
#

alright

earnest phoenix
#

in programming

carmine summit
#

i found error

earnest phoenix
#

: ))

carmine summit
#

instead of 2 datas in the front

#

i placed 2 datas in the back

#

fking datas

earnest phoenix
#

USE i IN FOR LOOP
@earnest phoenix Doesn't even matter but yea, i is kinda satisfying for that

#

@carmine summit If you don't want that just use node-fetch

carmine summit
#

.includes('.jpg' || '.png' || '.jpeg') is a thing?

earnest phoenix
#

No

carmine summit
#

or i have to separate it

#

ok

earnest phoenix
#

Use the some() method

#
Array.prototype.some(...fn)```
carmine summit
#

i dunno how to use that

earnest phoenix
#

MDN helps with this stuff

#

Just google

#

if someone doesn't use i or j in a loop, he is not a real programmer

#

*doesn't

#

ye

carmine summit
#

BRUH

#

its just a variable

earnest phoenix
#

but it is a big problem

#

Logic of for loops stand

carmine summit
earnest phoenix
#

it is a rule

carmine summit
#

its not a rule if it works the same way

open rune
#

I would like to use A if it works for my code

earnest phoenix
#

i in a for loop stands for index, that's why most use it

open rune
#

yes

earnest phoenix
#

what about j ?

#

But as it's a variable it doesn't matter, but better it's

#

:))

#

maybe j looks like i

#

what about j ?
@earnest phoenix Nothing, they just wanted to use j if i was in use

carmine summit
#

i got an error in my code but i dont want to share it here because all of you will roast me

earnest phoenix
#

nvm @carmine summit but it is a rule

#

i got an error in my code but i dont want to share it here because all of you will roast me
@carmine summit If you wish to get help, you must

open rune
#

tied with ruLeS

carmine summit
#
check = api.data.data.children[p].data.url_overridden_by_dest
if (check.includes('.jpg') || check.includes('.jpeg') || check.includes('.png'))
message.channel.send(api.data.data.children[p].data.url_overridden_by_dest)
}

cannot read includes of undefined

earnest phoenix
#

i and j have typically been used as subscripts in quite a bit of math for quite some time (e.g., even in papers that predate higher-level languages, you frequently see things like "Xi,j", especially in things like a summation).

When they designed Fortran, they (apparently) decided to allow the same, so all variables starting with "I" through "N" default to integer, and all others to real (floating point). For those who've missed it, this is the source of the old joke "God is real (unless declared integer)".

Most people seem to have seen little reason to change that. It's widely known and understood, and quite succinct. Every once in a while you see something written by some psychotic who thinks there's a real advantage to something like:

open rune
#

@carmine summit I am a bit late, what r u trying to make?

earnest phoenix
#
check = api.data.data.children[p].data.url_overridden_by_dest
if (check.includes('.jpg') || check.includes('.jpeg') || check.includes('.png'))
message.channel.send(api.data.data.children[p].data.url_overridden_by_dest)
}

cannot read includes of undefined
@carmine summit
check is undefined then

carmine summit
#

uh

#

you're correct

#

ima cry now

earnest phoenix
#

LMAO

stable eagle
#

wow

carmine summit
#

uh

earnest phoenix
#

@earnest phoenix noice Canvas

#

Poggers moment

carmine summit
#

whats the channel?

#

i wanna see it

restive furnace
#

why j

earnest phoenix
#

So if i is in use

restive furnace
#

i only accept i, x and y

open rune
#

no, it's i and j

#

because it's rule ~ A - C - E

restive furnace
#

i = iterator, j = ???, x = for nested loops, y = for nested loops

earnest phoenix
#

Best loop variable team

1- i
2- j
3- x
4- y
5- p```
open rune
#

i = iterator, j = ???, x = for nested loops, y = for nested loops
@restive furnace
i in a for loop stands for index, that's why most use it
@earnest phoenix

So, who's right?

restive furnace
#

in c++ we always talk about iterators, so ¯\_(ツ)_/¯

open rune
#

ok, I think iterator is fine

earnest phoenix
#

But original is index

open rune
#

is it was index for PHP and Iterator for C?

restive furnace
#

indexes are used in arrays and things, like array[69], and iterator, well you iterate through some object

stable eagle
#

what does ns prefix stand for?

restive furnace
#

is it was index for PHP and Iterator for C?
i guess

earnest phoenix
#

you mean suffix?

#

@earnest phoenix when we get the djs api

#
[i] => main loop
[j, x, y, p] => nested loops```
#

ive never seen ns used as a prefix

#

do we have have to .json()

#

Yes

#

oh

stable eagle
#

its on galaxygate

#

im confused what it means

open rune
#

what does ns prefix stand for?
@stable eagle nameserver prefix???

earnest phoenix
#

screenshot what you mean

stable eagle
earnest phoenix
#
        let value = args[0].toString();
        if(!value) return;
        let embed = await fetch(`https://djsdocs.sorta.moe/v2/embed?src=stable&q=${value}`).then(data => data.json())
        message.channel.send(embed);

@earnest phoenix not working : /

#

those are nameservers

restive furnace
#
[i, x, y, I, X, Y] => What I use```
open rune
#

it's nameserver

stable eagle
#

Oh

#

Ok

earnest phoenix
#

i didn't add {embed: embed}

#

what is the diffrent between Map() and Collection() ?

#

Nothing, Collection is just an extended version of Map

#

uhh

open rune
#

Map() used in node, right?

earnest phoenix
#

yes

#

maybe collection is only for djs

open rune
#

yeah, that's what I mean.

earnest phoenix
north bobcat
vague wigeon
#

try again

earnest phoenix
#

you adding the bot != the bot getting approved

carmine summit
#

how to remove a specific object from an array using .splice ?

earnest phoenix
#

do you understand what you just asked

carmine summit
#

yes?

earnest phoenix
#

do you understand what splice does

open rune
#

do you mean slice?

earnest phoenix
#

there's slice and splice

open rune
#

yes

#

even slice isn't used to remove specific obj

carmine summit
#

i just want to remove an object withuot creating holes

earnest phoenix
#
<String|Array>.prototype.<slice(...slicer)|splice(...splicer)>```
#

so you could have asked that in the first place

#

lol

#

you can use splice, you just need to find the index of your element

carmine summit
#

how

earnest phoenix
#

js should have indexOf

carmine summit
#

how

earnest phoenix
carmine summit
#

dont know how google works

earnest phoenix
#

i didn't ask

sudden geyser
#

you joking or serious

carmine summit
#

you're no help

#

thank yu for that

earnest phoenix
#

hey guyes

#

my code doesn't work

#

damn that sucks

#

Define "doesn't work"

nimble kiln
#

Show code and error

earnest phoenix
#

No

sudden geyser
#

If JS and JSFuck were to be used in the same file.

earnest phoenix
#

Halp

#

Plz

nimble kiln
carmine summit
#

@earnest phoenix remove { one at a time until the error disappears

earnest phoenix
#

@nimble kiln my

#

Code

#

No work

sudden geyser
#

try opening the file

earnest phoenix
carmine summit
#

@earnest phoenix remove { one at a time until the error disappears

tidal marlin
#

I would try putting in rice

sudden geyser
earnest phoenix
#

⁶@nimble kiln @nimble kiln

#

Halp

nimble kiln
#

CTRL+A

#

DEL

#

run node

earnest phoenix
#

Doesnt work

#

I found a way to make it work, click on the power off button on your pc

#

It'll be fixed automatically

#

Not work

nimble kiln
#

shutdown /s /t 0

earnest phoenix
#

Sraly hek0

#

My yandere sim doesnt work

#

Yes the amount of else if there explains

#

You just remade yandere simulator but better

#

hi

#

i nedd

#

host

#

mta

#

@queen violet

sudden geyser
#

what

earnest phoenix
#

(node:12520) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ... to show where the warning was created)

#

how do fix

misty sigil
#

LMFAO

#

YOU

earnest phoenix
#

don't troll

#

actually

#

what if we actually exceed event emitter

#

can we incease the limit?

tired gate
#

nothing happens when i run https://hasteb.in/veririqa.js, error below

    at Client.<anonymous> (C:\Users\LuuKarQui\Desktop\karsten\discordbot\main.js:109:39)
    at Client.emit (events.js:327:22)
    at MessageCreateAction.handle (C:\Users\LuuKarQui\Desktop\karsten\discordbot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\LuuKarQui\Desktop\karsten\discordbot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\LuuKarQui\Desktop\karsten\discordbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\LuuKarQui\Desktop\karsten\discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\LuuKarQui\Desktop\karsten\discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\LuuKarQui\Desktop\karsten\discordbot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\LuuKarQui\Desktop\karsten\discordbot\node_modules\ws\lib\websocket.js:797:20)
(node:19208) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19208) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
#

main.js line 108-109: js client.on('message', async (message) => { if (await db.get(`${message.guild.id}_SETUP`) == 1) {

sudden geyser
#

message.guild is null. There are a few ways that could happen, such as running a command in a DM.

charred geyser
#

can anyone help me with running a nodejs app with ngnix

sudden geyser
#

You should check if it's null before trying to use it.

tired gate
#

message.guild is null. There are a few ways that could happen, such as running a command in a DM.
@sudden geyser i ran the command in a guild

sudden geyser
#

There are other ways it could be null (e.g. an outage). The best solution would be to check if it's null before using it.

tired gate
#

right

#

how? i think ive done it before

#

ok i made a quick test using ```js
const Discord = require('discord.js');

module.exports = {
name: 'nullcheck',
description: "Kicks the specified guild member",
execute(message, args) {
message.channel.send(${message.guild.id})
}
}``` and it outputs the id

#

ignore the description btw

sudden geyser
#

if (message.guild) {...}

tired gate
#

so that test isnt good enough?

prisma oriole
#
execute(message, args) {
        if(message.guild) {
          // Execute command
    }
}
tired gate
#
execute(message, args) {
     if (message.guild) {
         message.channel.send('success')
     }
 }
``` when run, nothing happens
#

does that mean it's null?

#

since js execute(message, args) { message.channel.send(`${message.guild.id}`) } } outputs the ID, it shouldn't be null right

#

or am i completely wrong

opaque hawk
#
const prefix = message.guild ? (await getGuild(message.guild.id)).prefix : process.env.PREFIX!;
  if (!message.content.startsWith(prefix)) return;``` my bot doesn't respond to commands and I think it may be here
#
PREFIX=r!``` in the `.env`
earnest phoenix
#

NO

#
PREFIX="r!"
misty sigil
#

.env doesnt have ""

leaden rover
#

How do I make it so my bot updates its status overtime?

misty sigil
#

use a setInterval for JS

#

it needs to change at most once per 6 seconds

pale vessel
#

.env doesnt have ""
@misty sigil they can

misty sigil
#

they can?

sudden geyser
#

They can, but I think it'll intercept the "" as being included in the string

#

It's correct to have PREFIX=r!

vague wigeon
#

how to ping my bot? heroku

misty sigil
#

last time i used .env it returned "token" and not token

faint prism
#

how to ping my bot? heroku
@vague wigeon make a ping command and reply with the latency

earnest phoenix
#

@misty sigil wut

#

so why it works by me

leaden rover
#

@misty sigil what if its a Python project?

#

I have a bot with Discord.PY, so a JS thing might be a bit hard...

misty sigil
#

just use the same sort of thing

leaden rover
#

Ok

sudden geyser
vague wigeon
#

i think using python will have higher performance than js
but also depends on your skills

sudden geyser
#

Interpreted languages like Python and JS are quite slow, but when you're using Python, you're often weighing productivity over speed.

leaden rover
#

ok

slender thistle
#

Python is fast-deployment so

earnest phoenix
#

how can I get only user.tag?

const members = message.guild.members
        const sortedmembers = Array.from(members.cache.sort((a, b) => {return a.joinedAt.getTime()-b.joinedAt.getTime()}).keys())
        let jopos = -1;
        let memberiter
        do {
            jopos++;
            memberiter = sortedmembers[jopos]
        } while (memberiter != kisi.id);

     mget = (pos, d) => {
                out = members.cache.get(sortedmembers[pos])
                if(out && d=='r') return ` ➟ ${out}`
                else if(out && d=='l') return `${out} ➟ `
                else if(out && d=='m') return `__${out}__`
                else return '';
                 }

embed.addField('Katılma Sırası', `**${jopos+1}** / ${message.guild.members.cache.size}` + '\n' + mget(jopos-1,'l')+mget(jopos,'m')+mget(jopos+1,'r'),false); 
pale vessel
#

it's a member object so that turns into the mention when stringified

#

use member.user.tag

earnest phoenix
#

out = members.cache.get(member.user.tag[pos])

#

?

pale vessel
#

outside the method

#

get(id).user.tag

leaden rover
#
async def on_ready():                                       
    print(f'Logged in as {bot.user.name} - {bot.user.id}')
    await bot.change_presence(status=discord.Status.dnd, activity=discord.Activity(type=discord.ActivityType.watching, name=f'{len(bot.users)} user(s) in {len(bot.guilds)}/100 server(s) | m!help or m1help'))
    bot.load_extension("cogs.moderation")
    bot.load_extension("cogs.misc")
    bot.load_extension("cogs.music")
    bot.load_extension("cogs.owner")
    bot.loop.create_task(my_task)
    return```
Will this work for the bot changing its status a lot?
slender thistle
#

uheasdiopq

#

Bad idea to load extensions in on_ready because that can fire multiple times

faint prism
#

Better to load when the bot starts, rather than on the 'ready' event

slender thistle
#

I don't see where it changes its status "a lot" though

leaden rover
#

Ok

#

Will this work?

bot.loop.create_task(bot.run('TOKEN', bot=True, reconnect=True))```
leaden rover
#

Ok

pale comet
#

I'd suggest just updating the status once a member leaves or joins a guild @leaden rover

leaden rover
#

Ok

slender thistle
#

Will this work?

bot.loop.create_task(bot.run('TOKEN', bot=True, reconnect=True))```

@leaden rover .RUN IS BLOCKING SO NO

#

also

#

why

#

bot.run isn't even async, and why create it as a task in the first place

leaden rover
#

Ok

vague wigeon
#

My bot also has send command but only direct message to author (me), is it accepted?

faint prism
#

That sounds fine to me

charred geyser
#
let muteTarget = message.mentions.users.first();
        muteTarget.addRole(settings.muteRole);

TypeError: muteTarget.addRole is not a function

vague wigeon
#

hope so

knotty steeple
#

They can, but I think it'll intercept the "" as being included in the string
@sudden geyser no

#

incorrect

charred geyser
#

oh iits addrole dw

knotty steeple
#
# they are the same
KEY='value'
KEY=value
charred geyser
#

bruh

#

what is wrong with this?

#
let muteTarget = message.mentions.users.first();
console.log(muteTarget);
muteTarget.roles.add(settings.muteRole);
#

settings.muteRole is correct btw

#

and muteTarget logs the correct user

#

but i get TypeError: Cannot read property 'add' of undefined

obtuse jolt
#

I think it’s message.mentions.members.first()

#

Correct me if I’m wrong

#

Because members would be a guild member users would just be the user

#

@charred geyser

#

It’s a bit like trying to add a role to a user in DMs

#

It obviously wouldn’t work

#

But if you did it in the aforementioned server that would work

#

Yknow

viral iris
#

Set make the bot lagging ?

earnest phoenix
#

what

viral iris
#

Set

earnest phoenix
#

You mean like a set

#

of data

viral iris
#
const set = new Set();
earnest phoenix
#

it wont

#

lag your bot

charred geyser
#

Because members would be a guild member users would just be the user
@obtuse jolt the member doesn't seem to be the issue but i will try that

viral iris
#

even in command handler ?

earnest phoenix
#

no

viral iris
#

k thx

earnest phoenix
#

i mean why would it

charred geyser
#

@obtuse jolt users is actually right, it is the one that returns the correct object

#

im just not sure why "roles.add()" is causing an error

obtuse jolt
#

It’s usually because you use message.author instead of message.member but I’m not sure in your case

charred geyser
#

the ClientUser is correct

#

im pretty sure that is the right object?

earnest phoenix
#

no

charred geyser
#

oh

earnest phoenix
#

roles is a member of a guildmember object

obtuse jolt
#

Yes

earnest phoenix
#

message.mentions.members.first() i guess

obtuse jolt
#

Bruh moment

charred geyser
#

ah ok

#

thanks

#

yeah

#

you were right

#

i am big dumb dumb

#

whilst im here does anyone know about hosting a nodeapp with a domain using nginx

dreamy thistle
#

okay, this is a completly newbie ask.

Imagine, i have to do a command that store in a json file your user id.
i dont know how to transfer the information to the json file

final swallow
#

yo

earnest phoenix
#

yo wassup

sharp thicket
#

@earnest phoenix need any help?

earnest phoenix
#

nah

#

im good

charred geyser
#
let role = message.guild.roles.cache.find(
  (r) => r.name === settings.muteRole
);

returning undefined pEnSiVe

sharp thicket
#

hmm

#

wait

charred geyser
#

message.guild.roles.cache.find is the right way to get a role isnt it?

sharp thicket
#

yeah

charred geyser
#

settings.muteRole returns the correct string too

earnest phoenix
#

@charred geyser what does ur muteROle look llike ?

#

a name ?

charred geyser
#

ye

earnest phoenix
#

u better do it to ID

charred geyser
#

s

#

why?

earnest phoenix
#

cuz it is easy

#

and better

#

with ID

charred geyser
#

i do name so that people can change it easy in the dashboard

sharp thicket
#

let muterole = message.guild.roles.cache.find(x => x.name === "Muted")

earnest phoenix
#

cuz roles name could be same

charred geyser
#

there is a box and you write in the name

#

i know

#

but

sharp thicket
#
const muterole = message.guild.roles.cache.find(x => x.name === "Muted")
    ``` this is what i use
charred geyser
#

uh

#

oh wait

#

maybe just ==

#

nope

#
Muted
undefined
#

this is what it logs

#

Muted is settings.muteRole

sharp thicket
#

what library?

charred geyser
#

which comes from my database

#

d.js

sharp thicket
#

huh

#

well tha works for my bot..

#

that*

faint prism
#

Why not set a variable for roles.cache, hit a breakpoint, and find out what it the object looks like

sharp thicket
#

yeah good ideaq

#

idea*

charred geyser
#

okie

#

it is correct

#

cacheType: [class Collection extends Collection],
cache: Collection(7) [Map]

#

then just a list of the roles

#

message.guild.roles; is fine

#

but it is not searching it

#

or something

#

idk

vague wigeon
#

x => x.name.toLowerCase().includes("muted");

restive furnace
#

why not just use message.guild._roles?

charred geyser
#

x => x.name.toLowerCase().includes("muted");
@vague wigeon i am using settings.muteRole as my name btw

#

also i dont really wanna do includes

restive furnace
#

why

charred geyser
#

cause that would mean if you had roles including the same string as mute role it would fuck up

#

like

earnest phoenix
#

monkaHmm So what are you guys mainly trying to accomplish

charred geyser
#

muted1 muted2

vague wigeon
#

settings.muteRole should be roleid

charred geyser
#

no

#

its a string

#

maybe i should just have the bot create a role if it cant find one and have it always called "Muted"

wicked pivot
#
bot.guilds.cache.get('534738699007557655').members.cache.map(user => user.roles.size === 1)```this is supposed to give me the list of members with a roles?
earnest phoenix
#

you're mapping to an array of booleans

#

Also roles.cache.size

charred geyser
#

bruh

earnest phoenix
#

@wicked pivot If you want to filter it by members that has one or more roles use the filter() method

vague wigeon
#

why not roleid?

earnest phoenix
#

Wot?

vague wigeon
#

I think role name can be changed but id is fixed!?

misty sigil
#

id is fixed

#

name can be changed.

earnest phoenix
#

Everything on a role can be changed except it's id, and it's creation date

#

Unless you delete the role and recreate it to change the creation date

misty sigil
#

and id

earnest phoenix
#

Yea said it

vague wigeon
#

and will need to set muted role again if it is renamed

wicked pivot
#

I have to filter and then map?

earnest phoenix
#

Just set the role by id, and let the user set the role you want

#

@wicked pivot yes

#

why would you map

#

If you want to do things on the member

#

If not then just filter

#

also for above, you hould always use ids in cases like mute roles etc.

#

i love breaking bots that rely on just a name

wicked pivot
#
let GetMembersDontHaveRoles = bot.guilds.cache.get('534738699007557655').members.cache.filter(user => user.roles.cache.size === 1).map(m => m.user.id)
console.log(GetMembersDontHaveRoles)``` return :```[]```
earnest phoenix
#

Means there was no members with a role size of 1

#

the everyone role is also counted in roles iirc

#

Yes

wicked pivot
earnest phoenix
#

those are 2 roles

#

everyone role and the membre role

wicked pivot
#

not everyone counts as a roles?

misty sigil
#

@everyone is a role

wicked pivot
#

ahhhh okay

earnest phoenix
#

Everyone counts as a role

vague wigeon
#

Unless you delete the role and recreate it to change the creation date
@earnest phoenix If it got deleted, just check and match with data in database

misty sigil
#

that everone has

earnest phoenix
#

@earnest phoenix If it got deleted, just check and match with data in database
@vague wigeon If it got deleted then just reset, and do nothing

#

Let them set the role again

acoustic bridge
#
@client.listen('on_message')
async def on_message1(message: discord.Message):
    if any(word in message.content.lower() for word in words):
        await message.delete()
        await message.channel.send("Hey! Don't say that!")
        await asyncio.sleep(5)
        await message.delete()

It deletes the message of the user, but how do i delete the "warning" afterwards?

#

(discord py by the way)

slender thistle
#

.send returns a Message object. Apply it to a variable and then use .delete() on it

acoustic bridge
#

i see

#

such as

respond = await message.channel.send()
await respond.delete()
slender thistle
#

Mhm

acoustic bridge
#

Alright, thanksies lucinaheart

slender thistle
#

👍

faint prism
#

Hm I'm getting the username #0000 somehow in my database. Yeah, ik ik. I do store the username, probably should be just getting the username from the id. Not sure why It's empty though here

slender thistle
#

Are you sure it's not a zero-width-space by some random to God chance?

faint prism
#

wait a minute I may have answered my own question

#

yeah no idk

#

the UserRecord ctor is

        public UserRecord(IUser user)
        {
            UserId = user.Id;
            Username = $"{user.Username}#{user.Discriminator}";
        }

So it shouldn't be null

slender thistle
#

inb4 it's a webhook message

tidal marlin
#

How do I change array[number] into array[!number]

#

Like to not get the same number

faint prism
#

How do I change array[number] into array[!number]
@tidal marlin what

#

the index of an array is the offset of the object's memory location

#

what are you trying to do?

wild thistle
#

How can i make a database in python 3?

tidal marlin
#

I literally said what I'm trying to do

#

To get a number !== number

faint prism
digital wagon
#

oups xD

faint prism
#

How can i make a database in python 3?
@wild thistle you have many options. sqlite3, quick.db, mongodb, sql

wild thistle
#

ok ty

faint prism
#

To get a number !== number
@tidal marlin You want the boolean result of that?

#

Or are you trying to flip a value in an array element?

tidal marlin
#

What?

#

Number is integer

faint prism
#

yeah, I got that

tidal marlin
#

I'm trying to receive different number than the one it got on the first one

faint prism
#

so, does that mean you want something in a different index in the array?

tidal marlin
#

Yes

#

Cause I could make it complex

faint prism
#

so instead of arr[i] or want arr[j] for example?

tidal marlin
#

like make some ifs

#

and stuff

#

but I ask if there's something far more simple

spice furnace
#
      let user = bot.users.cache.get(money[i].ID.split('_')[2]).username
``` What is wrong?
faint prism
#

are you asking for a for loop?

tidal marlin
#

Not exactly

pale vessel
#

i don't get it

faint prism
#

Me either

#

I still don't know what you're asking really

tidal marlin
#

I'm asking about getting other index than the one I got in the first one

#

Cause I know I could use some complex ifs to get to that

#

but I ask if there's a way to not

faint prism
#

So for instance:

object[] myArray = new object[2];  // Array of 2 object elements
myArray[0];  // 1st element
myArray[1];  // 2nd element
#

Is that what you mean? That's accessing different elements in the array

tidal marlin
#

And I'm trying to get like
myArray[0] = myArray[!0]

#

So anything but 0

pale vessel
#

so what auger said

faint prism
#

that [!0] doesnt make sense though

tidal marlin
#

Yes I know

faint prism
#

are you trying to do a random element?

#

Like a shuffle?

tidal marlin
#

Yes

faint prism
#

Okay, now we are getting somewhere

tidal marlin
#

Because for sure it's possible with at least 2 ifs

#

but if there was something simpler

#

Basically I have solution but if there's anything better I can take a look at it

faint prism
#

so some pseudocode might be

myArray[0] = myArray[myArray.indexOf(myArray.random())]
tidal marlin
#

Yes but it can still be 0

#

It can't get the same index

faint prism
#

Right, you'll have to get creative there. See if you can exclude values from the .random() like a min and max

#

actually

#
myArray[0] = myArray.random()

This should be the same lol

tidal marlin
#

Probably

faint prism
#

idk the usage in js, but something like this maybe
<theArray>.random(1, <theArray>.length)

earnest phoenix
#

Arrays don't have a random() method

faint prism
#

then select a random valid index

tidal marlin
#

It can be myArray[Math.random()*number]

#

Obv also

pale vessel
#

fLoOr

tidal marlin
#

Math.round or floor

pale vessel
#

don't use round

tidal marlin
#

I don't

#

my numbers are for floor made with .999

pale vessel
#

can't you pick a random number and if it's the same index -1 or +1 it depending on the max and min value?

tidal marlin
#

No

#

Cause it may go out of index

#

oh

#

hold on

#

min max you say

pale vessel
#

that's why i said

tidal marlin
#

Like [0] as min and [size-1] as max

wicked pivot
#
bot.guilds.cache.get('534738699007557655').members.cache.filter(user => !user.roles.cache.get("535579900955066392") || !user.roles.cache.get("535579820088754178") || !user.roles.cache.get("662724365095403577"))```

this is supposed to list me the members who do not have the roles: 535579900955066392 535579820088754178 662724365095403577 ?
vague wigeon
earnest phoenix
#
<Guild>.members.cache.filter(m => ![<Role IDs>].some(r => m.roles.cache.has(r)));```
faint prism
tidal marlin
#

I'm trying to figure out what it does

#

Dunno if this somehow helps

faint prism
#
object[] arr = { "initial", "empty", "empty", "empty", "empty" };  // new array of strings
var rng = new System.Random();  // random number generator in C#
int rI = rng.Next(1,5);  // get a random number between 1-4
arr[0] = arr[rI];  // set arr[0] = arr[1-4]
#

This is essentially what it is

opal plank
#

wow

#

object array with strings?

faint prism
#

yeah ik ik

tidal marlin
#

Hmm, what if I told you that the first number is also random so I kinda can't simply do [0]

faint prism
#

It's the same principle just use a variable. But the way you get a random number would have to change

tidal marlin
#

I guess that's the answer

spice furnace
#

hy

#

who can help me?

#

the problem.

      let user = bot.users.cache.get(money[i].ID.split('_')[2]).username
``` username is undefined.
indigo flax
#

im discord.js

pale vessel
#

no you're austin

indigo flax
#

how come

#

for discord.js

#

it only

#

copies

#

stats.json

#

not any others

tidal marlin
#

It means the username from object you try to get is unavailable, so most likely your getting function is wrong or username doesn't exist in object @spice furnace

indigo flax
#

hey

#

marek

spice furnace
#

oh thanks

indigo flax
#

marek do u do discord.js

tidal marlin
#

Yeah?

indigo flax
eternal osprey
#

hey guys how can I make a bot that notifies once a new house sale is added from this site: https://map.gta.world

indigo flax
#

@eternal osprey api

eternal osprey
#

What api?

tidal marlin
#

website's api

indigo flax
#

idk if i need to add semicollens

eternal osprey
#

What if they don’t have one?

tidal marlin
#

@indigo flax Do you use json as DB?

indigo flax
#

yes

eternal osprey
#

hmm the site is made with leaflet tho.

eternal osprey
#

I once made a json database, I literally fucked it up so hard.

#

It literally got corrupted

indigo flax
#

@tidal marlin ik

#

ill get database soon

#

but for now im using that

#

so why doesnt the code work?

#

(had to put in pastebin since over 2,000 characters)

vague wigeon
#

Is Quickdb better than mongo?

faint prism
#

@tidal marlin here

using System;

public int GetRandomIndex(int cI, object[] arr, Random rng)
{
  var rI = rng.Next(arr.Length);
  if (rI == cI) return GetRandomIndex(cI, arr, rng);
  return rI;
}

var rng = new Random();
string[] myArr = { "a", "b", "c", "d", "e", "f" };
int i = rng.Next(myArr.Length-1);
return $"Random arr element: {myArr[i]}\nDifferent random arr element: {myArr[GetRandomIndex(i, myArr, rng)]}";

https://discordapp.com/channels/264445053596991498/265156286406983680/754756042981638206

tidal marlin
#

Cause function is getting overwrote

eternal osprey
#

depends

indigo flax
#

how do i fix it?

tidal marlin
#

Try using different names

indigo flax
#

ok

#

so like

faint prism
#

Not very efficient, but it'll get a different random index

indigo flax
#

instad of function backup

#

i do

#

function statsbackup

#

etc

tidal marlin
#

function backup_first

#

Or something else

indigo flax
#

ok thx

tidal marlin
#

just to not overwrite

indigo flax
#

ill tell u if it works

eternal osprey
#

Anyways, how can I make a bot that pings me on discord once a new house sale is added from this site ; https://map.gta.world

tidal marlin
#

Use api

eternal osprey
#

What api

#

The website doesn’t use one

faint prism
#

Scrape it periodically (if their TOS allow it)

eternal osprey
#

Well atleast, it is not stated on there website.

indigo flax
#

bruh

eternal osprey
#

okay so scraping.

indigo flax
#

who doesnt know what api is

eternal osprey
#

I do know what an api is you morron

faint prism
#

I think he said they don't have one @indigo flax

eternal osprey
#

I don’t know what api they use.

faint prism
#

It could be a private one

indigo flax
#

^

eternal osprey
#

exactly

indigo flax
#

ill look for it

eternal osprey
#

I know that they are using leaflet to get the map tho, but I don’t think that I can use it.

#

For my actual needs

indigo flax
#

@tidal marlin OOF now it says (node:24) UnhandledPromiseRejectionWarning: ReferenceError: backup is not defined at Client.<anonymous> (/home/container/server.js:81:15) at Client.emit (events.js:315:20) at WebSocketManager.triggerClientReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:431:17) at WebSocketManager.checkShardsReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:415:10) at WebSocketShard.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:197:14) at WebSocketShard.emit (events.js:315:20) at WebSocketShard.checkReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:475:12) at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:16) at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10) at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:125:16) (node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:24) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

#

rip

opal plank
#

define it

tidal marlin
#

Did you change all names?

indigo flax
#

yes

tidal marlin
#

Bruh

#

Show code again

indigo flax
#

alright

tidal marlin
#

After changes*

indigo flax
#

yea

tidal marlin
#

You know

#

setInterval(backup, 15000);

#

You should change those too

#

Like to match the function's name

indigo flax
#

alright

#

ty

opal plank
#

bruh

eternal osprey
#

cant I just scrape the website house sales? Using inspect element, getting the exact line from the site and then scrapin that?

opal plank
#

what am i looking at?

#

if(true) do stuff

tidal marlin
#

Intervals

opal plank
#

excuse me wtf

tidal marlin
#

It's high lvl

#

Only Hayper can understand

vague wigeon
tidal marlin
#

What if it's a disciple of Hayper

eternal osprey
#

Dat moment when Erwin pushed me to learn promisfying

indigo flax
#

@tidal marlin ty it works now

opal plank
indigo flax
#

i had to back it up cause it would courrupt sometimes

opal plank
#

also backup

wicked pivot
#

how to create a file with fs?

tidal marlin
#

Backup backup

eternal osprey
#

I still have no clue on how to notify once there is a new house sale added to this map https://map.gta.world

opal plank
#

@eternal osprey pushed? i pointed at gun at you, that shit was harmfull to the point of causing brain damage to the next poor weak soul who may have seen it

faint prism
tidal marlin
#

Why PUSH when I PULL

eternal osprey
#

Erwin

#

I am grateful that I learned that

pale vessel
#

Erlose 😔

eternal osprey
#

so I appreciate it.

opal plank
#

yw

eternal osprey
#

Next time, beat me up so I learn more again.

opal plank
#

will do

#

just a reminder

#

never

#

again

#

in

#

your life

#

do this

eternal osprey
#

Who

#

Is doing that

opal plank
#

if it starts looking like a rollercoaster, its bad

faint prism
#

Whops wrong ping

eternal osprey
#

oowh yeah

earnest phoenix
eternal osprey
#

That was fucked up

earnest phoenix
#

OMG

eternal osprey
#

erwin ffs

#

ERWIN

opal plank
eternal osprey
#

Delete that

faint prism
opal plank
#

i so saved it

vague wigeon
#

My brain ....

tidal marlin
#

Bruh

#

Who did that

opal plank
#

im using this as example of what NOT to do in js

#

dunno

eternal osprey
#

I did

opal plank
#

not pointing fingers

#

just keeping the prime example

tidal marlin
#

bruh VARS

eternal osprey
#

var markers?

faint prism
#

There you go, awesome. That PHP contains every listing lol

#

So you can scrape that and compare it with the entries in your own database or something

vague wigeon
faint prism
#

and alert on differences

opal plank
#

vars, multiple addField(), callback hell, multiple useless variables

faint prism
#

boom done

opal plank
#

it has literally everything it could to be wrong

eternal osprey
#

I will try to scrape it in a moment.

#

Well I understand that part

#

But how to actually notify if there is a new house added?

#

Like what should I compare with what?

tidal marlin
#

event?

vague wigeon
#

Always check !?

faint prism
#

I will try to scrape it in a moment.
@eternal osprey wow it's actually JSON already too

#

lucky you, that's basically an api response

wicked pivot
#

how to copy an entire json and write it to another json? (json backup)

opal plank
#

array of arrays

eternal osprey
#

bro I am a dumbass. Idk wether to cry or be happy

opal plank
faint prism
#

how to copy an entire json and write it to another json? (json backup)
@wicked pivot like a json file...?

opal plank
#

fsRead then fsWrite

#

fsRead reads the file, just stringify the output and then write the new file

#

though i must say

#

whatever you doing, its liekly not a good idea

#

what are the JSON's for?

faint prism
#

why backup a json file via the actual script?

opal plank
#

cof cof database cof cof

faint prism
#

^ lol I bet

wicked pivot
#
var info = require('../data/info.json');

fs.writeFile(`./backup/${moment().format("DD-MM-YYYY")}.json`, info, function(err){
        if(err) throw err
    })```
tidal marlin
#

mongo cof cof

vague wigeon
#

Quickdb

opal plank
#

100% database

faint prism
#

looks mutable (ie. bad use of json)

opal plank
#

if you going to be storing that many, use database for your own sake

misty sigil
#

use a database

earnest phoenix
tidal marlin
#

Just tell them to look into pins

misty sigil
#

that isnt pinned, marek.

tidal marlin
#

It is

wicked pivot
#

I have a web host with 500 gb of storage and the files that will be useless will be deleted

misty sigil
#

no it isnt

#

the free host is

tidal marlin
#

Oh

#

So talk to the mods

faint prism
#

this is my stats xD
why are you not doing issue tracking and PR to double check your code?

tidal marlin
#

Me?

earnest phoenix
#

cuz i don't how to do it

opal plank
#

github

eternal osprey
#

hey augin

opal plank
#

i need to use it more often

earnest phoenix
#

and there are no issue in my issue section

pale vessel
#

mods1mods2mods3mods4 pin this man's message

eternal osprey
#

@faint prism what is that site where you found the json?

pale vessel
earnest phoenix
eternal osprey
#

i know

#

but he showed like a whole database

faint prism
opal plank
#

im also very smart,i do catch(() => {}). Cant have issues if there are no errors in console WeSmart

pale vessel
#

yes it's the source

earnest phoenix
#

@faint prism from where?

opal plank
#

git kraken

faint prism
#

Keep a neat SDLC

opal plank
tidal marlin
#

I commited like week ago

misty sigil
#

git kraken?

#

its ksp but git

opal plank
#

git kraken is hella dope

faint prism
#

but he showed like a whole database
@eternal osprey what

eternal osprey
#

look

#
const request = require('request');
request('https://map.gta.world/4sale.php', function (error, response, body) {
  console.error('error:', error); 
  console.log('statusCode:', response && response.statusCode); 
  console.log('body:', body); 
});```
tidal marlin
#

But is it terminal? @opal plank

faint prism
#

var markers is the json for every house listing

eternal osprey
#
var dataStreets = [
            // Los Santos County
            {"loc":[-2836.0,674.8], "title":"Abattoir Avenue"},
            {"loc":[138.1,-641.9], "title":"Abe Milton Parkway"},
            {"loc":[496.3,-1723.3], "title":"Ace Jones Drive"},
            {"loc":[-1131.7,-17.5], "title":"Adam's Apple Boulevard"},
            {"loc":[-1407.6,-1144.1], "title":"Aguja Street"},
            {"loc":[-111.9,183.1], "title":"Alta Place"},
            {"loc":[-555.5,-59.7], "title":"Alta Street"},
            {"loc":[-74.0,22.70], "title":"Amarillo Vista"},
            {"loc":[-1735.4,1285.6], "title":"Amarillo Way"},
            {"loc":[57.3,-1546.8], "title":"Americano Way"},
            {"loc":[-957.9,373.1], "title":"Atlee Street"},
            {"loc":[-2063.1,-860.6], "title":"Autopia Parkway"},```
opal plank
#

@tidal marlin its a GUI client

eternal osprey
#

i could use these right

tidal marlin
#

Meh

pale vessel
#

yes

tidal marlin
#

Not interested

latent cargo
#

Hi

faint prism
#

Yeah, there is more data there though, like prices and such

eternal osprey
#

yeah i know

pale vessel
#

store it somewhere and check it periodically and see if there's any change between the new one and the one you stored

eternal osprey
#

but that is easy to do

faint prism
#

What are you asking

eternal osprey
#

how can i actually check if there is a new listing?

pale vessel
#

ignored 😔

opal plank
#

definetly check worthy

earnest phoenix
#

@faint prism how i can connect kraken to my repo ?

opal plank
#

at the very least

faint prism
#

how can i actually check if there is a new listing?
@eternal osprey the count of array

#

@faint prism how i can connect kraken to my repo ?
@earnest phoenix idk I use Azure DevOps

earnest phoenix
#

and wtf is that

#

nvm

#

im done

eternal osprey
#

Owh

#

yeah ofc.

faint prism
#

😛 gl

earnest phoenix
#

my brain expose

#

💥

latent cargo
#

EWpoor

#

Who plays fortnite

misty sigil
#

not me

pale vessel
#

poggers go to general channels

opal plank
#

^^

misty sigil
#

^^^^

opal plank
#

specially with fortnite tanjirocringe

latent cargo
#

Why

misty sigil
opal plank
#

cuz this channel is for development

#

are you developing anything fornite related that you need help with?

faint prism
#

Why
@latent cargo why did you immediate call me?

pale vessel
#

and fortnite doesn't help in human development either

faint prism
misty sigil
#

LFMAO

vague wigeon
#

Done

eternal osprey
#
console.log(dataStreets.length);```
#

auger

#

he called me too

opal plank
#

no one calls me sadcat

vague wigeon
#

Done

eternal osprey
#

asking if i play fortnite lmao

misty sigil
#

lmfao

#

whos he gon call next

vague wigeon
#

Can i call with u?

misty sigil
#

no

opal plank
#

no 2

tidal marlin
vague wigeon
#

Done

opal plank
#

@vague wigeon spam elsewhere

eternal osprey
#

something is off

#

about my code

faint prism
#

uh

opal plank
#

pastebin

faint prism
#

did you just copy it into a variable

#

why not fetch it, parse the one variable's JSON into a variable

opal plank
#

^^

eternal osprey
#

cuz this is easier i guess?

faint prism
#

It really isnt

opal plank
#

also `` unecessarily

#

thou arent doing template

pale vessel
#

pastebin? nah use paste.awoo.rocks

eternal osprey
#

it is necessary

opal plank
#

its not

earnest phoenix
#

pastebin is full of trackers and adware

opal plank
#

`` is used for ${}

eternal osprey
#

okay erwin

opal plank
#

' or "

eternal osprey
#

i know

opal plank
#

if you dont change it

earnest phoenix
#

so it'd be nice if you could use any other bin than pastebin

opal plank
#

otherwise the compiler expects for something

misty sigil
#

like even fucking use paste.awoo.rocks or some shit

#

not pastebin

opal plank
eternal osprey
#

there you go

opal plank
#

much better

misty sigil
#

why is an object

#

in a string

#

aea

opal plank
#

ikr!

#

and `` ontop of it

eternal osprey
#

i was just wanting to check how much houses the list containss of

faint prism
eternal osprey
#

auger

#

you wanna see my conversation ffs?

misty sigil
#

seems like he's like 3 year old

vague wigeon
eternal osprey
opal plank
#

yikes

vague wigeon
#

Wtf

misty sigil
#

nice a 10 year old

eternal osprey
#

lovely.

misty sigil
#

ban time ban time

opal plank
#

10 TOS

faint prism
#

before I rape you
waitWhat

opal plank
#

@faint prism where is that?

faint prism
vague wigeon
opal plank
#

oh

misty sigil
#

bRUh

eternal osprey
#

uhh

faint prism
#

_>

eternal osprey
#

autocorrect

#

i wanted to say something else

vague wigeon
#

I dont think so

slender thistle
#

Keep this channel on topic

faint prism
#

@eternal osprey but yeah, just scrape that one variable
||before mods request on topic||

#

damn

#

shiv beat me to it

opal plank
#

back to saying how bad that snippet is

eternal osprey
#

i know erwin

#

i just wanted to know the length of the variable

opal plank
#

you have an eval,no?

#

eval [2,2,3,4].length

#

no need for console log or variables

eternal osprey
#

anyone know some docs about scraping etc.?

#

this is my first time really scraping a website.

faint prism
#

anyone know some docs about scraping etc.?
@eternal osprey fetch and regex

opal plank
#

both of which i hate

restive furnace
#

or just fetch and look the stuff ya looking for

eternal osprey
#

okay so i gotta use fetch to scrape the variable from the website? and than comparing that list length to the base?

opal plank
#

didnt the api you touch gave you that already?

#

or that auger touched, for that matter

faint prism
#

eh, I'd scrape -> regex the variable's JSON -> store object -> setInterval to do again -> compare new length to old length -> set new to old -> notify on change

opal plank
#

do that but emit events

#

handling updates with events is cooler

#

emit an event with the new elements in it

charred geyser
#

how do i .overwritePermissions for a role?

#

i am trying to message.channel.overwritePermissions(muterole, { SEND_MESSAGES: false, ADD_REACTIONS: false, });

earnest phoenix
#
message.guild.channels.forEach(async (channel, id) => {
                        await channel.createOverwrite(muterole, {
                            SEND_MESSAGES: false,
                            ADD_REACTIONS: false,
                            SEND_TTS_MESSAGES: false,
                            ATTACH_FILES: false,
                            SPEAK: false,
                        });
                    });

@charred geyser ^^

charred geyser
#

lob u ace

#

you da best :3

earnest phoenix
#

:))

charred geyser
#

your indents were a bit off tho ;) :)))

#

lmao

#

lyl

sullen frost
#

does someone knows about vsc? ._.

earnest phoenix
#

yes

charred geyser
#

og also

#

message.guild.channels.cache.forEach(async (channel, id) => {*

#

you forgot the cache

#

im pretty sure it is necessary

#

🤷

earnest phoenix
#

uhhh imma fix that

opal plank
#

for() loop

charred geyser
#

no.

#

its ok

#

ace was right apart from the cache

#

i got it working 😄

restive furnace
opal plank
#

i wasnt referring to that

#

only to the method to use

#

for() is most of the time a better iterator

charred geyser
#

uh

#

okay

faint prism
#

I did it here

using System;
using System.Net;
string html;
using (var client = new WebClient())
{
  html = client.DownloadString(new Uri("https://map.gta.world/4sale.php"));
}
int a = html.IndexOf("[[");
int b = html.IndexOf("]]");
return $"Start of JSON: {a}\nEnd of JSON: {b}\nTotal PHP length: {html.Length}\nJSON Length: {b-a}\n{html.Substring(a, 500)}....";```
#

So the main takeaway is the indexes

#

fortunately [[ and ]] only appear once in the php

#

so it's ridiculously easy to scrape the JSON

eternal osprey
#

hmm okay

#

i will try that out

#

are you using python?

#

i have done something different

faint prism
#

If you quote my code snippet it's C#

eternal osprey
#

i have basically done something else

#

i first scraped the website

#

to check the locations

#

so i could use them as a base to compare to.

#
var cheerio = require('cheerio');
var Discord = require('discord.js');
var PREFIX = ('!')
var dataStreets = require('./data');
            
            

        
    
console.log(dataStreets);```
#

this is what i have now

#

i have put all the houses in a different folder.

#

would this work?

faint prism
#

Do you want the dataStreets or the house listings?

eternal osprey
#

house listing..

#

wait

faint prism
#

dataStreets is something else lol

eternal osprey
#

the datastreets are the house listings right

#

'fucking hell

faint prism
#

no var markers is not dataStreets

#

markers is [["2015","926 Las Lagunas Boulevard, Apt. 2","115000","1",...

eternal osprey
#

oooowh

#

it is called var markers

#

i am stupid ffs

faint prism
#

don't scrape it manually and save to a file

eternal osprey
#

oowh

faint prism
#

it defeats the point

eternal osprey
#

yeah i don't know how to do it else tbh.

faint prism
#

I literally showed you what to do

eternal osprey
#

I did it here

using System;
using System.Net;
string html;
using (var client = new WebClient())
{
  html = client.DownloadString(new Uri("https://map.gta.world/4sale.php"));
}
int a = html.IndexOf("[[");
int b = html.IndexOf("]]");
return $"Start of JSON: {a}\nEnd of JSON: {b}\nTotal PHP length: {html.Length}\nJSON Length: {b-a}\n{html.Substring(a, 500)}....";```

@faint prism this?

#

this is c#

#

i am using javascript

faint prism
#

it's the same idea

#

yeah

  1. fetch the php file
  2. scrape out the json uses the indexes based on the characters [[ and ]]
  3. store into a variable
  4. setInterval to check occassionally
  5. if old.length < new.length; alert you; old = new
  6. setInterval will loop the logic at some point
#

@eternal osprey and boom, done

eternal osprey
#

yeah i'll look through the fetch docs first.

pliant iron
#

Is anyone here familiar with creating npm packages?

worn badge
#

hey can anyone help me with getting the total member count for my bot on discord.js?
i tried client.users.cache.size but it keeps changing by massive amounts everytime i run the command thinkderp

sudden geyser
#

client.users stores all cached users. If you want the total member count of every guild, iterate over client.guilds.cache and add up the .memberCount property.

earnest phoenix
#

sum up your guilds' memberCount prop

#

^^

worn badge
#

ah alright ty

worn badge
#

would something like this work? (sorry im new to js xD)

            client.guilds.cache.forEach((guild) => {
              let guildm = guild.memberCount
              totalmembers = totalmembers + guildm
            });```
because it gave me a massive number for just 140 guilds ![thinkderp](https://cdn.discordapp.com/emojis/683236964455153686.webp?size=128 "thinkderp")