#development

1 messages · Page 1569 of 1

quartz kindle
#

oh mongoose was made by automattic?

#

cool

#

(fuck mongoose but cool)

solemn latch
#

i recognize the name, wheres it from 🤔

quartz kindle
#

node-canvas

solemn latch
#

OH

quartz kindle
#

when you try to benchmark something but js is too smart

agile lance
#

agreed ^^

opal plank
#

@gilded olive i just lost all respect for you. After explicitly stating i didnt want people blatently copying the stuff i made, you went out of your way to make a package that does EXACTLY what i worked to do. Thanks

quartz kindle
#

wut, where

gilded olive
#

dude its just a joke 🤣🤣

opal plank
#

i dont think its funny at all

#

same ascii that i do for my bots, same presence, ya trying to blatently plagiarise what i do?

#

yikes

mellow kelp
#

bruh moment

#

wait is that actually the same font that you used

quartz kindle
#

wait is it just the ascii art or the whole package?

modest maple
#

I mean... is it OS?

opal plank
#

the whole package is built to literally do the same thing im doing

#

he went out of this way to build a shitty package ontop of this

mellow kelp
#

ew

opal plank
#

to look like mine

#

just to "joke" at me

modest maple
#

I mean again... If its Open source with a OSS licenses then shrug Most licenses let you do that with crediting the original author

#

if its not licensed then CoffeeSip

#

low key though this only a little python script

#

hardly worth getting upset about

quartz kindle
#

which makes me wonder, should i maybe stop using MIT on my libs

#

xD

mellow kelp
#

hmm

#

what did MIT state again?

quartz kindle
#

pretty much do whatever you want

modest maple
#

pretty much do what ever but the repo's must use the MIT license and credit the author

mellow kelp
#

i guess that's fine to me

modest maple
#

you could go one of the anti-cloud licenses just to fuck the cloud companies mmLol

#

like mongo went and did

mellow kelp
#

kekw

quartz kindle
#

the repos dont need to use MIT

#

they just need to have a copy of my MIT somewhere in their code

modest maple
#

Just make your repo un-licensed so no one can use it mmLol

quartz kindle
#

xD

mellow kelp
#

big brain

quartz kindle
#

make unlicensed lib

#

publish on npm

#

watch people download

#

sue

#

profit

modest maple
#

profit mmLol

#

though im guessing npm will have some sort of protection for that

#

not that it'd stand any legal ground in the first place cuz i mean you uploaded

gilded olive
#

I can delete it if you want, it dosent even do what yours does
,its really meant to just use it easily

modest maple
quartz kindle
#

lmao

modest maple
quartz kindle
#

sounds like something an indian would do

#

no offense

modest maple
#

best part

quartz kindle
#

xD

modest maple
alpine coyote
modest maple
#

cool, but we dont care

mellow kelp
#

chill out pEnSiVe

#

the guy was just showing a thing

modest maple
mellow kelp
#

um ok

alpine coyote
alpine coyote
gilded olive
#

private/private orgs are where these are used

modest maple
#

yeah i doubt to a level where its actually worth putting them on mmLol

earnest phoenix
#

i hate people with over the top profiles like god just say you want to work for FAANG

mellow kelp
#

lmao yes

modest maple
#

then again when ever i see a repo that padded its usually a "well i used it like once" type thing

#

"Oh boys im a core maintainer for Python cuz i did a commit" mmLol

mellow kelp
#

like, "dude are you a programming god? you can code in ALL of these languages and use ALL of these technologies!"

#

"what's the point in learning to code if there are people out there who know absolutely everything there is to coding"

sterile lantern
#

im testing some website stuff but uh

#

it doesnt upload onto the web

#

and yes its a static web

mellow kelp
#

sometimes it takes a while

sterile lantern
#

hmm

mellow kelp
#

rip

#

you gotta add some A records i think

sterile lantern
#

ive never heard of that

#

what exactly do i do ?

#

the only thing i know about website config is CNAME

mellow kelp
#

wait im searching for something

sterile lantern
#

k

#

i also want to enforce https

mellow kelp
#

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

#

these IPs

#

add them as A records

sterile lantern
#

all in one or seperately

mellow kelp
#

for each one, leave the name in blank and set the ip to the target

#

separated

#

then you gotta add the CNAME thing

sterile lantern
#

what do i put in cname

#

my website name?

#

or github stuff

mellow kelp
sterile lantern
#

ah

mellow kelp
#

wait you mean the CNAME file or the record?

sterile lantern
#

uh

#

record

#

and wait

#

do i add the CNAME to github

#

or to the website thing

mellow kelp
#

there should be a CNAME file on your repo

#

containing the custom domain

sterile lantern
#

ah

#

ok

mellow kelp
#

but i think github adds it when you set the domain anyways

lyric mountain
#

iirc

sterile lantern
#

same issue

modest maple
#

so fucking confusing

gilded olive
#

They are all langs I learn and want to become prof in, so i put them there

quartz kindle
lyric mountain
#

very descriptive

modest maple
#

I mean

#

yeah the dude who made that issue was

#

well lets say they defo wernt a github user often

#

especially after we closed their original issue saying to go to the support server

sterile lantern
#

how would i make domain secure

#

its http not https

#

does cloudfare do it for us

modest maple
#

well for it to be secure between you and cloudflare it still takes work on your behalf using TLS

sterile lantern
#

what exactly do i need to do

#

i think i need to config stuff in domain

#

lel

modest maple
#

need to set up SSL on your given server

sterile lantern
#

SSL?

#

eek

modest maple
#

with a given cert and key file as a bare minimum

#

time for google™️

#

You know you're lib started to become thicc when this is the smallest amount of internal imports blobpain

fierce ether
#

const sendAcceptOrDecline = await Promise.all([playerOne.send(AcceptOrDeclineOne), playerTwo.send(AcceptOrDeclineTwo)]) how can i add a reaction to both?

prime fox
#

can someone help me with express passport

#

i login successfuly

#

and if i were to make another callback in "/discord/redirect" then i would be able to access req.user

#

however i redirect to the test route and somehow req.user is undefined

#

and yes

#

i do have these stuff

sudden geyser
vivid cedar
#

I cant afk message

#

somebody help me?

lyric mountain
#

No question no help

smoky herald
#

.....
How the f*** do I even shutdown my app after the implemented sharding, I just terminate with ctrl+c but it obivously shuts just one shard or idk, the logs just keep poppin

opal plank
#

one option is to close it with task manager(all node-js apps) or htop and send a SIGKILL signal to all of em' @smoky herald

smoky herald
shy turret
#

I've been using https://anonfiles.com/docs/api ...

          let form = new FormData();
          let stats = fs.statSync(zippath);
          form.append('field-name', fs.createReadStream(zippath), { knownLength: stats.size });
          let options = {
            method: 'POST',
            credentials: 'include',
            body: form    
          }
          let uploadFile = await fetch("https://api.anonfiles.com/upload", { ...options });
          if (uploadFile.ok == true) {
            res.send({
              error: "none",
              response: await uploadFile.json()
            });
          } else {
            res.send({
              error: "An error has occured when requesting anonfiles.",
              response: await uploadFile.json()
            });
          }
#

but i keep getting

{
        "status": false,
        "error": {
            "message": "No file chosen.",
            "type": "ERROR_FILE_NOT_PROVIDED",
            "code": 10
        }
}
#

when i literally add the file... in the body

smoky herald
opal plank
#

ask anyone here about what i fucked with in sharding, you'll have a giggle

smoky herald
#

I dunno if I wanna know how else I can fck it up xD

#

I honestly feel like reverting everything to non-sharded version and whatever happens at 2500 happens

#

I started getting random logs from dunno where, mongo errors of duplicate keys...

#

and it feels like each command goes to all shards or idk

earnest phoenix
#

!rank

shy turret
#

yes !rank

smoky herald
#

like, my app is literally not running anymore, but the bot is still online @opal plank

#

I open the console and there is no screen to reconnect, but the bot still responds to commands

opal plank
#

idk how you running them, but you should send SIGNSIGNAL to all of them via IPC

smoky herald
shy turret
#
          let uploadFile = await fetch("https://api.anonfiles.com/upload", {
            method: 'POST',
            body: createReadStream(zippath)
          });
          if (uploadFile.ok == true) {
            res.send({
              error: "none",
              response: await uploadFile.json()
            });
          } else {
            res.send({
              error: "An error has occured when requesting anonfiles.",
              response: await uploadFile.json()
            });
          }

why does anonfiles still error me that im not uploading any files

#

(no console errors)

prime fox
#

nice

#

Anyone know why req.user returns undefined?

smoky herald
agile lance
#

In quick.db, whats the new way of db.startsWith(...); ?

summer torrent
#

use .all() then Array.map()

agile lance
#

will it work the same if I try to use the Array.map({ sort: '.data'})?

summer torrent
#

no i mean

#

<db>.all().map(a => a.startsWith("abc")) something like this

agile lance
#

Ohh, is it possible to still implement a sorting method?

earnest phoenix
#

map is just a fancy for loop

#

so

limpid moth
#

I got my avatar command to fully work without errors ty for the help yesterday

lyric mountain
#

just a tip, append ?size=512 to the end of the url

#

if the lib doesn't do that already

delicate shore
#

Hey @pale vessel
Someone told me that you have your own api?
Can I get a link to that if it's true, Thanks

pale vessel
#

API for?

delicate shore
#

Image manipulation stuff

pale vessel
#

No

#

Who told you that?

delicate shore
#

nvm then

#

It was in a bot

#

it said Thanks flazepe for image manipulation

pale vessel
delicate shore
#

so i thought

pale vessel
#

What bot?

delicate shore
#

username601

#

wait nvm

#

I am just dumb

#

it returns your bot logo

pale vessel
#

oh that API

#

Yes that's my API

#

It just sends anything Aeon

limber flume
steady raven
#

a

feral aspen
#
rMember.roles.add(role.id).catch(e => console.log(e.message));

If I would want to define an embed and send it if an error occures, would that be possible in the catch?

#

Yeah?

limber flume
#

I’m not no pro at JavaScript but could you not just replace the console.log() with the embed your sending?

#

(e => send embed here)

feral aspen
#
rMember.roles.add(role.id).catch(e => message.channel.send(embed);
#

Like that?

limber flume
#

Yea

#

Sry if it’s wrong, I’m going by senses

sudden geyser
#

You're missing a ) in that follow up for the record.

limber flume
feral aspen
#

F

#

Is this possible?

feral aspen
#
rMember.roles.add(role.id).catch(e => {
    embedError.setDescription("lmao, error");
    message.channel.send(embedError);
});
#

Can that work?

limber flume
#

Try it and see

feral aspen
#

What? that only works when there is an error.

#

Do you think it would work?

sudden geyser
#

Is that not intentional?

limber flume
#

Not JavaScript coder, 🤷‍♀️

feral aspen
#

I don't like it to console log it.

#

I want it to send a message instead.

sudden geyser
#

It's supposed to send an error when an error occurs, so it should work.

feral aspen
#

Ok.

limber flume
agile lance
#

let data = await db.all(`bal.${message.author.id}`) data = data.sort((a, b) => b.value.bal - a.value.bal); data = Promise.all(data.map(async (data, index) => { const user = await client.users.cache.fetch(data.key.split("."[2])).catch(() => null); if(user) { return { tag: user.tag, bal: data.value.bal, rank: index + 1 } } }));

#

Says cannot read property of bal of undefined

#

Im confused and its making my head hurt

iron tendon
crimson vapor
#

what the fuck

blissful coral
#

How exactly can I use deleteMany()
on mongoose because it isn't deleting

#

What the hell

crimson vapor
#

client.disc = discord

iron tendon
#

so i can load discord if needed

#

because sometimes it just won't do shit

blissful coral
#

just require it in the file...

crimson vapor
#

@blissful coral deleteMany() takes the same as findOne() or find() or findOneAndUpdate()

blissful coral
#

It isn't deleting many

iron tendon
blissful coral
#

@crimson vapor join test 1

crimson vapor
#

no

#

im in bot devs

blissful coral
#

:(

pale vessel
#

stream in bot devs ez

blissful coral
#

I am

iron tendon
#

how the fuck do i pass in discord if i destructure the discord require

#

nvm figured it out

cinder patio
#

{}, Discord

#

or just don't destructure it

pale vessel
#

i don't think you can do that in node

#

you either destructure or not destructure

zenith terrace
#

flaz <_<

#

sleep

pale vessel
#

wdym

zenith terrace
#

yes

crimson vapor
#

its 2pm for him

zenith terrace
#

and? theres no rule to when you can sleep

crimson vapor
#

yeah but no reason to sleep at 2 pm

zenith terrace
#

there is

crimson vapor
#

wdym

zenith terrace
#

being bored and have nothing else to do

crimson vapor
#

ah

#

fair

zenith terrace
#

yes

iron tendon
#

PAIN

#

Ok, so I moved my events in to seperate files but I cannot get the user activity setter to work.

#

Literally just needed to pass in client

#

Nope, didn't work

#
TypeError: Cannot read property 'setActivity' of undefined.
const { green, red } = require('chalk');

module.exports = (client) => {
    console.info(`${green('SUCESS')} Bot is now online`);
    client.user.setActivity('chat.',
        {
            type: 'WATCHING',
        }).then(console.log(`${green('SUCESS')} Set playing status`));
};
earnest phoenix
#

are you doing this in/after the ready event?

#

if you do it before, the user is not going to be set as you're not granted the data finished downloading

iron tendon
#

What?

earnest phoenix
#

what what

earnest phoenix
earnest phoenix
#

nothing

#

you're just trying to use it before you say what it is

iron tendon
earnest phoenix
earnest phoenix
slender thistle
#

client.user is not available intil the bot is logged in and ready

iron tendon
#

oh so

#

ok

#

if i put that event elsewhere (index.js) it somehow works

earnest phoenix
iron tendon
#

LOAD THE CONFIG

#

const config = require('./some/dumb/location');

earnest phoenix
#

there's even an analogy if you just ✨ read ✨

iron tendon
#

or you have an src folder?

earnest phoenix
#

jesus fucking christ

iron tendon
#

i had to debug path issues just to get my handlers to work

earnest phoenix
#

path issues would error out with module not found

iron tendon
#

yes

earnest phoenix
#

...which is the error they're not getting

iron tendon
#

i figured it out

#

they put config after the line in which config is called

#

@earnest phoenix put config at the top of the file

agile lance
#

let data = await db.all(`bal.${message.author.id}`) data = data.sort((a, b) => b.value.bal - a.value.bal); data = Promise.all(data.map(async (data, index) => { const user = await client.users.cache.fetch(data.key.split("."[2])).catch(() => null); if(user) { return { tag: user.tag, bal: data.value.bal, rank: index + 1 } } }));

error: Cannot read property of bal of undefined

earnest phoenix
#

you should let them figure it themselves

iron tendon
#

ok

earnest phoenix
agile lance
#

i thought that was required either way because value was fetching it from the db?

earnest phoenix
#

🤷‍♂️

agile lance
#

idk how to make a leaderboard in quick.db so im winging it tbh

earnest phoenix
#

when you console.log it you'll see the structure of your object

#

use the according properties

agile lance
#

so do I just console.log(data); ?

iron tendon
#

now i get why your username is cry

earnest phoenix
#

data[0] (you need to grab the object, not the array)

agile lance
#

if I log just data, will it show the entire thing (similar to logging client)?

earnest phoenix
#

yes

agile lance
#

alright

earnest phoenix
#

depending on the size of the array it can just outright fill up your console buffer

iron tendon
#

Congrats, I made it all work!

agile lance
#

@earnest phoenix It cant make jt past data = data.sort((a, b) => b.value.bal - a.value.bal); so it cant log it

earnest phoenix
#

so just... comment it out?

#

or place the log above the line

agile lance
#

Ill try that

#

so it would be

#

data.id.bal ?

earnest phoenix
#

uhm

agile lance
#

ID*

earnest phoenix
#

that data structure is weird

agile lance
#

lol

iron tendon
earnest phoenix
#

you're not supposed to store it like that

agile lance
#

thats how i always have

earnest phoenix
#

you should have an id property that's set to the user id

#

and then a bal property that has the balance

#

so your structure would look something like this

{
  id: "snowflake",
  bal: number
}
agile lance
#

So now it at least responded

earnest phoenix
#

i heavily suggest redoing your structure like i mentioned above

agile lance
#

i cant

#

thsts the default structure

#

i dont store data using json files

earnest phoenix
#

...that's why i said redo

agile lance
#

lol

earnest phoenix
#

that example was also js objects

agile lance
#

i have no experience in other fields

earnest phoenix
#

not json

grizzled raven
#

isn't that quick.db?

agile lance
#

yes

#

and idk how to make it list data now

#

bc clearly theres data as shown

#

but it responded with no data hmm

earnest phoenix
agile lance
#

well what if i do .data after fetching the id as bal?

#

ima try it ig

#

Oh wait !! New error

#

Cannot read property of split of undefined

#

so the error has to do with this

#

const user = await client.users.cache.fetch(data.key.split("."[2])).catch(() => null);
if(user) {
return {
tag: user.tag,
bal: data.ID.bal,
rank: index + 1
}
}

#

i assume

agile lance
#

i dont have a data.key though in the array apparently, should i like, set the ‘key’ as message.author.id;?

#

@earnest phoenix what if i dont split it?

earnest phoenix
#

🤷‍♂️ your structure is a mess, i don't know what data.key is

agile lance
#

i thought that is auto-set to author id

#

without splitting i get a error that states

#

"client.users.cache.fetch(...) is not a function"

#

That can be messing up my splitting then

earnest phoenix
#

if i was in your place, i would just drop it here and redo everything (about your database)

agile lance
#

i spent so long on thisssss

#

idek how to redo my database

#

when they have 3+ values its sorts like that

earnest phoenix
#

guys i have completed this and its working but how do i can get there (i know i asked this million time lol )

agile lance
earnest phoenix
#

i have made a help panel that edits itself just like carl bot docs but i dont know how to set the timeout

#

pls help

agile lance
#

i might move to mongodb

earnest phoenix
slender thistle
# earnest phoenix

URL - http://your.public.ip.address:5000/dblwebhook
Authorization - whatever config.AUTH_PASS returns

slender thistle
#

The IP address of the machine your bot is on

earnest phoenix
slender thistle
#

Do you host on your PC?

earnest phoenix
slender thistle
earnest phoenix
#

k

slender thistle
#

Remove port from URL, set webhookPort to 8080

earnest phoenix
#

ok

#

1m

slender thistle
#

don't forget /dblwebhook in the URL

#

And yeah

earnest phoenix
#

@slender thistle whta do i put in the AUTH_PASS

slender thistle
#

What does your config.AUTH_PASS return

earnest phoenix
#

@slender thistle like that

#

@slender thistle hello?

#

im haveing issues with the client.login with working with an external file

#

bin your code

#

ok

#

like that

#

??

#

🚶‍♂️ 🦽

iron tendon
#
const Discord = require('discord.js');

const client = new Discord.Client();

const prefix = '!'

client.once('ready', () => {
    console.log('Your bot is online');
});

client.on('message', message => {
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if(command === 'ping'){
        message.channel.send('pong!');
    } else if (command === 'hello'){
        message.channel.send('gday m8!')
    }
});

client.login(process.env.TOKEN);

so i can at least read it

earnest phoenix
#

dont put space in .env

#

TOKEN=TOKEN HERE

earnest phoenix
#

ok

#

like that

iron tendon
#

first off its .env

and also no spaces

earnest phoenix
#

TOKEN=(MY TOKEN)

#

it is

iron tendon
#

it good you didn't also leak your token

earnest phoenix
#

yh

earnest phoenix
earnest phoenix
#

im learning x73db

#

thats means nothing to me...

#

good database for small bots like mine

iron tendon
#

im learning the art of [removed]

#

aka what i am doing with my hellCode

earnest phoenix
#
C:\Users\riley\Desktop\DiscordBot>node main
(node:15160) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
    at Client.login (C:\Users\riley\Desktop\DiscordBot\node_modules\discord.js\src\client\Client.js:206:52)
    at Object.<anonymous> (C:\Users\riley\Desktop\DiscordBot\main.js:24:8)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
(Use `node --trace-warnings ...` to show where the warning was created)
(node:15160) 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:15160) [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.

Command Promt Error

#

INVAILD TOKEN

summer torrent
#

can you read the error

earnest phoenix
#

its right tho

earnest phoenix
#

r u sure u puted the token right?

#

i checkd it

summer torrent
#

errors don't lie

iron tendon
#

MAKE SURE ENV FILE IS .env

earnest phoenix
#

ITIS

iron tendon
#

OK

earnest phoenix
iron tendon
earnest phoenix
#

poooof

iron tendon
#

WHAT

#

CLICK COPY AT THE TOKEN SECTION

summer torrent
#

we can't see your bot smh

agile lance
#

.-.

earnest phoenix
#

just showing u ik where to go

#

TOKEN=ODAwMTE2

iron tendon
#

WELCOME TO THE SERVER WHERE PEOPLE DON'T EVEN UNDERSTAND THE WAY TOKENS WORK

#

BUT WANT TO CODE BOTS

earnest phoenix
#

that is in my .env

summer torrent
earnest phoenix
#

stop having a mental breakdown in the development channel

iron tendon
#

ok

agile lance
#

do require('dotenv').token;

iron tendon
#

the more people who don't understand simple stuff, the more i have a mental breakdown

earnest phoenix
iron tendon
#

at the top

summer torrent
#

you need dotenv package

earnest phoenix
#

i have

iron tendon
#

DO I REALLY NEED TO FUCKING EXPLAIN

summer torrent
#

and no, thats not how it works

earnest phoenix
agile lance
#

if ur self hosting why have a env anyway lol

earnest phoenix
#

i was told to do it

iron tendon
#

like module_not_found => path error

#

time to google

earnest phoenix
#

require('dotenv').config() - what do i put in config?? or leave it blank?

summer torrent
#

read the docs

iron tendon
#

^ this

earnest phoenix
#

it says early on

#

As early as possible in your application, require and configure dotenv.

require('dotenv').config()

#

so ima put it at the top

earnest phoenix
iron tendon
#

put the config in it

earnest phoenix
#

yh

#

require('dotenv').config()

#

at the very top

iron tendon
#

🚶🏼 🦽

earnest phoenix
#

guys

earnest phoenix
slender thistle
earnest phoenix
slender thistle
#

Well there's your answer

earnest phoenix
slender thistle
#

Yes

earnest phoenix
iron tendon
#

Welcome to hell, number 10000000 in queue.

earnest phoenix
#

Your bot is 60% close to being reviewed. When your bot is accepted or declined you will receive a DM from Luca in our Discord server.
Please check the pins of the #support channel to learn when your bot will be approved.

I dont even want that bot anymore so ima delete it

earnest phoenix
#

pls someone help

iron tendon
#

i hate it when

if (blah) 
{
  do stuff;
}

why bracket like that

earnest phoenix
#

get a linter

#

and a formatter

#

i.e. prettier

iron tendon
#

im making fun of C# users haha funny

pale vessel
#

boo hoo

lusty quest
#

c# is quite powerful and versatile

earnest phoenix
#

i use it for quite literally everything but UI

#

node excels at UI

#

my some command not works and no error raised why ?

iron tendon
#

what

earnest phoenix
#

😭

iron tendon
#

i had a stkem readn stsgta

earnest phoenix
#

guys i have created a blacklist code i wondering how do i let the blacklisted member not using my commands

iron tendon
#

blocklist*

lusty quest
#

if you use a Command handler check if the message author is in your blocklist

earnest phoenix
#

the amount of messy formatting that screenshot has is causing me pain

lusty quest
#

then do it in your message handler

earnest phoenix
#

lol

lusty quest
#

also dont use var. var is deprecated, but still there to not break the internet

#

use let or const instead. let is mutable const is not

earnest phoenix
#

some of my command don't works and no error is raised

#

😭

earnest phoenix
#

Java

#

😓

lusty quest
#

java != javascript

earnest phoenix
#

!?

#

Take a screenshot of the error

gusty ivy
#

He said no error???

earnest phoenix
#

in terminal no error

#

😭

#

whats the problem !?

lusty quest
#

did you use some sort of command handler?

earnest phoenix
#

should i try running it with idle python ?

#

ya

#

error handler

lusty quest
#

can you see if the command gets loaded on startup?

earnest phoenix
#

mine is python bro

lusty quest
#

py also got ways to log to console

earnest phoenix
#

k

#

how to debug bro ?

lusty quest
analog tinsel
#

how can i generate random number in minimum range - maximum range?

pale vessel
#

Math.random() * (max - min) + min

analog tinsel
#

k ty

earnest phoenix
#

Is this the correct code for total roles that a user has?
message.member.roles.cache.size

pale vessel
#

Yes

#

You can also use message.member._roles.length

earnest phoenix
#

Oh

earnest phoenix
earnest phoenix
pale vessel
#

Yes

earnest phoenix
#

ok

pale vessel
#

It's an array of role ids

#

For internal use ig

earnest phoenix
#

For server total roles message.guild._roles.length?

pale vessel
#

Server? Use roles.cache.size

cinder patio
#

usage of undocumented / private properties is not recommended

earnest phoenix
#

what abot user tags?

#

I mean Badges

pale vessel
#

use user.flags.toArray()

earnest phoenix
#

Ok

#

message.user.flags.toArray()?

pale vessel
#

message.author

earnest phoenix
#

Ok

analog tinsel
#

@pale vessel Math.random() * (max - min) + min can you make example number?

analog tinsel
#

when i did maximum: 100 and minimum:1 it will give me 101 too

#

randomly

#

100+1

pale vessel
#

Why not Math.ceil(Math.random() * 100);?

cinder patio
#

hmm I think you should Math.floor it

analog tinsel
#

trying

#

k it worked

fathom furnace
#

Can anyone help me make the bot send dm message to the user who voted for it in top.gg? AShuh

earnest phoenix
#

Is this correct? message.guild.me.roles.highest.compare

#

@pale vessel

pale vessel
#

Do you mean comparePositions()?

earnest phoenix
#

No

#

Highest role for the user

pale vessel
#

There is no role.compare

earnest phoenix
#

oh

#

Then?

pale vessel
#

What are you trying to do?

#

Highest role is just message.guild.me.roles.highest

earnest phoenix
#

Ohk

#

for userinfo command

#

Iam asking

#

And one more doubt

#

I have only userinfo command for self.But i dont know what is the code for userinfo @user?

pale vessel
earnest phoenix
#

Ok

pale vessel
#

That gets the first mentioned member

earnest phoenix
#

Oh

pale vessel
#

You should fallback to the author if no one is mentioned by using message.mentions.members.first() || message.author

earnest phoenix
#

Oh ok

pale vessel
#

Assign that to a variable and treat that as a member

earnest phoenix
#

Ok

#

Which variable?

pale vessel
#

Anything

#

const member = ...

earnest phoenix
#

Ok

pale vessel
#

Like that

earnest phoenix
#

Oh ok

pale vessel
#

and member.roles...

earnest phoenix
#

Ok

#

message.author.guilds.cache.size?
CORRECT

#

??

cinder patio
#

You want to get the amount of guilds the user's in? Not possible

earnest phoenix
#

why

#

It's not like you cache people's guilds lol

#

oh

#

Ok

earnest phoenix
#

shrug Idk if it's possible using oauth2, but I've never dealt with it

#

Ok

cinder patio
#

you can do it via oauth2 yeah

earnest phoenix
#

oh ok

cinder patio
#

but you can't access all guilds just with the bot

earnest phoenix
#

kk

thick bolt
#

Who here knows dbd.js

cinder patio
#

ew

lusty quest
#

why did you want to use a wrapper?

cinder patio
#

so dumb

lusty quest
#

for beginners is maybe a easyer start but you give up on flexibility

cinder patio
#

if you begin with dbd.js you'll likely never learn anything useful as long as you're using it

lusty quest
#

maybe they notice the missing flexibility when they get better.

crimson vapor
#

dbd.js is more confusing than brainfuck

lusty quest
#

its fine tbh, but its limiting, i think using commando would be the better alternative

#

but still not perfect

smoky herald
#

fight against sharding, day 3, anyone with some sharding experience I can occasionally annoy in DMs? ASMikuHeart

crimson vapor
#

anyone know if you can put limits on a input for a function in ts

#

something like arg: string[3] meaning it has 3 length

cinder patio
#

nope

#

that's not a thing

crimson vapor
#

that would be cool

crystal wigeon
#

how do you recognize event blocks in js?

willow inlet
#

Hi

cinder patio
#

oh...

#

event blocking code is syncronous, so that's that

crystal wigeon
#

so anything that needs to wait is an event block?

cinder patio
#

Any loop is event blocking, for example

crystal wigeon
#

for (..) {}

#

this event block?

cinder patio
#

yeah. No code will execute until the loop is over

crystal wigeon
#

tf

#

so

#

what if i wanted the loop to complete

#

but dont want it to event block

#

something like

#

arr = []
loop // push to array
arr output

#

if i dont use that for(...) it wont push to array

#

the array will be empty

cinder patio
#

I'm not sure what you mean

crystal wigeon
#

lets say i have an empty array where i need to push some values in a loop

cinder patio
#

you will only notice event blocking if you are doing thousands of iterations

crystal wigeon
#

so this loop needs to complete before the output of the array is used

#

well

#

there are thousands of users

#

accessing this small loop

#

which is pretty much event blocks

#

ig?

#

1000 users -> for(10 iter)

cinder patio
#

The code after the foor loop will execute after the for loop is over, the array will always be not empty after the loop

crystal wigeon
#

but you just said for(..) is event blocks

#

so if there are 1000 users waiting for this loop

#

its pretty much gonna start to lag

crimson vapor
#

it depends on how often you do that

earnest phoenix
#

how can we code decancer?

cinder patio
#

Nothing else can happen during the iteration , that's what you mean by event blocking, right

crimson vapor
#

its very very inefficient to run 1k iterations on a command message

#

but its decent for a flushCache or something

earnest phoenix
#

js

fierce ether
#

const winAmount = Math.floor(Math.random() * 10) + how do i make this 20-30?

crystal wigeon
#

actually my question was what are event blocks.. are for loops the one ones??

#

i doubt for loops cause event blocks

smoky herald
fierce ether
#

will that do 20 - 30 yeh?

limpid moth
#

I have an object holding an array of values in a json file. How can I have my program search through that array to find if a message sent by a user has any of those values?

smoky herald
# fierce ether will that do 20 - 30 yeh?

it's a function which takes two parameters and gives you a number in between, as their names say you enter minimum number including first parameter and maximum number including max parameter

cinder patio
#

Any syncronous operation is blocking

#

1 + 1 is blocking

#

how long it takes to run it is a different question

earnest phoenix
#

bubble sort says hi

#

some one pls help me i delted the last bit of my code and dont know it...
client.login.Discord;

i tried to remake it...

#

what

#

then client.login part

#

i forgot how to make it

misty sigil
#

bruh

cinder patio
#

it's a function, call it with your bot's token as the first argument

misty sigil
#

read the docs

crystal wigeon
earnest phoenix
#

client.login('my token');

#

thx

crystal wigeon
#

it should run 2 separate funcs for 2 users

misty sigil
#

in fact

#

definitely that

crystal wigeon
#

it should not do something like u1 loop still running and the u2 loop doesnt even start

cinder patio
#

How many iterations is the loop doing max

earnest phoenix
#

whats the command promt thing that makes the directory change?

cinder patio
#

cd?

tight plinth
#

any clue why, even if i send a message, the c.on("collect") event never triggers?

pale vessel
#

you need to return your filter

tight plinth
#

heck

pale vessel
#

either h => x == y or h => { return x == y; }

earnest phoenix
tight plinth
#

i am definitively dumb

#

ty qt

#

now go sleep

pale vessel
#

nou

crimson vapor
mellow kelp
#

interesting

pliant nymph
#

bot.user.setStatus not working

#

bot.user.setPresence({activity: { name: test, type: "PLAYING"}, status: "idle"}); activity working but it didn't set status.

zenith terrace
quartz kindle
#

status sometimes doesnt work for no reason

silent cloud
#

Hey guys

#

I have youtube ip blocked (429)

#

How i can fix it without proxies?

modest maple
#

you cant

#

other than waiting

silent cloud
#

And why i got it

modest maple
#

have fun

#

cuz you're scraping YT

silent cloud
#

I only used music

modest maple
#

which they dont allow

silent cloud
#

._.

modest maple
#

welcome to why music bots cost so much run :P

silent cloud
#

Bruhhh

lusty quest
#

buy a ipV6 subnet and shuffle the IPs

earnest phoenix
#

making a music bot is not worth it unless you invest cca 50 bucks a month for a minimal bot

#

making a music bot was easier back in the day when rythm and all other bots were new

#

they built their foundation and userbase on that and made money with that

#

and now they're able sustain their services with these new restrictions youtube put in place

#

newer bots cannot do that without a big investment

mellow kelp
#

cri

lusty quest
#

also the main reason why i make a large circle around music bots.

lucid prawn
#

how do i start i discord bot list

#

*ing

lusty quest
#

you want to post your bot stats to the api?

solemn leaf
#

Yeah wdym

lucid prawn
mellow kelp
#

using a library?

lucid prawn
#

wym

mellow kelp
lucid prawn
mellow kelp
#

library, not the language

#

well i assume you're not using a lib

lucid prawn
#

im dumb rn

#

i got hit in the head so

mellow kelp
#

um ok

earnest phoenix
#

wait what do you want to do

#

display a user's avatar on your website?

lucid prawn
#

yes

mellow kelp
#

do you have the user info?

lucid prawn
#

yes

#

my bot ask for it

mellow kelp
#

ok

#

the user object has an avatar property

lucid prawn
mellow kelp
#

you gotta form a url like this: https://cdn.discordapp.com/avatar/<user-id>/<avatar property>.png

mellow kelp
#

yeah that gives you access to the user info

earnest phoenix
#

tf do you need the email for

mellow kelp
#

you can change the extension to jpg, jpeg and webp

earnest phoenix
#

or just don't have an extension

#

discord will pick the best option

lucid prawn
mellow kelp
#

wait really

#

poggers

earnest phoenix
#

yeah, that way you're granted support for animated avatars

#

without any preprocessing or some shit

mellow kelp
#

extra pog

tired panther
mellow kelp
#

yeah

feral aspen
#

OMG SORRY FOR PING! 🤦‍♂️

rugged cobalt
#

is there a way to remove a document from a collection in mongoose if the keys match a certain value

#

or would you have to like find all the documents which match that value and delete them

pale vessel
#

Use deleteMany(filter)

iron tendon
#

didn't we have a deleteMany debate?

pale vessel
#

What debate?

rugged cobalt
#

so basically I would update it to be the new array and then deleteMany(<if some value matches this>)

fierce ether
#
Error: Players validation failed: elo: Cast to Number failed for value "NaN" at path "elo"``` what does this mean
agile lance
#

code: let data = await db.all(`bal.${message.author.id}`) data = data.sort((a, b) => b.ID.bal - a.ID.bal); data = Promise.all(data.map(async (data, index) => { for(let i = 0; i < data.length; i++) { const user = await client.users.cache.fetch(data[i].ID.bal.split(".")[2]).catch(() => null); if(user) { return { tag: user.tag, bal: data.ID.bal, rank: index + 1 } } } })); if(!data.length) return message.reply('There is no data currently.') const page = functions.pages(data, 10, args[0] || 1) if(!page) return message.reply('That page does not exist!') let dcc = new discord.MessageEmbed() .setTitle(`Leaderboard for ${client.user.tag}.`) .setColor('GREEN') .setDescription(page.map(e=> `\`#${e.rank} | ${e.user} | ${e.bal}`)) message.reply(dcc) }

No error, just keeps saying No data found but I do have data

outer perch
#

I can't understand RegEx, can someone tell me how to make one so I can replace every "time": value (JSON) to 300?

lyric mountain
#

you want to REPLACE the word time with 300?

sterile lantern
#

what do i do for this

#

i have no clue about how this works

outer perch
#

there are multiple "time"s

mellow kelp
#

you could use recursion to replace all the values with the key time in your object

outer perch
#

I'm confused already

#

how do I do that?

mellow kelp
#

well, first you would probably want to parse the json into a js object

#

you can make a function that loops through every key of the object, and changes the value to 300 if it's "time"

#

and if it finds a value that is another object, call the function on that object too

lyric mountain
mellow kelp
#

well yeah, if you don't have nested objects just do that

lyric mountain
#

regex is actually a "replace this" thing

#

not "replace that"

#

if that makes sense

#

even if you have nested objects, all you need to do is iterate over those too

outer perch
#

how do I do thaaaat

mellow kelp
#

recursion

#

(probably)

lyric mountain
#

btw, what's the current value of the "time" fields?

#

are them numbers?

eternal osprey
#

hey guys

#
o[firstmember].owner = targetMember.id; //Setting the owner ID
                                                 ^

TypeError: Cannot set property 'owner' of undefined```
#
        
                        fs.writeFile("mons.json", JSON.stringify(o), e => {
                            //Handle error
                            o[firstmember].owner = targetMember.id; //Setting the owner ID
                        
                            fs.writeFile("mons.json", JSON.stringify(o), e => {
                                o[targetMember.id].owner = firstmember; //Setting the owner ID
                                
                            });
                        });
                    
                    
                     });
                      ```
limpid moth
#

I'm trying to have my code go through an array and if the message has start with"owo" and a value from the array. The array is stored in a json file.

// Require fs
const fs = require('fs');

// Require Discord JS
const Discord = require('discord.js');


// Get the token from config.json
const { token, prefix, prefix2 } = require('./config.json');


// Create a new Discord Client and call it client
const client = new Discord.Client();


// Define Commands
client.commands = new Discord.Collection();

// Define commandFiles as the command folder. Then ignore all files in that folder that do not end with .js
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
}
const { list } = require('./owocommands.json');

// Say ready when online
client.once('ready', () => {
    console.log('Ready!');
});

// When there is a message detected...
client.on('message', message => {

    function check() {
    return message.content === 'owo' + list || message.content === 'owo ' + list;
    }

    // If the message was made by a bot ignore it
    if (message.author.bot) return;
    const msg = message.content;
    // Counting
    if (msg === 'owo') {


        if (list.every(check) === false) {
            message.channel.send('That was a command');
            return;
        }
        message.channel.send('That was not a command');

        }
eternal osprey
#

this is how the mons.json looks. I need the owner ids to be changed

sterile lantern
#

this happens when i try to add a CNAME

#

for github

#

unless i don't need to?

lyric mountain
#

you see, github is not a site hosting

royal herald
#

Thats clodflare

sterile lantern
#

it does host static sites

#

and yeah ^^

eternal osprey
#

anyone that could help me with the object transfer?

lyric mountain
#

you're trying to set a cname for one that already exists

mellow kelp
#

@sterile lantern have you tried reading the error message

lyric mountain
#

do you own a domain?

lyric mountain
sterile lantern
#

i do own it

#

but im using cloudfare's NS

lyric mountain
#

what is your domain?

sterile lantern
#

uhh

#

namecheap

lyric mountain
#

no

#

domain

#

not provider

sterile lantern
lyric mountain
#

so your site can only be xxxx.codewindhq.net

sterile lantern
#

?

lyric mountain
#

or codewindhq.net

sterile lantern
#

what does the xxxx mean

#

i mean

#

i have https

lyric mountain
#

whatever u want to put there

#

xxxx is a placeholder

#

like, you could make api.codewindhq.net

sterile lantern
#

ah

#

alr

lyric mountain
#

or blablabla.codewindhq.net

#

what cname are you trying to set?

sterile lantern
#

just

#

wait no

#

i mean

lyric mountain
#

afaik u cant

sterile lantern
#

o

#

oof

lyric mountain
#

because codewindhq.net already exists

lyric mountain
#

it's yours

#

you need to set a dns for that domain

#

but you can't have an ip in github

sterile lantern
#

for A records

#

dns only

#

or

#

proxy?

outer perch
#

in seconds

rugged cobalt
#

How would you do deleteMany in mongoose so that you only delete it if the key x doesn't have a value

#

so like js await someSchema.deleteMany({ // if prefix is not here });

mellow kelp
#

i think you can use $not

lyric mountain
outer perch
#

tyy

eternal osprey
#

hey

#

can someone help me with changing the owner value in the object

#
  fs.writeFileSync("./mons.json", JSON.stringify(o), e => {
                            //Handle error
                            if (mons[firstmember].currentMon.id == found){

                             mons[firstmember].owner = `${targetMember.id}`; //Setting the owner ID
                            }
                            if (mons[targetMember.id].currentMon.id == founds){
                            fs.writeFileSync("./mons.json", JSON.stringify(o), e => {
                               
                                mons[targetMember.id].owner = `${firstmember}`; //Setting the owner ID
                                
                            });
                        }
                        });```this is waht i have rn
humble rock
#

did u know free host expect heroku?

lyric mountain
#

what?

#

do you mean "except"?

humble rock
#

yea

#

sorry

#

im not english

lyric mountain
eternal osprey
#

glit ch

lyric mountain
#

but it ain't like heroku]

modest maple
#

Theyre all a shit as each other

lyric mountain
humble rock
lyric mountain
#

you too what?

humble rock
#

i don't like heroku

#

too

lyric mountain
#

I didn't say that

modest maple
#

Thats

lyric mountain
#

I said "it ain't like heroku"

#

which means "it isn't like heroku"

modest maple
#

Lmao sometimes translation randomness is amazing

humble rock
#

lol

modest maple
#

I love heroku

#

Gimmie dem servers

humble rock
lyric mountain
#

heroku is good for what it was made

#

webservers

humble rock
#

free deploy it's during for 1 month

lyric mountain
#

no?

#

heroku is free until you reach the quota

modest maple
humble rock
#

oh

#

oh

lyric mountain
#

like glitch

modest maple
#

Takes a 5 piece ritual and chant

humble rock
#

let's watch a video on yt

modest maple
#

Lets not

lyric mountain
#

in their docs

humble rock
#

oh ok

lyric mountain
#

well, not officially theirs

#

ig

humble rock
#

but... i doesn't need glitch for do that(?)

lyric mountain
#

no

eternal osprey
#

how do i loop through this object to search a element that has the same owner id

#

like, could anyone give me an example

lyric mountain
eternal osprey
#

it is valid

lyric mountain
#

no, show the formatted json

#

that thing u sent is unreadable

eternal osprey
#
{
    "1721138": {
        "ability": "Corrosion",
        "iv": 88,
        "stamina": 96,
        "hp": 338,
        "speed": 50,
        "attack": 16,
        "defense": 28,
        "specialattack": 234,
        "specialdefense": 307,
        "id": 367,
        "name": "Huntail",
        "level": 18,
        "catchChance": 0.8333333333333334,
        "spawnId": 4236884,
        "owner": "345138133429649408",
        "catchTime": "01/18/2021 9:49 PM",
        "nickname": ""
    },
    "1722312": {
        "id": 713,
        "name": "Avalugg",
        "level": 14,
        "iv": 11,
        "hp": 132.6,
        "speed": 46.84,
        "attack": 160.76,
        "defense": 246.52,
        "specialattack": 67.32,
        "specialdefense": 69.32,
        "catchChance": 1,
        "spawnId": 3466157,
        "owner": "345138133429649408",
        "catchTime": "01/19/2021 4:15 PM",
        "nickname": ""
    },
    "1724437": {
        "ability": "Turboblaze",
        "iv": 43,
        "stamina": 256,
        "hp": 167,
        "speed": 143,
        "attack": 211,
        "defense": 205,
        "specialattack": 167,
        "id": 170,
        "name": "Chinchou",
        "level": 32,
        "catchChance": 0.46875,
        "spawnId": 4108588,
        "owner": "345138133429649408",
        "catchTime": "01/15/2021 12:15 PM",
        "nickname": ""
    },```
#

something like this.

#

I need the owner key to be changed.

quartz kindle
#

you have the entry id?

#

like 1722312?

summer torrent
quartz kindle
#

or you have the owner id and you want to find the entry that has the owner id?

limpid moth
#

I'm trying to get it to say if the message is a command, the commands are listed under list, but I always get that the message is not a command:

        function check() {
            console.log(msg);
            return 'owo' + list === msg.startsWith();
            }
        function check2() {
                console.log(msg);
                return 'owo ' + list === msg.startsWith();
                }

    // Counting code


        // If the message startswith owo and is a command then do nothing.
        if (list.every(check) === true || list.every(check2) === true) {
            message.channel.send('That was a command');
            return;
        }
        message.channel.send('That was not a command');
twin swallow
#

Can anyone with Javascript knowledge let me pick their brain via DM's for a minute?

lyric mountain
#

is that even a code?

#

that's a json

rugged cobalt
#

oh forgot to mention, that's MongoDB

#

the picture is a document from the guildConfig collection

thin turret
#

cheese.burger()

rugged cobalt
#

ok.then()

lyric mountain
#

that's still a json tho

#

show the actual code

misty sigil
#

the sourcebin link

rugged cobalt
#

this.id also refers to guild id

#

so technically that filter obj should match that photo, right?

agile lance
#

```let money = db.startsWith(bal.${message.author.id}, { sort: '.data' })

    let content = "";

    for (let i = 0; i < money.length; i++){
        let user = client.users.cache.get(money[i].ID.split('.')[2]).tag

        content += `${i+1}. ${user} - ${money[i].data} \n`;

}
const embed = new Discord.MessageEmbed()
.setTitle(**Global** Leaderboard)
.setDescription(${content})
.setColor("RANDOM")
.setTimestamp()

        message.channel.send(embed);

}```

Issue: Returns the embed without the content being thte leaderboard

Package: Quick.db@7.0.0-b21

tight plinth
#

console.log content

agile lance
#

returns nothing

#

i dont see a issue with anything tho

eternal osprey
#
 let last1 = Object.values(mons).find(m => m.name === `${found.name}`)
                        fs.writeFileSync("./mons.json", JSON.stringify(mons), e =>{
                            //Handle error
                             last1.owner = `${targetMember.id}`; //Setting the owner ID
                            });
                                let last2 = Object.values(mons).find(m => m.name === `${founds.name}`)
                                 fs.writeFileSync("./mons.json", JSON.stringify(mons), e => {
                                    
                                     last2.owner = `${targetMember.id}`; //Setting the owner ID
                                    });```does anyone know why it doesn't change the owner.ids?