#development

1 messages · Page 77 of 1

crystal wigeon
#

but then how can i access just the logger id then? we back to the old problem i sent

#

something like this

#
    id
    constructor(id) {
        this.id = id
    }

    log(text) {
        console.log("log id ---", this.id, text)
    }
}


const anotherFunc = () => {
    this.logger.log("something new another")
}

const boot = async (id, time = true) => {
    const logger = new Logger(id)
    logger.log("before")
    if (time) {
        setTimeout(() => {
            anotherFunc()       
        }, 3000);
    }
}

boot(123)

setTimeout(() => {
    boot(555, false)
}, 2000)```
quartz kindle
#

class main {
  constructor(id) {
    this.id = id;
    this.logger = new Logger(id);
  }
  boot(time = true) {
    this.logger.log("before");
    if(time) {
      setTimeout(() => {
        this.anotherFunc();
      })
    }
  }
  anotherFunc() {
    this.logger.log("something new another")
  }
}

const a = new main(123);
a.boot();

const b = new main(555);
b.boot(false);
crystal wigeon
#

what if "anotherFunc" is exported from another file?

quartz kindle
#

you can do this ```js
const anotherFunc = require(...)
class main {
constructor() {
this.anotherFunc = anotherFunc.bind(this)
}
}

crystal wigeon
#

mmm

quartz kindle
#

or this ```js
const anotherFunc = require(...)
class main {
anotherFunc() {
return anotherFunc.call(this);
}
}

crystal wigeon
#

so i have no choice but to pass args

#

to this?

#

i'll have to do this to every inner func inside of anotherFunc as well

#

which is not ideal

quartz kindle
#

you have to put your args and context somewhere, with classes you can use this, with functions you have to use arguments

crystal wigeon
#

mm

#

how does google cloud run do it then? they generate a new id for each request for the logs

quartz kindle
#

if the function is inside the class, or bound to it, or called from it, then the function also has access to this

#

if not, then it needs arguments

quartz kindle
#

thats what i do in my api

crystal wigeon
#

mmm new instance yeah trying to figure out a way to do it by not making it global object or something where it would be affected by 2nd incoming req

#

or by passing it to funcs

quartz kindle
#

all class instances are separate from each other, they cannot be affected

crystal wigeon
#

given that the funcs are called from within the class

quartz kindle
#
someServer.on("request", (userid) => {
  const instance = new SomeClass(userid)
  instance.doStuff()
})
crystal wigeon
#

the moment i use global instance its all gone for a toss

quartz kindle
#

no other request can interfere with an existing class

#

each request will create its own separate instance

crystal wigeon
#
  const instance = new SomeClass(userid)
  func1()
})

func1() {
  const instance = new SomeClass(userid)
  instance.dostuff()
}
#

can i do this?

#

mm

#

ig i gotta store a global object with userid mapping

#

if i wanna use it that way. but i gotta pass user id everywhere

quartz kindle
crystal wigeon
#

mmm

quartz kindle
crystal wigeon
#

this is going to be a challenge

quartz kindle
#

the class inside func1 will have no id

crystal wigeon
#

yeah mmm

#

its more like, i got a global logger instance

#

export logger = new Logger()
logger is called in multiple files and funcs

#

i want the logger to have same id for 1 execution

quartz kindle
#

a global class is called a singleton, in that case the class cannot have a context, you need to pass the id to its methods

#

so you will always have to use logger.log(someid)

crystal wigeon
#

lets say

  func1() -> inside func1 there are few more funcs() in diff files
  })```
#

mmm

#

and everywhere i need to pass the id as args

#

into all these funcs

#

right?

#

thats mm man not ideal

quartz kindle
#

depends, you can mix them up in a lot of ways

crystal wigeon
#

lets say i have logger.log in func3

quartz kindle
#

the object oriented way would be using classes and putting all the funcs inside the classes

crystal wigeon
#

which is called inside func2 -> func1

#

yeah well cant but all funcs inside 1 class

quartz kindle
#

the functional programming way would be by passing the id to all of them via arguments

crystal wigeon
#

okay so

quartz kindle
#

you can mix it up as you prefer as well

#

for example having func1 inside a class, then func2 called with id as an argument

crystal wigeon
#

is it possible for me to access log inside func3 if its in diff file but is being called in func2 which is inside of a class?

#

via "this"

#
   constructor() {
  // set id
}
func1(params) {
 return func2.call(params, this) // from another file
}
 }

export func2({ other parameters }) {
 this.log() // is this possible?
}
quartz kindle
#

its possible if func1 is inside class x

#

params and this shold be the other way around

#

this first

crystal wigeon
#

gotcha, so it will still work

#

even if its in another file

quartz kindle
#

yes

#

what .call() does is defining a this value for the function, and then executing it

#

function.call(thisVal, param1, param2, ...)

crystal wigeon
#

gotccha, worth giving it a try ig

#

but using classes in js is not recommended no?

quartz kindle
#

it doesnt matter, its just a design decision, how you want to design your stuff

#

if you have a lot of context and relationships, usually classes are nicer to use

crystal wigeon
#

cause i thought that might cause memory leaks

#

i see

quartz kindle
#

nah

crystal wigeon
#

alr i'll give it a try

#

thanks

quartz kindle
#

technically speaking, up until a certain number of arguments, funcions will probably be a little faster than classes

#

but depending on the thing you're working on, classes will be much much easier to work with

crystal wigeon
#
    id
    constructor(id) {
        this.id = id
    }

    log(text) {
        console.log("log id ---", this.id, text)
    }
}


const anotherFunc = (params) => {
    this.logger.log("something new another " + params)
}

class Main {
    logger
    constructor(id) {
        this.logger = new Logger(id)
    }
    boot(params) {
        console.log("log id: ", this.logger.id)

        setTimeout(() => {
            anotherFunc.call(this, params)
        }, 5000);
    }
}

const main = new Main(444)
main.boot("extra params")

setTimeout(() => {
    const msain = new Main(555)
    msain.boot("extra params")
}, 2000)```
crystal wigeon
#

and see the execution line

#

so i tried this and it says this.logger is undefined

quartz kindle
#

arrow functions do not support this at all

#

anotherFunc needs to be a normal function

crystal wigeon
#

welp

#

figured haha

#

oh well

#

thanks

#

gotta find other ways cause i have arrow funcs everywhere

quartz kindle
#

if id is all you need everywhere

#

then its not a big deal if you just give it as a parameter to all the functions

#

you can just do func1(id, stuff) -> anotherFunc(id, other stuff) -> func3(id, something else)

crystal wigeon
#

gotta find other ways mmm

#

maybe closures

#

?

#

i fr need a global object to somehow behave like a local object

quartz kindle
crystal wigeon
#

yeah, mm just tryna set a context for each new request thats all

lyric mountain
ancient wedge
#

hi, is there a way to call interaction.reply() multiple times without getting Interaction has already been acknowledged. error?

well it only sends it once but needs to be called twice

e.g. this gives an error but i can't figure it out:

try 
{
...
} catch (err) 
{
  return interaction.reply("epic error message");
}

interaction.reply("ok")

discordjs latest

lyric mountain
#

yes, dont reply twice

ancient wedge
#

i need it to be ephemeral

lyric mountain
#

still

#

you dont need to send 2 messages, only 1

ancient wedge
#

its sending only 1 message

#

it returns on error so its only 1

lyric mountain
#

yes?

#

like, why do you need to send 2 messages?

ancient wedge
#

one on error one on success

#

its never gonna send 2 messages

lyric mountain
#

show your current code

lyric mountain
#

I said current code

#

not example code

ancient wedge
#

its just long version of that

#

reply on error, reply on success

lyric mountain
#

well, I cant help unless I see the code that's erroring

#

because the example u showed shouldn't error

earnest phoenix
#

Hello

ancient wedge
earnest phoenix
#

Damn

lyric mountain
#

...you're missing the point

earnest phoenix
#

тянуть 31 мои друзья

feral aspen
#

Is building websites with hugo a good idea? (or efficient, let's say)

fervent moss
#

Wats hugo

earnest phoenix
#

It is used to create static websites, and yes it's good at doing its job.

#

Try it and see, then if you want to keep on using it that's your choice.

feral aspen
fervent moss
#

Drag and drop sort of?

feral aspen
#

It's a framework.

earnest phoenix
earnest phoenix
#

Up to you if you want to use it or not, simply try it out is what I'd recommend.

feral aspen
#

Eh, I've been willing to rewrite my portfolio...

#

However, someone told me about Hugo, but not sure if it'd be efficient to use such so.

earnest phoenix
#

It is, at least that's my opinion.

feral aspen
#

Do you use raw HTML & CSS for your website?

dry imp
#

💀

feral aspen
#

???

earnest phoenix
#

Nope I don't

#

Markdown

#

Astro and Hugo are completely different things, Astro sucks for what Hugo does.

#

No need to come over and over with Astro.

feral aspen
#

Fair enough.

dry imp
#

use mainstream ones like mine

ancient wedge
lyric mountain
#

ah

valid furnace
#

hi my bit isnt working

green haven
#

no thanks!

green haven
valid furnace
green haven
valid furnace
wraith pilot
#

Hey i want to ask something

green haven
green haven
#

what are thjey

valid furnace
#

can you do it for me

green haven
#

omg okay

#

Yes

#

<3

valid furnace
#

okay i sent you my password and email in dms

green haven
#

omg

#

okay

lyric mountain
#

tf is happening here

lyric mountain
valid furnace
#

@green haven have you logged into it yet>?

green haven
#

yes omg be patient

valid furnace
#

i want my bot up

valid furnace
green haven
#

you ungratefuil toad

valid furnace
#

give me my password back

dry imp
#

hahahshshshsjs lmaoooo

green haven
#

okay

valid furnace
#

stop

#

some help

#

she hacked me

green haven
#

30,000?

lyric mountain
dry imp
green haven
#

excusing you

valid furnace
dry imp
#

developing brain

green haven
#

its giving

lyric mountain
valid furnace
#

can you ban her shes messaging my friends

green haven
#

what

#

omg

#

stop

#

ruben

#

stop

solemn latch
#

👀 wth is going on here

green haven
#

help

#

ruben is gaslight ing me

valid furnace
#

what

lyric mountain
valid furnace
#

you hacked me

green haven
#

no

#

im helpgng rben

#

he asked me

solemn latch
#

@valid furnace dont give your password info out.
@green haven dont ask for user login info.

lyric mountain
#

context:

valid furnace
#

but you asked for my password

green haven
#

i didnt do anything 😭

dry imp
#

wtf is this drama

solemn latch
green haven
#

ruben

#

youre

#

dense

valid furnace
#

i thought she would help

solemn latch
#

thats not how the internet works 👀

green haven
#

cries

valid furnace
#

oh

#

ok

solemn latch
#

never share account info

green haven
valid furnace
#

i choose my own destiny

green haven
#

💀

valid furnace
#

i need to make a bot

solemn latch
#

You'll want to learn to program first.

green haven
#

top.ggTop voted bots on Top.gg ; ProBot ✨. 4.2. 8,000,000 · logging · +4 ; Mudae. 4.5. 3,371,839 · fun · +1 ; Karuta. 4.2. 678,782 · art · +10 ; Dank Memer. 4.8. 8,627,015.

valid furnace
#

to learn ciding

green haven
#

stop why are you so toxic

lyric mountain
#

just move on

green haven
#

what are you even talking about

valid furnace
#

I like JavaScript because had has libraries like discordjs

#

can I use mongodb

#

with mongoose npm package

green haven
lyric mountain
#

you just need to select the one that you likes the most

solemn latch
#

they're muted

quartz kindle
#

discord.whitespace

#

discord.intercal

wheat mesa
#

🤢

radiant kraken
#

oh wait that's just the app

lofty cipher
#

How can i fix this?

C:\Users\diana\Documents\vscode\Hundy Bot\Hundybot\node_modules\mongodb\lib\cmap\connection.js:207
                    callback(new error_1.MongoServerError(document));
                             ^

MongoServerError: BSON field 'delete.deletes.q' is the wrong type 'string', expected type 'object'
    at Connection.onMessage (C:\Users\diana\Documents\vscode\Hundy Bot\Hundybot\node_modules\mongodb\lib\cmap\connection.js:207:30)
    at MessageStream.<anonymous> (C:\Users\diana\Documents\vscode\Hundy Bot\Hundybot\node_modules\mongodb\lib\cmap\connection.js:60:60)
    at MessageStream.emit (node:events:513:28)
    at processIncomingData (C:\Users\diana\Documents\vscode\Hundy Bot\Hundybot\node_modules\mongodb\lib\cmap\message_stream.js:132:20)
    at MessageStream._write (C:\Users\diana\Documents\vscode\Hundy Bot\Hundybot\node_modules\mongodb\lib\cmap\message_stream.js:33:9)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Writable.write (node:internal/streams/writable:337:10)
    at TLSSocket.ondata (node:internal/streams/readable:766:22)
    at TLSSocket.emit (node:events:513:28) {
  ok: 0,
  code: 14,
  codeName: 'TypeMismatch',
  '$clusterTime': {
    clusterTime: Timestamp { low: 1, high: 1671198912, unsigned: true },
    signature: {
      hash: Binary {
        sub_type: 0,
        buffer: Buffer(20) [Uint8Array] [
           81,  46, 129,  63,  18, 156,
           19, 197, 204,  12, 254,  49,
           70, 149, 145, 133,  15, 184,
          168, 141
        ],
        position: 20
      },
      keyId: Long { low: 21, high: 1655997781, unsigned: false }
    }
  },
  operationTime: Timestamp { low: 31, high: 1671198911, unsigned: true },
  [Symbol(errorLabels)]: Set(0) {}
}
lofty cipher
# lyric mountain show code
try {
                        if (!interaction.author.bot) {
                            const channnel = await client.channels.fetch(db.channelId);
                            const message = new EmbedBuilder()
                                .setTitle(`Hundy Global | ${interaction.author.username}`)
                                .setDescription(`\n ${interaction.content}`)
                                .setFooter({ text: 'Von Server: ' + interaction.guild.name })
                                .setThumbnail(interaction.author.displayAvatarURL({ format: 'ping'}))
                                // .setImage(interaction.guild.displayAvatarURL({ format: 'png' }))
                                .setImage(interaction.guild.icon)
                            await channnel.send({ embeds: [message]})
                        }
                    } catch (e) {
                        db.collection.deleteOne(db.channelId)
                    }
lyric mountain
#

ah, mongo

lofty cipher
#

Yes

lyric mountain
#

well, judging by the error, deleteOne isn't expecting a string

#

cant say much more than that

lofty cipher
#

Okay thanks

lyric mountain
#

also

#

this will error

#

this too since ur not checking if the guild has an icon

lofty cipher
#

Okay

#

Can anyone tell me how to delete the object that has the data to the server?

#

In mongodb

#

aka mongoose

hidden gorge
#

hey @royal portal is there a way for my bot to check if a slash command is ran in a dm?

royal portal
#

should be

hidden gorge
#
client.on("message", msg =>  { 
    
   if(msg.guild==null &&msg.author.id!=='botDiscordId'){
    msg.reply('dosomethinghere')
   }
});``` ?
lyric mountain
#

slashes dont have an author

earnest phoenix
#

Slash-commands aren't messages either

hidden gorge
#

is there a way to detect it?

lyric mountain
#

yes, by using if (msg.guild) { ... }

#

but seriously, rename that variable

hidden gorge
ancient wedge
#

what does this error even mean

lyric mountain
#

it means your node is outdated

ancient wedge
#

it used to work but after reinstalling its borken

#

oh fk i forgot

neon leaf
#

how can I make typescript use tabs instead of spaces after compilation? my files use tabs but the output isnt and its causing errors

#

or just make it remove tabs entirely, that would work too

neon leaf
#

wdym?

#

I already use tabs

#

not spaces

lyric mountain
#

that means nothing

#

it just means 1 tab = 2 spaces

neon leaf
#

no

#

its an actual \t

lyric mountain
#

but anyway, HOW is it causing errors?

lyric mountain
neon leaf
#

and it renders the spaces

lyric mountain
#

yes

#

it's supposed to

neon leaf
#

and I dont want to

lyric mountain
#

then remove the leading spaces

#

that's how multiline strings work in js/ts

neon leaf
#

this is a live example

#

I cant because then the identation looks cursed

lyric mountain
#

the first ` dictates the spot zero

#

u get what u get

#

u can also replace those spaces, but it'll cost some processing for the sake of code vanity

#

funny enough, in java the first word dictates spot zero, instead of the quotation mark

quartz kindle
# neon leaf this is a live example

you have 3 options:

.setDescription(
some text here and some more
)

2. ```js
  .setDescription("some text\nhere\nand\nsome more")

.setDescription([
"some text",
"here",
"and",
"some more"
].join("\n"))

lyric mountain
#

all equally cursed KEKW

neon leaf
#

3 seems the best lmao

lyric mountain
#

and the only one that requires additional processing

quartz kindle
#

option 4. ```js
Hello How are you?.replace(/\s+/g, " ").trim()

lyric mountain
#

u can also replace those spaces, but it'll cost some processing for the sake of code vanity

lyric mountain
#

it'll look like this

#

but without the leading spaces

#

a

#

wait

#

that'll result in

quartz kindle
#

idk regex

lyric mountain
#

lmao u just replaced everything that's an alphadecimal character

#

what u want is /\s+/g

quartz kindle
#

there

#

lmao

lyric mountain
#

but yet again, additional runtime processing for the sake of code vanity

#

btw, that'll result in HelloHowareyou?

quartz kindle
#

there

#

lmao

#

or

#
`
  Hello
  How are you?
`.split("\n").map(x => x.trim()).join("\n")
marsh breach
#

@balmy jasperot

limber siren
#

any clue why js client.on("ready",
isn't working

quartz kindle
#

did you run that function?

limber siren
quartz kindle
#

show more code

limber siren
lyric mountain
#

show where ur calling that function

quartz kindle
#

although i kinda already figured out whats wrong tho

#

your problem will probably be fixed if you do async (client) => { (which btw you can remove the async here, its not needed) and remove the require("../index")

#

and then call the function with (client)

lofty cipher
#

How do I get into the comma in node.js?

quartz kindle
#

into the comma?

lofty cipher
#

Yes 0,00000000060

quartz kindle
#

oh you mean decimals

#

what do you want to do with them?

lofty cipher
lyric mountain
#

"Young programmer gets into comma after learning JS"

lofty cipher
quartz kindle
lofty cipher
#

0,00000000060 bitcoins per minute

lyric mountain
#

I wouldn't get into deep decimals if I were you

lofty cipher
#

Why?

lyric mountain
#

js isn't precise enough to maintain a stable calculation when u use very small numbers

#

for such high precision calculus you'd use a scientific-capable language like c

#

the big question is, why do u need it?

quartz kindle
#

there are some libraries that are made to handle precise numbers in js

#

but yeah, js itself does not have built in support for high precision decimal numbers

lofty cipher
sterile brook
quartz kindle
lyric mountain
#

do u REALLY need to use such ultra-small numbers?

sterile brook
#

okeh, he will develop improved blockchain

lyric mountain
#

is it for a bot?

lofty cipher
lyric mountain
#

are u basing the values off bitcoin api or setting them manually?

lofty cipher
#

for small income

lyric mountain
#

just go with bigger numbers then

lofty cipher
#

manually and + upgrades for more

lyric mountain
#

numbers in js can go up to 2 billion, just use a higher number like 0.0006 or so

boreal iron
quartz kindle
#

in this case, i'd use a package to ensure high precision numbers

#
lyric mountain
#

lies, lies everywhere

quartz kindle
#

its not hard to make a high precision number system in js, since it has BigInt which can be used to simulate decimal numbers, but for extra safety you probably want to use something that already exists and is trusted by other people

wheat mesa
quartz kindle
#

quickjs has it, v8 doesnt

slow terrace
#
                const timezone = `America/New_York`;

                let options = {
                  timeZone: timezone,
                  year: 'numeric',
                  month: 'numeric',
                  day: 'numeric',
                  hour: 'numeric',
                  minute: 'numeric',
                  second: 'numeric',
                  millisecond: 'numeric',
                },
                formatter = new Intl.DateTimeFormat([], options);
                console.log(formatter.format(new Date())); // Logs 12/16/2022, 4:37:04 PM

How to convert this date to ms?

#

Is that possible?

lyric mountain
#

well, yes, but why do u have it to being with?

lyric mountain
#

exactly what I asked

#

any reason ur not using js' built-in Date?

slow terrace
ancient nova
lyric mountain
#

but well, back to your question, yes you can convert that to millis

#

it'll be a lengthy code, but it's possible

#

multiply second by 1000, minute by 60000, hours by 3600000, etc

#

then sum all together

eternal osprey
#

hey guys

#

i am using sqlite3 for nodejs atm as i wanted to implement a bit of testing due to my midterms next month

#

i have made this

#
let k = await db.query(sql` SELECT * FROM role;
                 `)```
#

however, is this even possible? And what does the variable look like? Is k just an array of objects?

quartz kindle
#
sql` SELECT * FROM role;`
``` this is called a tagged template
eternal osprey
#

mhmm?

#

Yeah it says that too if i hover over it in vscode

quartz kindle
#

no idea what the sql function does, but it should return an array of results yes

eternal osprey
#

i never really implemented the things i learned in dbms in actual code, but rather tested the queries in duckdb (more like a client)

eternal osprey
#

tbh i think that dbms is my favourite subject so far. I love to work with data, same went with my past semester course analysis.

slow terrace
lyric mountain
#

u can format dates however u like

wheat mesa
#

Nobody cares. Fuck NFTs, fuck crypto, fuck spammers

dry imp
#

i care but u must be dumb to advertise nft in this server

indigo cobalt
#

Why the heck you're putting this on a development channel.

wheat mesa
#

He wants to get people into investing in environment-destroying dogshit scams

#

That’s my take

supple quail
#

@drowsy crag is this allowed \

#

idk if ads are allowed

#

😭

wheat mesa
#

I like artists, I like web developers, but I have absolutely no respect for people who use those things to promote “metaverse”/“web3”/crypto scams

drowsy crag
#

@fluid loom please dont advertiseBunNod this channel is for development related discussions and advice, not a place to grow your own projects

quartz kindle
wheat mesa
#

I would invest in timcoin

#

Backed by our lord and savior

radiant kraken
#

@wheat mesa do you prefer going safe on readability or unsafe for speed

#

my current code involves a lot of pointer arithmetic iara_why_sob

wheat mesa
#

wtf are you doing that requires that much ptr arithmetic 😭

radiant kraken
#

okay maybe i should really use Iterators

#

i forgot that this is not C

radiant kraken
#

there we go now it's more bearable

quartz kindle
#

all of that for a simple endsWith function? damn

lyric mountain
#

if the desired match is longer than the test string, it's impossible for it to end with it

radiant kraken
radiant kraken
#

i'm the type of person who use Rust just for the features, and in the end i still stick to my C's unsafe self ia_lul_haha

next storm
#

Hey i need a little help.
Actually I'm creating a tag system, in which if user can set certain tags and a reply for that.
I'm using mongo db to store that. Can anyone tell me I'm which way should I store so that I can add and delete the data easily

wheat mesa
#

not sure what you mean by "which way I should store"

next storm
#

I mean, should I store it as a direct object or an array of objects?

wheat mesa
#

why would you store it as an array

#

you'd have to fetch the entire array and append to it and then push the entire array each time

#

wasted performance

next storm
wheat mesa
#

I see nothing wrong with that

next storm
#

Okay I got it

#

Thanks

radiant kraken
#

is it possible to return a custom class object in WebAssembly

#

just wondering

crystal wigeon
#

hey @quartz kindle I was able to solve my issue using cls-hooked they basically use the call stack to map the context. interesting stuff

#

didnt need to use class or pass any args

earnest phoenix
#

if (message.guild && message.guild.id === chx) {
message.channel.send("sei premium")
} else {
message.channel.send("non sei premium")
}

#

I don't know why but it doesn't send me mesage after else

sharp geyser
#

because else won't run if the first condition evaluates to true

earnest phoenix
spark garnet
#


if (message.guild && message.guild.id == chx) 
{
      message.channel.send("sei premium")
    }
else
{
       message.channel.send("non sei premium")

}

#

i think the issue with the "===" operator ? i guess it should be "==" idk

earnest phoenix
#

okk

#

no work

digital swan
earnest phoenix
#
const discord = require ("discord.js");
const config = require("../config/config.json")
const prefix = require('../config/config.json')
const db = require("quick.db")
module.exports.run = async(client, message, args) =>{
    let chx = db.get(`premium_${message.guild.id}`); 
    if(chx === null) { 
      return;
    }

    if (message.guild && message.guild.id == chx) {
      message.channel.send("sei premium")
    } else {
       message.channel.send("non sei premium")
    }
    
    await message.channel.send("non sei premium")
      

}```
digital swan
#

do you know what the value of it is

spark garnet
#
const discord = require ("discord.js");
const config = require("../config/config.json")
const prefix = require('../config/config.json')
const db = require("quick.db")
module.exports.run = async(client, message, args) =>{
    let chx = db.get(`premium_${message.guild.id}`); 
    if(chx === null) { 
      return;
    }
   await message.channel.send(chx)
    if ( message.guild.id == chx) {
      message.channel.send("sei premium")
    } else {
       message.channel.send("non sei premium")
    }
    
 
      

}
#

try it like this

drifting cairn
spark garnet
#

let chx = db.get(premium_${message.guild.id});

#

it = the id

digital swan
#

noone except him knows what is in the database so we dont know if chx is equal to a snowflake, number, array or what

spark garnet
#

then try to send the chx so you can see what is

#
const discord = require ("discord.js");
const config = require("../config/config.json")
const prefix = require('../config/config.json')
const db = require("quick.db")
module.exports.run = async(client, message, args) =>{
    let chx = db.get(`premium_${message.guild.id}`); 

    if(chx === null) 
    { 
      return;
    }


   await message.channel.send(chx)
    if ( message.guild.id == chx) {
      message.channel.send("sei premium")
    } else {
       message.channel.send("non sei premium")
    }
    
 
      

}


digital swan
#

whats wrong with console.log

spark garnet
#

yeah also good

spark garnet
#

?

digital swan
#

it should just have permissions that it needs to function

#

personally i wouldnt just use the admin permission, especially for a new & untrusted bot

spark garnet
#

okay my bot have permission like normal users send message

earnest phoenix
digital swan
#

Console.log it to see if it’s actually what you expect it to be first

lean pike
#

Hi guys,
I have a question about graphql. I use Postgresql database and redis for cache, but I got delay.
I want to make it more less. Do you advice me to use it in my project or nope.

#

This is simple rep

#

and this is only 36 row

next storm
#
DiscordAPIError: Missing Permissions
    at RequestHandler.execute (/home/ubuntu/Ares/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/ubuntu/Ares/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async GuildBanManager.remove (/home/ubuntu/Ares/node_modules/discord.js/src/managers/GuildBanManager.js:199:5)```how to fix this error?
digital swan
#

looks like the bot doesnt have permission to unban people

next storm
digital swan
#

yeah

next storm
#

but i've already checked the condition if bot has or not, and if it doesn't have then it returns an error msg

digital swan
#

well it mustnt be working properly

next storm
#

yeah it works, but it logs the error msg in console sometimes

digital swan
#

well it must be coming from somewhere where you didnt check for permission

next storm
#

actually I've a command of unbanall and it unbans all the members, and in the starting of the command only, I've written that to check permissions

digital swan
#

do you know thats where the error is coming from?

next storm
#

that only i don't know ):

#

it shows node module error

digital swan
#

are you attempting to unban members from somewhere other than the unbanall command?

next storm
#

nope

#

actually it spammed the console 💀

#

and it can occur only through unbanall

digital swan
boreal iron
#

But since the error is very specific, in your case a ban/unban case it shouldn't be hard to find the related code

next storm
#
message.guild.bans.fetch().then((bans) => {
      if (bans.size == 0) {
        return message.channel.send({ embeds: [new MessageEmbed().setColor(client.color).setDescription(`${client.emoji.cross} | There is no one banned in this server.`)] });
      } else {
        let i = 0;
        bans.forEach((ban) => {
          try {
            message.guild.members.unban(ban.user.id);
          } catch (err) {
            console.log(null);
          }
          i++;
        });
        message.channel.send({ embeds: [new MessageEmbed().setColor(client.color).setDescription(`${client.emoji.tick} | Successfully *Unbanned* \`${i}\` users from the server.`)] })
      }
}```
boreal iron
#

console.log(null); is what u catch

#

Also fetching the bans also returns a promise you don't catch

next storm
#

I added that now 😂 there's nothing which I've done in catch block

next storm
boreal iron
#

Not to say that this will entirely get you rate limited

next storm
#

;-; then what to do

boreal iron
boreal iron
next storm
#

yes

boreal iron
#

You are looping through it or simply use filter() on it to get all user IDs

#

Then unban all members by providing the user IDs all at once

#

Should be able to pass an array of IDs to unban

next storm
#

can we unban all members by passing the array?

boreal iron
#

Instead of sending the request lots of times

next storm
#

okay I got it

boreal iron
#

I do assume this is possible

#

Lemme check

boreal iron
#

Ha lol you can't pass an array with user IDs

#

What a crap

next storm
#

):

#

then there's nothing to do smh

boreal iron
#

Guess unbanning each one by its own is the way then

next storm
#

hm

boreal iron
#

Weird but ok

next storm
#

how can i catch that error?

#

try catch block doesn't does that i guess

boreal iron
#

Adding a catch block to the fetch method

next storm
#

.catch() ?

boreal iron
#

Without permissions the promise will return an error

next storm
#

.catch() one?

boreal iron
#

Yeah

next storm
#

okiz

boreal iron
#

fetch(...).then(...).catch()

next storm
#

oki

craggy pine
#

Couldn't you also just do a quick check at the beginning of the code block to see if the permission is given to the bot in the guild and if not return an error message.

boreal iron
# next storm oki

Also you aren't awaiting your confirmation message which can also fail

#

Imagine if 100 unbans would happen, then 100 messages would be send

#

Which is api spam

next storm
#

no

#

it will not

boreal iron
#

So send one message

next storm
#

it sends after everyone;s unbanned

craggy pine
#

Ah right this is a unban all command not a unban one

next storm
#

after loop ends, it sends

boreal iron
#

Ah

#

Well mobile code block suck

#

Yeah saw it now

#

Still another not awaited promise

#

send() returns a promise

#

Once sending the message fails you will see an error and will never know where it comes from

craggy pine
#
if (message.guild.me.hasPermission(["BAN_MEMBERS"]))
boreal iron
#

Fetch can fail regardless

craggy pine
#

I believe is the correct code.

boreal iron
#

Not so for v14

craggy pine
#

Hate discord versions.

#

sigh

#

Well assuming it's v13

if (message.guild.me.hasPermission(["BAN_MEMBERS"])) return message.channel.send("Bot can't unban users due to missing permissions!")
//no point in running the rest if permission is not present with the bot. 
message.guild.bans.fetch().then((bans) => {
      if (bans.size == 0) {
        return message.channel.send({ embeds: [new MessageEmbed().setColor(client.color).setDescription(`${client.emoji.cross} | There is no one banned in this server.`)] });
      } else {
        let i = 0;
        bans.forEach((ban) => {
          try {
            message.guild.members.unban(ban.user.id);
          } catch (err) {
            console.log(null);
          }
          i++;
        });
        message.channel.send({ embeds: [new MessageEmbed().setColor(client.color).setDescription(`${client.emoji.tick} | Successfully *Unbanned* \`${i}\` users from the server.`)] })
      }
}

#

Is what I would do. mexShrug

lyric mountain
#

Console log null?

boreal iron
#

We're through that already

spark flint
#

Does anyone know how to recover files from a corrupted Minio instance? I've located the folder of all of the files, but they are stored as directories with xl.meta in the directory.

I've tried restarting Minio from that path, but it didn't work as everything returns AccessDenied when visited in the browser.

earnest phoenix
#

This is my button test command and i get this error after clicking button, plz help!

Code- https://sourceb.in/msEeSXxG9L

Error-


throw new DiscordAPIError(data, "co de" in data ? data.code: data.error, statu s, method, url, requestData);

DiscordAPIError[50035]: Invalid Form Body components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,). at SequentialHandler.runRequest (/home/ runner/Test-bot/node_modules/@discordjs/res t/dist/index.js:667:15)

at processTicksAndRejections (node: inte

rnal/process/task_queues:96:5) at async SequentialHandler.queueRequest (/home/runner/Test-bot/node_modules/@disco rdjs/rest/dist/index.js:464:14)

at async REST.request (/home/runner/Tes

t-bot/node_modules/@discordjs/rest/dist/ind

ex.js:910:22)

at async InteractionWebhook.editMessage (/home/runner/Test-bot/node_modules/discor d.js/src/structures/Webhook.js:338:15)

at async ButtonInteraction.editReply (/ home/runner/Test-bot/node_modules/discord.j s/src/structures/interfaces/InteractionResp onses.js:158:17) {

requestBody: {

files: [],

json: {

content: undefined, tts: false,

nonce: undefined, embeds: [t-bot/node_modules/@discordjs/rest/dist/ind

ex.js:910:22)

at async InteractionWebhook.editMessage (/home/runner/Test-bot/node_modules/discor d.js/src/structures/Webhook.js:338:15) at async ButtonInteraction.editReply (/ home/runner/Test-bot/node_modules/discord.j s/src/structures/interfaces/InteractionResp

onses.js:158:17) {

requestBody: { files: [],

json: {

content: undefined, tts: false, nonce: undefined,

embeds:

title: 'Moderation commands description: '</kick: 0>\n</ban: 0> \n</unban:0>\n</warn: 0>', color: 3771371

}

], components: [

type: 2,

emoji: undefined```
earnest phoenix
boreal iron
#

Inside your collector when building your new buttons, you forgot to put them in an action row

#

Buttons always need to be inside an action row

#

See yourself how you did it above

north cairn
#

can someone help me

#

i made slash commands and it says appliacation did not respond

#

no erros

#

bot's on.

boreal iron
#

Are u listening to the accociated event?

north cairn
#

umm no

#

my parents sitting nearby

#

and i love my life

#

dont want lose it

boreal iron
#

wtf are u talking

solemn latch
#

what

north cairn
#

the birthday thing?

boreal iron
#

You have to listen to the gateway event INTERACTION_CREATE to receive interactions events

north cairn
#

oh i thought u talkin of the event

#

dem

boreal iron
#

What library do you use?

#

-> also what language

#

js -> djs, py -> dpy ...?

north cairn
#

djs

#

13.8

#

replit

#

now say which file u think the problem mayb

#

interactionCreate?

boreal iron
#

That's the event you need to listen to, yes

north cairn
#

so like where is the error here

#

it keeps saying "The application did not respond"

boreal iron
#

What's inside your command file?

#

does it properly respond to the interaction=

north cairn
#

@boreal iron here

boreal iron
#

This shouldn't be there

north cairn
#

then?

boreal iron
#

add console.log(interaction); inside your ping command file, directly after execute(...)

#

And see if something gets logged on the execution

north cairn
#

there is no execute

#

in ping

#

oh reply thing?

boreal iron
#

Of course there is

#

async execute(client, interaction) => { console.log(interaction); ...

north cairn
#

got em

limber siren
#

Does anyone knows why this is not working

north cairn
#

lemme do

boreal iron
#

alr

boreal iron
north cairn
#

nothing got logged @boreal iron

limber siren
#

I waited the hour for it to sync

#

but still nothing

boreal iron
limber siren
#

The command is being red

limber siren
boreal iron
# limber siren yes

I mean you're just adding the loaded command file to the array... but I don't see this being registered anymore

boreal iron
north cairn
#

but when i type / it shows that /ping but when i run it,says "the appilcation-"

boreal iron
#

What you do is if(!cmd) return; which is a bad behavior

#

Even if no command has been found you should reply accordingly

north cairn
#

trynna say

#

bro that dont cause the error ryt?

boreal iron
#

The error is, no loaded command file has been found

north cairn
#

ye

boreal iron
#

log client.slashCommands please

#

Guess it's empty

#

brb

north cairn
#

i gtg sleep in 5 mins

#

mom will kill me

boreal iron
#

do what I told you meanwhile

#

and post the results

north cairn
#

ye nothing logged

#

@boreal iron

boreal iron
#

client.commands.set(...) and not client.slashCommands

#

The property is called commands not slashCommands

north cairn
#

so change the command to slash

boreal iron
#

inside your event listener edit client.slashCommands.get(...) to client.commands.get(...)

north cairn
#

@boreal iron

boreal iron
#

is slashCommands still your defined array?

boreal iron
boreal iron
north cairn
#

i need to define slashCommands that way?

#

like in that ss?

north cairn
boreal iron
#

When reading your command files, you will have to save the commands into an array, since you wanna register 'em later on

north cairn
boreal iron
#

the var slashCommands is only available inside your readdirsync

#

If you wanna make it accessible outside, define it outside

#

const slashCommands = [];
readdirSync...

boreal iron
lean pike
boreal iron
#

There's no advice

#

It depends on your project, scale, how you implemented it and use it... etc

#

There's generally nothing wrong with using both

lean pike
earnest phoenix
#

Not sure how GraphQL will even be able to help you for that

lean pike
#

The problem in Response. It take maybe 800-3000ms to send responses

earnest phoenix
#

And that's my point

lean pike
#

Do u want to see example for one row

boreal iron
#

A common database query should only take about a few ms

lean pike
boreal iron
#

Is it even necessary for you to use redis?

lean pike
#

I use it

boreal iron
#

Do you cache database results or ...?

lean pike
boreal iron
#

That's quite a lot

#

Guess you're better without using it then

lean pike
#

When the project will be open publish for all it will have a lot of data

#

Because it is SaaS App

boreal iron
#

Hmm I'm missing the experience with redis to help you with it

#

Might just be wrongly configured

lean pike
#

But i will use the redis server after finish the work on it

quartz kindle
#

where is the redis server hosted? in the same vps as your app?

#

and your pgsql, where is it hosted?

lean pike
#

Pgsql hosted by Supabase for testing only

quartz kindle
lean pike
#

All delay come from getting data of all orders

#

In database

quartz kindle
#

how many db queries do you have on each request?

lyric mountain
#

make a PLAN query to see where it's being slow

#

and make sure u have primary keys on all tables

lean pike
#

Do want to see simple CVS file for query

#

Are comes from database 🥲

lyric mountain
#

what?

quartz kindle
#

also, is 800-3000ms what you measure in your code, or is it the browser request time?

lean pike
lyric mountain
#

like, run a plan query, it'll output detailed data of time taken on each step

quartz kindle
#

is 800-3000 what postman says?

lean pike
#

Yep

#

The max number get 2847ms

quartz kindle
#

measure the time inside your code, from request receive to response send

lean pike
#

This is simple example

#

😅

sudden geyser
#

csv notlikenoot

lyric mountain
#

run a plan query, again, as I said

#

sql has tools for finding slow steps, no reason not to use them

lean pike
#

For now I use Prisma ORM with PostgreSQL Provider

#

So I can't use it 😅

lyric mountain
#

...?

#

u cant make raw queries to the database?

lean pike
lyric mountain
#

EXPLAIN SELECT yourqueryhere FROM whatever

boreal iron
#

nobody really understands the Java dude

quartz kindle
#

im convinced the problem is not the query itself

quartz kindle
lean pike
#

3 times KEKW

boreal iron
#

Do you use an IP address as host to your database or domain name?

#

In your code

lean pike
#

First and Second in Auth Middleware and Third in router

#

But it's not take a lot of time in other routes it take maybe 700ms in maximum

quartz kindle
#

it takes a lot of time because the db is hosted in another server

#

so each db request is ~200ms

boreal iron
#

It can take a lot of time when resolving hostnames instead of using an IP

#

Which is a known issue

quartz kindle
#

if the db was hosted on the same server, the requests should be like 1-10ms

lean pike
boreal iron
#

err Wut

quartz kindle
#

then the time you see in postman still has your network delay of your own internet

boreal iron
#

How can it be an external database then when using localhost?

boreal iron
#

Yeah I'm talking about your database

#

Not redis

lean pike
#

Okay

#

Supabase provides a database url

boreal iron
#

So an hostname not an IP

lean pike
#

Yep

boreal iron
#

So the connection to this host might be very slowly then

#

Not your queries

lyric mountain
#

is it a free service btw?

#

because that'd explain it

lean pike
#

It's free service

boreal iron
#

Yeah not much to expect then

lyric mountain
#

definitely a limited bandwidth then

boreal iron
#

The connection is limited then

#

Yeah

lean pike
#

Idk if i will use GraphQL because after 2 or 3 months the orders will be so much

quartz kindle
#

it will not make a difference

#

you need to reduce the distance between your app and your db

boreal iron
#

What u should do is hosting the database yourself

lyric mountain
#

you could try to compress the query results as much as possible, to reduce data size

#

like, remove all but the essential fields

lean pike
lyric mountain
#

well, you could also use a cache layer to reduce database calls as much as possible

lean pike
#

I want to remove a lot of things but every order have a products and more things

#

So i can't delete it

boreal iron
#

If you wanna have a performant database you will have to pay for a server hosting it on

lean pike
#

For example anyuser can buy a 100 different products

#

And that means in order query are 100 product

lyric mountain
#

which will reduce overall slowness

lean pike
#

And every product have Id, image, price and quantity*

quartz kindle
lean pike
#

Hmm

#

This idea in my mind

#

But i don't have a lot of time

lyric mountain
#

it'll ofc come at the cost of memory usage, so you'll need to balance performance x usage

lean pike
#

To do it in this moment

#

Because tomorrow I have English exam KEKW

boreal iron
#

Then go for your exam first

lean pike
#

I study hard for it but I have one subject. I didn't read it. It say write 200-230 words on this topic: "Cigarettes Advertising should be illegal" 😅

lyric mountain
#

aren't they?

sharp geyser
quartz kindle
#

with one query at a time

#

:^)

sharp geyser
#

Yea

#

Better yet

#

Just do one query per column in the entry for every entry

#

This would make things 10x faster

boreal iron
#

Misty added a real life selfi as profile picture

#

Wtf

sharp geyser
boreal iron
valid furnace
#

How much time do you have to wait until voting for a bot again?

boreal iron
#

12h

crystal wigeon
#

Show me

#

Can’t believe Pokemon ending 😭

crystal wigeon
boreal iron
#

Huh

#

Look above man

ancient wedge
lyric mountain
#

always either let or const

ancient wedge
#

whats wrong with var?

lyric mountain
#

var is a relic of the past that's kept on js for the sake of backwards compatibility

#

that variable definition is know to cause many memory leak issues, and it's hoisted

#

which means sometimes it might not hold the value u expect it to

ancient wedge
#

ah didnt know that, used to var from c# lol

lyric mountain
#

I noticed u coded in c#

#

the bracket placements gave it away

ancient wedge
#

it just feels better idk

lyric mountain
#

another thing u can do is save commands[cmd] to a variable

#

so you don't have to access the array 3 times

ancient wedge
#

hmm i'll try it

lyric mountain
#

the last thing would be making a proper command manager

#

like, without resorting to arrays/objects

#

also may I ask, why did u make a bot with js and not c#?

#

it's somewhat a downgrade

ancient wedge
#

its just easier and i didnt have a vps before

#

thinking of converting it to c# over time

eternal osprey
#

hey

#

i have created this sql program

#
 await db.query(sql`ALTER TABLE serverdatabase DROP CONSTRAINT id;
                        UPDATE TABLE serverdatabase
                        SET status = 'enabled', admin = ${interaction.member.id}
                        , date = ${ cDay + "/" + cMonth + "/" + cYear},
                        level = ${level}, unverified = ${unverified_role}',
                        verified = ${verified_role}, pending = ${pending_role},
                        timezone = ${timezone};
                        ALTER TABLE serverdatabase ADD CONSTRAINT id;
                        `)``` however it returns me the error that there's a syntax error near constraint. Why?
tribal crow
#

Hey hey! I'm wanting to replace every letter of a word with _. Example: "Hello" = "_____". How would i do this?

eternal osprey
#

just check the length of the message and use a for loop to create a string containing only _

lyric mountain
eternal osprey
#

done

#

still same tho

ancient wedge
#

you could try regex

ancient wedge
lyric mountain
eternal osprey
#

it is

#

it's just normal sql

#

owh wow

#

sqlite doesn't allow constraints

lyric mountain
#

yep, "normal" sql varies from database to database

#

the language is the same, but not all features might exist

uneven tartan
#

what is that thing

#

u update the reply

#

is it interaction.update

#

or interaction.updateReply

#

or what is it

solemn latch
uneven tartan
#

13.*

#

i think its .editReply but im running into an entirely new issue

solemn latch
#

I've not really done embed editing, you may need to set fields to an empty array?

cursive musk
#
    const img = message.author.displayAvatarURL();
    let level = user.level + 1;
    let flitered = await model.find({}).sort({ xp: -1 }).limit(10);
    let sorted = flitered.map((x) => x.xp).sort((a, b) => b - a);
    let rank = sorted.splice(0, message.guild.memberCount);
    let rankIndex = rank.indexOf(user.xp) + 1;
    const userrank = new canvacord.Rank()
      .setAvatar(img)
      .setCurrentXP(user.xp)
      .setRequiredXP(level * 50)
      .setStatus("online")
      .setLevel(user.level)
      .setRank(rankIndex)
      .setProgressBar("#FFFFFF", "COLOR")
      .setUsername(message.author.username)
      .setDiscriminator(message.author.discriminator);
    userrank.build().then((data) => {
      const attachment = new AttachmentBuilder(data, { name: "RankCard.png" });
      message.reply({ files: [attachment] });
    });

I made a simple rank command, but I'm wondering how I can make it so if I do !rank @mention it will show the mentioned users rank.

solemn latch
uneven tartan
#

no work :(

solemn latch
#

Are embeds editable in the way you're trying to edit them? 🤔

uneven tartan
#

as far as i know yes, it just overwrites the previous content

#

which is why i have to specify an empty array in the components

#

weirdly enough it IS editing it properly, but its erroring for whatever reason

uneven tartan
solemn latch
#

👀 sus logger

uneven tartan
#

its a moderation bot what do u expect

radiant kraken
#

i have very low experience on writing TypeScript typings, so can anyone find an issue with this: ```ts
type DecancerFunction = (rawInput: string) => string;

export default interface Decancer extends DecancerFunction {
contains: (decancered: string, noNoWord: string) => boolean;
}

suppose the library exports:
```js
module.exports = Object.assign((rawInput) => { ... }, {
  contains: (decancered, noNoWord) => { ... }
})

the error (on VSCode): ```
This expression is not callable.
Type 'typeof import("path/to/the/typings")' has no call signatures.

#

cc @earnest phoenix or tim

earnest phoenix
#

hello, so my test script (can be found here: https://github.com/User319183/Cookie-Clicker-Script/blob/main/script.js) works when pasting it into the console, but it doesn't work when pasting it into Tampermonkey. For those that don't know, tampermonkey is a browser extension where you can inject code and it auto-injects itself when your on the respected page

#

After doing some testing, the script and alerts load, but the functions of giving cookies and saving cookies don't load

#

But, the code in that link works when pasting it into the console

#

Lmk if anyone knows why^

plain coral
#

Problem "outdating is this wrong command? but that update that new command. but that's not kick , etc (but removed)

#

how is solution?

north cairn
#

bro what u just said

#

couldn't even understand

#

anyways can u help me out as u also wrking with slash commands

wheat mesa
#

One of your commands is likely missing an execute function

north cairn
#

want see it code to get the error>

#

?*

#

@wheat mesa ?

sharp geyser
#

poor waffle

north cairn
#

now a new error

sharp geyser
#

Well thats not the entire error

north cairn
#

application did not respond

sharp geyser
#

Whats the full error

north cairn
sharp geyser
#

That isn't helpful

north cairn
#

so i made slashcommands,it got registered

#

but when i run the only slash command i have rn

#

it says

#

appilcation did not respond

sharp geyser
#

What is the error in the console

#

That's not the full error

north cairn
#

anything wrong here?

#

no error in console

sharp geyser
#

Thats not what your screenshot from a few seconds ago said

north cairn
wheat mesa
#

Another tip: don't copy paste code that you don't understand

sharp geyser
#

😔

north cairn
sharp geyser
north cairn
#

see what

wheat mesa
north cairn
#

anything wrong in slashcommand handler or interactionCreate file?

sharp geyser
#

Try it and see

north cairn
sharp geyser
#

What

north cairn
#

u trynna say?

sharp geyser
#

You trying to do shit yourself?

#

Im not going to stare at that screenshot looking for issues

north cairn
#
const slashCommand = client.slashCommands.get(interaction.commandName);
    if(!slashCommand) return;
        try {
 await slashCommand.execute(client, interaction) 
           
        } catch(err) {
          if(err) console.log(err)
          await interaction.reply({content: "A Error Occured!", ephemeral: true})
        }
        
   
  })```
sharp geyser
#

Try it and see if it works

north cairn
sharp geyser
#

Then say that

#

and provide errors

#

I can't work based off nothing

north cairn
sharp geyser
#

Idk what it should be

north cairn
sharp geyser
#

Is client.slashCommands a collection?

north cairn
sharp geyser
#

Maybe learn coding

north cairn
sharp geyser
#

yea sure

north cairn
#

now say

#

u helping me or not?

sharp geyser
#

I can't help you with nothing to go off of

north cairn
sharp geyser
#

there could be a dozen things wrong and all you're giving me is it don't work

north cairn
#

gave u ss of files

#

what else u want me to do

sharp geyser
#

Are you sure the cmd exists in the collection?

north cairn
#

ye

sharp geyser
#

Have you actually checked?

north cairn
#

:bruh:

sharp geyser
#

Also have you checked if your command execute body even gets ran?

north cairn
#

it says the error

sharp geyser
#

Yes but that error is literally useless here

#

All it means is that you didn't reply/do something to the interaction

north cairn
#

ok here

north cairn
#

and now it says

#

slashCommand.execute is not a function

sharp geyser
#

because there is no execute function attached to slashCommand variable

#

which means whatever .get returned has no execute func

north cairn
#

oh

#

so what do i do now

earnest phoenix
plain coral
#

Repeat explain: this problem did not work command bar does not appear worked 3 command.

Example add hello and then it appears "/hello" is not there, I don't see how to solve it?

ancient wedge
north cairn
ancient wedge
#

well does your slash command have execute?

north cairn
#

yes

#

only have one command rn

#

ping.js

#

it have

ancient wedge
#

sheesh sorry idk python

north cairn
plain coral
north cairn
#

ping?

#

@ancient wedge ye so now what

ancient wedge
#

lemme see wait

north cairn
#

k

ancient wedge
#

looks alright lol

#

did u write it

north cairn
#

yea the embed thing i wrote

#

rest slash thing i cpied

#

new to /

ancient wedge
#

aha

#

looks like your error comes from reading dir

#

becuase your path is /slashCommands/command.js

#

you read /slashCommands/${dir}/command.js

north cairn
#

hm.

#

so

#

should i

#

remove that

#

dir thng

ancient wedge
#

probably, dir is a file in this case

north cairn
#

ye.

ancient wedge
#

just remove dir and try

north cairn
#

ye ye

#

client.slashCommands = new Discord.Collection()

#

@ancient wedge wow bro..!!