#development

1 messages · Page 851 of 1

sullen salmon
#

Discord js latest

uneven egret
#

i have 6 BOT in my server

elder vine
#

{client}.fetchUser("ID_HERE")

sullen salmon
#

That no longer works @elder vine

sudden geyser
#

fetchUser is v11

elder vine
#

use fetch then

sudden geyser
#

<GuildMemberManager>.fetch is v12

sullen salmon
#

I tried using that fetch but it always gives undefiend @sudden geyser

sudden geyser
#

show code

sullen salmon
#

I deleted it 1 sec

#

And that prints a "promise" whatever that is

sudden geyser
#

it returns a promise

#

resolve the promise then log it

sullen salmon
#

How do you do that

sudden geyser
#

myPromise().then((theValue) => {...})

#

or use async/await

sullen salmon
#

Huhhhhhhh

#

THa&gzpé!'ế

#

THis is trash

sudden geyser
#

what is

sullen salmon
#

I can't use the promise how tf does it all work

elder vine
#

Use async/await

sullen salmon
#

What is wrong with this

elder vine
#

Alright

sullen salmon
#

Is that even a thing in js?

sudden geyser
#

learning js would help

elder vine
#

here you pass an async .then(async (member) => {

#

to use it inside {}

#

oh

#

f

sullen salmon
#

Ok nah I'll just loop over all members

elder vine
#

no

sudden geyser
#

you don't have to, as you've already done so by using .then all you need to do is log member

sullen salmon
#

Nvm

#

It's fine

#

I'll fix it

elder vine
#

alright

pale vessel
#

js is complicated

earnest phoenix
#

hello, i want to make a git pull command thats pull from the git repo, how do i make like that
lib: discord.py

#

using subprocess module ?

#

how to update node js under linux?

#

@earnest phoenix try apt upgrade nodejs -y maybe...

#

Thanks 😉

#

Np

nocturne grove
#

What does guildMember.partial mean? That the object does not contain every property?

earnest phoenix
#

is my bot ping between 60 and 105 good?

nocturne grove
#

How did you measure that?

#

Usually I'd say that's good

hallow sandal
elder vine
#

You gotta provide email and password when pulling.

hallow sandal
#

How do I do that?

elder vine
#

Seems like you did that

#

It should prompt you with login

hallow sandal
#

Well, Im already logged in Heroku in the terminal

sudden geyser
#

What does guildMember.partial mean? That the object does not contain every property?
@nocturne grove from the docs: https://discord.js.org/#/docs/main/stable/topics/partials

nocturne grove
#

@sudden geyser that's what made me ask it. I looked at that first

sudden geyser
#

It does mean an object may not contain every property.

nocturne grove
#

okay thank you!

marble juniper
#

can you already use server templates in discord.js or at any api endpoint

slender thistle
#

I don't think it's safe to allow bots to use server templates

marble juniper
#

well my friend has a bot which can load server templates

zenith terrace
#

Xenon GWjiangoOmegaLUL

marble juniper
#

also its discord server templates

#

not xenon

narrow kettle
#

[python] is there any way to add ; before every , in a tuple?

slender thistle
#

The comma that separates tuple elements?

narrow kettle
#

yes

slender thistle
#

Uhh...??? Add ; to every element in a tuple?

narrow kettle
#

yeah so im not sure how

#

do i need to make it into a list?

slender thistle
#

iterate over the tuple

#

elem += ';'

narrow kettle
#

wait im not sure actually

#

look dms

hallow sandal
#

@elder vine Do you know how I can avoid the error?

elder vine
#

What error?

grizzled raven
#

syntax error

slender wagon
#

\nServer Created at: ${message.guild.createdAtTimestamp} i want it to show the time when the server was created

#

any idea

knotty steeple
#

isnt it just createdAt

earnest phoenix
#

Yup it's
message.guild.createdAt

slender wagon
#

DAMNN

#

so i've spent my 15 minutes on bullshit ;D

#

thank you!

elder vine
#

xD

earnest phoenix
#

Np... But 15 minutes on this?...
Damn...

elder vine
#

Or you could display it nicer with moment module

summer torrent
#

createdAt or createdTimestamp

elder vine
#

but then you have to use the timestamp

slender wagon
#

oh okay

#

it worked!

#

thank you

elder vine
#

then you can display in which order you want, and the information you want.

slender wagon
#

yeah for example Thu Nov 08 2018 20:32:42 GMT+0100 (Central European Standard Time)

elder vine
#

Well, that is kinda, you know - filled up with a lot

slender wagon
#

after the 2018 i don't want the other part

#

yeah that's what i'm trying to say

elder vine
#

Yep, you can use the moment module

knotty steeple
#

just slice it off

slender wagon
#

thank you!

knotty steeple
#

no need for extra deps

summer torrent
#

use moment package

slender wagon
#

installing it rn

elder vine
#

Well with moment, you customize more - in my opinion it works better

slender wagon
#

yep i'm reading abt it rn

earnest phoenix
#

I have set it to delete the message within 10 seconds but will not delete it CODE ```js
let van = new Discord.MessageEmbed()
.setColor('#30acff')
.setDescription("Ilyen felhasználó van már az adatbázisban\nHa elfelejteted a jelszavad a weboldalon az elfelejtet jelszó fülön megváltoztathatod\n Website")
.setFooter(Ez az üzenet 30 másodperc mulva törlődik, bot.user.displayAvatarURL())

message.author.send({embed: van}).then(msg => msg.delete(10000))```

elder vine
#

What is the error?

earnest phoenix
#

not deleted message 10 sec

elder vine
#

Do you get any error in console?

earnest phoenix
#

not error

elder vine
#

message.author.send(van).then(msg => {
msg.delete(1000)
});

#

Should work, idk

mossy vine
#

elfelejtett* btw

earnest phoenix
#

ó Cyber még nem néztem átt csak teszt

#

😛

elder vine
#

English please :P

earnest phoenix
#

okey

mossy vine
#

what version of d.js

#

nvm i see from MessageEmbed

#

message.delete({timeout: 10000})

#

they changed the api for that

#

@earnest phoenix

earnest phoenix
#
message.author.send(van).then(message.delete({timeout: 10000})```
#

?

mossy vine
#

keep the arrow function

elder vine
#

no

tight plinth
#

@earnest phoenix try it and see

earnest phoenix
#
message.author.send(van).then(msg => {
                msg.delete({timeout: 10000})
            });```
#

Working TANKS 😉

elder vine
#

Good.

earnest phoenix
elder vine
#

You can.

#

just fetch messages by the bot and delete them

earnest phoenix
#

how?

elder vine
#

use the fetchMessages()

#

for v11 ^

#

idk about v12

#

then just delete them for each message using forEach

summer torrent
#

messages.fetch

knotty steeple
#

christmasthink how would i log when a shard has connected

#

and how do i actually shard

summer torrent
earnest phoenix
#

so far it hasn't been 10 seconds for him

grizzled raven
#

sammy what version of djs are you on

knotty steeple
#

stable

earnest phoenix
#

newest

#

I updated the node js 1 hours

knotty steeple
#

also internal sharding

#

is what i want to try

#

also doesnt this mean i have to put an event in an event or is there a better and less dumb way

grizzled raven
#

tim said that all you had to do was just shards: "auto"

knotty steeple
#

i want to log when each one connects

#

@grizzled raven

slender wagon
#

${message.guild.roles}I need a role counter

#

what should i add uwu

tight plinth
#

.forEach(role => counter+=1)

knotty steeple
#

cant you just get the size of a collection

#

lul

slender wagon
#

confusion

knotty steeple
#

<Collection>.size

#

huh

tight plinth
#

works too

slender wagon
#

aight

#

thank you i'll try em out

quartz kindle
#

@knotty steeple you need the raw event for shard ready

knotty steeple
#

and where does it say about that

#

thonks

quartz kindle
#

it doesnt

#

raw is undocumented

knotty steeple
#

nice

quartz kindle
#

but you can do js client.on("raw", p => { if(p.t === "READY") { console.log(p.d) } })

#

you will see the contents of the shard ready packet

#

it includes the shard ID and number of guilds it holds

tight plinth
#

.t

#

uwu

quartz kindle
#

t = type
d = data

tight plinth
#

o

knotty steeple
#

so is it that i set totalShards to auto

grizzled raven
#

@quartz kindle would each shard's connection ready event be different to the client ready event?

knotty steeple
#

on the ShardingManager

grizzled raven
#

shards to auto

#

no sharding manager required

#

for internal

knotty steeple
#

oh on the client

#

eep

quartz kindle
#

yes

#

it goes like this

mystic violet
#

How would you play a file using ffmpeg in a voice channel (discord.js) without the stock functions because I dont think they use pure ffmpeg

#

would I use connection.play(ffmpeg(path))?

quartz kindle
#
  1. login
  2. get recommended shards
  3. shard 1 connects (raw shard ready event)
  4. shard 1 receives list of guilds (guildcreate events)
  5. shard 1 ready (shardReady event)
  6. shard 2 connects (raw shard ready event)
  7. shard 2 receives list of guilds (guildcreate events)
  8. shard 1 ready (shardReady event)
    .... repeat for N shards
  9. client ready event
knotty steeple
#

if i log p.d.shard i just get an array of 0, 1

#

e

quartz kindle
#

should get [0,1] on the first ready event

#

then [1,1] on the second

knotty steeple
#

but wait there is also a shardReady event

#

thonks

quartz kindle
#

the shardReady event fires at the end

#

when it receives all guilds

#

updated the list above

knotty steeple
#

also wym the second ready

quartz kindle
#

the discord API itself only sends one ready event, that is when a shard connects

#

then discord.js fires all those additional events when it finished getting all guilds

#

shardReady for individual shards and ready for all shards

elder vine
knotty steeple
#

yea thats what im looking at

#

so if im using internal sharding also

#

broadcastEval and stuff doesnt work right

quiet wave
#

Tebrik ederim @knotty steeple! Seviye atladın ve 8 seviye oldun!

knotty steeple
#

uhh

#

lmao

#

@modern sable

#

userbot

quartz kindle
#

so

#

how did you trigger it lol

#

so if

#

so if im

knotty steeple
#

level up message?

quartz kindle
#

oh possible

modern sable
#

yeah thats a level up message and they had a fucked twitch status

quartz kindle
#

yeah broadcasteval doesnt work with internal

knotty steeple
#

so what would you do instead then

#

does a normal eval function just work

nocturne grove
#

Can anybody explain why my await functionOne(args) is not working, when functionOne() is async and the await functionOne(args) is located inside an async function? It's really irritating me and working with promises is far from ideal.

quartz kindle
#

you have everything available in the same process

#

you can access it directly

knotty steeple
#

speaking of i probably should make my eval command

quartz kindle
#

@nocturne grove error?

elder vine
#

Show code

lyric mountain
#

@nocturne grove are you calling the method correctly? what error does it throw?

nocturne grove
#

I don't get an error. It's just executing in the wrong order

knotty steeple
#

oh yes also

nocturne grove
#

and that's not the intention

quartz kindle
#

show code

knotty steeple
#

how do i make it to it loads my commands first

nocturne grove
#

I will explain it really quick

lyric mountain
#

just show code

#

it's better than a thousand words

knotty steeple
#

cuz im just reading a directory to see what commands are there then putting it into a collection

nocturne grove
#

ok but it's long, I can just say how it works maybe

knotty steeple
#

sometimes it doesnt events first and sometimes it does commands first

lyric mountain
#

use hastebin

elder vine
quartz kindle
#

@knotty steeple you can use sync code to load initial files

#

ie readdirSync

knotty steeple
#

oh yea i wasnt using that

nocturne grove
#

This is executed when my bot is starting:```js
client.guilds.forEach(guild => {
con.query(SELECT * FROM rolecounterdata WHERE guild_id = ${guild.id}, async function(err, guildrolecounters) {
if (err) return consolelog.execute(err);
if (!guildrolecounters[0]) return;

                await log(guild, ':unlock: I am back online! I will continue counting role members for your server.', ['startup'], ' when I was offline');
                checkpermission(guild, ' when I was offline', guildrolecounters);
                startupcounters(guildrolecounters, guild);
            });
        });```

It's all about those 3 functions in the end. I will show them entirely, they should be fully (or for 80% at least) executed before the next one will be executed.

#
async function log(guild, message, logtype, messageaddition) {
            con.query(`SELECT * FROM logpreferences WHERE guild_id = ${guild.id}`, function(err, logpreferences) {
                if (err) return consolelog.execute(err);
                con.query(`SELECT * FROM serverdata WHERE guild_id = ${guild.id}`, function(err, serverdata) {
                    if (err) return consolelog.execute(err);
                    if (serverdata[0].logchannel == 'off' || serverdata[0].logchannel == 'custom' && [0, undefined].includes(logpreferences[0][logtype[0]]) && [0, undefined].includes(logpreferences[0][logtype[1]]) && [0, undefined].includes(logpreferences[0][logtype[2]])) return;
                    const logchannel = guild.channels.get(serverdata[0].logchannel_id);
                    if (!logchannel) {
                        adminloop(guild, messageaddition, 'Log channel deleted', 'My log channel was deleted', 'I deleted it from my database and turned logs off.');
                        return insertdata.execute('serverdata', 'logchannel', guild, 'off', undefined, 'logchannel_id', null);
                    }
                    if (!logchannel.permissionsFor(guild.me).has('SEND_MESSAGES') || !logchannel.permissionsFor(guild.me).has('READ_MESSAGES') || typeof message == 'object' && !logchannel.permissionsFor(guild.me).has('EMBED_LINKS')) {
                        adminloop(guild, '', 'Can\'t send message in log channel', `I am not able to send my log in ${logchannel}`, 'I turned logs off for now. Make sure to give me the \'Send Messages\', \'Read Messages\' and \'Embed Links\' permissions in that channel. Then, reactivate logs.');
                        consolelog.execute('off automatically', guild, 'setlogs');
                        return insertdata.execute('serverdata', 'logchannel', guild, 'off');
                    }
                    logchannel.send(message);
                });
            });
        }```
#
function checkpermission(guild, messageaddition) {
            con.query(`SELECT * FROM rolecounterdata WHERE guild_id = ${guild.id}`, function(err, result) {
                if (err) return consolelog.execute(err);
                if (!result[0] || !client.guilds.get(guild.id)) return;
                const deletedpermsembed = new Discord.RichEmbed().setColor('#FF0000');
                if (messageaddition) {
                    deletedpermsembed
                        .setTitle('Manage channel permission has been removed')
                        .setFooter('When I was offline');
                }
                else {
                    deletedpermsembed
                        .setTitle('Manage channel permission was removed')
                        .setTimestamp();
                }
                result.forEach(function(rolecounterdata, index) {
                    const counterchannel = guild.channels.get(rolecounterdata.counterchannel_id);
                    if (counterchannel && (!counterchannel.permissionsFor(guild.me).has('MANAGE_CHANNELS') || !counterchannel.permissionsFor(guild.me).has('CONNECT'))) {
                        deletedata(guild, guild.roles.get(rolecounterdata.role_id));
                        deletedpermsembed.addField(rolecounterdata.counterchannel_name.replace(/\\/g, '\\\\'), `role name: ${rolecounterdata.role_name.replace(/\\/g, '\\\\')}\nrole size: ${rolecounterdata.rolesize}`);
                    }
                    if (index == result.length - 1 && deletedpermsembed.fields.length > 0) {
                        deletedpermsembed.setDescription(`I stopped counting for the following counter${deletedpermsembed.fields.length > 1 ? 's' : ''}:`);
                        log(guild, deletedpermsembed, ['counterchannel_delete'], messageaddition);
                    }
                });
            });
        }```
#

the last one doesn't matter though, and that's a really long one

quartz kindle
#

@nocturne grove you want each guild to await for all three functions to resolve before proceeding to the next guild?

elder vine
#

hastebin please :P

nocturne grove
#

no, wait

#

The problem is that in some cases, the log function will turn the log channel from the guild off. And it should wait for that to happen, because in the checkpermission and startupcounters function, the log function will be executed again. Now, it just executes the log functions in checkpermission & startupcounters before the the first log function was fully executed

mystic violet
#

How would you play a file using ffmpeg in a voice channel (discord.js) without the stock functions because I dont think they use pure ffmpeg
would I use connection.play(ffmpeg(path))?

#

instead of connection.play(path)

nocturne grove
#

so it could be that the log function in the first code blocks toggles the log channel to off, but the log function referred to in the checkpermission function still thinks the log channel is on (but it should already been toggled off then)

quartz kindle
#

@nocturne grove because you're working with callback functions

#

promises do not affect callbacks

nocturne grove
#

I hope I've made it clear, but it's still really vague I guess

quartz kindle
#

you need to convert the callback itself into a promise

#

for example

nocturne grove
#

can't I use await/async for this? As promises are making the code longer and not really nicer

quartz kindle
#
async function() {
  bla(bla,function() {
    return 10
  })
  return 20
}``` this function will return 20 no matter if you await it or not, because the callback function from the bla function starts a whole separate block of code that is completely independent from the async function
nocturne grove
#

so it's because of the fact I have (for example) a con.query thing in the function?

quartz kindle
#

since you are working with a database that uses callbacks, you cant await them like that, you need to create a new promise for each callback in order to correctly promisify it

#

for example

#
function() {
  return new Promise((resolve,reject) => {
    bla(bla,function(result){
      resolve(result)
    })
  })
}```
#

the function returns a promise, instead of the function itself being async

#

and this promise contains the database query and only resolves when the callback is resolved

nocturne grove
#

yeah that's what I did with the log function, but I should resolve it at multiple places then, because the functions won't always be executed until the last line

#

one promise worked, but I have to put the resolve() every time there's a 'return' in my code, so 5 times (and a resolve in the last line)

#

Is there no better way?

quartz kindle
#

you can make one promise resolve only the very final value

nocturne grove
#

but then my code never continues to the functions underneath it, right?

#

if I never resolve them

quartz kindle
#

not until the promise is resolved

nocturne grove
#

so I'd have to resolve it on 6 different places

quartz kindle
#

you'd have to resolve or reject all possible outcomes of it

#

in order to avoid it getting stuck waiting forever

nocturne grove
#

and reject just stops the function?

quartz kindle
#

yes, reject throws an error

nocturne grove
#

oh that's not what I want. So for me, I won't use reject

quartz kindle
#

you can resolve the error instead of rejecting it

#

so the error will be returned instead of thrown

nocturne grove
#

ah okay

quartz kindle
#

for example, if the database gives you an error, you can simply return resolve()

#

which is the same as return undefined in a normal function

nocturne grove
#

okay okay thank you! (I really have to go now) but thanks for your help!

#

Hope it will work eventually

quartz kindle
#

👍

obtuse wind
#

This is gonna sound stupid but whatevs, what would I add to my softban command to clear messages for the past 7 days?

because I'm having trouble understanding the documentaion from discord.js.org .-.

amber fractal
#

?

#

it's just an object

#

{days:7}

obtuse wind
#

k thx

amber fractal
knotty steeple
#

the bot is only in 2 guilds so mmulu

earnest phoenix
pale vessel
#

must be wrong endpoint

#

maybe you're missing a version?

earnest phoenix
#

can you help me fix it ? @pale vessel

#

there’s no endpoint there’s some problem there is no route

pale vessel
#

it might be on glitch's end

quartz kindle
#

show code?

elder vine
#

It's a website

#

with confusing sorting in folders

quartz kindle
#

might as well be an express server

grizzled raven
#

@quartz kindle does the client guildCreate event get emitted for every guild the shard has?

#

so then would you have to make it return if the client isnt ready

nocturne grove
#

I can't put something to be executed in between resolve(here), right?

#

But can I do js resolve() console.log(true);for example?

quartz kindle
#

@grizzled raven when the client connects, discord sends you all the initial guild information in the form of GUILD_CREATE packets. these packets are identical to the packet send when a guild is joined, but discord.js takes care of that and wont emit its own guildCreate events until the client is ready, which only becomes ready after all the initial GUILD_CREATE packets are received

#

so you will only see the initial GUILD_CREATE packets through the raw event, they will never show in the guildCreate event

#

@nocturne grove resolve() doesnt imply return, so you actually can run code after you call resolve()

#

what you put inside the resolve arguement is what will be returned by the promise

nocturne grove
#

so in my case, I do have to return ánd resolve()?

quartz kindle
nocturne grove
#

I'm sorry but I don't really understand things like that, but I guess I'd have to do them both

earnest phoenix
#

plese help me console log ```js
/home/dc/node_modules/mysql/lib/protocol/Parser.js:437
throw err; // Rethrow non-MySQL errors
^

TypeError: Cannot read property 'client' of undefined
at new MessageEmbed (/home/dc/node_modules/discord.js/src/structures/MessageEmbed.js:13:60)
at Query.con.query (/home/dc/commands/help.js:61:21)
at Query.<anonymous> (/home/dc/node_modules/mysql/lib/Connection.js:526:10)
at Query._callback (/home/dc/node_modules/mysql/lib/Connection.js:488:16)
at Query.Sequence.end (/home/dc/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
at Query._handleFinalResultPacket (/home/dc/node_modules/mysql/lib/protocol/sequences/Query.js:149:8)
at Query.EofPacket (/home/dc/node_modules/mysql/lib/protocol/sequences/Query.js:133:8)
at Protocol._parsePacket (/home/dc/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/home/dc/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/home/dc/node_modules/mysql/lib/protocol/Parser.js:43:10)

zenith terrace
#

client is undefined

nocturne grove
#

@earnest phoenix send the code where it went wrong

summer torrent
#

show help.js 61th line

earnest phoenix
#

help.js 61 line js let hhelp = new Discord.MessageEmbed()

quartz kindle
#

@nocturne grove in the first example i did r(10), which returns 10 but doesnt exit the function, so the console.log right after will still work
in the second example i did return r(10) which returns 10 and exists the function, so the console.log right after will not run

summer torrent
#

what is your djs version Thonk

earnest phoenix
#

newlest

zenith terrace
#

Show code

quartz kindle
#

whats your node.js version?

earnest phoenix
#
const Discord = require("discord.js");
module.exports = {
  name:'help',
  description: 'help!',
  status: 'on',
  async execute(bot, message, args, con) {


    con.query(`SELECT * FROM prefix WHERE id = ('${message.guild.id}')`, async (err, rows) => {
    if(err) throw err;
        
        if (rows[0].help === 1) {
            let coff = new Discord.MessageEmbed()
            .setColor('#ff5930')
            .setAuthor(`${bot.user.username} - ERROR`, bot.user.avatarURL())
            .setThumbnail(bot.user.avatarURL())
            .setDescription(":no_entry: Ez aparancs ki van kapcsolva! :no_entry: ");

            message.channel.send({embed: coff})
        } else {
      

  con.query(`SELECT * FROM prefix WHERE id = '${message.guild.id}' `, (err, rows) => {
    if(err) throw err;```
#
const anime = rows[0].anime
    const baka = rows[0].baka
    const cute = rows[0].cute
    const fox = rows[0].fox
    const hug = rows[0].hug
    const kawaii = rows[0].kawaii
    const kiss = rows[0].kiss
    const neko = rows[0].neko
    const pat = rows[0].pat
    const slap = rows[0].slap
    const food = rows[0].food
    const smug = rows[0].smug
    const tickle = rows[0].tickle
    const poke = rows[0].poke
    const help = rows[0].help
    const website = rows[0].website
    const uptime = rows[0].uptime
    const mutecommand = rows[0].mutecommand
    const unmute = rows[0].unmute
    const clear = rows[0].clear
    const boobs = rows[0].boobs
    const cum = rows[0].cum
    const hentai = rows[0].hentai
    const kitsu = rows[0].kitsu
    const lewd = rows[0].lewd
    const lick = rows[0].lick
    const pussy = rows[0].pussy
    const trap = rows[0].trap
    const yuri = rows[0].yuri
    const stats = rows[0].stats
    const howgay = rows[0].howgay
    const love = rows[0].love```
#
const prefix = rows[0].prefix;
        let hhelp = new Discord.MessageEmbed()
        .setColor('#30acff')
        .setAuthor(`${bot.user.username} - Commands List`, bot.user.avatarURL())
        .setThumbnail(bot.user.avatarURL())
        .setDescription('**Prefix:  ``' + prefix + '`` <command>** ')
        .addField(`:information_source: Core`, `| ${help ? "" : "``help`` | "} ${website ? "" : "``website`` | "} ${uptime ? "" : "``uptime`` | "} ${help ? "``ping`` |" : "``ping`` | "} ${stats ? "" : "``rank`` | "} `)
        .addField(`:shield: Moderation`, `| ${mutecommand ? "" : "``mute`` | "} ${unmute ? "" : "``unmute`` | "} ${clear ? "" : "``clear`` | "} `)
        .addField(`:musical_note:  Music`, "| ``play`` | ``skip`` | ``stop`` | ``volume`` | ``np`` | ``list`` |")
        .addField(`:gear: Util`, "| ``verify`` | Webpanel")
        .addField(`:u6e80: Weeb`, `| ${baka ? "" : "``baka`` | "} ${anime ? "" : "``anime`` | "} ${cute ? "" : "``cute`` | "} ${fox ? "" : "``fox`` | "} ${kawaii ? "" : "``kawaii`` | "} ${neko ? "" : "``neko`` | "} ${smug ? "" : "``smug`` | "}`)
        .addField(`:ideograph_advantage: Tag`, `| ${howgay ? "" : "``howgay`` | "} ${love ? "" : "``love`` | "} ${hug ? "" : "``hug`` | "} ${kiss ? "" : "``kiss`` | "} ${pat ? "" : "``pat`` | "} ${poke ? "" : "``poke`` | "} ${slap ? "" : "``slap`` | "}  ${tickle ? "" : "``tickle`` | "} `)
        .addField(`:underage: NSFW`, `| ${boobs ? "" : "``boobs`` | "} ${cum ? "" : "``cum`` | "} ${hentai ? "" : "``hentai`` | "} ${kitsu ? "" : "``kitsu`` | "} ${lewd ? "" : "``lewd`` | "} ${lick ? "" : "``lick`` | "} ${pussy ? "" : "``pussy`` | "} ${trap ? "" : "``trap`` | "} ${yuri ? "" : "``yuri`` | "} `)
        .setFooter(`Chino-Chan | All rights reserved`)
        message.channel.send({embed: hhhelp});
      });
    }
  });
},
};
quartz kindle
#

whats your node.js version? do node -v from your terminal

earnest phoenix
#

v8.10.0

quartz kindle
#

thats a very outdated version

zenith terrace
#

omg that embed

nocturne grove
#

@quartz kindle oh wow of course, r is just resolve and you changed the function a bit, didn't see that. Thanks!

finite bough
quartz kindle
#

you need to install node.js v12 or later

zenith terrace
#

owo

earnest phoenix
#

@finite bough SQL

finite bough
#

not that

earnest phoenix
#

what

pale vessel
#

hedi lewd

finite bough
#

^

earnest phoenix
#

1 horus update ndoe js linux

zenith terrace
#

Hedi very lewd

finite bough
#

1 hr O_O

quartz kindle
#

@earnest phoenix you need to install node.js from the latest binaries, or using nvm

#

using apt will not work

earnest phoenix
#

what linux commad node js update?

zenith terrace
crimson vapor
#

When passing a variable through a constructor such as client through a command constructor, why does the variable in the constructor update when the one outside does?

quartz kindle
#

check method 1, using nvm

#

@crimson vapor non-primitives such as arrays and objects are passed by reference not by copy

crimson vapor
#

that make a lot more sense

#

does it do that for functions as well? like if you were to require a file and run one of the exports with client?

quartz kindle
#

it should

crimson vapor
#

ok

#

So passing client through a command by run() or this.client shouldn't effect the amount of ram used?

quartz kindle
#

nope

crimson vapor
#

ok

#

is there any way to minimize the memory used?

quartz kindle
#

control your caches

#

the single source of all discord.js memory issues is the caching it does

#

users, guilds, channels, members, presences, voice states, roles

#

all of those fill your memory up

earnest phoenix
#

hmmm very good code js sudo npm cache clean -f sudo npm install -g n sudo n stable

crimson vapor
#

What is the best way to clear it?

earnest phoenix
#
v12.16.1```
#

nice

#

😛

crimson vapor
#

alright thanks for your help

earnest phoenix
#

noooo

#

error

#
/home/dc/node_modules/mysql/lib/protocol/Parser.js:437
      throw err; // Rethrow non-MySQL errors
      ^

TypeError: Cannot read property 'client' of undefined
    at new MessageEmbed (/home/dc/node_modules/discord.js/src/structures/MessageEmbed.js:13:60)
    at Query.<anonymous> (/home/dc/commands/help.js:61:21)
    at Query.<anonymous> (/home/dc/node_modules/mysql/lib/Connection.js:526:10)
    at Query._callback (/home/dc/node_modules/mysql/lib/Connection.js:488:16)
    at Query.Sequence.end (/home/dc/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
    at Query._handleFinalResultPacket (/home/dc/node_modules/mysql/lib/protocol/sequences/Query.js:149:8)
    at Query.EofPacket (/home/dc/node_modules/mysql/lib/protocol/sequences/Query.js:133:8)
    at Protocol._parsePacket (/home/dc/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/home/dc/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/home/dc/node_modules/mysql/lib/protocol/Parser.js:43:10)
root@otamoon:/home/dc#
#

:'((

slender wagon
#

how do i add a video on an embed message? is there a way

#

nvm fixed

earnest phoenix
#

please help all command error ```js
(node:22522) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'client' of undefined
at new MessageEmbed (/home/dc/node_modules/discord.js/src/structures/MessageEmbed.js:13:60)
at Query.<anonymous> (/home/dc/commands/fox.js:33:26)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:22522) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:22522) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

quartz kindle
#

try this console.log(process.version) in the beginning of your code

#

in your main file

#

what does it show?

earnest phoenix
#

nothing

quartz kindle
#

it should show something before the error

summer torrent
#

try with eval command

earnest phoenix
#
root@otamoon:/home/dc# node index.js

v12.16.1
knotty steeple
#

ok so im trying to increment a number and you might be thinking its pretty simple right?

if (page !== max) {
    await m.edit({ embed: pages[page] });
    awaitReactions(msg, m, options, filter);
}```
pages is basically something like
```js
const pages = {
1: {title: "first page", description: "first page!"},
2: {title: "second?", description: "thats right boi"}
}```

and page is the number of the current page its on (this is for a help command btw)

if i try to put `page++` anywhere it doesnt make the other functions run
summer torrent
#

oof

knotty steeple
#

i dont use async at all

#

E

summer torrent
knotty steeple
#

if u need more stuff from me ill send it

quartz kindle
#

@earnest phoenix what is your discord.js version?

#

do npm ls discord.js

knotty steeple
#

the awaitReactions function just runs it over again

earnest phoenix
#

root@otamoon:/home/dc# npm ls discord.js ota-chan@1.0.0 /home/dc └── discord.js@11.5.1

summer torrent
#

that is RichEmbed on v11.5

quartz kindle
#

v11 doesnt have MessageEmbed, use ^

earnest phoenix
#

shit

summer torrent
#

also newest version is 12.1.1

earnest phoenix
#

npm update

#

npm update discord.js

quartz kindle
#

npm update will not work

earnest phoenix
#

o shit

summer torrent
#

npm i discord.js

quartz kindle
#

npm wont let you update major versions

marble juniper
#

just do npm install discord.js

#

reinstall it

timber rampart
#

sa

#

tr nerde ln

knotty steeple
#

u dont have to use stable

quartz kindle
#

you need to uninstall and reinstall, or install with a forced version discord.js@12.1.1

summer torrent
quartz kindle
#

but pay attention, discord.js v12 is VERY different from v11

#

you need to fully rewrite your bot to use v12, if you want to upgrade

crimson vapor
#

not exactly

knotty steeple
#

does it eat less ram

crimson vapor
#

just a lot

knotty steeple
#

also can u answer my qustion

earnest phoenix
#

whyyy?

#

/home/dc/index.js:31
let guildArray = bot.guilds.array();
^

TypeError: bot.guilds.array is not a function

summer torrent
#

guilds.cache

earnest phoenix
#

xdd

#

sry

summer torrent
quartz kindle
#

@knotty steeple not enough information

#

show more code?

knotty steeple
#

like

quartz kindle
#

also, why not use message.awaitReactions?

#

instead of calling the function directly

knotty steeple
#

hold up

#
async function awaitReactions(msg, m, options, filter) {
            const { min, max, page, limit } = options;

            m.awaitReactions(filter, { max: 1, time: limit, errors: ['time'] }).then(async c => {
            const r = c.first();
            if (r.emoji.name === '⏩') {
                await removeReaction(m, msg, '⏩');

                if (page !== max) {
                    await m.edit({ embed: pages[page] });
                    awaitReactions(msg, m, options, filter);
                }
            }
            else if (r.emoji.name === '🗑') {
                await m.delete();
                return;
            }
            else {
                awaitReactions(msg, m, options, filter);
            }
            }).catch(e => console.log(e));
        }
#

intendation is kinda hecky

#

and this is options ```js
let options = {
limit: 15 * 1000,
min: 1,
max: 4,
page: 1
}

#

@quartz kindle

earnest phoenix
#
const gayUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));``` cache???
white gate
#

guild.members.cache

slender wagon
#

client.user.setActivity(`Serving ${client.guilds.size} servers`);
umm this is the command that i give for my activity but it comes out as Serving Undefined servers

summer torrent
#

what is your djs version

elder vine
#

show error

slender wagon
#

it doesn't give error

elder vine
#

client.guilds.cache.size? idk I've not used v12

slender wagon
#

12.0.2

#

aight le me try that out

elder vine
#

client.guilds.cache.size maybe then?

slender wagon
#

it worked!!

elder vine
#

Good :)

slender wagon
#

i forgot abt the new thing "cache"

#

thank you!

elder vine
#

Yea, no problem.

slender wagon
#

i shouldn't update to this version lol

elder vine
#

I've not yet updated :P

zenith terrace
#

Neither have I

earnest phoenix
#

Same

#

It's dumb af

grizzled raven
#

ok thanks tim

spare glen
#

does anyone know how to add a video to an embed?

#

i tried with webhooks but that didn't work

#

even tho in the docs they say you can and that it works

#

ping me if you have an answer

summer torrent
#

you cant

spare glen
#

but mee6 did it somehow

lyric mountain
#

probably it's a website video's preview

#

like when you put a youtube link in the chat

summer torrent
#

^

spare glen
#

tru tru

#

wish discord would add a .setVideo() method like wtf

lyric mountain
#

wish discord allowed bots to use goLive

spare glen
#

wish discord would just press alt + f14

lyric mountain
#

f14

spare glen
#

f35

quartz kindle
#

@knotty steeple if you destructure options into individual variables, they will be copies, not references, so if you do page++ it wont affect the page in options

knotty steeple
#

wait what

lyric mountain
#

suddenly...

elder vine
#

process.env.MONGODB is undefined

#

Well..

#

It should be working, as token was working out for you

#

Ehh..

#

I'm not sure.

slender wagon
#

````${message.guild.owner}``` it comes out as null uwu

elder vine
#

no, mongodb string

#
message.guild.cache.owner

maybe @slender wagon

#

yea

slender wagon
#

hol up le me try

elder vine
#

OH

#

Wait

quartz kindle
#

@slender wagon that means the owner is not cached

slender wagon
#

``` .addField("Owner", ${message.guild.cache.owner})
^

TypeError: Cannot read property 'owner' of undefined```

#

how can i fix that

elder vine
#

idk how this v12 works

slender wagon
#

samehh

#

it is driving me nuts

#

;D

elder vine
#

Read docs

slender wagon
#

i'm

#

i have 2 of em open

elder vine
slender wagon
#

yep i'm there too

elder vine
#

oh xD

knotty steeple
#

@quartz kindle so

#

i did some changed considering what u said

#

works now

quartz kindle
#

@slender wagon if the owner is not cached, you need to cache it

#

await client.users.fetch(guild.ownerID)

#

then you can do guild.owner

slender wagon
#

OHH okay!

quartz kindle
#

you might need to also do await guild.members.fetch(ownerID)

elder vine
#

Works now, right? @earnest phoenix

slender wagon
#

oh alright thank you!

#
                ^^^^^

SyntaxError: await is only valid in async function```
elder vine
#

you need to put it in an async function then

#

async function newfunc() {} like this

slender wagon
#

ohh alright

knotty steeple
#

how do you do an unnamed async function

elder vine
#

Good.

gentle arrow
#

i need help im trying to host a python discord bot with heroku it gived me errors

finite bough
#

what error

small prairie
#

get embed from a message and send it to somewhere else
d.js v11.5

gentle arrow
#

wdym

small prairie
past trail
#

@gentle arrow hmmm well it looks like the error looks like you didn't use the git commands to get the bot up and running, also did you put all of the imports that you installed via pip into the requirements.txt?

copper cradle
#

how did you get the files? @gentle arrow

earnest phoenix
earnest phoenix
#

How can I make the bot send a message to a channel when it crashed

#

aka is there an oncrash event

#

LOL

quartz kindle
#

thats impossible

#

the only way to do that would be to use another bot to monitor your main bot

earnest phoenix
#

i found a good way

#

L

#
   client.channels.get('694728750197112932').send('P.A.E.T. has hit an error!: ' + error);
});

process.on('beforeExit', function (error) {
   client.channels.get('694728750197112932').send('P.A.E.T. has hit an error!: ' + error);
});
#

idk but it works

#

for most of my errors

quartz kindle
#

that will not work for all errors, but it may work for some

crimson vapor
#

wouldnt it be easier to use a webhook manager

#

because then if your bot goes offline you can send to a channel the error

copper cradle
#

I'd make an "online monitor" program in go to check the status of my bot and if the process exits with a non 0 exit code then, with a webhook, I send a message to a channel in my server

ember bluff
elder vine
#

Idk, maybe for certified bots?

knotty steeple
#

its a banner for certified bots yes

ember bluff
#

how do we get certified

elder vine
#

Apply

#

Through post/mail (not email) - by sending a letter.

ember bluff
#

what kind of mail

elder vine
#
  • you need to have a bot submitted and approved & follow certification requirements
crimson vapor
#

It isnt email?

elder vine
#

No

#

It’s to send a mail to his address

knotty steeple
#

isnt cert just closed

#

huh

elder vine
#

No

#

You can send a real letter to them with the application

#

And you get it sent back, and might be lucky and receive socks back :P

#

You can send your application to:

Certification Applications
Dbots B.V.
Weesperplein 4B, 5th Floor
1018 XA Amsterdam
Netherlands

earnest phoenix
#

is there a way to write something in the user's text box? like suggest a command?

knotty steeple
#

text box where

earnest phoenix
#

the text box in which we write to send a message

knotty steeple
#

so what exactly do you want

#

say clearly

earnest phoenix
#

a clickable text that suggests a command for the user and write the command here:

knotty steeple
#

you cant put anything in the box

earnest phoenix
#

ah, ok

#

thanks

zenith terrace
#

All you can do is type {prefix}suggest <suggestion> and the bot posts it to a channel

#

¯\_(ツ)_/¯

grizzled raven
#

does ```js
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

summer torrent
#

how can I get my mongodb npm package version?

barren swallow
#

Look in package.json?

summer torrent
#

I mean how I can get it with code

barren swallow
#

Um it's a json file so

knotty steeple
#

@barren swallow what

#

@summer torrent dunno about a property but you would do it with a console command

barren swallow
summer torrent
#

I know it. I want to get it for my versions command.

require('../package.json').dependencies.mongodb``` worked
barren swallow
#

👍

summer torrent
#

ty titan for idea

barren swallow
#

😃

#

@barren swallow what
@knotty steeple ?

sick cloud
#

how do you enable that thing that warns you leaving the page if there might be unsaved changes

summer torrent
sick cloud
#

iirc there's a built in way to do it not just in javascript

floral bloom
#

Discord.js
Why do I get the error Cannot send an empty message when checking the name/ID of a custom emoji in an await reactions function? It works perfectly fine with default Discord emojis, just not custom ones.

summer torrent
#

show code

knotty steeple
#

what are u typing out the code or what

#

lmao

floral bloom
#
let r = [
  "this is just so that r[1] actually shows a 1...",
  "\u0031\u20E3", // 1
  "\u0032\u20E3", // 2
  "\u0033\u20E3", // 3
  "\u0034\u20E3", // 4
  "\u0035\u20E3", // 5
  "\u0036\u20E3", // 6
  "\u0037\u20E3", // 7
  "\u0038\u20E3", // 8
  "\u0039\u20E3", // 9
  ":no:670828327518339097", // No / 10
  ":yes:670828144168796172", // Yes / 11
  ":err:671011561417998368" // Error / 12
];
let filter;
filter = (reaction, user) => {
  return ([r[1], r[2], r[3], r[10]].includes(reaction.emoji.name) && user.id === message.author.id);
};
msg.react(r[1]).then(() => 
msg.react(r[2]).then(() => 
msg.react(r[3]).then(() => 
msg.react(r[10])).then(() => {
  msg.awaitReactions(filter, {
    max: 1,
    time: 60000,
    errors: ["time"]
  }).then(async collected => {
    const reaction = collected.first();
    if (reaction.emoji.name === r[1]) {
      // Do something.
    } else if (reaction.emoji.name === r[2]) {
      // Do something else.
    } else if (reaction.emoji.name === r[3]) {
      // Do something else again.
    } else if (reaction.emoji.id === "670828327518339097") {
      // This doesn't work when trying to do something.
      // I've tried:
      // reaction.emoji.name === "no"
      // reaction.emoji.name === r[10]
    }
  })
})))
#

msg is the message sent by the bot.

knotty steeple
#
msg.react(r[1]).then(() => 
msg.react(r[2]).then(() => 
msg.react(r[3]).then(() => 
#

what the fuck is this

floral bloom
#

Excuse me?

knotty steeple
#

it just looks so weird

#

why dont u await those

floral bloom
#

Because another developer used that instead of await, I just transferred some of the code to a new command file.

barren swallow
#

where are you even trying to send the message?

knotty steeple
#

^

#

you really excluded alot of actual code

floral bloom
#

The message sends, but when I click the reaction, I get the error Cannot send an empty message, when the output doesn't even send a message. I can do the same function with a Discord emoji, it's just the custom emoji that doesn't work for some reason and that's the error it gives me.

barren swallow
#

can you even msg.react(':err:671011561417998368')
dont you gotta fetch the emoji ?

#

wait no

earnest phoenix
#

does anyone know about the different types of serverQueue.songs. example serverQueue.songs.url

barren swallow
#

@earnest phoenix 🤔 what?

floral bloom
#

Okay, I have an array of emojis. It has numbers 1-9 and three custom emojis. All emojis are added to the message fine. When using the Discord emojis, the functions work fine. But when trying to click a custom emote to preform the same function, I get the Cannot send an empty message error.

summer torrent
#

console.log() it

barren swallow
#

^

floral bloom
#

Log what, exactly?

summer torrent
#

what you're trying to send

knotty steeple
#
} else if (reaction.emoji.id === "670828327518339097") {
      // This doesn't work when trying to do something.
      // I've tried:
      // reaction.emoji.name === "no"
      // reaction.emoji.name === r[10]
    }```
#

what exactly are you doing in this block

earnest phoenix
#

hey

#

Hi

#

how to fix

#

anyone tell me first pls

summer torrent
#

separate server ids with , (comma)

earnest phoenix
#

ok

summer torrent
#

example 264445053596991498, 275047183055847439

earnest phoenix
#

ok

#

thx

#

serverQueue.songs[0].authoris this an thing ?

summer torrent
barren swallow
#

elaborate more @earnest phoenix

#

@summer torrent 😂

earnest phoenix
#

its not

summer torrent
#

console.log() it and see which properties it has

earnest phoenix
#

nothing

#

i want to get the authors name

barren swallow
#

then thats your answer 👏

#

console.log(serverQueue.songs[0])

copper cradle
#

@earnest phoenix serverQueue is an object created by yo, you must know each property

summer torrent
#

^

earnest phoenix
copper cradle
#

that's what happens when you don't acually know what you're doing and you're just following tutorials

#

send your code

#

and I'll tell you the properties

summer torrent
#

console.log(serverQueue.songs[0])

copper cradle
#

or do that lol

earnest phoenix
#

not work @summer torrent

copper cradle
#

when you're doing serverQueue.push you're pusing an object into it

earnest phoenix
#

TsumikiTail sadly ik only title url and duration

#

oh and push

copper cradle
#

...

earnest phoenix
copper cradle
#

do you know what you're doing?

earnest phoenix
copper cradle
#

I've seen that var naming somewhere else

#

you're following plexi dev's tutorial aren't you?

floral bloom
#

what you're trying to send
@summer torrent
what exactly are you doing in this block
@knotty steeple
I'm having the bot edit the message that the reactions are on. When I use, for example, 1️⃣ as the reaction that will trigger the edit message function, it works. But when using the custom emoji, it gives me the Cannot send an empty message error.

earnest phoenix
#

yep but i cant get the video's author for some reason

floral bloom
#

Oh dang, pings.

earnest phoenix
#

no tutorial

copper cradle
#

wdym

earnest phoenix
#

just pure docs

copper cradle
#

there's no way

#

if you don't know how to get those props

#

send your code and I'll guide you

earnest phoenix
#

no i do but some dont work

barren swallow
copper cradle
#

send your code @earnest phoenix

#

I'll tell you what to do

earnest phoenix
#

which one

copper cradle
#

the file you're working on

floral bloom
#

Using zoomeyes as the example for the custom emoji, this should work, correct?

if (reaction.emoji.name === "zoomeyes") {
  // Do something.
}
copper cradle
#

where you have serverQueue

floral bloom
#

Or should this work?

if (reaction.emoji.id === "390046883281633290") { // ZoomEyes ID
  // Do something.
}
copper cradle
#

I'm not downloading a file into my phone

earnest phoenix
#

k one sec

#
const discord = require('discord.js');
module.exports = {
    name: "np",
    description: "Show the music now playing.",
    execute(message) {
      const serverQueue = message.client.queue.get(message.guild.id);
      const vurl = serverQueue.songs[0].url;
      const vidid = vurl.split('v=')[1];

      const secondsToHms = d => {
        d = Number(d);
        var h = Math.floor(d / 3600);
        var m = Math.floor((d % 3600) / 60);
        var s = Math.floor((d % 3600) % 60);
      
        var hDisplay = h > 0 ? h + (h == 1 ? " hour, " : " hours, ") : "";
        var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
        var sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : "";
        return hDisplay + mDisplay + sDisplay;
      };

        
      if (!serverQueue) return message.reply("There is nothing playing.").catch(console.error);
      else{
        let embed = new discord.MessageEmbed()
        .setColor('RANDOM')
        .addField(`Now playing:`,`**${serverQueue.songs[0].title}**`)
        .setThumbnail(`https://img.youtube.com/vi/${vidid}/maxresdefault.jpg`)
        .addField("Duration:",secondsToHms(serverQueue.songs[0].duration))
        .setTimestamp()
        
        return message.reply(embed)
          .catch(console.error);
      }}
    };
    
copper cradle
#

where did you define client.queue

barren swallow
copper cradle
#

yeah

earnest phoenix
#

k one sec

barren swallow
#

add author: songInfo.player_response.videoDetails.author to song obj

earnest phoenix
#

hmmm k

copper cradle
#
song = {
          title: songInfo.title,
          url: songInfo.video_url,
          duration: songInfo.length_seconds,
          vidid: songInfo.video_id
          
        };

the object you're pushing is this, as you can see, you never added an author property, add it as Titan said

earnest phoenix
#

hmmm i tried author before author: songInfo.author but it dint work

copper cradle
#

ofc

earnest phoenix
#

author: songInfo.player_response.videoDetails.author i will try this

copper cradle
#

learn to debug

#

pls

barren swallow
#

you never added it to the obj thats why

copper cradle
#

that would've saved this time

barren swallow
copper cradle
#

why do you even have 2 of them

#

you just need 1 holy cow

barren swallow
#

^

earnest phoenix
#

ya i did add it to both

#

Rage i need perfection

#

lol

copper cradle
#

...

#

perfection would be only using one

#

watch that

#

and learn to debug

#

if you knew this before you could've saved us this short but tedious talk

earnest phoenix
#

oof i never knew about this

#

btw is there an windows ver?

#

hmmm 100% vs code will have it

copper cradle
#

...

#

dude

#

to debug

#

you can literally console.log any object and it'll log the object and it's properties

#

just try it

#

lemme show you what I mean

crimson vapor
#

as long as you catch everything the correct way, debugging should be relatively easy

copper cradle
#

yeah

earnest phoenix
#

thonkku ok then

#

will try it

knotty steeple
#

thats how i debug

#

throw console.log on everything

earnest phoenix
#

k

crimson vapor
#

I console log every other line and see which line is causing the issue by the amount of console logs there are

copper cradle
#

@earnest phoenix I recorded a small thing for you

#

it'll help you

crimson vapor
#

recorder?

copper cradle
#

recorded lmao

#

I hate typing on my phone

#

ah

#

it won't send wtf

crimson vapor
#

lol

#

you typing code?

#

or recording something

#

I cant tell

earnest phoenix
#

rip

knotty steeple
#

wait whats the function to add stuff to an object

earnest phoenix
#

must be too big

west raptor
#

wdym add stuff to an object

copper cradle
#

^

still lily
#

how do you make money in a econemy bot seperate for each person

knotty steeple
#

like .push to an array

#

is it the same thing

#

idk how to explain exactly

crimson vapor
#

maybe like js obj = { var = 1 }; obj.vari = 2; console.log(obj) -> { var: 1, vari: 2};

knotty steeple
#

makes sense

copper cradle
#

or also

#
obj[stringKey] = value;
#

for example

knotty steeple
#

well i tried doing that anyway cuz the key is a number

crimson vapor
#

I forgot that you could to that tbh

knotty steeple
copper cradle
#
let obj = {};
obj['whoami'] = "you're gay";

console.log(obj); // { whoami: "you're gay" }
crimson vapor
#

do you mean js obj.1 = 2
or

obj['1'] = 1```
or ```js
obj.x = 1```
copper cradle
#

that way you can use user input to add values

knotty steeple
#

the first one isnt valid

copper cradle
#

^

crimson vapor
#

I know, im trying to clarify

copper cradle
#

yes

crimson vapor
#

I wish it worked tbh

copper cradle
#

you can name 'em '1' but not 1

crimson vapor
#

ye ik

knotty steeple
#

if the key is a number you can just do obj[1]

#

can you not

copper cradle
#

n o

knotty steeple
#

o k

crimson vapor
#

I dont think so

knotty steeple
#

yep

#

u can

crimson vapor
#

are you sure

knotty steeple
#

my help command uses that

#

so

#

yes

#
obj = {
0: "e",
1: "f",
2: "g",
}```
crimson vapor
#

ummm

copper cradle
#

oh shit

#

I'm dumb

knotty steeple
#

thats completely valid btw

crimson vapor
#

that shouldnt work I thought

knotty steeple
#

and you access it the same way

copper cradle
#

I literally have that written in my example code

#

well

#

had

#

bc I made some debugging examples for atom-dragon

knotty steeple
#

also the example u put here

maybe like js obj = { var = 1 }; obj.vari = 2; console.log(obj) -> { var: 1, vari: 2};
isnt valid

crimson vapor
#

it turns it into a string

knotty steeple
#

obj = { var = 1 };

crimson vapor
#

thats valid

copper cradle
#

it isn't

knotty steeple
#

tf

#

no

copper cradle
#

bc var is a js keyword

#

and also

knotty steeple
#

yea

crimson vapor
#

shit u right

copper cradle
#

you don't assign values using =

knotty steeple
#

you cant use =

copper cradle
#

you use :

crimson vapor
#

look calm down I low IQ

copper cradle
#

it's big brain time

crimson vapor
#
let obj = {
    'not': 'anything'
};
obj[1] = 'test';
console.log(obj);```
`{ '1': 'test', not: 'anything' }`
#

so it turns the 1 into a string there

knotty steeple
#

yea because js

crimson vapor
#

var works tho

#
let obj = { var: 'test1' };
obj[2] = 'test2';
console.log(obj);```
knotty steeple
#

yea because js

#

its also stupid

#

sometimes

crimson vapor
#

not a string btw

copper cradle
#

wait srsly

knotty steeple
#

huh?????

copper cradle
#

that shouldn't work

crimson vapor
#

{ '2': 'test2', var: 'test1' }

knotty steeple
#

that should not

#

work

#

js wtf

#

explain

copper cradle
#

If only you knew

crimson vapor
#

bc x.var works

copper cradle
#

lemme shou you something guys

knotty steeple
#

ive done js for too long to know its dumb

crimson vapor
#
let obj;
obj.var = 'string?'
obj[1] = '1'
console.log(obj) -> { var: 'string?', '1': '1' }
knotty steeple
#

well this turned into a learning course

crimson vapor
#

but its fun

copper cradle
#
[] == ![];

Do that

knotty steeple
#

js can interpret brainfuck cant it

crimson vapor
#

nothing == !nothing

copper cradle
#

well, kinda

crimson vapor
#
[] == [] -> false```
#

tf lol

copper cradle
#

the process is this

[] == ![]
0 == !0 // false
0 == false
0 == 0 // true
crimson vapor
#

0 == false -> true

knotty steeple
#

this is what i needed btw

const pages = {}
        for (var i = 0; i < violet.commands.categories.length; i++) {
            const categories = violet.commands.categories;
            const cmds = violet.commands.filter(c => c.settings.category === categories[i])
            .map(c => `${c.info.name} - ${c.info.description}`)
            pages[i] = {
                title: `Command category: ${categories[i]}`,
                description: cmds.join("\n")
            }
        }
#

but for the description it only does 1

copper cradle
#

bc 0 is false and 0 <= true < +∞

crimson vapor
#

sorry, my mind is broken rn

knotty steeple
#

xd

copper cradle
#

simplified to

crimson vapor
#

change === to ==

copper cradle
#

true = ] 0, +∞ [

#

ofc it'll return false

#

bc [] is not 100% equal to false

crimson vapor
#

fuck can you not

copper cradle
#

what

knotty steeple
#

lul

crimson vapor
#

my brain cant rn

knotty steeple
#

can you help me with my problem

copper cradle
#

{ x / 0 < x <= 30}

crimson vapor
#

honestly, give me a few mins to fix my brain

knotty steeple
#

dont comment about how the embed looks its wip™️

copper cradle
#

that prefix tho

#

v,

knotty steeple
#

its short

#

im lazy

copper cradle
#

lol

knotty steeple
#

its also supposed to show the ping command

#

for some reason it isnt

#

i logged cmds to check and it does include it

#

but when to actually include it in the function it just doesnt

crimson vapor
#

alright I know

#

if commands is a map idk if it will work correctly

#

so, you need a way to join every command

knotty steeple
#
const cmds = violet.commands.filter(c => c.settings.category === categories[i]).map(c => `${c.info.name} - ${c.info.description}`)```
#

this is what cmds is btw

crimson vapor
#

alr

knotty steeple
#

it does filter to find commands in a specific category then maps it out

#

when i send the embed i just join it

#

or is it just the way im actually mapping it

crimson vapor
#

are you getting any errors?

knotty steeple
#

no

#

it just doesnt send everything

crimson vapor
#

what does cmds log?

knotty steeple
#
ping - See how long it takes for me to respond.
help - Shows all the commands that I have.
#

what its supposed to be

crimson vapor
#

does it log as an array or an object? or wut?

knotty steeple
#

its that

crimson vapor
#

if its a string then you dont need to join and you would get an error

knotty steeple
#

when you use map its not a string

#

you join it to make it a string

crimson vapor
#

ik

#

here ill brb one sec

#

ok join with only spaces

knotty steeple
#

tried it already

#

same thing

steady hamlet
#

would it be breaking Discords ToS if i made a command that allowed people in servers with the admin permission to send out an announcement to all the server members via DM?

slender thistle
#

Yup

crimson vapor
#

kinda

slender thistle
#

It's a mass DM

steady hamlet
#

ok thx

knotty steeple
#

yes

crimson vapor
#

oh YES

knotty steeple
#

mass dm bad

crimson vapor
#

via dm yeah

#

alright dont join

#

at all

#

just cmds

knotty steeple
#

then how do i send it

crimson vapor
#

just send cmds

knotty steeple
#

i cant just put the variable in the description like that cuz its an array

crimson vapor
#

you should be able to

#

maybe put it in `${}`

knotty steeple
#

lmao what its the same

#

ok

#

that makes sense

crimson vapor
#

its just ping command?

knotty steeple
#

help

#

just help

crimson vapor
#

o

#

yea

#

umm idk

#

maybe its just help then

copper cradle
#

btw

#

if you console.log()

#

"b" + "a" + + "a" + "a"

#

you'll get a surprise

knotty steeple
#

ok

#

i just realized

#

i was being a dumb

copper cradle
#

what

#

did u run console.log("b" + "a" + + "a" + "a")

crimson vapor
#

banana

copper cradle
#

no

#

baNaNa

crimson vapor
#

fuck my name looks peasant like

copper cradle
#

lmao

crimson vapor
#

back

peak dirge
#

Why this is not a thing anymore..

client.on("guildCreate", guild => {
    let defaultChannel = "";
    guild.channels.forEach((channel) =>{
        if(channel.type === "text" && defaultChannel ==""){
            if(channel.permissionFor(guild.me).has("SEND_MESSAGES")) {
                defaultChannel = channel;
            }
        }
    })
high bough
copper cradle
#

what is not a thing anymore

high bough
#

Why this is not a thing anymore..

client.on("guildCreate", guild => {
    let defaultChannel = "";
    guild.channels.forEach((channel) =>{
        if(channel.type === "text" && defaultChannel ==""){
            if(channel.permissionFor(guild.me).has("SEND_MESSAGES")) {
                defaultChannel = channel;
            }
        }
    })

@peak dirge Cuz It's spam I think...

copper cradle
#

run it on an elevated terminal

#

wait no

high bough
#

I'm on glitch

copper cradle
#

well that explains a lot

peak dirge
#

TypeError: guild.channels.forEach is not a function

high bough
copper cradle
#

u just updated right

high bough
#

They removed it, no?

copper cradle
#

they didn't remove it

peak dirge
#

I am just trying to find first text channel that my bot can send message about commands etc.

copper cradle
#

@peak dirge console.log(guild) and see what you get

#

you shouldn't do that

#

no one likes bots that do such thing

#

it's spammy and unnecessary

#

Imagine you add a bot with, for some reason, admin perms and the first thing it fucking does it send a message in your #announcements channel

#

or even better

sudden geyser
#

@peak dirge forEach is not a method on the manager. You must call it on the collection (.cache)

earnest phoenix
#

Why my bot vote was deduct

hollow granite
#

im pretty sure it resets every month

earnest phoenix
#

Oo

#

Thanks

gritty frost
#

Help

spare goblet
#

@earnest phoenix data.lyrics is undefined

warm marsh
#

Also why join sync code with async?

earnest phoenix
#

because they don't know what they're doing

warm marsh
#

Makes sense.

oak cliff
#

bots cant see this channel @high bough you want #commands

high bough
#

Lol xd I was on the wrong channel the entire time?!?!?!

warm marsh
#

Do structure still exist in djs?

#

nvm

hallow sandal
#

Hi, so I managed to get my output on heroku to work. But the thing is that my bot isn't running.

#

I checked on the terminal by running the bot and It shows that I dont have errors.

warm marsh
#

Also is Discord taking forever to send messages?

#

Does the bot work on localhost?

hallow sandal
#

Not sure

#

And yeah, discord is slow.

#

Whenever I clicked deploy, it was installing the modules and stuff.

elder vine
#

Discord API Outage

hallow sandal
#

But the bot wasn't running.

tight plinth
#

client.shard.id dont work, as well as client.shard.broadcastEval('this.shard.id').then(result => console.log(result)), both returns undefined or null

#

(djs v12)

opal copper
#

Guys, just to know, how many persons are against Discord Bot Maker ?

robust moth
tight plinth
#

discordjs version?

robust moth
#

@tight plinth 12.1.1

zenith terrace
#

.cache then

tight plinth
#

it's members.cache.filter

robust moth
#

Ooo

#

@tight plinth
Can't read members property

tight plinth
#

message.guild.members.cache.filter...

robust moth
tight plinth
#

message.guild undefined

#

impossible

#

lemme test