#development

1 messages · Page 1059 of 1

earnest phoenix
#

jesus

restive pebble
#

how
@earnest phoenix use boolean

earnest phoenix
#

like what

#

how to know if he is desktop

#

what method

restive pebble
#

user.presence.clientStatus

hazy sparrow
#

okay so i wanted to make a 8ball command. this is the code i made

module.exports = {
    name: '8ball',
    description: "Ask the 8ball anything you want!",
    execute(message){
        
        if (!message.content.startsWith(prefix) || message.author.bot) return;

        const args = message.content.slice(prefix.length).trim().split(/ +/);
        const command = args.shift().toLowerCase();  
        
        const ball = Math.floor(Math.random() * (6- 1 + 1) + 1)
        
        if (!args.length) {
            return message.channel.send(`what are you asking the 8ball, ${message.author}?`);     
        }

if (args.length){

if(ball === 1) {
        
  message.channel.send('yes, m8')     
 
    } if(ball === 2) {
            
 message.channel.send("that's a big NO")
    
        } if(ball === 3) {
            
  message.channel.send("I don't think so.")  
       
            } if(ball === 4) {
            
 message.channel.send("i don't what what to say about this")   
         
                } if(ball === 5) {
            
   message.channel.send("YAAAAS!")      
            
                     } if(ball === 6) {
    message.channel.send("no.")        
    
                     }        
}
    
    
        
}
     
    
    
    
}   

will it work?

restive pebble
#

try kek

hazy sparrow
#

ok

#

it worked lmao

#

i had one error which was "prefix was not defined" so i defined it and it worked

small prairie
#
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
 NODE_MODULE_VERSION 83. Please try re-compiling or re-installing
restive pebble
#

glitch moment

small prairie
#

Whats this :/

restive pebble
#

try npm rebuild

small prairie
#

didnt work

#

tried like a million times

restive pebble
#

node-gyp rebuild

small prairie
#

-bash: /root/.nvm/versions/node/v12.18.1/bin/node-gyp: No such file or directory

restive pebble
#

hmmmm

#

npm uinstall and reinstall

small prairie
#

should i just delerted the node_modules folder?

restive pebble
#

yes

small prairie
#
npm WARN discord.js-commando@0.11.0-dev requires a peer of better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of sqlite@^3.0.0 but none is installed. You must install peer dependencies yourself.

audited 352 packages in 6.632s

21 packages are looking for funding
  run `npm fund` for details

found 6 vulnerabilities (4 low, 1 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
root@client:~/public#
#

this might be cause?

#

@restive pebble

restive pebble
#

its warning

#

it dosent matter

small prairie
#

Same error

restive pebble
#

could u try copying the json.sqlite file

small prairie
#

json.sqlite?

restive pebble
#

yes

small prairie
#

where is it?

#

i mean

restive pebble
#

there must be an json sqlite file

#

any .sqlite file

small prairie
#

Uh no

#

i dont use sqlite its just quick.db shit requirement

#

and quick.db requirement for shit commandop

restive pebble
#

yea

small prairie
#

So will i still have a .sqlite file?

restive pebble
#

better sqlite 3 dosent support many node versions

small prairie
#

i use 12
i use better-sqlite in my other bots but weird erro r just popped out when i installed the dbl lib

#

i know sqlite doesnt work with 12+

quartz kindle
#

it does

restive pebble
#

yes i does

small prairie
#

okay so im wrong

#

better-sqlite doesnt?

restive pebble
#

it works with 10 also

quartz kindle
#

it does

small prairie
#

ok weird

#

Eh i just use 12 all the time

#

i get a weird error on 14

restive pebble
#

14?

quartz kindle
#

what error

small prairie
earnest phoenix
#

if i wanna go back from to hygenx/ from hygenx/main/bot.js would I do ../?

#

or what?

quartz kindle
#

that just means it was compiled for the wrong node version

restive pebble
#

../../

quartz kindle
#

you need to rebuild it

earnest phoenix
#

ok

#

thx boeing

small prairie
#

rebuilding doesnt work :/

quartz kindle
#

how are you rebuilding?

small prairie
#

npm rebuild

restive pebble
#

use node-gyp kek

quartz kindle
#

npm rebuild better-sqlite3

restive pebble
#

where u hosting bot

small prairie
#

vultr vps

restive pebble
#

k

small prairie
#

same bug

#

/error

restive pebble
#

better sqlite is strange

quartz kindle
#

show full log

small prairie
#

Full log was in?

#

as*

restive pebble
#

install then

quartz kindle
#

there is no actual build log?

small prairie
#

Nope

#

just what i sent

earnest phoenix
#

@restive pebble [Error: ENOENT: no such file or directory, scandir '../../events/'] { errno: -2, code: 'ENOENT', syscall: 'scandir', path: '../../events/' [Error: ENOENT: no such file or directory, scandir '../../dbl/'] { errno: -2, code: 'ENOENT', syscall: 'scandir', path: '../../dbl/' (node:24) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined at /home/container/hygenx/main/bot.js:34:35 at FSReqCallback.oncomplete (fs.js:155:23) (node:24) 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:24) [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. Code:https://hastebin.com/jayebufode.js
paths: hygenx/commands/
hygenx/events/
hygenx/dbl/

small prairie
restive pebble
#

ok wait

#

he is asking for build logs

#

send ss after npm rebuild

earnest phoenix
small prairie
#

Uh?

#

The beast check starting of ss

earnest phoenix
#

oh wat

#

weird

#

idk

robust moth
#

Any one can tell me how !! Is work ?

small prairie
restive pebble
#

@earnest phoenix explain

#

where ur file is

#

and what dir u want to read

earnest phoenix
#

thats where the file is currently

#

and the code

restive pebble
#

ok

summer torrent
#

Any one can tell me how !! Is work ?
@robust moth wdym by !!

earnest phoenix
#

i want it to go to HygenX/commands

restive pebble
#

../../commands/dbl

earnest phoenix
#

I did

#

omfg

small prairie
#

nvm

earnest phoenix
#

im a idoit

digital ibex
#

!! is like

small prairie
#

Im officially dead

digital ibex
#

reverse

earnest phoenix
#

wait

#

no

#

still same error

small prairie
#

@restive pebble check the log

restive pebble
#

try with ../

earnest phoenix
#
fs.readdir("../../events/", async (err, files) => {
  if (err) return console.error(err);
  files.forEach(file => {
    const event = require(`../../events/${file}`);
    let eventName = file.split(".")[0];
    client.on(eventName, event.bind(null, client));
  });
  await console.log(`All Events have Been Loaded and are waiting to me activated.`)
});```
#

ok

digital ibex
#

why are you awaiting the console.log?

earnest phoenix
#

cause i want it to console log when everything is done

digital ibex
#

whats ur issue, also?

earnest phoenix
#

...

digital ibex
#

awaiting it isn't gonna do anything

earnest phoenix
#

scroll up ^^^

digital ibex
#

no

earnest phoenix
#

@restive pebble Tried

#

same error

#
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '../dbl/'
[Error: ENOENT: no such file or directory, scandir '../events/'] {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '../events/'
(node:24) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined
at /home/container/hygenx/main/bot.js:34:35
at FSReqCallback.oncomplete (fs.js:155:23)
(node:24) 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:24) [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.```
#

and yes

#

there are files named that

#

might be a problem with pulling

quartz kindle
#

@small prairie whats that?

restive pebble
#

logs

small prairie
#

Logs

quartz kindle
#

what kind of logs lol

#

from where

restive pebble
#

wot

small prairie
#

npm rebuild

restive pebble
#

lemme see

#

kek

#

where

quartz kindle
#

you dont need to rebuild everything, you just need to rebuild better-sqlite3

small prairie
#

these are the logs then

earnest phoenix
#

@restive pebble So?

quartz kindle
#

the command npm rebuild better-sqlite3 should produce build logs, if it doesnt, that means its trying to use prebuilt binaries

#

try npm install better-sqlite3 --build-from-source

restive pebble
#

wait

small prairie
#

now thats producing logs

restive pebble
#

how u get domains like

#

thxt

#

bought?

small prairie
restive pebble
#

hmmm

#

oh thz

small prairie
#

np

quartz kindle
#

the build process should take a moment or two

restive pebble
#

x

quartz kindle
#

like 30sec-1min

small prairie
#

me waiting for eternity

#

;-;

#

my host has been slow lately

#

time to upgrade

restive pebble
#

ok

small prairie
#

rip its not happening ;-;
should i close other processes and then rebuild?

restive pebble
#

what other process

hazy sparrow
summer torrent
#

which lib

hazy sparrow
#

d.js

summer torrent
#

setAuthor() has image option

hazy sparrow
#

like
setAuthor(AvatarURL())

summer torrent
#

no

restive pebble
#

No

#

Text first

summer torrent
hazy sparrow
#

im following that

#

i didnt get it

#

so i came here

summer torrent
#

(text, image url, url)

restive pebble
#

It's same as footer

hazy sparrow
#

oh got it

summer torrent
hazy sparrow
#

but

#

i want it in a title

restive pebble
#

Cannot

hazy sparrow
#

oh thats why

#

what about a field title

earnest phoenix
#

@small prairie I signed up. and downloaded sharex how do i config it?

tulip ledge
#

nope

#

Only author or footer

restive pebble
#

Docs

hazy sparrow
restive pebble
#

Hi chicken

summer torrent
#

you can use image url on author, image, thumbnail and footer

restive pebble
#

That author lul

summer torrent
#

^

tulip ledge
#

Hi

restive pebble
#

Markdowns

small prairie
#

@earnest phoenix just download the thing they give and run it

#

simple as that

restive pebble
#

kek

earnest phoenix
#

ok

hazy sparrow
#

so
.setAuthor("string", message.author.avatarURL())

summer torrent
#

yes

hazy sparrow
#

ah got it thanks

earnest phoenix
#

thx

tulip ledge
#

I acxtually wanna cry

restive pebble
#

Null moment

marble juniper
#

why @tulip ledge

restive pebble
#

Go to pins and read all rules

marble juniper
#

also I do when I see that spelling

tulip ledge
#

The way I make weapons work is by saving stats to a user but the issue is that if an item is too OP and I wanna rebalance it the user keeps their stats D:

restive pebble
#

Kek

tulip ledge
#

I would have to run multiple queries to check if the user has the item equipped etc and then remove the stats 😦

#

And I just realized it after writing around 10000 lines of code that depend on that system

hazy sparrow
#

another question, can i leave out a title in a field?

tulip ledge
#

No

restive pebble
#

Help me

#

Pls

digital ibex
#

use zws

tulip ledge
#

Use an invisible unicode character

restive pebble
#

Tell me some really awesome api

quartz kindle
#

what kind of api

digital ibex
#

cat api ofc

tulip ledge
#

Tim

restive pebble
#

Like spotify

tulip ledge
#

Do you know a better way of making my item system work?

hazy sparrow
restive pebble
#

I wrapped their api already

tulip ledge
#

So that I can actually rebalance items

digital ibex
#

description

summer torrent
#

desc

restive pebble
#

I want to wrap more apis

hazy sparrow
#

description of?

tulip ledge
#

.setDescription()

digital ibex
#

embed.description = string

hazy sparrow
#

ohh

#

ty

restive pebble
#

Oh ok

#

Soundlcloud

hazy sparrow
#

another question

tulip ledge
#

Does anyone have a better way of doing stuff with my items then I'm doing right now?

digital ibex
#

markdown

restive pebble
#

Mardiwn

tulip ledge
hazy sparrow
#

i know how to put the whole discription as a link

digital ibex
restive pebble
#

Html basics

hazy sparrow
#

so
.setDescription(hi)

tulip ledge
#

)

digital ibex
#

ya

restive pebble
#

``

earnest phoenix
#

.setDescription('text[text](link)')

tulip ledge
hazy sparrow
#

ty

earnest phoenix
#

do this allowed? (when someone send ads to server which is ad protected)

restive pebble
#

Wot

digital ibex
#

no its not

tulip ledge
#

Does anyone know a better way of doing my items? As items have different stats like strength, agility etc. I currently save them in a JSON file to get the stats by just looking up the item the user has equipped in that JSON file but the issue is if that I need to rebalance an item the stats won't change and I'd have to run like 4-5 SQL queries to rebalance the item, if there's alot of users this could take really long

hazy sparrow
#

the whole thing became a string

restive pebble
#

Nice

digital ibex
#

what does the json look like?

restive pebble
#

which u can access

#

{
Kek
}

earnest phoenix
#

@gleaming glen benim botum da reklam engelleme var eğer reklam filtresi açıksa reklamı siler ve sunucu sahibine atar
buna zin varmı

hazy sparrow
#

like .setDescription('hiaye is sending "hiaye"

digital ibex
#

yeah

#

no

#

yeah

#

actualy

restive pebble
#

It won't work

digital ibex
#

but add the )

restive pebble
#

No space

digital ibex
#

and '

tulip ledge
#
    "item name": {
        // Item stats like "strength": 10,
        "rarity": "rare",
        "obtained": "How it's obtained",
        "type": "weapon"
    },
#

Like that

digital ibex
#

store it in an array

#

so like

hazy sparrow
#

but add the )
@digital ibex me?

earnest phoenix
#

.setDescription('hi[aye](https://google.com/%27) is sending "hi[aye](https://google.com/)"')

tulip ledge
#

I don't see how that would help storing it in an array

digital ibex
#
"items": [{
 "item name": {
   item stats
  }
}]```
#

it'll make the queries faster

tulip ledge
#

Well not really

#

As items are stored by ID's

#

Meaning an id like this FHYE-IT73-OT90

digital ibex
#

oh right

#

hm

tulip ledge
#

I'd have to track down all the items by querying the items table

digital ibex
#

how r u making the queries?

tulip ledge
#

Then getting the id's

#

And then looking up all the users who have that ID equipped

#

And remove the stats

#

I have yet to rebalance any items

#

I just noticed it

#

That that would be an issue for later

digital ibex
#

And then looking up all the users who have that ID equipped
how are you doing this?

#

just with an if statement?

quasi arrow
#

how long does it usually take to get bot verified?

digital ibex
#

like 3 weeks

tulip ledge
#
client.con.query(`SELECT * FROM items WHERE itemname = "tobalance"`, (err, rows) => {
  if(err) throw err;
  if(rows.length < 1) return "nothing to balance!";
  rows.forEach(x => {
    client.con.query(`SELECT * FROM inventory WHERE weapon = "${x.itemid}"`, (err, rows) => {
      // Remove the stats
    })
  })
})
#

Probably something like that

#

And lets say (this is probably not gonna happen but it's in theory) you have 2000 users in total and about 200 people have that item equipped I'd have to do around 400 querries

digital ibex
#

im assuming you're storing users in your database?

tulip ledge
#

Yes

#

Actually the weapon is stored in the inventory table

digital ibex
#

maybe store their items

#

then u can do a simple if statement

#

so liek

restive pebble
#

So no one has some cool apis

#

x)

digital ibex
#
if (member.items.some((e) => items.includes(e))```
misty sigil
#

telk does

#

canvas and stuff

digital ibex
#

then thats when the storing in arrays comes in think

tulip ledge
#

That could work but then I'd have to do alot more stuff aswell

digital ibex
#

more stuff like?

tulip ledge
#

Like more stuff in the database

#

When the user equips and unequips stuff

#

The thing is my items also have reforges and stuff

#

I would make it WAY more complicated

#

How long would it take on average to do around 400 queries

digital ibex
#

yeah, you would need to change stuff

#

with your database, im not too sure.

tulip ledge
#

In theory

digital ibex
#

if its well maintained, i'd say it should be like 0.3 seconds

tulip ledge
#

Oh so shouldn't be that big of an issue then

digital ibex
#

well i mena

#

0.3 seconds is a big issue, but if that screenshot is correct, you shouldn't worry nope

#

0.3 seconds to make them queries is adding 300ms onto your ping

#

lets say your ping is 150ms, it'll be like 450ms

tulip ledge
#

Well I mean it's just right after I release an update that rebalances an item for example

#

I can just do that query once

#

Rebalance all items

#

And then I don't have to querry any more

digital ibex
#

what would the rebalancing do?

tulip ledge
#

I can just make a command out of it like -balance <item>

#

Change some stats

digital ibex
#

is that dev only?

tulip ledge
#

Yes

digital ibex
#

or for server admins

#

oh right

tulip ledge
#

Dev only

digital ibex
#

then ig you shouldn't have to worry

tulip ledge
#

Alright then

#

Thank you

digital ibex
#

np 👍

tulip ledge
#

I'll prob do like -balance <item> strength:5, agility:2 wich is how much it should be removed by

restive pebble
#

K

earnest phoenix
#
        prefix.findOne({
            Guild: message.guild.id,
        }, (err, data) => {
            if (err) console.log(err);
            if (!data) {
                const newPrefix = new prefix({
                    Prefix: args.join(' '),
                    Guild: message.guild.id,
                });

                newPrefix.save();
                message.channel.send({
                    embed: {
                        color: colours.auxcrd,
                        description: 'Prefix has been set!',
                    },
                });
            }
            else {
            }
        });``` hey i just started using mongodb but I want to update/edit the data if the guild has already set a custom prefix
restive pebble
#

Same lol

earnest phoenix
#

how would i do that

restive pebble
#

I mastered it today itself

#

I can help

tulip ledge
#

Euhm why does it say my query is wrong? ALTER TABLE users ADD key VARCHAR(10);

earnest phoenix
#

please do kek

tulip ledge
#

Mysql btw

restive pebble
#

U using mongoose?

earnest phoenix
#

yep

restive pebble
#

SURRENDERS

earnest phoenix
#

i have my models already

restive pebble
#

I use mongodb

#

No clue of mongoose module

earnest phoenix
#

i dunno if this matters but i use compass too

tulip ledge
#

Ok so apparantly u can't name a column "key" in MySQL

restive pebble
#

Auric

#

Can u tell some good apis

earnest phoenix
#

idk any tbh

#

¯_(ツ)_/¯

digital ibex
#

please...

pure lion
#

Make your own api x)

restive pebble
#

@earnest phoenix what is prefix

#

Was thinking @pure lion

earnest phoenix
#
const Schema = mongoose.Schema({
    Prefix: String,
    Guild: String,
});```
pure lion
#

:D

restive pebble
#

k

digital ibex
#

do not make collections for each thing, thing like prefix, logs whatever

pure lion
#

Aa mongoose

quartz kindle
#

i have an api but not sure if you'd be interested in that kid of stuff lol

pure lion
#

Thank you lost

restive pebble
#

Ok

#

Tell

pure lion
#

@earnest phoenix make one schema for the guild lmao

restive pebble
#

I like aviation and space stuffs

digital ibex
#

same

#

not space tho

#

confuses me

quartz kindle
#

its for astronomy and astrology

pure lion
#

Kerbal space programme?

misty sigil
#

ksp?

earnest phoenix
#

imma just play around with code, see if i get some progess

quartz kindle
#

gives planetary and stellar positions at specific moments in time

pure lion
#

Kspppppp

restive pebble
#

Yes

#

Give kek

misty sigil
#

that one game that I fly a rocket in and manage to orbit it round the sun and kill all the crew?

quartz kindle
trail finch
#

HELLO

#

anyone on?

misty sigil
#

lots of us

#

what do you need

trail finch
#

COOl

restive pebble
#

K thx

trail finch
#

i needed a help

restive pebble
#

I will see

trail finch
#

client.commands.set(props.help.name, props);

#

idk why its telling error

pure lion
trail finch
#

-_-

#

is that a joke or something?

pure lion
#

No

#

:)

trail finch
#
  if (err) throw err;

  let file = files.filter(f => f.endsWith(".js"));
  if (file.length <= 0)
    return console.log("There is js files in the commands folder");

  file.forEach(f => {
    let props = require(`./commands/${f}`);
    console.log(chalk.yellow(`Attempting to load ${f}`));

    client.commands.set(props.help.name,props);
  });
  console.log(chalk.bold.bgGreen("Everything loaded properly."));
});

process.on("unhandledRejection", error => {
  console.error("Unhandled promise rejection:", error);
});```
#

full code one

earnest phoenix
#

What's the matter?

trail finch
#

=( sad from morning dont know why

#

its tellign error

tulip ledge
#
          await rows.forEach(x => {
            if(x.area !== floor) return message.channel.send("One or more users are not on the same floor.")
            if(x.dungeonkey === "false") return message.channel.send("All users must have a key or they cannot enter the dungeon.")
            else {
              let sql = `UPDATE users SET dungeonkey = "false" WHERE discordid = "${x.discordid}"`;
              client.con.query(sql)
              levelarray.push(x.level)
            }
          })

Any idea why it isn't returning even tho it's sending the message "All users must have a key or they cannot enter the dungeon."

misty sigil
#

telling error doesn’t help

trail finch
#

umm

#

wait

misty sigil
#

give us the error

tulip ledge
#

No error

misty sigil
#

not u

trail finch
#

the error is

pure lion
#

Jsjsjsjsj

trail finch
#

read property*

#
/app/index.js:23
    client.commands.set(props.help.name,props);
                                   ^
TypeError: Cannot read property 'name' of undefined
at file.forEach.f (/app/index.js:23:36)
    at Array.forEach (<anonymous>)
at fs.readdir (/app/index.js:19:8)
    at FSReqWrap.args [as oncomplete] (fs.js:140:20)```
#

the full error

earnest phoenix
#

you didn't set a name for each command

digital ibex
#

console.log(props.help)

earnest phoenix
#

most likely

trail finch
#

um

digital ibex
#

?

tulip ledge
#

Anyone knows mine?

digital ibex
#

whats ur issue?

tulip ledge
#
          await rows.forEach(x => {
            if(x.area !== floor) return message.channel.send("One or more users are not on the same floor.")
            if(x.dungeonkey === "false") return message.channel.send("All users must have a key or they cannot enter the dungeon.")
            else {
              let sql = `UPDATE users SET dungeonkey = "false" WHERE discordid = "${x.discordid}"`;
              client.con.query(sql)
              levelarray.push(x.level)
            }
          })

Any idea why it isn't returning even tho it's sending the message "All users must have a key or they cannot enter the dungeon."

#

The code after the forEach is being executed

#

Even tho it shouldn't

trail finch
#

um

digital ibex
#

its sending that regardless?

trail finch
#

is that a rpg game bot?

tulip ledge
#

Why?

digital ibex
#

?

tulip ledge
#

yes it's sending the message

restive pebble
#

Yes only thts left now

#

Play games on discord

tulip ledge
#

But the code after the forEach gets executed

digital ibex
#

oh

quartz kindle
#

you cannot return a foreach

digital ibex
#

its not "false" its false

tulip ledge
#

Euhm

#

Oh

#

No well it's saved as a string

#

Thats not the issue

hazy sparrow
digital ibex
#

hm

quartz kindle
#

if you've read it, you know the problem lol

restive pebble
#

Lol

digital ibex
#

send the file tree

hazy sparrow
#

wheres it though

tulip ledge
#

Wait so you can't return a forEach?

#

Would I do a for loop then?

#

Or what would I do

digital ibex
#

use map

quartz kindle
#

forEach takes a function, so when you return inside a forEach, you are returning from that function, the parent code is unaffected

tulip ledge
#

oh

#

What do I do then?

quartz kindle
#

any other loop

tulip ledge
#

Ok

#

So for would work

hazy sparrow
earnest phoenix
#

aight guys I just figured out how to update my mongodb prefix data

#

ty for the help tho

quartz kindle
#

mdn has a pretty big warning about that

tulip ledge
#

Ok it's working now ty

#

Oh

trail finch
#

umm my problem....

tulip ledge
#

I always use for loops and I was like I'll use forEach this time

#

Wellp...

trail finch
#

welp

quartz kindle
trail finch
#

xd

hazy sparrow
#

capital c?

trail finch
#

yes

quartz kindle
#

@trail finch one of your commands has no help property

restive pebble
#

Hello I need a help

tulip ledge
#

What do you mean your issue

trail finch
#

oo

restive pebble
#

Basically I'm making a raid bot

tulip ledge
#

Didn't like 3 people already answer you?

restive pebble
#

guild.members.cache.forEach(mem=>{
mem.ban()
})

trail finch
#

help property

restive pebble
#

So this will work?

trail finch
#

hm i didnt got that

tulip ledge
#

if he has perms

sudden geyser
#

why would you want to do that

hazy sparrow
#

@hazy sparrow
@quartz kindle fixed it but still same error

restive pebble
#

Yes he has all

tulip ledge
#

But I think raid bots are against ToS

restive pebble
#

Just tell will that work

#

Idc about TOS

trail finch
#

lol

sudden geyser
#

Then should you tell be asking us

restive pebble
#

Or any other thing

quartz kindle
#

the forEach will be executed concurrently, which will flood the api, although discord.js will block it and queue it for you

restive pebble
#

Yea

#

Idc

trail finch
#

so u dc bout banning ur acc?

quartz kindle
#

in any case, it would be better to make it sequential

trail finch
#

i mean

#

ban from discrd

restive pebble
#

Hmmmm

#

I'll try

trail finch
#

hm

pure lion
#

Omg why would you do that

#

Also can I test it

restive pebble
#

I am just making a raid bot

pure lion
#

Epic

trail finch
#

umm i didnt understand the umm

pure lion
#

I wanna test

restive pebble
#

No

earnest phoenix
#

I am just making a raid bot
@restive pebble lmaooo

restive pebble
#

Not that

trail finch
#

*one of my command dosnt have help prop, so what should i do?

slender thistle
#

Idc about TOS
Cool

trail finch
#

sorry i am a beginner so

restive pebble
#

Yes

tulip ledge
#

Add the help property

restive pebble
#

Unless I'm not caught

pure lion
#

Lets kick boieieieieieing

restive pebble
#

Idc

hazy sparrow
#

wheres tim

earnest phoenix
#

wait why would you say that

trail finch
#

console.log(help.prop)

slender thistle
#

Walking on thin ice there buddy

earnest phoenix
#

Boeing are you good

trail finch
#

this?

pure lion
#

You realise Tim isn't the only person here

tulip ledge
#

no

pure lion
#

@hazy sparrow

digital ibex
#

lmao

#

im fucking dyinggg

trail finch
#

Lol

tulip ledge
#

In ur command files you need a module.exports.help = {//stuff}

restive pebble
#

Boeing are you good
@earnest phoenix why

trail finch
#

no bad words xD

#

hm

slender thistle
#

Keep this channel on topic

trail finch
#

owo ok

hazy sparrow
#

but hes the only person who i actually understand

digital ibex
#

O_O

pure lion
#

Damn he your therapist?

earnest phoenix
#

@restive pebble you usually don't act like this but we'll move on

tulip ledge
#

Hotel Shivaco

pure lion
#

Anyway what's the

#

Issue

restive pebble
#

Kek

pure lion
#

Okay I'm leaving this server that was so bad

digital ibex
#

?????

pure lion
#

I'm dead

#

On many levels

hazy sparrow
#

why?

tulip ledge
#

Why do I get like 3 spotify adds wtf is this

hazy sparrow
#

lol

digital ibex
#

wdym?

pure lion
#

I can't breathe rn 🎉

restive pebble
#

3 lmao

digital ibex
#

uh

#

quick question

tulip ledge
#

shoot

restive pebble
#

And yes since I'm making a raid bot I have to mass ping

#

Now suppose

digital ibex
#

if anyone knows, does anyone know why im getting this? client_loop: send disconnect: Connection reset by peer

tulip ledge
#

You're so gonna get banned

slender thistle
#

Stop discussing it

restive pebble
#

I'm using the guildCreate

hazy sparrow
#

boeing i want to donate to your raid bot to raid my server

restive pebble
#

How can I select a random channel

#

In the server

#

Pls help

hoary lily
#

uhm why
message.member.voice.channel
Returns undefined "voice"

slender thistle
#

Stop all this talk about raid bots now

restive pebble
#

Ah ok

tulip ledge
#

Just go loop on the channels and see if the type is a text channel and if the bot has perms to type in it

slender thistle
#

And keep this channel on topic, last warning

tulip ledge
#

Alright

earnest phoenix
#

Because member isnt in a voice channel @hoary lily

restive pebble
#

Ok

digital ibex
#

any ideas?

hoary lily
#

I'll again

restive pebble
#

Mongo?

digital ibex
#

me?

restive pebble
#

Yes

hazy sparrow
digital ibex
#

nope

restive pebble
#

And error also pls

hazy sparrow
digital ibex
#

its for my website

tulip ledge
#

@digital ibex Are u hosting it on your home pc?

digital ibex
#

im not

tulip ledge
#

As it mgiht be that the connections/requests are too much for your router to handle

restive pebble
#

@tulip ledge channel.me.hasPermission('SPEAK')?

#

How do I check

#

I am making a moosic bot

hazy sparrow
#

lol

digital ibex
tulip ledge
#

if(channel.permissionsFor(guild.me).has("SEND_MESSAGES"))

restive pebble
#

Oh semdessage

#

Ok thx

digital ibex
#

over 12+ hours

tulip ledge
#

mmmh weird

#

Then I don't know

#

🤷‍♂️

hazy sparrow
#

is anyone gonna solve my problem or what

jagged sun
#

Hey guys! How can I delete a role that I have the ID from with discord.js?

tulip ledge
#

<role>.delete() I assume

#

Let me double check tho

earnest phoenix
#

hello

hazy sparrow
#

hi

jagged sun
#

msg.guild.roles.get(<ID>).delete()

#

does not work

tulip ledge
#

Yeah role.delete()

digital ibex
#

errors?

earnest phoenix
#

bye

hazy sparrow
#

bye

digital ibex
#

bye

tulip ledge
#

Whats the error?

#

If the role is higher then the bot's role he can't delete it

#

Thats why you might wanna add a .catch() to it

#

Cuz you know "Gotta catch 'em all"

hoary lily
#

Hi why does
message.member.voice.channel
Returns

TypeError: Cannot read property 'voice' of undefined
jagged sun
#

TypeError: Cannot read property 'delete' of undefined

digital ibex
#

it cant find the role

tulip ledge
#

The user is not in a voice channel @hoary lily

hoary lily
#

I tried that already

tulip ledge
#

Are you using v12?

coral lichen
#

@jagged sun it cant find the thing you're trying to delete

hoary lily
#

Ye

tulip ledge
#

As you need to add a cache to it

hoary lily
#

Ooo

tulip ledge
#

No I'm talking to @jagged sun

jagged sun
#

@coral lichen i know that

#

how?

tulip ledge
#

Maybe you need to add cache to it aswell @hoary lily not sure tho

#

msg.guild.roles.cache.get(<ID>).delete()

digital ibex
#

other way around

coral lichen
#

just do msg.guild.roles.cache.get(<ID>).delete()

tulip ledge
#

Wait no

#

Yeah

coral lichen
#

oops

tulip ledge
#

Like that

digital ibex
#

msg.guild.roles.cache

coral lichen
#

we posted the same lmao

hoary lily
#

Ok I'll try

#

Thanks a bunch

hazy sparrow
digital ibex
#

i've asked you

#

to show

#

ur file tree

hazy sparrow
#

file tree?

#

you mean

digital ibex
#

yes

jagged sun
#

msg.guild.roles.cache
@digital ibex TypeError: Cannot read property 'get' of undefined

tulip ledge
#

For example

hazy sparrow
jagged sun
#

It can't get when using cache

digital ibex
#

what the actual fuck

jagged sun
#

msg.guild.roles.cache.get(<ID>).delete()

#

does not work

digital ibex
#

send the code ur using

hazy sparrow
#

me?

digital ibex
#

no

hazy sparrow
#

ok

tulip ledge
#

I just evaled this: console.log(message.guild.roles.cache.get("725026789574836315")) and it works tho

#

Meaning the ID is probably wrong

jagged sun
#

ah shit lemme try smthng

#

the id is an int in my db

tulip ledge
#

It needs to be a string

restive pebble
#

Kek

jagged sun
#

but does that matter?

tulip ledge
#

And ID needs to be a string

#

So idk what you're doing wrong

pure lion
#

Hotel shivaco is the best thing anyone has ever said here I'm sorry it's uncontested

hazy sparrow
#

oh guys i figured out my problem

quartz kindle
#

IDs need to be strings in js

tulip ledge
#

Lmao

hazy sparrow
#

Hotel shivaco is the best thing anyone has ever said here I'm sorry it's uncontested
@pure lion true

tulip ledge
#

Idk why I was like "shivaco" that sounds farmiliar and I was like a yeah "Hotel Trivago"

jagged sun
#

how can I make an int to string?

quartz kindle
#

because all js numbers are 64 bit floats, and IDs are larger than what 64bit float supports

tulip ledge
#

"${id}"

quartz kindle
#

so rounding occurs, and all your IDs become invalid

tulip ledge
#

Wait no

hazy sparrow
#

how can I make an int to string?
@jagged sun use "<id>" not <id>

tulip ledge
#

I'm stupid

#

U need backticks

misty sigil
#

"${id}"
@tulip ledge no

tulip ledge
#

`${id}`

#

Like that

quartz kindle
#

you need to store them as text in your database, and retrieve them as text

tulip ledge
#

I use varchar

pure lion
#

${} means template literal for those who don't know :D

tulip ledge
#

To store them

#

"Hotel Shivaco" is my first time on the starboard in 2 years of being in this discord lmao

misty sigil
#

mine was last month

pure lion
#

It's the best thing on the starboard

jagged sun
#

@jagged sun use "<id>" not <id>
@hazy sparrow I know, but I didn't have a var there

proud condor
#

Hey developers

#

I need help

misty sigil
#

with what

pure lion
tulip ledge
#

Don't ask to ask

misty sigil
proud condor
#

sorry

tulip ledge
#

Lmao I am braindead aparantly

proud condor
#

But I think it doesn't really matter

misty sigil
#

what api

tulip ledge
hazy sparrow
#

can you ask this person to ask me what is my problem pls

tulip ledge
#

Wait what

proud condor
tulip ledge
#

I just lost more braincells then I have trying to read that @hazy sparrow

proud condor
#

Is there a way to put an image in an embed if you don't have url?

hazy sparrow
#

lmao

tulip ledge
#

Whats ur question?

hazy sparrow
#

me?

tulip ledge
#

I don't think so let me pull up the discord py docs

#

No

proud condor
#

Like if I have the image opened with discord.File() function

#

Oh :c

tulip ledge
#

You need to specify a url

#

For as far as I've seen

proud condor
#

Thanks for help

tulip ledge
#

np

#

There mgiht be a way tho

#

And then went back to js

#

So I'm not that good 🤷‍♂️ I just looked at docs

quartz kindle
#

images in embeds have to be linked via an attachment url

proud condor
#

Currently the bot sends the image to a specific channel

tulip ledge
#

Parameters

    url (str) – The source URL for the thumbnail. Only HTTP(S) is supported.
proud condor
#

Then it gets url of the attachment

jagged sun
#

msg.guild.roles.cashe.get(${rid}).delete() still can't read property get

tulip ledge
#

Its cache

#

Not cashe

earnest phoenix
#

Not cashe

hoary lily
#

Does my beta app affects my bot's processes?

pure lion
#

Not cashe
The amount of times this happens here

jagged sun
#

lol bruh

hoary lily
#

I mean discord beta apk

pure lion
#

Nk

#

No

jagged sun
#

still lmao

tulip ledge
#

NOOO I was writing this really long mysql query in my cmd line and then I accidentally pressed arrow up 😦

jagged sun
#

😬

pure lion
#

AAAA

#

(don't use mysql but oof)

jagged sun
#

cache shows the same thing

quartz kindle
#

@proud condor you define a file with discord.File(path,name) right?

tulip ledge
#

Wdym don't use MySQL

pure lion
#

I don't*

tulip ledge
#

Oh ok

proud condor
#

@proud condor you define a file with discord.File(path,name) right?
@quartz kindle Yes

quartz kindle
#

then in your embed, you need to define the image url as "attachment://filename.png" for example

tulip ledge
#

Tim said MySQL should be fine so I'm sticking with MySQL

quartz kindle
#

the file name must be the same as you defined in the name parameter of discord.File

pure lion
#

using nosql x)<

quartz kindle
#

then you send both the file and the embed in the same message

proud condor
#

But I need to put the image into the embed

#

Using embed.set_image()

quartz kindle
#

yes

#

you set the url as "attachment://name here"

#

using the name from discord.File

jagged sun
#

What can I do here, it says it can't read property get of undefined msg.guild.roles.cache.get(`${rid}`).delete()

proud condor
#

using the name from discord.File
@quartz kindle Okay thanks

#

Let me try this

lusty quest
#

@jagged sun is the role cached?

quartz kindle
#

the file name needs to include the correct extension for it to show up correctly

#

.jpg or .png

#

or whatever discord supports

jagged sun
#

@jagged sun is the role cached?
@lusty quest no, it's just the ID

lusty quest
#

if its not cached you cant use the cache

proud condor
#

the file name needs to include the correct extension for it to show up correctly
@quartz kindle Ye i know

quartz kindle
#

roles are always cached by default

#

in regular d.js

#

Toby are you on v11 or v12?

hazy sparrow
#

cant i open 2 folders in VS code?

jagged sun
#

Toby are you on v11 or v12?
@quartz kindle v11

quartz kindle
#

wdym?

#

@jagged sun there is no .cache in v11

earnest phoenix
#

Anyone give me link of better antispam discord server

quartz kindle
#

use .roles.get()

jagged sun
#

so what else can I use then?

lusty quest
#

remove the .cache part

tulip ledge
#

remove the cache

earnest phoenix
#

Anyone give me link of better antispam discord server

hazy sparrow
#

yes but i cant give

earnest phoenix
#

@hazy sparrow give me in dm

jagged sun
#

Cannot read property 'delete' of undefined

hazy sparrow
#

@earnest phoenix read what i said

earnest phoenix
#

@hazy sparrow ok no problem

tulip ledge
#

the role doesnt exist then

quartz kindle
#

@jagged sun is the role id coming from your database?

lusty quest
#

@jagged sun you dont pass the id you pass a mention

jagged sun
#

the role doesnt exist then
@tulip ledge It does

#

@jagged sun is the role id coming from your database?
@quartz kindle Yess

#

@jagged sun you dont pass the id you pass a mention
@lusty quest It's the ID

quartz kindle
#

is the id stored as text in the database?

jagged sun
#

No, but it is then used as a string

lusty quest
#

````${id}``` should return the object not the id

quartz kindle
#

it doesnt matter

#

unless your database supports bigints, you cant store it as int

#

what database are you using?

jagged sun
#

${rid} I doestn't work like that?

quartz kindle
#

no

#

you can console.log(rid) and you'll see

lusty quest
#

remove the string parsing

tulip ledge
#

wait what

#

.toString() then?

jagged sun
#

remove the string parsing
@lusty quest It has to be a string then?

quartz kindle
#

it wont work, the id is already invalid

earnest phoenix
#

Pls some1 give me link of better antispam discord server

lusty quest
#

remove ${}

jagged sun
#

It worked

#

But it needs .toString after getting it from the DB

quartz kindle
jagged sun
#

and it didn't work with .delete, I had to use msg.guild.roles.delete(ID)

tulip ledge
#

wait does that mean that js is braindead?

quartz kindle
#

the moment javascript gets the value from the database as a number, the number loses precision, because it exceeds what 64 bit floats support

jagged sun
#

wait does that mean that js is braindead?
@tulip ledge think so...

hazy sparrow
lusty quest
#

if you use Mysql you could store it as Bigint

#

if you use mongoose you cant use Bigint

tulip ledge
#

wdym?

hazy sparrow
#

like

opal plank
#

having to use n on every operation for big int is annoying af

hazy sparrow
#

is it a field

tulip ledge
#

No

quartz kindle
#

whatever you do with the number afterwards doesnt matter, the precision is already lost

tulip ledge
#

Its .setDescription()

hazy sparrow
#

then?

#

oh ok

opal plank
#

string

#

then append n

#

parseint

#

dunno why you want the raw number tho

tulip ledge
#

what would happen if timestamps exceed 64 bits?

quartz kindle
#

the only way to reliably store large numbers in a database in js is if the database supports returning them as bigints, in a way that the value is never converted to a regular number

proud condor
#

@quartz kindle It's not working

quartz kindle
#

show code

proud condor
#

It just sends the embed without the image

#
file = discord.File(theMinefield[user].draw_field(), filename="minefield.png")
embed = discord.Embed(title="Minefield successfuly created!", colour=discord.Colour(0x3153))
embed.set_author(name=user, icon_url=user.avatar_url)
embed.set_image(url="attachment://minefield.png")
await ctx.send(embed=embed)
quartz kindle
#

you need to send the image

#

ctx.send(embed=embed,file=file)

proud condor
#

Okayy

#

Oh it's working

#

I thought it will send the embed and the image separately

#

Thanks

tulip ledge
#

are u making a minesweeper?

quartz kindle
#

the attachment:// is what links them together

#

without it, they will show up separately

proud condor
#

Yeah i understood, thanks

#

are u making a minesweeper?
@tulip ledge yes lol

tulip ledge
#

like interactive?

proud condor
#

wdym?

tulip ledge
#

like not like ZeroTwo's

#

Where it is like ||bomb||||1||

proud condor
#

ZeroTwo has minesweeper?

#

lol

tulip ledge
#

yeh

proud condor
#

I didn't know okay

tulip ledge
#

i once made a minesweeper in the browser

proud condor
#

Nice

#

Using JavaScript?

slender thistle
#

How would minesweeper work in browser?

tulip ledge
#

But I always wanted to make one in djs but idk It would be pretty hard as users can't rlly select what spots to chedck in discord

#

Yes using JS

slender thistle
#

is it a huge 2D array if buttons?

tulip ledge
misty sigil
#

How it would work generally, I'd assume

slender thistle
#

Oh nice

tulip ledge
#

You make a 2D array

#

And a Cell class or something

#

And store the cells in the array

proud condor
#

Ye i have the same

tulip ledge
#

And then check if the users clicks a certain pixel then calculate what x and y it si in the 2D array and reveal it

#

You also have some calculations to calculate the number, floodfill etc

proud condor
#

Oh you meant like you can click the tiles?

hazy sparrow
tulip ledge
#

Yes

proud condor
#

No it's just using commands

tulip ledge
#

Or you type like E5 or something

proud condor
#

Using a command and row, column numbers

earnest phoenix
#

+yardım yetkili

tulip ledge
#

@hazy sparrow Code?

hazy sparrow
#

wait

jagged sun
#

This **** still retarded

#

It does not delete

hazy sparrow
tulip ledge
#

client.commands.get('foohelp').execute(message);

#

foohelp as no execute exports

#

And dont if else stack when using a command handler

#

Just do like if(client.commands.get(cmd)) client.commads.get(cmd).execute(message)

hazy sparrow
#

what??

#

Just do like if(client.commands.get(cmd)) client.commads.get(cmd).execute(message)
@tulip ledge what??

tulip ledge
#

instead of doing

if(message.content.startsWith(`${prefix} help foo`))

Do what I said

#

it'll remove alot of lines

quartz kindle
#

ah the classic "build a command handler and dont actually use the handling part"

hazy sparrow
#

instead of doing

if(message.content.startsWith(`${prefix} help foo`))

Do what I said
@tulip ledge still did not understand

quartz kindle
#

command handlers exist exactly so you dont need to if else every single command you have

#

instead of if else every single command, you just check if command exists

#

thats what a command handler is made for

hazy sparrow
#

eh whatever

#

you guys never solved my problem

quartz kindle
#

instead of js if(a) {} else if(b) {} else if(c) {} else if(d) {} else if(e) {} you simply do ```js
if(commands.has()) {
commands.get.execute()
}

#

because your commands are already inside a list, that you made with readdir and commands.set
you dont need to check each one of them separately, you check if it exists in the list

hazy sparrow
#

so its

commands.get.execute('foo`)
}
tulip ledge
hazy sparrow
#

the problem is in ping help

#

foohelp is working fine

quartz kindle
#

cannot read execute of undefined, in your case, it means that the command doesnt exist

hazy sparrow
#

hmm

#

oh im a stupid

quartz kindle
#

and that problem will not happen if you use the commands.has method, because non-existent commands will not be executed

hazy sparrow
#

i added the file in a wrong folder

#
 commands.get.execute('foo`)
} 

like this tim @quartz kindle

opal plank
#

oh fuck

quartz kindle
#

you need to adjust it to fit your code

opal plank
#

thats actually a good call, i just voided the errors instead of using has

#

i was doing get()

quartz kindle
#

well you can do whichever

#

you can also do this ```js
cmd = commands.get()
if(cmd) { cmd.execute() }

opal plank
#
try {
cmd.get(command).execute()}
catch {}```
quartz kindle
#

oh lmao

hazy sparrow
#

i understand what you say but i dont understand the code

opal plank
#

it just tries, if errors, void it

quartz kindle
#

@hazy sparrow all your commands are stored in client.commands correct?

hazy sparrow
#

ahh ok

#

not all

#

1 is stored in client.helpcommands

quartz kindle
#

i dont see any client.helpcommands.set in your code

hazy sparrow
quartz kindle
#

thats empty

#

it has no commands in it

hazy sparrow
#

it has a helpping.js

quartz kindle
#

where do you set it?

hazy sparrow
#

what?

quartz kindle
#

i dont see any client.helpcommands.set

opal plank
#

you making a map

#

but it has nothing in it

#

Discord.Collection() is a Map extension.

hazy sparrow
#

oh shi

quartz kindle
#

that doesnt matter

opal plank
#

after you make that map, you need to map key/values

hazy sparrow
#

ive done client.commands.set twice

quartz kindle
#

yes, so your helpping command is also stored in client.commands

#

and honestly, keep it that way

hazy sparrow
#

okay

quartz kindle
#

its better to keep all commands in the same storage

#

just remove the client.helpcommands line

hazy sparrow
#

ok

quartz kindle
#

so now that all your commands are in client.commands

#

client.commads has .get() and .has() methods, so you can quickly get a command, or check if a command exists

#

in this part you define a command variable, which represents the first word of the message, after the prefix. which means, this word is the name of the command

hazy sparrow
#

but the reason i wanted a seperate folder for help commands is because this

quartz kindle
#

therefore, command is the name of the command

opal plank
#

@hazy sparrow later down the lines, there a guides to show you use put the help on the module exports

#

so you can call it dynamically

quartz kindle
#

so all you need to do is client.commands.get(command) to get a command, or client.commands.has(command) to check if the command exists

hazy sparrow
#

ahh ok

quartz kindle
#

so you have two options

#

first check if the command exists, and then if it exists, get it and run it

#

or

#

get the command first, and if you got a valid command, run it

hazy sparrow
#

ill go with the first one

#

client.commands.get

quartz kindle
#

the first option would translate to ```js
if(....has(command)) {
....get(command).execute()
}

#

the second option would be ```js
let cmd = ....get(command)
if(cmd) {
cmd.execute()
}

#

both do the same thing, just in a different way and order

#

check if it has it, if it has it get it, execute it
or
get it, if it exists execute it

restive willow
#

anyone making a coin system w/ mongodb because mines just not working
@earnest phoenix still need? I made one yesterday