#development

1 messages · Page 1152 of 1

earnest phoenix
#

This dude is a reseller of an already sketchy minecraft hoster?

lone coyote
#

im trying to learn maybe a bit too fast, but i will be very satisfied if i finish

#

i should have looked there first

solemn latch
#

yeah, he is

#

the amount of money he is making, probably pretty sweet.

#

do absolutely nothing, if someone has an issue, so what.

#

i mean the amount he is making compared to the effort and investment*

lone coyote
#

the way the doc says to handle errors doesnt work

#

aahh

earnest phoenix
#

I assure you it does

#

You just aren't doing it correctly

lone coyote
#

i mean probably

earnest phoenix
#

Two things you need to learn when getting into development:

  1. Google is ur soul mate for now on
  2. The docs are never wrong, you are
#

Unless its PHP, then fuck that, what are you even doing with ur life

lone coyote
#

haha

#

no its python

#

i know the docs arent wrong, i am just using a weird version

#

im using v1.4.0

lone coyote
#

and i think the docs are for pre 1

#

or not

#

i am dumb

summer torrent
trail forge
earnest phoenix
#

From what the log said

#

Str (the id) doesnt have attribute id, idk how attribute work in python so yeh

solemn latch
#

Am i the only one who could spend hours looking at all the things aws and google compute provides and sells

sudden geyser
#

Attributes are just properties.

solemn latch
#

so many things

earnest phoenix
#

how do i post an image to a channel with discordpy

sudden geyser
lone coyote
#

copy pasting from the docs: @info.error async def info_error(ctx, error): if isinstance(error, commands.BadArgument): await ctx.send('I could not find that member...') gives me a name error name is not defined

earnest phoenix
#

IS THAT

#

YANDEV

#

Fucking

#

someone help

#

Just add an attachment

#

Easy

#

wdym

#

this shit doesn't work

@client.command()
async def clip(ctx):
    await ctx.send(file=discord.File('fed.PNG'))
#

:KEKW:

lone coyote
#

this?

earnest phoenix
#

Lemme read the docs

#

For a sec

#

Never use python

#

it has a big community

lone coyote
#

:(

#

yeah

earnest phoenix
#

i program in C++

#

but i do think that py and js are the best for bots

#

FUCK

#

i put import random;

lone coyote
#

with a semicolon?

earnest phoenix
#

yes.

lone coyote
#

explain that

#

explains*

winter basalt
#

why not try aegiscpp if you like c++

earnest phoenix
#

because c++ would make things more complicated than they need to be

winter basalt
#

fair

earnest phoenix
#

and it has no community for the discord bot dev

lone coyote
#
async def info_error(ctx, error):
    if isinstance(error, commands.BadArgument):
        await ctx.send('I could not find that member...')```
#

gives me a name error

#

name 'info' not defined

earnest phoenix
#

class discord.File(fp, filename=None, *, spoiler=False)@earnest phoenix

#

Check file path

#

what is the root path

torn ravine
#

does anyone remember where the fs docs are?

summer torrent
#

on node.js website

torn ravine
#

found thank you

drifting wedge
#

Does mongo work on heroku?

#

Mongo atlas

summer torrent
#

yes

drifting wedge
#

For discord py how do I see the guilds my bot is in?

#

Or members?

solemn latch
#

You know it works.
It was discussed in length earlier

drifting wedge
#

For me it didn’t

#

So that’s why I asked

#

I will try again and again tho

trim saddle
#

bot.guilds

earnest phoenix
#

.lengths

#

.size

#

.size()

drifting wedge
#

Even for py?

#

Ok lol

stuck crest
#

ey how to make stop command music bot?

#

i already make play and skip command

earnest phoenix
#

exit the process

#

🧠

opal plank
#

process.crash() in the end of the code

earnest phoenix
#

don't forget to shut down the os for maximum efficiency

opal plank
#

actually i think thats electron

#

make sure to cut the power supply cord with a scissor while its on too

#

@stuck crest we making jokes cuz :
a. you i did not provide a language
b. you did not provide a library
c. we cant read minds

earnest phoenix
#

ask stupid questions get stupid answers 🤷‍♂️

opal plank
#

^^

earnest phoenix
#

^^

thick gull
#

i mean

#

process.exit() with pm2 could work

gray zealot
#

How do I require a file in py? like in javascript: const file = require("./filename.json");

thick gull
opal plank
#

isnt import the syntax in py?

gray zealot
#

oh yeah 😂 sorry I just started py :D

earnest phoenix
#

shh they don't know json isn't native to python yet

gray zealot
#

🤐

sudden geyser
#

with open to the rescue

opal plank
#

i shouldnt even be talking about py tbh, not my area

earnest phoenix
gray zealot
#

ty :)

errant perch
#

anyone know any good rona npm's

earnest phoenix
#

Also not listed on the site, but the 2nd argument for open in this codeblock determines how it'll interact with the file contents

with open('data.txt', 'w') as outfile:
    json.dump(data, outfile)

@gray zealot

#
 The argument mode points to a string beginning with one of the following
 sequences (Additional characters may follow these sequences.):

 ``r''   Open text file for reading.  The stream is positioned at the
         beginning of the file.

 ``r+''  Open for reading and writing.  The stream is positioned at the
         beginning of the file.

 ``w''   Truncate file to zero length or create text file for writing.
         The stream is positioned at the beginning of the file.

 ``w+''  Open for reading and writing.  The file is created if it does not
         exist, otherwise it is truncated.  The stream is positioned at
         the beginning of the file.

 ``a''   Open for writing.  The file is created if it does not exist.  The
         stream is positioned at the end of the file.  Subsequent writes
         to the file will always end up at the then current end of file,
         irrespective of any intervening fseek(3) or similar.

 ``a+''  Open for reading and writing.  The file is created if it does not
         exist.  The stream is positioned at the end of the file.  Subse-
         quent writes to the file will always end up at the then current
         end of file, irrespective of any intervening fseek(3) or similar.
gray zealot
#

Also not listed on the site, but the 2nd argument for open in this codeblock determines how it'll interact with the file contents

with open('data.txt', 'w') as outfile:
    json.dump(data, outfile)

@gray zealot
@earnest phoenix ty!

earnest phoenix
#

Thats all, and np

#

¯_(ツ)_/¯

drifting wedge
#

How do I like make a turn off module per server?

#

I’m using a mongo py

#

Should I just make like a on/off line? If so how

solemn latch
#

Store a bool for each module for each server.
If a command is in a module check if that server has it enabled.
If its enabled, run the command

drifting wedge
#

Do it’ll be like if enabled, else say module not enabled

solemn latch
#

Yeah

drifting wedge
#

Well I’d have to access dbs for everything

#

Wait tho

solemn latch
#

Generally speaking youd cache that data.

#

Since its such a small amount of data, you'd cache it all

drifting wedge
#

How would I cache it?

sudden geyser
#

store it in memory

#

such as a variable

drifting wedge
#

Explain in easier terms

#

I’ll look into it tmr

earnest phoenix
#

I'd personally rather put it in a DB, so its persistent between bot restarts, etc.

drifting wedge
#

Yea

earnest phoenix
drifting wedge
#

Agree

#

That’s what I want

sudden geyser
#

that is what you're going to be doing. just caching it as well can make it faster

solemn latch
#

Your database is remote

drifting wedge
#

But I mean should like welcome messages, levels and that stuff be like in the main help menu or be in mod

#

Yes

#

Remote

solemn latch
#

So you'll definitely want to cache it

drifting wedge
#

How tho?

solemn latch
errant perch
#

using discord.js

earnest phoenix
#

#.cases

errant perch
earnest phoenix
#

Parse it into json

#

Parse the cc*

errant perch
#

ok

sonic lodge
#

api.all() returns a promise it seems

#

you need to await it or access cases in .then

api.all().then((result) => {
  console.log(result.cases);
});```
earnest phoenix
#

Oh

errant perch
#

got it

#

thanks

#

sorry for being stupid

sonic lodge
#

no one here is stupid

solemn latch
#

Except me

errant perch
#

indeed

sonic lodge
#

you aren't stupid unless if you want to be lol

errant perch
#

then let me be stupid'

solemn latch
#

Can i be stupid Thursday to Sunday

errant perch
#

no

#

i wanna be stupid thursday and sunday

solemn latch
#

And normal Monday.
And extra smart Tuesday and weekend

#

Weekend KEKW

errant perch
#

molester monday

solemn latch
#

I meant Wednesday but typed weekend

earnest phoenix
solemn latch
#

Ah we have been get got

errant perch
#

darn

earnest phoenix
#

how to send a file with the bot in python

#

im so confused

drifting wedge
#

Is transferring shit to cogs hard?

#

Also how can I set aliases for ellif?

#

Like to cut down on code?

earnest phoenix
#

No, transferring & using cogs isn't hard @drifting wedge

#

Don't work on reinventing the wheel, learn to optimize ur code instead

drifting wedge
#

Don't work on reinventing the wheel, learn to optimize ur code instead
@earnest phoenix yea that’s why adding cogs

#

But can I set alisases to ellifs?

#

Or no

earnest phoenix
#

You mean for Pythons syntax, as in an elif statement?

#

I mean, why would you want to do such a thing?

drifting wedge
#

Bc like for mod

#

And moderation

#

They send the same message

#

But have different names

#

@earnest phoenix

earnest phoenix
#

Mod & moderation?

#

Do you mean you have a command

drifting wedge
#

Yes

#

Like the help command

earnest phoenix
#

That can be triggered with a mod and moderation command?

drifting wedge
#

But it’s .help moderation or .help mod

earnest phoenix
#

I don't really remember how to do that, but its 100% possible @drifting wedge

#

Just check the docs

drifting wedge
#

Will do

dusky mason
#

You need help?

#

@drifting wedge

#

For groups like help mod

#

Are you using @client/bot.command?

#

If you are

#

Let me pull up code

drifting wedge
#

@dusky mason

#

It’s like 5 am and I gotta wake up at 8

#

So tomorrow?

dusky mason
#

Sure

solar mulch
#

Hello!

dusky mason
#

Wassup

split marsh
#

how do i make my bot able to add reactions and then detect if you react

#

something like reactiontime

dusky mason
#

Python?

split marsh
#

discordjs

dusky mason
#

Can’t help

split marsh
#

oh

dusky mason
#

Sorry

split marsh
#

i used youtube but they are only reaction role tutorials

dusky mason
#

Yeah, I assume if you want it to be timed you can do like sleep or something

#

Idk js

split marsh
#

idk js either

#

lol

dusky mason
#

Rip

sonic lodge
#

if you have the message object, message.react(emoji);

split marsh
#

im mainly into lua

sonic lodge
dusky mason
#

He is asking how to time it

#

Yeah that

split marsh
#

yeah

#

thanks

#

ill figure out the time thingy

#

ok tysm

copper cradle
#

Or you can create a reaction collector on a message

ivory seal
#

how do i make a message go to one particular channel

#

like for logging

#

if a member is added

#

i want a message to go to a particular channel

sacred pewter
#

What's the command only for admins?

ivory seal
#

are u using commando?

faint ice
#

Hi,
the bot invitemanger is offline.
why?

earnest phoenix
#

@oak cliff do the commandz

oak cliff
#

-wrongserver @faint ice

gilded plankBOT
#

@faint ice

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(

faint ice
#

i cant write anything in the server

#

why?

sonic lodge
#

ask the server admins

faint ice
#

ok

ionic dawn
#

qt

pine aspen
#

const g = require('../../models/guilds'); g.updateOne({ id: message.channel.guild.id }, { $pull: { autoRole: '739887331796058162' } });

#

MongoError: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}

twilit rune
#

hey does anyone know how to do sharding for python. I cant seem to figure it out and i've looked everywhere.

snow urchin
pallid igloo
snow urchin
#

I am the worst with RegExp, how can I include everything BUT #Room.

pallid igloo
#

Like everything other than #room?

snow urchin
#

ya

pallid igloo
#

Alright, Lemme think

snow urchin
#

and the dot

sonic lodge
#

i think you could use negative lookahead

#

something like
\b(?!#Room\.\b)

pallid igloo
#

/[^#Room].*/ I can't think of anything else..

#

iirc, the exclusing thing is only with square brackets and hat

sonic lodge
#

that excludes each individual character, #, R, etc.

pallid igloo
#

Yeah

#

But hat without square bracket means first word in a line..

snow urchin
#

something like
\b(?!#Room\.\b)
@sonic lodge nope 😦

sonic lodge
#

lemme do some googling

pine aspen
#

const g = require('../../models/guilds'); g.updateOne({ id: message.channel.guild.id }, { $pull: { autoRole: '739887331796058162' } }); MongoError: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}

pallid igloo
#

Why isn't this working?
(?!#Room)([a-z0-9]+)

pine aspen
#

I'd just used [a-z0-9|Room]

ivory seal
#

how do i make a message go to one particular channel
like for logging
if a member is added
i want a message to go to a particular channel

pine aspen
#

@ivory seal fetch the channel

pallid igloo
#

how do i make a message go to one particular channel
like for logging
if a member is added
i want a message to go to a particular channel
@ivory seal Which library?

pine aspen
#

send a message to the channel

ivory seal
#

@pallid igloo discord.js

pine aspen
#

client.channels.cache.get('channelid').send('logs')

pallid igloo
#

@ivory seal just use a cache.get on client.channels

ivory seal
#

what if i don't have a channel id

#

but i have a name

pallid igloo
#

you could do .cache.find(c => c.name === 'Name').send('LOGS!')

pine aspen
#

client.channels.cache.find(channel => channel.name == 'name').send('logs')

#

ah

pallid igloo
#

note : Name is case sensitive...

pine aspen
#

you beat me

sonic lodge
#

@snow urchin you could also use something like #Room\.(.+) and extract the result of the capturing group

ivory seal
#

kk thanks guys

pallid igloo
#

@sonic lodge It doesnt work, as far as I say

pine aspen
#

anyone do mongoose?

sonic lodge
#

it does?

pallid igloo
#

I can't see it working.

#

It's excluding Room and # indvidually too.

pine aspen
#

@pallid igloo what do you need it to do?

#

register only Room?

pallid igloo
#

No

#

Exclude #Room

sonic lodge
#

does the input always include #Room.

pine aspen
#

so like it removes the #Room?

#

If so you can just use replace ngl no need regex

sonic lodge
pine aspen
#

;p

pallid igloo
#

xD

snow urchin
#

dont make me type im lazy xd

pine aspen
#

let m = #RoomLOL
m = m.replace('#Room', "")
console.log(m)

m output

LOL
pallid igloo
#

Uhh

#

That might not always be the case.

delicate shore
#

I am so fucking done

ivory seal
#

example my bot creates a channel

#

how do i get that channel id

pallid igloo
#

example my bot creates a channel
@ivory seal Resolve the promise

pine aspen
#

@ivory seal .then

delicate shore
#

My VPS deleted themselves leaving me with nothing
All my code was there no backup

ivory seal
#

i am a begginer

#

so........

delicate shore
#

i am done

pallid igloo
#

@ivory seal You need basics of js to make a discord bot

pine aspen
#

.then(c => console.log(c.id)

pallid igloo
#

We wont spoon feed you

ivory seal
#

i do know basics of js

pallid igloo
#

@pine aspen Can you stop spoonfeeding?

pine aspen
#

ok

ivory seal
#

there are many types of js

pallid igloo
#

The promise of guild.channels.create returns the newly made channel.

pine aspen
#

no

ivory seal
#

i am fluent in dew

delicate shore
#

can anyone suggest me some free vps pls

ivory seal
#

js is vast

delicate shore
#

for 1 day

pine aspen
#

yogavpn

delicate shore
#

my VPS got deleted

pine aspen
#

no jk

snow urchin
ivory seal
#

there is none

delicate shore
#

I just need a backup for one day or so

ivory seal
#

no such thing as a free vps

delicate shore
#

is replit a good option

ivory seal
#

why not run it from ur computer

pine aspen
#

@delicate shore heroku

delicate shore
#

Ping

pallid igloo
#

I just need a backup for one day or so
@delicate shore You can try using Github to backup, It cannot host ofc.

delicate shore
#

Heroku doesnt support quick.db

snow urchin
#

it does

pine aspen
#

rip

pallid igloo
#

I said backup, No Hosting.

#

You just need a backup

sonic lodge
#

then get the capturing groups

pallid igloo
#

ad you're gonna have a backup

#

and no, Repl isn't neccesarily free when it comes to hosting and performance.

fluid basin
#

@snow urchin why do you want to use regex for something that doesn't need regex?

pallid igloo
#

I have no idea

delicate shore
#

:(

sacred pewter
#

How to use a command only for admins?

fluid basin
#

repl.it's code will stick if you have an account, but the runtime will only operate for 30mins to 1 hour if there is no activity

pallid igloo
#

How to use a command only for admins?
@sacred pewter Which library?

upbeat rampart
#

Lagu

weak rain
#

is Dan hosting good?

golden condor
#

Not for security

torn ravine
#

I was trying to use fs earlier to make a dynamic help command command

golden condor
#

ok

#

You should use maps or collections tbh

torn ravine
#

my commands are maps originally

golden condor
#

Replace it with a collection

#

Works the same

#

Except you can map it

torn ravine
#

my commands are maps

golden condor
#

By map I mean .map

torn ravine
#

yea

fluid basin
#

why would you need .map even

golden condor
#

Collection.map(command => command)

#

To make a dynamic help cmd

fluid basin
#

yeah but thats not very flexible

tight plinth
#

im trying to publish an npm package, but each time im trying to do npm publish this occurs and idfk what to put here

golden condor
#

You have 2fa?

tight plinth
#

erm idk

fluid basin
#

wot

golden condor
#

I think that means 2fa

tight plinth
#

i logged

#

i donthave 2fa

golden condor
#

Trt

#

Try

fluid basin
#

wot

golden condor
#

npm login

#

Again

#

I think that's the cmd

tight plinth
#

still same thing

golden condor
#

o

#

Um

fluid basin
golden condor
#

Oh that's new?

tight plinth
#

i guess i have to do that

golden condor
#

I guess I need to enable 2fa

#

Lumap it's an Auth token I think

#

@tight plinth

#

Oop

#

I meant to ping you in the message

tight plinth
#

@golden condor i enabled 2fa and it worked with it

#

ty ^^

golden condor
#

Np

torn ravine
golden condor
#

I'm tryna do it on mobile but I can't because I have to scan a qr code 😔

worthy glacier
#

hi im trying to make a function sendTyping() so that when a command takes time to process it uses .startTyping() and .stopTyping() to show a "bot is typing" status in the chat bar. How would I get the function to start once a command is sent and then stop once the bot is done sending all messages?

golden condor
#

Do it at the end of the command

worthy glacier
#

so that i dont have to use .startTyping() and .stopTyping() every time

golden condor
#

The last line of the file/command run function

#

oh

#

Uh

worthy glacier
#

just simplifying intoa single function

golden condor
#

You could start typing in the message event if it's a valid command

karmic compass
#

How do you even get your bot to type/stop typing in discord.js?

golden condor
#

And then stop it at the end

#

Read his message

worthy glacier
#

message.channel.startTyping()

karmic compass
#

That’s a thing

#

Okay

golden condor
#

yeah

karmic compass
#

Can anyone send the discord.ja docs

#

Js*

golden condor
#
pure lion
#

Can I compile an electron app to an apk?

cosmic robin
#

how would i compile all of args into one string

pure lion
#

.join

cosmic robin
#

thx

pure lion
#

Args is an array for future notice

cosmic robin
#

ite thx

sterile thicket
#

When I do message.guild.owner in this server I get 'null' but in other small servers it works fine.

earnest phoenix
#

try message.guild.cache.owner

golden condor
#

@sterile thicket it's not cached

#

You need to fetch the owner

sterile thicket
golden condor
#
await message.guild.members.fetch(message.guild.ownerID)```
#

It won't work because that's not a thing

#

Put that at the top of the command

bitter bison
#

bot developers

#

you can make a bot

#

Correct?

golden condor
#

Yes...

bitter bison
#

How do you make a bot is it hard or easy I don't know about these things but I add bots and try to edit on them in a server

tight plinth
weak rain
#

is dan vps good?

opal plank
#

@bitter bison small simple bots? should be able to do it in a couple hours if you know the language. Simple bot + no/little knownledge? prob a week or two if you focus.
Complex bot + little knowledge ? 2 months ish. Complex bot and know your shit? 2 or 3 weeks

bitter bison
#

@opal plank
oh thanks It takes time to make a bot.

opal plank
wary flame
#

Can I compile an electron app to an apk?
@pure lion Sadly not, electron is only for desktop devices and is very unlikely to ever get support for mobile devices

sterile thicket
#

How to resolve a promise?

message.channel.send(m.user.tag))```
It gives me promise object
#

everything in google goes over my head

pure lion
#

Okay new question

#

How do I make my ts compiler output "async" and not >massive block of code<

fluid basin
#

@pure lion wdym

pure lion
#

E.g

#

async exec(param)

#

Compiled to

#

Big blocc of js

opal plank
#

use native supporting es +

#

and set your compiler options too

#

@pure lion use a tsconfig

#

tl;dr
tsconfig.json ```js

  {
       "compilerOptions" : {
               "target": "es6",
                                    }    
  }```
pure lion
#

Ah

#

I did es5 because I'm secretly a retard

bitter bison
#

development

#

I'm new to these things.

#

??

pure lion
#

What Lang is that

earnest phoenix
#

We don’t use bot designer for discord

#

here

bitter bison
#

oh

earnest phoenix
#

we code

bitter bison
#

what I do now

earnest phoenix
#

idk

bitter bison
#

I need to now how to mention

fringe axle
#

Im BDFD supporter and this is...

#

I‘m crying

fierce arch
#

Hi how do I resize an image to make it smaller using css?

#

Wait wrong channel sorry

thick gull
#

we code
@earnest phoenix bot designer is allowed as long as you have custom commands

earnest phoenix
#

oh india

thick gull
earnest phoenix
fringe axle
#

@thick gull and this code he made is...

#

I-I-I... D:

thick gull
#

¯_(ツ)_/¯

earnest phoenix
#

bot designer no fun

#

@earnest phoenix bot designer is allowed as long as you have custom commands
yeah ik but most of us don’t

fringe axle
#

I‘m BDFD supporter ;-;

#

And there is a big info in the app where you can get support xD

earnest phoenix
#

???

#

what are you tryna say vale

#

what's js react

thick gull
#

its js react

pallid igloo
#

Uhh, Upon doing return inside a javascript function, does it return that value whenever it's called for that specific space or is called as it is?

feral aspen
#

Helo

#

Anyone know what is the problem in here.

#
    at Function.normalizeField (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:418:23)
    at C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:438:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:437:8)
    at MessageEmbed.addFields (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:252:42)
    at MessageEmbed.addField (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:243:17)
    at C:\Users\hajji\OneDrive\Desktop\Attitude\commands\general\newhelp.js:24:23
    at Array.forEach (<anonymous>)
    at Object.module.exports.run (C:\Users\hajji\OneDrive\Desktop\Attitude\commands\general\newhelp.js:20:20)
    at module.exports (C:\Users\hajji\OneDrive\Desktop\Attitude\events\guild\message.js:11:33) {
  [Symbol(code)]: 'EMBED_FIELD_VALUE'
}```
#

This is my code..

            const dir = bot.commands.filter(c => c.config.category === category)
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
            } catch(e) {
                console.log(e)
            }
        })```
earnest phoenix
feral aspen
#

ik

earnest phoenix
#

This is my code..

            const dir = bot.commands.filter(c => c.config.category === category)
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
            } catch(e) {
                console.log(e)
            }
        })```

@feral aspen lmao there is a blank string in a part of a field

#

embed.addField

feral aspen
#

wdym..

stuck crest
#

please teach me to make music bot

earnest phoenix
#

see a tutorial

feral aspen
#

please teach me to make music bot
@stuck crest we cant spoond feed sorry

stuck crest
#

ok

earnest phoenix
feral aspen
#

@earnest phoenix wdym by the thing you said above.

earnest phoenix
#

wdym..
@feral aspen in a field there MUST be two strings with data and one of them in your code is empty

viral iris
#

what's wrong

earnest phoenix
#

npm.load() required

#

bruh

viral iris
#

how :\ ?

feral aspen
#

@earnest phoenix how can I fix, idk tbh

#

Just tell me in the embed.addfield section

viral iris
#
const npm.load() = require('npm.load()');
#

like this ?

pale vessel
cosmic robin
#

when using the embed command it outputs an error when checking the role perms

#

could anyone tell me what im doing wrong?

feral aspen
#

maybe roles.cache.has

cosmic robin
#

ty

feral aspen
#

any help on my command please.

#

This is my code..

            const dir = bot.commands.filter(c => c.config.category === category)
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
            } catch(e) {
                console.log(e)
            }
        })```

@feral aspen ...

#

There is an error in the embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" ")) section

#

what should I do to fix?

sudden geyser
#

What is the exact error

feral aspen
#

This

#
    at Function.normalizeField (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:418:23)
    at C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:438:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:437:8)
    at MessageEmbed.addFields (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:252:42)
    at MessageEmbed.addField (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:243:17)
    at C:\Users\hajji\OneDrive\Desktop\Attitude\commands\general\newhelp.js:24:23
    at Array.forEach (<anonymous>)
    at Object.module.exports.run (C:\Users\hajji\OneDrive\Desktop\Attitude\commands\general\newhelp.js:20:20)
    at module.exports (C:\Users\hajji\OneDrive\Desktop\Attitude\events\guild\message.js:11:33) {
  [Symbol(code)]: 'EMBED_FIELD_VALUE'
}```
viral iris
#

how to fix this

feral aspen
#

😐

sudden geyser
#

what may be happening is dir is an empty array

feral aspen
#

no

#

i dont think

sudden geyser
#

have you tried checking it

viral iris
#

how to fix this
?

thick gull
#

npm.load()

viral iris
#

where?

feral aspen
#

i

#

ni

thick gull
feral aspen
#

no* is not empty

pallid igloo
#

@viral iris I got the error.

sudden geyser
#

can you show us your commands/info/img.js file at line 3

viral iris
#

can you show us your commands/info/img.js file at line 3
@sudden geyser 1sec

#
const { prefix } = require("npm");
pallid igloo
#

It's basically newhelp.js:20-24

sudden geyser
#

why are you requring npm

cosmic robin
sudden geyser
#

.cache is not a property of type GuildMember. Plus I think Administrator should be in full caps (and hasPermissions should have the last S removed).

cosmic robin
#

ite thx

pallid igloo
#

Use 8 instead of ADMINISTRATOR

sudden geyser
#

ew

pallid igloo
#

Oof

quartz kindle
#

its faster :^)

sudden geyser
#

my poor brain

#

hey bro can you give me permission 131072

pallid igloo
#

??

#

No

pale vessel
pallid igloo
#

You aren't supposed to ping everyone

#

Same.

#

That feature is so useful.

sudden geyser
#

It's also useful for attracting people who asked "Who pinged" without checking the Inbox button first

viral iris
pallid igloo
#

I always use the inbox button, But thats basically my style of saying, Why did a person ping me?

viral iris
#

how to fix this

pallid igloo
#

WHAT IS THE ENAME EVENT?

sudden geyser
#

what is evt

pallid igloo
#

Ename is a client event?

#

wtf

#

What is the ename client event?

sudden geyser
#

probably a property, likely the name of a file or something

viral iris
#

??

pallid igloo
#

Oh alright.

#

I'm working on a tictactoe command, Testing it after 3 ddays of hardwork

#

Hope that it doesn't goes down the drain.

viral iris
#

@pallid igloo

#

whats ename client event?

pallid igloo
#

You have defined it, Thats exactly what I was asking

viral iris
#
const { readdirSync } = require("fs");
module.exports = bot => {
  // const load = dirs =>{
  const events = readdirSync(`./events/`).filter(d => d.endsWith(".js"));
  for (let file of events) {
    const evt = require(`../events/${file}`);
    let ename = file.split(".")[0];
    bot.on(ename, evt.bind(null, bot));
  }
};
#

what's event.js file

#

@pallid igloo

pallid igloo
#

Can you show one of your files?

steel pelican
viral iris
#

which 1 ? @pallid igloo

pallid igloo
#

Idk

quartz kindle
#

@steel pelican dont use .reply

pallid igloo
#

I'm just lurking and observing your code, idfk the error

steel pelican
#

@quartz kindle ok

pallid igloo
#

use .channel.send

viral iris
#

which 1

quartz kindle
#

@viral iris add a console.log(ename,evt) line in between the ename and the bind lines

#

so you can see which event is failing

viral iris
#

ok

#

@quartz kindle

#

only got this message {}

river thistle
#

kek

quartz kindle
#

that means the problem is your message.js event

#

its not returning a valid function

#

show your message.js

viral iris
#

i make the message.js /*
/*

#

should i remove it ?

#

i mean the file

quartz kindle
#

your event loader expects all events to return a valid function

#

if you want to disable the message event, remove it, or make it return a function that does nothing

#

like this

#

module.exports = () => {}

viral iris
#

ok thx

pallid igloo
#

Is tic tac toe worth on a discord bot?

#

I mean, It's almost day 4 of working on tic tac toe.

sudden geyser
#

depends on what your bot is about

floral creek
#

m

feral aspen
#

RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.

#

embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))

#

what can I do to fix.

cobalt eagle
#

hi i have a problem my bot keeps crashing every day with this :
error: read ECONNRESET

alpine kiln
#

where is general chat

sinful belfry
alpine kiln
#

thanx

digital ibex
#

dir is probably an empty array

#

@cobalt eagle u need to provide context

cobalt eagle
#

ok so my bot is now hosted 24/24 on my raspberry pi

#

and for now reason

#

some hours after it is launched

#

it crashes with this error

#

(it's also why it was off when it had to be tested)

digital ibex
#

are you emitting any events?

feral aspen
#

@digital ibex no, all the files on the commands folder are full

#

idk how to fix

cobalt eagle
#

nope

digital ibex
#

what is dir?

cobalt eagle
#

the bot doesn't do anything when it crashes

feral aspen
#

The directories

#

for the commands

digital ibex
#

no i mean

feral aspen
#

??

digital ibex
#

what does it return?

feral aspen
#

I dont know

#

this is the code

#
            const dir = bot.commands.filter(c => c.config.category === category)
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
                console.log(dir.map(c => `\`${c.config.name}\``))
            } catch(e) {
                console.log(e)
            }
        })```
digital ibex
#

whats the error stack, @cobalt eagle

feral aspen
#

that is the code.

digital ibex
#

whats categories?

#

the array

feral aspen
#

const categories = readdirSync("./commands/")

#

commands..

cobalt eagle
#
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
    at Connection._handleProtocolError (/home/pi/node_modules/mysql/lib/Connection.js:423:8)
    at Protocol.emit (events.js:315:20)
    at Protocol._delegateError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:398:10)
    at Protocol.handleNetworkError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:371:10)
    at Connection._handleNetworkError (/home/pi/node_modules/mysql/lib/Connection.js:418:18)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read',
  fatal: true
}
pi@raspberrypi:~/Desktop/bots $ node GrapeBotV3.js 
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
    at Connection._handleProtocolError (/home/pi/node_modules/mysql/lib/Connection.js:423:8)
    at Protocol.emit (events.js:315:20)
    at Protocol._delegateError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:398:10)
    at Protocol.handleNetworkError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:371:10)
    at Connection._handleNetworkError (/home/pi/node_modules/mysql/lib/Connection.js:418:18)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read',
  fatal: true
}
#

idk what exactly is the error stack

opal plank
#

thats usually internet, no?

#

specifically websocket

digital ibex
#

no @feral aspen

#

readdirSync is a callback

feral aspen
#

In a tutorial, it said to use that.

#

@digital ibex

#

This is the full code

#

        embed.setDescription(`These are the available commands for ${message.guild.me.displayName}\nThe bot's prefix is: **${PREFIX}**`)
        embed.setFooter(`${message.guild.me.displayName} | Total Commandds: ${bot.commands.size}`, bot.user.displayAvatarURL())

        categories.forEach(category => {
            const dir = bot.commands.filter(c => c.config.category === category)
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
                console.log(dir.map(c => `\`${c.config.name}\``))
            } catch(e) {
                console.log(e)
            }
        })

        return message.channel.send(embed)```
cobalt eagle
#

how do i fix it ?

#

or preventing it from crashing the bot at least

digital ibex
#

i told u

#

wait nvm

#

just console.log(dir) pls

feral aspen
#

ok

#

one sec

pine aspen
#
const g = require('../../models/guilds'); 
g.updateOne({ id: message.channel.guild.id }, { $pull: { autoRole: '739887331796058162' } });

MongoError: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}

#

Does anyone know how to do this?

#

The docs just list this no more.

restive furnace
#

you are updating one what i see.

pine aspen
#

Yes.

#

I'm removing a component of the autoRole array.

restive furnace
#

then you need to pass { $set: { field }}, is what the error says

feral aspen
#

Hello @digital ibex

#

I consoled

#

it did this

#

Collection [Map] {}

digital ibex
#

then theres ur answer

feral aspen
#

What do I do

#

I still dont know how to fix the issue.

#
                embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))```
cobalt eagle
#

so any idea ?

feral aspen
#

@digital ibex what should I do to fix the problem?

pallid igloo
#

@feral aspen dir is empty, so you cannot have empty objects being joined

#

Even if you console.log dir.size, it should be undefined iirc.

feral aspen
#

        embed.setDescription(`These are the available commands for ${message.guild.me.displayName}\nThe bot's prefix is: **${PREFIX}**`)
        embed.setFooter(`${message.guild.me.displayName} | Total Commandds: ${bot.commands.size}`, bot.user.displayAvatarURL())

        categories.forEach(category => {
            const dir = bot.commands.filter(c => c.config.category === category)
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
            } catch(e) {
                console.log(e)
            }
        })

        return message.channel.send(embed)``` this is my code, what can I do
pallid igloo
#

you can think more into javascript and use more reasonable filters.

feral aspen
#

Man, Ive been struggling for 2hrs

#

I cant think of anything, I just need help.

pallid igloo
#

Idc, I have been strugling for 4 days.

#

It happens

#

You gotta understand.

#

ANyways

feral aspen
#

What can I do?

pallid igloo
#

What is c.config btw?

#

const dir = bot.commands.filter(c => c.config.category === category)
Use a different filter.

#

one that actually matches something.

steel pelican
#

What did i do wring

#

Wrong

fresh matrix
#

Is the main prefix ~ because I might change if it is as I cant make it changeable

pallid igloo
#

??

#

@steel pelican guild.channels.cache.find(ch => ch.name == 'genel');

#

Is the main prefix ~ because I might change if it is as I cant make it changeable
@fresh matrix For what?

steel pelican
#

@pallid igloo thx

pallid igloo
#
[
  [ '', 'A', 'B', 'C' ],
  [ '1', '🔵', '❌', '⬜' ],
  [ '2', '🔵', '❌', '🔵' ],
  [ '3', '❌', '🔵', '❌' ]
]

This is my "data".
if(data[1][3] != ⬜) return m10.reply('That cell isn\'t empty!');
Why is this giving me this error?
TypeError: Cannot read property '3' of undefined

slender wagon
#

try to remove the third cell and see what happens

earnest phoenix
#

helo, i have a little problem with json, javascript
so im trying to add values to json without overwriting it

example:

{
    "hello": "yes",
    "hello_two": "yes"
}

i need to change only "hello" value

slender wagon
#

why have u got to make two values when they do the same thing

pallid igloo
#

you're using filesystem?

earnest phoenix
#

ye fs

steel pelican
#

Bruh

marble juniper
#

use fs-extra and not fs if you work with json files

#

I mean you can use fs

pallid igloo
#

Yea.

marble juniper
#

but fs-extra makes it easier

#

it has 2 functions for json files

pallid igloo
#
[
  [ '', 'A', 'B', 'C' ],
  [ '1', '🔵', '❌', '⬜' ],
  [ '2', '🔵', '❌', '🔵' ],
  [ '3', '❌', '🔵', '❌' ]
]

This is my "data".
if(data[1][3] != ⬜) return m10.reply('That cell isn\'t empty!');
Why is this giving me this error?
TypeError: Cannot read property '3' of undefined

marble juniper
#

readJson
writeJson

earnest phoenix
#

bcs [3] doesnt exist

fresh matrix
#

@pallid igloo I wanna make it so I can have a prefix so that no other bot has it.

pallid igloo
#

Who said?

#

[ '1', '🔵', '❌', '⬜' ],
This is [1]

#

and it has [3]

marble juniper
pallid igloo
#

the white block.

steel pelican
#

How do iget the server.link

marble juniper
earnest phoenix
#

o that looks easy ;d

#

thanks

pallid igloo
#

@pallid igloo I wanna make it so I can have a prefix so that no other bot has it.
@fresh matrix Think of a unique prefix then.

fresh matrix
#

I dunno lol

pallid igloo
marble juniper
#
const fs = require('fs-extra')

// With a callback:
fs.writeJson('./package.json', {name: 'fs-extra'}, err => {
  if (err) return console.error(err)
  console.log('success!')
})

// With Promises:
fs.writeJson('./package.json', {name: 'fs-extra'})
.then(() => {
  console.log('success!')
})
.catch(err => {
  console.error(err)
})

// With async/await:
async function example () {
  try {
    await fs.writeJson('./package.json', {name: 'fs-extra'})
    console.log('success!')
  } catch (err) {
    console.error(err)
  }
}

example()
#

thats the example

#

of how to use writeJson

pallid igloo
#
[
  [ '', 'A', 'B', 'C' ],
  [ '1', '🔵', '❌', '⬜' ],
  [ '2', '🔵', '❌', '🔵' ],
  [ '3', '❌', '🔵', '❌' ]
]

This is my "data".
if(data[1][3] != ⬜) return m10.reply('That cell isn\'t empty!');
Why is this giving me this error?
TypeError: Cannot read property '3' of undefined
Somebody? Anybody?

marble juniper
#

first parameter is just the path

#

and second the value

cobalt eagle
#

i think my error is caused by the mariadb database automatically closing the connection after a while?

pallid igloo
#

god knows

cobalt eagle
#

god sucks

marble juniper
#

god is dead

steel pelican
#

Lol god. sucks

cobalt eagle
#

idk

#

but i need a way to solve my problem

pallid igloo
#
[
  [ '', 'A', 'B', 'C' ],
  [ '1', '🔵', '❌', '⬜' ],
  [ '2', '🔵', '❌', '🔵' ],
  [ '3', '❌', '🔵', '❌' ]
]

This is my "data".
if(data[1][3] != ⬜) return m10.reply('That cell isn\'t empty!');
Why is this giving me this error?
TypeError: Cannot read property '3' of undefined
Somebody? Anybody?

#

I NEED SOLUTION TO THIS. JAVASCRIPT CAN GO GAY ALOT

cobalt eagle
#

ok yes

#

after research there's a timeout

wanton anvil
#

hey guys can anyone tell me what does relationships.read scope do in oauth2

pallid igloo
#

idk, this might not be the place for that.

#

Ask in DiscordApi, they'd reply better

wanton anvil
#

ok

#

thanks

marble juniper
#

I NEED SOLUTION TO THIS. JAVASCRIPT CAN GO GAY ALOT
@pallid igloo just wait for someone to respond lol

steel pelican
#

me too dumb for javascript

pallid igloo
#

why am I using 2d arrays?

#

it sucks to be me.

#

Lets use 3d instead!

marble juniper
#

also

#

did you put the unicode character

#

in the if Operator

#

in a string

#

if (data[1][3] != ⬜) return m10.reply('That cell isn't empty!');

#

this part

harsh badge
#

Fan Boy

#

you are doing sth wrong

pallid igloo
#

Wait, Lemme try.

marble juniper
#
if(data[1][3] != '⬜') return m10.reply('That cell isn\'t empty!');
pallid igloo
#

Lemme try that

marble juniper
#

you are trying to compare it with nothing

#

make it a string

#

lol

cobalt eagle
#

if i set the timeout to 0 will it be removed ?

#

like no timeout

wanton anvil
#

hey guys can anyone tell me what does relationships.read scope do in oauth2

marble juniper
#

we told u to ask in discord api @wanton anvil

harsh badge
#

@cobalt eagle use clearTimeout

wanton anvil
#

we told u to ask in discord api @wanton anvil
@marble juniper and where is that??

marble juniper
cobalt eagle
#

i'm talking about mariadb's timeout

pure lion
#

there a way to fetch a user and see if theyre a verified bot?

pallid igloo
#

I guess not.

#

Also, It didn't help

harsh badge
#

@cobalt eagle show some code

cobalt eagle
#

no code involved

#

i have an error that crashes my bot for no reason after a while

pure lion
#

e r r o r ?

cobalt eagle
#

after some research i've found that it's caused by mariadb

#

that has a timeout that closes the connection

pure lion
#

is that nosql or sql

harsh badge
#

sql

pure lion
#

ah

harsh badge
#

closes the connection? hmm

#

what does the error say

cobalt eagle
#
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
    at Connection._handleProtocolError (/home/pi/node_modules/mysql/lib/Connection.js:423:8)
    at Protocol.emit (events.js:315:20)
    at Protocol._delegateError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:398:10)
    at Protocol.handleNetworkError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:371:10)
    at Connection._handleNetworkError (/home/pi/node_modules/mysql/lib/Connection.js:418:18)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read',
  fatal: true
}
pi@raspberrypi:~/Desktop/bots $ node GrapeBotV3.js 
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
    at Connection._handleProtocolError (/home/pi/node_modules/mysql/lib/Connection.js:423:8)
    at Protocol.emit (events.js:315:20)
    at Protocol._delegateError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:398:10)
    at Protocol.handleNetworkError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:371:10)
    at Connection._handleNetworkError (/home/pi/node_modules/mysql/lib/Connection.js:418:18)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read',
  fatal: true
}
pure lion
#

you have shit internet

cobalt eagle
#

the error wasn't occuring when i used mysql

harsh badge
#

ECONNRESET

marble juniper
#

thats ur internet

pure lion
#

you have shit internet
.

cobalt eagle
#

wtf

#

ok

marble juniper
#

thats the internet

#

period

harsh badge
#

your connection goes idle and mariadb closes it

cobalt eagle
#

yes

pure lion
#

there a way to fetch a user and see if theyre a verified bot?

cobalt eagle
#

that's why i need to not close it

harsh badge
marble juniper
#

I don't think there is a way to see if the user is verified

#

I mean

cobalt eagle
#

yes thats what i was doing

marble juniper
#

the bot

pure lion
#

i mean bot

#

also shit

cobalt eagle
#

thx

marble juniper
#

there a way to fetch a user and see if theyre a verified bot?
so a verified self bot

#

im just joking

cobalt eagle
#

how do i restart the mariadb server ?

marble juniper
#

read the docs

cobalt eagle
#

just close and reopen the terminal ?

#

ok

#

so now it should be working fine

#

and won't crash when the bot get tested 😠

ivory seal
#

    var log=client.channels.cache.find(channel => channel.name == 'log-channel');
    if(log !=null)
   const updatedembed=new MessageEmbed()
    .setTitle("**Message Updated**")
    .addField("Author: ",NewMessage.author.username)
    .addField("Old Message: ",oldMessage.cleanContent)
    .addField("Updated Message: ",NewMessage.cleanContent)
    log.send(updatedembed);

});```
#

this is my code

#

it says Unexpected token 'const'

#

pls help

harsh badge
#

use brackets

midnight blaze
#

is there a way to make a collector only reactive to people who are in a certain vocal channel?

const collector = new Discord.MessageCollector(/*message.channel, m => m.author.id === message.author.id,*/ { max: 1, time: 30000 });
ivory seal
#

what do u mean

harsh badge
#

{}

pure lion
#

@midnight blaze filter = msg => msg.channel //shit

ivory seal
#

{} for what

drifting wedge
#

can bots use custom emojis?

harsh badge
#

ye

drifting wedge
#

how?

harsh badge
#

@ivory seal your condition?

drifting wedge
#

like server emojis?

#

i tried

harsh badge
#
  if (log != null) {
    const updatedembed = new MessageEmbed()
      .setTitle('**Message Updated**')
      .addField('Author: ', NewMessage.author.username)
      .addField('Old Message: ', oldMessage.cleanContent)
      .addField('Updated Message: ', NewMessage.cleanContent);
    log.send(updatedembed);
  }
drifting wedge
#

didnt work

ivory seal
#

hold on trying

#

it works the first time

#

after that it doesn't work

pale vessel
#

@midnight blaze const filter = message => voiceChannel.members.has(message.author.id);

#

something like that, i guess

delicate shore
#

Yo @pure lion did u make a support ticket?

ivory seal
#

like the first time i edit it it works

#

after that i edit any message

#

it doesn't get logged

pure lion
#

@delicate shore yeah, should be soon

pale vessel
#

nice

ivory seal
#

so.. what should i do?

pale vessel
#

eval m.guild.channels.cache.get("265156286406983680").send("yes"); --silent

delicate shore
#

ok

pale vessel
#

oof

midnight blaze
#

thanks flazepe^^

delicate shore
#

Bruh

drifting wedge
#

how do i see the total users in servers that have the bot?

faint prism
#

for each server?

delicate shore
#

No spoonfeed @dense vessel

faint prism
#

do a foreach and keep an int count

drifting wedge
#

memberCount = len(set(self.bot.get_all_members()))

#

i have this

oak cliff
#

Rule 7, yes.

drifting wedge
#

is the pre rewrite?

delicate shore
oak cliff
#

guide people to the right answer please :)

dense vessel
#

sorry my bad

faint prism
#

python?

delicate shore
#

it is client.users.cache.size

digital ibex
#

depends on the library and language

drifting wedge
#

python

faint prism
drifting wedge
#

memberCount = len(set(self.bot.get_all_members()))

#

im using this

faint prism
#

you already said that

drifting wedge
#

sorry

#

and is this correct? serverCount = client.guilds

delicate shore
digital ibex
#

or len(client.users) :p

drifting wedge
#

or len(client.users) :p
@digital ibex for every server?

delicate shore
#

what's len

faint prism
#

length in python

digital ibex
#

google it

faint prism
#

^

delicate shore
#

oh ok

#

python no

digital ibex
#

it gets all the members which ur bot is in

#

terrible explanation

#

nvm me, it gets all the users which is in the cache

drifting wedge
#

len(clinet.users)?

digital ibex
#

not clinet

#

client

drifting wedge
#

ik

#

typo

digital ibex
#

then yeah

delicate shore
ivory seal
#

    var log=client.channels.cache.find(channel => channel.name == 'log-channel');
    if(log !=null){
   const updatedembed=new MessageEmbed()
    .setTitle("**Message Updated**")
    .addField("Author: ",NewMessage.author.username)
    .addField("Old Message: ",oldMessage.cleanContent)
    .addField("Updated Message: ",NewMessage.cleanContent)
    log.send(updatedembed);```This code works for the first time , when i try it again it doesn't work
pale hamlet
#

k

digital ibex
#

what do u mean “it doesnt work” ?

faint prism
#

Not sure how I feel about the indention after that if conditional

ivory seal
#

as in it doesn't log

fluid basin
#

indentation is not strictly enforced in JS

digital ibex
#

so?

faint prism
#

ik, only python really does that

digital ibex
#

nobody wants to see shit

faint prism
#

^

ivory seal
#

the error is MessageEmbed fields values may not be empty

faint prism
#

Hard to tell without the error msg though

digital ibex
#

log both <Message>.cleanContent

quartz kindle
#

one of the values is empty

wheat jolt
#

or more

ivory seal
#
    at Function.normalizeField (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
    at C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:445:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:444:8)
    at MessageEmbed.addFields (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:259:42)
    at MessageEmbed.addField (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)
    at CommandoClient.<anonymous> (C:\Code Projects\Discord Bots\Master-Bot2\index.js:110:6)
    at CommandoClient.emit (events.js:327:22)
    at Object.module.exports [as MESSAGE_UPDATE] (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_UPDATE.js:14:12)
    at WebSocketManager.handlePacket (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31) {
  [Symbol(code)]: 'EMBED_FIELD_VALUE'```
#

error msg ⬆️

wheat jolt
ivory seal
#

how do i fix it?

wheat jolt
#

try this

client.on("messageUpdate",function(oldMessage,NewMessage){

    var log=client.channels.cache.find(channel => channel.name == 'log-channel');
    if(log !=null){
   const updatedembed=new MessageEmbed()
    .setTitle("**Message Updated**")
    .addField("Author: ",NewMessage.author.username || 'empty')
    .addField("Old Message: ",oldMessage.cleanContent || 'empty')
    .addField("Updated Message: ",NewMessage.cleanContent || 'empty')
    log.send(updatedembed);
#

it'll show empty if the value is empty

#

obv

faint prism
#

Neat how JS can use variables like that

ivory seal
#

instead of giving 1 msg

#

my bot is giving 5

#

same message

#

the first one says the actuall message

#

the others say empty

digital ibex
#

send a screenshot pls

ivory seal
#

one sec

faint prism
#

What is this NewMessage

digital ibex
#

(i no understand)

quartz kindle
#

messageUpdates are sent when embeds are added to a message

#

these updates will likely have a system:true field

#

so you have to ignore them

ivory seal
#

how do i do tht

wheat jolt
#

if(newMessage.system) return
maybe

#

yup

ivory seal
wheat jolt
#

my homies still don't know what a screenshot is

wheat jolt
#

@summer torrent can you pls show more code

quartz kindle
#

you cannot async map

wheat jolt
#

oki

quartz kindle
#

it will give you an array or promises

#

well, you can, but you'll have to use Promise.all on it

summer torrent
#

getHook is

 const getHook = async (id) => {
            let hooks = await message.guild.fetchWebhooks()
            return hooks.get(id)
}```
quartz kindle
#

for example

#

await Promise.all(data.feeds.map(async f => {}))

drifting wedge
#

for a membercount plugin

#

how do i define the guild

#

in py?

faint prism
#

wha-

summer torrent
#

k lemme try

quartz kindle
#

that will execute all promises concurrently, if you want them sequentially instead to not hit the api too hard, you have to use a for loop

faint prism
#

@drifting wedge To count the users yourself, just iterate over each user in a guild and increment an integer

#
int totalUsers = 0;
foreach Guild g in Guilds
  foreach User u in g
    totalUsers++
#

Don't think you need some library/pluguin for that

quartz kindle
#

you want all users or only online users?

ivory seal
#

it still deosn't work

#

it only works the first time

faint prism
#

you want all users or only online users?
@quartz kindle ah, forgot about the caching

quartz kindle
#

@ivory seal you should also ignore bots

faint prism
#

Right, would want to include that

quartz kindle
#

if(newMessage.author.bot) return

ivory seal
#

yep it works

#

thanks @quartz kindle

#

also can someone give me a link for the color codes i can use for Embeds in Discord

faint prism
#

look up hex color codes

#

or rgb code, or use ms paint lol

ivory seal
#

k thanks

faint prism
ivory seal
#

does rgb work?

faint prism
#

Refer to the docs

quartz kindle
restive pebble
#

nice

#

i didnt knew that lol

#

i thought only RANDOM was option sed

faint prism
#

a random color?

restive pebble
#

yes

faint prism
#

oof, yeah not the case

solemn latch
#

Luminous vivid pink

#

Lmao

#

Someone got a little name happy with that one

faint prism
#

Blurple

earnest phoenix
#

How can I solve?