#development

1 messages · Page 823 of 1

pine aspen
#

better sql

#

The result of premium is undefined

pale vessel
#

what module is that?

pine aspen
#

wait

#

hold up

#

It's MYSQL but a mate updated it to use Better-Sqlize module

#

I think.

wheat jolt
#

const premium =
Instead of
const { premium } =

#

Check what you get

pine aspen
#

k

#

@wheat jolt

#

same

#

undefined

wheat jolt
#

Ugh

#

Is that guild premium?

pine aspen
#

Yup

wheat jolt
#

No ideea then

pine aspen
#

wait

#

what if i change args[1]

#

to an int

wheat jolt
#

Doesn't matter if it's an int or a string

pine aspen
#

k

dapper hill
#
        case 'embed':
            const embed = new Discord.RichEmbed().addField('Author', message.author.username);
            msg.channel.sendEmbed(embed);
            break;``` I am trying my hand out on embeds and for some reason whenever I type ?embed nothing shows up. I get no error and the bot doesn't type anything. I am using a toutorial from early 2019 so would it have to do with the fact that I am using 12 and I think he is using 11?
hoary elm
pine aspen
#

(node:546) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `premium` of 'undefined' or 'null'. at Object.run (/app/data/DiscordBot/commands/admin/premium.js:91:5) at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) (node:546) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, orby rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:546) [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.

#

Error.

#

@hoary elm what's the issue?

#

Oh.

#

nvm

hoary elm
#

Lol I attached the command code and problem

pale vessel
#

@dapper hill msg.channel.send(embed)

wheat jolt
#

@dapper hill what version of Discord.js?

dapper hill
#

12.0.2

wheat jolt
#

sendEmbed is deprecated

#

Use .send

pine aspen
#

Toxic it ain't that.

pale vessel
#

Use MessageEmbed()

wheat jolt
#

Oh v12

pine aspen
#

The code looks very organized

pale vessel
#

@dapper hill msg.channel.send(new Discord.MessageEmbed().addField('Author', message.author.username))

pine aspen
#

I'm sorry this is too advanced for me.

hoary elm
#

@pine aspen for the most part.... I just can't figure out the timeout

If they use the command nb/open without a reason the bot will ask them to provide a reason if they don't provide one in 1 min I want it to timeout.

pine aspen
#

Maybe.

hoary elm
#

It does the time out i just don't know how to get it to send a message saying that it timed out

pine aspen
#

Wait

#

Sec

#

Do you use a DB?

hoary elm
#

For this bot no

pine aspen
#

k

hoary elm
#

It's just a single server ticket bot

pine aspen
#

Idk then sorry.

pale vessel
#

where did you add talkRecently?

hoary elm
#

Very bottom

pale vessel
#

oh

dapper hill
#

Ya @pale vessel That doesn't seem to work unless I typed it in wrong

pale vessel
#

you had the ( backwards

#

lol

dapper hill
#

Ya I just noticed that loil

#

thanks

#

wait no same error

pale vessel
#

did you check whether the user is inside the set or not and then add the id

dapper hill
#

nvm

#

did not save

#

cause I am special

#

lol

pale vessel
#

yes keem is very special

dapper hill
#

ooooo

#

n

#

o

#

        case 'embed':
            const embed = new Discord.RichEmbed().addField('Author', message.author.username);
            msg.channel.send(new Discord.MessageEmbed().addField('Author',
            message.author.username));
            break;```
pale vessel
#

remove embed = line

#

you already defined the embed in the next line

#

inside channel.send

hoary elm
#
.then(collected => {
message.delete().catch();
reason = collected.first();
if(!collected) return message.channel.send("Ticket Creation Timed Out")
})  
}```
This is the timeout I was referring to 
 @pale vessel sorry for late response
#

Time is set via the awaitMessages string

dapper hill
#

        case 'embed':
            const new Discord.RichEmbed().addField('Author', message.author.username);
            msg.channel.send(new Discord.MessageEmbed().addField('Author',
                message.author.username));
            break;
``` So like this @pale vessel ?
pale vessel
#

no

dapper hill
pale vessel
#

remove the line that has const

#

the whole line

dapper hill
#

oooo

#

ok

pale vessel
#

RichEmbed is deprecated, you already defined the new embed on the next line inside msg.channel.send

dapper hill
#

uhhh

#

uhh

pale vessel
#

what happened

dapper hill
#

No error but it just isnt sending anything lol

#

I am going to try somthing

pale vessel
#

@hoary elm what do you mean by "can't figure the timeout"?

#

because you defined message as message, not msg

#

change msg to message

hoary elm
#

When it awaits their response it times out after 60 seconds when it times out I want it to send a message so they know it timed out

pale vessel
#

but it didn't send anything?

hoary elm
#

No

dapper hill
#

it worked

#

thanks @pale vessel

pale vessel
#
.then(collected => {
    message.delete().catch();
    
    if (!collected.first()) return message.channel.send("Ticket Creation Timed Out")
    
    reason = collected.first();
});```
#

maybe check if there's collected first before declaring it

hoary elm
#

Oof I kinda figured it was something simple 🤦🏻‍♂️

pale vessel
#

but did it work tho

hoary elm
#

Testing now

golden condor
#

Is there anyway to selfdeaf on ytdl?

hoary elm
#

@pale vessel didn't help

pale vessel
#

no errors?

hoary elm
#

Same thing times out but no message

#

No

#

Ok I lied

#

``UnhandledPromiseRejectionWarning: #<Collection>

``

golden condor
#

Is there anyway to selfdeaf on ytdl, I'm not sure

pale vessel
#

if (!collected.first()) return message.channel.send("Ticket Creation Timed Out")

hoary elm
#

Oh 🤦🏻‍♂️ thats why I didn't put .first()

#

I was going to but I second guessed myself

#

Nope. Same error

pale vessel
#

does reason work?

hoary elm
#

Yes

pale vessel
#

then try if (!reason)

#

wait.

#

we did that

hoary elm
#

Yes but I didn't have it inside the awaitMessage

pale vessel
#

what happens to reason if it goes timeout?

#

does it return anything?

hoary elm
#

No

#

The bot just times out and provides no response

pale vessel
#

all right let's just try that

#

if (!reason)

hoary elm
#

Same error

#

But now this is included

#

DeprecationWarning: Collection#exists: use Collection#some instead

sick cloud
#

are there any encoder things like base64 but smaller

#

so to make a longer string smaller but when decoded still retain all the data

golden condor
#

Is there anyway to self deaf when using ytdl?

elder moss
#

I need a job

#

Does anyone now any hiring jobs?

#

Know*

hoary elm
#

@pale vessel just wanted to update and let you know I got it I just added a .catch(collected => { Timeout message here }) and seems to be working so far 👌thank you for your assistance

pale vessel
#

ah nice

dapper hill
#

Ok this might be very vauge

#

but

#

How do I add a specific image to my embed

#

not the persons profile photo. Just a specific image

hoary elm
#

.setImage('link or path here') afaik

dapper hill
#

ahhhh ok

#

I will try that out thank u

#

ok that worked but how do i make it small and put it in the top left corner?

hoary elm
#

Top left corner I believe is set with author...

#

.setAuthor("someMessageHere", "someLinkHere or PathHere")

dapper hill
#

like this

#

but in the top left corner

#

without any text if possible

#

I will try that I guess

hoary elm
#

If you don't want text you can try not setting any for example "" leave the quotes empty but it's most likely gonna error that embed fields can't be empty

dapper hill
#

did not work

hoary elm
#

Hmm they must have changed that in newer versions then

#

One sec

dapper hill
#

Wait

#

@hoary elm

#

I got it

#

its .setThumbnail

hoary elm
#

Oh I was just gonna suggest thumbnail

#

Lol

dapper hill
#

Quistion

#

How do I keep my bot online even when I have shutdown my computer?

#

@hoary elm ? Do you know?

hoary elm
#

VPS

cursive dagger
#

Check pins

hoary elm
#

^^

dapper hill
#

thank u @cursive dagger

#

and u @hoary elm

hoary elm
#

Np

golden condor
#

Can anyone help

#

I need to know if I can self deaf on ytdl

tight plinth
#

You can

restive furnace
#

ytdl? nope, you need to do it via discord.js/eris voice sending thingy

#

so yes iys possible

pine aspen
#

Hey,

#
message.author.send(bot.guilds.map(g=> g.name) + bot.guilds.map(g=> g.id).join(`\n`))
#

I'd like to make the bot dm this to me on a command

#

<Server Name> - ID: SEVER_ID - Owner: SERVER_OWNER does anyone have an idea how i could do this?

toxic jolt
#

For 2 days, most everyone is getting this error. How can we fix it?

#

or

#

getting this error

modest maple
#

probably blocking code somewhere

quartz kindle
#

@pine aspen you mean this? ```js
bot.guilds.map(g => <${g.name}> - ID:${g.id} - Owner:${g.ownerID}).join("\n");

pine aspen
#

Yup

#

That exactly.

toxic jolt
#

i how to fix pls help guys

quartz kindle
#

@toxic jolt you need to show your code

toxic jolt
#

okay i give you edit link

#

pls help man

modest maple
#

we're not doing it for you

earnest phoenix
#

Use hastebin

#

Lmao

finite bough
#

how to marry a bot

zenith terrace
#

You propose to it

finite bough
#

how

#

-d.js

pine aspen
#

@quartz kindle yeah like that but how could i fetch ownerid

#

and owner username

#

of the server

finite bough
#

owner.displayName @pine aspen

quartz kindle
#

await client.users.fetch(g.ownerID)

pine aspen
#

oh

#

so that works

#

so then i assume for member count i could filter bot users own

#

and do g.members

finite bough
#

.size

quartz kindle
#

its more complicated than that

#

to get an accurate member count, you use guild.memberCount

#

but if you want to filter bots and users, you need to fetch all members first

#

which is a pain because it eats ram for breakfast

#

imagine fetching 80k members for this server alone

pine aspen
#

Haha.

#

I'll not do that then.

#

I'm just simply bad an don't really understand mapping

quartz kindle
#

mapping is simply converting each item in an array to something else

#

ie: [1,2,3,4,5].map(thisItem => thisItem + 2) // [3,4,5,6,7]

pine aspen
#

Tim you're method ```js
message.author.send(bot.guilds.map(g => \${g.name} - ID:${g.id} - Owner:${g.ownerID}`).join("\n"));

#

Isn't working very well.

#

I got another method.

#

Oh.

quartz kindle
#

@toxic jolt you need to rewrite your bot. your code is very messy, lots of copy pasted things, broken and disabled codes, useless things everywhere, you have like 50 modules installed that you dont use. all of that together makes your bot very slow and full of strange errors

#

you need to clean up everything

pine aspen
#

Oh.

quartz kindle
#

start again from 0, install and use only what you need

#

delete all codes that are useless, repeating or broken

finite bough
#

@pine aspen Owner: ${g.owner.displayName}

quartz kindle
#

what is not working?

finite bough
#

life

pine aspen
#

Sec

#

I'll try

quartz kindle
#

displayName will only work if the owner is cached

finite bough
#

then fetch it

#

ig

quartz kindle
#

thats what we're doing

finite bough
#

u* xD

pine aspen
#

bot.users.fetch() is not a function ;/

#
message.author.send(message.client.guilds.sort((a, b) => b.memberCount - a.memberCount).map((r) => r).map((r, i) => `${r.name} | ID: ${r.id} | ${bot.users.fetch(r.ownerID)}  ${r.userCount} members`).slice(0, 10).join("\n"));
#

I got to work.

quartz kindle
#

well, if you're using client, use client

pine aspen
#

But bot.users.fetch() isn't a function.

#

I'm not using client

quartz kindle
#

oh nvm

#

bot might not be defined in your current scope

#

use message.client instead then

pine aspen
#

K

quartz kindle
#

and you need to await it

pine aspen
#

`js

quartz kindle
#

so you need to do .map(async r =>)

pine aspen
#
  run: (bot, message, args) => {
#

should work tho

#

k

quartz kindle
#

it should

#

unless you didnt pass bot, or passed it wrong

pine aspen
#

idk

#

I'll check later

round ridge
#

need bit of help with discord.js v12

        muterole = await message.guild.roles.create({
            name: 'Mod',
            color: "#514f48",
            permissions: []
        })

Its not nameing role Mod

pine aspen
#
Check Date
The Date + 30
If the date is 30 more days than in DB
remove premium 
else return
#

How could i do this?

#

@round ridge what're you trying to do?

#

The name should be 'mute'

pale vessel
#

please read the docs.

round ridge
#

i know i did wrong but still its not nameing role

pine aspen
#

Yeah

#

It's not supposed to rename

pale vessel
#

the docs has everything.

pine aspen
#

Go read docs

round ridge
#

it docs saying to do like that

pale vessel
#

no.

round ridge
#

it is i did read them

pale vessel
pine aspen
#

Flazze

pale vessel
#

what's up

pine aspen
#

Go time to help rly quick?

pale vessel
#

sure.

pine aspen
#
Check Date
The Date + 30
If the date is 30 more days than in DB
remove premium 
else return
#

I'm not to sure how to do this

#

Do you have a recommendation on how i could

pale vessel
#

the date + 30

pine aspen
#

Also idk how to use db date in this thats a bit why

#

the date + 30 days

pale vessel
#

what type of database are you using?

pine aspen
#

mysql

#

but module is a custom madeby a friend

#

but it's pretty simple to use

pale vessel
#

did you store the date in the database?

pine aspen
#

No not yet

restive furnace
#

@pine aspen mind sharing the wrapper?

pale vessel
#

than in DB

pine aspen
#

uhm

#

sure

#

ye

#

I'll put the data in

#

when the guild joins

pale vessel
#

you can put a timestamp

pine aspen
#

hmm

pale vessel
#

and then add 30 days to the timestamp

pine aspen
#

so like con.prepare('INSERT INTO time = ? WHERE guildid = ?').run(timestap, message.channel.send)

pale vessel
#

time stamp could be new Date().getTime()

#

it's in milliseconds

#

so 2592000000 for thirty days

restive furnace
#

but isnt that python?

#

that what syn uses

#

or ikd

#

idk

pale vessel
#

wha

#

the wrapper?

restive furnace
#

idk

pine aspen
#

No

#

djs

pale vessel
#

anyway, i gave you some ideas on how to do that

#

it's up to you on how to execute it

pine aspen
#

k

#

how'd i do to only have a date like this

#

xxxx:xx:xx

#

year date month

pale vessel
#

you can format the timestamp using module like moment

#

or you can use js but it's quite messy

pine aspen
#

k

pale vessel
#

i recommend using YMD because it's the standard

pine aspen
#

k

#

I think i already have moment

tight plinth
#

I tried to code a discord bot in owo language, here is my code : ```owo
owO oWO owoWowo //starts the bot

OwoWowo OwO UwU //message event
OwU(owo) //starts the bot

#

Yes we need to start the bot 2 times

restive furnace
#

haha..

tight heath
#

any js lads here

#

is this a valid way of destructuring and passing a default arg

restive furnace
#

what you trying to do?

tight heath
#

passing {} as the default arg into a function and destructuring the lifetime property from the arg if one is passed

restive furnace
#

i cant help, sorry.

quartz kindle
#

doesnt look like it

#

this.test becomes undefined instead of an empty object

#

this seems to work however

#

basically if a value is not passed, it has to destructure the default value instead lol

zenith terrace
#

@quartz kindle everyone went quiet 😂

earnest phoenix
#

bruh some child of 11 y.o. trying to code a bot

#

he said he will reach his goal

pale vessel
#

who?

earnest phoenix
#

but he is violating discord t.o.s already

round ridge
#

Help what is the new version of filter in discord.js v12

(node:4420) UnhandledPromiseRejectionWarning: ReferenceError: filter is not defined
  let proof = null;
  await message.channel.send(prooooof).then(async () => {
    await message.channel
      .awaitMessages(filter, {
        maxMatches: 1
      })
      .then(collected => {
        proof = collected.first().content
      });
  });
earnest phoenix
#

@strange harness

#

i think he once tried to get his bot here

#

but then he left or something

sudden geyser
#

@round ridge that's not with Discord.js.

#

That's with your code.

round ridge
#

how if it was working on v11

sudden geyser
#

It doesn't.

round ridge
#

it is

pale vessel
#

it's called maxProcessed now, not maxMatches

round ridge
#

k

pale vessel
sudden geyser
#

You're still going to get that same error.

earnest phoenix
#

i told that child to stop the development of his bot

#

he was already doing 10 errors

#

and he did not even learn a programming language

round ridge
#

@pale vessel that did not help its problem with filter

sudden geyser
#

flaz I think it's max

#

not maxProcessed

earnest phoenix
#

How add my bot to the site ?

#

he says he has coding skills and he is the youngest developer 😂

pale vessel
#

oh. you're right. to collect

#

so it's max

pale vessel
#

they reversed the new properties xd

sudden geyser
#

yeah discord.js likes to do that

round ridge
#
(node:1336) UnhandledPromiseRejectionWarning: ReferenceError: filter is not defined

Still same :/

pale vessel
#

you need to define filter

round ridge
#

how it never was like that

pale vessel
#

...ok dude

round ridge
#

in v11 all was okay v12 releas and rip

pale vessel
#

this is what a filter should look like: const filter = m => m.content.startsWith('!vote');

sudden geyser
#

Dominik if you downgraded your version right now and tested it you'd get the exact same error message.

round ridge
#

so how would i define to bot wait for message

#

@sudden geyser my other bot is on v11 and work

pale vessel
#

maybe he accidentally removed the filter without realizing

sudden geyser
#

probably

#

because they're not the same

pale vessel
#

anyway, it's not that hard to fix

round ridge
#

oh yep i did that

    const filter = res => {
      return res.author.id === user.id;
    };

forgot about this line

pale vessel
#

see

round ridge
#

but never saw this my 2 dev might did that intresting 😄

pale vessel
#

const filter = m => m.author.id === user.id;

#

this looks better

round ridge
#

i think max : 1 dont work as its not doing ant think

#

i try maxProcessed

#

yep maxProcessed work

pale vessel
#

damn it

#

the fucking docs

#

jk i can't read so it's me

round ridge
#

last question how i get collected message content as this give error

      .then(collected => {
        proof = collected.first().content
      });
(node:4688) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'content' of undefined
pale vessel
#

console log collected and see what it returns

sudden geyser
#

maxProcess is the maximum number of messages for your bot to see. max is the max number of messages that pass your filter successfully to be collected.

round ridge
#

i puted max : 1 did not work

#

its outputting Collection [Map] {}

pale vessel
#

v11:
max: max messages to process
maxMatches: max messages to collect

v12:
max: max messages to collect
maxProcessed: max messages to process

#

look at the difference

#

they flipped it and changed the name

sudden geyser
#

first one empty because nothing was collected, but it hit the max processed

pale vessel
#

its outputting Collection [Map] {}
@round ridge well it's empty

round ridge
#

Shit

pale vessel
#

use max

round ridge
#

Ok

pale vessel
#

it's the same as maxMatches, which worked in v11

round ridge
#

Ok i try again

#

@pale vessel when i use max nothing happend

true ravine
#

Dunno why I can't find it online, but how do you update to discord.js v12?

golden condor
#

@true ravine what do you use?

#

Glitch?

#

Or anything else

quartz kindle
#

Either uninstall and reinstall, or instal with @12.0.2

true ravine
#

Okay I'll just uninstall

#

Thanks

quartz kindle
#

npm doesnt let you update major versions because major versions will always break your code

true ravine
#

Yeah I tried just npm update and it updated me from 11.5 to 11.6

golden condor
#

How do I selfdeaf in ytdl-core

#

I use lavalink so I know how to do it on there

#

But I also use ytdl so wanna know that too

earnest phoenix
#

ytdl isn't related to discord in any shape or form

golden condor
#

Ik

#

I use ytdl-core-discord

#

Nope never mind

#

I don't

#

I was getting lavalink-discord and ytdl-core mixed up

hollow saddle
#

Still, neither have any capabilities to selfdeaf

#

What lib are you using?

earnest phoenix
#

lavalink does

#

wait nevermind

hollow saddle
#

Ah but still

earnest phoenix
#

lavalink doesn't, it's the wrapper around lavalink that does it

#

since the only thing passed to lavalink is the connection itself

#

so lavalink can write to it

#
module.exports = {
    name: "normshift",
    desc: "Host a shift.",
    usage: "",
    execute: async (message, args) => {
    message.delete()
    const worked = new Discord.RichEmbed()
        .setTitle(`New shift being hosted by ${message.member.displayName}!`)
        .addField("etype:", "")
        .addField("Game Link:", "")
        .addField("Description:", "")
        .setFooter("Module 1.0.0")
    const invalid = new Discord.RichEmbed()
        .setTitle("There was an error with this shift.")
        .setDescription("Sorry, there seemed to be some trouble")
        .setFooter("Module 1.0.0")
    let whitelist = ["676786881161330690", "648717359632351283"];

    if (whitelist.includes(message.channel.id)){
        message.channel.send(worked)
    }else{
        message.channel.send(invalid)
    }
}};

This still sends worked in non-whitelisted(AND whitelisted) channels and there are no errors.

pale vessel
#

oh

#

just realized

#

you deleted the message

#

where can it get the id?

earnest phoenix
#

it doesn't matter

#

the object still exists in memory

pale vessel
#

put message.delete() last, just try

earnest phoenix
#

it

#

does

#

not matter

#

also, @earnest phoenix, debug

#

inspect your variables and step through your code block by block and see where the issue is

#

There are no errors

#

And it just doesnt make sense

#

I don't knooww

#

i told you to debug lol

#

it's on you if you refuse to do it

quartz kindle
#

and see if it matches any of those ids

true ravine
#

Sorry for another stupid question, but could someone link me the changes in d.js v12?

pale vessel
earnest phoenix
#

Thanks tim

#

let me do it rn

true ravine
#

Cheers

earnest phoenix
#

Hey Tim

#

In the whitelisted channels, the ID is the same.

#

But in non-whitelisted channels it sends worked

#

and I don't know why

pale vessel
#

a day passed and still no solution yet lol

earnest phoenix
#

nupe

#

I should just remove it loll

#

whats the latest version of discord.js

quartz kindle
#

12.0.2

true ravine
#

I'm sorry but whose bright idea was it to make us use .cache before absolutely everything in djs

#

By the time I've updated to v12 they'll have released v21

earnest phoenix
#

stop being moronic

#

cached entities are now contained in a cache container and there's nothing bad about that

#

also, regex replace exists

#

you could've had inserted .cache into everything you needed to within 30 seconds

true ravine
#

Very sorry sir didn't realise that is such a sensitive topic

earnest phoenix
#

because it isn't lol

#

it's just that people are being morons complaining about the change without knowing what it actually does

#

and breaking changes are... kind of the point of major versioning

true ravine
#

True

#

I guess I'll go back to pasting cache everywhere then

earnest phoenix
#

...but you don't have to

true ravine
#

Hol up

#

I don't?

earnest phoenix
#

what IDE are you using

true ravine
#

vscode

earnest phoenix
quartz kindle
#

cant you just like hit ctrl+h

#

and replace all x.y with x.cache.y

earnest phoenix
#

^

true ravine
#

Yeah

earnest phoenix
#

Fuck you

unique nimbus
#

That is not nice

earnest phoenix
#

Siktir

#

Fuck you

#

no let them be they're very edgy

unique nimbus
#

No thanks

#

yes

earnest phoenix
unique nimbus
#

Very cool

#

A youtuber

earnest phoenix
#

oh no please you're hurting my feelings 😭

true ravine
#

Look at this comedian

twilit rapids
#

-m @earnest phoenix Being annoying and rude in development | 3 days

unique nimbus
#

I don't even know where it came from

gilded plankBOT
#

🤐 Muted ₮[EsQureY]_SO 22#2440 (@amber crescent)

true ravine
#

Lmao

quartz kindle
#

wtf

unique nimbus
#

Welcome to the Internet

#

¯_(ツ)_/¯

twilit rapids
#

He left btw

unique nimbus
#

yes

elder moss
#

how to get your bot verified by discord

pale vessel
#

discord can't verify your bot

elder moss
#

how do you get bot developer role

pale vessel
#

what do you mean by verify?

unique nimbus
#

Basically you add the bot

pale vessel
#

oh. you need to submit your bot and wait for its approval

unique nimbus
#

^

elder moss
#

yh thats it

#

where do i submit it

pale vessel
elder moss
#

not verify 🙄

quartz kindle
elder moss
#

thanks

#

i dont have a website url

#

wth

pale vessel
#

it's optional

elder moss
#

ohh

#

thanks

pale vessel
#

it'll tell you if it's required

elder moss
#

aight

solemn quartz
#

Guys

#

I made a 8ball cmd! : D

#

Finally

sudden geyser
#

Good job

solemn quartz
#

but it isnt much good

#

cuz i cant do something like if it only does ?8ball it says "what are you asking?"

#

So like i have a prolem

#

^

pale vessel
#

you can try awaitMessages

finite bough
#

@solemn quartz check if an argument is given

echo violet
#

Hello everyone 😊

pale vessel
#

hey

echo violet
#

I just started development for the first time using node.js for discord bots. Is there any good resources out there anyone could recommend for a beginner? Just made my first hello world bot some days ago :P

mossy vine
#

learn basic javascript

#

thats the main advice

echo violet
#

ohhhh okay, took it in college, it’s not that bad at all :-)

solemn quartz
#

@echo violet search on Yt "CodeLyon"

mossy vine
#

ah so youre familiar with thing like callbacks, etc.

solemn quartz
#

easiest tutorials ever

#

lol

echo violet
#

Will definitely research JavaScript some more though and thank you BG!

#

Yes

#

CompSci major :P

#

Just getting feet wet here though!

solemn quartz
#

lol

mossy vine
#

the codelyon tutorials are outdated now

solemn quartz
#

GL @echo violet

mossy vine
#

d.js v12 has quite a few changes

#

i suggest documentation

#
solemn quartz
#

yea

#

too

#

@echo violet have you already installed discord.js?

echo violet
#

Bookmarked! Thank you 🙏🏻

#

Yes

solemn quartz
#

From what do you code?

#

VS code?

#

Glitch?

#

What

echo violet
#

You mean my IDE?

mossy vine
#

yes

echo violet
#

I just use notepad++ :o

solemn quartz
#

wat

amber fractal
#

I would suggest a better editor

echo violet
#

I research code and implement it and mess around with it.. yeah :’D

mossy vine
#

notepad++ is not bad but especially as a beginner you would generally want features such as autocompletion and code suggestions

amber fractal
#

I just think it's messy

echo violet
#

I see :) what would you guys recommend?

mossy vine
#

but then again i have no idea what your skill level is so ¯_(ツ)_/¯

#

visual studio code is a very popular option

#

and a very good one in fact

#

insanely good for javascript

amber fractal
echo violet
#

Been coding for a few years now here and there and did some work for Mainframes under IBM but I don’t have that much experience :(

#

Thank you!

#

That looks pretty neat and organized, will download it when I’m back home and give it a try

#

You guys have been pretty helpful, thank you :D

#

Never thought of using anything VS related for this LOL

amber fractal
#

Workspaces really help organize your code

echo violet
#

-deleted-

#

Ooh I posted this in the wrong place :’D Sorry LOL

#

Trying to share documentation with another friend that just got into development too

earnest phoenix
#

Helo

#

Chat

#

@echo violet heli

#

O

wide ridge
#

Is there any way to wait for all of my shards to fully start up before allowing users to execute commands?

earnest phoenix
#
///...```

Is this true?
amber fractal
#

@wide ridge what lib

#

and version

#

nice token

#

you're gonna wanna reset that

#

whoever posted that

elder moss
#

oh

amber fractal
#

I mean I could just snipe it

#

which is why you should reset it

earnest phoenix
#

it also can stay in someone's client cache lmao

elder moss
#

i didnt post it

wide ridge
#

@wide ridge what lib
@amber fractal discordjs

elder moss
#

so idk

amber fractal
#

Someone posted their token

#

@wide ridge what version though 12 or 11

wide ridge
#

11.5, sorry

elder moss
#

why would someone post their token

amber fractal
#

they posted code

#

and didnt remove it

elder moss
#

lol

amber fractal
#

wait for all shards to be ready by them emitting this

#

The easiest way I can think of is storing the value somewhere where all shards can access like a database and check before the command is executed or you could probably use broadcastEval in some way too, but I never did anything with that

tough relic
#

Hello! yeah it's me again... I was just wondering if there is a way to @ the person who called the bot

blissful scaffold
#

Probably something like message.author.mention, but it depends on what library you use

tough relic
wicked pivot
#
const Discord = require('discord.js');

module.exports.run = async (bot, message) => {
    message.guild.members.map(c => {
        if(c.presence.game)
        if(!c.user.bot)
        if(c.presence.game.name === "Custom Status"){
            if(c.presence.game.name.includes("discord.gg" || "http")){
                console.log(c.presence.game.state)
            }
        }else if(c.presence.game.name !== "Custom Status"){
            if(c.presence.game.state.includes("discord.gg" || "http")){
                console.log(c.presence.game.state)
            }
        }
    })
};

module.exports.help = {
    name: "scanstatus"
};```
I can't, how can I do? to see if in the status of a user on the server it has (http where discord.gg)?
warm marsh
#

version?

tough relic
#

I got my bot to @ me and the number after the # but I got no ping....

wicked pivot
#

^11.4.2

tight plinth
#

@tough relic that's bot how it works. Your but should do <@yourid> to ping you

tough relic
#

You mean I should put <> around the name or delete the # and the numbers?

quartz kindle
#

your should put <@> around your ID, not your name

tight plinth
#

Your ID is 495628159337627655

quartz kindle
#

like this

tight plinth
#

So it will be @tough relic

quartz kindle
#

^

finite bough
#

^

tough relic
#

Alright thx

slate oyster
#

True ^

unique nimbus
#

That is an opinion

#

not a fact

vestal star
#

Any idea how I could run complete nodejs virtualization, on my ubuntu server?

#

Also, I would rather use pm2 because of it's metrics

earnest phoenix
#

cool developers use only Eclipse IDE
isn't eclipse one of the buggiest IDEs out there and has an interface looking like it's straight out of 2006 bloblul

blissful scaffold
#

It looks like it's straight out of 2006, because you can't improve perfection 😛

earnest phoenix
#

have you tried reading the error

elder moss
#

no

tight plinth
#

The other description

elder moss
#

icba

tight plinth
#

Short desc ≠ long description

elder moss
#

kk

#

thanks

earnest phoenix
#

just wondering but would a temp email api get my bot banned?

#

what

finite bough
#

tf is a temp email

amber fractal
#

never heard of 10 minute mail?

earnest phoenix
#

temporary email....

finite bough
#

oh temporary email

earnest phoenix
#

yeah but how is that related to discord

finite bough
#

I was thinking of temperature email

earnest phoenix
#

just wondering if DBL would ban my bot if i added that

finite bough
#

studying too much chemistry

earnest phoenix
#

dbl can't do anything against your bot but remove it from their page lol

finite bough
#

depends

#

how u use it

#

if it breaks discord TOS

earnest phoenix
#

thats what i meant

finite bough
#

dbl will remove it

earnest phoenix
#

as in removing it from thier site

finite bough
#

if a temp email api is not breaking the discord tos

#

dbl should not have any problem

wicked pivot
#
const Discord = require('discord.js');

module.exports.run = async (bot, message) => {
    message.guild.members.map(c => {
        if(c.presence.game)
        if(!c.user.bot)
        if(c.presence.game.name === "Custom Status"){
            if(c.presence.game.name.includes("discord.gg" || "http")){
                console.log(c.presence.game.state)
            }
        }else if(c.presence.game.name !== "Custom Status"){
            if(c.presence.game.state.includes("discord.gg" || "http")){
                console.log(c.presence.game.state)
            }
        }
    })
};

module.exports.help = {
    name: "scanstatus"
};```
 I try to make a command which scans all the status of user of the server, and if one of the users has in its status "discord.gg" where "http" sa tells me by the good of a message

v11.4.2
finite bough
#

@wicked pivot good of a message?

earnest phoenix
#

that's

#

not how includes works

tight plinth
#

^

round ridge
finite bough
#

@round ridge show code

round ridge
#

that all

finite bough
#

wait

amber fractal
round ridge
#

@finite bough its v12 btw

finite bough
#

yes but

#

the code?

earnest phoenix
#

please help me console log js (node:22945) UnhandledPromiseRejectionWarning: Error: getaddrinfo EAI_AGAIN discordapp.com:443 at Object._errnoException (util.js:1022:11) at errnoException (dns.js:55:15) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26) (node:22945) 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(). (rejection id: 2) (node:22945) [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.

finite bough
#

the eval code which u use

round ridge
#

@finite bough think is even when i put it in index or some else nothing happens its undefine all time

finite bough
#

show me the code

round ridge
#

ok

earnest phoenix
#

@earnest phoenix which hosting are you on

#

localhost

#

are you self hosting?

finite bough
#

nvm

#

my brain is running slow today

earnest phoenix
#

@earnest phoenix yap my server pc linux

round ridge
amber fractal
#

@round ridge you didnt trim the command

finite bough
#

if(["626346037975580672","594491170248458250"].includes(message.author.id)){

amber fractal
#

It isnt that

finite bough
#

what r u trying to do here?

amber fractal
#

he's trying to eval with the command call

round ridge
#

@amber fractal huh?

earnest phoenix
#

@earnest phoenix a google search says that the problem is with your proxy / connection

amber fractal
#

That checks if the user is a dev I'm guessing

earnest phoenix
#

try doing some solutions from google

finite bough
#

yea but

amber fractal
#

@round ridge log args for me

finite bough
#

never saw someone doing it this way

amber fractal
#

tell me what it is

round ridge
#

@amber fractal problem is that i cant get user username all i need help with

amber fractal
#

Having an array of developer ids is probably the best if you have multiple devs on a project. but it should also be in a config file so you can change it with ease

finite bough
#

^

earnest phoenix
#

@earnest phoenix i restarted the router and it improved

round ridge
#

@amber fractal you understand what i mean

amber fractal
#

Yeah I can see that, message.author.username would work if your eval command worked properly

round ridge
#

but its not working in any command

amber fractal
#

what does it show for the other commands

round ridge
#

undefined

finite bough
#

message.author.cache.username?

amber fractal
#

what?

finite bough
#

wait

amber fractal
#

author returns a user

finite bough
#

nvm

sudden geyser
#

read docs pls

round ridge
#

@sudden geyser did milion times

finite bough
#

it should cache by itself

amber fractal
#

@round ridge can you show me other code where you use it and it returns undefined?

round ridge
#
const Discord = require("discord.js");
const randomPuppy = require("random-puppy");

module.exports.run = async (client, message, args) => {

        const img = await randomPuppy("greentext");
        const embed = new Discord.MessageEmbed()
            .setColor("#00dd55")
            .setImage(img)
            .setTitle(`Greentext`)
            .setTimestamp()
            .setFooter(`Image requested by ${message.author.username}`)
        message.channel.send(embed);
    }
amber fractal
#

what about message then is it being passed correctly?

round ridge
#

all is good

#

but cant define author

amber fractal
#

what is the error specifically

round ridge
#

nothing there is no error

#

but when i eval it u get SyntaxError: Unexpected identifier

amber fractal
#

I love js... So it sends but the footer says Image requested by undefined?

finite bough
#

can u add .cache ?

amber fractal
#

to what

round ridge
#

i did 2 times same error

finite bough
#

idk I dont get this new cache thing but tey it

#

oh

#

lel

amber fractal
#

message.author doesnt have a cache lol

round ridge
#

I love js... So it sends but the footer says Image requested by undefined?
@amber fractal yes

wide ridge
#

It appears that bots have access to print any emoji as long as you have the emoji name and id. Is this correct? I'm sharding my bot and I noticed I can use emojis for servers that the bot is not in.

This does not seem to be the case for message reactions while sharding, though. Reactions do require the bot to have access to the specific emojis.

amber fractal
#

@round ridge It may be dumb, but try message.member.user.username

round ridge
#

ok

#
SyntaxError: Unexpected identifier
amber fractal
#

well what did you do

round ridge
#

eval that

amber fractal
#

Your eval command isnt set up right

#

like I said

#

you're evaling with the m!jsk

round ridge
#

jsk is just rename of eval..

amber fractal
#

which gives you the unexpected identifier

#

Yes, your args includes it

earnest phoenix
#

It appears that bots have access to print any emoji as long as you have the emoji name and id. Is this correct? I'm sharding my bot and I noticed I can use emojis for servers that the bot is not in.

This does not seem to be the case for message reactions while sharding, though. Reactions do require the bot to have access to the specific emojis.
custom emojis can be used across shards, as long as your bot is in the guild with the custom emoji and has permissions to use them in the channel, they're able to use it

round ridge
#

Yes, your args includes it
@amber fractal nope

amber fractal
#

That's the only way you'd get that unexpected identifier error

#

from that

#

wait

#

I see

#

you're evvaling twice

round ridge
amber fractal
#

idk then

#

the new cache system is stupid

round ridge
#

that is right

earnest phoenix
#

try using message.author

amber fractal
#

he did

#

same thing

earnest phoenix
#

huh

#

are you on a stable d.js ver?

round ridge
#

v12

#

v12.0.2

amber fractal
#

Last thing I could thing of is message.author ? message.author.username : (await message.guild.members.fetch(message.member.id)).username

#

wait

#

I misplaced a )

earnest phoenix
#

but if the author was undefined, it would throw right?

#

Hmm imma try the thing you're trying @round ridge and if it works... Imma tell you something...

#

anyways, yeah, try forcefully fetching the member

amber fractal
#

Unless he's catching unhandled rejections and doing nothing with them with like a process.on('uncaughtexception', ...

round ridge
#

i try first reinstall all modules

earnest phoenix
#

that won't help

finite bough
#

^

round ridge
#

never know

earnest phoenix
#

but i do know

#

it's a runtime issue, not a compilation issue

finite bough
#

wait

earnest phoenix
round ridge
#

yep it did help i know what is the error

#

discord.js is wrongly installed

finite bough
#

@round ridge can u just try client on("message", message..... message.chhanel.send(message.author.username)

#

in ur main file

earnest phoenix
#

Did you do npm install discord.js --save?
Or what? @round ridge

finite bough
#

does it matter .,.

round ridge
#

i did npm install discord.js

earnest phoenix
#

But the --save is important...

sudden geyser
#

depends

round ridge
#

not rly

finite bough
#

not rly

earnest phoenix
#

When i didn't do --save some of my code didn't work... Suspicious

finite bough
#

@round ridge try getting it on ur main file

#

@earnest phoenix his code is working

amber fractal
#

not since 5.0

round ridge
#

just wait need to redownload all as that was main problem discord.js did not download right as i saw

earnest phoenix
#

Oh... Hmm

#

K good luck...

finite bough
#

pls 1st try getting it on ur main file

#

there can be a problem with ur command handler then

#

idk how but

#

ok

#

oh I have no idea how

earnest phoenix
#

--save is obsolete

#

nvm im late

finite bough
#

XD

wide ridge
#

custom emojis can be used across shards, as long as your bot is in the guild with the custom emoji and has permissions to use them in the channel, they're able to use it
@earnest phoenix so you see, my shards are able to use all of the custom emojis even if they're not in the guilds that have the custom emojis

earnest phoenix
#

huh

#

are you sure about that

wide ridge
#

yeah

#

they can send them through embedded messages, but they can't react using them

earnest phoenix
#

that's... weird

wide ridge
#

message reactions using the custom emojis doesn't work, but I can see the emojis in the embeds and in message replies etc

amber fractal
#

are they using them or are they using the url to them

wide ridge
#

they're using them like this:
<pokeballidofemoji:>

#

<:emojiname:emojiID:>

#

which works for all of my custom emojis. I have over 500 emojis across 18 different guilds

earnest phoenix
#

it's more than likely a bug

wide ridge
#

and some of my shards serve only 4 guilds

round ridge
amber fractal
#

could be because you have them cached maybe?

earnest phoenix
#

try sending :txt: and seeing if that's going to get resolved

#

thank you discord

#

you're useless

wide ridge
#

Hmm I haven't checked their cache

finite bough
#

xD

earnest phoenix
#

@round ridge wait did you include that Embed message code in a different file than the very main?

round ridge
#

no

#

all is in that file

earnest phoenix
#

Hmm that's very suspicious

finite bough
#

@earnest phoenix ever heard of command handling?

earnest phoenix
#

Yea?

finite bough
#

then why did u ask that

#

"another file"

#

actually

#

@round ridge can u check if u defined the guild something

#

like const guild = "?"

#

smthing like that

earnest phoenix
#

Hmm... I mean like i think i have found something... But...
I mean did he include all his codes in one file or did he use another files to store them commands in...

round ridge
#

i did

earnest phoenix
#

@round ridge did you make a js file for every single one of your commands or you included them all in just one file?

round ridge
#

@earnest phoenix yes

finite bough
#

he did .,.

#

sir

earnest phoenix
#

Umm... Which one now all codes in one?

finite bough
#

his code works

#

that means the basic stuff is ok

#

@round ridge can u try logging out author username from ur main file?

round ridge
#

nothiing work

finite bough
#

is it the author username only

#

?

earnest phoenix
#

you guys forgot

#

that fetch is a promise

#

and it needs to be resolved with either async-await or Promise.then

finite bough
#

I ignored that as it's also not working in his embed

#

@earnest phoenixit would return an error tho

earnest phoenix
#

how?

finite bough
#

ehh

earnest phoenix
#

fetch gets the object from discord directly

finite bough
#

no I mean

#

async error

earnest phoenix
#

wat

finite bough
#

aaa

earnest phoenix
#

await in non async method?

finite bough
#

smthing like that

#

but

earnest phoenix
#

that's why i said or Promise.then

finite bough
#

lmao

#

yea that's why I said aaa

royal ravine
#

hi i am getting this error when i use node .

#

/home/pi/DiscordBots/ThemeBot/node_modules/discord.js/src/util/Util.js:32
);
^
SyntaxError: Unexpected token )

#

i think its bcus i have a old version

#

but how can i upgrade it

#

i can only use the terminal

#

npm -v = 4.1.2

earnest phoenix
#

it's a syntax error

royal ravine
#

how should i fix that ?

earnest phoenix
#

lol

#

yikes

royal ravine
#

oef

modest maple
#

by fixing the syntax

royal ravine
#

its in the nodes modules folder wont i break anything if i remove code ?

earnest phoenix
#

go ask the repo owner

modest maple
#

i imagine root is gonna be index.js as for .env fuck knows

#

might wanna learn basic js before jumping into bot development

marble juniper
#

also build some things after you learned them for practise it wont help if you just watch hours of tutorials but have nothing built in that time just an advice @earnest phoenix

earnest phoenix
#

you don't

finite bough
#

file inside a file

#

easy

#

step 1 make sure the file is a girl who is 18+

#

step 2, do I even have to explain further?

#

we all know u r a man of culture

split hazel
#

Not sure but is there a way to detect the encoding of a string? Let's say i encoded text to binary, is there any tools available to detect it is binary (node.js specifically)

amber fractal
finite bough
#

@split hazel if u use vsc will detect the language I think

amber fractal
#

That's not what they're trying to do I don't think

#

but

#

the one I gave isnt either I dont think

#

not sure.

split hazel
#

Yeah not what i wanted, that only detects the type of the string, i want it to detect the type of encoding which was used, for example binary, base32, base64, ROT etc etc

earnest phoenix
unique nimbus
#

you didn't define db

earnest phoenix
#

not sure what u mean by that

quartz kindle
#

do you have db anywhere in your code?

earnest phoenix
#

yup

quartz kindle
#

then you're using it wrong

earnest phoenix
#

nah

#

wasnt like this when i set it up

quartz kindle
#

errors dont lie

#

you're probably trying to use it out of scope

earnest phoenix
#

no

quartz kindle
#

then show code

earnest phoenix
#

i just use it to get servercount on dbl

#

never had this problem just today it says undefined

quartz kindle
#

show code

earnest phoenix
#

const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('', bot);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})

dbl.on('error', e => {
console.log(Oops! ${e});
})

#

removed key for privacy

quartz kindle
#

well... where is db?

earnest phoenix
#

idk

#

tonkku helped me with that

quartz kindle
#

whats the full error?

earnest phoenix
#

db is not defined

quartz kindle
#

the full error

#

including the stack trace

earnest phoenix
#

that is the error

quartz kindle
#

no its not

earnest phoenix
#

so why am i getting db is not defined

quartz kindle
#

show the full error

earnest phoenix
#

that is what it shows nothing else

quartz kindle
#

what is written under it?

earnest phoenix
#

see Error: db is not defined

quartz kindle
#

i want to see this

#

what is this

earnest phoenix
#

thats my bot count

#

Server count posted

quartz kindle
#

dude i cant help if you dont show more

#

what you shown so far helps with nothing

#

and you refuse to show more

earnest phoenix
#

i dont think u understand

quartz kindle
#

no, you are the one who doesnt understand

#

programming is not magic, i cant possibly know what your code is doing if i dont see it

earnest phoenix
#

@bitter sundial i keep getting this error db is not defined how do i fix this?

quartz kindle
#

...

unique nimbus
#

bruh

#

NEKO

#

Do you know how Tim has a bright green role

#

Because he knows what he is doing

quartz kindle
#

i told you, if you dont show your code, nobody can fix it

unique nimbus
#

yes

#

People needs to see the code to know why it doesn't work

earnest phoenix
#

i already showed the code

quartz kindle
#

you showed a small irrelevant part of it

earnest phoenix
#

thats the code i have

unique nimbus
#

Show the full error

bitter sundial
#

you define the db or remove the code

earnest phoenix
#

how do i define db?

unique nimbus
#

bruh

quartz kindle
#

either show your code, or go learn javascript

earnest phoenix
#

const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('', bot);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})

dbl.on('error', e => {
console.log(Oops! ${e});
})

quartz kindle
#

the error is not here

#

i told you

earnest phoenix
#

thats the full code already showed u

bitter sundial
#

what are the lines under the picture you showed

quartz kindle
#

^

#

i've asked you this a thousand times

bitter sundial
#

they're important to locating the error

earnest phoenix
#

server count posted

#

then db is not defined

quartz kindle
#

UNDER it

#

not above