#development

1 messages ยท Page 1739 of 1

lusty quest
#

they upload it probably once per day or so

#

uploading it on each request is stupid

blazing sentinel
#

yeah. once per day or sth like that

quartz kindle
#

covid apis usually have much faster updates

blazing sentinel
quartz kindle
#

so yours will get slightly outdated

#

and if you download that file every minute you will probably be ip blocked as well

#

so there are still rate limits

lusty quest
#

also you you probably want to parse the csv with code, in excel its readable like turkish bot code

slender thistle
#

A minute interval is overkill imo

blazing sentinel
slender thistle
#

Once per day is fine since you don't really need that much precision with this data

blazing sentinel
#

it contains all the countries

lusty quest
#

if you start to hammer the url they will eventually add ratelimits

blazing sentinel
#

you can manually change the csv file if you want, but i'm going to make it download each bot starts.

lusty quest
#

maybe use a cron to update it

#

like once on startup and then on a shedule

#

so you wont have to restart the bot every day

slender thistle
#

I'm thinking of running a repl every 48 hours to fetch that file and store last results and the ones before it in cache

quartz kindle
#

you can compare the differences between both files and offer an approximate average for a given time frame

lusty quest
#

or use some tensorflow hackery and make a predictment for the future

blazing sentinel
quartz kindle
#

for example of it was 500 the day before, and 600 now, in 12 hours you can say its 650, without having any data

slender thistle
#

That's gonna be tough to do on a low-cost machine I believe

blazing sentinel
lusty quest
#

also works on js

blazing sentinel
slender thistle
#

Though I'm not sure how good Tensorflow is at using machine resources

#

There are TF bindings for JS iirc

lusty quest
slender thistle
#

Do you have any usage stats for it?

blazing sentinel
lusty quest
#

well it detects toxicity so its just text classification

#

but what i can say is that a 10$ Digital ocean droplet wont cut it

#

now i have a Dedicated root and it barely puts any load on the CPU

quartz kindle
#

AI eats cpu for breakfast

lusty quest
#

lol not really

#

if you do image stuff yes

#

but text stuff not really if its a fast cpu

#

like if the tensorflow stuff runs on my Bot it barely gets one core over 2% usage (ryzen 3600x)

blazing sentinel
lusty quest
#

on one core, not 6

blazing sentinel
#

because on the server, you would have only an intel xeon trash cpu

lusty quest
#

and this for less than 2 seconds at best

spare badger
#

What data type do you guys use in your database when you want to store the guild id? (In the Discord documentation it says its a "snowflake"?!?!) Is it just an integer?

lusty quest
#

well its a server

blazing sentinel
lusty quest
#

if you use integer its possible that it will get fucked

spare badger
#

@lusty quest How?

lusty quest
#

like js likes to round them

#

i use MongoDB and just say the field is a string

#

then just put the id into the field

blazing sentinel
#

use parseInt()

#

if it is a string

spare badger
#

Alright thank you. But the ID will always be a valid integer right? Will never start with 0 for example?

lusty quest
spare badger
#

Thank you guys

blazing sentinel
#

you use djs?

spare badger
#

@lusty quest Thank you!

blazing sentinel
spare badger
#

@blazing sentinel I'm currently building an API in PHP so no this won't have anything to do with JS

lusty quest
#

not sure if php can handle bigints

quartz kindle
#

use int64 if you can

blazing sentinel
spare badger
#

@quartz kindle Yea will use big ints

#

Thank you for your help guys

blazing sentinel
#

i use postgresql for my bot, and using bigint for channel, user or guild id's

spare badger
#

@blazing sentinel I will do the same!

blazing sentinel
#

ok. good luck ๐Ÿ‘

prime mist
lusty quest
#

still defaults to int for numbers

prime mist
# lusty quest still defaults to int for numbers
#

(or appending n to the end of the number apparently, which is cool)

quartz kindle
#

depends

#

you have to use a library that actually supports bigints internally

#

if youre interacting with a database

#

an older db lib will use normal numbers as an intermediary value and fuck you up

#

also hi Tim

#

:^)

prime mist
#

Great name

quartz kindle
#

you too

prime mist
#

Yeah, I have being using discord-api-types for my client implementation, which just uses strings.

quartz kindle
#

string to bigint is safe, just a bit more costly in resources

sick apex
#

ik too many requests error

#

I buyed server and from that time I didnt have that rpoblem

#

problem*

prime mist
quartz kindle
#

yes if you can safely transfer them to and from js without precision loss, use them

#

bigint uses 8 bytes, string uses 17-18

prime mist
#

I haven't needed a database yet, so not my problem lol

quartz kindle
#

xd

prime mist
#

Anyone here done a benchmark between ERL and JSON for the gateway API?

quartz kindle
#

not yet, ive been wanting to do it for a long time

mystic harness
#

how to make full image view in Long Description?

#

tag me pls

quartz kindle
#

wdym full image view

mystic harness
#

wait let me screen

wheat jewel
#
router.get('/servers/:id', (req, res) => res.render('dashboard/show'), {
    guild: bot.client.guilds.cache.get(req.params.id)
});```this is saying ```ReferenceError: req is not defined```no idea why
mystic harness
#

i mean this

wheat jewel
#

it's markdown

mystic harness
#

how to make full image view

quartz kindle
#

just google markdown images

mystic harness
#

not to be like to people need to click

quartz kindle
#

the syntax is

mystic harness
#

so i forgot !?

quartz kindle
#

ye

mystic harness
#

kk ill try

mystic harness
#

nop still same

wheat jewel
mystic harness
quartz kindle
#

you're doing .get(path, reqres, object)

mystic harness
#

they need to click on text to open image

#

i dont want that

quartz kindle
#

instead of .get(path, reqres(render,object))

quartz kindle
mystic harness
#

idk why

quartz kindle
#

try putting it in a new line

#

not in the same line as the text

#

all 3 links each in a separate line

mystic harness
quartz kindle
#

also

#

use the direct link to the image

mystic harness
quartz kindle
#

not the imgur page link

wheat jewel
quartz kindle
#

that link is for the imgur website page

#

not the image itself

mystic harness
#

ohh

#

then wait

old cliff
mystic harness
#

i have only this

sick apex
#

that can be used too

mystic harness
#

it dont i try

sick apex
#

then go to your imgur.com site of img click right and click on copy image adress

quartz kindle
#

show code

#

the png link is correct

mystic harness
#

i got this

#

wait

#

https://i.imgur.com/YEq0ApR.png

quartz kindle
#

yes

sick apex
#

yeag

quartz kindle
#

thats correct

sick apex
#

yeah

quartz kindle
#

show code

sick apex
#

that is it

mystic harness
#

i have it

quartz kindle
#

wheres the !

mystic harness
#

and still i have this

wheat jewel
mystic harness
#

thats it

#

ty

#

so much

#

another question

#

why i have this

#

i type how widget said

#

is that because my bot is not aprove yet?

quartz kindle
#

yes

mystic harness
#

ohh

#

kk then

#

ty

#

i need help about this

#

so how will then people donate me if they are not in my server?

tired panther
mystic harness
#

because i dont have support server yet

rancid copper
#

How do i setup a hyperlink in html

#

This isnt working

tired panther
rancid copper
#

How do i make it a string

sick apex
#

I fixed it by not using audioonly filter seems like ffmpeg crashed everytime

ember quarry
#

I am unable to add background url while submitting my bot, when I save details it says unexpected error occurred. What have I done wrong?

sick apex
#

they are updating top.gg UI a lot there was time when you cannot edit bot

#

it wasnt long ago

#

I think it'll be fixed soon

ember quarry
#

is there any recommended size of image for the background url?

ember quarry
# tired panther on the top.gg page?

when we add the our bot it asks for background url while editing, is it having any size or something that is recommended other then PNG and jpg

tired panther
#

png has a higher quality

near stratus
earnest phoenix
#

+startbot

near stratus
#
<a href="https://blah.blah">Text</a>
near stratus
rancid copper
near stratus
rancid copper
#

Am I loosing my mind

near stratus
mystic harness
#

can someone help me?

slender wagon
#
let keyword = ['Ye', 'More Words', 'Words', 'More']
        let alts = keyword.forEach(element =>  element)
        for (var i = 0; i < 1000; i++) { 
            let img = new Image()
            img.src = "./image.png";
            img.id = "alttags";
            img.alt = alts;
            document.body.appendChild(img)
        }

i wanna get each of the keywords and place it in the img.alt but not the whole list 1 keyword per image

#

not sure how i am supposed to do this

pale vessel
#

what's that forEach for?

cinder patio
pale vessel
#

can't you use keyword[i]?

slender wagon
#

it doesn't

#

oh

cinder patio
#

but don't loop 1000 times

slender wagon
#

i am trying to create the same image 1000 time

#

and add a different keyword

#

on each alt

slender wagon
#

EEE

#

thanks

gaunt lynx
#

Guys

#

I need a help please

cinder patio
slender wagon
#

YES

#

oop

#

s

#

yes

#

ik

#

i'll add 1K keywords

cinder patio
#

i % 4

#

ah... ok then

gaunt lynx
#

Can someone help me out please

slender wagon
#

lol freelancing can get stupid

gaunt lynx
#

I'm unable to setup plasma bot

#

Can someone help me

cinder patio
gaunt lynx
#

I'm unable to find their

#

Support server

cinder patio
gaunt lynx
#

Thanks sir

raw jacinth
#

i got this error

#

idk what to do

delicate shore
#

Hello everyone

eternal osprey
#

hey

#
{"store1":{"name":["Footsites"],"emoji":["๐ŸŸข"]}```
#

${database[store1].emoji}

#

why is store1 not defined?

slender thistle
#

because you're using store1 as a variable

#

And a variable like that doesn't exist

#

Use string instead

eternal osprey
#

how do i convert it from variable to string?

#

it's already in ""

#

so how can it be a variable?

vivid fulcrum
#

because you're using string literals

eternal osprey
#

okay i've got it working

vivid fulcrum
#

${} marks it as an interpolation

eternal osprey
#

just had to add "" in the actual name call

#

thanks guys

eternal osprey
#

hey, how do i refresh an embed without actually sending a new one?

#

Like edit.

vivid fulcrum
#

edit the message

#

you need to re-create the whole embed and then edit the message with the object

pale vessel
#

you forgot about js being able to dynamically modify properties

vivid fulcrum
#

right, crack

eternal osprey
#

hey i was trying to modify the embed completely

#
   s = await message.channel.send(statusembed)
    }
    if(message.content.startsWith(`${config.prefix}change`)){
      const args = message.content.split("\n").map((x) => x.split(/ +/));
      if(args[0][1] == 'store1'){
        if(!args[0][2]){
          message.channel.send("Please input a new emoji to add!");
          return 0;
          }
          database["store1"].emoji == (`${args[0][2]}`);
          fs.writeFileSync("./database.json", JSON.stringify(database))
          const statusembed1 = new Discord.MessageEmbed()
          .setFooter("Services status check!")
          .setTitle("Service Status")
          .setDescription(`๐ŸŸข Operational\n๐Ÿ”ด Down\n๐ŸŸ  Degraded Performance\n๐Ÿ”ต Under Maintenance\n๐Ÿ”’ Locked till drop`)
          .addField(`Stores`, `${database["store1"].emoji} ${database["store1"].name}\n${database["store2"].emoji} ${database["store2"].name}\n${database["store3"].emoji} ${database["store3"].name}\n${database["store4"].emoji} ${database["store4"].name}`)
          .setTimestamp()
          .setThumbnail("https://www.linuxnix.com/wp-content/uploads/2011/05/status.jpg")
          .setColor("#00FF00")
          s.edit(statusembed1)
          
      }```but as you can see i was getting scope errors
#

so i tried to use let s = ""

#

at the begin of my code

#

and tried the scope trick, but it gave me a s,.edit is not a function error

eternal osprey
#

i tried logging s inside the !embed scope, which worked, 2nd one in the !change scope didn't.

#

yah nvm i placed the let s = "" in my message event. Worked now

sand nymph
#

is there a way to check the realtime votes from my bot in py?

vivid fulcrum
earnest phoenix
#

am I being stupid or am I being stupid

#
let zombieXP = profileSuccess.profile.members.[`${correctuuid}`].slayer_bosses.zombie.xp
#

why doesn't this work?

#

basic syntax error yet i'm so confused

vivid fulcrum
#

what doesn't work

#

oh

earnest phoenix
#

in that line lmao

#

i'm so confused

vivid fulcrum
#

you have a period before indexing the array/object

#

delete the dot

earnest phoenix
#

but it's supposed to be here?

#

part of an api

vivid fulcrum
#

no it isn't

earnest phoenix
#

alright then

vivid fulcrum
#

when you're indexing something

#

you aren't using dots

earnest phoenix
#

oh

#

right

vivid fulcrum
#

instead, you do it right on the object/array

#

. is a property/method accessor

earnest phoenix
#

uhhh i got another question

#

so this is part of the api

#
let profileid = playerSuccess.player.stats.Skyblock.profile;
#

but is there any way for it to get the first file name in that "folder"

#

(yes i know it's profiles and not profile)

#

so under profiles, i want it to get the first file name

vivid fulcrum
#

it's called an array, not a folder

#

or

earnest phoenix
#

right

vivid fulcrum
#

i don't know what that is, it seems to be an object

earnest phoenix
#

opens this up

#

I just need it to get 4dfab9aa438c4dc39e1274d7853a5f59

#

the first array preferably

vivid fulcrum
#

yeah, so, you're going to have to use Object.values() and pass theprofiles to the values() method

#

this will return an array of values

earnest phoenix
#

huh

vivid fulcrum
#

once you get that just index it with an index of 0

earnest phoenix
#

can you change that to monkey brain language

vivid fulcrum
#

uh

quartz kindle
#

lul

vivid fulcrum
#

what don't you understand

earnest phoenix
#

lmao

#

i don't understand where to put Object.values()

quartz kindle
#

you have an object right now, objects have keys, meaning to access a value you must know the key

earnest phoenix
#

i've never used apis really

vivid fulcrum
#

anywhere lol

earnest phoenix
#

don't understand anything

vivid fulcrum
#

this isn't related to apis

#

it's basic js

quartz kindle
#

if you want to access a key that you either dont know, or that is dynamic and can change on every request, then you have to convert the object into a list of keys

#

so you can then get the first key

nova chasm
#

Guys are you gonna update 24/7 ๐Ÿ”Š bot?

quartz kindle
#

to convert an object into an array, you use Object.keys(yourobjecthere)

#

Object.keys() will give you an array of keys inside the object

earnest phoenix
#

can someone show me the piece of code needed lmao

nova chasm
#

I mean it's offline , that's why asking...

vivid fulcrum
#

you can straight up use values, no? they don't need the object key

#

just the value

earnest phoenix
#

well the array changes per request

nova chasm
#

Python ?

vivid fulcrum
#

so just Object.values(obj)

#

it will return an array

nova chasm
#

Ahh JS

vivid fulcrum
#

after you get the array, index it ([0])

#

and you got the first object inside profiles

earnest phoenix
#

griegiermg

#

ahhh idk what you mean lmao

quartz kindle
#
myobj = {
  key1: 10
}

let arrayofkeys = Object.keys(myobj)
let firstkey = arrayofkeys[0];
console.log(firstkey) // "key1"
let valueoffirstkey = myobj[firstkey];
console.log(valueoffirstkey) // 10
vivid fulcrum
#

which part are you confused about

#

that ^^

earnest phoenix
#

everything

#

so myobj would be the profiles section

#

correct?

quartz kindle
#

yes

earnest phoenix
#

alright so

#
let arrayofkeys = Object.keys(profiles) // profiles is a var
let firstkey - arrayofkeys[0];
let profileid = profiles[firstkey];
quartz kindle
#

the id of the profile is the firstkey variable

earnest phoenix
#
          let profiles = playerSuccess.player.stats.Skyblock.profiles;
quartz kindle
#

your profileid variable is already the contents of the profile

earnest phoenix
#

giregie

#

my brain is using all 4 of my braincells

#

and it's failing

#

god damn

quartz kindle
#

arrayofkeys is ["4df97w4ghg0384g",...]

vivid fulcrum
#

SkyBlock

quartz kindle
#

firstkey is "4dfubwog88g3g3go3g4hou"

earnest phoenix
#

omg

#

omfg

#

JGUIRNGIRNMGJINM

quartz kindle
#

profileid is the data that is inside the thing

earnest phoenix
#

im so sorry lmfao

#

it worked

#

ty both of you

static matrix
#

Lavalink or YTDL, which is faster?

eternal osprey
#

hey

#

how do i get a random number between: const min = 32200
const max = 33799

quartz kindle
copper pond
#

Pls help me out with the error

#

Pls ping if anyone answers..

quartz kindle
#

self.bot.ready does not exist

lusty quest
#

ohh no, they pushed slash commands to the beta branch of d.js. i see a ton of people coming here complaining that it doesnt work.

slender thistle
#

LMFAO

pale vessel
#

What

quartz kindle
#

it doesnt work?

lusty quest
pale vessel
eternal osprey
#
        var obj = json[i];
    
        const id = obj.id
    }``` i am looping through a json using this. How do i check whether the message.author.id is in here?
quartz kindle
#

im working on adding it to djsl master

eternal osprey
#

isn;'t there a property named contains?

pale vessel
#

Object.values(obj).includes(message.author.id)

eternal osprey
#

love you

quartz kindle
#

wait

pale vessel
#

or obj.id === message.author.id?

#

not sure where the id is

eternal osprey
pale vessel
#

oh ic

quartz kindle
eternal osprey
#

alrighty

#

and if it doesn't exist, does it return null?

#

yeah right

quartz kindle
#

returns undefined

pale vessel
#

if you have multiple properties that have different IDs use json.find(item => Object.values(item).includes(message.author.id))

eternal osprey
#

which means that i wouldn''t need the for loop

pale vessel
#

you don't need it

eternal osprey
slender thistle
#

Is a cronjob just a while True loop with sleep?

eternal osprey
#

i can access other data by using m.(datavalue). For example: m.status

quartz kindle
#

yes

quartz kindle
slender thistle
#

Not precisely

#

Sec

#
interval = 1 * 60 * 60

if __name__ == '__main__':
    while True:
        login()
        send_request()
        time.sleep(interval)
eternal osprey
#

owh wait i forgot one side note

#
 "metadata": {
            "discordid": "345138133429649408"
        }```this is actually how the discordid is stored
#

alongsdie other info above the metadata

#

wait that is really easy. Just .metadate.discordid

modest maple
eternal osprey
#

how do i send a message as soon as a for loop reached its end?

vivid fulcrum
#

...send it out of the for loop

eternal osprey
#

wait is that really that easy?

slender thistle
#

Yes

eternal osprey
#

because i am getting cannot send an empty mesasge errors

#

eventhough the txt file is filled with info

vivid fulcrum
#

what's your code

eternal osprey
#

wait one sec i need to try something

#
    function getRandomBetween(min, max) {
        return Math.random() * (max - min) + min;
      }
    const constant2 = Math.round(getRandomBetween(32200,33799));
   function string(length) {
        var result           = [];
        var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
        var size = characters.length;
        for ( var i = 0; i < length; i++ ) {
          result.push(characters.charAt(Math.floor(Math.random() * 
     size)));
       }
       return result.join('');
    }
    
    const randomstring = string(10);
     fs.appendFileSync("./generates.txt", constant1 + ":" + constant2 + ":" + username + ":" + password + "-" + randomstring + "\n"); 
    }
    console.log(database)
 message.author.send(database)


    }
}```
#

the txt file gets overwritten with info, but before that console.log(database)

pale vessel
#

txt file db :troll:

eternal osprey
#

it's not a db

#

just some lines of constants from the json file

#

it immediatelly resets the file after its sent.

vivid fulcrum
#

damn that code is so messy

#

did you copypaste parts from so

#

lol

#

anyway

#

you have no variable named database

eternal osprey
#

let database = fs.readFileSync("./generates.txt", "utf8");

pale vessel
vivid fulcrum
#

๐Ÿ™„

pale vessel
vivid fulcrum
#

stop omitting parts of your code if you want help

pale vessel
eternal osprey
#

yeah that is the variable called

#

but it is not a variable

pale vessel
#

i will shitpost somewhere else

earnest phoenix
#

@fast wind

vivid fulcrum
#

omitting code and asking for help is like going to the doctors because you've been coughing but you didn't mention that you smoke 2 packs of cigs a day

eternal osprey
#

sorry cry

pale vessel
eternal osprey
#

it's not a database holy shit

quartz kindle
#

fail

vivid fulcrum
#

lmfao

eternal osprey
#

i am just using the txt file to send to the user

tidal comet
#

-You have to be connected to a voice channel before you can use this command!

eternal osprey
#

it;s not a database

#

it is not

#

IT is NOT

pale vessel
#

perfect crop

quartz kindle
#

lmao

pale vessel
#

NO

quartz kindle
#

i wanted to make it bigger

#

but it doesnt work

pale vessel
#

darn

eternal osprey
#

anyways, does anyone know why this issue is occuring?

vivid fulcrum
pale vessel
#

stop using var and use let/const

eternal osprey
#

okay but that can't be the issue

vivid fulcrum
#

oh wow you get a really nice gradient when you zoom into white pixels so much

eternal osprey
#

guys why are you still trolling me

#

i am genuinely trying to get help here

#

would appreciate if you could be a bit more serious

vivid fulcrum
#

provide your actual entire code

#

without omitting parts

#

and you'll be taken seriously

eternal osprey
#

well instead of making a meme of me, you could've just said that.

#

one sec

vivid fulcrum
eternal osprey
#

okay my bad wait let me bin it

vivid fulcrum
#

also like

quartz kindle
#

where is database defined

vivid fulcrum
#

50% of that code is copypasted from SO ๐Ÿ™„

quartz kindle
#

Lol

vivid fulcrum
pale vessel
#

lmfao

eternal osprey
#

aty the top of the code

pale vessel
#

oh my goodness

#

it's an exact copy

vivid fulcrum
#

if you don't want to be clowned, stop behaving like a clown

quartz kindle
#

is that like a base64 id generator?

vivid fulcrum
#

nah just a random str

#

it's the first result on google for "js generate random string"

#

and you can tell they copypasted it because of the uniform padding on the variable declaration

lusty quest
#

lol i would just use crypto to make a hex string

#

is way compacter, and crypto is a build in module so you have it anyways

quartz kindle
#

i just use Math.random() plus Date.now()

#

and convert it to base 36

green kestrel
#

doesn't node have a "generate uuid" function?

#

I'd use that if it does

quartz kindle
#

not natively

#

plenty of npm packages that do it tho

sudden geyser
#

assuming they implement it correctly

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

/hug

eternal osprey
#

how do i delete the contents of a file after a message is sent?>

#
message.author.send({
  files: ["./generates.txt"]
})``` I know to use fs.writeFileSync("./blabla.txt", ""). But how do i perform it AFTER the .send
vivid fulcrum
#

await it

earnest phoenix
#

<Promise>.then(...)

vivid fulcrum
#

or that

#

but await syntax >>>>>>>>>

#

otherwise you're entering callback hell

earnest phoenix
#

yea

#

Callback hell is messy

#

Not as messy as Luca's meme repository though

quartz kindle
#

wdym luca's code is the best code ever created

#

you need 50 years of experience to pull off something like that

earnest phoenix
#

Beautiful isn't it?

quartz kindle
#

whoever did it is a god

sudden geyser
#

you could make a spinning donut out of that

eternal osprey
earnest phoenix
#

no it wouldn't

#

At least try the async-await syntax

grizzled raven
earnest phoenix
#
// Promise.prototype.then(...)
message.author.send(...).then(() => {
  // Write file
});

// async-await
await message.author.send(...);
// Write file```
earnest phoenix
#

how do i get my bot's webhook url?

sudden geyser
#

You create a web server and have top.gg hit the endpoint for your webhook URL (can be configured on your bot's profile settings on top.gg).

vagrant grove
#

Asd

eternal osprey
#
let args1 = ""
let args2 = ""
    if(message.author === 'bot') return;
if(message.content.startsWith(`${config.prefix}generate`)){
    const args = message.content.split("\n")
    .map((x) => x.split(/ +/));
    if(args.length == 4){
args1 = args[0][1] + args[0][2]  
args2 = args[0][3]
 }
 else if(args.length == 3){
  args1 = args[0][1]
  args2 = args[0][2]
 }
    
  
    
    console.log(args1)``` Why does this console.log return nothing?
earnest phoenix
#

You're looking for <Message>.author.bot

eternal osprey
#

aha yeah sorry

#

that isn't the issue tho

#

let me provide an updated snippet

#
let args1;
let args2;
client.on("message", async message => {
   
if(message.content.startsWith(`${config.prefix}generate`)){
    const args = message.content.split("\n")
    .map((x) => x.split(/ +/));
    if(args.length == 4){
args1 = (args[0][1] + args[0][2])
args2 = args[0][3]
 }
 else if(args.length == 3){
   args1 = args[0][1]
   args2 = args[0][2]
 }
    
  
 console.log(args1)
    console.log(args2)```
earnest phoenix
#

Because the length of the array might be even equal to 4 or 3, that's why they're empty

#

Try logging args.length at least

eternal osprey
#

it shows 4 or 3 depending on how i use it

#

let me log them for you

earnest phoenix
#

And you're accessing non existent indexes

#

args[0][1] can be undefined for example

#

Try logging args[0]

eternal osprey
#

owh shit

#

i forgot that i have an array of an array

vagrant grove
#

:c

earnest phoenix
#

What's the issue

vagrant grove
#

event is not defined

earnest phoenix
#

Because you didn't define any variable called event...

vagrant grove
#

ohh ok

#

XD

earnest phoenix
#

You're calling the <EventEmitter>.emit() method and the client class extends the EventEmitter class

#

You can do Client.emit(...)

weak cypress
#

I was going to do a server statistics command for my application but the code is not working, can you help me?

earnest phoenix
#

how make this any one say pls i cnt know html

umbral zealot
#

<table>

umbral zealot
earnest phoenix
#

whare should i rigth my eliments

#
<table>
    <thead>
        <tr>
            <th colspan="2">The table header</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>The table body</td>
            <td>with two columns</td>
        </tr>
    </tbody>
</table>

slender thistle
#

Learn HTML

weak cypress
slender thistle
#

What's the issue

#

What isn't working

#

Are there any errors you're getting

vagrant grove
earnest phoenix
#

how wright is big size any one say pls

#

music tune

umbral zealot
#

Use CSS for that

#

or <h1> tags

#

maybe you should go through a simple HTML and CSS tutorial

signal estuary
#

Can someone tell me why the bot doesnt return and throws an error instead:

let user = msg.mentions.users.first() || await client.users.fetch(args[0]) || undefined;
if(!user) return msg.channel.send("User not found")
earnest phoenix
#

bro ic cnt know htm;

umbral zealot
#

bro u cn

#

just lern

earnest phoenix
#

I think I learn html and CSS

#

So I can be prepared for website

signal estuary
umbral zealot
#

... what. 404????

#

Can you show a screenshot or something

earnest phoenix
#

so error comes

signal estuary
umbral zealot
#

huh. interesting. I thought that would return undefined

#

well I guess you have to catch it then

#

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

umbral zealot
signal estuary
earnest phoenix
#

oho api probleam

#

i think user cnt define

umbral zealot
#

ok maybe but there's millions of people that use k , I've literally never seen anyone say "cnt"

#

except this dude

terse ingot
#

What's cnt

umbral zealot
#

It's when you're too lazy to type "can't"

#

but you can type literally every other word correctly

earnest phoenix
umbral zealot
#

Dude you're not helping

#

smh

terse ingot
#

I see thz

earnest phoenix
#

ok nothing

umbral zealot
#

do this

earnest phoenix
#

owo

umbral zealot
umbral zealot
#

Thank you madam.

earnest phoenix
umbral zealot
#

What, you can call everyone 'sir' but I can't call everyone 'madam'? what a double standard.

umbral zealot
#

And I am not.

signal estuary
umbral zealot
earnest phoenix
#

Hi I got a development question, is it hard to cluster shards for discord bot

umbral zealot
#

pretty hard yeah

earnest phoenix
#

Where can I learn it?

umbral zealot
#

That's... not something you just "learn"

#

clustering is a super advanced concept in application development

#

How many guilds is your bot on?

earnest phoenix
#

Oh I just want to learn clustering

umbral zealot
#

Ok but this is like saying you "just want to learn nuclear fusion" and all you want to power is a flashlight

#

This isn't something you just pick up

earnest phoenix
#

Oh true

umbral zealot
#

It takes years of development experience to understand something like this

earnest phoenix
#

Sorry for being rude , the actual reason is because i want to know how to make clusters beforehand

umbral zealot
#

Yes.

#

clustering is something bots like dank memer need - on millions of guilds

#

learn to breathe before trying to learn how to run a marathon.

earnest phoenix
#

Yea, probably need to let my bot grow first

#

So is it needed to cluster shards or nah

umbral zealot
#

I think you're using the word "Cluster" thinking it's relevant to you. it's not

#

You will be able to shard later on, but don't worry about this until you reach about 2000 guilds. Then you can think about sharding and execute it.

#

And for most discord.js bots that literally just means doing new Discord.Client({ shards: 'auto' }) and that's it.

sudden geyser
#

@earnest phoenix if you want to learn what clustering is, I recommend you read https://en.wikipedia.org/wiki/Computer_cluster

A computer cluster is a set of computers that work together so that they can be viewed as a single system. Unlike grid computers, computer clusters have each node set to perform the same task, controlled and scheduled by software.
The components of a cluster are usually connected to each other through fast local area networks, with each node (co...

twilit hemlock
#

how to look for sub folders

    fs.readdir('./commands', (err, files) => {
        if(err) return console.log(err);
        let jsfile = files.filter(f => f.split(".").pop() == 'js')

        if(jsfile.length == 0) {return console.log("Could not find any commands!")}

        jsfile.forEach(f => {
            let props = require(`./commands/${f}`)
            bot.commands.set(props.help.name, props)
        })
    })  ```
sudden geyser
#

Call fs.readdir again.

#

If there may be an arbitrary number of subfolders consider making it recursive / use a loop.

heady ember
#

has someone any improvement ideas for this help panel?

earnest phoenix
#

Ahh ok @umbral zealot and @sudden geyser

sudden geyser
#

In combination to my first message, ```js
fs.readdir("./commands", (err, directories) => {
handleError(err);

for (directory of directories) {
fs.readdir(./commands/${directory}, (err, files) => {
handleError(err);

  // `files` is your JS files
});

}
});

umbral zealot
twilit hemlock
sudden geyser
#

See the example I wrote.

sick apex
#

Do someone know why when I start new terminal nvm won't bind as alias ?

#

it fucked up my bot like 20th time

misty sigil
#

bit of fun innit

twilit hemlock
#

Ok

pulsar spade
#

Hello for me html and css not working on bot description when adding bot

dusky sundial
#

Could you show it?

pulsar spade
#

@dusky sundialcode?

#

on DM?

dusky sundial
#

No, just post the code here

#

otherwise people won't be able to help you

pulsar spade
#

nvm working now but gif has some issue with resolution

earnest phoenix
#

dose anyone know free 24/7 hosting?

lyric mountain
#

free regardless of quality?

earnest phoenix
#

yes

lyric mountain
#

replit

earnest phoenix
#

?

lyric mountain
#

literally

earnest phoenix
#

that is me having to re cod

lyric mountain
#

?

#

re cod what?

earnest phoenix
#

my code

lyric mountain
#

why?

earnest phoenix
#

thats what it dose

#

and its pub

deep mantle
#

you can hide your token

earnest phoenix
#

?

#

how

lyric mountain
#

you SHOULD hide your token

deep mantle
#

yes

snow tartan
#

Indeed

vivid fulcrum
#

recode
2 line change

earnest phoenix
#

How add sportify npm in node. J's

vivid fulcrum
#

what

earnest phoenix
#

How add sportify api in

#

Node

vivid fulcrum
#

what is sportify

#

do you mean spotify

earnest phoenix
#

Hmm

cinder patio
earnest phoenix
earnest phoenix
lyric mountain
earnest phoenix
vivid fulcrum
#

not a very smart individual, are you

earnest phoenix
#

Every time ping me

earnest phoenix
cinder patio
#

Hey how old are you?

earnest phoenix
cinder patio
#

no, the guy with the cat pfp

cinder patio
charred nest
#

when do you guys recommend beginning to shard? iโ€™m currently @ 720 servers, i know by 2000 you should definitely start sharding but should i begin to learn about it now & implement more towards 1500 ? or should i wait a bit longer than that ia_think_thonk

lusty quest
#

regarding "free" hosts they dont exist (exept you have a friend who runs it on his Root server or Paid VPS)

lusty quest
#

if you reach 1k i would start

charred nest
#

alright, thanks yโ€™all

lusty quest
#

its what discord recommends

charred nest
#

n about free hosts, donโ€™t use em, even if they say โ€œfreeโ€, itโ€™s either just a trial for a week then you have to pay or itโ€™s an untrustworthy site that leaks your token & then youโ€™re screwed

lusty quest
#

or steal all your code and sell it

charred nest
#

i recommend DigitalOcean

lusty quest
#

they are fine if you dont do heavy stuff like AI

pulsar spade
#

i use repl

lusty quest
#

free hosts are ok for testing, but for production they are no where close reliable enough

charred nest
#

mhm

#

nor very trustworthy

lusty quest
#

if you run stuff like a website that maybe work a free host is fine, if it starts to use critical data get a paid vps and secure it properly

modest crane
#

imagine not getting 3 free vps from google cloud and oracle cloud

lusty quest
#

good luck trying to run tensorflow on them

#

sure it will run but will also take ages

modest crane
earnest phoenix
#

I maked a bot and I know one admin he added my bot in 100 real servers in one day after we apply for verification it says suspicious growth KEKW

cinder patio
#

duh

lusty quest
#

well this is suspicious growth

earnest phoenix
#

Ok we will increase bot active

#

And re apply after few weeks

lusty quest
#

you have to get now to 280 or so guilds

#

if you do the same thing again i guess you get flagged again

earnest phoenix
#

Then?

lusty quest
#

you do nothing, it has to grow naturaly

cinder patio
#

bruh

lusty quest
#

there are many people who try to trick into certification, idk what happens if you get flagged again tbh, maybe they just kill the application

sudden geyser
#

[PostgreSQL] I'm using an implementation of Facebook's DataLoader utility for batching query data for my backend GraphQL API and SQL query. This makes it possible to load a bunch of IDs from different fields in one SQL query (e.g. calling loader.load_one(...) in 10 different places results in one SELECT * FROM users WHERE id = ANY($1)).

For simple fields, it's been relatively easy, but with connections, I'm hitting an obstacle where the data to load may be different from one another. For example, connection => [{ id: 1, cursor: "123=", limit: 3 }, { id: 5, cursor: "93752=", limit: 5 }].

The issue I want to solve is not with DataLoader: it's how to model such a query. I'd like to avoid forcing the loader to call the database multiple times for each connection, since that would break one of the core problems DataLoader solves.

earnest phoenix
lusty quest
lyric mountain
#

shitty but yes

lyric mountain
molten lagoon
#

why is everyone using another language here ;-;

lyric mountain
#

like, select N rows filtering by row number

#

SELECT * FROM users WHERE row_number(ORDER BY id) BETWEEN 1 AND 20

#

or if you want:

#

SELECT * FROM users WHERE row_number(ORDER BY id) BETWEEN 1 + (20 * :chunk) AND 20 + (20 * :chunk)

final pebble
#

hello
why count server does not work?

crimson vapor
#

you need to post

final pebble
#

post what?

deep mantle
#

Servcount with the DBL API

final pebble
#

ok thank you

rapid wharf
#

Discord.py how to get the no of bots in a server . i tried this

        if bots.bot in bots:
            await ctx.send(len(bots.bot))```
but no responce
sudden geyser
# lyric mountain why don't u just use chunked queries?

I don't think I can use chunked queries because multiple connections may request different rows from the table. I'm using the row's id primary key (a uuid) and a created_at field (TIMESTAMPTZ) to create an order for cursors (one small challenge when using uuid due to them not being incremental).

For example, one connection requests 3 rows at most and wants the first 5 rows, and another connection requests 5 rows at most and wants the last 2 rows. It's a bit confusing to model in my head and describe, but this gets even harder if I add more fields, so I may go back to the drawing board and think about how to model the data loader.

blazing sentinel
final pebble
crimson vapor
#

POST, not GET

dusky sundial
crimson vapor
#

what language do you use @final pebble

blazing sentinel
#

and you wont do it from your browser, your bot will do that

final pebble
#

python

blazing sentinel
#

also you need a DBL token

rapid wharf
blazing sentinel
#

go to your bot > edit > webhooks > copy token

dusky sundial
dusky sundial
#

Keep in mind that you're gonna need the members intent for that to work

rapid wharf
#

i have it

final pebble
deep mantle
blazing sentinel
blazing sentinel
blazing sentinel
#

and but it in your request headers as Authorization

rapid wharf
blazing sentinel
final pebble
#

i dont know what u talking about

deep mantle
blazing sentinel
rapid wharf
blazing sentinel
#

in requests, u can do sth like this:

requests.post("https://top.gg/api/bot/mybotid/stats",headers={"Authorization":"your DBL token"}, data={"server_count":len(bot.guilds)})
#

but you have to install requests library using pip

#

and add import requests at the top of the file

final pebble
#

ahhh ok will try now
thank you man

blazing sentinel
#

how much servers does your bot run on?

final pebble
#

24

blazing sentinel
#

ok

#

if your bot gets bigger, use aiohttp instead of requests

#

i gave the example with requests because it is easy

#

but requests is not async, and it will block your code

final pebble
#

turn out iam using requests

final pebble
#

@blazing sentinel
how time does it take to update because still does not counting

blazing sentinel
#

at the time

final pebble
#

that is the right way?

snow urchin
sudden geyser
#

I think you need to use ON DELETE CASCADE

snow urchin
#

And how would I use it? I am not the best with MySql at all

sudden geyser
#

But there are many variants in replacement of CASCADE

#

You need to use on the foreign key constraint.

lyric mountain
#

yeah, cascade is the solution

#

also mysql is bad

sudden geyser
snow urchin
#

yes, but that doesnt show how to edit an existing table for it, I do not want to create a new table

lyric mountain
#

"How to remove children with parent" KEKW

snow urchin
#

unless im being dumb

pulsar spade
#

anyone tried deep learning bot hosting on repl for free?

lyric mountain
#

you can't at all

sudden geyser
#

Deep learning bot hosting?

lyric mountain
#

replit is too weak for anything AI-related

pulsar spade
#

ye

#

@sudden geyser

lyric mountain
#

ignored

sudden geyser
pulsar spade
#

@lyric mountainnot ignored

sudden geyser
pulsar spade
#

yep, i made a test discord bot with DL but idk if repl can handle

lyric mountain
#

it can handle about 10 requests MAYBE

#

you'll hit RAM ceiling way too fast

#

that or you'll have about 1 answer/hour

pulsar spade
#

wondering about also repl provide gpu hosting by default ?

lyric mountain
#

i don't even know if you can have a gpu there

#

it's really REALLY barebones

pulsar spade
#

i see since there tensorflow package avaliable

echo wing
#

Sorry if this is in the wrong place, but just a brief question on the best way to display lots of data?
More of a "user ease of use" type question but any answers / suggestions are appreciated.

sudden geyser
#

You should use pagination with reactions.

lyric mountain
#

best way is not to display lots of data

#

try to minimize as much as possible

echo wing
lyric mountain
#

and yes, as lite said, paginate

echo wing
#

thank you guys, i do realize it's quite crowded

lyric mountain
#

it's not being crowded that's the issue

#

it's the char limit

echo wing
#

well luckily haven't run into it yet, but ive noticed on mobile devices it does not display as nicely

lyric mountain
#

6000 chars max per embed

echo wing
#

oh i thought it was 1024

#

oh thats per field my bad

lyric mountain
#

1024 per field value iirc

#

or title

echo wing
#

yep

lyric mountain
#

I don't remember which one was

echo wing
#

value

sudden geyser
#

The best way to display your content is to only include as much information as the user needs (as Kuu said). For example, allowing a user to look up achievements for a specific category (e.g. a game) or pointing the user to the website.

lyric mountain
#

or better yet

#

using canvas to make an achievement display

echo wing
#

having it on the website ain't a bad idea either, but i really like the reaction and pages idea

snow urchin
pale vessel
#

@clear marlin i see your name ๐Ÿ‘€

pale vessel
snow urchin
pale vessel
#

try running node -v

snow urchin
#

ye ik, it has updated just fine

quartz kindle
#

if you're using pm2 then you're having a common pm2 issue

pale vessel
#

they are

snow urchin
quartz kindle
#

manually define the engine path using either the command line or an ecosystem file

#

or completely remove pm2 and all apps from pm2 and try adding them again

snow urchin
quartz kindle
#

pm2 start server.js --interpreter=/full/path/to/node/version

#

you can also try --interpreter=node@14

#

or with the full node version: node@14.5.5 or whatever yours is

snow urchin
#

so --interpreter=node@14.16.1

#

and I presume I need to rebuild node modules after updating? cause its screaming at me now

#

LOL

#

yarn rebuild doesn't seem to work though, says rebuild is not a command

quartz kindle
#

delete node_modules and whatever package.lock yarn uses

#

and have it install again

#

i stopped using yarn because of shit like that

#

it sucks at building native addons

snow urchin
quartz kindle
#

then try the full path to where node is installed

snow urchin
#

ive not a clue where its installed at ๐Ÿ˜„

quartz kindle
#

run nvm which node

#

or nvm root

snow urchin
quartz kindle
#

well it says that module must be installed separately

#

so add it to your package.json maybe?

snow urchin
#

right ye, thought it already was

quartz kindle
#

data?.["test"]

fair axle
#

thanks

snow urchin
#

smh so much errors after updating

quartz kindle
#

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

eternal osprey
#

hey

#

how do i define a variable on my request? ```js
request(options, function (error, response) {

if (error) throw new Error(error);

});``` i should await it right? And then simply const ... = request(

lavish bramble
#
async function part1(){
        await message.channel.send(`>>> Your Game will be starts in 5sec\nType :- \`cancel\` to End`)
        await message.channel.send(m)
        await message.channel.awaitMessages(m => m.author.id == message.author.id,
        {max: 1, time: 1800000}).then(collected => {
            if (collected.first().content.toLowerCase() == 'cancel') {
                message.channel.send('**game ended**')
                status = 1
                return
            }else{
                 const right = collected.first().content
            if(right == m) {
            	message.reply("โœ… ")
            
            status = 1
            }
            	
            }else{
            	const wrong = collected.first().content
            	if(!wrong == m){
            		message.reply("W")
            	}
            }

Error :- unexpected token else

vivid fulcrum
#

well, it's unexpected

#

you can't else and else

lavish bramble
#

So what can I do?

vivid fulcrum
#

else is already in case nothing above is true

eternal osprey
#

like the method used

vivid fulcrum
#

don't understand what you're trying to say

eternal osprey
#

i am trying to define a variable to my request.get

#

and i asked if i could just await it and then define a variable to it?

quartz kindle
#

you want to return response into a variable?

eternal osprey
#

so it would become something like this: ```js
var test;
request(options, function (error, response) {

if (error) throw new Error(error);

}).then(() => console.log(test))```
okay like this?

quartz kindle
#

no you cant

#

its a callback

eternal osprey
#

owh

#

how would i ever get info from it then

quartz kindle
#

you need to wrap it in a promise

vivid fulcrum
#

luckily node has a util func that does it for you

quartz kindle
#
// synchronous library
const result = something();

// asynchronous library with promises
const result = await something();

// asynchronous library with callbacks
const result = await new Promise((resolve, reject) => {
  something((error, result) => {
    if(error) { reject(error); }
    else { resolve(result); }
  })
})
eternal osprey
#

owh so it is not possible to use .then?

quartz kindle
#

if the library does not support promises, no

#

callbacks are an old thing, before promises existed

eternal osprey
#

alrighty!

quartz kindle
#

you can also use what cry said

eternal osprey
#

yeah i had a look at that earlier but i don't quite get that. Rather just stick with what you told me

quartz kindle
#
const promisify = require("util").promisify;
const somethingPromise = promisify(something);

const result = await somethingPromise();
#

it depends on the function tho

#

promisify does not support all things

eternal osprey
#
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'URLGOESHERE',
  'headers': {
    'Authorization': 'AUTHGOESHERE'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});```yeah this is exactly how i get it
vivid fulcrum
#

why are you using request

#

it's deprecated, you should've gotten a warning when installing it

eternal osprey
#

umh yeah

terse finch
#

is there an efficient way to grab all the guild members ids using discord.py

eternal osprey
#

because this code was from like a while back, i just got back to it

vivid fulcrum
#

replace request with node-fetch

eternal osprey
vivid fulcrum
#

request probably has a ton of vulnerabilities by now

eternal osprey
#

because we already have the contents right

vivid fulcrum
#

because the value is in the callback function

#

it isn't returned to you

#

request was designed in 2009

vivid fulcrum
pale vessel
vivid fulcrum
#

yeah probably

#

i dont believe shit they say lol

eternal osprey
vivid fulcrum
#

aand they're still using it

#

dude pla

#

pls

fair axle
#

Is anyone has an idea how can we calculate bot's ping on slash commands?

drifting wedge
#

how can i make it all equally spaced out

#

including the dividers

sudden geyser
#

What is this in the first place

boreal iron
drifting wedge
#

its fine

opal plank
drifting wedge
#

i need help

boreal iron
#

convert the container around as display: table; as the inner containers (divs) to table: cell;

drifting wedge
#

i only dont accept css -1 version code

#

like sub 0 version

boreal iron
#

they will align with the total table width

drifting wedge
#

alright ty

vivid fulcrum
#

or

opal plank
#

@fair axle the ping is the same either way, you ping discord's domain, whatever endpoint you go to wont have much effect at all

vivid fulcrum
#

the modern approach

boreal iron
vivid fulcrum
#

flexbox

#

display: flex
justify-content: space-evenly

boreal iron
#

... there we go anyone just waited until I, the dinosaur, answers

drifting wedge
#

it puts it all in the middle

boreal iron
#

Yes common table behavior

fair axle
drifting wedge
opal plank
boreal iron
#

add text-align: left: for the table cells

lyric mountain
#

that's space-around

#

you gotta stretch the div

#

else it'll shrink

drifting wedge
#

wot

#

my brain is dying

#

dumb peopel words

#

pls

boreal iron
#

hold on, that looks like you're using 1 DIV only for the whole menu

drifting wedge
#

im using multiple

#

i have container

boreal iron
#

show the structure

lyric mountain
#

red is the page width, blue is your div

karmic timber
#

Ciao

boreal iron
#
<div>
  <div>menu 1</div>
  <div>menu 1</div>
  <div>menu 1</div>
</div>
lyric mountain
#

if you don't stretch the blue div, it'll wrap around the content

#

styles="width: 100%"

drifting wedge
#

wait

#

hold up

#

im using tables

boreal iron
drifting wedge
#

my brain

opal plank
# fair axle Thanks

it boils down to the request itself taking longer response time due to the servers in all honesty

#

if you do 5 requests, you'll see all of them having a similar but slightly changed response time

boreal iron
#

Even I am not using tables in 2021 anymore...

lavish bramble
#

Can I change the time of guild created at