#development

1 messages · Page 1921 of 1

novel hollow
#

Yes

#

And I've been looking it up for help and I still don't understand so I came here

quartz kindle
#

make sure your bots invite link has the applications.commands scope

earnest phoenix
#

Make sure you have the application.commands scope

quartz kindle
#

and reinvite it

earnest phoenix
#

^

#

tim types faster than me

novel hollow
#

ah ok

earnest phoenix
#

smh

#

tim be slower

#

derp

boreal iron
#

Tim doesn't type

#

He has anything in his clipboard

#

Any possible answer

earnest phoenix
#

auto responses

spark flint
#

tim has a streamdeck full of preset keybinds

earnest phoenix
#

doesn't even visit the channel he has a chat bot that does it for em.

earnest phoenix
split hazel
#

tim is a computer

jolly notch
spark flint
split hazel
novel hollow
jolly notch
boreal iron
#

Keep the bot scope as well

jolly notch
split hazel
#

i used to code on a tiny display

earnest phoenix
boreal iron
#

If you don't just use slash commands

quartz kindle
#

im on the phone, i cant even type fast

earnest phoenix
#

mhm sure

jolly notch
boreal iron
earnest phoenix
#

dont lie to us tim

quartz kindle
#

i am lol

earnest phoenix
#

tim you must use all your fingers then

split hazel
#

tim is the among us imposter

quartz kindle
earnest phoenix
#

no way do you type faster than me on a keyboard

#

ah nice photoshop

#

dont worry tim we keep your secret

quartz kindle
#

im typing slow as fuck actually

jolly notch
quartz kindle
#

youre just lagging

earnest phoenix
#

must be connection issues ye

#

damn us wifi

split hazel
#

my pc in a second when i start intellij idea:

earnest phoenix
#

puffin clouds

split hazel
#

that shit is so heavy

boreal iron
#

that's what I call a workplace

feral aspen
quartz kindle
#

too long

feral aspen
#

What's the resolution??

boreal iron
#

12k

quartz kindle
#

10k x 1k

#

lul

boreal iron
#

basically no

earnest phoenix
#

just buy 3 thin 4k monitor

feral aspen
#

Fr.

earnest phoenix
#

why buy monitors

#

just get a tv

feral aspen
#

No dude, a projector.

earnest phoenix
#

yes

#

sounds good to me

boreal iron
#

11520 x 2160p to be correct

earnest phoenix
#

if teachers can do it

#

so can I

feral aspen
#

Fr. lmao

earnest phoenix
#

time to play vAlOrAnT on a projector

feral aspen
boreal iron
#

yeah perfect to work with

earnest phoenix
#

this is where I take my leave

#

as idk what you guys are saying

feral aspen
#

Kinda too much.

#

What graphics card do you have?

boreal iron
#

huh err.. 1080 Ti

feral aspen
#

With 3 moni- bruh.

earnest phoenix
#

actually monitors are really cheap

boreal iron
#

actually they are not

feral aspen
#

They are not honestly.

earnest phoenix
#

but gpu are expensive as ..

feral aspen
#

In Dubai, I barely find any good monitors. lmao

boreal iron
feral aspen
#

C19 and stock prices just going up.

earnest phoenix
#

Even prebuilt pc with rtx 3080 are cheaper

earnest phoenix
feral aspen
#

HUH.

#

Here is like 600 EUROS.

boreal iron
feral aspen
earnest phoenix
#

yes it was the cheapest one,but you can get gd one for 200-250

boreal iron
#

yeah these ones cost ~ 270 bucks

#

affordable

#

If you necessary need an IPS panel or more than 60 Hz for whatever reason it's getting expensive really fast

feral aspen
earnest phoenix
#

but laptop,pc,gpu prices huh,fr they are overrated

feral aspen
#

144hz is really expensive.

quartz kindle
#

ips is a must tho

boreal iron
quartz kindle
#

or oled

#

anything else is crap

feral aspen
earnest phoenix
quartz kindle
#

truck driver :^)

earnest phoenix
#

lol

boreal iron
#

Not since TN panels nowadays got quite good

boreal iron
earnest phoenix
#

Sys admin?

quartz kindle
#

driver for eu politicians

boreal iron
#

lol I've got nothing to do with IT jobs lmao

feral aspen
earnest phoenix
boreal iron
#

just doing whatever I do the last 15y for fun

boreal iron
quartz kindle
#

dayum

#

nice

feral aspen
#

How can Google Certificates benefit me? Eyes

earnest phoenix
#

Get cisco cert like ccna

feral aspen
#

???

boreal iron
quartz kindle
#

lol rip

boreal iron
#

now ended up need to install the shit on a slow SSD

quartz kindle
#

install some boot loader like clover

boreal iron
#

while creating a ZFS RAID1 for the NVME drives to put the VMs on it later on

#

Was thinking about that, too

boreal iron
quartz kindle
#

once the boot loader its done its job, it shouldt be needed anymore

#

all the relevant stuff will sit in ram

earnest phoenix
#

how can I join spaces? like if a player a "Magical Sword", in the code is magicalsword: {... so i want to be "MagicalSword" to make it lowercase

lyric mountain
#

<String>.replace(" ", "")

boreal iron
earnest phoenix
#

and in a if it'll be if(<thing>.includes(" "))?

lyric mountain
#

...why includes?

#

and why an if?

#

just replace regardless of having space or not

earnest phoenix
#

ok

feral aspen
earnest phoenix
#

i know the lowercase

#

but thx anyways

wheat mesa
#

Strings are immutable in js, right

feral aspen
lyric mountain
wheat mesa
#

I know for sure they’re immutable in Java but never tested js

last tapir
#

wdym immutable

lyric mountain
#

cannot have state changes

last tapir
#

meaning?

lyric mountain
#

that it cannot have state changes

last tapir
#

example pls

wheat mesa
#

Ok so, ```js
let mystring = "aaaabbbbb"
mystring.replace("a", "b")
console.log(mystring) // "aaaabbbbb"
mystring = mystring.replace("a", "b")
console.log(mystring) // "bbbbbbbbb"

#

The string methods only return new strings, they dont modify the content of the calling string

last tapir
#

and by not being able to have state changes, it means... ?

last tapir
#

woops didnt see that

#

my bad, thanks!

split hazel
#

pov: you use java

#

pov: you use nodejs
npm install

lyric mountain
#

use gradle pls

split hazel
#

no

last tapir
#

...

feral aspen
wheat mesa
#

Gradle made me instantly stop wanting to use Java, so I did

split hazel
#

pov you use java again

wheat mesa
#

I have not touched Java in a personal project for quite some time now

#

I plan to keep it that way

split hazel
#

i have no fucking clue whats going on lmao

#

how do people use java

wheat mesa
#

Otherwise I would’ve made mc mods

split hazel
#

yay it detected them now

feral aspen
#

pov: you're new to coding

friend.hack.get.password(pls);
split hazel
#

maybe this will work

#

i really have no idea what im doing

#

theres so many buttons

wheat mesa
#

Better idea for what to do with Java:

earnest phoenix
#

nah java isn't bad

split hazel
#

why couldnt they just write minecraft java in c++ originally

#

stupid notch

wheat mesa
#

That’s called bedrock edition

split hazel
#

yeah but no one uses it

wheat mesa
#

C++ probably would’ve made modding for mc way harder than in Java though

split hazel
#

in c++ i wouldve been at the stage of writing the mod by now

#

right now im trying to install the dependencies lmao

wheat mesa
#

Idk

#

Cmake kinda sucks balls

earnest phoenix
split hazel
#

i did

#

noo i have to restart intellij again

earnest phoenix
#

then use mvn install

split hazel
#

intellij starting is like a rocket launching

#

yeah i installed them now

earnest phoenix
#

btw you can use vscode to for java projects

split hazel
#

too late now brother

#

they told me to get a decked out ide

earnest phoenix
#

decked out ide?

wheat mesa
#

Intellij idea

novel hollow
#

@frozen mesa thanks

frozen mesa
#

wat

#

huh???

feral aspen
#

Ahh, look at that.

#

Old times. lmao

#

I can already feel the pain I used to go through when I was new to coding.

#

Banning a user with make.user.banned; AAAAA

#

Using JSON databases, not getting the developer badge after August 20 or 21, I really don't know, just Discord 2020, and you know what's better? 2021. lmao

#

I can't wait for 2022, input message components (fr feature), what else, verified badge? User verified badge? YouTuber badge? Banned badge?

wheat mesa
#

It’s going to be 2020 Two soon

feral aspen
wheat mesa
#

2020 was alpha, 2020 One was beta, 2020 Two is release

jovial imp
#

I coded this last night

#

thoughts?

#

and it stores a different id for different servers so if you set the id to 1234 in server a it wont change server b's 4321 :)

solemn latch
#

so, its a vote tracker for servers?

jovial imp
#

Yea kinda

spark flint
#

it doesn't seem like a vote tracker

#

just something that says the vote link

jovial imp
#

You can set a link and you click the button to vote for the server

#

I couldn't figure out how to track the amount of votes sadly

earnest phoenix
#

Vote webhook

solemn latch
#

why not just get the id of the server from the guild the command was run in?

#

no configuration that way

jovial imp
#

I thought abt that too

#

wait

#

I could set that to the default

#

and you can config if you want

#

So before you use the update cmd it's the server's id that your in

#

finished

#

it

solemn latch
#

now do the webhook stuff ^_^

jovial imp
#

yea

#

i will do that

#

:()

jovial nexus
#

what is the function for closing an stage channel in djs?

slow terrace
#
        let logs = [];
        setInterval(async () => {
        let webhook = webhooks.filter((w)=>w.type === "Incoming" && w.token).first();
        if(!webhook){
          webhook = await Channel.createWebhook(botname, {avatar: client.user.displayAvatarURL({ format: 'png', dynamic: true, size: 128 })})
        } else if(webhooks.size <= 10) {
//
        }
        webhook.send({ embeds: logs.slice(0, 10).map(log => DeletedLog) })
        logs = logs.slice(10)
    }, 5000);
E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\rest\RequestHandler.js:298
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Cannot send an empty message
    at RequestHandler.execute (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
woeful pike
#

you never assign logs to anything

#

also collection.filter(...).first() = collection.find(...)

fresh bluff
#

Hey guys whats the code to add a discord button to a message i forgot?

lament rock
#

components

fresh bluff
spark flint
wheat mesa
#

No

#

No no no

#

@spark flint please don’t encourage djs components angeryBOYE

spark flint
#

ok

fresh bluff
#

What why?

wheat mesa
#

You don’t need a third party package to make buttons and stuff easily

#

You can use the component builders djs offers if you really want to

#

But third party packages are generally not a good idea since you’re relying on someone else’s code to stay updated constantly

fresh bluff
#

how do i do that?

wheat mesa
fresh bluff
#

Thanks @wheat mesa Not the First time you've helped me

wheat mesa
#

Gl 🙂

fresh bluff
#

@wheat mesa

#

HELP

wheat mesa
#

What’s your code

fresh bluff
#

client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    if (interaction.commandName === 'ping') {
        const row = new MessageActionRow()
            .addComponents(
                // ...
            );

        const embed = new MessageEmbed()
            .setColor('#0099ff')
            .setTitle('Some title')
            .setURL('https://discord.js.org')
            .setDescription('Some description here');

        await interaction.reply({ content: 'Pong!', ephemeral: true, embeds: [embed], components: [row] });
    }
}); ```
#

there @wheat mesa

wheat mesa
#

You didn’t define client

fresh bluff
#

maybe this is the issue?

fresh bluff
wheat mesa
#

You have to make a discord client variable called client

fresh bluff
#

How?

wheat mesa
#

Perhaps you should follow the djs guide from the beginning to get started, it’ll be a lot easier that way

fresh bluff
#

I am

wheat mesa
fresh bluff
wheat mesa
#

You should try learning some javascript if you’re not sure how to set up a variable, it’ll be very difficult if you don’t know how to do that :p

fresh bluff
#

@wheat mesa ima go on stackflow

#

@wheat mesa i put var and it still does not work

wheat mesa
#

You need to instantiate a discord client for that to work

fresh bluff
#

I am but im confused

wheat mesa
#

Show your code

fresh bluff
#

@wheat mesa

#

@wheat mesa whats the issue?

#

@wheat mesa Help me quickly i gtg soon please

wheat mesa
#

You need to either put this code in your index.js file or you need to set up an event handler similar to the way you set up a command handler

#

I highly recommend not copy pasting code in the future though

fresh bluff
#

where in the index top or bottem?

#

@wheat mesa

wheat mesa
#

Bottom probably

fresh bluff
#

OMG @wheat mesa IT WORKED

wheat mesa
#

In the future I recommend you should take a moment to understand the code rather than just copy pasting it into a cloned GitHub repo (I assume that’s what it is)

fresh bluff
wheat mesa
#

You should learn javascript a little

#

Because a discord bot of that size can be a complex program

#

And it’ll be basically impossible to understand unless you know js

#

Update node

sterile lantern
#

It does, you need to use Nix

#

A different type of project (not node js)

wheat mesa
#

Then don’t use replit

#

:p

solemn latch
#

Has replit started blocking uptime robot stuff yet?

wheat mesa
#

Nope

#

Afaik

solemn latch
#

I still think eveventually they will

spark flint
#

i don't wanna blatently ping another mod lmao

earnest phoenix
#

Error: TypeError: Cannot read properties of undefined (reading 'includes')

const { authorized_access } = require("../bypass.json")


  let user = message.mentions.users.first();
  if(!user === authorized_access.includes(message.author.id)) return;  message.channel.send(`You may not Ad Warn Administrators.`) 
    ```

Probably a simple fix but I am super confused.
spark flint
earnest phoenix
#

But it is defined tho-

#

can anybody help me?

#

<script>
      window.onload = () => {
            const url = window.location.href;

            const accessToken = url.slice(43);

            console.log(accessToken)

        if (!accessToken) {
            return document.getElementById('login').style.display = 'block';
        }

        fetch('https://discord.com/api/users/@me', {
            headers: {
                authorization: `Bearer ${accessToken}`,
            },
        })
            .then(result => result.json())
            .then(response => {
                const { username, discriminator } = response;
                document.getElementById('info').innerText = ` ${username}#${discriminator}`;
            })
            .catch(console.error);
    };

    </script>

I'm getting the error: GET https://discord.com/api/users/@me 401
I'm kind of a beginner in these things
I've tried everything and nothing

spark flint
#

js in html?

earnest phoenix
#

you're right 😐

#

Okay so I fixed mine but, now it still proceeds with the code below it.

 let user = message.mentions.users.first();
    if(!user === ["694367588464984095", "772609860100423700"]) return; {  message.channel.send(`You may not Ad Warn Administrators.`) }
#

How do I make it so it stops after It sends that message?

earnest phoenix
earnest phoenix
#

:c

#

I count 8 lol

#

oof

earnest phoenix
#

What you are essentially doing is if the if statement returns true you are just returning the code and not letting anything after the return run

#

You'd most likely wanna move return inside the brackets before the message.channel.send

#
let user = message.mentions.users.first();
if(!user === ["694367588464984095", "772609860100423700"]) {  return message.channel.send(`You may not Ad Warn Administrators.`) }
#

also your if statement is wrong

#

You can't compare a string to an array of strings, you wanna see if the array includes the user

#

Here's documentation on what would be the best method to use for checking if the string given exists in the array

#

Ohhh

#

Makes sense

hybrid cargo
#

user returns a user object, and comparing it to a array is always gonna return false

earnest phoenix
#

Will try rn ty

#

It works, yo your fr amazing, tysm @carmine topaz !

#

and to all of you who helped!

#

Life saver my man 💯

earnest phoenix
#

Does replit not support node 16?

#

Nvm, go it 🎉

#

Wait no, it still says 'node:events'

#

@earnest phoenix May I borrow your expertise one more time good sir/ma'am/or neither PI_Shrug 🤣?

#

of?

#

Thats the error I get

#

all im trying to do is run the bot

#

Of which file?

#
const Discord = require("discord.js");
const db = require('quick.db')
const { Client, Intents } = require('discord.js');

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const http = require("http");
const express = require("express");
const app = express();
const fs = require("graceful-fs");
const config = require("./config.json");

/*
 app.get("/", (request, response) => {
  console.log(Date.now() + " Ping Received");
  response.sendStatus(200);
});
*/

var server = require("http").createServer(app);
const listener = server.listen(process.env.PORT, function() {
  console.log("Your app is listening on port " + listener.address().port);
});

client.on("ready", async () => {
  client.user.setActivity(`Noah AH Utilities`, {
    type: "WATCHING"
  });
  console.log(`logged in as ${client.user.tag}`);
});

client.commands = new Discord.Collection();

const commandFiles = fs
  .readdirSync("./commands")
  .filter(file => file.endsWith(".js"));

for (const file of commandFiles) {
  const command = require(`./commands/${file}`);
  client.commands.set(command.name, command);
}

const cooldowns = new Discord.Collection();


    
  if (message.content.indexOf(prefix) !== 0) return;
  
  const args = message.content.slice(prefix.length).split(/ +/);
  const commandName = args.shift().toLowerCase();

  const command =
    client.commands.get(commandName) ||
    client.commands.find(
      cmd => cmd.aliases && cmd.aliases.includes(commandName)
    );

  if (!command) return;

  if (command.guildOnly && message.channel.type !== "text") {
    return message.reply("I can't execute that command inside DMs!");
  }

  if (command.admin && !config.administrators.includes(message.author.id)) {
    return message.reply("You must be an administrator to run this command!");
  }
  if (command.args && !args.length) {
    let reply = `You didn't provide any arguments, ${message.author}!`;

    if (command.usage) {
      reply += `\nThe proper usage would be: \`${prefix}${command.name} ${command.usage}\``;
    }

    return message.channel.send(reply);
  }
  try {
    command.execute(message, args, client);
  } catch (error) {
    console.error(error);
    message.reply("there was an error trying to execute that command!");
  }
});


client.login(config.token);```
#

There ye go

#

How would my main file affect my bot starting tho?

#

It started in Glitch and VSC just how it is.

#

Replit keeps saying 'node:events'

#

Glitch yeah

#

VSC haven't tried

#

Fixed, holy moley there were so many problems

#

It was one after another

#

Finally got it on djs v13 tho

#

Replit makes stuff so confusing frfr lol

#

nice

hybrid cargo
earnest phoenix
#

its fixed

#

ig

#

Its fixed already.

hybrid cargo
#

Oh nvm

#

xD

earnest phoenix
#

🤣 your good lol

#

were late

#

af

hybrid cargo
# earnest phoenix af

lol, i pressed esc but discord for some reason said that this was the latest message and did not refresh the channel

earnest phoenix
#

lol

#

lmao

#

Discord buggin frfr 🤣

earnest phoenix
#

alr back again

#

So did Discord.js v13 change literally everything then?

earnest phoenix
#

Did that

#

Now I get that

#
if(member.permissions.has(Permissions.FLAGS.BAN_MEMBERS))

          const embed = new Discord.MessageEmbed()```
#

Works ty

#

Wait no

#

Now its saying that even if the user has Ban Perms

earnest phoenix
#

Also, how come my slash commands show they are working, but they don't actually work?

earnest phoenix
#

Okay, literally disregard all of that^^ I figured out reality. 🤣

tepid crane
#

I want to keep my bot playing music 24/7 , I've eliminated clear players and queue end , player destroyer. It still disconnect vc

#

Yup I'm hosting it in gcp

#

I didn't check it. Can it be related to lavalink server? I'm hosting? Do we need to setup lavalink server differently for 24/7 music?

earnest phoenix
#

I was reposting to show him a fix to his first issue

#

then told him how to fix the bigger issue

hybrid cargo
#

dead nvm lol mb

earnest phoenix
#

yea

#

I was just not trying to give him the full code since its better for them to learn how to read docs

#

:p

tepid crane
#

@earnest phoenix do you know anything about my problem?

earnest phoenix
#

What exactly is your issue?

real locust
#

Hello

#

Can i ask a question

earnest phoenix
#

Don't ask to ask

#

just ask your question

real locust
earnest phoenix
#

#support is probably a better channel for that

lament rock
#

debugging nodejs worker_threads suck :(

feral aspen
#
module.exports.run = {
    capitalise: function(value) {
        return value.charAt(0).toUpperCase() + value.slice(1);
    },
};
const { capitalise } = require("../../functions/functions.js");
#

Did I do something wrong when requiring the function?

earnest phoenix
#

Is that even how that works?

feral aspen
earnest phoenix
#

Actually thinking about it I think that should work 🤔

feral aspen
#

TypeError: capitalise is not a function.

earnest phoenix
#

How are you using capitalise

feral aspen
#

It takes one argument. Eyes

#

Shall I do it the hard way by defining a class.

earnest phoenix
#

Ehhhh

#

I am just curious why you are doing it like module.exports.run

pale vessel
earnest phoenix
#

can't you just do

module.exports = {
  capitalise: function() {}
}
#

dang it flaze

#

;c

feral aspen
#

Oh, let me try that, my bad.

earnest phoenix
#

flaze too fast

feral aspen
#

I was going to do it like this.

module.exports = class Capitalise {
    constructor (value) {
        this.value = value;
    };

    capitalise() {
        
    }
}
pale vessel
#

static capitalise() {}

feral aspen
#

Also, off-topic, how do you do it like this, just for curiosity.

#

For this part, basically. return value.charAt(0).toUpperCase() + value.slice(1);

#

Is it this.charAt( or this.value.charAt( or value.charAt(.

pale vessel
#

If you need to set values then you need to instantiate the class

#

Otherwise a static method will do

pale vessel
feral aspen
#

👍

#

Anyways, using the old method.

#

Thanks. Happy_pepe

#

Any NPM that gives like a 6 - 20 random character code or something?

#

Bruh.

#

I kinda have it planned on my mind, let me try.

#

Is this good?

#

Kinda long. lmao

wheat mesa
#

this is basically the regex required to match 1 character

feral aspen
wheat mesa
#

also if you're trying to use this to generate something like keys/anything that needs to be secure, just use a package for it

feral aspen
#

random() do be looking cool.

earnest phoenix
#

module.exports.run

#
const { run } = require("the function.js");
const { capitalize } = run;
feral aspen
#

???

pale vessel
#

const { run: { capitalise } } = require("the function.js");

feral aspen
#

Oh, that works, too.

#

Now that I think about it, it would work.

earnest phoenix
# feral aspen ???

according to javascript, the file exports an object called run with the property capitalise instead of directly exporting the function

#

remove .run

feral aspen
#

I see.

earnest phoenix
#

I eat

willow mirage
#

why on the GuildMemberAdd I use await member.guild.invites.fetch() but the invite doesn't update

feral aspen
#

await?

#

await message.guild...

#

You wait for the for each function to end, probably.

cinder patio
#

Use a for loop instead of forEach

earnest phoenix
#

mmm sql queries I hate doing em.

#

Eh yes

#

But it can be annoying as well

feral aspen
#

It was fun while it lasted.

#

Is there such things called message dm collectors?

#

A user performs a command, the bot sends a dm to the user waiting for a message to be sent, the user sends a message and that bot reads it and uses it to do something.

hybrid cargo
#

.forEach is always synchronous, even if u specify async

quartz kindle
#

use await instead of .then

woeful pike
#

you probably want to do

SELECT * FROM guild WHERE id = ANY($1);
const guilds = await db.get(query, guildIdsArray)
#

or the sqlite version of that query i guess

quartz kindle
#

not exactly that is synchronous, ifyou do async, then its async. the problem is that forEach takes a callback function for each iteration in a "fire and forget" way, so even if you await inside it, the other iterations are still executed concurrently as they are in separate callback functions

earnest phoenix
#

can someone give me a vote notification template? I have a functional vote command but i want that when voted, the person will not have to use the vote command again, instead the bot will give the reward to him and send a DM

#

ik that it goes in message.js and that but idk how to make it

solemn latch
eternal osprey
#
 Error:
0|index  | Something went wrong installing the "sharp" module
0|index  | Cannot find module '../build/Release/sharp-linux-x64.node'
0|index  | Require stack:
0|index  | - /root/kpop-v1/node_modules/sharp/lib/sharp.js
0|index  | - /root/kpop-v1/node_modules/sharp/lib/constructor.js
0|index  | - /root/kpop-v1/node_modules/sharp/lib/index.js
0|index  | - /root/kpop-v1/node_modules/join-images/lib/main.js
0|index  | Possible solutions:
0|index  | - Install with the --verbose flag and look for errors: "npm install --ignore-scripts=false --verbose sharp"
0|index  | - Install for the current runtime: "npm install --platform=linux --arch=x64 sharp"
0|index  | - Consult the installation documentation: https://sharp.pixelplumbing.com/install
0|index  |     at Object.<anonymous> (/root/kpop-v1/node_modules/sharp/lib/sharp.js:30:9)
0|index  |     at Module._compile (node:internal/modules/cjs/loader:1101:14)
0|index  |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
0|index  |     at Module.load (node:internal/modules/cjs/loader:981:32)
0|index  |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
0|index  |     at Module.require (node:internal/modules/cjs/loader:1005:19)
0|index  |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
0|index  |     at require (node:internal/modules/cjs/helpers:102:18)
0|index  |     at Object.<anonymous> (/root/kpop-v1/node_modules/sharp/lib/constructor.js:8:1)
0|index  |     at Module._compile (node:internal/modules/cjs/loader:1101:14)
``` how would i fix this?
woeful pike
#

you either didn't install sharp or you built it on a computer with a different architecture than the one you're running it on

eternal osprey
#

thanks for the advice tho!

stiff lynx
#

How can I see the memory usage in a command?

quartz kindle
#

process.memoryUsage()

#

assuming node.js

stiff lynx
earnest phoenix
#

Anyone know what this is? discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In 0: Invalid application command id provided

#

use .rss thats more accurat

stiff lynx
earnest phoenix
#

yes

stiff lynx
earnest phoenix
#

Yes

stiff lynx
#

discord on mobile, is trash, change my mind

stiff lynx
earnest phoenix
#

I'm not sure what code this part even is though

#

or is this even a code problem

pale vessel
#

Yes it is

#

Check your command schema

#

Or actually, it could be from where you're posting commands

earnest phoenix
#

Ah, okay

stiff lynx
#

you r passing an invalid form body

#

as you can read

pale vessel
#

Don't assume that they could read

stiff lynx
quartz kindle
#

Invalid application command id provided

feral aspen
#

For every collector that is used to collect one thing, should I always use collector.on("collect"...

#

For example, when you press a button, you only use collector.on('end', while for dropdown, you use collect and end.

#

Should I be using collect in buttons even though it's one time?

earnest phoenix
#

its optional, you can just change the button timeout to anything you want. But if you clicked the button then you will get no output since the timeout is done

#

you can use collector.on('end', for editing the response if your button's timeout is done

#

while collector.on('collect', is used to trigger the upcoming response for the button

#

and its required. Discord will return "This interaction failed" because the main button collector is missing

small tangle
#
@Override
    public void execute(SlashCommandEvent event) {
        final Guild guild = event.getGuild();
        if (guild == null) {
            event.reply(REDCROSS + " You need to execute this command in a guild!")
                 .setEphemeral(true)
                 .queue();
            return;
        }

        slashCmdMan.getCommands().forEach(cmd -> {
            final CommandData cmdData = cmd.getCommandData();
            if (DEV_COMMANDS.contains(cmdData.getName())) {
                guild.upsertCommand(cmdData).queue();
            } else {
                event.getJDA().upsertCommand(cmdData).queue();
            }
        });

        guild.retrieveCommands()
             .queue(commands -> {
                 commands.forEach(cmd -> {
                     cmd.updatePrivileges(guild, CommandPrivilege.enableUser(Env.get("DEV_ID"))).queue();
                 });
             });

        final MessageFormat formatter = new MessageFormat(Resources.getPattern("update"));
        event.reply(formatter.format(new Object())).queue();
    }

so this command refreshes all slashcommands of my bot, but it feels quite redundant, because first im upserting all commands but then need to iterate through the guild commands to update the restrictions (because the dev commands are disabled) to enable my user id to use them. is there a better way to achieve that?

earnest phoenix
#

tf

#
 \`${client.users.cache.get(money[i].ID.split('_')[1]) ? client.users.cache.get(money[i].ID.split('_')[1]).tag ? client.users.cache.get(money[i].ID.split('_')[1]).username ? client.users.fetch(money[i].ID.split('_')[1]).tag : "Unknown User#0000"}\`
#

it says } is unexpected

#

but it's not

#
  for (var i in money) {
            if (money[i].data === null) money[i].data = 0
            finalLb += `**${money.indexOf(money[i]) + 1}.** \`${client.users.cache.get(money[i].ID.split('_')[1]) ? client.users.cache.get(money[i].ID.split('_')[1]).tag ? client.users.cache.get(money[i].ID.split('_')[1]).username ? client.users.fetch(money[i].ID.split('_')[1]).tag : "Unknown User#0000"}\` - ❂ ${money[i].data}\n`;
        };
``` this is the full part
woeful pike
#

homie have you heard of variables

earnest phoenix
#

yes

#

it worked before but now it's not

woeful pike
#

please break this down into separate variables, I can't even understand what's going on here

#

you have an entire function embedded inside a template literal with a triply nested ternary statement

earnest phoenix
#

ok

woeful pike
#

you're missing the else branch for the 2 other ternaries

#

but like you should never ever have a triply nested ternary

#

also money.indexOf(money[i]) + 1 is just i + 1

#

make a function that maps a row in your moneys array into a line in the message you're going to send

woeful pike
#

and the rest is just

const lines = money.map(createLine)
sendMessage(lines.join("\n"))
#

just make a function and call it

#

you don't have to use stuff like map if you're not familiar with it, but definitely use functions to break your problems down into smaller sub-problems. That's like the entire point of programming

earnest phoenix
#

ok (?)

lyric mountain
#

And don't use var

split hazel
#

the middle bottom is true

woeful pike
#

I don't get the python one

#

do they think floating point arithmetic is only broken in javascript?

tulip ledge
#

can anyone explain to me why the images are overlapping below?

#

they're in a grid

green kestrel
#

I think it's an artifact of how js implicitly converts types

#

seen PHP do it but not usually on such trivial things, you usually need to divide

woeful pike
# green kestrel

isn't this because C++'s default precision just truncates numbers?

green kestrel
#

possibly

woeful pike
#

it's not a JS artifact, it's an inevitable fact of how computers do floating points

green kestrel
#

I think you may need to use double not float, like js does,.to duplicate it every time

#

3.00000000000000004 can't be represented in 32 bit float can it?

#

with no loss of accuracy

woeful pike
#

oh that could be it

#
#include <iomanip>
#include <iostream>

int main() {
  std::cout << std::setprecision(17) << 0.1 + 0.2;
}

seems like it is a truncation thing

green kestrel
#

yeah, I'm pretty sure you can't represent it in float anyway

#

if you tried to store 3.0111111111111111111111 or something it would probably display it as ending in 111115

wheat mesa
#

not enough bits to store it at 100% accuracy

quartz kindle
soft surge
#

just upgraded to discord js v13 and got this error

#
  if (!msg) throw new Error(`An invalid error message key was used: ${key}.`);
                  ^

Error: An invalid error message key was used: Error when sending fetchProp response to master process: Cannot read properties of undefined (reading 'replace').
    at message (C:\Users\KrAzZ\Documents\GitHub\Rose\Rose\node_modules\discord.js\src\errors\DJSError.js:40:19)
    at new DiscordjsError (C:\Users\KrAzZ\Documents\GitHub\Rose\Rose\node_modules\discord.js\src\errors\DJSError.js:16:13)
    at C:\Users\KrAzZ\Documents\GitHub\Rose\Rose\node_modules\discord.js\src\sharding\ShardClientUtil.js:199:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5)```
#

not sure if its my shards or something else

quartz kindle
#

do you have .replace in broadcastEval or something?

lyric mountain
#

Major updates usually require entire codebase refactoring

soft surge
#

Found the issue. Apparently my statuses were outdated

earnest phoenix
#

find the problem

<script src="https://cdn.jsdeliver.net/npm/bulma@0.9.1/css/bulma.min.css"></script>
spark flint
#

Lmao script

earnest phoenix
wheat mesa
#

Anyone know how to simulate a guildCreate event? Trying to test it out and reinviting over and over would be annoying

earnest phoenix
#

AYO C# HAS A DECIMAL TYPE?

earnest phoenix
wheat mesa
#

c# is based

wheat mesa
#

Yeah doesn't seem to work. For some reason it's not receiving the guild correctly so payload.guild is undefined

#

Lemme debug some more

earnest phoenix
#

you using djs or detritus

wheat mesa
#

detritus

#

you know I would never go back to djs

earnest phoenix
#

I think you should pass the guild as { guild: someGuild }

lyric mountain
#

You start as a whole
Then you become detritus

earnest phoenix
#

as the error says no payload.guild

wheat mesa
#

Yup, worked

#

I forgot the new docs existed

earnest phoenix
#

i forgot the old docs existed

wheat mesa
#

I need to write a surface-level github tutorial for handling command arguments in detritus

earnest phoenix
#

On replit, how would I make it so it does not shut down my whole bot whenever it runs into a error, rather than it just telling me the error in a channel?

earnest phoenix
#

I did, but it always does "exit status 1" and shuts the bot down.

quartz kindle
#

then you're not catching it properly

lyric mountain
#

Do what you must but dont ever think about using a global exception ignorer

#

That is, unless you enjoy being blind af

cinder patio
earnest phoenix
earnest phoenix
lyric mountain
#

I mean, using a catch-all is fine if you want to centralize error handling

#

just don't mute exceptions

cinder patio
#

use it but there aren't docs for the beta branch

earnest phoenix
#

who doesn't like to use beta version on production

tribal crow
#

Hey! How would i send a message to a specific channel in a specific guild? I've tried client.guilds.cache.get("id"), but i get an error saying TypeError: Cannot read properties of undefined (reading 'guilds'). Any help is appreciated :)

lyric mountain
#

nothing is guaranteed to be cached at any given time

#

use fetch

earnest phoenix
#

cannot read properties of undefined

tribal crow
#

The problem lies at .guilds tho?

earnest phoenix
#

client is undefined

#

are you running this in a command

dense lark
#

how will i find the members count of a server with its ID?

hasty lotus
#

Hi! Just a little question. Is there any way to know when a membre has accepted server rules (the discord rule thing with the community feature) ? I haven't found anything on the documentation about it, but my issue is that my bot currently gives new members a role automatically on join, which triggers discord to automatically makes them valide the rules :/

wheat mesa
wheat mesa
#

oh my outdated package I forgot to update detritus

hasty lotus
#

hm sad

tribal crow
earnest phoenix
hasty lotus
#

yeah i saw that thank very much :p

quartz kindle
#

define it

#

if you dont know what that means, show your code

tribal crow
quartz kindle
#

interaction.client.guilds....

tribal crow
#

ooooh

#

tysm

earnest phoenix
#

(node:4529) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'low' of undefined

earnest phoenix
quartz kindle
#

you want me to find the problem in a 1k line file with no stack trace?

#

lol

misty sigil
#

very useful

quartz kindle
#

at least show the full error so we can see the stack trace

#

you have 54 instances of .low in your code, the problem could be any one of them

wheat mesa
#

wtf is that

#

lmao

#

someone show this man loops

earnest phoenix
# quartz kindle you have 54 instances of `.low` in your code, the problem could be any one of th...
(node:4529) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'low' of undefined
    at Object.run (/home/runner/Clash-Chest/commands/box opening/open.js:500:13)
    at Client.<anonymous> (/home/runner/Clash-Chest/index.js:106:23)
    at Client.emit (events.js:314:20)
    at Client.EventEmitter.emit (domain.js:483:12)
    at MessageCreateAction.handle (/home/runner/Clash-Chest/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/runner/Clash-Chest/node_modules/ws/lib/event-target.js:132:16)
(node:4529) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
``` everytime it's different line but the error is in that lines `.low`s
#

why it's undefined? all is correct like I have Goblins and in the chh array is goblins and i did chh[<myObtainedThing>.toLowerCase()]

lyric mountain
#

show line 500 from open.js

earnest phoenix
#

it's the same thing again and again to evade the undefined but it still appears

#

so i'll delete that

#
const config = require("../config.json");
const Discord = require("discord.js");
const db = require('quick.db')
const { version } = require("discord.js");
const moment = require("moment");
const m = require("moment-duration-format");
let os = require('os')
let cpuStat = require("cpu-stat")

const ms = require("ms")
https://freeimage.host/i/BHP0JV
module.exports = {
  name: "emergency", // Command Name
  description: "List all of my commands/info about a specific command.", // Description
  aliases: ["h"], // Aliases
  usage: " ", // Usage
  guildOnly: false, // If Command In DMs return
  admin: false, // Bot Admin only
  async execute(message, args, client) {    
      let prefix = config.prefix

// const args = message.content.trim().split(/ +/g);
  const cmd = args[0].slice(prefix.length).toLowerCase(); // case INsensitive, without prefix

if(cmd == 'example'){
  if(args[0] == '1'){
  console.log('1');
 } else {
  console.log('2');
  
  }
}
}
}

Tge "example" command does not show, I just started using djs v13 and with all of my commands, as soon as I fix the errors, the command doesn't run properly, it will ask "You must mention the user" or "Give a reason" but won't do the ban or anything.

#

No errors, just is there something wrong with my code^?

earnest phoenix
#
(node:4662) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'low' of undefined
    at Object.run (/home/runner/Clash-Chest/commands/box opening/open.js:585:23)
    at Client.<anonymous> (/home/runner/Clash-Chest/index.js:106:23)
    at Client.emit (events.js:314:20)
    at Client.EventEmitter.emit (domain.js:483:12)
    at MessageCreateAction.handle (/home/runner/Clash-Chest/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/runner/Clash-Chest/node_modules/ws/lib/event-target.js:132:16)
(node:4662) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4662) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

line 585 ```js
let blaror4 = card4.low;

#

the name is random but the error is the .low

lyric mountain
#

show where you define card4

#

also, please use descriptive variables

#

tf is blaror4?

earnest phoenix
lyric mountain
#

...but isn't that code yours?

earnest phoenix
#

yes

#

i just put names randomly sometimes

earnest phoenix
#

t/Client.js:544
throw new TypeError('CLIENT_MISSING_INTENTS');
^

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.

#

what's this

lyric mountain
#

we didn't even solve the previous error and you're already asking abt another one

earnest phoenix
#

let card4 = chh[comban4.toLowerCase()] || Object.values(chh)[comban4.toLowerCase()];

#

let comban4 = array4[Math.floor(Math.random() * array4.length)];

#

let array4 = [...array1, ...array2, ...array3, ...array5, ...array6];

#

let array1 = db.get(common_${message.author.id});
let array2 = db.get(rare_${message.author.id});
let array3 = db.get(epic_${message.author.id});
let array5 = db.get(leg_${message.author.id});
let array6 = db.get(champ_${message.author.id});

lyric mountain
#

tf

earnest phoenix
#
let chh = {
archers: { name: "Archers", rarity: "Common", low: "archers" }
....
....
}
lyric mountain
#

why is array4 the sum of all arrays?

#

why are them named like that?

#

why are you making 5 database requests?

#

aaaaaaaaaaaaaaaaaaaaaaaaa

earnest phoenix
#

wait i'll respond 1 by 1

earnest phoenix
earnest phoenix
earnest phoenix
quartz kindle
#

the problem is not low

#

the problem is what is before it

#

card.low === undefined will never work, because card is undefined

earnest phoenix
quartz kindle
#

and trying to read .low of undefined, causes that error

#

so you're reading the error wrong and trying to fix it the wrong way

earnest phoenix
#

ok

#

but the error is same

blazing umbra
#

After bot verified how to transfer ownership to team

quartz kindle
#

because you didnt fix it

earnest phoenix
#

i deleted all that

blazing umbra
#

I am getting error

#

Anybody can help me

soft surge
#

Sending the error would be perfect

quartz kindle
earnest phoenix
#

now the error is like this

#
/home/runner/Clash-Chest/commands/box opening/open.js:582
        let blaror0 = card0.low;
                            ^

TypeError: Cannot read properties of undefined (reading 'low')
quartz kindle
#

same thing

#

card0 is undefined

#

where did you define card0?

earnest phoenix
#

i changed node version, it changed for that?

blazing umbra
quartz kindle
#

yes they changed the description of the error to try to make people understand that the problem is always the thing before

earnest phoenix
#
        let card =
            chh[comban.toLowerCase()] ||
            Object.values(chh)[comban.toLowerCase()];
        let card0 =
            chh[combanO.toLowerCase()] ||
            Object.values(chh)[combanO.toLowerCase()];
        let card2 =
            chh[comban2.toLowerCase()] ||
            Object.values(chh)[comban2.toLowerCase()];
        let card3 =
            chh[comban3.toLowerCase()] ||
            Object.values(chh)[comban3.toLowerCase()];
        let card4 =
            chh[comban4.toLowerCase()] ||
            Object.values(chh)[comban4.toLowerCase()];
        let card5 =
            chh[comban5.toLowerCase()] ||
            Object.values(chh)[comban5.toLowerCase()];
soft surge
quartz kindle
#

let card0 = chh[combanO.toLowerCase()] || Object.values(chh)[combanO.toLowerCase()];
this is undefined

blazing umbra
soft surge
#

¯_(ツ)_/¯

earnest phoenix
#

but how is undefined

#

if all is correct

quartz kindle
#

you are likely trying to get an invalid value out of chh

#

console.log(chh, comban0)

earnest phoenix
#

chh is the thing that you said me 2 months ago

quartz kindle
#

console.log it

earnest phoenix
#
let chh = {
archers: { name: "Archers", rarity: "Common", low: "archers" }
....
....
}
``` this
soft surge
#

So i made an event handler correct

#

but for the messageCreate event, no commands are being picked up

#

code: ```onst prefix = ["rose "];
const client = require('../app');

client.on('messageCreate', async message => {
const args = message.content.slice(prefix.length).trim().split(/ +/);
if (!message.guild) return;
if (message.author.bot) return;
const cmd = args[1]
const command = client.commands.get(cmd)
if (command) {
command.execute(
client,
message,
args
);
} else {
message.channel.send("That isn't a command!")
}
})```

earnest phoenix
#

it's too large are you sure, tim?

soft surge
#

dont worry about the top

quartz kindle
#

console.log comban0

soft surge
#

idk why the c isnt there

quartz kindle
#

also, your prefix is wrong

soft surge
#

my prefix is separate

quartz kindle
#

the length of ["rose "] is 1, not 5

soft surge
#

the command would be: rose avatar

#

or something

quartz kindle
#

message.content.slice(prefix.length) makes it become ose avatar not avatar

earnest phoenix
#
/home/runner/Clash-Chest/commands/box opening/open.js:587
        let blaror0 = card0.low;
                            ^

TypeError: Cannot read properties of undefined (reading 'low')
    at Object.run (/home/runner/Clash-Chest/commands/box opening/open.js:587:23)
    at Client.<anonymous> (/home/runner/Clash-Chest/index.js:106:23)
    at Client.emit (node:events:390:28)
    at MessageCreateAction.handle (/home/runner/Clash-Chest/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/runner/Clash-Chest/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/runner/Clash-Chest/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (node:events:390:28)
exit status 1

combanO = Barbarians

#

barbarians in chh

quartz kindle
#

console.log(chh.barbarians, chh[comban0.toLowerCase()])

earnest phoenix
#

ok

#
{ name: 'Barbarians', rarity: 'Common', low: 'barbs' } { name: 'Barbarians', rarity: 'Common', low: 'barbs' }
#

this time the error from card0 is in card

quartz kindle
#

where is comban0 defined?

earnest phoenix
#
let combanO = array4[Math.floor(Math.random() * array4.length)];
quartz kindle
#

and what is array4

#

are all combans defined like that?

earnest phoenix
#

yes

quartz kindle
#

all from array4 or each from different array?

earnest phoenix
#
let array4 = [...array1, ...array2, ...array3, ...array5, ...array6];
earnest phoenix
quartz kindle
#

and what are these arrays lol

earnest phoenix
#

array4 is the sum of obtained cards

#
let array1 = db.get(`common_${message.author.id}`);
let array2 = db.get(`rare_${message.author.id}`);
let array3 = db.get(`epic_${message.author.id}`);
let array5 = db.get(`leg_${message.author.id}`);
let array6 = db.get(`champ_${message.author.id}`);
quartz kindle
#

somewhere in array4 you have a value that is invalid and does not exist in chh, and since you're defining the combans with Math.random, then everytime the error will be in a random comban

#

console.log those arrays and look for an invalid value

earnest phoenix
#

ok

#

invalid value, maybe there are a lot of them because my typing is bad

#

lol

quartz kindle
#

👍

earnest phoenix
#

so i deleted it from my profile

#

and now works without any error, now i have to delete others legendarys or i'll check documentation to replace

quartz kindle
#

👍

earnest phoenix
#

i'll update to discord.js v13 tomorrow because it's giving errors

boreal iron
#

Take your time to update it as it will probably need some time depending on the amount of your code

earnest phoenix
#

oh how I make this to give always a new card and not one you already have

#

like the random card is selected by this:

let cards = {
"card1": { name: "Card1", level: "21", ....},
"card2": { name: "Card2", level: "22", ....},
"card3": { name: "Card3", level: "23", ....}
}

let chsl = Object.values(cards);
chssa = chsl[Math.floor(Math.random() * chsl.length)];

and the new card to give will be chssa but if chssa is already owned, i'll make it like this:

if(chssa === true) {
let chs = Object.values(cards);
chssa = chs[Math.floor(Math.random() * chs.length)];
}
``` again and again but that in some time it doesn't work and the card is duplicated, so is there a possibility to remove the owned cards from `cards`? and leave it like this:
```js
let cards = {
"card1": { name: "Card1", level: "21", ....},
"card3": { name: "Card3", level: "23", ....}
}
``` Card2 was owned so it was removed from there and now when i randomly choose there is no possibility to duplicate
oak pagoda
#

Anyone good with html and particle js?

lyric mountain
#

state your question and wait for answers

#

asking if someone is good with html will yield no answer

oak pagoda
#

I been working on a website and turns out the particles and the main context come seperate, the particle was generated with a code generator and yea, this is what it shows , I probably tried many alternative methods but couldn't merge

quartz kindle
quartz kindle
oak pagoda
#

Merge the displayed content with the particles

#

If that made sense

quartz kindle
#

you mean extend the particles background to cover the entire page?

oak pagoda
#

Precisely but instead of extending I wanna put the content with the particles-

#

No need to extend

quartz kindle
#

just move it up

oak pagoda
#

I did

quartz kindle
#

you can use margins or absolute positioning for example

soft surge
#

updated to discord js v13

#
                           ^

TypeError: Cannot read properties of undefined (reading 'roles')```
#

what is it now?

oak pagoda
#

I'll probably try positioning

quartz kindle
soft surge
#

???

#

but there cant just be "no guild"

#

except for when you are in dms

quartz kindle
#

there can

#

exactly

soft surge
#

but im testing in a channel

quartz kindle
#

then your message variable is not actually a message

#

show code

soft surge
#

oh wait one sec

#

i mightve found a solution

cosmic forum
#

hello, i am trying to set up a component collector that only runs when the user who ran the command clicks the button, however it is running no matter who clicks.

let f = i => i.user.id == msg.author.id;
let col = msg.channel.createMessageComponentCollector({ f, time: 300000 });

(discord.js)

soft surge
#

nvm

soft surge
#
module.exports = {
    name: 'play',
    description: 'Plays music in a VC',
            /**
     *
     * @param {Client} client
     * @param {Message} message
     * @param {String[]} args
     */
    execute: async (message, client, args) => {
        if (!message.guild.roles.cache.find(role => role.name === "DJ")) {
            message.guild.roles.create({
                data:{
                    name: 'DJ',
                    color: 'RED',
                }
            });
        };
        if (!message.member.voice.channel) return message.channel.send(`**You need to be in a voice channel to play music!**`);
        if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id) return message.channel.send(`**You need to be in the same voice channel to use this command!**`);
        if (!args[2]) return message.channel.send(`**You need to specify a song to play or search for!**`);

        client.player.play(message, args.slice(2).join(" "));
    },
};```
quartz kindle
#

there you run .execute()

soft surge
#
const client = require('../app');

client.on('messageCreate', async message => {
    const args = message.content.slice(prefix.length).trim().split(/ +/);
    if (!message.guild) return;
    if (message.author.bot) return;
    const cmd = args[1]
    const command = client.commands.get(cmd)
    if (command) {
        command.execute(
            client,
            message,
            args
        );
    }
})```
quartz kindle
#

thats the problem

#

message and client are swapped

soft surge
#

oh

#

im slow

#

mb

quartz kindle
#

filter: f

#

the options object needs the key names to be correct

cosmic forum
#

ohh ok

soft surge
#

one last thing

#

RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.

#
            .setThumbnail(client.user.displayAvatarURL())
            .setColor(colours.rose)
            .addField('General', [
                `**❯ Client:** ${client.user.tag} (${client.user.id})`,
                `**❯ Servers:** ${(await client.shard.fetchClientValues("guilds.cache.size")).reduce((a, b) => b + a)} `,
                `**❯ Users:** ${(await client.shard.fetchClientValues("guilds.cache")).reduce((a, b) => a + b.memberCount, 0)}`,
                `**❯ Channels:** ${(await client.shard.fetchClientValues("channels.cache.size")).reduce((a, b) => b + a)}`,
                `**❯ Creation Date:** ${utc(client.user.createdTimestamp).format('Do MMMM YYYY HH:mm:ss')}`,
                `**❯ Node.js:** ${process.version}`,
                `**❯ Bot Version:** ${version}`,
                `**❯ Discord.js:** v${djsversion}`,
                '\u200b'
            ])```
quartz kindle
#

thats not a string

#

its an array

soft surge
#

well thats where the error is

quartz kindle
#

well make it a string

boreal iron
#

ended up with grub bootloader and a weird bug I discussed with some people in the forums, turns out it’s a known bug and the whole Saturday was just a time waste
After investigating clover i found out it’s trash, too

earnest phoenix
boreal iron
#

At the end the OS now runs on the bootable SATA SSD and NVMEs are mounted as ZFS RAID1 acting as vm file system

quartz kindle
boreal iron
#

Not sure if I somehow loose performance in between OS (SATA SSD) and NVME drives but that’s all I got

#

What a gigantic waste of time

quartz kindle
#

i doubt youll lose performance

boreal iron
#

At the end it’s running now as it should

earnest phoenix
quartz kindle
#

yes

earnest phoenix
#

ok

boreal iron
#

The VM file system is a RAID as well the DB file system, that’s important
And the vmfs with its NVMEs shouldn’t have speed issues running multiple VMs and IO operations parallel

earnest phoenix
quartz kindle
earnest phoenix
#

ok

lyric mountain
#

not wanting to put you down, but you should probably learn the language before attempting a big project such as a bot

earnest phoenix
# quartz kindle check if the user already has it

the last question and i'll go to learn js like kuuhaku said (i was learning but idk why i stopped)
and the question is how I check if the user already has it? there nothing to compare with like if(card === true) but here's nothing

quartz kindle
#

how do you know what cards a user has?

earnest phoenix
#

i never used it because i never needed

#

oh nvm

#

with the db

#

so i sum all the owned cards and use this?: if(array4 === true)? it's weird tho

quartz kindle
#

no

#

i dont know what your code looks like, but you have to get the cards the user already has, for example in an array, then check if the card already exists there

#

for example

#
exists = [1,2,3]
all = [1,2,3,4,5,6,7,8,9]
notExists = all.filter(item => !exists.includes(item))
newItem = notExists[Math.floor(Math.random() * notExists.length)]
#

of course since you're using objects, you have to check the content of the object

earnest phoenix
#

my brain exploded but i understood (maybe)

#

i'll try it out

quartz kindle
#

basically its a double loop

#

for each item in the cards array, you need to check each item in the cards the user has, and see if it exists there

fresh bluff
#

Hey can someone help me fix the appearance of the game category its bugged

earnest phoenix
#

pass code

fresh bluff
#

this is the code for the help command

earnest phoenix
#

you didn't end the ` in information

fresh bluff
#

Oh

quartz kindle
#

you cant use ` on actual emojis

#

the other three are unicode characters

#

use the unicode version of the emoji

fresh bluff
#

Then what do i do for the emoji?

quartz kindle
#

\🎮

wicked mango
#

Oh

quartz kindle
#

copy and paste that into your code

#

instead of using the emoji name

earnest phoenix
#

\:emoji:

fresh bluff
#

Thanks @earnest phoenix but uh the line what do i do?

#

theres a black line

#

did i mess something up? @earnest phoenix

quartz kindle
#

you have the ` after the new lines

#

instead of at the end of the text

fresh bluff
#

so where?

quartz kindle
#

in that place

fresh bluff
#

OH

#

Thanks

bitter adder
lyric mountain
#

the issue is not being replt, the issue is him not using multiline string

fresh bluff
lyric mountain
#
let aString = `
  this is
  a valid
  string
`
fresh bluff
#

also @lyric mountain How do I make the Header a link in the text

lyric mountain
#

second parameter in setTitle

bitter adder
#

title
url

woeful pike
bitter adder
#

wait why am i a bit developer

#

thats wierd

fresh bluff
#

Yeah @lyric mountain

bitter adder
lyric mountain
#

thank god

fresh bluff
fresh bluff
woeful pike
#

why not just reply instead of adding that footer lol

lyric mountain
fresh bluff
#

Thanks

#

@lyric mountain I did that but it shows the link and not the text with the link in it like if you click the text it opens a link how do i do that?

bitter adder
#

check how embeds are made

#

....

fresh bluff
bitter adder
#

idk js but prolly that

#

i like kotlin

#

🥰

fresh bluff
#

Let me check

#

Yep @carmine topaz is right I checked the docs

earnest phoenix
#

this filters the true or false? i want to get only the false ones

quartz kindle
#

no

#

let filteredTotal = total.filter(... => existing.find(...))

#

you are filtering the total list, chh,

#

and you want to compare it to the existing cards of the user

#

so it has to be the array that contains what cards the user already has

#

not itself again

earnest phoenix
quartz kindle
#

if array4 is the cards that the user has, yes

earnest phoenix
#

ok

earnest phoenix
quartz kindle
#

it has to be all cards that the user has

earnest phoenix
#

ok

#

thx for responding my stupid questions over and over

boreal iron
#

Tim just wanna delay his API another year, that’s why he’s here

quartz kindle
#

yes

#

thats exactly it

earnest phoenix
#

Uh-Oh

#
(node:6593) UnhandledPromiseRejectionWarning: TypeError: chh.filter is not a function
quartz kindle
#

or Object.entries()

fresh bluff
#

I need help setting up my node_modules file how do i set that up?

wheat mesa
#

What

#

You normally never lay a finger on that folder unless you’re modifying a library

boreal iron
#

He probably means node init

#

Building a project

wheat mesa
#

npm init -y

boreal iron
#

Oh lol I wrote node

earnest phoenix
#
const config = require("../config.json");
const { Discord, MessageEmbed } = require("discord.js");
const moment = require('moment')
const db = require('quick.db')
module.exports = {
  name: "ban", // Command Name
  description: "List all of my commands/info about a specific command.", // Description
  aliases: ["h"], // Aliases
  usage: "<user>", // Usage
  cooldown: 0, // Cooldown In Seconds
  guildOnly: false, // If Command In DMs return
  admin: false, // Bot Admin only
  async execute(message, args, client) {    

    
      let prefix = config.prefix
         if (!message.member.permissions.has("BAN_MEMBERS")) return message.channel.send("**You Dont Have The Permissions To Ban Users! - [BAN_MEMBERS]**");
            if (!message.guild.me.permissions.has("BAN_MEMBERS")) return message.channel.send("**I Dont Have The Permissions To Ban Users! - [BAN_MEMBERS]**");
            if (!args[0]) return message.channel.send("**Please Provide A User To Ban!**")

            let banMember = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(r => r.user.username.toLowerCase() === args[0].toLocaleLowerCase()) || message.guild.members.cache.find(ro => ro.displayName.toLowerCase() === args[0].toLocaleLowerCase());
            if (!banMember) return message.channel.send("**User Is Not In The Guild**");
            if (banMember === message.member) return message.channel.send("**You Cannot Ban Yourself**")

            var reason = args.slice(1).join(" ");

            if (!banMember.bannable) return message.channel.send("**Cant Kick That User**")
            try {
            banMember.send(`**Hello, You Have Been Banned From ${message.guild.name} for - ${reason || "No Reason"}**`).then(() =>
                message.guild.members.ban(banMember, { days: 7, reason: reason })).catch(() => null)
            } catch {
                message.guild.members.ban(banMember, { days: 7, reason: reason })
            }
            if (reason) {
            var sembed = new MessageEmbed()
                .setColor("GREEN")
                .setDescription(`**${banMember.user.username}** has been banned for ${reason}`)
            message.channel.send(sembed)
            } else {
                var sembed2 = new MessageEmbed()
                .setColor("GREEN")
                .setDescription(`**${banMember.user.username}** has been banned`)
            message.channel.send(sembed2)
            }}}```
It sends the ban message to the user, but does not ban the user from the guild.
#

Djs v3 be so buggin lol

#

Where are you banning them at

#

Oh I see

#

I am confused why you are doing it this way to be honest

#

PI_Shrug Is that not the way everyone does it?

#

I mean

#

Probably some people

#

but this just seems eh to me

#

Could you "refine" or fix it to where it might be easier to understand?

#

If you can, again up to you Cause I am completely new to v13

#

Okay well

#

Are you sure it isn't banning them?

#

Positive 100%

#

Cause seems to me it is getting past that and probably having an issue with sending the embeds after

#

Well

#

I can say one thing, you are already going to have an issue anyway. Once the member is banned banMember is no longer the person you are trying to ban

#

wym?

#

Well

#

When you are going to ban someone you assign their stuff to banMember right?

#

So you can send them a message saying they are getting banned.

#

mhm

#

I want it to send a message, ban them, then send a message to the channel.

#

But it won't ban and then send a message to the channel.

#

But once they are banned banMember becomes null, since they no longer exist in the guild so using it will cause you issues. Which I think is what is happening here.

#

I can only go based off the error you provided.

#

But idk where exactly it is having issues sending a message.

#

It just says can not send a empty message, so I am confused.

#

Its not empty tho also

#

Lemme try to ban them at the end

#

And the reason why I asked are you sure they aren't banned, cause sometimes visual bugs can happen on discord and they can appear to still be in the guild.

#

Send a message

#

then ban

boreal iron
#

If you’re on djs v13 the syntax to send content or embeds has changed

#

You need to provide that as options

earnest phoenix
#

Oh they are using v13?

#

I thought they were still using v12

#

:p

boreal iron
#

Idk

earnest phoenix
#

I am on v13

#

Oh then

#

duh

#

You can no longer send embeds that way

#

o-o

#

OH YEAH

#

OML

#

{embeds:[]}

#

You have to give it options now

#

yep

#

Yeah got it now 🤣 ty

#

I am guessing the issue lies there

#

heh

#

Ayy works now

#

Your amazing

boreal iron
#

Only a string can be send without defining messages options

earnest phoenix
#

well fake was the one that really helped

#

:p

#

My friend made that account name so I aint sus lmfao

#

Yeah @boreal iron tysm too 💯

#

You both are 10

#

I am shocked you can still use banMember tho

#

shouldn't it be empty after banning?