#development

1 messages · Page 1050 of 1

delicate shore
#

it's

earnest phoenix
#

choose a random pic from an array THAT"S IT

delicate shore
#

difficult

#

choose a random pic from an array THAT"S IT
@earnest phoenix API...

earnest phoenix
#

i can show you my code

spare mirage
#

use Cheerio

earnest phoenix
#

THAT AIN'T SPOONFEED

spare mirage
#

@delicate shore use cheerio

delicate shore
#

my current commnd list

#

if it's enough

earnest phoenix
#

notepad is dead from the amount of stuff in my index.js

spare mirage
#

lol

earnest phoenix
#

imma type it out

spare mirage
#

imma just use ytdl

#

fk it

delicate shore
#

ok

#

don't type

earnest phoenix
#
function pickRandom() {
    return "Just copy code from stackoverflow for the methof i did this";
}
var dogpics = ["a","heck","load","of","pics uploaded to imgur"];
//some shenanigans
if (command === "dogpicture") {
    message.channel.send(`A random dog picture: ${pcikRandom(dogpics)}`);
}
#

that's it

#

literally it

delicate shore
#

really

earnest phoenix
#

yeah

#

lemme copy screenshot my code

delicate shore
#

Just copy code from stackoverflow for the methof i did this"?

earnest phoenix
#

imma tell you

delicate shore
#

k

spare mirage
#

use cheerio :3

delicate shore
#

hnm

#

m

#

m

#

,

earnest phoenix
#

do you want the whole array of dog pics

spare mirage
#

dumb

earnest phoenix
#

your pfp says it all

#

and he might NEED it

spare mirage
#

lol

#

@delicate shore use cheerio

#

and require```js
function image(message, parts) {

/* extract search query from message */

var search = parts.slice(1).join(" "); 

var options = {
    url: "http://results.dogpile.com/serp?qc=images&q=" + "doggo",
    method: "GET",
    headers: {
        "Accept": "text/html",
        "User-Agent": "Chrome"
    }
};```
delicate shore
#

ok

#

ok

#

ok

#

okok

#

oko

#

kok

spare mirage
#

only message is enough

#

btw

delicate shore
#
  
if(command === "cat") {
  //catty
        try {
            fetch('http://aws.random.cat/meow')
        .then(res => {
                msg.channel.send({files: [{attachment: res.body.file, name: `cat.${res.body.file.split('.')[2]}`}]});
            });
        } catch(err) {
            return msg.channel.send(err.stack);
        }
    }```
spare mirage
#

and u dont need search

delicate shore
#

i made this

#

the best way

spare mirage
#

thats also a gud idea

delicate shore
#

lmao

earnest phoenix
#

@delicate shore

function pickRandom(warray) {
  var randomNumber = Math.floor(Math.random() * warray.length);
  return warray[randomNumber];
}
var doges = [
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fpuppy-1903313__340.webp?v=1593084690595",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fpug-801826__340.webp?v=1593084694122",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fpug-690566__340.webp?v=1593084700772",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fpets-4415649__340.webp?v=1593084704596",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fhusky-3380548__340.webp?v=1593084709666",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-3277416__340.webp?v=1593084714281",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-2785074__340.webp?v=1593084720651",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-1224267__340.webp?v=1593084730544",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-1168663__340.webp?v=1593084733684",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-1168663__340.webp?v=1593084733684",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-838281__340.webp?v=1593084737829",
  "https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fbulldog-1047518__340.webp?v=1593084740577"
];
var randomdoge = pickRandom(doges);
if (command === "dogpicture") {
    message.channel.send("Random doggo:"+pickRandom(doges));
}
delicate shore
#

oh jesus

earnest phoenix
#

the links are long that's it

delicate shore
#

jesus christ

#

lmao

#

you uploaded all the photos

#

in your modules section?

earnest phoenix
#

this hurts my soul

#

store your array somewhere

#

this is all that matters:

function pickRandom(warray) {
  var randomNumber = Math.floor(Math.random() * warray.length);
  return warray[randomNumber];
}
var doges = [
  "insert pics","here"
];
var randomdoge = pickRandom(doges);
if (command === "dogpicture") {
    message.channel.send("Random doggo:"+pickRandom(doges));
}the only part is this:
#

store your array somewhere
@earnest phoenix no

#

recreating it each and every time the command is executed degrades your performance

#

i suck at everything don't wanna cause errors

#

recreating it each and every time the command is executed degrades your performance
@earnest phoenix wtf im not i am just running a function and passing the whole array

#

yeah... but you're recreating it

delicate shore
#

my bot

#

is not going online

#

f

#

RIp

hazy iris
#

Check terminal

#

Or logs

delicate shore
#

i did

#

it says no package found

slender thistle
#
bot.on("message", function(message)
{
    if message.content.startsWith("pictures yeet")
    {
        // recreate the array on each command usage
        let dogs = ["picture 1", "picture 2"];
        // random element from `dogs`, etc.
    }
})```
delicate shore
#

so i did enable-npm

hazy iris
#

Did it say any error?

delicate shore
#

no

hazy iris
#

Weird

#

Try starting it again

#

Or just wait a bit

delicate shore
#

i am downloading

#

whole packages

#

again

hazy iris
#

Okay

delicate shore
#

how to comment out multiple

#

lines of codes

#

at once

earnest phoenix
#

varies from language to language

pure lion
#

In js it's /**/

delicate shore
#

discprd.js

pure lion
#
/*
This
Is
A
Comment
*/```
delicate shore
#

ok

#

thnx

indigo cloud
#

i am getting in line 45 an error
TypeError: Cannot read property 'then' of null

earnest phoenix
#

have you tried reading the error

indigo cloud
#

i did tho i dont know how to fix

earnest phoenix
#

fetch returned null

#

go from there

indigo cloud
#

yea ik tho the problem is i have no clue on how to fix it sorry if i seem rude btw

fringe axle
#

I have a small problem:
var chan = this.client.guilds.first().channels.get(channelid)
I want that every guild is list here. That I can use every guild channel

#

Not only the first guild

delicate shore
#

my error

#
if(command === "cat") {
  //catty
        try {
            fetch('http://aws.random.cat/meow')
        .then(res => {
                msg.channel.send({files: [{attachment: res.body.file, name: `cat.${res.body.file.split('.')[2]}`}]});
            });
        } catch(err) {
            return msg.channel.send(err.stack);
        }
    }
#

my code

earnest phoenix
#
bot.on("message", function(message)
{
    if message.content.startsWith("pictures yeet")
    {
        // recreate the array on each command usage
        let dogs = ["picture 1", "picture 2"];
        // random element from `dogs`, etc.
    }
})```

@slender thistle i said I'm not recreating it

delicate shore
#

help pls

earnest phoenix
#

Is the code i provided earlier working?

delicate shore
#

no

#

o

digital ibex
#

what are you trying to do?

slender thistle
#

Why in living God's name is my Delphi program adding a string to Memo2.Text instead of Memo1.Text when I use Memo1.Text := Memo1.Text + #10 + inttostr(a[i]) CatThink

digital ibex
#

and whats your issue?

delicate shore
#

ok

#

scroll. up

#

i wanna show pics

#

of cats

earnest phoenix
#

Then you make another array

#

Dumb

digital ibex
#

can u just send it

earnest phoenix
#

And pickRandom(thenameofthecatarray)

digital ibex
#

i really cant be bothered to scroll up

earnest phoenix
#

Returns a random one

delicate shore
#

@digital ibex

earnest phoenix
#

Why go for harder methods

delicate shore
#

that is easy

earnest phoenix
#

Smh

delicate shore
#

i am using that only

#

that is giving me error

digital ibex
#

using an api is hard? PepeYikes

earnest phoenix
#

Now that's the definition of easy smh

#

using an api is hard? :PepeYikes:
@digital ibex if you are using it instead of an easier method that a guy named code913spent so long to type

#

You can copy my source ckde and BOOM donr

pure lion
#

using an api is supposed to be easy thats the idea of an api

digital ibex
#

im not sure what that meant

#

but ok

delicate shore
#

@earnest phoenix i am using your code only!! for dog command

#

and i am thankful

#

to u

earnest phoenix
#

Wtf i reused that code for 47 other commands

delicate shore
#

for that

fringe axle
#

I have a small problem:
var chan = this.client.guilds.first().channels.get(channelid)
I want that every guild is list here. That I can use every guild channel
Not only the first guild

earnest phoenix
#

And i don't get a single error

digital ibex
#

lol

earnest phoenix
#

You just use my method temporarily and learn the API one then use it

pure lion
#

x)

delicate shore
#

ok

#

i am using api

#

for others

#

but for this one command

#

i am getting error

#

ahh

earnest phoenix
#

Learn it first i said...

digital ibex
#

yes

#

learn

#

with this

delicate shore
#

ok

digital ibex
#

not hard code the images u want

delicate shore
#

i use API

#

for meme

#

and others

earnest phoenix
#
if(data) {

                if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("Nu ai permisiunea sa faci asta ! | Permisiune necesara: Administrator");

                let newPrefix = args[0];

                if(!newPrefix) return message.channel.send("Trebuie sa specifici un prefix!");

                Prefix.findOneAndUpdate(
                    { GuildID: message.guild.id }, 
                    { Prefix: newPrefix }
                );

                message.channel.send(`Prefixul a fost setat la ${newPrefix}`);

            }

Why the data don't update?

delicate shore
#

like insult

digital ibex
#

if u want certain images, make ur own api

#

wut

pure lion
#

@earnest phoenix what is data

#

Oh you're using mongoose

digital ibex
#

whats 'Prefix' ?

pure lion
#

Args[0] X)

earnest phoenix
#

like insult
@delicate shore you asked for how to make the dog command, i told you how, then you use an API and ask us how to fix an error because you didn't learn how that API works and i am NOT insulting you

pure lion
#

Data = await the search for the guild ID

earnest phoenix
#
const Prefix = require("../../models/Prefix");

model file code :

const mongoose = require("mongoose");

const Schema = new mongoose.Schema({
    GuildID: String,
    Prefix: String
})

module.exports = mongoose.model("Prefix", Schema);
digital ibex
#

no the 'Prefix.findOneAndUpdate'

pure lion
#

Basically

#

Oh

earnest phoenix
#

like insult
@delicate shore you asked for how to make the dog command, i told you how, then you use an API and ask us how to fix an error because you didn't learn how that API works and i am NOT insulting you

^^^did you read this?

digital ibex
#

dont make a collection for each thing like prefix, logs, mods or whatever, i believe its just gonna use more ram and storage than needed

earnest phoenix
#

So should i only make a GuildConfig and then an array of settings ?

digital ibex
#

you need to await it, also

#

that could work

#

its however you wanna do it

earnest phoenix
#

I'll update that later, but first i want to know why the data don't update

digital ibex
#

await it

#

so await Prefix.findOneAndUpdate

earnest phoenix
#

Hello, in my ! User-info command I would like the bot to give me the role of the person on the server, do you know what I should add?

#

and that will solve the problem ?

digital ibex
#

try it

#

aware, what library?

earnest phoenix
#

Yes it worked

#

Thank you

#

Hello, in my ! User-info command I would like the bot to give me the role of the person on the server, do you know what I should add?
@earnest phoenix no offense but idk

pure lion
#

@earnest phoenix which role?

#

noreplyhuh

earnest phoenix
#

I am creating a bot, and I would like to have the text in value so that when I do ! User-info my bot gives me the roles that I have

delicate shore
#
if(command === "cat") {
  let msg2 = await msg.channel.send("Fetching a image, please wait a second!");
    fetch("http://aws.random.cat/meow")
      .then(res => res.json())
      .then(json => {
        let embed = new Discord.MessageEmbed()
          .setTitle(json.title)
          .setImage(json.url)
          .setFooter(`Dogs are better?`)
        msg2.edit(embed);}
            
)}
#

how to solve this

#

eroooooor

pure lion
#

u h

#

log the json and show me

delicate shore
#

oh nmv

#

i got it

earnest phoenix
#

bro

#

APIs suck

lusty quest
#

does someone know if you can save mutiple tings into one field with mongodb? want to store mutiple roleids under one key

#

APIs are ez

earnest phoenix
#

Just tell me how many libraries including discord.js are that are nothing but an easier version of Discord API

lusty quest
#

all of them?

#

bcs this is what they are?

slender thistle
#

They are supposed to be API wrappers so

earnest phoenix
#

Nvm

digital ibex
pure lion
#

Is findMany decapricated?

#

It doesn't appear if i type it in :/

indigo cloud
pure lion
#

okay about to launch xp

#

wish me luck

lusty quest
#

iirc find will also find all keys containing the item you searched

sudden geyser
#

@indigo cloud .fetch(...) does not return a promise.

indigo cloud
#

u know how to fix it

#

bc i used to use db.fetchObject tho they updated it

#

and so i made i replaced it with fetch

sudden geyser
#

You can fix it by not treating it like a promise.

#

You have the value there.

#

If it's null it means nothing was found.

indigo cloud
#

ik

pure lion
#

*stress noises*

sudden geyser
#

findMany in what. MongoDB?

pure lion
#

no its fine i fixed it now :D

#

Aka my XP system is working

#

Minus one small thing

#
(node:26556) UnhandledPromiseRejectionWarning: CastError: Cast to Number failed for value "NaN" at path "XPtotal"
#

nvm i didnt refresh the db yet x)

tulip ledge
#

So I' mworking on this dungeon system and have people party up and I have put the ID of the users in an array like this:
["user1", "user2", ...]
Now every user has stats like health defense strength etc... and when attacking I need to access these stats would it just be smart to do a while loop and query the database every time? Or make a class in advance and save the classes in a different array and access these?

lusty quest
#

i would make a template and store each user in its own entry. If something happens get all users that are participating on the event

pure lion
#

YOOOOOOO MY XP SYSTEM WORKS

tulip ledge
#

I have no clue what that means tho

#

I'm currently working on this class:

class Player {
  constructor(health, defense, strength, cc, cd, weapon) {
    this.health = health,
    this.defense = defense,
    this.strength = strength,
    this.cc = cc,
    this.cd = cd,
    this.weapon = weapon
  }
  takeDamage(bossDamage) {
    // TODO
    // Calculate player damage reduction
    // Calculate boss Damage
    // Remove damage from this.health
  }
}
lusty quest
#

looks fine

tulip ledge
#

Alright

#

I can just overwrite the this.health with this.health = newhealth

#

Right

#

I'm pretty new to classes

lusty quest
#

idk, i never used classes.

tulip ledge
#

Oh

lusty quest
#

had no use case for them. there was probably one i worked around with some stupid stuff

tulip ledge
#

Does anyone know if I can do like this:

class Player {
  constructor(health, defense, strength, cc, cd, weapon) {
    this.health = health,
    this.defense = defense,
    this.strength = strength,
    this.cc = cc,
    this.cd = cd,
    this.weapon = weapon
  }
  takeDamage(bossDamage) {
    // TODO
    // Calculate player damage reduction
    // Calculate boss Damage
    // Remove damage from this.health
    this.died()
  }
  died() {

  }
}
#

Will that work?

tight plinth
tulip ledge
#

The issue is

#

I would have to write everything to get the basics of that

#

Would take me prob around 1-2hours

#

To then realise if it works or not 🤷‍♂️

tight plinth
tulip ledge
#

I just need to know if you can call a method inside a method

tight plinth
#

actually

#

remove this.

#

but make sure to first initialize the function and then using it

pure lion
#

aaaaaaaaaa the levels arent working

tulip ledge
#

Ok

pure lion
#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa i fixed it

tulip ledge
#

So I would do like if(mobdmg >= this.health) return died();

pure lion
#

i cant believe i made a leveling system on my own (with guidance from tim, flaz and superbrain but i wrote it myself) i am so proud of me :D

tulip ledge
#

Right?

#

Good job!

pure lion
#

:D ty

earnest phoenix
#

quick.db is the easiest worst database library

#

i cant believe i made a leveling system on my own (with guidance from tim, flaz and superbrain but i wrote it myself) i am so proud of me :D
@pure lion me is more proud because i made an economy system with no help

tulip ledge
#
class Player {
  constructor(health, defense, strength, cc, cd, weapon) {
    // Constructor stuff
  }
  died() {
    return 'You died!';
  }
  takeDamage(bossDamage) {
    // Calculation stuff
    if(mobdmg >= this.health) return died();
    this.health -= mobdmg;
    return [this.health, mobdmg]
  }
}
  

ReferenceError: died is not defined

#

Ok nvm

earnest phoenix
#

Wtf

pure lion
#

where is died supposed to be defined

tulip ledge
#

It's this.died()

pure lion
#

oh-

tulip ledge
pure lion
#

also how do you make methods?

tulip ledge
#

You need to do this.died()

earnest phoenix
#

Lmfao you died in an undefined way

tulip ledge
#

@pure lion

class Player {
  constructor(health, defense, strength, cc, cd, weapon) {
    // Constructor stuff
  }
  died() {
    return 'You died!';
  }
  takeDamage(bossDamage) {
    // Calculation stuff
    if(mobdmg >= this.health) return died();
    this.health -= mobdmg;
    return [this.health, mobdmg]
  }
}
  

constructor is to create the class and died() and takeDamage() are methods that are accessed like this:
let Player1 = new Player(stuff)
Player1.takeDamage()

pure lion
#

ohkayyyy got it

lusty quest
#

are there events in d.js that listen to removed roles or added roles besides guildMemberUpdate?

pure lion
#

Not sureee

#

Also can you help me? I'm not sure how to index stuff like multiple docs when they share a key (guild ID)

lusty quest
#

did you have something that is unique? like a userid?

pure lion
#

Yeah

#

But what if the user joins in another guild with the bot

lusty quest
#

usually i would use the guildid as primary key. Why did you have mutiple keys inside the same guild?

pure lion
#

Because there's a new doc for every user

lusty quest
#

this should be always unique

pure lion
#

Okay

#

Got it now, thankyaaaa

earnest phoenix
#

How to get a specific data from mongodb ? like if i want to get a value from a guildsetting ?

lusty quest
#

findOne

#

i suggest using the guildID as key

#

this will return the entire document for the guild

earnest phoenix
#

i don't really understand

#

i have the findone here

#

        ReportChannel.findOne({ GuildID: message.guild.id }, async (err, data) => {
            if(err) console.log(err);

            if(!data) return message.channel.send("Canalul de reporturi nu este setat pe acest server ! Roaga un administrator sa il seteze folosind comanda $reportchannel");
            if(data) {
                let member = message.mentions.users.first() || client.users.cache.get(args[0]);
                let bReason = args.join(" ").slice(22);

                if(!member) return message.channel.send("Trebuie sa specific un utilizator !"); 
                if(!bReason) return message.channel.send("Trebuie sa specifici motivul pentru care ai raportat aceasta persoana!");

            }
        })
#

how can i get a data from that ? like a channelid

#

or smth

lusty quest
#
config = await model.findOne(message.guild.id)
console.log(config)
#

try this

tulip ledge
#

So I have this array of numbers: [25, 36, 23, 45]
I want to check if one of the number is 10 or more larger then one of the others. Is there a way to do that?

earnest phoenix
#
config = await model.findOne(message.guild.id)
console.log(config)

and then how i will get the channel from the specific guild ?

#

like, how i'll define it

lusty quest
#

you can get your keys then with config.channelid

#

but this requires you to set a value with the channelid

#

(inside the database)

earnest phoenix
#

ok, i understand now

#

if i have in the model channelid saved as Channel i do config.Channel ?

lusty quest
#

yes

earnest phoenix
#

Ok, thank you

#
let config = await ReportChannel.findOne(message.guild.id);
                let channel = bot.channels.cache.get(config.Channel);

so this should work ?

lusty quest
#

@tulip ledge idk i wish i could help but i have no idea how to do it properly without a stupid workaround

tulip ledge
#

I was thinking of running a forloop and then comparing that with all the elements in the array

#

But that will be unefficient right?

#

Since I just want to check if the user's levels are too far appart

#

So like you can't have a level 50 carry a level 5 in a dungeon

lusty quest
#

give it a shot. maybe some smarter person ends in here and give you a way more efficent way

tulip ledge
#

Like Tim?

#

Speak of the devil lmao

quartz kindle
#

if(Math.max(10,20,30,40) - Math.min(10,20,30,40) > 10) console.log("level diff too high")

#

lmao

tulip ledge
#

I mean mine would still be ok as the array is either 2, 3 or 4 long

earnest phoenix
#

(node:16808) UnhandledPromiseRejectionWarning: ObjectParameterError: Parameter "filter" to findOne() must be an object, got 704974227626786827

                let config = await ReportChannel.findOne(message.guild.id);
tulip ledge
#

Oh shit

#

Ok

#

That works with an array too?

pure lion
#

XP system is pain in ass

quartz kindle
#

Math.max(...array)

#

you need the ... operator for arrays

tulip ledge
#

Ok

quartz kindle
#

yup, should work

lusty quest
#
   const config = await shema.findOne({ guildID: guild.id });
``` @earnest phoenix
quartz kindle
#

basically the highest level in the party should not be more than 10 levels above the lowest level

tulip ledge
#

Omg

#

Tim big brain

#

Thank you lol

#

Oh now I understand what Math.min and Math.max do

#

I mean this dungeon thing is going so well

pure lion
#
(node:24380) UnhandledPromiseRejectionWarning: MongoError: E11000 duplicate key error collection: test.guildmembers index: guildID_1 dup key: { guildID: "710964023117479966" }
#

aaaaaaa

lusty quest
#

you got a duplicated key

pure lion
#

its not even being searched for

#
  const Mdata = await GuildMember.findOne({ID: msg.guild.id + msg.author.id})

w e h

lusty quest
#

this will not work i guess

#

make a value with your id and then pass it to your DB query

pure lion
#

ok

lusty quest
#

also make sure you send the dataset to your DB first

pure lion
#

alright

tulip ledge
#

Okay now I have to make the thing where players can "move" so would I do like a while loop that keeps going untill either all players are dead or the boss is dead and inside the while loop a for loop that allows the players to move? As when a player dies they get removed from the players array. Should i do it like that or is there a better way?

lusty quest
#

also i think the error is on a different position

pure lion
#
    if (!Mdata) {
      const db = new GuildMember(newUser)
      db.save()
      console.log(db)
    }

btw this is what i use for creating a new user

lusty quest
#

this looks fine.

cinder patio
#

is that sequelize? mongoDB/mongoose?

pure lion
#
async function xp(msg) {
  const Gdata = await Guild.findOne({guildID:msg.guild.id})
  if (Gdata.XP == false) return
  var prefixes;
  if (Gdata == null) {
    prefixes = 'aa!'
  } else {
    prefixes = Gdata.prefix
  }

  const newUser = {
    _id: mongoose.Types.ObjectId(),
    ID: msg.guild.id + msg.author.id,
    guildID: msg.guild.id,
    userID: msg.author.id,
    xp: 0,
    level: 1,
    enabled: false
  }

  const Mdata = await GuildMember.findOne({ID: msg.guild.id + msg.author.id})
  console.log(Mdata)
  var newLevel;
  if (Mdata == null) {
    newLevel = 1 * 500
  } else {
    newLevel = Mdata.level * 500
  }
  if (msg.content.startsWith(prefixes)) {
    return
  } else {
    var randomInt = Math.floor(Math.random() * 10) + 15
    if (!Mdata) {
      const db = new GuildMember(newUser)
      db.save()
      console.log(db)
    } else if (Mdata) {
      await Mdata.updateOne({xp: Mdata.xp + randomInt})
      await Gdata.updateOne({XPtotal: Gdata.XPtotal + randomInt})
    }
    if (Mdata.xp > newLevel) {
      await Mdata.updateOne({level: Mdata.level + 1})
      await Mdata.updateOne({xp: 0})
      if (Gdata.XPmsg == false) {
        return
      } else {
        msg.channel.send(`GG ${msg.author}, you leveled up to ${Mdata.level}!`)
      }
    }
  }
}

heres the full function if it helps

lusty quest
#

@cinder patio mongoose

pure lion
#

ive deleted the document and tried again btw

tulip ledge
#

Okay now I have to make the thing where players can "move" so would I do like a while loop that keeps going untill either all players are dead or the boss is dead and inside the while loop a for loop that allows the players to move? As when a player dies they get removed from the players array. Should i do it like that or is there a better way?

lusty quest
#

@tulip ledge i guess i would use Reactions for this

#

use the onReaction event

tulip ledge
#

I was more thinking of a awaitMessages tho

lusty quest
#

or how its called

#

also works

tulip ledge
#

I've yet to use onReaction

#

I always used reaction collectors

pure lion
#
players.forEach(/*move*/)
tulip ledge
#

That won't work

#

As I would have to loop it

pure lion
#

oh

pale vessel
tulip ledge
#

And forEach will loop untill all players did it and then stop

#

It would have to keep looping

lusty quest
#

gg

tulip ledge
pure lion
#

cumfused<

pale vessel
#

😳

tulip ledge
cinder patio
#

Dice, you do know that you can search for both guildID and userId, right?

pale vessel
pure lion
#

yes but it would return as duplicate keez

#

like its doing rn

#

for some reason

pale vessel
#

no, use updateOne with upsert option on

pure lion
#

. ?
🎲

cinder patio
#

ChickenDev, you can do this without looping, depends on what your logic is for the game

pale vessel
#

it will try to find the member and if it doesn't exist, it creates the member with all the data you provided

pure lion
#

:o

#

thatssouseful

pale vessel
#

updateOne({ guildID: "123", memberID: "122" }, { "xp": 69 }, { upsert: true });

#

this doesn't create any duplicate

tulip ledge
#

@cinder patio It goes like this: The user can do a move (either attack or a heal) then the boss attacks him, then the next user does the same and so on... untill either the boss is dead, all users are dead or the move count has gone down to 0

pale vessel
#

if it finds it, it updates it, if not, it creates it

#

simple 5Head

pure lion
#

i have terminal stupidity gimme a minute

tulip ledge
pure lion
#

how would it create the whole object for the user

cinder patio
#

You can do the check for 0 moves / boss dead / all players dead after the boss attacks, and the boss can attack right after the player does attack or heal. That way you have no loops

tulip ledge
#

Oh

#

You mean I need to call a function?

#

And then recall that function

cinder patio
#

Sure

tulip ledge
#

Inside the function

pure lion
#

flaz would it create a whole new object and set the xp to 69?

pale vessel
#

it combines it

#

yes

#

it combines with the filter

tulip ledge
#

I'd still need a for loop on the players right?

cinder patio
#

yea

quartz kindle
#

so you need each player to make a move in the form of an answer or reaction or command?

tulip ledge
#

Or do I do like:
function move(player) {
}
move(players[i])

pure lion
#

alright im gonna go and try that, i hope i dont die :D

tulip ledge
#

Yes

pale vessel
#

nah you're good

tulip ledge
#

Like you type:

#

attack

#

And you attack if it's your turn

#

Or heal

#

And you heal

quartz kindle
#

what if you dont make a move, does it skip your turn after 10 seconds?

tulip ledge
#

Yes

#

Thats the plan

#

The boss will attack you and you haven't done anything

quartz kindle
#

alright so i guess awaitMessages is ok for this

tulip ledge
#

and a .catch then?

cinder patio
#

Could use a collector instead

quartz kindle
#

error throwing is optional in message collectors

tulip ledge
#

So I would make a function inside the function forloop on the players array inside there I do awaitMessages

#

Am I right?

quartz kindle
#

it doesnt throw an error by time limit if you dont make it

pure lion
#
    GuildMember.updateOne({ID:msg.guild.id + msg.author.id}, {upsert: true})

like this? (guildmember is the constructor)

tulip ledge
#

Weird it does for me

lean pike
#

Guys i have Q: I need to use mongodb in a glitch, but i dont know how to link db to website

tulip ledge
#

It sais <Collection> blabla

#

If no one responds to it

quartz kindle
#

what you need here is probably a recursive function

tulip ledge
#

Without a catch

pure lion
#

setinterval?

tulip ledge
#

Like function move() {
if() move()
}

#

Right

quartz kindle
#

do you have errors:["time"]in the collector options?

tulip ledge
#

yes

quartz kindle
#

then thats why

tulip ledge
#

Oh

#

So if I remove it

#

I get no error

quartz kindle
#

if you remove it, it wont throw an error, it will just return an empty collection

tulip ledge
#

Oh ok

#

And if the collection is empty

#

I just do nothing

#

And move on to the boss attack

quartz kindle
#

yeah

#

or next players

tulip ledge
#

Ok

#

Alright

#

and a recursive function is like
function move() {
if() move()
}

#

Right?

quartz kindle
#

yes

tulip ledge
#

Ok

#

I'll try

#

Wish me luck lmao

quartz kindle
#

good luck

#

make the whole battle loop a recursive function

#
function makeMove(player) {
  blablabla
  makeMove(next player)
}
pure lion
#

Okay wish me luck too x)

#

Brb

quartz kindle
#

good luck lmao

pale vessel
#

@pure lion if it doesn't work, try GuildMember.updateOne({ID:msg.guild.id + msg.author.id}, {}, {upsert: true}) (empty document as second argument)

pure lion
#

Can someone join my server, say test then leave again? :d

tulip ledge
#

Oh so no for loop

#

Ok

pale vessel
#

use an alt

pure lion
#

I don't have an alt

pale vessel
#

create one, it's really convenient

pure lion
#

wsjkhdfgjhsdgkjhs

pale vessel
#

especially for scumbag activity if you know what i mean

pure lion
#

;3

#

maybe itll add one for webhooks :floshed:

#

fuck its not adding xp any more

#

x) forgot to await it

tulip ledge
#

I mean it's working now I just have to let the users actually move

pale vessel
#

x)

cinder patio
#

You don't even need recursive functions. If I understand your idea correctly, you can just use one message collector. First, before you start collecting messages, decide what the order of turns for the players would be. For example :

const turns = [player2, player1, player4, player3];
let currentTurn = 0;

Then, when attack/heal is sent by the player who's turn it is

  • Do the selected action
  • Check if the boss is dead, if they are, stop the game
  • Otherwise do the boss attack
  • Then check if every player is dead, if they are, end the game
  • If the game hasn't ended, switch to the next turn:
if (currentTurn === turns.length) currentTurn = 0;
else currentTurn++;

@tulip ledge

pure lion
#

Chicken can you send one word in my server please :D

pale vessel
#

inb4 he reported you for advertising

pure lion
#

hes already in it x))))

pale vessel
#

get an a l t

#

o h

pure lion
#

i cba

#

also y e

pale vessel
#

but an alt is still nice to have

pure lion
#

okay fine

pale vessel
#

i test my moderation commands using one

pure lion
#

o

#

epic

lusty quest
#

@quartz kindle does d.js-light change something on Voicechannel.setName()?

quartz kindle
#

nope

#

is it not working?

lusty quest
#
TypeError: channel.setName is not a function

``` this happened recently. But im not sure if it is bcs the bot got certified or the lib
#

like a month ago this worked with no issue

cinder patio
#

console.log channel maybe it's not a channel

lusty quest
#
const channel = client.channels.fetch(data.playercounter_channel);
await    channel.setName(`Member Count: ${countmembers}`);
#

i have a check before this. if it cant find the channel it returns

cinder patio
#

fetch returns a promise afaik

#

so you have to await it

quartz kindle
#

yes

lusty quest
#

yea just saw it

gilded ice
#

Uh

#

Why can't my main send messages any more

tight heath
#

@quartz kindle yo

quartz kindle
#

yo

tight heath
#

does this look like a jemalloc problem

#

because I didn't have it before using jemalloc

#

but it seems to be happening a lot

quartz kindle
#

honestly i dont know

tight heath
#

like, a lot

#

👀

quartz kindle
#

it might be possible, but afaik jemalloc is production ready and 100% compatible with other allocators, so there should be no difference from an application level

#

but if you stop using it, and the problem disappears, then should be worth investigating

tight heath
#

this is same code, before using jemalloc

quartz kindle
#

did you change node.js versions by any chance?

tight heath
#

uhh

#

one is on 1.14.2, the other 1.14.4

#

i doubt the diff is that big

#

uhh

#

fuck

#

14.2 / 14.4

#

whatever

digital ibex
#

hello certified developers

tight heath
#

this is le build fyi

quartz kindle
#

i googled the error and found links to the node.js repo, linking it to v8 and the n-api

tight heath
#

hmm i don't recall having it beforehand

#

can you make out any version?

#

also i was wrong about node v

#

14.4 / 14.5

#

so it would have to be a breaking change at 14.5

#

or an incompat with jemalloc

#

👀

quartz kindle
#

14.5 uses v8 8.3

#

14.4 was on v8 8.1

tight heath
#

that sounds like a breaking change

#

can you link the issue

#

or whatever you found

#

im inable to do anything on mobile

quartz kindle
#

the issue was from v13.3 tho, not relevant to this case

#

but it confirmed that its a node.js error

#

and the issue is still open actually lol

tight heath
#

hmm I'll try not using jemalloc & 14.5

#

and see how it goes

#

i sadly can't specifically recreate it

#

it doesn't always happen

quartz kindle
#

rip

#

yeah try running it, if the issue persists then at least the problem is not jemalloc

sinful belfry
#

is there a way to cache every message with discord.js-light (even messages sent by other users and without replying to their message)?

quartz kindle
#

in v3 yes, in v2 you'd need to do it manually channel.messages.cache.set(message.id,message) (and make sure the channel is and stays cached)

sinful belfry
#

kittyLove ok ty!

lusty quest
#

does the guildMemberUpdate cache the member on event or does it need to be done with code? (d.js-light)

quartz kindle
#

if the member is already cached, it updates it, if not, it gives you an ephemeral member

lusty quest
#

ok

#

i ask bcs i have some strange behaviour. I want to check if a member gets a role or if it get removed. but it only works for some reason with the bot but not any other user.

quartz kindle
#

the member needs to be already cached before the update event comes, otherwise you have no access to the member's previous roles

tulip ledge
#

So while I was walking to the food bar I was thinking of more moves I currentl have this and am looking for like a "gamble" one that does like 200% damage or something but only hits like 30% of the time does anybody have a name for that move?

quartz kindle
#

djslight doesnt cache members as they come online like djs does

#

so you'd need to use fetchAllMembers

lusty quest
#

ok thx

#

@tulip ledge Leeroy jenkins

quartz kindle
#

lmao

tulip ledge
#

lmao

#

Well idk

#

I need like a move like strike and stab

quartz kindle
#

power attack

#

power move

#

idk

tulip ledge
#

That's an option

quartz kindle
#

all in

#

reckless attack

tulip ledge
#

Yeah I'll call it all in

#

I mean my moves have a chance to crit imagine u deal 50 damage have 200% crit damage you deal 150 damage on crit then you do all in and land it u deal 400% damage making it 600 damage

#

Damn

lusty quest
#
//mainfile
const client = new Client({
  token: process.env.CLIENT_TOKEN,
  fetchAllMembers: true
});


//guildMemberUpdate event
 if(NewMember.user.bot)return;
   const config= await client.getGuild(NewMember.guild);
   const user = NewMember.roles.cache.map(r => r);
  // console.log(NewMember);
   console.log(user);
  try{
   if(user.includes(config.patreon_roles[0])){
    await client.updateProfile(NewMember, { patreon: true });
   }else{await client.updateProfile(NewMember, { patreon: false });}
}catch(error){console.error(`[Guild Member Update] ${error}`);}

```the event doesnt fire did i overlook something?
tulip ledge
#

The first boss has 1000 hp so you'd still have a challenge

quartz kindle
#

200% of 50 is 100 tho

tulip ledge
#

Well no

quartz kindle
#

unless it counts as "bonus damage"

tulip ledge
#

It's +200%

quartz kindle
#

ah ok

#

@lusty quest you need intents

lusty quest
#

got the member intent running

quartz kindle
#

in your client options

lusty quest
#

ohh right...

tulip ledge
#

Wait what

#

How?

#

Cuz I didn't know that was needed lol

quartz kindle
#

intents will be mandatory in october

hidden lynx
#

why am i having this problem on my server and how can i fix this?
node[27035]: (node:27035) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
On my pc everything is working fine. :/ I assume this has something to do with node

lusty quest
#

node version on your server?

quartz kindle
#

discord.js requires node.js version 12 or later

earnest phoenix
#

How to get an array of all roles in a server?

#

For a serverinfo command

summer torrent
#

which lib

lusty quest
#

guild.member.roles.cache.map(r=>r)

#

or just guild.roles.cache.map if its for the entire guild

tulip ledge
lusty quest
#

looks good

jade finch
#

yeah

#

it looks nice

quartz kindle
#

i'd put woo's hp line separate from the party, so it doesnt look like woo is part of the party

tulip ledge
#

Ok

quartz kindle
#

maybe a line that says vs in between them

#

or maybe put woo's data right after "woo appeared"

tulip ledge
#

I'm using classes for the boss so I can easily make new bosses

#

No I want to do like
ChickenDev dealt 50 Damage to WOO
WOO dealt 30 Damage to ChickenDev

quartz kindle
#

and in the actions menu, maybe put the actions names in bold or something more visible

#

instead of code block for everything

tulip ledge
#

Ok

#

Like this?

#

I should prob remove that empty space after the party

quartz kindle
#

or add an empty space before it

#

like it was before

#

maybe a - between the move name and move description

#

or ->

tulip ledge
#

Wich one?

quartz kindle
#

i like the second one better

tulip ledge
#

k

quartz kindle
#

try something like
Strike -> 100% Chance, 100% Damage
Strike - 100% Chance, 100% Damage
Strike - 100% Chance, 100% Damage

tulip ledge
#

Oh I liek the one with the highlight more

livid pawn
#

How can I remove a reaction from a specific user (with a custom emote, like this one : leftarrow ) ?

quartz kindle
#

of even
Strike- 100% Chance, 100% Damage

tulip ledge
#

Wait thats possible lol

earnest phoenix
#

how can i fix my description?

tulip ledge
#

**test**

#

😦

earnest phoenix
tulip ledge
#

I kinda like this

quartz kindle
tulip ledge
#

Oh

quartz kindle
#

@earnest phoenix <code> bla </code>

earnest phoenix
#

thank you

tulip ledge
quartz kindle
#

you need the / to properly close tags

tulip ledge
#

Thanks Tim!

#

I'll put u in my credits command

quartz kindle
#

lmao ok

#

let me test something

tulip ledge
#

:>

quartz kindle
tulip ledge
#

That looks slick af

quartz kindle
#

although it doesnt work in mobile

tulip ledge
#

Still

#

It looks really good

#

I wanna use it :>

#

What like language? is it

quartz kindle
#

apache

tulip ledge
lusty quest
#

ahh yes for some reason i have 2 ghost seasons running from one of my bots.

vital shard
#

@red sparrow lan

quartz kindle
#

maybe also bold the names instead of the VS

#

in the middle block

tulip ledge
#

Yeah maybe

vital shard
#

@red sparrow dm at bana

#

@red sparrow hey

quartz kindle
#

also, the "All In" got broke lmao

#

apache only colors the first word

red sparrow
#

fck off @vital shard

tulip ledge
#

yeah I noticed

red sparrow
#

shut up @vital shard

#

fck up

tulip ledge
red sparrow
#

<@&304313580025544704>

scenic kelp
#

-atmods @red sparrow

gilded plankBOT
#

@red sparrow

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
flat pelican
#

I swear

scenic kelp
#

you do not need to ping the entire mod team because somebody pinged you thrice

tulip ledge
#

Alright time to do the rest 😄

#

So close to finishing the dungeon command

#

I currently do let move = collected.first().content.toLowerCase(); should I if else stack to look at what move it is or should I use switch?

maiden mauve
#

Is there any way through api to pull someones block lists? Or is that all local to user/private?

cinder patio
#

you can't

maiden mauve
#

The concept of a DM being rejected seems to be the only indicator

quartz kindle
#

the api doesnt expose blocks at all

#

or if it does, its not documented

earnest phoenix
#

@tulip ledge I like that embed,lol

livid pawn
#

I can't remove user reaction with this, so I'm wondering how to do it :

let left_arrow = bot.emojis.get("731893513171763250");

/* msg is message.channel */
msg.reactions.get(left_arrow.name).remove(message.author.id);
earnest phoenix
#

Ugh

quartz kindle
#

msg.reactions.get("731893513171763250").remove(message.author.id)

livid pawn
#

Already tried but didn't work :(

quartz kindle
#

.name is used for default emojis, .id is used for custom emojis

livid pawn
#

But i'll try a second time

quartz kindle
#

ah wait, in v12 i think its .get().users.remove

#

let me check

#

yes

livid pawn
#

Oh xD

quartz kindle
#

reactions.get().remove() is to remove all users

livid pawn
#

Thanks

quartz kindle
#

reactions.get().users.remove(id) is to remove a single user

livid pawn
#

Thank you !

#

Let's try this

#

:)

tulip ledge
livid pawn
#

Oh it still doesn't work :(

quartz kindle
#

its good if WOO used a "scare" move on you, otherwise its better "ChickenDev was too scared to move"

tulip ledge
#

Oh ok

quartz kindle
#

yup

livid pawn
#

I put :

msg.reactions.get("731893513171763250").users.remove(message.author.id);

this time

#

as you said

tulip ledge
pastel violet
#

does messages.fetch get images as well?

solemn latch
#

docs would tell you that

tulip ledge
#

Woo

#

I need your special ability

solemn latch
#

am i the first boss?

#

if i am, i should have incompetency
and i hit myself

#

on the ability turn

tulip ledge
#

Yes

#

You are the first boss

#

So hit yourself?

#

Ok lmao

solemn latch
#

yeah

#

lmao

tulip ledge
#

Alright

#

xD

#

Don't

solemn latch
#

api abuse?

#

your bot will auto be banned from discord pretty much instantly if you do that

tulip ledge
#

discord js is not java friend

solemn latch
#

^

tulip ledge
#

java !== javascript

#

Still it will be auto banned

#

But sure

solemn latch
#

public or private, your not getting help for api abuse here

tulip ledge
#

for(i = 0; i < 1000000; i++) {
<Channel>.send("Spamming...")
}

solemn latch
#

banned @tulip ledge

tulip ledge
#

Please no

earnest phoenix
#

guys

#

Bot awaiting approval - Please be patient, us humans take time to verify bots!

digital ibex
#

wot

earnest phoenix
#

can anyone tell me how long does it will it take to verify?

sudden geyser
#

2-4 weeks

solemn latch
#

3-4 weeks

jaunty junco
#

well

digital ibex
#

around 3 weeks

jaunty junco
#

about a month

earnest phoenix
#

wait WHAT

#

ummmm

jaunty junco
#

maybe less maybe more depends

earnest phoenix
#

hmmm

tulip ledge
#

If you give tonkku some hentai he'll speed up the process for you

jaunty junco
#

lol

tulip ledge
#

Don't actually

earnest phoenix
#

Not funny.

tulip ledge
#

it's a joke

#

I found it funny

earnest phoenix
#

will that actually work?

tulip ledge
#

No

#

Don't

sudden geyser
#

lol

restive willow
#

does anybody use galaxygate for hosting? I need some help setting up a database on it, never used a VPS before

tulip ledge
#

You'll get banned probably

#

Lmao

earnest phoenix
#

try it then.

solemn latch
#

@restive willow dragon in their support discord is super helpful

tulip ledge
#

I think a friend of mine does

#

But I'm not sure

digital ibex
#

everyone uses gg or do

#

prob does

tulip ledge
#

A guy named jens#2019 is his tag @restive willow

restive willow
#

thaNKS

#

thanks

earnest phoenix
#

can anyone here help me speed up the process?

tulip ledge
#

No one can lmao

#

Just wait

solemn latch
#

it cant be sped up

jaunty junco
#

@earnest phoenix no

digital ibex
#

you can't

tulip ledge
#

Be patient

earnest phoenix
#

you can't

tulip ledge
#

I remember back in the day my bot got verrified in like a day or so

#

It was like almost 3 years ago

earnest phoenix
#

how do i know what servvers are using my bot?

#

how do i know what servers are using my bot

#

i know how to do it in discord.py but my bot is discord.js

jaunty junco
#

also avoid asking for someone to verify your bot, because it wont help and will probably provoke them to not verify it

digital ibex
#

3 years ago? you've only been here for 2 yikes

tulip ledge
#

Or 2 then

#

I don't fucking know

sonic lodge
#

@earnest phoenix guilds property of your client

earnest phoenix
#

my bot isnt like approved

cinder patio
#

Karvalian, <Client>.guilds is a collection of all guilds. You could map it so it returns an array of all the guild names your bot is in

tulip ledge
#

Wait how the f do you know? U a stalker zoomeyes

earnest phoenix
#

@sonic lodge can you help me with that?

unkempt marsh
#

Hmm.

digital ibex
#

no im not

tulip ledge
#

Its a joke -_-

digital ibex
#

just search ur name on the search bar and go to the oldest

sonic lodge
#

your client has a property called "guilds"

tulip ledge
#

Doesn't mean that my first message was from 2years ago it didn't get approved before that

unkempt marsh
#

@earnest phoenix In discord.js ```js
client.guilds.cache.each(guild => console.log(guild.name));

pale vessel
#

e a c h

digital ibex
#

you joined 2 years ago, is what im saying.

#

map it, tank argie

jaunty junco
#

luvit discordia question- is it possible to save different data in 2 different json files? if so how?

tulip ledge
earnest phoenix
#

@unkempt marsh that code is returning error

digital ibex
#

docs, pls

unkempt marsh
#

What's the error? @earnest phoenix

tulip ledge
#

@unkempt marsh its forEach not each lmao

digital ibex
#

theres no need to use a for each function there, thats just slower, just use map

unkempt marsh
#

@tulip ledge In discord.js it's each()

earnest phoenix
#

@unkempt marsh client.guilds.cache.each(guild => console.log(guild.name));
^

ReferenceError: client is not defined
at Object.<anonymous> (C:\Users\obaid\Desktop\YOUTUBE\Discord Bot\index.js:38:1)
 at Module._compile (internal/modules/cjs/loader.js:1201:30)
 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
 at Module.load (internal/modules/cjs/loader.js:1050:32)
 at Function.Module._load (internal/modules/cjs/loader.js:938:14)
 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
 at internal/main/run_main_module.js:17:47

unkempt marsh
#

I know what is forEach()

sonic lodge
#

where did you define your client

unkempt marsh
#

I knew it.

earnest phoenix
#

i have defined it as bot not client

sonic lodge
#

so bot.guilds

earnest phoenix
#

my const is bot not client

unkempt marsh
#

Replace client to bot

earnest phoenix
#

it isnt showing up

cinder patio
#

There's both each and forEach. Both work

tulip ledge
#

@unkempt marsh In javascript it's forEach()

pale vessel
tulip ledge
#

What the fuck

#

Since when does each work

unkempt marsh
#

@tulip ledge Ik.

earnest phoenix
#

it isnt showing a error now but it isnt showing anything else too

pale vessel
#

it's discord collection

sudden geyser
#

each and forEach do the same thing. The difference is each returns the collection again for chaining, while forEach returns nothing.

tulip ledge
#

Oh each is a promise?

sudden geyser
#

no

pale vessel
#

no

earnest phoenix
sonic lodge
#

you need to access bot.guilds after the bot is ready

tulip ledge
#

Oh

sonic lodge
#

put it in the ready event function or something like that

unkempt marsh
#

Lol.

cinder patio
#

forEach also works. Doesn't matter in this case.

earnest phoenix
sonic lodge
#

sure, it would work

unkempt marsh
#

forEach also works. Doesn't matter in this case.
@cinder patio Yeah.

earnest phoenix
#

ok

#

it works

unkempt marsh
#

...

sonic lodge
#

you don't need two ready events

tulip ledge
#

lmao

earnest phoenix
tulip ledge
#

Imagine doing that in a bot like dank memer

#

That has 2.5m guilds

earnest phoenix
#

well i only have 2 servers

jaunty junco
#

is it possible to save different data in 2 different .json files in discordia

earnest phoenix
#

one of them is my own and the second of them is my own too but its the main server for the bot

sonic lodge
#

@earnest phoenix you don't need two ready events

earnest phoenix
#

@sonic lodge i deleted the first ready event i hhad that too so that if the code im applying doesnt work i can still switch back to the old code

tulip ledge
sonic lodge
#

ok

unkempt marsh
#

If you already have event listener like ready you don't need to add another event listener. @earnest phoenix

earnest phoenix
unkempt marsh
#

👍

earnest phoenix
#

where do i put the website link of my bot in this server?

solemn latch
#

whatcha mean?

earnest phoenix
#

like post the website of my bot

solemn latch
#

you dont post any websites here

#

or any of the channels

#

if you have a website for your bot, it can go in the description of your bots page

earnest phoenix
#

my bot is not approved it

#

yet

solemn latch
#

yeah

earnest phoenix
#

@unkempt marsh can i do it like that so that it updates the server name?

digital ibex
#

tank argie, i've already told u to use map

unkempt marsh
#

You mean new Map()?

earnest phoenix
#

@unkempt marsh can i do it like that so that it updates the server name?

unkempt marsh
#

Wdym?

earnest phoenix
#

so t hat i dont have to CTRL+C and rerun for it to update the names

unkempt marsh
#

tank argie, i've already told u to use map
@digital ibex Btw, I don't understand what you trying to say. I am not the one who is having a problem here.

#

@earnest phoenix Do a loop.

earnest phoenix
#

do you know how to do it so that it updates the server names?

#

how

#

like you know every 60 seconds or 30 seconds it updates the names

solemn latch
#

console logging is a bad way of doing this.

earnest phoenix
#

well im running it by node .js so its the only way

solemn latch
#

im also using nodejs

#

🤔

unkempt marsh
#

console logging is a bad way of doing this.
It depends.

earnest phoenix
#

im hosting it using node js

solemn latch
#

console.log stops your code from running

#

until it finishes logging

unkempt marsh
#

That's a lie.

solemn latch
#

🤔

#

what

tulip ledge
#

Ok I have this annoying issue
let Player1 = new Player(accepted[0], userrows[0].maxhealth, userrows[0].health, userrows[0].defense, userrows[0].strength, userrows[0].cc, userrows[0].cd, rows[0].sword, rows[0].consumables, 0)
When creating a player it takes the ID of the array from the people who accepted and then takes the rows 0 this is my SQL query
SELECT * FROM users WHERE discordid IN (${usercheck}) and usercheck is formatted like this: "488825595980021791", "259776081316282368" But for some reason rows[0] are my stats every single time. Meaning that when the user accepts before me he gets my stats. Does anybody have a solution?

sudden geyser
#

No it's not

digital ibex
#

some peoples logic in this server 😔

unkempt marsh
#

I'm using console.log for debugging my codes.

solemn latch
#

debugging is fine

unkempt marsh
#

It won't stop your code.

earnest phoenix
#

i can simply use break; after calling to log to fix it

digital ibex
#

tank argie, u do know nodejs' features is to carry on?

pale vessel
#

it does until it finishes logging

solemn latch
#

^

#

while its logging nothing else can happen in your program

pale vessel
#

you probably didn't notice it

solemn latch
#

sure logging errors, thats fine, because its only errors

earnest phoenix
solemn latch
#

yikes

earnest phoenix
solemn latch
#

ofc it works, you where not in the middle of logging

#

lol

tulip ledge
next escarp
#

xD

#

bruh

cinder patio
#

Even so, console logging anything to the console takes way less than a millisecond, won't make your code any slower

next escarp
#

yeah

unkempt marsh
#

True.

solemn latch
#

its not really a problem at the scale of logging 50 chars.
but when your server is in 300 guilds, logging that every 30 seconds will cause problems

#

🤔

cinder patio
#

not really

solemn latch
#

and is just a general waste of resources

cinder patio
#

again, not really

solemn latch
#

🤔

#

okay then

pale vessel
#

i don't see anything wrong with console.log tbh

earnest phoenix
#

ill disable the 30 seconds loop after i get more members. but currently i have less so i have to look for how many members im gaining

#

can anyone tell me how do i loop that commands?

#

command*

unkempt marsh
#

Well, if you put too much information inside of console.log ofc it will.

solemn latch
#

which this is a useless peice of info

#

which could easily be done in other ways

earnest phoenix
#

ummmm?

tulip ledge
earnest phoenix
#

can anyone tell me how do i loop that commands?

cinder patio
#

Even if you printed like 10k lines it would still take a millisecond or two

digital ibex
#

lol this channel turned into why not to console.log

#

lmao

earnest phoenix
#

can anyone help me or no?

unkempt marsh
#

Lol.

#

Nvm, I mind my own knowledge.

earnest phoenix
#

ummm

#

@unkempt marsh can you help me with what i said?

tulip ledge
#

If no one gives me a solution I'm just gonna if stack

earnest phoenix
#

If no one gives me a solution I'm just gonna if stack
@tulip ledge same here

tulip ledge
#

Dude

solemn latch
#

setinterval @earnest phoenix

tulip ledge
#

Looping is not if stacking

earnest phoenix
#

I MEant ill stack overflow it

#

to fiind the answer

cinder patio
#

What's the problem Chicken

earnest phoenix
#

setinterval @earnest phoenix
@solemn latch can you tell me the code that i have to paste into my bot :/

solemn latch
#

no, spoonfeeding is against the rules here

unkempt marsh
#

^

earnest phoenix
#

i came back to programming after a long break so i need time to warmup

digital ibex
#

lol

earnest phoenix
#

atleast just help me

unkempt marsh
#

no, spoonfeeding is against the rules here
@solemn latch I'm about to do it lol.

digital ibex
earnest phoenix
#

help needed pls :/

unkempt marsh
#

@earnest phoenix He already told you, setInterval()

earnest phoenix
#

whhere do i put it