#development

1 messages ¡ Page 1801 of 1

eternal osprey
#

Or is that js - excel integration not available

digital ibex
#

why are u sending ur data to excel, there IS a better solution to what ur trying to do

#

and client side or server side

eternal osprey
#

that's all tbh.

digital ibex
#

u can do that in js

eternal osprey
#

how would i do that?

digital ibex
#

do u mean "strucurize" by changing the data?

eternal osprey
#

I tried reading docs and got a few potential packages but unsure whether they will do what i please

digital ibex
#

or whats goin on

eternal osprey
#

for example a txt file with 5 words. I want those 5 words copied to the excel file that is available in the folder / one that gets made (either option will do)

digital ibex
#

so, im assuming you've already retrieved the data from the txt file yeah?

eternal osprey
#

yup!

digital ibex
#

so client or server side

eternal osprey
#

not sure what you mean. The bot is handling and fetching information from an api, so I would say client side.

#

and saving that info (after escaping the arrays) in a txt file

digital ibex
#

is it form data?

eternal osprey
#

It's just a plain txt file

#

with words each line

digital ibex
eternal osprey
#

oowh yeah i thought so!

#

I actually already searched a tutorial about that one

wheat mesa
#

@digital ibex I was able to fix some of the errors, but I'm still working on things

#

In order to fix the initial issue you're having you need to export your class.

digital ibex
#

yeah

#

thats not changed anything

#

?

wheat mesa
#

You still have errors, but they're different than before.

digital ibex
#

oh?

wheat mesa
#

In some of your other files, you do const RandomGenerator = require("../../../index")

#

But what you need to do there is const RandomGenerator = require("../index.js")

#

By the way, I highly recommend not having 2 index.js files, as it makes it kind of confusing on yourself

digital ibex
#

but then i have to create a new instance of the same class

#

then it'll have incorrect data

wheat mesa
#

I'm not really sure what your goal is here, I just read the errors and attempted to fix it to what I assume you were trying to do

#

You're trying to create an instance of your RandomGenerator class in the Position.js and Random.js files, right?

digital ibex
#

so im creating the class in the root index.js. im not creating it anywhere else as i need the data, and if i create it elsewhere it'll have none of the corresponding data

digital ibex
#

i just got the same data from the root index.js

wheat mesa
#

Oh, so you're using the root index.js file to export an instance of your RandomGenerator class, then?

#

If I understood correctly

digital ibex
#

yeah

eternal osprey
#

Hey pro discord mod, I tried reading the docs ad have issues understanding how I would get a whole total txt file and push it in a row

#

because they input it manually

limber mica
#

How do i fetch users instead of getting em from the cache?

digital ibex
wheat mesa
#

Position.js ```js
const RandomGenerator = require("../../../../index.js");

module.exports = class Position {
constructor() {
this.random = RandomGenerator;
}

get data() {
    return this.random;
}

}

#

I believe this is what you're looking for?

digital ibex
#

but thats not going to fix it

#

i'll try

solemn latch
wheat mesa
#

You're right, it won't fix the errors

#

But it's fixing the errors one step at a time

limber mica
#

client.users.fetch(ID) returns a 404

digital ibex
#
module.exports = class position {}

class bob {}
module.exports = bob;
``` both r the same thing which doesnt change anything
wheat mesa
#

No, it's not the same thing to my knowledge

#

I don't think you can do that

digital ibex
#

it is

#

i've been doin that for

#

like forever

lyric mountain
#

you indeed can

wheat mesa
#

Hm, never seen that before

lyric mountain
#

you're just declaring before exporting

#

instead of directly exporting

solemn latch
digital ibex
#

yo kuuhaku any idea on how to fix my problem btw

#

?

wheat mesa
#

Okay for some reason my setup earlier wasn't working with that version of declaring an export

lyric mountain
#

where does it start?

limber mica
digital ibex
#

uh one sec

limber mica
#

Im struggling with the API call for it

#

I only have the guild id

digital ibex
solemn latch
limber mica
limber mica
#

Thats all i get

solemn latch
#

how are you getting the guild owner id?

eternal osprey
limber mica
eternal osprey
#

i cannot fin the info's in the docs to do that

#

they only use manual input

digital ibex
#

idk i've never used it

#

i just found it and yeah

solemn latch
digital ibex
#

lemme give it a quick read

limber mica
#

I can only get the owner ID

solemn latch
#

OH duh

#

im dumb

limber mica
#

So am i

digital ibex
limber mica
#

Here is my fetch code

client.guilds.fetch(args[0])
            .then(guildtarget=> { 
//code here
})
digital ibex
#

cuz u creating & deleting a txt file and exporting it to excel doesnt seem very

#

uh

#

good

eternal osprey
#

no i am not deleting it

#

i removed that part

digital ibex
#

why are u using a txt file

solemn latch
digital ibex
#

why not just store it in ur memory

#

or in a db

#

that'll be like a billion times better performance wise

eternal osprey
#

But it is not really performance bound and needing

#

it can even have delays of hours, it doesn't matter.

#

I just need to export whole files to excel

digital ibex
#

okay

#

i mean its pretty straight forward since all u have to do is jus add a script tag

wheat mesa
#

@digital ibex which error are you getting still?

#

I'm no longer getting any errors related to the root index.js file

digital ibex
#

same, Index is not a constructor

wheat mesa
#

After some modifications

eternal osprey
digital ibex
#

me neither

#

u just copy and paste the script tag

wheat mesa
#

I have this in the root index file: ```js
const Index = require("./Random-Generator/src/lib/index")

module.exports = new Index();

digital ibex
#

and ur done

wheat mesa
#

Works fine

#

And in position.js ```js
const RandomGenerator = require("../../../../index");

class Position {
constructor() {
this.random = RandomGenerator;
}

get data() {
    return this.random;
}

}

module.exports = Position;

digital ibex
#

u've got the exact same code, the code is no different apart from the path

wheat mesa
#

The path seemed to be the problem for the most part

digital ibex
#

it will throw a different error like module not found

wheat mesa
#

Yes, I had a few of those errors come up

digital ibex
#

i havent

wheat mesa
#

The only files I modified were both of the index.js files, and then the 2 files in structures

digital ibex
#

yeah

#

u changed the path

wheat mesa
#

Yes

digital ibex
#

?? if i change the path the file does not exist

#

what

wheat mesa
#

I'm getting a different error now instead, but nothing related to the original problem you had

digital ibex
#

u have to change the path otherwise the file wont exist

#

mate

#

show me ur full path

#

mine is c:/users/user/deskop/random-generator

#

u've probably got something like c:/users/user/desktop/something/random-generator

wheat mesa
#

Yes, that's what I've got

digital ibex
#

so u've got something and i dont

wheat mesa
#

I'm not really sure how to fix the problem for you, seems to not have the same problem for me

digital ibex
#

so u need an extra ../

wheat mesa
#

I'm not quite sure what to tell you at this point

digital ibex
#

im trying to say, the path has nothing to do with it

#

the error is essentially saying that Index is not a class

wheat mesa
#

Let me clone the project again rq, I think something is being weird with the way it's cloning

#

Alright, I've cloned the project, and I'm not getting the error of Index is not a constructor

#

Instead it throws this: ```C:\Users\jacks\Desktop\Random-Generator\src\lib\structures\Position.js:5
this.random = RandomGenerator();
^

TypeError: RandomGenerator is not a function
at new Position (C:\Users\jacks\Desktop\Random-Generator\src\lib\structures\Position.js:5:17)
at new Random (C:\Users\jacks\Desktop\Random-Generator\src\lib\structures\Random.js:6:3)
at Object.<anonymous> (C:\Users\jacks\Desktop\Random-Generator\src\lib\core\Class.js:2:13)
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 Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\jacks\Desktop\Random-Generator\src\lib\index.js:4:14)```

#

So I'm not quite sure why you're still getting the Index is not a constructor error

#

Did you save your new code before running it? That's the only thing I can think of as to why it would still give you that error

digital ibex
#

im goin to src/tests

#

and then doing node name

wheat mesa
#

Oh, I wasn't aware that you were running it from there

slender wagon
#

how do i access the second href?

story.querySelector('.heading')
digital ibex
#

add a class or an id

#

and then jus

slender wagon
#

i can't

digital ibex
#

<doc>.getElementById or something

#

why cant u

slender wagon
#

cuz scraping

digital ibex
#

what

slender wagon
#

web scraping

digital ibex
#

u can still do it

slender wagon
#

how

digital ibex
#

thats not stopping u

#

edit as html

#

or whatever

slender wagon
#

wha

digital ibex
#

right click i think

#

on the "elements" tab

#

I think

woeful pike
#

.heading > a + a

slender wagon
slender wagon
#

scraping*

digital ibex
#

um chill question mark

#

i also said "i think"

slender wagon
#

i am chill, was just saying lol

woeful pike
#

how do I automate x?
idk have u tried doing it by hand?

slender wagon
#

lol

#

💀

#

i am scraping links without the full url, they are like /page/ofthesite
but my page automatically adds http://127.0.0.1:5500/ infront of it

#

is there a way i could get rid of that

boreal iron
#

Try to explain what you wanna do without using the same words again.

slender wagon
#

so

#

i get a not complete url

#

/test/page

boreal iron
#

Where did I get it from?

slender wagon
#

and as soon as it reaches my site the site it self gives it its own tld

#

scraping

boreal iron
#

Yeah that’s a normal behavior of your webserver.
If you don’t add a HTTP_HOST or SERVER_NAME to the URL it will be handled as relatively local path.

slender wagon
#

i tried

#

it doesn't seem to work

#

it still has the current tld in

boreal iron
#

You need to add the domain name as prefix before the path you’re “scrapping”

slender wagon
#

so pull both domain name and the url?

boreal iron
#

A valid URL starts with the protocol
In that case with http(s)://

slender wagon
#

yeah i see

boreal iron
#

My virtual host folder name is the same as the domain name
It would be funny if the web server would think that path would be an URL

#

(Without the protocol)

slender wagon
#

no no

#

i add the protocol

#

it still doesn't recognize

#

cuz as soon as it pulls it adds its own tld

#

so i gotta find a way to scrape it together with its own tld

#

using vanilla js and it is a pain

boreal iron
slender wagon
#
 const url = story.querySelector('.heading > a').href```
#

here is how the url that it pulls is like

#

so at the time that it pulls it automatically assigns its own tld

#

so if i log url i'll get the current tld and then the page

quartz kindle
#

The HTMLAnchorElement.href property is a stringifier that returns a USVString containing the whole URL, and allows the href to be updated.

woeful pike
#

url.replace(baseUrl, "")

quartz kindle
#

The HTMLAnchorElement.pathname property is a USVString containing an initial '/' followed by the path of the URL not including the query string or fragment (or the empty string if there is no path).

slender wagon
woeful pike
#

I mean you're looking to remove the base url from a url and this is how you do it

quartz kindle
#

or just use the correct property that already gives it to you

boreal iron
#

Yeah I see looks like JS is adding the FQDN to it

slender wagon
#

hhh

boreal iron
#

It so just replace your local server name by the remote one

woeful pike
#

even if you don't know about pathname (which doesn't include querystring so technically not 100% the solution) I'm not exposing some crazy hidden knowledge, this is just how you implement the thing you want to do

boreal iron
#

As your script knows your exact current server name

slender wagon
#

i got 200 domain names that are gonna use the same page

woeful pike
#

sometimes you have a super hidden method like array.copyWithin that you probably haven't heard of and it's like the perfect solution but this is just how you remove things from strings lol

boreal iron
#

Then use a framework, for example jQuery to fetch the exact value

#

*element value

#

$(element).attr(“href”);

element can still be the element you got via It’s Id

#

_I hate mobile auto correction _

slender wagon
#

oh i wont use jQuery on this project

boreal iron
#

Well not much more I can suggest then

slender wagon
#

yeah no worries

boreal iron
#

Yeah nvm didn’t even notice Xetaras and Tim’s response

crimson vapor
#

ayo pog

clever agate
wheat mesa
boreal iron
#

I was but not anymore

bright thorn
#
if(message && message.guild) {
                  message.channel.messages.fetch(client.setups.get(message.guild.id).message_track_info).then(msg=>{
                    msg.edit(msg.embeds[0].setDescription(`${createBarlul(player)}`)).catch(e => console.log("Couldn't delete msg, this is for preventing a bug".gray));
                  })
#

this message is not editing

#

i can't understand this issue

#

anyone can solve

#

please

wheat mesa
#

You should probably create a new embed, and then edit the message with that embed. Also, the first parameter of message.edit() does not take an embed (https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=edit)

bright thorn
#

embed 0

#

this is defined

#

also

wheat mesa
#

Well yes, just saying that it's easier to create a new embed

wheat mesa
bright thorn
wheat mesa
#

I'm assuming you're trying to edit an embed, usually I do something along the lines of ```js
const Embed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setTitle(Cool embed)
let myMessage = await message.channel.send({ embed: Embed })

// Blah blah blah code stuff until you need to edit the embed

const NewEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setTitle(New edited embed!)
myMessage.edit(NewEmbed)

bright thorn
#

line 124

copper cradle
#

and this dude was making a bot tutorial series

lament rock
marble juniper
#

nice ghost ping

clear marlin
marble juniper
wheat mesa
#

fuck it

#

detritus time

opal plank
copper cradle
wheat mesa
#

I have no clue where to start but I'll figure it out okeh

copper cradle
#

I'm gonna make a pr removing the entire lib

wheat mesa
#

lmao

opal plank
clear marlin
#

okay wait, its time to write an article

opal plank
#

my repo is good to start with, the docs examples are good to get a basic hang of the lib, and cake's repo is big brain time where u might be scared of the advanced syntax

clear marlin
#

on detritus

opal plank
#

tetritus

#

say it right scrib

lament rock
#

tetris

wheat mesa
#

You're 1 contribution away from 1k this year nice

clear marlin
opal plank
#

imagine not knowing how to spell tetanus

lament rock
#

gonna start calling detritus tetris

clear marlin
#

yes

#

good

opal plank
wheat mesa
#

Also gonna look up how to set up a linter cus I've never done that before!

opal plank
lament rock
#

eslint is pretty poggers

opal plank
wheat mesa
#

I have a feeling it's much nicer than the garbage I indent myself 😎

opal plank
#

git clone that

wheat mesa
#

Yeah I'm looking at that rn

opal plank
#

actually, not yet

#

let me push a breaking update realquick like a gigachad

wheat mesa
#

I don't wanna clone quite yet

lament rock
#

vscode stronk. I just wish I had access to gh copilot already

wheat mesa
#

I tend to learn a lot more from writing the code itself rather than just going through it and attempting to understand it

#

Even if it's word for word copying

clear marlin
#

omg erwin

opal plank
#

done, go ahead and clone it if u want

#

its should be megachad easy

clear marlin
#

your github profile picture tho

opal plank
#

lel

#

that was my old avatar

#

i should switch

clear marlin
#

yes

lament rock
opal plank
# clear marlin yes

but anyway, how to get a bot in detritus

git clone https://github.com/erwin1234777/detritus-example.git
rename example.config.json to config.json
edit ur token
press f5
wait
profit??
#

@wheat mesa

#

both of u ^^

clear marlin
#

profit?? No

lusty quest
#

i think VSC doesnt pickup the correct profile by default

opal plank
#

yes

#

it do now

#

cuz i removed the others

lusty quest
#

there is still the default profile, where it likes to default to

wheat mesa
#

You mean git clone?

opal plank
#

it should pick it up tho

#

yes, git clone

wheat mesa
#

alright, just making sure I wasn't missing something lol

opal plank
#

i was installing shit as i was writing that

lament rock
#

npm clone

#

wonder what it do

opal plank
#

npm install brain

lament rock
#

404

opal plank
#

frick

#

guess we gonna have to fall back to deprecated stuff

wheat mesa
#

Do I need to install eslint and prettier in order for those to work, or should it work from just git cloneing it?

opal plank
#

there are a couple concepts i should explain to both of you, since this is pretty much which you even start with

lament rock
#

removed 7482 packages, audited 1. 1 package is looking for funding. type npm fund for more info

opal plank
#

just use vsc extension

#

prettier

wheat mesa
#

alright

inner fulcrum
#

does editing a message 3 time under 1-2 sec is api abuse? or wat

wheat mesa
#

What other packages do I need to have installed for this example to work?

lament rock
inner fulcrum
#

mm

#

k

opal plank
#

@wheat mesa@clear marlin
So, how to start?
Detritus has 4 main "clients". ShardClient, ClusterClient, CommandClient and SlashClient
focus on ShardClient and ClusterClient, since they are what actually connects to the gateway and does "discord" stuff.
ShardClient is a single client thats connected to the ws. A ClusterClient, to but it very bluntly, is just an array of ShardClients. (its not that simple, but this helps understanding what it is). Its just a group of shards.

now that you know that, you either pick a single shard or a clusterClient to run multiple shards for you.

now, to CommandClient or SlashClient. Think of them as wrappers. They can wrap either on a shardClient or ClusterClient. Thats what will do the command handling for you along with all the extra features.

So, if u want a bot, with a single shard, and a command handler, you'd pick a CommandClient with a single shard.

You want a slashCommand with a bunch of shards? you'd pick a SlashClient with multiple shards

const commandClient = new CommandClient(config.token, { //this is a commandClient with a ClusterClient inside
  useClusterClient: true,
  shardCount: config.shards
}

const cluster = new ClusterClient(token, {shardCount: 10}) //this is just a ClusterClient with 10 shards(each shard being its own ShardClient, hence why i hinted this is basically just a glorified array


const slashClient = new SlashClient(cluster) // notice how u can add the wrapper on an already started cluster/commandClient/shardClient. You only need to do this once, no need for all those declarations. you only need 1 (max 2 if u want slashClient AND commandClient)
clear marlin
#

woah

opal plank
#

yeah

clear marlin
#

okay then

opal plank
#

its the very first step

#

which is a big one

#

which client to choose from

clear marlin
#

wait erwin, I got a idea

#

write the article for me, and then I'll copy and paste it

opal plank
#

u do know i sent that cuz its 2AM and im about to sleep right?

#

and i'd feel bad not replying to your questions as im going away now

clear marlin
opal plank
#

thats just which u should do

#

my recommendation

#

CommandClient with clusterClient true

clear marlin
#

go to sleep

#

erwin

opal plank
#

prepare ur app for scaling

#

never hurts

lusty quest
#

Evie wrote some small article about it

opal plank
#

yeah, theres a bit of misinformation there tho

#

cuz she got the basics messed up a bit

#

hence why i posted the bibble above

wheat mesa
#

I'm going to rewrite my bot for scaling, so I'll go with your recommendation

#

Even though the bot itself isn't very unique

clear marlin
#

hence

wheat mesa
#

Might as well

opal plank
#

correct

clear marlin
#

Erwin writes the article for me

opal plank
#

imma sleep

lusty quest
#

start preparing for it early, gives you less headache if you need it later

opal plank
#

kthxbye

#

goodluck

clear marlin
#

okay, go to sleep

opal plank
#

may god be on ur side

lament rock
clear marlin
#

lmaoo

wheat mesa
#

Oh wait, before I start writing this... do most/all node packages work with ts? I would assume no right?

#

For example, could I use ytdl-core if I was using detritus?

lusty quest
#

should still work

lament rock
#

Not all of them do. TypeScript imports default from modules which can cause cannot read prop of undefined errors. In which case, you'd need to use the require statement and type it as typeof import("mod").

Modules that don't have .d.ts files will also make TypeScript hate you

wheat mesa
#

I see

lusty quest
#

you can use detritus as JS lib

#

TS just gives you some extra stuff

wheat mesa
#

Yeah, I'd just prefer to use it as a TS lib

lament rock
#

default imports and exports was the worst thing to happen to JS. You cannot change my mind

cinder patio
#

JS didn't have a way to import/export before though

#

you'd have to cram all js files in the html file OR use a bundler

#

oh you're just talking about default

#

yea I agrre

#

agree

clear marlin
proud plover
#

🥲

eternal elbow
#

I'm trying to make a controllable music system from Dashboard, but I couldn't find exactly how to get the music back and forth, how can I do that?

#

.seek() worked in v11, but in v12 I play("music", {seek: ms}) but it gets stuck after changing a few times

lusty quest
#

seek should be still a thing?

stiff lynx
#

Idk why I have that undefined

bright thorn
#

make sure you did valid addfield values

#

.addField('Inline field title', 'Some value here', true)

fresh verge
#

What does this mean?

lusty quest
fresh verge
lusty quest
#

the full error stack

fresh verge
#

That is?

lusty quest
#

there is stuff missing

#

but it looks like you try to fetch a unknown message

eternal elbow
lusty quest
#

i make a large circle around Music bots bcs they are annoying. ¯_(ツ)_/¯

jovial elk
#

hey everyone, anyone else's bot suddenly keep going offline and online randomly?

no errors in the logs, so i assumed its a discord problem, so i am wondering if i am the only one experiencing it :/

lusty quest
#

check gateway event logs if something funky happens there (enable debug event, is usually aviable on most libs)

jovial elk
#

maybe its the hosting service i am using experiencing issues

lusty quest
#

do not keep the event in production tho, if you use pm2 you can fill 25GB pretty fast

jovial elk
solar cave
#

how to take user input for cooldowns
@commands.cooldown(1, user_input, commands.BucketType.user)

earnest phoenix
#

let message = {channel:{id:"0"}} message.channel?.send("test")
why does ? only work on vars and not on functions?

vivid fulcrum
#

it does, if the function returns something

#

or, it should

tired panther
#

not the Function, it would be message.channel.send?.()

earnest phoenix
#

thx sounds good

solar cave
#

guys how can i remove cooldown with command?

eternal osprey
#

is there anyoe here that can help me with sheetjs?

#

To export data to excel using js

lusty quest
#

but why?

#

looking at the docs, it should be quite easy to use

#

just push an array

eternal osprey
#

i can't

#

i tried pushing a txt file filled with https

#

links

digital ibex
#

I’m looking through the discord docs, and there is no way to retrieve a users player banner, am I correct or blind?

eternal osprey
#

but it simply did not make the file

lusty quest
#

why txt?

eternal osprey
#

but stil gives the same issue

lusty quest
#

did you tried to upload a xlsx and then just manipulating it?

#
var wbout = XLSX.write(wb, {bookType:'xlsx',  type: 'binary'});
``` also tried this one?
eternal osprey
#

yup

lusty quest
#

does the process got permissions to create files?

eternal osprey
#

yup!

lusty quest
#

do you get an error?

eternal osprey
#

nope

lusty quest
#

hmm

#

show your code

digital ibex
#

Awesome, I told u yesterday that ur over complicating things

eternal osprey
digital ibex
#

There is a better method to do what ur doing

#

I forgot what u were doing but that’s what I remember

eternal osprey
#

hmm alright

#

may i ask what the method is then?

lusty quest
#

what is your goal

eternal osprey
#

i have 3 type of data's.

#

1 is a string full with linkedin urls

#

1 is a string full with names

#

1 is a string with meails

#

emails

#

i am trying to push all 3 into seperate rows

#

to excel

lusty quest
#

are they already formated in some way

eternal osprey
#

nope i just escaped the arrays and then put \n between each name/link/etc

#

so the result looks like:
name1 name2 nam33

lusty quest
#

so you got Name\nName\nName and URL\nURL\nURL?

eternal osprey
#

yeah

#

i looped through an array to get all the users, and fetch their names etc. I then usedL += and \n after the path to spread them over each line:

#
const test = datajson.profiles
    for (const names of test){
        naming += names.name+'\n'
        email += names.teaser.emails+'\n'
        urlsys += names.linkedin_url+'\n'
        
  
   
   }```
lusty quest
#

why not directly joining them each into sub arrays?

#

so you have [[name,url,email],[name,url,email]]

#

would take away some headache i guess

#

since they are all sorted together

eternal osprey
#

but as it is a loop

#

wouldn't it get all the names in 1 subarray

#

all the urls in 1

lusty quest
#

naming etc is somewhere defined

eternal osprey
#

same for the mails

lusty quest
#

usually a loop does the stuff for each object in the array you run it over

#

if you have the array with the subarray you could just push the array to xlsx

eternal osprey
#

okay wait i will try

#

no but waity i am a bit confused

#

how would i subarray them all seperately

#

as the loop will get all the contents and push them together

#

Error: aoa_to_sheet expects an array of arrays

lusty quest
#

how exaclty is your json designed?

#
const XLSX = require('xlsx')
const json = require('./test.json')
const wb = XLSX.utils.book_new();

wb.Props = {
    Title: "Test",
    Subject: "Test",
    Author: "Test",
    CreatedDate: Date.now()
};

wb.SheetNames.push("Test Sheet");

const ws_data = [["test","test2"]]; 
const ws = XLSX.utils.aoa_to_sheet(ws_data);

wb.Sheets["Test Sheet"] = ws;

XLSX.writeFile(wb, 'test.xlsx');
```this works for me to write files
#

(ignore the json, wanted to test the parsing, but idk how your json is structured

lusty quest
inner fulcrum
#

guys my meme command takes years to respond what can i do (my friend gave it to me btw it was too long so smoled it no errors btw and still the same speed of responding it takes like 2-3 secs to send it)

const https = require('https');
const Discord = require('discord.js');
const url = 'https://www.reddit.com/r/meme/hot/.json?limit=100'

module.exports = {
    name: 'meme',
    description: 'sends meme',
    execute(message, args) {
        https.get(url, (result) => {
            var body = ''
            result.on('data', (chunk) => {
                body += chunk
            })
            result.on('end', () => {
                var response = JSON.parse(body)
                var index = response.data.children[Math.floor(Math.random() * 99) + 1].data
                var redditimage = index.preview.images[0].source.url.replace('&amp;', '&')
                var title = index.title

                const imageembed = new Discord.MessageEmbed()
                    .setTitle(`${title}`)
                    .setImage(redditimage)
                    .setColor(000000)
                message.channel.send(imageembed)
           
            }).on('error', function (e) {
                console.log('Got an error: ', e)
            })
        })
    },
}
sudden geyser
#

part of the reason is the content is very large

inner fulcrum
#

mmmmmmmm

#

so wat can i do lol

#

am dum dum today

sudden geyser
#

In fact, a nice 68k (564kb unzipped)

inner fulcrum
#

:/

sudden geyser
#

You could download the response once and look through the response for each meme command.

inner fulcrum
#

mmmmmmmmm

#

monke

sudden geyser
#

I haven't used Node.js https module though, and I don't think that's why it's so slow

inner fulcrum
#

ooof

#

am i going out dated lmao

cinder patio
#

you're only going outdated because you copied that code 😩

sudden geyser
#

A lot of users just prefer to use higher-level packages to accomplish the same, like node-fetch.

inner fulcrum
#

mmmmm

#

monke brain time

lusty quest
#

why did you use the preview image and not the full quality one?

#

also you might want to add some NSFW filtering

#

x.data.children[1].data.urlshould give you the full quality image

long crow
#

Just started playing with it

visual knoll
#

wow

earnest phoenix
#

how i use css in top.gg bot's page

cinder patio
earnest phoenix
#

i used ```css
<style>
body {
background: purple;
}
</style>

#

but the background doesn't change

modest maple
#

@rustic nova

earnest phoenix
#

Wonder if these are self-bots christmasthink

#

i'm not selfbot lol

flat copper
#
client.on("message", message => {
  if(message.author.bot) return 
  if(message.content.length > 4){
    meme(client, message)
  }
})```
Hey I want this to send message when message goes upto 4
cinder patio
earnest phoenix
#

the background

#

the background that you can change to white and black

#

How to add this?

cinder patio
lusty quest
pale vessel
earnest phoenix
#

i'm getting this

zinc wharf
earnest phoenix
#

Invalid CSRF Token. Please refresh the page and try again

pale vessel
zinc wharf
#

Ah, I need to go get glasses

peak patrol
#

Guys how do I make the help command????

#

In Java script?

earnest phoenix
#

doesn't change

cinder patio
#

Is this the beta version?

zinc wharf
peak patrol
#

No no

#

I mean

#

How to make it costumized

earnest phoenix
#

do anyone know how to make greet command?

lusty quest
#

define greet command

earnest phoenix
#

already

lusty quest
#

did you want the bot to greet everyone who joins or join a mentioned user

earnest phoenix
#

delete one left

earnest phoenix
#

that already maded just need to make delete after few sec

lusty quest
#

yes doesnt work for a or question

#

ok what language did you use

earnest phoenix
#

node.js

cinder patio
lusty quest
#

store the message object in a variable, then set a timeout with the time you want it to stay, then call delete() on the message object

earnest phoenix
#

.greetdel 1

#

like this

cinder patio
#

idk how to do it in the beta version

earnest phoenix
#

not by typing in code only

lusty quest
earnest phoenix
lusty quest
#

did you have a per guild config?

earnest phoenix
#

yes

#

it invite tracker bot

#

is surely have it

earnest phoenix
lusty quest
#

just add a field for the time you want to use for the timeout

#

and where you set the timeout call the DB and retrive the value to set it in the timeout

earnest phoenix
lusty quest
#

you know how to query the db right?

earnest phoenix
lusty quest
#
const time = db // value you retrive from the Database
const greetmsg = await message.channel.send("Hello there") //await the message to get the message object and not a unresovled Promise
setTimeout(function () {
greetmsg.delete()
}, time*1000) //by default it uses ms if you store the stuff in the db as seconds, format it to ms

earnest phoenix
#

i disabled it but when i refresh the page it's on

cinder patio
#

switch to the old design

lusty quest
#

if your bot restarts while a timeout is running the message will not get deleted

earnest phoenix
#

and want to ask one question

earnest phoenix
earnest phoenix
#

or we can't ask?

cinder patio
lusty quest
lusty quest
#

its not tolerated

earnest phoenix
#

ok

earnest phoenix
#

@cinder patio works

#

in beta mode too

#

i refreshed my browser

granite nebula
#

some people trying to enter the server are getting this message

Reason
I don't have permission to add the 860851625169125396 role to them!
but some people have done the captcha and entered the server

cinder patio
#

oh nice

granite nebula
#

hi guys

#

having a bit of trouble

young rune
#

my console is bugging be bout bytes...

#

anyone, help?

lusty quest
#
  1. the role the Bot wants to give out has to be lower than the Highest role the bot has
earnest phoenix
#

how can i fix this?

young rune
#

use full screen image

granite nebula
earnest phoenix
young rune
#

letme show you an example rq

rose warren
lusty quest
young rune
#

why is my name unmentionable??

earnest phoenix
#

idk

lusty quest
young rune
#

changed/

granite nebula
#

right so where can we get help with the captcha bot i was sent here rfom support

earnest phoenix
#

@rose warren works

#

why is there a white line?

young rune
#

i used a different piece of code but okay..

young rune
earnest phoenix
#

no

young rune
#

<br>?

earnest phoenix
#

i din't use html

young rune
#

...

#

html better :/

#

you used markdown?

earnest phoenix
#

yes

rose warren
earnest phoenix
#

ok

#

how was it?

rose warren
#

Then use CSS to fix

young rune
#

i just realized, isn't that just the website??

lusty quest
earnest phoenix
#

how much time does the bot reviewing process usually take ?

young rune
#

check pins

rose warren
earnest phoenix
#

ok

#

does the bot have to be online then ?

young rune
#

yes..

rose warren
#

Yes. Otherwise we won't be able to review it

earnest phoenix
lusty quest
#

the bot has to be always online, bcs you dont know when the review is

earnest phoenix
#

ok.

young rune
#

anyone knows how to overcome this "byte" problem?

lusty quest
#

i dont know py, sry

young rune
#

documentation gives me nothing

young rune
earnest phoenix
#

same no py

young rune
#

py ezy 🙂

earnest phoenix
#

js easier

earnest phoenix
rose warren
#

#1 decline reason is "offline"

young rune
#

js makes me blind with all the { and ; and ()

earnest phoenix
earnest phoenix
young rune
earnest phoenix
#

not every one can host their bots right away

young rune
#

use repl then-

earnest phoenix
#

no thanks

young rune
#

then keep your computer on 24/7 lol

earnest phoenix
#

more problems than benefits

young rune
#

the fastest cheapest way ^

#

oh god

lusty quest
#

buy a Raspberry Pi and run it on it

young rune
earnest phoenix
young rune
earnest phoenix
#

tried it and it literally sucks

earnest phoenix
young rune
#

its something with my "byte" stuff in a hidden respority which i can't access

earnest phoenix
#

my bots running on repl and its 24/7

young rune
#

idk what i need to do to fix that

earnest phoenix
#

what about heroku ? is it good ?

young rune
#

heroku is-

#

confusing-

#

idk how to use heroku

#

where do i write the script'_'

earnest phoenix
#

but confusing

#

ive seen bots on it that have 30 ping

young rune
#

omg can someone teach me how to navigate the site-

#

im getting lost

#

holy my windows security keeps picking up threats after it scanned none, the hell

earnest phoenix
#

or u can keep the bot on github desktop

young rune
#

github is confusing for me :/

#

glitch is shit at hosting

earnest phoenix
young rune
#

repl gives to much erros

young rune
earnest phoenix
#

whats github desktop ?

#

never heard of it

young rune
#

windows security picking a "virus" up again

young rune
earnest phoenix
#

but better

#

well if its a desktop version does it host your bot or no ?

young rune
#

search is downright broken in win11, :/

young rune
#

and freer

#

can someone name me back :/

earnest phoenix
#

ight ill try it out

young rune
#

OH GOD WINDOWS SEEURITY PICKED ANOTHER "VIRUS"

#

im mad at microsoft..

earnest phoenix
young rune
#

i think windows security is the virus

earnest phoenix
young rune
#

how do i remove it.. hmm

earnest phoenix
young rune
young rune
#

but it detects again

lament rock
#

GitHub is a code repository. Not a VPS provider... GitHub and Glitch are non comparable

young rune
#

and scans none

young rune
#

windows security sent me another alert.

earnest phoenix
young rune
#

well

earnest phoenix
#

for some time

young rune
#

not so easy

earnest phoenix
#

im confused now can you host code on github or not ??

earnest phoenix
#

🤔

wheat mesa
#

My windows defender likes to trigger on a certain emoji in my discord cache. Has a Trojan embedded in the image somehow. Nothing I can do about it, thankfully it’s harmless.

young rune
#

mkay, windows is saying itself is a virus

#

claps

earnest phoenix
#

if i inspect a thing it appears EntityPage_

wheat mesa
#

Not sure if that’s the reason for yours triggering or not

young rune
#

it says its own files is a virus-

earnest phoenix
#

i have to put .entity-page?

#

or .EntityPage

earnest phoenix
#

?

#

sure

young rune
#

win 11 is triggering some messy stuff with desktop :/

earnest phoenix
#

dm

#

mk

lament rock
#

Windows 11 is in developer beta

young rune
lament rock
#

Of course its broken

young rune
#

but windows security is not

#

:/

#

the files are the same :///

lament rock
young rune
#

and typing in any microsoft app is broken

#

including apps on microsoft store bruh

#

nooone else seems to have this problem

#

windows gone too far with the notifications

#

10 notifications on wanting to remove itself

#

now 12

#

..

#

also can someone help me with the quote_from_bytes() error?

#

im confused

slender thistle
#

I think you need to pass a bytes object into it

young rune
#

into where..?

#

the console doesn't say :/

#

windows tried removing itself 25 times now

slender thistle
#

In the function params

young rune
#

hmm

slender thistle
#

I'm not sure how you're using it even

young rune
#

repl :/

#

the worst place to build discord bots.

earnest phoenix
#

^

#

true

young rune
#

okay i think me sending a message in discord is triggering windows

#

every message i get a notification-

#

ive quaratined it 15 times, its still tryna relaunch itself bruh

#

smart

earnest phoenix
young rune
rose warren
#

It's against Glitch's TOS I believe

earnest phoenix
#

but i can

#

¯_(ツ)_/¯

#

if i get suspended then VSC

#

and heroku

young rune
#

i'll prefer not building discord bots now :<

#

maybe website with discord instead :/

earnest phoenix
#

how do i change that

#

in css

lament rock
#

display: none;

young rune
#

you are not supposed to..

earnest phoenix
#

??

young rune
#

not use much of the api though

#

:/

#

just 'steal' user data xD

earnest phoenix
#

👍

young rune
#

like 'stealing' emails and modifying names

#

:))

earnest phoenix
young rune
#

omgg change my name to normal

wheat mesa
young rune
#

tbh discord does a bad job at letting the user actually see what they bout to grant

#

noone cares about reading the scopes-

wheat mesa
#

Collecting personal data is still not a great thing to do

earnest phoenix
#

is getting a premium host worth it ?

young rune
#

unless you really know what you are doing

#

and you really need it

wheat mesa
#

Not sure if it’s against TOS or not, but if it’s not, then it’s still a scummy thing to do without the users knowing

young rune
#

then buy a premium host

slender thistle
earnest phoenix
young rune
#

they are ignorant

young rune
wheat mesa
earnest phoenix
#

@young rune bro even i use repl

young rune
#

but repl giving me shit

#

:/

#

making an economy bot with repl

#

is giving me shit as i need to make databases for every user

earnest phoenix
#

yep i have a economy bot made with repl

young rune
#

unique databases

earnest phoenix
#

can you use json files on repl ?

young rune
#

i think so?

#

:/

earnest phoenix
#

then why not use it ?

young rune
#

uhhh why would I need it-

earnest phoenix
#

you said you were using a different database for every user

young rune
#

windows tryna remove itself for the 30th time

young rune
#

:/

earnest phoenix
#

ok

#

nvm

young rune
#

im not willing to learn

#

://

tawdry oracle
#

how is possible that my bot with 100 guilds consumes less ram that my new 14 guild one?

wheat mesa
#

Json shouldn’t be used as a db anyways

#

Only if it’s a small db

young rune
#

logical choice is a db for meh :///

wheat mesa
#

SQLite or something

young rune
#

im using repl's database :<

#

they look similar to SQlite though

lament rock
#

json is prone to corruption when it becomes large and also is not able to be written to from multiple processes as the fs locks the files to processes until it's freed. JSON should only be used to store configuration.

Trying to stream and parse data from JSON is also a nightmare

quartz kindle
#

how is it possible that 100 guilds consume more ram than 14 guilds? isnt it kinda obvious?

lament rock
#

different libs? different intents?

quartz kindle
#

are those 14 guilds big?

#

lots of members?

tawdry oracle
#

30k users in total

quartz kindle
#

lots of channels?

young rune
tawdry oracle
lament rock
#

Then what are you doing in development

young rune
tawdry oracle
#

but the 100 guild bot is in almost the same server as the new one

quartz kindle
#

you can check how many channels and users both bots have

tawdry oracle
#

ok let me see

young rune
#

learning new stuff: learning how to say russian

wheat mesa
#

Libs and intents aren’t anything to do with databases-

young rune
#

IDK WHAT LIBS AREEEE

lament rock
#

dev isn't the place to learn russian

quartz kindle
#

you dont know what a library is?

wheat mesa
#

Discord.js is a lib

cinder patio
#

libraries dude, place you go to get books

young rune
#

library

#

-_-

#

just say it plz

wheat mesa
#

Yes

tawdry oracle
young rune
#

yes library i know

tawdry oracle
#

maybe is because the gateway intents, because the code is almost the same

quartz kindle
#

which intents are you using?

tawdry oracle
#

only server members

lament rock
#

do they use different libs or different intents was my question

quartz kindle
#

do you fetch all members?

tawdry oracle
#

nope, should i?

lament rock
#

Discord.js likes to eat more ram than any other lib

quartz kindle
#

how many users do they have?

young rune
tawdry oracle
young rune
quartz kindle
#

how much memory are they using?

#

and how did you measure it

tawdry oracle
#

pm2 metrics, the small one is using 356mb and the big one 156mb

quartz kindle
#

does the small one use voice/music?

tawdry oracle
#

both

#

constant

young rune
#

btw is it normal if my anti-malware is running at the highest cpu of my computer?

quartz kindle
#

and the big one doesnt?

young rune
#

its at 25%

tawdry oracle
#

yes, they both do music 24/7

quartz kindle
#

how many active streams?

tawdry oracle
#

how do i chech that ?

quartz kindle
#

how many voice channels is your bot connected to

lament rock
#

however many voice connections there are

quartz kindle
#

should be in client.voice

#

or something, i dont remember

lament rock
#

djs master removed built in voice support

#

might be something to note moving forward

tawdry oracle
#

big one 56 and small one 13...

quartz kindle
#

can you log process.memoryUsage() in both?

tawdry oracle
#

looks that now is relaxing, but consuming more, the small one is now at 200mb and the big one at 93mb

#

still a lot for 20 servers for me

slender thistle
slender thistle
young rune
slender thistle
#

Generally speaking you could just use secrets as a substitute for JSON files on repl anyhow

lament rock
#

use their user ID

young rune
slender thistle
#

^

young rune
#

and i think

#

thats the problem :/

slender thistle
#

Not sure how repl works with such big ints

#

You could try saving them as strings and then converting them to int whenever needed

lament rock
#

kinda weird how dpy converts them to ints

tawdry oracle
# quartz kindle can you log process.memoryUsage() in both?

this is wierd... if i do ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB they both report using 107.97 MB, but in pm2 it says 200mb and 92mb, maybe is a linux problem? The big one is running on windows and the small one on ubuntu

young rune
#

im making an economy bot with a daily gift, and that is that when i check if the gift has been given, it gives me the error

quartz kindle
#

not heapUsed

lament rock
#

That's not how you would measure memory usage either way

#

rss - (heapTotal - heapUsed)

quartz kindle
#

wut

tawdry oracle
#

big one: main > { rss: 97951744, heapTotal: 72298496, heapUsed: 63276360 external: 20344085, arrayBuffers: 18510720 main > }small one: deKiro > 2021-07-03T18:21:36: { rss: 166109184, heapTotal: 92033024, heapUsed: 75047064, external: 20754566, arrayBuffers: 18925353 deKiro > 2021-07-03T18:21:36: }

quaint wasp
#

ummm

signal estuary
#

How can I fetch every channel in the server?
I tried: ```js
await msg.guild.channels.fetch().then(channels => {}

But this doesnt work / exsit, so any Idea?
quaint wasp
#

Why doesnt it use the thing?

tawdry oracle
quaint wasp
#

oh... right..

#

lol\

quaint wasp
lament rock
# quartz kindle wut

rss is total alloc space for node. Heap total is for the process space and used is self explanatory.

rss still needs to be accounted for. heapTotal - heapUsed returns the free memory for the process which you would subtract from the residential which gives true memory usage.

quaint wasp
signal estuary
quartz kindle
#

its reserved by the process, the os cannot claim it

#

so it counts as the total memory used by the process

#

its not free if it cannot be used by other processes

lament rock
#

yes. You still need to take the residential set into account when calculating usage with node

quartz kindle
#

looks like windows is swapping out some of your rss, but the rest looks normal

#

no idea why the small one uses more

tawdry oracle
#

new vps i guess

#

its @jovial nexus money so idc

jovial nexus
#

shut up

lament rock
quartz kindle
#

they are both using the same external memory, but the small one is using more heap, which implies more s storage

#

if you're sure its not discord.js then it could be something else you're storing in js memory

lament rock
#

I was gonna recommend taking a heapdump earlier

lament rock
#

No one other than you should read it tho since it has your client's token

earnest phoenix
#

is it possible for the bot to change its profile picture on its own at a certain time?

lament rock
#

yeah

#

you need to patch /users/@me

#

what lib are you using @earnest phoenix

earnest phoenix
#

discord.js?

lament rock
#

client.user.setAvatar iirc

quartz kindle
#

canvas can use a lot of memory if you use high resolution images and canvases

earnest phoenix
#

can anyone help me do it?

lament rock
#

I just gave the answer. Look at the discord.js docs for an example

crimson vapor
tawdry oracle
#

@quartz kindle

#

the gateway intents

#

use 200mb

#

i just turned them off and now its going as intended

trail finch
#

um anyone can help me with umm import pynput.. like whenever I type it in python IDLE it does nothing

quaint wasp
#

I got this:

        if(!logs.me.hasPermission('SEND_MESSAGES')) {
            message.channel.send(messageE)
        }```
And yet discord still gives me error on console and doesnt reply with the embed.
trail finch
#

I thought u have a solution to my problem ;-;

quaint wasp
#

sorry i use javascript 😐

trail finch
#

well its javascript

quaint wasp
#

ye miss typed.

lusty quest
#

hasPermission iirc is deprecated tho

trail finch
#

btw I use javascript too.. recently learning python

quaint wasp
#

nice.

quaint wasp
lusty quest
#

it got replaced by permissions.has()

quaint wasp
#

WHAT