#development
1 messages · Page 1239 of 1
@earnest phoenix how can i change the null message to no?
@clear arrow Basics of javaScript's syntax
@earnest phoenix how can i change the null message to no?
member.premiumSince || 'No'?
since yesterday
yes
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
thats why i hate pm2
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
ok
aw ok :))
<GuildMember>.premiumSince ? <GuildMember>.premiumSince : "No";```
thanks!
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 
BRUH NVM
it is a rule
alright
in programming
i found error
: ))
USE
iIN 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
.includes('.jpg' || '.png' || '.jpeg') is a thing?
No
i dunno how to use that
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

it is a rule
its not a rule if it works the same way
I would like to use A if it works for my code
i in a for loop stands for index, that's why most use it
yes
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
i got an error in my code but i dont want to share it here because all of you will roast me
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
tied with ruLeS
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
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:
@carmine summit I am a bit late, what r u trying to make?
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
wow
uh
why j
So if i is in use
i only accept i, x and y
i = iterator, j = ???, x = for nested loops, y = for nested loops
Best loop variable team
1- i
2- j
3- x
4- y
5- p```
i = iterator, j = ???, x = for nested loops, y = for nested loops
@restive furnace
i in a for loop stands forindex, that's why most use it
@earnest phoenix
So, who's right?
in c++ we always talk about iterators, so ¯\_(ツ)_/¯
ok, I think iterator is fine
But original is index
is it was index for PHP and Iterator for C?
indexes are used in arrays and things, like array[69], and iterator, well you iterate through some object
what does ns prefix stand for?
is it was index for PHP and Iterator for C?
i guess
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
what does ns prefix stand for?
@stable eagle nameserver prefix???
screenshot what you mean
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
[i, x, y, I, X, Y] => What I use```
it's nameserver
@earnest phoenix Does this look like not working to you
i didn't add {embed: embed}
what is the diffrent between Map() and Collection() ?
Nothing, Collection is just an extended version of Map
uhh
Map() used in node, right?
yeah, that's what I mean.
Map
What
try again
you adding the bot != the bot getting approved
how to remove a specific object from an array using .splice ?
do you understand what you just asked
yes?
do you understand what splice does
do you mean slice?
there's slice and splice
i just want to remove an object withuot creating holes
<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
how
js should have indexOf
how
it takes 5 seconds to do this
dont know how google works
i didn't ask
you joking or serious
Show code and error
If JS and JSFuck were to be used in the same file.

@earnest phoenix remove { one at a time until the error disappears
try opening the file
@earnest phoenix Are you
@earnest phoenix remove { one at a time until the error disappears
I would try putting in rice
@carmine summit it's going to take a lot more to do that
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
shutdown /s /t 0
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
what
(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
don't troll
actually
what if we actually exceed event emitter
can we incease the limit?
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) {
message.guild is null. There are a few ways that could happen, such as running a command in a DM.
can anyone help me with running a nodejs app with ngnix
You should check if it's null before trying to use it.
message.guildisnull. 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
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.
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
if (message.guild) {...}
so that test isnt good enough?
execute(message, args) {
if(message.guild) {
// Execute command
}
}
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
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`
.env doesnt have ""
How do I make it so my bot updates its status overtime?
.env doesnt have ""
@misty sigil they can
they can?
They can, but I think it'll intercept the "" as being included in the string
It's correct to have PREFIX=r!
how to ping my bot? heroku
last time i used .env it returned "token" and not token
how to ping my bot? heroku
@vague wigeon make a ping command and reply with the latency
@misty sigil what if its a Python project?
I have a bot with Discord.PY, so a JS thing might be a bit hard...
just use the same sort of thing
Ok
@leaden rover I think an asyncio task is what you'll want (https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html)
i think using python will have higher performance than js
but also depends on your skills
Interpreted languages like Python and JS are quite slow, but when you're using Python, you're often weighing productivity over speed.
ok
Python is fast-deployment so
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);
it's a member object so that turns into the mention when stringified
use member.user.tag
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?
uheasdiopq
Bad idea to load extensions in on_ready because that can fire multiple times
Better to load when the bot starts, rather than on the 'ready' event
I don't see where it changes its status "a lot" though
Ok
Will this work?
bot.loop.create_task(bot.run('TOKEN', bot=True, reconnect=True))```
Ok
I'd suggest just updating the status once a member leaves or joins a guild @leaden rover
Ok
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
Ok
My bot also has send command but only direct message to author (me), is it accepted?
That sounds fine to me
let muteTarget = message.mentions.users.first();
muteTarget.addRole(settings.muteRole);
TypeError: muteTarget.addRole is not a function
hope so
They can, but I think it'll intercept the
""as being included in the string
@sudden geyser no
incorrect
oh iits addrole dw
# they are the same
KEY='value'
KEY=value
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
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
Set make the bot lagging ?
what
Set
const set = new Set();
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
even in command handler ?
no
k thx
i mean why would it
@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
It’s usually because you use message.author instead of message.member but I’m not sure in your case
this is what it returns
the ClientUser is correct
im pretty sure that is the right object?
no
oh
roles is a member of a guildmember object
Yes
message.mentions.members.first() i guess
Bruh moment
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
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
yo
yo wassup
@earnest phoenix need any help?
let role = message.guild.roles.cache.find(
(r) => r.name === settings.muteRole
);
returning undefined 
message.guild.roles.cache.find is the right way to get a role isnt it?
yeah
settings.muteRole returns the correct string too
ye
u better do it to ID
i do name so that people can change it easy in the dashboard
cuz roles name could be same
const muterole = message.guild.roles.cache.find(x => x.name === "Muted")
``` this is what i use
uh
oh wait
maybe just ==
nope
Muted
undefined
this is what it logs
Muted is settings.muteRole
what library?
Why not set a variable for roles.cache, hit a breakpoint, and find out what it the object looks like
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
x => x.name.toLowerCase().includes("muted");
why not just use message.guild._roles?
x => x.name.toLowerCase().includes("muted");
@vague wigeon i am using settings.muteRole as my name btw
also i dont really wanna do includes
why
cause that would mean if you had roles including the same string as mute role it would fuck up
like
So what are you guys mainly trying to accomplish
muted1 muted2
settings.muteRole should be roleid
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"
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?
bruh
@wicked pivot If you want to filter it by members that has one or more roles use the filter() method
why not roleid?
Wot?
I think role name can be changed but id is fixed!?
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
and id
Yea said it
and will need to set muted role again if it is renamed
I have to filter and then map?
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
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 :```[]```
Means there was no members with a role size of 1
the everyone role is also counted in roles iirc
Yes
the problem is that if
not everyone counts as a roles?
@everyone is a role
ahhhh okay
Everyone counts as a role
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
that everone has
@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
@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)
.send returns a Message object. Apply it to a variable and then use .delete() on it
Mhm
Alright, thanksies 
👍
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
Are you sure it's not a zero-width-space by some random to God chance?
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
inb4 it's a webhook message
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?
How can i make a database in python 3?
oups xD
How can i make a database in python 3?
@wild thistle you have many options. sqlite3, quick.db, mongodb, sql
ok ty
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?
yeah, I got that
I'm trying to receive different number than the one it got on the first one
so, does that mean you want something in a different index in the array?
so instead of arr[i] or want arr[j] for example?
let user = bot.users.cache.get(money[i].ID.split('_')[2]).username
``` What is wrong?
are you asking for a for loop?
Not exactly
i don't get it
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
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
so what auger said
that [!0] doesnt make sense though
Yes I know
Yes
Okay, now we are getting somewhere
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
so some pseudocode might be
myArray[0] = myArray[myArray.indexOf(myArray.random())]
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
Probably
idk the usage in js, but something like this maybe
<theArray>.random(1, <theArray>.length)
Arrays don't have a random() method
then select a random valid index
fLoOr
Math.round or floor
don't use round
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?
that's why i said
Like [0] as min and [size-1] as max
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 ?
<Guild>.members.cache.filter(m => ![<Role IDs>].some(r => m.roles.cache.has(r)));```
Are you describing something like this?
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
yeah ik ik
Hmm, what if I told you that the first number is also random so I kinda can't simply do [0]
It's the same principle just use a variable. But the way you get a random number would have to change
hy
who can help me?
the problem.
let user = bot.users.cache.get(money[i].ID.split('_')[2]).username
``` username is undefined.
im discord.js
no you're austin
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
oh thanks
marek do u do discord.js
Yeah?
https://hasteb.in/nufiwucu.php
how come
for discord.js
it only
copies
stats.json
not any others
hey guys how can I make a bot that notifies once a new house sale is added from this site: https://map.gta.world
@eternal osprey api
What api?
website's api
@tidal marlin
https://hasteb.in/nufiwucu.php
how come
for discord.js
it only
copies
stats.json
not any others
idk if i need to add semicollens
What if they don’t have one?
@indigo flax Do you use json as DB?
yes
hmm the site is made with leaflet tho.
I once made a json database, I literally fucked it up so hard.
It literally got corrupted
@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)
Is Quickdb better than mongo?
@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
Cause function is getting overwrote
depends
how do i fix it?
Try using different names
Not very efficient, but it'll get a different random index
ok thx
just to not overwrite
ill tell u if it works
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
Use api
Scrape it periodically (if their TOS allow it)
Well atleast, it is not stated on there website.
bruh
okay so scraping.
who doesnt know what api is
I do know what an api is you morron
I think he said they don't have one @indigo flax
I don’t know what api they use.
It could be a private one
^
exactly
ill look for it
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
@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
Did you change all names?
yes
alright
After changes*
You know
setInterval(backup, 15000);
You should change those too
Like to match the function's name
bruh
cant I just scrape the website house sales? Using inspect element, getting the exact line from the site and then scrapin that?

What if it's a disciple of Hayper
@tidal marlin ty it works now
i had to back it up cause it would courrupt sometimes
also backup
how to create a file with fs?
Backup backup
I still have no clue on how to notify once there is a new house sale added to this map https://map.gta.world
@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
@indigo flax https://map.gta.world/4sale.php
This looks like it contains the data you want
Why PUSH when I PULL
Erlose 😔
so I appreciate it.
yw
Next time, beat me up so I learn more again.
if it starts looking like a rollercoaster, its bad
Whops wrong ping
oowh yeah
WHAT THE HECK IS THIS
That was fucked up
OMG

Delete that
I still have no clue on how to notify once there is a new house sale added to this map https://map.gta.world
@eternal osprey https://map.gta.world/4sale.php @ thevar markers
i so saved it
My brain ....
I did
bruh VARS
var markers?
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

and alert on differences
vars, multiple addField(), callback hell, multiple useless variables
boom done
it has literally everything it could to be wrong
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?
event?
Always check !?
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
how to copy an entire json and write it to another json? (json backup)
array of arrays
bro I am a dumbass. Idk wether to cry or be happy

how to copy an entire json and write it to another json? (json backup)
@wicked pivot like a json file...?
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?
why backup a json file via the actual script?
cof cof database cof cof
^ lol I bet
var info = require('../data/info.json');
fs.writeFile(`./backup/${moment().format("DD-MM-YYYY")}.json`, info, function(err){
if(err) throw err
})```
mongo cof cof
Quickdb
100% database
looks mutable (ie. bad use of json)
if you going to be storing that many, use database for your own sake
use a database
this is my stats xD
that isnt pinned, marek.
It is
I have a web host with 500 gb of storage and the files that will be useless will be deleted
this is my stats xD
why are you not doing issue tracking and PR to double check your code?
Me?
cuz i don't how to do it
github
hey augin
i need to use it more often
and there are no issue in my issue section



pin this man's message
@faint prism what is that site where you found the json?
look no issue (cuz this is private xD)
cuz i don't how to do it
@earnest phoenix
im also very smart,i do catch(() => {}). Cant have issues if there are no errors in console 
yes it's the source
@faint prism from where?
git kraken
Keep a neat SDLC

I commited like week ago
git kraken is hella dope
We're delighted to present performance improvements and tabs in the v6.0 release, presenting you a (much) faster Git Client! To get the latest version of GitKraken, the Git GUI client for Windows, Mac and Linux, download it Free at: https://bit.ly/2IAXpZB
Learn more about the...
but he showed like a whole database
@eternal osprey what
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);
});```
But is it terminal? @opal plank
var markers is the json for every house listing
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"},```
@tidal marlin its a GUI client
i could use these right
Meh
yes
Not interested
Hi
Yeah, there is more data there though, like prices and such
yeah i know
store it somewhere and check it periodically and see if there's any change between the new one and the one you stored
but that is easy to do
What are you asking
how can i actually check if there is a new listing?
ignored 😔
definetly check worthy
@faint prism how i can connect kraken to my repo ?
at the very least
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
😛 gl
not me
go to general channels
^^
^^^^
specially with fortnite 
Why
go to discord.gg/fortnite for fortnite
cuz this channel is for development
are you developing anything fornite related that you need help with?
if not, well, #general
Why
@latent cargo why did you immediate call me?
and fortnite doesn't help in human development either
LFMAO
Done
no one calls me 
Done
asking if i play fortnite lmao
Can i call with u?
no
no 2
Done
@vague wigeon spam elsewhere
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
something is off
about my code
uh
did you just copy it into a variable
why not fetch it, parse the one variable's JSON into a variable
^^
cuz this is easier i guess?
It really isnt
pastebin? nah use paste.awoo.rocks
it is necessary
its not
pastebin is full of trackers and adware
`` is used for ${}
okay erwin
' or "
i know
if you dont change it
so it'd be nice if you could use any other bin than pastebin
otherwise the compiler expects for something
much better
i was just wanting to check how much houses the list containss of
yeah idfk lol
seems like he's like 3 year old

yikes
Wtf
nice a 10 year old
lovely.
ban time ban time
10 TOS
before I rape you

oh
bRUh
uhh
_>
Keep this channel on topic
@eternal osprey but yeah, just scrape that one variable
||before mods request on topic||
damn
shiv beat me to it
back to saying how bad that snippet is
anyone know some docs about scraping etc.?
this is my first time really scraping a website.
anyone know some docs about scraping etc.?
@eternal osprey fetch and regex
both of which i hate
or just fetch and look the stuff ya looking for
okay so i gotta use fetch to scrape the variable from the website? and than comparing that list length to the base?
didnt the api you touch gave you that already?
or that auger touched, for that matter
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
do that but emit events
handling updates with events is cooler

emit an event with the new elements in it
how do i .overwritePermissions for a role?
i am trying to message.channel.overwritePermissions(muterole, { SEND_MESSAGES: false, ADD_REACTIONS: false, });
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 ^^
:))
does someone knows about vsc? ._.
yes
og also
message.guild.channels.cache.forEach(async (channel, id) => {*
you forgot the cache
im pretty sure it is necessary
🤷
uhhh imma fix that
for() loop
Discord.NET vs DSharpPlus?
i wasnt referring to that
only to the method to use
for() is most of the time a better iterator
okay so i gotta use fetch to scrape the variable from the website? and than comparing that list length to the base?
@eternal osprey https://discordapp.com/channels/264445053596991498/265156286406983680/754771871299272745
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
hmm okay
i will try that out
are you using python?
i have done something different
If you quote my code snippet it's C#
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?
Do you want the dataStreets or the house listings?
dataStreets is something else lol
no var markers is not dataStreets
markers is [["2015","926 Las Lagunas Boulevard, Apt. 2","115000","1",...
don't scrape it manually and save to a file
oowh
it defeats the point
yeah i don't know how to do it else tbh.
I literally showed you what to do
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
it's the same idea
yeah
- fetch the php file
- scrape out the json uses the indexes based on the characters
[[and]] - store into a variable
- setInterval to check occassionally
- if old.length < new.length; alert you; old = new
- setInterval will loop the logic at some point
@eternal osprey and boom, done
yeah i'll look through the fetch docs first.
Is anyone here familiar with creating npm packages?
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 
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.
ah alright ty
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 










