#development

1 messages ยท Page 1901 of 1

limber mica
#

but ye a object.keys() would be better

old cliff
#

what does this mean?

limber mica
#

One thing i could never understand

#

is "this"

#

in node JS

past geyser
cinder patio
#

Are you sure it's the only thing slonk

past geyser
#

I didn't said only

#

Btw

#

Neither did he

earnest phoenix
#

Cool

limber mica
#

Dyno has 364 LINES OF CONFIG

earnest phoenix
#

What do you not get

#

Simply saying I don't get it isn't helpful what about it don't you get

wooden ember
#

anyone know how to iterate through a foreach loop backwards?

#

in nodeJS

eternal elbow
#

W-what

earnest phoenix
#

That makes no sense

#

Cause it makes no sense

#

Never heard of it

#

Why are you posting that in the dev channel

#

Smh

#

No one wants to listen to it

wooden ember
#

is this a new feature?

fresh bluff
#

I have 2 Bots now running

wooden ember
#

i have like 4 but they are basically for memes at this point

wooden ember
#

yeah

fresh bluff
#

Lmao

earnest phoenix
wooden ember
#

ah fair enough

gray heron
#

my motivation

fresh bluff
#

Got this setup

earnest phoenix
#

My motivation: none

gray heron
earnest phoenix
#

No

fresh bluff
earnest phoenix
#

If you are a programmer you're never okay

earnest phoenix
fresh bluff
earnest phoenix
#

Nah but honestly

#

Let the server owners decide for their server

fresh bluff
#

Congrats you did something useless ! But you Got Verified?

earnest phoenix
#

Have a default response that can be changed per guild

fresh bluff
#

Bot*

gray heron
earnest phoenix
#

I see

#

Then just tell you are now verified

#

No one's going to take the time to read it tbh

fresh bluff
#

@earnest phoenix Awesome Idea

wooden ember
#

just trying to iterate through messages but when you fetch them they are oldest to newest

fresh bluff
#

What does this mean?

wooden ember
#

oh i see

earnest phoenix
#

I am not entirely sure how it works cause I've never used it

gray heron
eternal elbow
fresh bluff
fresh bluff
eternal elbow
gray heron
fresh bluff
wooden ember
fresh bluff
#

Be Back in 2-3 Hours

wooden ember
eternal elbow
#

Check again

wooden ember
#

yeah in the code its right

eternal elbow
#

.reverse() is not new

#

Or your array is not array

wooden ember
#

all that stuff I checked my array isnt called array i just wrote that here for the sake of simplisity

wooden ember
#

yay scam

#

and its gone

#

but still though idk why it doesnt work

#

just using for each normally works

#

so its an array

#

but the reverse thing doesnt work

#

there arent any syntax errors that i can see

fresh bluff
#

@gray heron Thoughts?

spark flint
fresh bluff
spark flint
#

it looks like you've done it all in <h1> tags

spark flint
#

HTML, Wix, Wordpress etc

fresh bluff
spark flint
#

Same as Wix

fresh bluff
#

Yep

gray heron
spark flint
#

click on the text and then it should give options for resizing text

spark flint
#

these are more like bot rules

fresh bluff
gray heron
#

@fresh bluff search for bot's tos

lyric mountain
#

Or rename to "rules"

#

Also, rules won't stop anyone anyway

earnest phoenix
#

Who reads rules

#

pfft

earnest phoenix
#

Hi, I have a question and I do not know where to ask, why update node? What does it give?

#

well it gives us joy when people dont use old ass versions of node

#

But what does it change?

vivid fulcrum
#

security updates, environment optimization and new language features

earnest phoenix
#

Hmm

earnest phoenix
spark flint
#

How do I publish a module on Pypi?

earnest phoenix
#

if I change from version 14 to 16, it can spoil the bot for me?

vivid fulcrum
#

spoil?

earnest phoenix
#

Sorry for my eng

vivid fulcrum
#

oh you mean break

#

lol

#

no

earnest phoenix
#

Yes

#

Google translate translates me break to spoil

vivid fulcrum
#

there aren't any breaking changes afaik

earnest phoenix
#

Seems pretty straight forward to me tho

spark flint
#

I've found a tutorial i'm following now

earnest phoenix
#

then why ask

#

reeeeeeeeeeee

earnest phoenix
#

imagine putting a python package on npm

spark flint
#

i should try KEKW

earnest phoenix
#

I mean

#

I don't think it'd work

vivid fulcrum
earnest phoenix
#

it needs a package.json

vivid fulcrum
#

doing native on node is such a pain

#

you need 3 different envs

#

lol

#

node, py, cpp

spark flint
#

the module test worked

#

I managed to install it

#

and import it

earnest phoenix
#

"what did it cost?"
"another package name taken"

spark flint
#

ah fuck it failed slightly

#

i did ```py
import blacklister

print(blacklister.Blacklist(APIKEY, 471409054594498561))

#

ah I know why

#

yep it worked now

#
import blacklister

blacklist = blacklister.Blacklist(APIKEY, 471409054594498561)

print(blacklist.reason)```
earnest phoenix
#

I like cheese

#

I am learning python in cs class

spark flint
#
import blacklister

blacklist = blacklister.Blacklist(APIKEY, 471409054594498561)

if blacklist.check == False:
    print(blacklist.username)
    print("User not blacklisted!")
else:
    print(blacklist.username)
    print(blacklist.reason)```
#

epic its live now

past geyser
#

how can i access bot servers in html?

earnest phoenix
#

wut

rancid moss
#

Hello guys. I have a question
Why is the sniping command against Discord's ToS?
I went on google but only found how to make a snipe command or them saying yes to the fact that it's against Discord's ToS.

past geyser
past geyser
rancid moss
#

hmm

earnest phoenix
#

alright

earnest phoenix
#

Its not against tos

#

I have never heard of it being against the tos

rancid moss
#

I'm getting mixed answers, bruh

earnest phoenix
#

I don't see how it can be a privacy issue

#

If it was a privacy issue they won't send the message delete event to bots

earnest phoenix
past geyser
#

cant make it public

earnest phoenix
#

theres 0 point to it

#

Aeon has a verified bot and it has a snipe command

#

The tos probably says a server cannot see deleted messages from other servers

past geyser
earnest phoenix
#

If your snipe command only shows messages from the current server it's allowed

past geyser
#

yeah

earnest phoenix
#

yea

rancid moss
#

Ah OH
So if you were to have a snipe command, that shows last deleted messages from that server you ran the command, it's allowed? huh

earnest phoenix
earnest phoenix
#

Only from the current server

past geyser
rancid moss
#

Ah alright, then there are no problems having the command ๐Ÿ™‚
Thank you guys for your help!

earnest phoenix
past geyser
#

i have one html repl and one nodejs repl

#

nodejs one contains my bot and the other one site ๐Ÿค“

rancid moss
#

no

past geyser
#

hacked prolly

earnest phoenix
#

Have your html repl request data from your nodejs repl

past geyser
#

okayyyy

#

more info

earnest phoenix
#

The nodejs repl should have a server that responds with the bot guilds

earnest phoenix
# past geyser any docs?

What is an API? What is REST? Learn how an Application Programming Interface (API) can adhere to Representational State Transfer (REST) to enable reliable communication between apps https://fireship.io/tags/node/

๐Ÿ‘• Best comment wins a free T-shirt (read fine print at end of video)

Open API Spec https://swagger.io/specification/
Request Methods...

โ–ถ Play video
past geyser
#

ok

#

that might help

#

thanks

earnest phoenix
quartz kindle
#

yes its an actual thing

earnest phoenix
#

yes

#

I love using that one

limber mica
#

The people who wrote Dyno are GENIOUS

earnest phoenix
#

are you obsessed with dyno or smth

limber mica
#

Yes

#

Im looking through its code

#

and by god

#

Its top tier

earnest phoenix
#

if its anything like what you showed before

#

I disagree

limber mica
#

no

quartz kindle
#

dyno is open source now?

limber mica
#

im talking about the command handling and modules system they built

quartz kindle
#

or what happened?

wheat mesa
#

big bot, been around for ages, makes sense that its code would be built well

limber mica
quartz kindle
#

leak?

limber mica
#

The repo is deleted

earnest phoenix
limber mica
wheat mesa
#

nvm then

quartz kindle
#

dayum

limber mica
#

i got the current version

#

and its soo cooooool

quartz kindle
#

rip for them

limber mica
#

well

quartz kindle
#

someone got fired

limber mica
#

no .env were leaked

#

No private data

#

just src

#

so the DB ip's and all stuff has been removed

#

so it was intentional

earnest phoenix
#

It is still a private bot

limber mica
earnest phoenix
#

probably can get in trouble for leaking code

limber mica
#

Idk who did

earnest phoenix
#

like legal trouble most likely

limber mica
#

i found a repo that got taken down VERY quickly

quartz kindle
#

its like leaking the source code for twitch

limber mica
#

But i removed it

#

Because i dont want to get in trouble

earnest phoenix
#

doesn't leaking private code break the license terms?

quartz kindle
#

i have the torrent but i didnt download it

limber mica
quartz kindle
#

i dont have 125gb to throe away for useless shit

#

lel

limber mica
#

lol

#

i got 15 TB on my pc

#

im using 10

wheat mesa
#

twitch best open source project tbh

quartz kindle
#

xD

limber mica
#

yeah, i got every dyno repo

earnest phoenix
#

I was going to do an open source project but no one would help

#

so no point

limber mica
#

apparently

#

actually

#

no

#

i wont say that

quartz kindle
boreal iron
earnest phoenix
#

space

limber mica
boreal iron
#

18+ content ?

limber mica
#

twitch backend

quartz kindle
#

thats the size of the twitch leak

earnest phoenix
limber mica
#

thats only part 1

limber mica
boreal iron
#

125 GB lmao

limber mica
#

dyno uses mongo and redis

earnest phoenix
#

mongo sucks

#

redis is not bad tho

#

I don't know how to use it properly tho

limber mica
#

I use postgre

#

so for coldbot

#

i used firebase

#

and for my new bod

#

(100% based not based off of dyno) i use postgreSQL

wheat mesa
#

I just use mongo because it was easy to set up

#

free cloud tier

limber mica
limber mica
#

I installed it on my vps

#

it never works

wheat mesa
#

works fine on my vps

earnest phoenix
#

mongo is just too overhyped

wheat mesa
#

For the code portion, obviously

limber mica
#

yes

wheat mesa
#

I don't run the db myself

limber mica
#

mmm

wheat mesa
#

I just use Mongodb's free cloud tier

limber mica
#

that works tooo

wheat mesa
#

only 512mb of storage but I really couldn't care less since it's rarely used

limber mica
#

fun fact

#

Dyno stores

#

ALL

#

Auto mod events

wheat mesa
#

if I cared about storage/efficiency I'd use postgresql

limber mica
#

EVERY. SINGLE. ONE

#
    guild:     { type: String, index: true },
    user:      { type: Object, required: true },
    type:      { type: String, index: true },
    reason:    { type: String },
    message:   { type: Object },
    createdAt: { type: Date, default: Date.now(), index: true },
#

thats the data they store on

#

ALL

#

auto mod events

#

they are proabably using

earnest phoenix
#

what

limber mica
#

Dyno stores all that data on every automod events

#

and are using like

#

a trillion GB

wheat mesa
#

that much data is like what, max 1 kb per entry or something?

limber mica
#

yes

#

ant they are in

#

1 million servers

#

and i can assume

#

about

#

20 events per second

#

maybe 30

#

(they have 1 billion discord events per second)

#

so actually

#

abt

#

1,000

#

so 1 mb per second

wheat mesa
#

I highly doubt that data is forever stored

limber mica
#

no

#

its deleted after 6 months

#

(or until the bot just dies)

cinder zenith
#
internal/modules/cjs/loader.js:1089
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /rbd/pnpm-volume/11fc1f96-9954-4725-9b45-1a95c004ed2f/node_modules/node-fetch/src/index.js
require() of ES modules is not supported.
require() of /rbd/pnpm-volume/11fc1f96-9954-4725-9b45-1a95c004ed2f/node_modules/node-fetch/src/index.js from /app/bot.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /rbd/pnpm-volume/11fc1f96-9954-4725-9b45-1a95c004ed2f/node_modules/node-fetch/package.json.
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/app/bot.js:485:15)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12) {
  code: 'ERR_REQUIRE_ESM'
}

how can i solve it?

past geyser
#

how to access rest api from html anyone?

limber mica
#

hmmm

#

now i know how dyno works

#

so they made their own API for modules and sharding

#

all command types

wheat mesa
boreal iron
boreal iron
limber mica
#

(e.g. fun, mod, admin, ect.) are seperated into "modules" and dyno can load them and commands

past geyser
#

want to access from my html repl

spark flint
wheat mesa
#

html stands for hypertext markup language

#

it's not a language for interacting with APIs

boreal iron
#

Then include some JS scripts into your HTML code

wheat mesa
#

you can call js from html, then you use that js to interact with APIs

spark flint
#

show me what the api output is and what data you want adding to your HTML @past geyser

spark flint
past geyser
#

see

boreal iron
#

You have to use JS as well to push the content you got from your API request to any HTML element

#

Or PHP or whatever

spark flint
#

add id="servers" to the html tag for the server count

past geyser
#

@spark flint

#

oh

spark flint
#

then add ```js
<script>
$.getJSON('https://hashc.axpectop.repl.co/servers', function(data) {

    document.getElementById("servers").innerHTML = `${data}`;
});

</script>``` to the bottom of your page

spark flint
#

if its h1, do <h1 id="servers">

past geyser
#

<div class="value custom0" akhi="100">0</div>
<h1 class="counterr"><i class="fas fa-server icon-color-white"></i> <b>Servers</b></h1>
</div>

#

this akhi is servers currently

spark flint
#

<div class="value custom0" akhi="100">0</div>
<h1 id="servers" class="counterr"><i class="fas fa-server icon-color-white"></i> <b>Servers</b></h1>
</div>

#

@solemn latch

wheat mesa
#

thanks bro โค๏ธ

spark flint
#

scam

#

wow so legit

cinder zenith
#

oh

boreal iron
past geyser
#

done @spark flint ๐Ÿ‘

spark flint
#

does it work?

past geyser
#

wait only done html

#

adding script

spark flint
#

you need to import jquery too

cinder zenith
#

ok

boreal iron
#

Using JS to send a request to your API anytime somebody refreshes your site might be a bad idea

spark flint
#

add html <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> to the top in the "<head>" tag

past geyser
spark flint
#

at the bottom

past geyser
wheat mesa
#

idk if spoonfeeding him is gonna help

spark flint
past geyser
#

added both

spark flint
spark flint
wheat mesa
#

But then how did you learn ๐Ÿ˜›

past geyser
wheat mesa
#

By figuring it out!

#

but just giving him code to copy/paste isn't gonna help in the long run

boreal iron
# spark flint at the bottom

Doesnโ€™t matter in this case as the content is missing anyways cause heโ€™s getting it from the API
There wonโ€™t be any noticeable difference between parsing the site first after loading the scripts in this case

past geyser
spark flint
# past geyser yup

try adding res.setHeader('Access-Control-Allow-Origin', 'WEBSITE URL'); to the API code

#

thats the current issue

past geyser
#

ok

#

in the js?

spark flint
#

yeah

#

not on the html

past geyser
#

ok

#

hey @spark flint help me after 12-13 hrs sleep time sry and thanks for the help till now bye!

spark flint
#

Ok

past geyser
#

its 11:52 here

#

bye

boreal iron
#

lel youโ€™re living in the past

#

Which relatively means I live in the future

#

Yay

lyric mountain
spark flint
spark flint
#

I had to do it for my site too

lyric mountain
#

Did on my api too

#

Cors is a bitch

spark flint
#

i have a live count on my bot site

fossil bone
#

O.O

cinder zenith
#
internal/modules/cjs/loader.js:1089
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /rbd/pnpm-volume/11fc1f96-9954-4725-9b45-1a95c004ed2f/node_modules/node-fetch/src/index.js
require() of ES modules is not supported.
require() of /rbd/pnpm-volume/11fc1f96-9954-4725-9b45-1a95c004ed2f/node_modules/node-fetch/src/index.js from /app/bot.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /rbd/pnpm-volume/11fc1f96-9954-4725-9b45-1a95c004ed2f/node_modules/node-fetch/package.json.
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/app/bot.js:485:15)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12) {
  code: 'ERR_REQUIRE_ESM'
}

Hello, I saw such an output from my bot's log channel, although I tried to solve it, I couldn't. Can you help?

Discord.js = Defined

Node-fetch = Defined

#

Node.js = Defined

spark flint
#

Might help

wheat mesa
#

defining those things has nothing to do with your error

spark flint
wheat mesa
earnest phoenix
#

Max number of daily application command creates has been reached when i can start to create new commands

wheat mesa
#

daily

boreal iron
#

lol how

#

Sounds like a bad or non existing command handler

wheat mesa
#

how on earth

earnest phoenix
#

When day is restarting

boreal iron
earnest phoenix
boreal iron
#

You register them once

earnest phoenix
#

It was getting on my nerves that it wasn't there
And i did every ready delete all and create news

earnest phoenix
boreal iron
#

Then compare them to your locally loaded commands and add/update/delete if needed

boreal iron
earnest phoenix
#

Must be joking

#

7 hours more

modest maple
boreal iron
#

and a reload command

earnest phoenix
#

Can you show me better way

boreal iron
modest maple
#

just dont re-register every time?

boreal iron
#

Itโ€™s not that complicated

earnest phoenix
#

Its actually

modest maple
#

if you're not changing the signature of the command dont do it

earnest phoenix
#

Actually i do

#

But not for all

#

I am adding new command files

modest maple
#

200 of them? pithink

boreal iron
#

If you canโ€™t code it then register them once only (manually) if you create a new slash command

modest maple
#

if so i'd cut back on the command count lol

earnest phoenix
#
client.on("ready", async() => {
  console.log("Slash Commands");
  
        await client.application.commands.set([]).then(console.log("Global Commands Reseted"));
        await client.guilds.cache.get(client.conf.guildId).commands.set([]).then(console.log("Guild Commands Reseted"));
  
    fs.readdirSync("./commands/").forEach(async dir => { 
      const commands = fs.readdirSync(`./commands/${dir}/`).filter(file => file.endsWith(".js"));
        commands.map(async cmd => {
          let file = require(`./commands/${dir}/${cmd}`);
          let name = file.name || "No command name.";
          let description = file.description || "No Description";
          let options = file.options || [];
          
            const data = { name, description, options };
            let option = name == "No command name." ? "โŒ" : "โœ…";

              if (option == "โœ…") {
                await wait(1000);
                client.slashCommands.set(name, { ...data, run: file.run });
                
                await client.application.commands.create(data).then(console.log(`Global Slash Command: ${name} Loaded โœ…`)).catch(console.error) 
                //await client.guilds.cache.get(client.conf.guildId).commands.create(data).then(console.log(`Guild Slash Command: ${name} Loaded โœ…`)).catch(console.error) 
              };
    });
  });
});
boreal iron
#

Oh god

earnest phoenix
#

Wonderfull right ?

#

Lol

#

I really hate slash commands

boreal iron
#

Once itโ€™s registered, itโ€™s registered means you donโ€™t have to do it again not even on a restart

#

Only if you update the slash command

earnest phoenix
#

Hmmm

boreal iron
#

Registered them on any startup will still show the OLD registered slash commands but you will have to wait up to one hour before they got pushed into each guild

earnest phoenix
#

Client.application.commands.get.for each if! client.application.commands.has
Client.applicatipn.commands.create else client.application.commands.update

#

Is it better

earnest phoenix
boreal iron
#

Yeah youโ€™re getting closer

#

But

#

If they exist you would update them on each startup which can cause the same issues as registering them

#

If you wanna build a proper handler then keep in mind:

#

(will tell you how I do it)

#

โ€ฆwait for it

earnest phoenix
#

I need client.on(fileAdd event lol

boreal iron
#
- load your slash command files
- save them in a map (or collection)
- fetch the client's application commands from Discord
- loop through the fetched commands
- check if the collection includes the commands in your map
- if not, register it
- if so, go a level deeper and check it's content
- check if the fetched command has the same description, options, components etc. as the one in your command map
- if not, update it
- if so, continue the loop
#

Client.application.commands.get.for each if! client.application.commands.has
Client.applicatipn.commands.create else client.application.commands.update

#

That's almost 33% of what you need to check to automate it

earnest phoenix
#

I already have a saver

boreal iron
#

I am going a step further and check if my command map (loaded from my files) includes a property called guild and if so, register the command as guild command only

#

The property is a simple array in my case

#

boop command handler ready

#

Put anything in a function or two and call both in a reload command and all your issues are gone

earnest phoenix
#

Okay so i am gonna spend my 3 hours for handler lol

boreal iron
#

That will save you more than 3 hours for the future, yeah

#

You can also register, update or delete any command manually in the future

#

That's your decision

#

Just suggesting things...

#

brb

earnest phoenix
#

why's it splitting the response so weirdly?

earnest phoenix
#

@boreal iron sorry for ping but how can i reach name of fetched application command

#

I found it

#

With Using map

boreal iron
#

huh was afk

earnest phoenix
#

Its so weird actually

boreal iron
#

The fetched commands are returned as collection

earnest phoenix
#

client.application.command.fetch().map is not a function

boreal iron
#

Dude

earnest phoenix
#

Let x = client.application.command.fetch()
x.map is a function

boreal iron
#

Fetch is promise

#

always

earnest phoenix
#

Still weird

boreal iron
#

No

earnest phoenix
#

Just forcing me using unless code line

boreal iron
#

Not needed to map it, it's a collection already

#

If you wanna check if your command (name) is already included then use <collection>.has("command name")

boreal iron
#

Just don't over complicate things

earnest phoenix
#
client.slashCommands.set(name, { ...data, run: file.run });
                
                let appCmds = await client.application.commands.fetch()
                appCmds.map(appCmds => {
                  if(client.slashCommands.get(name) === appCmds) console.log("yes")
                })
boreal iron
#

Stop using map

#

That's nonsense

earnest phoenix
#

Removed ok

boreal iron
#

has() to check if the key exists in the collection

limber mica
earnest phoenix
#

Hmm

boreal iron
earnest phoenix
#

Bruh

#

Its same thing

limber mica
earnest phoenix
#

You just using for instead map

boreal iron
#

W.H.A.T.

boreal iron
#

Any editor is using different syntax highlighting colors

#

I mean you can select purple if you like to, I like that deep black look

split hazel
#

anyone know a slim version of windows 7 iso?

earnest phoenix
#
                client.slashCommands.set(name, { ...data, run: file.run });
                
                let appCmds = await client.application.commands.fetch()
                appCmds.map(xc => {
                  console.log(xc.name, xc.id)
                  if(!client.slashCommands.has(xc.name)) client.application.commands.delete(xc)
                })
split hazel
#

trying to run it in a vm with as minimal bloat as possible

earnest phoenix
#

Same thing

boreal iron
#

Same what?

earnest phoenix
#
                let appCmds = await client.application.commands.fetch()
                appCmds.map(xc => {
                  console.log(xc.name, xc.id)
                  if(name !== xc.name) client.application.commands.delete(xc)
                })
earnest phoenix
boreal iron
#

If you prefer yours

#

why not

earnest phoenix
#

Am i wrong?

boreal iron
#

Keep in mind fetch can "fail"

#

Check if appCmds is empty before mapping it

#

Just to follow "good practises"

#

Anyways... first thing you do is loading all your command files

#

And throwing them into your map (or collection)

earnest phoenix
#

Oh

boreal iron
#

Next is fetching the registered commands

#

Which you did

earnest phoenix
#

It still going complicated

#

And my english not enough for all you said

boreal iron
#

First loop is to check if any registered command does not exist locally anymore and if so delete it

#

As you did

#

Next step is to loop through your locally stored commands and check if the description and options matches the registered (fetched) one

earnest phoenix
#

Is id changes if i change command codes?

boreal iron
#

The application command ID or the map key?

earnest phoenix
#

First

boreal iron
#

It will change if you register it

earnest phoenix
#

So i go use for ?

#

Offf

boreal iron
#

It should be the same if you update it

earnest phoenix
#

My brain is dying

#

Why it must be so complicated

boreal iron
#

You don't have to deal with the application command ID, never

#

The key of your fetched collection is the name of your command

#
{
  "ping":
  {
    "id": "xxx",
    "name": "ping",
    "options": null
  }
}
#

Just log the fetched commands and see what I mean

earnest phoenix
#

I did

#

Many times

boreal iron
#

Well then, you know the structure

earnest phoenix
#
                let appCmds = await client.application.commands.fetch()
                if(!appCmds) return;
                
                  for(const [id, command] of appCmds) {
                    if(!client.slashCommands.has(command.name)) {
                      client.application.commands.delete(command).catch(console.error)
                    } else  {
                    await client.application.commands.create(data).then(console.log(`Global Slash Command: ${name} Loaded โœ…`)).catch(console.error)
                  }
                  };
boreal iron
#

That else doesn't make sense

earnest phoenix
#

Yes notice that

#

Bc every login it register command

boreal iron
#

That loop ONLY needs to check if it doesn't exist and deletes it

#

That's all this loop does

earnest phoenix
#

Hmmm

boreal iron
#

Second loop will not loop your appCmds instead it will loop your client.slashCommands

earnest phoenix
#

Can you some spoonfeed

boreal iron
#

Usually I won't

earnest phoenix
boreal iron
#

client.commands are my loaded and stored command from the loaded modules

earnest phoenix
#

I am not dumb as that lol

#

But its so small

boreal iron
#

Click on the image to show the original

#

Thats larger

#

lol

earnest phoenix
#

My computer screen is 480 px

#

And i have eye problem lol

boreal iron
#

Sending a Discord code block makes things worse

#

trust me

earnest phoenix
#

Hmmm

#

How you set your slash commands

#

ฤฐn collection

#

Or i save it with data which one includes name desc etc

boreal iron
#

what do mean in collection?

earnest phoenix
#

Discord.Collection

#

Lemme check if it can cause problem

boreal iron
#

Oh that's what you mean I see

#

I'm not storing them as collection, I store them as map

#

But you can store them as Discord collection

earnest phoenix
#

Whats different

boreal iron
#

Map doesn't support all the Discord helper methods, like find, filter etc.

#

client.commands = new Map();

earnest phoenix
#

Then why you use it lol

#
                client.slashCommands.set(name, { ...data, run: file.run });
                
                let x = client.slashCommands.get(name)
                console.log(x.name, x.description)
boreal iron
#

Because the locally stored command var doesn't need to use this methods

earnest phoenix
#

I meant that

#

I thought may code cant reach x.name

boreal iron
#

map supports get(), has(), set() as well

earnest phoenix
#

What is mean command.guilds?

boreal iron
#

You can ignore that statement, that's why I collapsed it

#

It will check if my module has a guild property

#

And if so it will create a guild command, not a global one

#

To test commands etc.

#

If guilds isn't null, the command acts as guild only command, not as global one

#

Being created in the guilds the array includes

#

If they don't exist already of course

earnest phoenix
#

If permissions= administrator a user hasnt admin cant see it ?

boreal iron
#

what?

#

I have an own permission handler

earnest phoenix
#

command.permissions

boreal iron
#

The property permissions has nothing to do with slash command permissions

earnest phoenix
#

Okay

boreal iron
#

I have an own permission handler

earnest phoenix
#

Okay i got how to create commands

#

How i update them?

boreal iron
#

When running the slash commands, permissions of the member are checked and if he doesn't have permissions an ephemeral message being send to him

earnest phoenix
#

I got it

#

But diff way

#

But your way is better

#

But i dont wanna do it at this time

gray patio
#

|||| d

earnest phoenix
#

Cause i dont have brain left much

boreal iron
#

It is way more flexible than what Discord currently "supports"

earnest phoenix
boreal iron
#

For example my config slash command requires at least one of the permissions listed in the array

#

(not all)

#

That's how my handler works

earnest phoenix
#

Good good

boreal iron
#

It brings you to the point if the fetched command doesn't exist yet, it registers it

#

The last else you see is the moment the registered command exists

#

That's the point I'm checking if the description is the same, the options, components etc.

#

If so, continue the loop

#

If something is different, then update the application command

earnest phoenix
#

What if i change command ?

#

.codes

boreal iron
#

If I would change the command, it would check if the command name still exists (as registered command) and if it doesn't match the registered one, update it

#

Changing the command name would result in the registered command being delete and the command with your new name would be registered

#

If I just change the description or options it will only update the registered command

earnest phoenix
#

if(appCmds.description !== command.description) {
client.application.commands.edit(data).then(console.log(Global Slash Command: ${name} Updated โœ…)).catch(console.error)
}

#

Supplied command is not a ApplicationCommandResolvable.

boreal iron
#

Yeah look at my example

earnest phoenix
#

Didnt see it

boreal iron
#

const commands = await client.application.commands.fetch()

#

const application = commands.find((application) => application.name === command.name);

#

application is a application command object

earnest phoenix
#

If i change codes in files will it edit ?

boreal iron
#

dunno what data is in your case

earnest phoenix
#

option description name

boreal iron
#

It can be the command ID or the command object

earnest phoenix
#

So is it ok?

sterile lantern
#

i made a request and then did request.data and this shows up,

#

how do i get the imageUrl, request.data.imageUrl doesnt work

#

wait nvm

earnest phoenix
#

Its an array

sterile lantern
#

its just request[0].data

#

yes

#

got it sunglas

earnest phoenix
#

Not faster than me lol

spark flint
#

how to fix

#

I pushed the latest version but its not letting me install it yet

earnest phoenix
#

You should wait then

#

If it is anything like npm it takes a while to update fully

spark flint
#

I just pushed yet another version

#

so I'll wait for that

#

ah shit i broke it

hollow depot
#

ok so, on my vps the past days all of my requests (including bot login) were being aborted, i figured out that probably the vps cant connect to anything, as even "npm uninstall [package]" does not work.
does domeone know what could be possibly causing this? im kinda desperate

#

yes, ssh is the only thing that works, so i dont really know

grim aspen
#

Is there an error code?

hollow depot
#

nope, i tried running node -e "//and here all the code to login the bot" and still does not work

#

(yes the token is right, the request is being aborted)

grim aspen
#

What happens if you do node (your start file)

#

Well if youโ€™re using node

hollow depot
#

one sec

#

i am on 16.8.0, is there a new version?

#

its an aws linux ec-2 instance

#

lol apt command not found

#

i want to cry

#

this is gonna sound dumb but i'm a non-native english speaker, whats a distro?

#

omg im not sure actually

earnest phoenix
#

Since the creation of my website/bots ive been under constant DDOS, about 300k r/s per day, sometimes peaking 1m per day, sometimes, anyone got any tips on how to prevent this? i certainly am out of ideas

#

the bot only gets used like, 40 times a day

#

i use cf

#

CF is letting the requests through, alot of them

boreal iron
#

setting up a proper firewall

#

requires advanced network knowledge ofc

lyric mountain
#

properly configuring nginx/apache too

earnest phoenix
#

ok

#

thank you!

earnest phoenix
boreal iron
#

even apache has a rate limit module

lyric mountain
#

can do that with nginx too

earnest phoenix
#

ye but i need my bots IPs to be allowe, and thats where the issue is ๐Ÿ˜ฆ

lyric mountain
#

wat?

#

isn't ur bot running on the same machine?

earnest phoenix
#

the bot runs on the same machine yes?

lyric mountain
#

use localhost

earnest phoenix
#

ah

boreal iron
#

You don't need a module for it, just use deny on IP addresses

#

you can even deny hostnames

#

apache, old but good

earnest phoenix
#

this was yesterday

hollow depot
#

ok so, i'm really sorry for bothering you this much, but im not familiar with linux stuff and idk how to interpret the output LOL, can i dm you?

earnest phoenix
rapid zealot
#

@spark flint i have problem with Application Manager and support can't understand me what i mean when tell them it's not working when i make my app to work with dashboard and for sub domain where i want to run the Application but when i tell them what i mean they send me email with bulshits answer look


To further assist you with your request we would kindly ask you to provide us with the login details of your VPS L SSD (***.***.***.***) and more information on which step of the tutorial you are facing your problem or what is not working on the end. Please be as much more detailed in your reply and provide us with all related information so that we can better assist you with your issue.

We are looking forward to hearing from you.

If you have any questions or need help, please do not hesitate to contact us.

--
Best regards,

Viktorio Zupcic
Kundenservice / Customer support```
before this stuped email i talk with another idiot who want it from me root and password and i give him what he need Customer ID with root and pass to see where is the problem and i tell him what i do and where is the problem now another one answer me with same bulshit like first one but this time i tell him to join and to see where is the problem and why stuped Application Manager not work
spark flint
#

application manager?

rapid zealot
#

yep

reef stump
#

@real rose Hey Bro Can You Review My Bot ..

spark flint
boreal iron
#

we would kindly ask you to provide us with the login details of your VPS

#

haha lol

real rose
spark flint
# rapid zealot yep

didn't realise there was an application manager. Could you send a screenshot of the Application Manager section?

#

thats all I see

boreal iron
#

holy shit

#

looks like created around 1990

spark flint
#

yup

#

the main site is good

#

but the control panel is outdated af

#

thats the first think I thought

boreal iron
spark flint
reef stump
rapid zealot
boreal iron
spark flint
rapid zealot
#

nope

spark flint
#

You're using the worst possible thing

rapid zealot
#

nope

spark flint
#

cPanel is webhosting

#

I'm using a VPS

rapid zealot
#

i'm using VPS with WHM & cPanel

spark flint
reef stump
rapid zealot
#

it's not webhosting

spark flint
#

WHM and Cpanel are webhosting tho

#

thats their purpose

rapid zealot
#

nwm and thats true but Application Manager not work and that is my problem 2 month i trying again and again to run Application but everytime when open link from my browser i see 504 error

spark flint
#

What do you use WHM and cPanel for?

#

only for bots?

#

I'm guessing you pay for cPanel too which you shouldn't as its overpriced af

lyric mountain
#

cpanel is overrated

spark flint
#

yes

rapid zealot
#

5 domain name with PHP and trying to run Application Manager for my bot but everytime when i trying tutorial again and again not work and i tell them what i do and where is the problem and they say me again and again bulshit like where is the problem or where you found problem at the start or the end of tutorial

spark flint
#

i use DirectAdmin for dbot and cPanel for my own hosting

rapid zealot
#

that is bulshits

spark flint
#

not very good

boreal iron
#

what's the app manager even for?

#

and don't say for apps

rapid zealot
spark flint
rapid zealot
#

if you want to understand look this tutorial and if you know what you need to do you will make a dashboard for any bot directly from your domain name with Application Manager

rapid zealot
boreal iron
#

Ah I see... and what's the issue you're running in?

rapid zealot
#

if you know how to hide some files from apache to restrict only local i dont care about security issue ๐Ÿ˜„

spark flint
#

never

rapid zealot
#

i try it at another domain and not work again

#

๐Ÿ˜„

spark flint
#

please never use cpanel for bot hosting lmao

rapid zealot
#

but when i try it at another hosting with same tutorial everything work

#

๐Ÿ˜„

boreal iron
#

well 504 on what?

spark flint
#

just don't use cPanel for the bot

boreal iron
#

on your site?

spark flint
rapid zealot
#

๐Ÿ˜‰

rapid zealot
#

i have 5 domain name and no one work with Application Manager

#

that's why i buy another hosting from another hosting company and try it this guide from cPanel blog and everything work how i want to work

boreal iron
#

god... that looks like so much time to spend

rapid zealot
#

now my question is is im stupid to pay for Contabo for VPS like 80-100$ every month or to pay to another hosting with perfect support and working application manager or anythink else at the VPS

spark flint
#

you pay how much?!?!

rapid zealot
#

for like a 20-30$ ?

spark flint
#

I pay ยฃ10 a month for 20 websites on cPanel with WHM access

boreal iron
#

how about paying for a simple cloud server and setting up your own webserver?

spark flint
boreal iron
#

register the domains somewhere and root them to your server

spark flint
#

its not worth running their own webserver

rapid zealot
#

VPS L SSD

spark flint
#

How much do you pay monthly?

boreal iron
rapid zealot
#

AMD EPYC 7282 16-Core Processor

#

๐Ÿ˜‰

spark flint
#

hosting own webserver with cPanel will be so much more expensive

#

as cPanel is expensive to get unless its a hosting plan

boreal iron
#

yeah I pay less for the cloud server and the domain costs around 10 bucks per year

spark flint
#

how much is the cloud server?

boreal iron
#

huh lemme check

#

got a lot of servers

#

5,29 - 6,30 โ‚ฌ

spark flint
boreal iron
#

depending on the provider

spark flint
#

but as i hope devpage.me grows, i'll eventually move to a cloudserver for that

spark flint
boreal iron
#

god damn, that questions tho

spark flint
#

the directadmin one I use has 188gb ram

#

I can't beat that easily lmao

boreal iron
spark flint
#

I pay ยฃ6.99 a month for an unlimited account reseller DirectAdmin plan

#

I can't justify paying for a cloud server at a higher price than that

boreal iron
#

Using several providers

#

To ensure my DNS network is always up

spark flint
# boreal iron

I don't use Ionos anymore (illegally extending a contract without my permission)

boreal iron
#

check that boxes not allowing them to contact you

#

That's my only valid option to host a server in the US with a europe provider

spark flint
#

They only let me cancel my contract they extended without telling me because I said I would report the payments to my bank

boreal iron
#

lol

solemn latch
#

ionos charged me for stuff I canceled several times(back when they where 1&1).

boreal iron
#

sounds promising, thank you

#

cancelling contracts right now

spark flint
#

I would recommend it

boreal iron
#

nah

#

They only host one of several DNS server for me

#

Most of my root servers are located by Hetzner

spark flint
#

they also lock your account so you can't cancel

boreal iron
#

Still the leader in the EU

solemn latch
#

was when I was a kid with no money my first domain I got it from them.
was actually the most stressed ive been about money ๐Ÿ˜”
kek had to get my parents to help me out, as they refused to drop it.

boreal iron
#

they may changed after getting IONOS to fit into the market

#

probably

solemn latch
#

maybe ๐Ÿ‘€

boreal iron
#

can't complain so far

rapid zealot
#
VPS L SSD
***.***.***.*** **โ‚ฌ17.99**ย€ 23.09.2021 - 23.10.2021 โ‚ฌ17.99ย€
Administration: cPanel (5 accounts) **โ‚ฌ15.59**ย€ 23.09.2021 - 23.10.2021 โ‚ฌ15.59ย€
Subtotal
(recurring fees) โ‚ฌ33.58
Cumulative net โ‚ฌ27.98
+20.0% VAT โ‚ฌ5.60
Cumulative gross **โ‚ฌ33.58**```
boreal iron
#

But I would never use it for a dedicated server anyways

spark flint
boreal iron
#

Their infrastructure is so bad

spark flint
#

20 websites instead of 5 and its cheaper every month, plus you don't have to install or manage everything as its a reseller plan

#

and they migrate it all over there for you

spark flint
boreal iron
spark flint
#

Ionos Hosting and domain for ยฃ1.20 a month was great until they silently increased my contract price to ยฃ15 a month without the option to cancel and extended another 2 years

boreal iron
#

I wouldn't pick them as domain host

#

Their DNS network is slowly and small as fuck

spark flint
#

I now just buy domains from either Namecheap or 123 reg and link to one of my hosting plans (depends what the project is for)

spark flint
rapid zealot
#

thats why if Contabo can't understand what i mean and where is my problem with Application Manager i will change the hosting and never ever come back to this hosting again

spark flint
#

Server location choices

rapid zealot
#

i have 7 day's before auto pay and i will see them

spark flint
#

the only reason why I promote brixly a lot is because of how good their support is and how nice the CEO is lmao

boreal iron
rapid zealot
#

if you know best hosting solution for web sites with WHM & cPanel i'm always here and want to know about that

spark flint
#

also where is your VPS located

rapid zealot
#

Germany

#

Contabo

spark flint
#

and you have 5 websites

rapid zealot
#

yes thats righ i have 5 domain names with 5 accounts at the WHM for every domain name

spark flint
#

You can have up to 20 with the plan I recommend

rapid zealot
boreal iron
#

How about picking a managed webhosting package

#

As you don't seem to be experienced with servers at all

spark flint
#

thats kinda like what I'm suggesting

boreal iron
#

That's not managed

spark flint
#

It is

#

Its a reseller plan so he doesn't manage the servers at all

#

and uptime is great

boreal iron
#

That's not what I mean lol

spark flint
#

the reason I use it is because I have no server experience at all and all issues get resolved within 10ish mins

boreal iron
#

yeah I wouldn't recommend to run a server without proper knowledge

#

you're always a security risk for the whole networks, that's how it is

spark flint
#

thats why I don't now lmao

#

I tried

boreal iron
#

and responsible for your shit

#

hmm I see the peak lol

rapid zealot
# boreal iron As you don't seem to be experienced with servers at all

no i have experience but i don't have time to lose with idiots who can't understand me what i mean i tell them what i mean and where is the problem and mohamed answer me with stuped questions when i give him root user with password and everythink what i do is to follow the guide from tutorial but at the end when i open browser and put the link to see final Hello i'm your node Application i see 504 error that is not serious bro

spark flint
#

Well all I'll say is if you want to move to another cPanel/WHM plan then I'd highly recommend Brixly as its got great 24/7 tech support and they will automatically migrate the websites from your old host to your new, and they will likely sort the node.js issues for you.

rapid zealot
#

paraphrase it god damn it sorry for my bad language but i tell him what i do and where is the problem as much as possible and he tell me to paraphrase it

spark flint
rapid zealot
#

btw now you understand where is my problem right

spark flint
#

yeah

rapid zealot
#

why when i tell them as much as possible where is the problem they send me that stuped email's with stuped answers

#

๐Ÿ˜ฉ

spark flint
#

no clue

rapid zealot
#

I'm tired and i don't have much time to lose with idiots at Contabo but if they give me a good reason to stay i will pay again that's is the mine last message to them

boreal iron
#

Why do you use the English support then in a German spot if that's not your main lagnuage?

spark flint
#

they will come up with some bs to make you stay lmao

boreal iron
#

lel

spark flint
#

like I get the same access with better perks for cheaper and I don't have to worry about managing a server

#

its more the price tho

rapid zealot
#

Look what i send from 1st email to the first idiot

https://blog.cpanel.com/how-to-host-a-node-js-application-with-cpanel/ also we try it at other domain to see is this a bug and that's why we are want help because we are trying this Tutorial at another hosting that and it's work perfect but at your hosting not want to working and here is some screenshots```
split hazel
#

contabo is cheap but every little thing has a service fee

spark flint
#

โ‚ฌ33.58 a month is fucking expensive

split hazel
#

specs?

spark flint
#

for 5 cPanel accounts with WHM access

split hazel
#

idk about their cpanel business

spark flint
split hazel
#

well don't you have to also pay for a cpanel license

spark flint
spark flint
boreal iron
#

wtf do you need 8 cores and 30 GB RAM for?

#

by running a few websites

spark flint
#

cPanel hosting

#

ig

split hazel
#

I'm pretty sure cpanel licenses aren't that cheap

#

cpanel is overrated

spark flint
#

Unless bought in bulk like web hosting companies do

rapid zealot
spark flint
#

Directadmin with unlimited accounts for ยฃ6.99 a month really is not bad

boreal iron
#

AMD EPYC 7282 16-Core Processor

for site hosting?

#

lmao

spark flint
#

lmao

rapid zealot
#

๐Ÿ˜„

spark flint
#

overkill

boreal iron
#

where's my picture

split hazel
#

dont know about hosting provider discounts but

#

not nice

boreal iron
#

there we go

#

that's enough for your sites

boreal iron
#

even the first option is enough

spark flint
split hazel
#

they probably have a partnership

#

maybe ask them about the price?

spark flint
split hazel
#

if they wanna tell you that is

spark flint
#

and on their 250 account plan it goes down to ยฃ0.19 per license after you hit 250

boreal iron
#

AMD EPYC 7282 16-Core Processor

I don't even need the 32 vcores in my Proxmox VE
But why not hosting 5 sites on it, while I am hosting 8 servers on it

spark flint
#

thats what one of my webservers has lmao

#

tbf there are like 1k sites on that server

rapid zealot
#

Guys i like to exchange information about hosting but i go to sleep because i'm at work after few hour
I will definitely review all your suggestions by the end of the week because I am looking for the best for me and my projects

spark flint
boreal iron
split hazel
#

contabo will just fire up a bunch of ss-

#

wait i wasn't supposed to say that

boreal iron
#

yeah as I said the RAM

spark flint
#

thats the cheapest plan from one of the companies i use

split hazel
#

pretty sure namecheap also have... cheap cpanel hosting

spark flint
#

I don't like namecheap hosting lmao

boreal iron
#

lol no IP for you, Sir

split hazel
#

why not

boreal iron
#

Imagine sharing your IP with others

spark flint
spark flint
#

it just does

#

cheap but slow

split hazel
#

disappointing

#

you could buy a big bo oh o wo ah with that

spark flint
#

lmao

#

or a bag of chocolate

split hazel
#

sorry had to after seeing the currency is pounds

#

even though I'm also british

spark flint
#

for server in UK

boreal iron
#

You should only pick US if you really need to

split hazel
#

non-united states of america

boreal iron
#

NUS?

split hazel
#

exactly

boreal iron
spark flint
#

my personal reseller plan uses a London based server and my devpage.me/dbot.cc reseller plan uses a amsterdam based server