#development

1 messages · Page 886 of 1

modest maple
#

Except ads

limpid pulsar
#

what if I like remove the navbar

knotty steeple
modest maple
#

And main site buttons like report and that

limpid pulsar
#

ah alright

knotty steeple
#

sad thing u cant remove the ads

#

omegalul

turbid bough
#

is the money set as integer?

#

not like string

knotty steeple
#

yes

true tundra
#

I got it

knotty steeple
#

literally running it in sqlite db viewer works

regal jacinth
#

i still don't get it

#

gimme examples

turbid bough
#

what does
SELECT * FROM users ORDER BY money DESC; return?

regal jacinth
#

on what should I do

knotty steeple
#

where the code or db viewer

regal jacinth
#

?

#

;-;

earnest phoenix
turbid bough
#

It looks like your project does not contain a 'stage' task,?

digital ibex
#

hi

#

ihave this ```js
if (member.createdAt < 500903242400000 && /* more stuff which works /*) {
embed.description =
'A member has just joined the server.\nWarning!\nThis is a account has been flagged for suspicious activity.';
}

turbid bough
#

whats the problem?

#

btw, your comment ending is wrong

#

its */ not \*

digital ibex
#

why does it not set the description as A member has just joined the server.\n**Warning!\nThis is a account has been flagged for suspicious activity.** ?

digital ibex
#

oh yeah lol, woops

#

not that

#

i just added that

knotty steeple
#

did u define an embed

digital ibex
#

yes

knotty steeple
#

what is it

digital ibex
#

its an object

turbid bough
#

what object

digital ibex
#

just an object

#

let embed = {...}

#

but thats not the issue

knotty steeple
#

its related to the issue isnt it?

turbid bough
#

yeah thats probably the problem

digital ibex
#

how

#

no its not lol

turbid bough
#

idk which language?

digital ibex
#

thats.... javascript

turbid bough
digital ibex
#

im not using djs

turbid bough
#

ok

digital ibex
#

and u can create an embed different ways

#

not just that way

turbid bough
#

Ok what are you using lol

digital ibex
#

and i'm using eris

hasty lotus
#

hey if anyone know quite well json pls dm me

knotty steeple
#

just say ur issue here

#

also how are u sending the embed

digital ibex
#

what

#

thats got nothing to do with the issue

knotty steeple
#

how

#

are you

#

sending the embed

turbid bough
#

lol

hasty lotus
#

would you know how to make a top command

digital ibex
#

message.channel.createMessage({ embed });

hasty lotus
#

using json ?

turbid bough
#

ok, the object should be actually

#

oh

knotty steeple
#

top for what

hasty lotus
#

like i've got a json

turbid bough
#

embed: embed?

hasty lotus
#

containing an array of users

hasty lotus
#

looking like that :

turbid bough
#

cause, since if you are using embed.description

#

it wouldnt work right?

digital ibex
#

no

turbid bough
#

if you are inputting as {embed} in createdescription

#

ok, then can you send you your code?

hasty lotus
#
"xp":{
    "ID":"xpcount"
}```
digital ibex
#

i

#

just sent the code

turbid bough
#

what

hasty lotus
#

but course it's more long than that

turbid bough
#

3 lines of code?

knotty steeple
#

send more examples

digital ibex
#

do u even kno what ur talking about

hasty lotus
#

but how can i get the 1st user ?

digital ibex
#

like

#

[0]

knotty steeple
#

so is it like

digital ibex
#

nini

hasty lotus
#

noo

turbid bough
#

is he trolling?

hasty lotus
#

not the 1st user of the array

digital ibex
#

me?

hasty lotus
#

nooo

#

u don'tunderstant

#

wait

knotty steeple
#
"xp":{
    "ID":"420",
    "ID2": "69"
}
hasty lotus
#

xD

#

yeah it looks likt that

turbid bough
#

sammy, you missing a quote

hasty lotus
#

and i zant to do a js code

#

that selects the 1st user by xp

knotty steeple
#

u can get object values from xp and sort it

hasty lotus
#

how ?

#

x)

knotty steeple
#

Object.values(xp)

turbid bough
hasty lotus
#

what will this output ?

digital ibex
#
if (member.createdAt < 10000) {
embed.description = 'hi';
}
#

thats the code

turbid bough
#

i cant decode shit with that code

#

try defining member

hasty lotus
#

what will Object.values(xp) output?

digital ibex
#

kinda need to learn js lmao

#

u do

knotty steeple
#

the values of the items in the object

hasty lotus
#

i'm usually a java dev sry

#

trying to learn js

digital ibex
#

i wasn't talking to you :D, its fine

hasty lotus
#

uh

#

ok

#

np

#

but anyway

knotty steeple
#

cuz objects are like this

hasty lotus
#

i still need to learn js

#

xD

#

but how can i sort the xp

#

to get the top 1

turbid bough
#

@digital ibex i need your whole code, from defining your embed, till sending your message.

knotty steeple
#

also

#

change it to integers

#

instead of strings

digital ibex
#

no u don't

hasty lotus
#

me ?

knotty steeple
#

yes

hasty lotus
#

wut

#

ok come dm

digital ibex
#

i was talking to tuan again :D

knotty steeple
#

"xpcount" should be a string

turbid bough
#

i cant help this guy

hasty lotus
#

pls

knotty steeple
#

like 69 as my xp count

digital ibex
#

thuan,

knotty steeple
#

instead of "69"

hasty lotus
#

it is

digital ibex
#

u don't need my whole code

knotty steeple
#

why did u put it in a string then

turbid bough
#

dude read my sentence

digital ibex
#

ok,

turbid bough
#

i need your code from when you define your embed, till you send your message

hasty lotus
#

@knotty steeple -> dm pls

knotty steeple
#

also there is a sort function

#

no

hasty lotus
#

why

knotty steeple
#

i dont dm random people

hasty lotus
#

there is to many ppl here

knotty steeple
#

no there isnt?

hasty lotus
#

i don;t understant anythings

#

ok

digital ibex
#
    let embed = {
        title: 'Member Joined',
        description: 'A member has just joined the server.',
        fields: [
            {
                name: 'Member',
                value: member.mention,
                inline: true
            },
            {
                name: 'Member Created At',
                value: new Date(member.createdAt).toDateString(),
                inline: true
            }
        ],
        color: 0x10eb23,
        timestamp: new Date(),
        footer: { text: `User ID: ${member.id}` },
        author: { name: ` | ${guild.name}`, icon_url: member.avatarURL }
    };
    if (member.createdAt < 500903242400000 && ) {
        embed.description =
            'A member has just joined the server.\n**Warning!\nThis is a account has been flagged for suspicious activity.**';
    }
    client.createMessage(Guild.alchan, { embed });
};```
#

there

knotty steeple
#

find someone else then if u dont want my help christmasthink

hasty lotus
#

don't worry about string or not

digital ibex
#

thats the whole thing, even tho u don't need it but sure, ok

hasty lotus
#

it is string

#

@digital ibex what version of DJS ?

digital ibex
#

thats eris not djs

hasty lotus
#

uh

#

ok

turbid bough
knotty steeple
#

do u always send with createMessage on the client

split hazel
#

d.js makes it confusing with like 50 different versions

hasty lotus
#

yeah

digital ibex
#

yes, i removed that bit, and as i said, that bit isn't causing any issues

hasty lotus
#

and all 12 versions are all different

knotty steeple
#

ok

turbid bough
#

does the embed post at all btw?

hasty lotus
#

i tried to upgrade to djs 12

turbid bough
#

but just not the description

digital ibex
#

yes it does

hasty lotus
#

i downgraded 3h after

digital ibex
#

yes

hasty lotus
#

xD

split hazel
#

dont see why they needed to add in the .cache thing

turbid bough
#

did you check your member.createdAt?

split hazel
#

its a pointless visual change

digital ibex
#

what

split hazel
#

and such a huge breaking change since you literally need to edit like 90% of your code

digital ibex
#

member.createdat is fine, nothing wrong with that

turbid bough
#

so if you do console.log() in that if statement, something prints out right?

hasty lotus
#

@knotty steeple

#

still here ?

knotty steeple
#

what

hasty lotus
#

i didn't understood

#

how can i get the 1st user

#

like the one that has the biggest xp count

#

is there any function ?

digital ibex
#

yes

limpid pulsar
hasty lotus
#

??

limpid pulsar
#

In these tags, the triangular ending doesn't come under .atag?

knotty steeple
hasty lotus
#

uh thx

limpid pulsar
#

I want to color those too

knotty steeple
#

since Object.values returns an array u can do that

limpid pulsar
#

Anyone have any idea how I can access the tip too?

turbid bough
#
xp.sort(function (a) {
  return a.value;
});```
im guessing
knotty steeple
#

bruh moment

hasty lotus
#

.sort automatically chooses the biggest one ?

turbid bough
#

lowest to highest

limpid pulsar
#

hi?

knotty steeple
#

sort doesnt work for numbers by default well

hasty lotus
#

uuuuh

#

okkk

knotty steeple
#

just read what i linked

hasty lotus
#

i understood

#

so then a[1] will be the biggest one

#

right ?

turbid bough
#

well, do array.reverse and a[0] would be the biggest one

hasty lotus
#

list ?

#

uh

#

ok

turbid bough
#

list, xp, array whatever you get from your json file.

digital ibex
#

well

#

fixed it

turbid bough
#

what was the problem?

limpid pulsar
#

h e l p

digital ibex
#

no idea, i just re wrote it

turbid bough
#

okk

#

good then i guess

digital ibex
#

also

#

in ms, how long is one day?

turbid bough
#

in ms?

digital ibex
#

not related to bot dev but eh

turbid bough
#

oh millisecond

digital ibex
#

yeah

turbid bough
#

86 400 000

digital ibex
#

thank u

turbid bough
#

btw

digital ibex
#

kk

hasty lotus
#

so :

const xp = require('../xp.json')

xp.sort(function (a) {
    a.reverse
    console.log('The forst user has :' + a[0] + 'xp')
}```
#

this works ?

turbid bough
#

nope lol

knotty steeple
#

no it doesnt

#

i told u use Object.values

#

on xp

#

so it can be an array of the xp values

hasty lotus
#

i don't undestand anything

#

sry i'n dyslexic

#

i'm

knotty steeple
#

jesus

#

get a dyslexic font

limpid pulsar
#

hey, I need h e l p

🚨 can you guys see my messages ??

hasty lotus
#

yes

robust arrow
#

xp.sort(function (a) {
    a.reverse
})
for(let ind in xp){    
    console.log(`The forestisrts user has: ${xp[ind][0]} xp`)
}```
knotty steeple
#

no

turbid bough
#

no

knotty steeple
#

xp isnt an array

limpid pulsar
#

oof

knotty steeple
#

and dont spoonfeed

hasty lotus
#

it is

knotty steeple
#

what

#

the fuck

robust arrow
#

JSON objects can be navigated this way

knotty steeple
#

ok smart person

robust arrow
#

Dunno about the sort function, that came up earlier

knotty steeple
#

but dont spoonfeed

digital ibex
#

(side note: best storing it in an actual db instead of a json file, they can get corrupted way easier if in a json)

robust arrow
#

fiiiiiine

hasty lotus
#

yeah i know

earnest phoenix
#

how i get icon url of the server?

hasty lotus
#

but i'm so bad using real dbs

digital ibex
#

Guild.iconURL

hasty lotus
#

@earnest phoenix guild.iconURl

#

ys

#

.URL*

digital ibex
#

or iconURL is a function if u r using djs 12

limpid pulsar
#

nevermind, got it myself

earnest phoenix
#

exists member.guild.iconURL ?

digital ibex
#

no

#

yea

#

i mean

#

mb

hasty lotus
#

@limpid pulsar what's ur plbm

#

msg.guild.iconURL exists

earnest phoenix
#

ok

hasty lotus
#

if u want

limpid pulsar
#

Yeah, I fixed it

earnest phoenix
#
client.on('guildMemberAdd', (member) => {

  let embed = new Discord.RichEmbed()
     .setTitle('Bienvenid@')
     .setThumbnail(member.guild.iconURL)
     .setDescription(member.user.username + ' se unio al servidor!')
     .setFooter('Ahora somos ' + member.guild.users.size + ' miembros.', member.user.avatarURL)
     .setColor(0xff0000) 
   // Enviamos el mensaje a un canal segun el ID-CANAL
   let channel = client.channels.get('662679657250029621');
   channel.send({ embed });

})```
#

11v

#

dont work

glad charm
#

Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem.

earnest phoenix
#

glitch dont give me a error

#

...

knotty steeple
#

it does

earnest phoenix
#

for me not

#

for this event not

quartz kindle
#

should be member.guild.members, not member.guild.users

earnest phoenix
#

in description?

#

or footer?

quartz kindle
#

footer

earnest phoenix
#

ok

zealous urchin
#

Hello, I'm using discord.py and I would like to check if user voted in top.gg for my bot (or not)
I looked into dblpy's documentation, but I found nothing. Could I know what function that I should use?

quartz kindle
#

no?

zealous urchin
#

Oh thank you 😄

earnest phoenix
#

work @quartz kindle

#

why this dont work?```js
client.on('guildMemberRemove', (member) => {

let embed = new Discord.RichEmbed()
.setTitle('Adios')
.setThumbnail(member.guild.iconURL)
.setDescription(member.user.username + ' se fue del servidor!')
.setFooter('Ahora somos ' + member.guild.members.size + ' miembros.', member.user.avatarURL)
.setColor(0xff0000)
// Enviamos el mensaje a un canal segun el ID-CANAL
let channel = client.channels.get('662679657250029621');
channel.send({ embed });

})```

glad charm
#

@earnest phoenix again, please give an error message instead of jsut asking "Why doesn't this work". It's not helpful.

#

We can't help you if you don't help us.

earnest phoenix
#

glitch dont

lyric mountain
#

I always wonder why people assign a variable then do an action, instead of doing the action directly

glad charm
#

Certain cases.

split hazel
#

People have different coding styles, it can also make the code more readable, or easier to comprehend

lyric mountain
#

I see

earnest phoenix
#

so?

split hazel
#

A lot of chaining can make code a bit more complicated

quartz kindle
#

my code is usually as horizontal as it fits my screen

glad charm
#

Lmao.

quartz kindle
#

thats when i break it up into variables

lyric mountain
#

Don't assigning channel to a var increase memo usage?

split hazel
#

I'm personally a fan of assigning a minimal amount of variables but

#

Not really since it's referencing to the actual object

#

It doesn't duplicate the actual object

quartz kindle
#

its an extra pointer

earnest phoenix
#

why this dont work?```js
client.on('guildMemberRemove', (member) => {

let embed = new Discord.RichEmbed()
.setTitle('Adios')
.setThumbnail(member.guild.iconURL)
.setDescription(member.user.username + ' se fue del servidor!')
.setFooter('Ahora somos ' + member.guild.members.size + ' miembros.', member.user.avatarURL)
.setColor(0xff0000)
// Enviamos el mensaje a un canal segun el ID-CANAL
let channel = client.channels.get('662679657250029621');
channel.send({ embed });

})```
glitch dont give me a error

glad charm
#

Using new creates that memory allocation anyway.

#

Yeah like Tim said.

quartz kindle
#

@earnest phoenix cant see anything wrong there, you need to get an error, if you dont get an error figure out why you dont get an error first

split hazel
#

Which is why when modifying an object, .geted from a collection you don't have to set it back again to make the actual change

quartz kindle
#

which is all good until for some reason you have a json configuration several layers deep, and you need to pass it to your class instances as a deep copy

#

that always seems to hit me in the most unexpected ways lmao

split hazel
#

It confused me at first

quartz kindle
#

"wait wtf is this class settings wrong? oh... the config file 10 layers back is being modified because its a reference..."

split hazel
#

I didnt know you had to duplicate an object by stringifying it at first and parsing it at first

#

Which broke my code and I had no idea why

quartz kindle
#

exactly lmao

split hazel
#

Thought it was as simple as assigning it to a variable

quartz kindle
#

and then everyone says to avoid JSON.parse(JSON.stringify()) because its slow

#

then you start panicking

#

and you end up JSON-JSONing anyway

split hazel
#

👀 I've seen deep clone libraries

#

But honestly minimal performance impact

#

Especially when most use case is with small json objects

earnest phoenix
#

tim

#

i test channel.send(embed)

#

and work

#

but channel.send({embed})

#

dont

quartz kindle
#

then use .send(embed)

lyric mountain
#

laughs in Collections.copy()

earnest phoenix
#

what? xd

#

{embed} and embed is equal?

lyric mountain
#

No

quartz kindle
#

{embed} = {embed:embed}

lyric mountain
#

{} basically means "an object that contains an embed attribute"

hasty lotus
#

guys

lyric mountain
#

So you're passing a wrapped embed

hasty lotus
#

would you know how to write in q json db

#
fs.writeFile("../db.json", JSON.stringify(db), (err) => {
            if(err) console.log(err)
          });```
#

this don't work

lyric mountain
#

Don't use json db

hasty lotus
#

when i restart the processqll gone

quartz kindle
#

are you using glitch?

lyric mountain
#

For the sake of your memory

hasty lotus
#

no i'm in my vps

quartz kindle
#

is the whole file gone or just the contents?

hasty lotus
#

just the content

#

it looks like it doesn't reqlly writes in it

#

like when you use .push

#

it's just for the process

quartz kindle
#

when you write to it, it replaces the entire file with new content

hasty lotus
#

¯_(ツ)_/¯

quartz kindle
#

check if you're not erasing the existing content at process start

hasty lotus
#

nope

#

just mqking q reauire

#

a require

quartz kindle
#

the file also gets erased if an error happens during writing

hasty lotus
#

i haven't got any errors in the console

quartz kindle
#

show code

hasty lotus
#

which one §

#

?

quartz kindle
#

everything that uses fs

hasty lotus
#

it's a cmd handler

#
fs.readdir("./commands/", (err, files) => {

    if(err) console.log(err);
    let jsfile = files.filter(f => f.split(".").pop() === "js");
    if(jsfile.length <= 0){
      console.log("Couldn't find commands.");
      return;
    }
  
    jsfile.forEach((f, i) =>{
      let props = require(`./commands/${f}`);
      console.log(`Command ${f} loaded!`);
      var cmdammount = Math.round(cmdammount + 1)
      bot.commands.set(props.help.name, props);
    });
  
    console.log(`${bot.commands.size} commande chargées au total !`)
});

fs.readdir('./events/', (err, files) => {
    files = files.filter(f => f.endsWith('.js'));
    files.forEach(f => {
        const event = require(`./events/${f}`);
        bot.on(f.split('.')[0], event.bind(null, bot));
        console.log(`Event ${f} loaded !`)
        delete require.cache[require.resolve(`./events/${f}`)];
    });
});```
This in the index to loqd cmds + events
#

load

#

sry i'm on an azerty and i usuallyuse qwerty so a and q swap

quartz kindle
#

ok no need for these i guess, just the fs that uses your json file

hasty lotus
#

well none in the index

#
db[msg.author.id] = {
            id: msg.author.id,
            xp: 0,
            lvl: 0,
            perso:[],
            arm:[],
            vehic:[],
            plan:[],
            armes: "0",
            vehicle: "0",
            planetes: "0",
            personnages: "0",
            commonbox: "0",
            rarebox: "0",
            superrarebox: "0",
            epicbox: "0",
            mithicbox: "0",
            lengendbox: "0",
            secretbox: "0",
            credit: "0"
        }

        fs.writeFile("../db.json", JSON.stringify(db), (err) => {
            if(err) console.log(err)
          });``` this is the start cmd
lyric mountain
#

fs.writeFile doesn't seem to append

hasty lotus
#

yeah

#

it's very weird

quartz kindle
#

and db is db = require(json file)?

hasty lotus
#

yes

#

const db = require("../db.json")

lyric mountain
#

Doesn't js have a fs.appendFile()?

inner glen
#

Any one have any client.guilds.size code i need it please?

quartz kindle
#

it has, but you cant use appendFile with json

lyric mountain
#

Hm

quartz kindle
#

what code?

hasty lotus
#

@inner glen ??

lyric mountain
#

He wants example of guilds.size usage

#

I guess

hasty lotus
#

uh

inner glen
knotty steeple
#

no one is gonna spoonfeed

#

btw

quartz kindle
#

whats your language and library?

inner glen
#

@quartz kindle DJS and JS

hasty lotus
#
bot.on("ready", () => {
    bot.users.setStatus(`on ${bot.guilds.size} guilds`)
})``` for discord.js
knotty steeple
#

bruh

lyric mountain
hasty lotus
#

just replace bot by cient if you use client

knotty steeple
#

facepalm

quartz kindle
hasty lotus
#

nooo

#

don't use v12

#

xD

#

use v11.6.4

knotty steeple
#

why not

#

its better

hasty lotus
#

best djs version ever

#

no

#

it's so bqs

inner glen
#

well i have V12

knotty steeple
#

how?

hasty lotus
#

they changed everything

knotty steeple
#

ok

#

and

inner glen
#

huh

hasty lotus
#

it's just

#

huh

clear wraith
hasty lotus
#

i don't like it

knotty steeple
#

thats only a problem if ur lazy to rewrite ur bot

#

@clear wraith try again

#

or refresh

#

but try again first

lyric mountain
#

@hasty lotus by using djs 11 you're effectively installing a timed bomb on your bot

heavy marsh
#

In Discord.js v 12.2.0 is there a way to check if this id xxxxxxx is a voice channel?

hasty lotus
#

@heavy marsh hmm

#

you could try to fetch the chal in bots.channels

#

and then try to read property voice of the channel

lyric mountain
#

Or you could retrieve the channels list and check for that ID, then get the type

heavy marsh
#

I am getting the ID

#

I wanna compare with the ID

lyric mountain
#

Just compare then

heavy marsh
#
if(message.channels.get(`xxx`) == message.voice.channel)
#

Is this correct?

quartz kindle
#

no

#

you want to check if that channel is a voice channel?

heavy marsh
#

Yes

quartz kindle
#

then just add .type === "voice"

#

message.voice is not a thing

heavy marsh
#
const MusicChannel = message.mentions.channels.first() || message.guild.channels.cache.get(args[1]);

if(MusicChannel.type !== "voice") return
#

like this

quartz kindle
#

yes

heavy marsh
#

ook I see got it. Thank you!

#

@quartz kindle is it

if(MusicChannel.type !== "voice") return

or

if(MusicChannel.id.type !== "voice") return
sudden geyser
#

id is a string.

#

and a string does not have the .type property.

heavy marsh
#

ooh ok

#

so its just ```js
if(MusicChannel.type !== "voice") return

sudden geyser
#

yeah if the channel exists

quartz kindle
#

yes, all channels have a .type property

heavy marsh
#

oks 🙂

clear wraith
#

How is const work = new Discord.RichEmbed() not a constructor?

#

How is new Discord.RichEmbed() not a constructor?

earnest phoenix
#

how i can do a dashboard for my bot?

knotty steeple
#

@clear wraith are u sure u defined Discord

clear wraith
#

yes

#

const Discord = require("discord.js");

lyric mountain
#

@earnest phoenix html, js, css, php and lots of hatred

inner glen
#

client.guilds.size not working why? i always get undefined

knotty steeple
#

u dont need php

#

at all

lyric mountain
#

Or react native, jsf, you choose it

knotty steeple
#

@inner glen dont forget cache

earnest phoenix
#

@lyric mountain i mean, how i conect the bot with the page

lyric mountain
#

Through a shared database

#

And php if using raw html

#

There're lots of options other than manually making a site with html

#

You have node, react, jsf, python, etc

clear wraith
#

How is Discord.RichEmbed() in const work = new Discord.RichEmbed() not a constructor?

#

I even defined Discord

#

const Discord = require("discord.js");

#

Thats the error. Idk where it came from.

#

everything was fine, and when i go to add Discord.js as a package... I get an error.

amber fractal
#

Are you on v12

#

It's MessageEmbed now

clear wraith
knotty steeple
#

there isnt a glitch specific version

amber fractal
#

So new Discord.MessageEmbed()

knotty steeple
#

try using that

clear wraith
#

ok

#

Ahh, Ok. That one worked.

#

Thanks!

quartz kindle
#

there are a LOT of changes in discord.js v12

#

i recommend you read the changes guide

clear wraith
#

How do i update Node??

#

Its supposed to v12, but mine says v10

lyric mountain
#

Uninstall it and reinstall

clear wraith
#

ok

inner glen
#

how i fix the undefined error?

lyric mountain
#

Show code

rare mist
#

Mods, will be a security breach having a command that allows to get information of a user such as its pfp name, date of the acount created, uk basic stuff but not only on the current guild but look for the user in all guilds the bot is in. ping me when awnser plz

turbid bough
#

what

lyric mountain
#

@rare mist no, except for the last one

#

Getting in which servers a user is on IS a privacy issue

inner glen
#

@lyric mountain client.on("ready", () => { client.user.setActivity(`on ${client.guilds.size} guilds`); console.log("Bot is ready") });

turbid bough
lyric mountain
#

@inner glen you gotta get the cache

#

client.guilds.cache.size

#

@rare mist also, you can't give data about an user that's not in the server

#

That's against tos

inner glen
#

@lyric mountain Thank u bud

rare mist
#

@lyric mountain Im not telling in witch servers the user is in

#

im just getting basic info

#

is it still a privacy breach?

lyric mountain
#

Yes

#

If the user is not in the sv, giving even the discrim is privacy breach

rare mist
#

jeez ok, im not adding that then i dont want mods here or discord mad

lyric mountain
#

Except if it's owner-only

rare mist
#

OwO

lyric mountain
#

You as owner can query info about your users

turbid bough
#

owners of bots already have all this information too anyway

lyric mountain
#

Just not expose it publicly

rare mist
#

Ohh ok

craggy cave
#

Why is preview on the website show differently to what actually is submitted different?

turbid bough
#

cause the decoder is different from what the browser generates, and the server generates.

craggy cave
#

damn that's annoying.

turbid bough
#

what part of it is different?

craggy cave
#

Is there any restrictions there like can we use javascript also or?

turbid bough
#

im not sure

lyric mountain
#

@craggy cave javascript only for certified bots

craggy cave
#

dangit

#

Alright

#

CSS is allowed though?

turbid bough
#

yes

craggy cave
#

Seems so

#

great

clear wraith
#

All this Updating stuff with Discord.js has fucked up my whole code, and now im stressed tf out...

sudden geyser
#

if it's that .cache stuff just write a regex in your ide find shortcut.

clear wraith
#

This makes no sense.. well to me at least

digital ibex
#

thats why i moved to eris

#

i recommend moving to eris from djs

clear wraith
#

wtf is that

knotty steeple
#

cache is better managed by the dev now

#

or can be

digital ibex
#

eris

#

is 🔥

#

cache is bs

knotty steeple
#

eris docs are shit

#

d.js and eris arent completely different in ram usage its just by default d.js is bad

digital ibex
#

if u kno how 2 read docs

#

they're as gud as any other docs

#

if u kno how 2 read docs

icy crane
#

i wanna try eris out at some point, but idk when lol

#

this lag, wtf is happening reee

digital ibex
#

they're as gud as any other docs

#

SEND MY MESSAGES DISCORD

#

if u kno how 2 read docs

#

they're as gud as any other docs

knotty steeple
#

no

#

they arent

icy crane
#

send eris docs, i wanna read them lol

#

im too lazy to google it

digital ibex
#

if u kno how 2 read docs

knotty steeple
#

there is so much stuff that should just be there

digital ibex
#

fuck u discord

icy crane
#

i wanna try eris out at some point, but idk when lol

digital ibex
#

why aren't they

#

read them 🙂

icy crane
#

: )

#

: )

#

bruh

#

eeeeeeek this LAG

digital ibex
#

fuck u discord

#

its perfectly fine for me

#

if u can read documentation properly then ur fine

#

its perfectly fine for me

clear wraith
#

Discord is fucked up rn

#

it laggy asf in dms, and in chats

digital ibex
#

same

icy crane
#

its broken

digital ibex
#

ok, its getting better 4 me

#

yeah

proven beacon
#

I want to randomly group users on an voice channel. How can I do it?
Sample:
Vamp = E user, C user
Doc = A user
Vill = B user, D user, F user, E user

#

Is there anyone who can help?

turbid bough
#

im guessing you could take the current users already in the channel, then randomly spread them out.

#

do like users.randomize, then take the count, divide by 3, then you get 0-(count/3) as group 1

#

then second would be

#

(count/3)-((count/3)*2)

#

then the third would be

#

((count/3)*2)-count

#

for example

proven beacon
#

But Sample count : args[0]

turbid bough
#

what do you mean?

proven beacon
#

@turbid bough u look dm?

turbid bough
#

i can only help here atm

proven beacon
#

I threw an example in the message box, can you look?

turbid bough
#

send the example in this channel

proven beacon
#
const Discord = require('discord.js');
const path = require('path');
const fs = require('fs');
const db = require('quick.db');
exports.run = async (client = new Discord.Client, message = new Discord.Message, args) => {
    if (!message.member.permissions.has('ADMINISTRATOR') )
        return message.channel.send(`Bu komutu kullanmak için gerekli yetkiye sahip değilsin!`).then(msg => msg.delete(5000));

if(message.member.voiceChannel.id === '698359791751528499') {
    var vk1 = message.guild.channels.get('698359785904537626');
    var vk1ses = message.guild.channels.get('698359791751528499');

  var oyuncular = '' 
 
    const takımlar = ['vamp', 'buyu', 'jest', 'dok', 'koy'] 
  //1:vampir, 2:büyücü, 3:jester, 4:doktor, 5:köylü
   var vampir = Number(args[0]);
   var buyucu = Number(args[1]);
   var jester = args[2];
   var doktor = args[3];
   var koylu = args[4];
   console.log(vampir)
 
   const listx = vk1ses.members;

let vamp = []
var x = listx.random(vampir)

vamp.push(x.map(e => e.user.id)) 
message.channel.send(vamp)


} 
}
turbid bough
#

im not that good with js, so, you would split all each users into each list and then push them into that channel

warm marsh
#

The code seems kinda crazy.

proven beacon
#

@turbid bough I will split the users on the channel.

#

@warm marsh little utanmisGul

digital ibex
#

hi, with eris, how can i get a members clientStatus?

#

like, i do Member.clientStatus and it returns undefined and idk where to go from there because ye, undefined

warm marsh
#

The docs don't have anything on it?

#

Its probably not named clientStatus.

digital ibex
#

yes it is

warm marsh
#

Mad.

#

I've never used eris so I'm no use.

turbid bough
#

docs says so too

digital ibex
#

clientStatuss type is ?object thats why, but usually, with my experience it always returns the Object i can kinda expand on, if that makes sense

turbid bough
#

are you sure you arent using an user object?

#

instead of member

digital ibex
#

yes

#

its Member

#

and ? makes it return undefined, i just need help getting the platform the members actually on

turbid bough
#

there is also the .status

#

oh wait, nvm

#

i dont know then

#

is the user you are viewing offline?

#

cause clientStatus should return undefined if so

digital ibex
#

no

#

im not looking for the members status

turbid bough
#

yeah i know, so the member isnt offline?

digital ibex
#

no

turbid bough
#

ok, then i dont know. try creating an issue at github

digital ibex
#

its not a bug

turbid bough
#

it is if it isnt returning anything when it is supposed to

digital ibex
#

theres no need to also

#

its not meant to

turbid bough
#

??

digital ibex
#

the type is ?Object

#

like i said

turbid bough
#

thats beacuse its expecting to be undefined lol

#

when its offline

digital ibex
#

you don't really know what ur talking about pepowot

turbid bough
#

ok, look, just beacuse it has a ? does not mean its not always supposed to be null

earnest phoenix
#

Wondering what's going on...

digital ibex
#
           let platform = message.member.clientStatus;
            platform = {web: 'web', desktop: 'desktop', mobile: 'mobile'}
if(platform === 'web') platform = 'Browser';
if(platform === 'desktop') platform = 'Desktop';
if(platform === 'mobile') platform = 'Mobile';
``` well, i just created this
#

and undefined

#

still

turbid bough
#

yeah create a github issue about it

digital ibex
#

no

#

u don't need to

turbid bough
#

why

digital ibex
#

because its not a bug or anything that they should know about

turbid bough
#

i have issue with this

  • create issue

its not an issue

digital ibex
#

ok

turbid bough
#

idk what you need help with then if the library isnt returning anything

sudden geyser
#

thats why i moved to eris
i recommend moving to eris from djs
@digital ibex I use Eris myself but there are a lot of things I feel are just missing or implemented weirdly. The most obvious being the docs itself.

digital ibex
#

eris is better what can i say

sudden geyser
#

depends on the category it's better in

digital ibex
#

and thats why i use it tbh

turbid bough
#

ok, to make sure

#

the member is online right?

#

not invisible

#

it might work on other users, but idk.

#

since discord's fucked i guess

digital ibex
#

thaun:

  1. the member is online, 3rd time,
  2. i'm literally saying the type is ?object, its obviously going to happen, i'm just stuck how to get the clientStatus
  3. u don't even know half of the stuff u r talking about
#

and no

turbid bough
#

"i'm just stuck how to get the clientStatus"
you dont know how either

digital ibex
sudden geyser
#

?object means it could be null/undefined. What exactly are you trying

digital ibex
#

yes

turbid bough
#

he trying to access it

digital ibex
#

i'm trying to get the clientStatus of a member

turbid bough
digital ibex
#

but everything i've tried its returning undefined

#

which isn't a problem with the library

sudden geyser
#

can you show the code of how you're doing it? is the member not cached?

digital ibex
#

u r talking about the clientStatus or the status ?

#

kk

sudden geyser
#

clientStatus

digital ibex
#
        let platform = message.member.clientStatus;
            platform = {web: 'web', desktop: 'desktop', mobile: 'mobile'}
if(platform === 'web') platform = 'Browser';
if(platform === 'desktop') platform = 'Desktop';
if(platform === 'mobile') platform = 'Mobile';
sudden geyser
#

why are you re-assigning platform? Also, you're not accessing any of the properties.

#

You're just checking if an object is equal to a string.

digital ibex
#

thats what i thought i had to do, because nothing would get me to web, desktop or mobile

turbid bough
#

i dont understand that lol

sudden geyser
#

clientStatus returns an object of { web: String, desktop: String, mobile: String }. String is either online or offline. You'd need to find the key of the object where it's online.

digital ibex
#

mk

#

<member>.clientStatus returns undefined

turbid bough
#

back to start

digital ibex
#

if thats not what ur saying?

sudden geyser
#

yeah well the property is not guaranteed to exist. That's why it has ? on it. If it doesn't exist, are you sure the member is online?

digital ibex
#

yep

#

i'm using message.member

#

so

#

me

#

i'm online

turbid bough
#

cant do anything about it

#

if its not returning anything it does not return anything

#

api's fault

digital ibex
#

kinolite, im confused on how to even get to that object

sudden geyser
#

for me it works, but data.client_status is from the API (Eris source code), so I'd just check if the property exists.

#

how do you get which object exactly? Like how to access it?

digital ibex
#

well

sudden geyser
#

or could you show what Member is and what you get when you try clientStatus on it

digital ibex
#

idk how 2 access it but i'm trying to access {web: String..}

#

Member is message.member

pale vessel
#

what are you trying to access?

sudden geyser
#

you'd loop over the object and find which one is equal to online

#

such as using Object.keys and then using .find

pale vessel
#

.find on an object?

sudden geyser
#

an array

#

of the object keys

#

at least that's how I do it

turbid bough
#

thats kinda weird way to do it

digital ibex
#

anything i do with clientStatus it says its undefined

#

can't find a way around it

pale vessel
#

you can't debug it?

earnest phoenix
#

download the member to force the gateway to give you presence data

digital ibex
#

im trying to

#

but its undefined on everything

turbid bough
#

you could try guild.getRESTMember(id)

earnest phoenix
turbid bough
#

he is using eris

earnest phoenix
#

rest doesn't give presence data

#

oh

#

my bas

#

bad*

digital ibex
earnest phoenix
#

anyways, presence is gateway only

digital ibex
#

im not using REST mode on my client shit

turbid bough
#

i mean ive asked on api discord, and they said its just is like that

pale vessel
#

how helpful

#

oh it's abal

earnest phoenix
#

it might be due to recent changes with intents

#

discord placed intents in place to fight against data scraping bots

#

you might need to get verified and enable those intents first

digital ibex
#

i've had this issue for over a month

#

so

turbid bough
earnest phoenix
#

that

digital ibex
#

i just came back to it because i finished my whois command

#

well, nearly finished

turbid bough
#

btw, idk why

#

but "read more"

#

barely gives any info about what the fuck it is

pale vessel
#

it's discord lul

turbid bough
#

just links an announcement

earnest phoenix
#

their team is trash and consisted of mostly interns and not professional devs

turbid bough
#

but no api links for what its for

#

and another link above that is another announcment

#

which is like info for non-developers

earnest phoenix
#

tldr intents are to stop data scraping which has been a huge issue with discord in the past, if you want to use most intents in over 100 guilds, you need to get verified

#

verification is done manually right now so they get to see which bots do what

copper cradle
#

lol

#

I hope I get verified soon

sudden geyser
#

I don't know if I'm the only one who feels verification being open at 75 then required at 100 is weird for bots that may be trending.

turbid bough
#

would 100 guilds count as trending?

#

ah well, i think it could get 25 more guilds within a week yeah

earnest phoenix
#

it depends on the grow rate

turbid bough
#

once all applicants have been done, its probably alot easier to do bot verification reviews alot sooner

#

and will take probably a few days.

#

and thats also why they havent made it mandatory right now.

sudden geyser
#

yeah it's the grow rate I mean. Say your bot gets on trending on dbl and earns servers quickly (it does depending on how you do). Hitting the 100 mark won't be long.

turbid bough
#

you mean the trending new bot called mee6?

earnest phoenix
#

the EA of discord

sudden geyser
#

mee6 is big meme

turbid bough
#

ah nvm, thats 2019 lol

#

and that was in trending

sudden geyser
#

I mean the top non-auction'd bot on trending is @earnest phoenix (Profile Picture Bot) was approved yesterday and claims to have 230+ servers.

turbid bough
#

yep, it does have 243 servers as discord reports it as

#

approved yesterday, but was made in march 14th

#

but i dont know if it was mid-dev by then

true tundra
#

Do you guys know how to make it where certain roles have access to certain emojis?

turbid bough
#

impossible

#

the only thing you can have closest to "emote per roles" is having a command that just responds with that picture depending on what role you have

#

or use global emotes, that noone has access to that server, and only the bot.

true tundra
#

Oh

#

Someone told me you can do it by discord api

turbid bough
#

im not exactly sure what he meant by that then

#

ah nvm, it is

#

just found it

true tundra
#

Oh oksy

turbid bough
#

ah nvm, you can modify it

true tundra
#

Way do you mean modify

turbid bough
#

you can restrict roles to an existing emoji

true tundra
#

So only certain roles can use it?

turbid bough
#

yes

true tundra
#

Okay ty

prime fox
#

someone teach me how to make custom prefixes without using json

earnest phoenix
#

@prime fox (impossible)

prime fox
#

oh noes

earnest phoenix
#

You need to either use a json or db

turbid bough
#

try using another language

#

like c#

slender thistle
#

Use database, load prefixes on bot startup, keep them and work with them in cache nekothinking

turbid bough
#

that does not use json

prime fox
#

db

#

yes

#

but

#

idk how to use a vps

#

setup on my vps

#

any recommendations?

earnest phoenix
#

@turbid bough there's no Language that doesn't use a json or db to store data in a place

turbid bough
#

oh wait, json, oh lol ok i thought something else lol.

#

i read presence

#

or embed

true tundra
#

@turbid bough Your talking about the Modify Guild Emoji right,?

turbid bough
#

or brain

#

yes

true tundra
#

Okay

turbid bough
#

you dont need to use a vps just for db

true tundra
#

Who

turbid bough
#

talking about the guy above who asked for custom prefixes without json

true tundra
#

Oh ok

bronze salmon
#

Another tip is to cache your prefixes in an array (or hashmap in java) if you're using a DB to make response time faster.

high bough
#

Guys, quick question

turbid bough
#

i think my EF core caches stuff already so i think im good i guess?

earnest phoenix
#

ef core does very small amount of caching

high bough
#
try {
if (message.createdTimestamp >= channel.lastspawn + (Math.round(Math.random() * 300000) + 300000)) {
const item = neko[Math.round(Math.random() * neko.length)];
const filter = response => {
return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};
message.channel.send(embedneko).then(() => {
message.channel.awaitMessages(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
message.delete({ timeout: 5000 })
auth.save().catch(err = console.log(err))
message.channel.send(`${collected.first().author} caught a neko!`)
})
.catch(collected => {
message.channel.send('The neko was let loose!')
});
});
channel.lastspawn = message.createdTimestamp
channel.save().catch(err => console.log(err))
}
} catch (err) {
console.log(err);
}
```This is the code, then I want to delete the response messages and the awaited message, how can I do that?
earnest phoenix
#

e.g keys iirc

high bough
#

I want to delete the embed that will be sent after its collected the answer

turbid bough
#

store the message you sent into a variable

#

then do message.delete

high bough
#

hmm

earnest phoenix
#

hi my music bot perfect runing and console erorrs help js 1|chino-test | Could not extract html5player key: https://www.youtube.com/s/player/bfb2a3b4/player_ias.vflset/en_US/base.js

green vale
gilded gazelle
#

how would you make a bot react with 1️⃣

tight plinth
#

@earnest phoenix u dont care about this error

#

@green vale try it and see

earnest phoenix
#

@gilded gazelle react to it's own message or the user's?

green vale
#

I only have one shard at the moment though, is it possible for me to spawn two shards?

tight plinth
#

@gilded gazelle <message>.react('EMOJI ID OR UNICODE EMOJI')

#

yes

#

just spawn another lol

gilded gazelle
#

yeah but I can't see the \1️⃣

tight plinth
#

its unicode

#

u need to copy paste the unicode emoji

gilded gazelle
tight plinth
green vale
#

hot

tight plinth
#

plz learn how to read

green vale
#

why did i say hot

tight plinth
#

coz

earnest phoenix
#

=>
Mobile: :- EMOJI
or
Pc: /EMOJI
@gilded gazelle

#

To get the Unicode of the emoji

turbid bough
tight plinth
#

/angeryBOYE

earnest phoenix
#

Wot

tight plinth
earnest phoenix
#

Yup

tight plinth
#

lol

gilded gazelle
#

/1️⃣

turbid bough
#

\1️⃣

#

it wont work cause its discord

tight plinth
#

no

earnest phoenix
#

TRIGGERED

tight plinth
#

it only works with custom emojis

gilded gazelle
#

ah, alright thanks

tight plinth
#

this one is not

earnest phoenix
#

Yea...
Why would you try to get the Unicode of an emoji that already exists in the keyboard data or something

turbid bough
#

1️⃣

earnest phoenix
#

(Just paste the pre-loaded emojis to=>
<message>.react("✅");
)

#

Easy

gilded gazelle
#

thanks

earnest phoenix
#

Np

green vale
earnest phoenix
#

number emojis are consisted of two different characters

#

the number + enclosed keycap

#

Does someone know how to make a javascript link?

#

what

#

A javascript link

#

Javascript:

green vale
#

it's just running js code in the browser

#

from the omnibar

tight plinth
#

why

green vale
#

I'm trying to implement shards, and the shard just immediately exits

tight plinth
#

for me they dont

green vale
#

I'm doing it in Discord.js so

#

Do you want to see my code?

tight plinth
green vale
#

I used that yes

tight plinth
#

oof

#

well idk

#

I use their code

#

and it works

green vale
#

Do I need to do anything else besides using a sharding file?

tight plinth
#

I'm trying to find current shard id

green vale
#

I mean sure I have to change a bunch of things with grabbing users and guilds for my bot but

#

sigh

turbid bough
#

arent you doing it wrong though?

#

client.shard.broadcastEval returns null

green vale
#

Yeah currently it's wrong because I'm not sharding

turbid bough
#

is it supposed to return a response from all the shards?

green vale
turbid bough
#

rip

restive furnace
#

try spawn 2 shards

turbid bough
#

how many shards are you trying to spawn?

restive furnace
#

shard.spawn(1)

#

1 = how many shards he is spawning.

#

so 1

turbid bough
#

right

#

can you try setting totalshards in options?

green vale
#

Hm alright

turbid bough
#

also, i dont see autoSpawn in the documentations either

green vale
#

yeah.

restive furnace
#

shard.spawn(); it spawns discord recommended amount of shards

turbid bough
#

in the documentations it says it defaults to this.totalShards

green vale
#

hmm

turbid bough
#

though, i dont know if thats set by discord though

restive furnace
#

check official api documentation.

green vale
restive furnace
#

there it says that

turbid bough
#

i just said "in the documentations"

restive furnace
#

discord.js docs

turbid bough
#

yes "in the documentations"

green vale
#

Yeah, I'm checking docs

#

it keeps on saying this

turbid bough
#

index.js is your main bot file right?

restive furnace
#

index.js = sharding file bot.js = bot code

green vale
#

Index.js is my main bot file, sharding.js is the main project file

#

I have it so Node starts sharding.js

#

It kept spamming it until I switched back to no shards and restarted Node

tight plinth
#

in this shard all guilds dont have bot status

#

why

green vale
#

Maybe I should try two shards

#

aaaaaand it's happening again

turbid bough
#

it might be beacuse you are trying to do something while its spawning shards?

tight plinth
#

the problem is idk what

turbid bough
#

in discord.js its default docs it says its 5500ms delay each shard spawn, but im not sure about yours

tight plinth
#

there is no error directly linked to my code

#

I use default values

green vale
#

I'm on v11

#

The delay is 7500

turbid bough
#

oh you guys are both using eris?

green vale
#

I'm on DJS

tight plinth
#

I was

turbid bough
#

oh ok

tight plinth
#

but its shit

green vale
#

I just use v11

tight plinth
#

team v12

green vale
#

eris kinda has lack of tutorials so

turbid bough
#

i cant find much documentations about sharding in eris docs lol

green vale
#

I'm gonna try the DJS.guide snippet

turbid bough
#

is eris buildt ontop of discord.js?

green vale
#

no

tight plinth
#

no

green vale
#

eris is an entirely different wrapper

turbid bough
#

ah ok

#

yeah im dumb

green vale
#

I used the snippet that DJS.guide provided

tight plinth
#

get rekt snekfetch

green vale
#

am sighing

#

Why is it saying 'unauthorized'

turbid bough
#

did you still have the autospawn in the config?

#

and the spawntimeout

#

cause i see you arent doing anything wrong

green vale
#

Let's see if this works

wheat jolt
#

isn't snekfetch deprecated?

green vale
#

Now it's spamming that Shard 0 exited before client became ready

#

What the fuck am I doing wrong sadjowiegroeij

turbid bough
#

what does your bot file look like?

#

wait a minute, why does discord.js require token on both the bot.js and the index.js

pale vessel
#

it's supposed to be like that

green vale
#

I won't show that but it's based on An Idiot's Guide's guidebot so I'll give you the file for that (it has the same handler and stuff in the file so)

#

And yeah you need token on both

#

--Actually my bot's on GitHub so I'll also give you that (it's not updated to the latest stuff on my bot, and it's also on v11 so)

turbid bough
#

you have disabled express whilst trying to use sharding right?

green vale
#

No because I need to keep it on-

#

Wait do I have to do that?

turbid bough
#

well, since you are sharding, if you would have 3 shards, you would then open 3 express's within the same port.

#

unless thats how it works?

green vale
#

i'm dumb

#

wait-

#

My Express server is completely separate of the bot itself and it wouldn't make sense if it spawned multiple

turbid bough
#

oh yeah i searched up express keyword and they were unused anyway

#

oh nvm, exept that keepOnline.js script

green vale
#

keepOnline is required for me because of the nature of my host

turbid bough
#

yeah, but that would probably only work for one of the shards, not the rest of them.

#

probably would give out an error