#development

1 messages ยท Page 912 of 1

knotty steeple
#

its for development

#

not specifically support

#

but 99% of the time it is

quartz kindle
#

@earnest phoenix from what i understood, your database is giving you the timestamp as a string, not as a unix number. the problem is not whether the date is correct or not, the problem is that youre not using the value correctly

#

you cannot do math functions with a value like "2020-05-06", its not a number, its text

knotty steeple
#

pls store it as an epoch

pale vessel
#

it's easier this way ^

#

that's what i do for my shitty economy commands

knotty steeple
#

u can even just make it as a string and parse it

#

that works

quartz kindle
#

before you can compare it with things such as Date.now(), you need to properly convert it into a unix number

earnest phoenix
#

how would i go about that then

#

look guys i know im dumb but im learning and i accept that

pale vessel
#

moment maybe if not native js

quartz kindle
#

i told you how: new Date(yourdatabasevalue).getTime()

pale vessel
#

oh js

earnest phoenix
#

where would i put that

pale vessel
#

lmao

#

you ask me

quartz kindle
#

i mean, look at your code and it should be obvious?

pale vessel
#

bUt i Didn'T cOdE iT

earnest phoenix
#

flaze stfu

pale vessel
#

sorry that was bit too much

earnest phoenix
#

you are hella annoying

knotty steeple
#

well if u cant tell from ur own code its the time bumped

#

also flaze thats supposed to be my job

pale vessel
#

it's my part time job now

wide ridge
#

each shard that I add increases my ram usage by about 1%. That should be normal right?

knotty steeple
#

probably not..?

#

idk

bold dock
#

Well I mean it opens a new websocket connection for each shard, which has its own buffer

knotty steeple
#

how big is a buffer

bold dock
#

Depends on the implementation

#

For example in my gateway it uses a shared buffer, which increases every time it's necessary

quartz kindle
bold dock
#

Because some packets can be quite large

quartz kindle
#

@wide ridge each shard spawned by the sharding manager in fork mode will create a new process, which is a new instance of node.js

#

an instance of node.js contains the entire V8 engine, which by itself uses about 50mb of ram alltogether

#

so each shard = approx 50mb, before adding discord.js

earnest phoenix
wide ridge
#

ahh I see

#

so I'll need to scale accordingly hmm

quartz kindle
#

you can try running shards in worker mode

#

worker threads are now stable as of node.js v12

wide ridge
#

I have a lot of CPU that isn't used by my bot (it's always < 7%), is there anything I can do to utilize it better?

quartz kindle
#

nope, its already using all it needs

#

doesnt need more than that

neat ingot
#

tbh, i'd rather be underutilizing cpu than over.

quartz kindle
#

you can use the mode option in your sharding manager to test worker mode

knotty steeple
#

the extra reactions are not necessary

quartz kindle
#

lmao

wide ridge
#

the extra reactions are not necessary
@knotty steeple have a strawberry my friend

knotty steeple
#

haha isnt that so fucking funny

neat ingot
#

one reaction per person guys cmon ๐Ÿ˜›

pale vessel
#

now you've done it lol

wide ridge
#

LOL

knotty steeple
#

must think ur a comedy genius

wide ridge
#

umm

#

sure

amber fractal
#

when development becomes offtopic

pale vessel
#

abal needs to fix this eris bug

#

where it keeps on disconnecting and reconnecting every two hours or something

knotty steeple
#

abal needs to make better collections

quartz kindle
#

its not a bug

pale vessel
#

and some people are not affected by it idk

#

abal said it was

quartz kindle
#

discord will disconnect you every 15min-4hours

#

due to load balancing

topaz fjord
#

or just asking you to reconnect

pale vessel
#

does reconnecting reset the uptime

quartz kindle
#

no

topaz fjord
#

no

pale vessel
#

then

#

on eris

topaz fjord
#

if you lib doesn't make it a fatal error

quartz kindle
#

you mean its resetting client.uptime?

pale vessel
#

yes

quartz kindle
#

lmao

pale vessel
#

i sound dumb

quartz kindle
#

well if for some reason he links websocket statuses to client.uptime, then yeah

pale vessel
#

interesting

#

well it's not like it affects my bot in any way

#

it's just reconnecting

#

so it's fine ig

quartz kindle
#

let me check

pale vessel
#

reconnecting triggers the ready event right?

#

or the shardReady event since ready is for all shards

quartz kindle
#

lmao

pale vessel
#

lmao

#

hahahaha

#

it does

#

well that's solved

#

thanks tim

toxic jolt
#

Hi guyssss

knotty steeple
#

whats ur problem

toxic jolt
#

My approved bot hahaha

#

now im developer

knotty steeple
#

wrong channel to say that

earnest phoenix
#

that's not development related

quartz kindle
#

@pale vessel you could always use process.uptime() instead

pale vessel
#

i'll do that instead

neat ingot
#

what kind of music do you guys listen to to help focus whilst doing the coding things?

earnest phoenix
#

preferably music i enjoy

knotty steeple
#

lofi

lost kettle
#

discord.js v11.5.1 vs v12 ?

knotty steeple
#

things i like distract me

pale vessel
#

i actually would prefer not to listen to anything

knotty steeple
#

v12 if u dont want to rewrite when u update eventually

earnest phoenix
#

more often than not whenever i listen to music when programming i go on a worldwide tour

unique nimbus
#

Normally its good to listen to music without any lyrics

#

so you can focus more on your coding

#

Because Audio makes you get distracted

#

as in text

#

lyrics

#

etc

#

Make it a background noise

#

so its not blasting into your ears

pale vessel
#

ah yes, development

neat ingot
#

I was reading a survey thing that suggested (according tot he programmers they surveyed) that electronic musics were the most common genre's that people listen to ๐Ÿ˜„

#

it was some kinda annual developer report survey thing.

knotty steeple
#

electronic

#

lmao

#

why do u think people say lofi is to study and shit

#

i find electronic more distracting

neat ingot
#

tbh the best thing anyone can study to is mozart ~ as lame as that is. its been proven time and again to help increase brain activities somehow

#

not all classical music ~ only mozart.

earnest phoenix
astral yoke
#

anyone know why this errors

#

const { channel } = message.member.voice;

#

(node:9952) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'voice' of undefined

amber fractal
#

member is undefined

astral yoke
#

could i define it with message.member?

amber fractal
#

well the member is undefined for whatever reason

#

either because dms or cache

lyric mountain
#

discord.js v11.5.1 vs v12 ?
@lost kettle one of the two will die in a few months, and take all the bots that use it together

#

I'll let you guess which one

quartz kindle
#

F

lost kettle
#

v11.5.1

#

?

quartz kindle
#

not only 11.5.1

#

all of v11

earnest phoenix
#

tim guess what

lost kettle
#

I am using v12 now

earnest phoenix
#

im still having an issue hahha

#

i still cant fix it

neat ingot
#

u didnt even give him time to guess.

#

pretty sure he coulda got that one as well ๐Ÿ˜„

quartz kindle
#

@earnest phoenix did you fix the timestamp issue at least?

#

whats your code now?

earnest phoenix
#

the same as before im just not understanding it like my brain isnt understanding

quartz kindle
#

do you know what a string is?

pale vessel
#

how did you code your bot

#

i'm being serious

earnest phoenix
#

discord.js

slender mountain
#

thats a library

#

whats the problem

earnest phoenix
#

im getting the timestamp as a string

slender mountain
#

and?

earnest phoenix
#
},
  bump: (msg) => {
    con.query(`SELECT * FROM settings WHERE guildid = ${msg.guild.id}`, (err, result) => {
      if (err) return console.log(err)
      let cooldown = (60 * 60 * 1000)
      if (result[0].premium === 1) {
        cooldown = cooldown / 2
      }
      const now = Date.now()
      const lastTimeBumped = result[0].last_time_bumped ? result[0].last_time_bumped : 0

      if (now - lastTimeBumped > cooldown) {
        con.query('SELECT * FROM settings', (err, row) => {
          if (err) return console.log(err)
          msg.guild.fetchInvites().then(invites => {
            if (row.length - 1 <= 0) {
              sendEmbed(msg, 'There are no other guilds for your advertisement to go, `p%invite` and setup the bot on other guilds before trying again.')
              return
            }
            if (invites.size > 0) {
              const invite = invites.first()

              bumpLogic(msg, row, invite)
            } else {
              let channelID
              const channels = msg.guild.channels.cache
              for (const c of channels) {
                const channelType = c[1].type
                if (channelType === 'text') {
                  channelID = c[0]
                  break
                }
              }

              const channel = channels.get(msg.guild.systemChannelID || channelID)
              channel.createInvite().then(invite => {
                bumpLogic(msg, row, invite)
                sendEmbed(msg, `Bumped sucessfully to **${row.length - 1}** Servers.`)
              })
            }
          })
        })
        con.query(`UPDATE settings SET last_time_bumped = NOW() WHERE guildid = ${msg.guild.id}`, (err) => {
          if (err) console.log(err)
        })
      } else {
        sendEmbed(msg, 'You must wait **** before you can use this command again.')
      }
    })
  },```
#

so basically when they do p%bump it bumps there server add but it tells the database when they did it so they have to wait 1 hour before they can do it again

quartz kindle
#

you are doing now - lastTimeBumped

#

do console.log(now) and console.log(lastTimeBumped)

#

and you'll see what im talking about

pale vessel
#

and you'll see the difference

earnest phoenix
#

1588809354760
2020-05-06T21:06:03.000Z

slender mountain
#

or console.log(typeof now) and console.log(typeof lastTimeBumped) if you are still confused

quartz kindle
#

exactly

#

and this is what happens when you try to do math on them

earnest phoenix
#

okay so from here where do i go

quartz kindle
#

you need to convert lastTimeBumped into a proper unix timestamp, as a number

neat ingot
#

^

quartz kindle
#

you can do that using new Date().getTime()

#

so then you can do math on it

earnest phoenix
#

instead of Date.now() i do new Date().getTime()

quartz kindle
#

no

earnest phoenix
#

oh without the new sorry

quartz kindle
#

you dont change now, you change lastBumpTime

#

now is already a number, its fine as it is

neat ingot
#

you have to convert your timestamp from your database using new Date().getTime(), then you can compare it to the the Date.now().

quartz kindle
#

you basically have this ```js
now = 1588809354760
lastBumpTime = "2020-05-06T21:06:03.000Z"

#

so you need to change lastBumpTime into a proper number

earnest phoenix
#

oh okay so to basically get that i use that one you said above there?

quartz kindle
#

yes

earnest phoenix
#

i put it there and ran it now it says i must wait

quartz kindle
#

show what you did to see if you did it right

earnest phoenix
#

const now = Date.now() console.log(now) const lastTimeBumped = new Date().getTime()

#

i think thats what you meant

pale vessel
#

no

#

you need the date from the database

#

and convert it into a timestamp

#

new Date(dateFromDB)

#

and then you use getTime()

#

then you can compare it against Date.now()

#

currently you're getting the current timestamp

#

which is the same as Date.now()

quartz kindle
#

if you do new Date().getTime() without any argument, the result is exactly the same as Date.now() (the current date)
you have to use new Date().getTime() with the date you get from your database, like this: new Date(date_from_database).getTime()

earnest phoenix
#

And obvs that goes in = then that

#

In last bumped correct

quartz kindle
#

yes

#

do it and show it again

shy turret
#

Part of my code:

if (thing[loopnum].startsWith("thing ") || thing[loopnum] == "thing") {

So, if thing[loopnum] is thing <has argument>, it passes the if statement. If thing[loopnum] is thing (no arguments), it doesn't pass the if statement.

pale vessel
#

go on

#

separate those two

quartz kindle
#

it should pass the statement, make sure the case is correct and there are no extra spaces somewhere

shy turret
#

^ that's what im checking rn

quartz kindle
#

if you want it to be case-insensitive, you can do thing[loopnum].trim().toLowerCase() === "thing"

#

.trim() removes any leading or trailing spaces and space-like characters (like new lines)

shy turret
#

I honestly feel like i need to use .toString()

quartz kindle
#

yeah if its not guaranteed to be a string, use .toString() as well

pale vessel
#

but you're combining those two even though one of them shouldn't pass the statement. am i understanding this wrong?

quartz kindle
#

yes there is a redundancy here

#

if you remove the space from startsWith, it will work for both

shy turret
#

^ it works but then you can do something like thingwueifbhweui which i dont want to allow

pale vessel
#

you can also use args

quartz kindle
#

if you split on spaces and create an array of words, then thats not a problem

#

this is what most people do

earnest phoenix
#

im annoying you two i think which i dont want lol

pale vessel
#

you said i was annoying lol

shy turret
#

actually when i tested with .toString() or .trim() i accidently added a space...

#

to thing

#

lets see which one it is

earnest phoenix
#

right so in this line

#

const lastTimeBumped = new Date()

shy turret
#

.trim() fixed it. Thanks.

earnest phoenix
#

do i put new Date(dateFromDB) literally

pale vessel
#

yes

earnest phoenix
#

then what run the bot or no

pale vessel
#

the date that you console.log earlier

quartz kindle
#

dateFromDB has to be the value you get from your database

earnest phoenix
#

1588810719744

#

which is that

quartz kindle
#

for example, in the code you showed before, it was rows[0].last_time_bumped

pale vessel
#

it shouldn't be that

quartz kindle
#

if i remember correctly

pale vessel
#

yeah that one

#

maybe you mistook it with Date.now()

earnest phoenix
#

const lastTimeBumped = new Date(1588810719744)

#

so it like that

pale vessel
#

wait that's from the db?

earnest phoenix
#

yes

pale vessel
#

then you don't need to convert it to a timestamp lol

earnest phoenix
pale vessel
#

is that in seconds though

earnest phoenix
#

im not sure ngl

#

i dont know sql to much little to nothing

#

but when i log console.log(lastTimeBumped) its different

pale vessel
#

when what was that from?

earnest phoenix
#

so if i do the bump feature now ill tell you what it says

pale vessel
#

what is lastTimeBumped?

#

i see it never mind

#

const lastTimeBumped = new Date(1588810719744)
@earnest phoenix is it this?

earnest phoenix
#

yes

pale vessel
#

as you can see those are actual numbers

earnest phoenix
#

yes i just bumped and it gave me 1588811344685

#

sorry

pale vessel
#

you don't need to convert it to timestamp as it's already one

earnest phoenix
#

2020-05-07T00:29:10.800Z

pale vessel
#

ah

#

now that needs to be converted

earnest phoenix
#

yes thats what im not figuring or understanding

pale vessel
#

which one is coming from the database? the numbers or the date above?

earnest phoenix
#

2020-05-07T00:29:10.800Z

#

this

pale vessel
#

then you need to use new Date(dateFromDB).getTime()

earnest phoenix
#

becuase went i turn the bot on it generates the correct numbers

pale vessel
#

where dateFromDB is the date you got from the db

earnest phoenix
#

now do i restart the bot

pale vessel
#

show the code first

earnest phoenix
#

} const now = Date.now() console.log(now) const lastTimeBumped = new Date(1588811344685).getTime() console.log(lastTimeBumped) if (now - lastTimeBumped > cooldown) {

#

like that?

pale vessel
#

how did you get those numbers?

#

the one in lastTimeBumped

sudden geyser
#

btw javascript will round that number

earnest phoenix
#

every time i restart the bot i get new numbers obvs

sudden geyser
#

oh nvm it's not as large as I thought it was

pale vessel
#

those aren't the date you gave me

#

2020-05-07T00:29:10.800Z
@earnest phoenix

#

it's supposed to be like this

earnest phoenix
#

yes

pale vessel
#

so what happened?

earnest phoenix
#

but its will change after every bump

pale vessel
#

no, you fetch it from the database

earnest phoenix
#

using query or

#

i use phpmyadmin

pale vessel
#

2020-05-07T00:29:10.800Z
@earnest phoenix how did you get this

earnest phoenix
#

when i do p%bump

#

it logs it

pale vessel
#

where did you log it?

#

look in the code

#

and use that inside new Date(here).getTime()

earnest phoenix
#

const lastTimeBumped = new Date(dateFromDB).getTime()
console.log(lastTimeBumped)
if (now - lastTimeBumped > cooldown) {

#

dont mind the datefromdb

#

i didnt change it just yet

pale vessel
#

change your code to what it's supposed to be and send it

earnest phoenix
#

which line do i change thats what im saying or just do it for me

#

that way we arent going round in circles

hidden canopy
#

Hey guys, what hosting service do you guys use for your bots? Considering I just wanna host one bot

pale vessel
#

can you send us your current code, the whole file

earnest phoenix
#
},
  bump: (msg) => {
    con.query(`SELECT * FROM settings WHERE guildid = ${msg.guild.id}`, (err, result) => {
      if (err) return console.log(err)
      let cooldown = (60 * 60 * 1000)
      if (result[0].premium === 1) {
        cooldown = cooldown / 2
        
      }
      const now = Date.now()
      console.log(now)
      const lastTimeBumped = new Date(dateFromDB).getTime()
      console.log(lastTimeBumped)
      if (now - lastTimeBumped > cooldown) {
        con.query('SELECT * FROM settings', (err, row) => {
          if (err) return console.log(err)
          msg.guild.fetchInvites().then(invites => {
            if (row.length - 1 <= 0) {
              sendEmbed(msg, 'There are no other guilds for your advertisement to go, `p%invite` and setup the bot on other guilds before trying again.')
              return
            }
            if (invites.size > 0) {
              const invite = invites.first()

              bumpLogic(msg, row, invite)
            } else {
              let channelID
              const channels = msg.guild.channels.cache
              for (const c of channels) {
                const channelType = c[1].type
                if (channelType === 'text') {
                  channelID = c[0]
                  break
                }
              }

              const channel = channels.get(msg.guild.systemChannelID || channelID)
              channel.createInvite().then(invite => {
                bumpLogic(msg, row, invite)
                sendEmbed(msg, `Bumped sucessfully to **${row.length - 1}** Servers.`)
              })
            }
          })
        })
        con.query(`UPDATE settings SET last_time_bumped = NOW() WHERE guildid = ${msg.guild.id}`, (err) => {
          if (err) console.log(err)
        })
      } else {
        sendEmbed(msg, 'You must wait **** before you can use this command again.')
      }
    })```
pale vessel
#

you didn't define dateFromDB

earnest phoenix
#

are you able to just do it for me this one time

#

because im struggling here

pale vessel
#

no, like do you store the dates inside the database?

earnest phoenix
#

yes when someone does p%bump it logs the time and then once an hour passes it will let you do p%bump again

pale vessel
#

can you try getting the time that you logged?

#

because you really need that

earnest phoenix
#

like this kind of thing

#

right so should i do p%bump to get the time?

pale vessel
#

so it is result[0].last_time_bumped

#

try to console.log it

earnest phoenix
#

under results yeah?

pale vessel
#

if it works, define dateFromDB to that

#

yes

earnest phoenix
#

i dont have that

pale vessel
#

it's undefined?

earnest phoenix
#

i just dont have that at all

pale vessel
#

all right, just console.log(results[0])

earnest phoenix
#

where fo you want that to go after what line or can i just it anywhere

pale vessel
#

oh I'm sorry

#

it's result

#

try the first thing i said

#

so it is result[0].last_time_bumped
@pale vessel

earnest phoenix
#

so log it after that line

pale vessel
#

define dateFromDB to that then

#

before lastTimeBumped

earnest phoenix
#

console.log(result[0].last_time_bumped)

#

yeah?

pale vessel
#

remove the console.log obviously lol

earnest phoenix
#

like this haha just to make sure

pale vessel
#

i said define so something like let dateFromDB = result[0].last_time_bumped

#

i literally just spoonfed you

earnest phoenix
#

is date from db the 1588812623213

pale vessel
#

it's the one you sent from phpmyadmin

#

we're converting that to a timestamp so that we can compare it with Date.now() you get me

earnest phoenix
#

let 2020-05-07 00:29:05 = result[0].last_time_bumped

pale vessel
#

dude no

amber fractal
#

wtf

pale vessel
#

i even gave you the code

amber fractal
#

let ANYVARIABLENAMEYOUWANT = result[0].last_time_bumped

pale vessel
#

oh my goodness my brain

amber fractal
#

not that though

pale vessel
#

Tim help

earnest phoenix
#

you said its the one from the picture like hello

quartz kindle
#

nah im out of this one

pale vessel
#

oh please

quartz kindle
#

lmao

pale vessel
#

well Steven

earnest phoenix
#

i did say do it for me to get me out your hair

amber fractal
pale vessel
#

it's all yours

amber fractal
#

I gtg tho

#

but he has the code

pale vessel
#

but he couldn't utilize it

amber fractal
#

is it still a string

#

lmao

earnest phoenix
#

take the piss out of me thats okay

pale vessel
#

sorry but it had to be done

earnest phoenix
#

im dumb lol

#

just do it so i can leave you lot alone

pale vessel
#

lmao i can't

earnest phoenix
#

becuase this clearly isnt working

#

my brains to small

#

can anyone tell me why voice.channel is undefined

quartz kindle
#

i would recommend learning some basic programming, you're running around in circles because you're trying to do something blindly and through guessing

earnest phoenix
#

well can you tell me then instead of taking the piss?

#

then i can learn for net time

#

nxt

#

next

pale vessel
#

because you were being too demanding misunderstood

we can't

earnest phoenix
#

im saying please can you

pale vessel
#

it's one of the rules

earnest phoenix
#

i asked nicely before i said if you dont mind id be grateful

#

okay so i done it but it dont give me any details lol

#

tbh lol i didnt think you meant just copy paste it in hhahaahha

#

right so i copied it in and started up the bot

mystic violet
#

I know this is a bot server, but hear me out could someone help me with collision detection? its just squares

if(x > self.x and x < self.x): return True
if(y > self.y and y < self.y): return True```
I tried this and it doesn't seem to work
#

oh wait

#

I might've done the signs wrong

#

one second

#

nah nvm

#

no idea how to do collision detection

quartz kindle
#

what kind of collision is it? a line against a dot? or a shape against a dot?

#

or a shape against another shape?

#

or a ball/circle against another ball/circle?

lyric mountain
#

Ball is the easiest

mystic violet
#

its to detect a cursor on a square

#

Tried this too

#
if(self.x < x + 1 and self.x + size > x and self.y < y + 1 and self.y + size > y): return True```
#

x and y are cursor coords and self.x and self.y are the coords of the square

#

size is how big the square is width and height

quartz kindle
#

so if x > self.x and x < self.x+size and y > self.y and y < self.x+size

#

is this py? js's canvas has an isPointInPath function, maybe py's drawing libs have something similar

mystic violet
#

its python

#

pygame

#

this doesn't seem to work either

#
if(x > self.x and x < self.x + size and y > self.y and y < self.y+size): return True```
quartz kindle
#

self.x and self.y are the upper left corner coordinates right?

mystic violet
#

heres how im looping through the "blocks" ```py
Mouse_x, Mouse_y = pygame.mouse.get_pos()

for block in renderedblocks:
    block.draw(screen)
    if(block.isSelected(Mouse_x, Mouse_y)):
        print("Collision Detected!")``` and yes
#

Oh I got it to work, It seems I have a "playerxoffset" etc

#

to move

#

so the map moves around the player

quartz kindle
#

ah

mystic violet
#

Im not sure how to implement that though, Just add it to self.x and self.y

#

Im guessing

quartz kindle
#

yeah

#

if the player moves down, the map moves up, correct?

mystic violet
#

yeah

quartz kindle
#

if the value of the offset increases, you need to decrease it from self

mystic violet
#

hehe I got it to work

#

thank you tim :))

quartz kindle
#

np :3

mystic violet
#
if(x > (self.x + playerxoffset) and x < (self.x + playerxoffset) + size and y > (self.y + playeryoffset) and y < (self.y+size + playeryoffset)): return True```
quartz kindle
#

gj

earnest phoenix
topaz fjord
#

are they in a voice channel

pale vessel
#

why wouldn't they lmao

topaz fjord
#

questionsโ„ข๏ธ

earnest phoenix
#

i do be in a voice channel, if I wasn't It would return the "you are not in a voice channel message"

earnest phoenix
#

think I found a bit of a workaround. my only question is how can I add commandFile.run(client, message, args, config, queue) to ```try {
command.execute(message, args);
} catch (error) {
console.error(error);
console.log('There was an error executing a command in a guild, please keep an eye on logs');
if (typeof execute !== 'undefined') {}
}
})

neat ingot
#

replace the execute with the run?

hidden canopy
#

Hey guys, what hosting service do you guys use for your bots? Considering I just wanna host one bot

#

I've looked at Vult VPS and AWS.. Wouldn't that be overkill for one bot?

dense drift
#

if

x = [Map] {
  '177188299943837696' => 1588815502000,
  '487641086462918656' => 1588815777000
}```

How can I do 

```js
x.foreach(u => {
msg.channel.send(u)
})```

And have it print `177188299943837696`?
earnest phoenix
#

@hidden canopy I usee heroku

#

its free

#

upload all your files to a private github page, set the worker up in a procfile and activate the dyno

#

if you want me to teach you how we can discuss in the dms

hidden canopy
#

I've heard about it

#

Sounds good, I'll text you

heavy anchor
#

Iโ€™m hosting with Heroku too @earnest phoenix but how do you use a database since everything resets when you restart or push?

earnest phoenix
#

I use a built in dyno plugin for mlab mongodb @heavy anchor

heavy anchor
#

Ok cool thx

earnest phoenix
#

@heavy anchor if you have a paid db you can use something like keyv to store data like prefixes etc...

heavy anchor
#

I donโ€™t have any db yet Iโ€™m just trying to figure out my opinions

earnest phoenix
#

@heavy anchor mlab has a free sandbox

#

good for hosting custom prefixes or whatnot

heavy anchor
#

Oh really? Iโ€™ll check it out. Thx for the info

earnest phoenix
sudden geyser
#

Is your bot in the server. It is.

earnest phoenix
#

how would I use two try statement, the second one asks for a "finally" statement

#

wait might've fixed it

queen needle
#
message.guild
        .createChannel("molly", "text")```
#

it says message.guild.createChannel is not a function

sudden geyser
#

What version of Discord.js are you using?

queen needle
#

12.1.1

sudden geyser
queen needle
#

how could i get how many users are in the servers my bot is in

earnest phoenix
#

The "id" argument must be of type string. Received undefined first time getting this error. I find it strange. Here's the code response = await message.channel.awaitMessages(msg => 0 < msg.content && msg.content < videos.length + 1 && msg.author.id == message.author.id, {

#

having a feeling I should change msg to message

queen needle
#

i can i get the total amount of channels my bot is in?

sudden geyser
#

@earnest phoenix are you sure it's coming from that area.

earnest phoenix
#

its look for an id so maybe

#

wait nope coming from main bot file

#

this line

sudden geyser
#

so which line would that be.

#

It doesn't seem to be coming from there.

earnest phoenix
sudden geyser
#

Can you show the full error stacktrace.

#

It's not coming from there either.

earnest phoenix
#
    at validateString (internal/validators.js:117:11)       
    at Module.require (internal/modules/cjs/loader.js:1035:3)
    at require (internal/modules/cjs/helpers.js:77:18)      
    at Client.<anonymous> (C:\Users\jjpla\OneDrive\Documents\GitHub\disc-bot-rep\bot.js:58:31)
    at Client.emit (events.js:310:20)
    at MessageCreateAction.handle (C:\Users\jjpla\OneDrive\Documents\GitHub\disc-bot-rep\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\jjpla\OneDrive\Documents\GitHub\disc-bot-rep\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\jjpla\OneDrive\Documents\GitHub\disc-bot-rep\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\jjpla\OneDrive\Documents\GitHub\disc-bot-rep\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\jjpla\OneDrive\Documents\GitHub\disc-bot-rep\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)```
#

found it was actually pointing somwhere else

sudden geyser
#

You probably tried to require a file with undefined as the input.

#

Go to line 58.

earnest phoenix
#

let commandFile = require(commands[command])

sudden geyser
#

Log commands[command]

#

and log command as well so you know what it is.

earnest phoenix
#

console.log((commands[command]))?

sudden geyser
#

yes

#

and the command name as well

earnest phoenix
#

I see the problem

#

my brain is huge people

sudden geyser
queen needle
#

is it possible to get all the channels my bot is in

neat ingot
#

dicsord.js v11: client.channels
dicsord.js v12: client.channels.cache

queen needle
#

so

#

client.channel.size

neat ingot
#

if you want the count yea

queen needle
#

how could i get the same thing but for users

neat ingot
#

replace 'channels' with 'users'..

sudden geyser
#

it's a matter of following links in the docs to your destination

queen needle
#
ERROR: connection refused 127.0.0.1.3000

#

i get this error when i try run my music bot

earnest phoenix
#

show your code

#

it looks like you added the port to the ip

#

im trying to determine if you did it manually if so replace the last full stop with a colon :

queen needle
#

well im, trying to figure out how to open a port

#
const express = require("express");
const app = express();
const listener = app.listen(process.env.PORT, function() {
  console.log("Your app is listening on port " + listener.address().port);
});```
earnest phoenix
#

what os?

queen needle
#

windows

queen needle
#

so would i just open it and replace js { "id": "default", "host": "localhost", "port": 46329,

#

the port with that port

earnest phoenix
copper cradle
#

finally is part of try / catch blocks

#

the error doesn't come from commandFile

queen needle
#

i thought it was try catch ?

#

When ever i try to play a song with my music bot is says you must be in a voice channel but gives no error

copper cradle
#

@queen needle

try {
    //this will run first
} catch (err) {
    // if the code in the try block fails this runs
} finally {
    // this code ALWAYS runs
}
queen needle
#

ohh

copper cradle
#

tho the finally one is opional

#

idk why they're getting an error on that

cinder patio
#

There's isn't a catch block in the image they sent

earnest phoenix
#

you don't have to catch but you must link try with either a catch or a finally

copper cradle
#

yeah

high bough
#

Can someone tell me what's wrong with this? No error code```js
client.on('guildMemberAdd', async member => {
var user = await client.users.fetch(member.id)
var avtr = user.avatarURL()
if (!user.avatarURL()) {
var avtr = "https://discordapp.com/assets/322c936a8c8be1b803cd94861bdfa868.png"
}
var channelw = await client.channels.cache.get("700948323393077313")
const loopfinity = client.emojis.cache.get("701676280793399377");
const embedc = new Discord.MessageEmbed()
.setDescription(${loopfinity} + " | " + **${user.username}** + " has joined " + ${member.guild.name}!\n**User ID:** ${member.id}\n**Guild ID:** ${member.guild.id})
.setColor([84, 64, 205])
.setFooter(${user.username} joined ${member.guild.name})
.setTimestamp()
channelw.send(embedc).catch(err => console.log(err))
if (member.guild.id === "700948321904099370") {
var avtr = user.avatarURL()
if (!user.avatarURL()) {
var avtr = "https://discordapp.com/assets/322c936a8c8be1b803cd94861bdfa868.png"
}
const loopfinity = client.emojis.cache.get("701676280793399377");
const embedh = new Discord.MessageEmbed()
.setDescription(${loopfinity} + " | " + **${user.username}** + " has joined the server!")
.setColor([84, 64, 205])
.setFooter(${user.username} joined the server, ${avtr})
.setTimestamp()
member.guild.channels.cache.get('700948323393077310').send(embedh).catch(err => console.log(err))
}
});

earnest phoenix
copper cradle
#

wHaT's tHe ErRoR

high bough
#

No Error

earnest phoenix
#

also debug your code

high bough
#

Just doesn't show

copper cradle
#

ok so, what should happen and what does actually happen

high bough
#

It should send the embed, but it didn't, no error

copper cradle
#

I'm not gonna read it without knowing what I'm looking for

#

ok reading this on mobile is a pain in the ass

earnest phoenix
#

Is it possible to upload a file to is-inside.me subdomains using Node.JS?

high bough
#

The second part of the code works, this one doesn't.```js
client.on('guildMemberAdd', async member => {
var user = await client.users.fetch(member.id)
var avtr = user.avatarURL()
if (!user.avatarURL()) {
var avtr = "https://discordapp.com/assets/322c936a8c8be1b803cd94861bdfa868.png"
}
var channelw = await client.channels.cache.get("700948323393077313")
const loopfinity = client.emojis.cache.get("701676280793399377");
const embedc = new Discord.MessageEmbed()
.setDescription(${loopfinity} + " | " + **${user.username}** + " has joined " + ${member.guild.name}!\n**User ID:** ${member.id}\n**Guild ID:** ${member.guild.id})
.setColor([84, 64, 205])
.setFooter(${user.username} joined ${member.guild.name})
.setTimestamp()
channelw.send(embedc).catch(err => console.log(err))
})

#

@copper cradle

#

Evaling this doesn't work either ```js
async function s() {
var member = "683577627948351512"
var user = await client.users.fetch(member.id)
var avtr = user.avatarURL()
if (!user.avatarURL()) {
var avtr = "https://discordapp.com/assets/322c936a8c8be1b803cd94861bdfa868.png"
}
var channelw = await client.channels.cache.get("700948323393077313")
const loopfinity = client.emojis.cache.get("701676280793399377");
const embedc = new Discord.MessageEmbed()
.setDescription(${loopfinity} + " | " + **${user.username}** + " has joined " + ${member.guild.name}!\n**User ID:** ${member.id}\n**Guild ID:** ${member.guild.id})
.setColor([84, 64, 205])
.setFooter(${user.username} joined ${member.guild.name})
.setTimestamp()
channelw.send(embedc).catch(err => console.log(err))
}
s()

copper cradle
#

wait

#

I'm doing something

#

I'll get back to you when I finish here

high bough
#

K thanks

sudden geyser
#
var member = "683577627948351512"
var user = await client.users.fetch(member.id)```
#

A string does not have the property id

lusty quest
#

is it possible to get the messageid of a embed you create with a command to store it? want to use it to edit the embed with an event

sudden geyser
#

Yeah just send the message

#

Then <Message>.id like any message.

#

Store it somewhere (like an object) then edit it in the event (if you have access to it)

marble juniper
#

you can store it with making a map object

#

that the easiest way to store it

#
client.customMap = new Map()
earnest phoenix
#

How do I upload a PNG to is-inside.me subdomains using node-fetch?

#

or should I use another library?

marble juniper
#

I recommend using axios

earnest phoenix
#

ok but how

exotic lotus
#

Can anyone help me with top.gg api?

earnest phoenix
exotic lotus
marble juniper
#

then just wait

exotic lotus
#

Ok then i will try to fix it myself

#

i cant wait more

#

im waiting for 1 day

marble juniper
#

@earnest phoenix you can take a look at the sharex config for either one of your subdomains at is-inside.me

#

sharex uses post requests and stuff too

#

so it has header options and stuff

#

and yeah then just send an axios request with the details

#

like headers etc

earnest phoenix
#

the problem im having is putting the PNG file into the body

#

it says invalid syntax "PNG" when i am using require

marble juniper
#

it will try to get a form file

#

so you have to upload it with the file

earnest phoenix
#

ok i'll try

marble juniper
#
var formData = new FormData();
#

then you can use append I think to add an object

#

and a file

#

should work

#

also in the headers it should be multipart/form-data

#

for Content-Type

earnest phoenix
#

ok thanks

#

i need to study what a formdata is first ๐Ÿคฃ

#

i got this when i tried to make a new form data

[06:00:52] Cluster 0 | Unhandled rejection at: Promise  [object Promise] reason:  ReferenceError: FormData is not defined
    at Client.<anonymous> (/app/server.js:641:22)
    at processTicksAndRejections (internal/process/task_queues.js:88:5)
#

k nvm i fixed it by installing the form-data module

marble juniper
#

formdata is like

#

for example on websites when you register with an email and password and you submit

#

thats part of a form

earnest phoenix
#

I wanna know how I would use another try statement if the first doesn't work

restive furnace
#

you can use many as you want

earnest phoenix
#

I want my command handler to run this

#

but this

#

is this

#

what library is dat

#

discord.js

lusty quest
#

@sudden geyser already tryed this but i get an empty response

#

any idea why updating to V12 creates this error HTTPError [AbortError]: The user aborted a request. On V11 it works fine. Other bots i created from the scratch on V12 dont get this error

pale vessel
#

restart your bot

lusty quest
#

this happens when the bot starts (every time)

#

when i start a other bot i dont get the issue

pale vessel
#

happened to me but restarting works

#

your case seems different though

lusty quest
#

i guess its my internet connection but the other bots i made on V12 dont disconnect

earnest phoenix
#

Is it possible to set an image to an embed without an URL? I am using Eris and eris-additions. I know there's one in discord.js but I don't know how to port it to Eris.

pale vessel
#

you mean an attachment?

earnest phoenix
#

attach a file and then reference it via attachment://filename.extension as the url

earnest phoenix
#

@earnest phoenix how do i attach it?

#

you mean an attachment?
@pale vessel yes

#

second argument of createMessage

true ravine
#

Just out of curiosity, are there any discord libraries for c# will full api coverage?

#

I assume there must be?

mossy vine
#

yes, several

#

im not sure what the best but theres discord.net, dsharpplus or whatever its called, disqord, and prolly more

true ravine
#

Wow thank you

broken crater
#

โ™ซ

modest maple
#

Made and maintained by one of the staff at discord lol

restive furnace
#

@earnest phoenix execute

earnest phoenix
#

Is there any music module you can recommend for VDS? Thonk

#

lavalink I don't know how to use

#

Made and maintained by one of the staff at discord lol
@modest maple unironically volt hadn't made a proper contribution in over a year and d.net is one of the trashiest libs out there right now lol

#

volt gave the repo to fox

modest maple
#

it is rather ironic indeed

#

maybe it represents the state of discord's code rn

#

lmao

earnest phoenix
#

How i can see who voted my bot ?

#

${vote.user.username} ???

warm marsh
high geode
#
const DBL = require('dblapi.js');
const dbl = new DBL(TOKENU TAU DBL, { webhookPort: 5000, webhookAuth: 'password' });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

where must I insert my bot id?

#

idk how this owrks

summer torrent
#

you need to put your dbl token

high geode
#

where do i find that?

#

oo

#

i got it

#

my bad

#

i'm idiot

earnest phoenix
#

i wanted to make a invite with bot

message.channel.createInvite({maxAge:max_age, maxUses:max_uses})
let max_age = args.slice(0);
if(!max_age) return max_age = 0;
but max_age is not working

output :
max_age: Value "[]" is not int.

#

pls help

frail ocean
#

console.log(max_age)

And you should see the issue.

earnest phoenix
#

ok

frail ocean
#

See the issue?

earnest phoenix
#

how i can make array to int

#

?

#

cuz here is ['100']

#

@frail ocean ??

frail ocean
#

arrayName[0] to get the first in the array

earnest phoenix
#

args[0] = max_age ??

#

because here is max_age = args.slice(0)

frail ocean
#

No.

earnest phoenix
#

?

frail ocean
#

For example;

let maxAge = max_age[0]

earnest phoenix
#

oh

#

ok

frail ocean
#

Since you don't define args[0] like args[0] = max_age

earnest phoenix
#

smart xD

frail ocean
#

Working?

high geode
#

so

earnest phoenix
#

typing

frail ocean
#

Using d.js v12?

sinful belfry
#

put it in ' '

#

the number, i mean

high geode
#

1 sec

#

still nothin'

sinful belfry
#

what version discord.js are you using?

earnest phoenix
#

@frail ocean IT WORKKK

trail rain
#

Anyone uses sql?

high geode
#

12

#

v12

sinful belfry
#

and you need to define the channel too

high geode
#

"discord.js": "^12.2.0",

sinful belfry
#

var channel =

earnest phoenix
#
  client.on("message", async (message) => {
    if(message.content !== "sh!invite") return;
    let generateinvite = `https://discord.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=392192`
    message.author.send(generateinvite)
  })```
why is my bot sending it multiple times?
sinful belfry
#

then put the client.channel.fetch after that

frail ocean
#

Also you're using "bot" and "client", which one is it defined as?

sinful belfry
#

^ good point

frail ocean
#

@earnest phoenix Multiple instances running?

earnest phoenix
#

wdym?

high geode
#

bot and client

frail ocean
#

Are you running the code multiple times?

earnest phoenix
#

no

high geode
#

another error

trail rain
#

@earnest phoenix does it send this multiple with this command only?

earnest phoenix
#

yes

high geode
#

WHAT THE HECK

frail ocean
#

var channel = client.channels.cache.get("ID")

earnest phoenix
#

commands work fine but events are doing it all multiple times

#

i have no idea why

frail ocean
#

Hmmm,

#

You sure the code is only running once?

earnest phoenix
#

yes

high geode
#

still error

frail ocean
#

Else, I'd console.log at different points, see where it's running multiple times then we can zoom in on there

earnest phoenix
#

how can i console log its process thjo

frail ocean
#

@high geode What's the top line of the error? Well where it actually says it

earnest phoenix
#

tho

frail ocean
#

console.log("Here - 1")

for example

high geode
#

var channel = client.channels.cache.get("707183850828070962")const bot = new Discord.Client({disableEveryone: true});

^^^^^
SyntaxError: Unexpected token const
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
at internal/main/run_main_module.js:17:11

frail ocean
#
    if(message.content !== "sh!invite") return;
    console.log("Hi")
    let generateinvite = `https://discord.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=392192`
    message.author.send(generateinvite)
  })```
#

In your code for examplwe

#

@high geode The const bot should be on a new line

high geode
#

bot.guilds.get("699189120945094757").channels.get("707183850828070962").send(${vote.user} voted voxility)
^
TypeError: bot.guilds.get is not a function
at DBLWebhook.<anonymous> (/app/server.js:14:14)
at DBLWebhook.emit (events.js:196:13)
at IncomingMessage.<anonymous> (/rbd/pnpm-volume/48f2957c-6991-4823-afce-9c4b8ef0edc3/node_modules/.registry.npmjs.org/dblapi.js/2.4.0/node_modules/dblapi.js/src/webhook.js:83:16)
at IncomingMessage.emit (events.js:201:15)
at endReadableNT (_stream_readable.js:1130:12)
at processTicksAndRejections (internal/process/task_queues.js:83:17)

#

again

frail ocean
#
var channel = client.channels.cache.get("707183850828070962")
const bot = new Discord.Client({disableEveryone: true});```
#
bot.guilds.cache.get......```
#

You need the "cache"

#

In v12.

high geode
#

so the errors gone

#

but the bot isnt sending

#

wait

#

still error

frail ocean
#

Error?

high geode
#

bot.guilds.get("699189120945094757").channels.get("707183850828070962").send(${vote.user} voted voxility)
^
TypeError: bot.guilds.get is not a function

#

wth

frail ocean
#
bot.guilds.cache.get......```
#

You need the "cache"
In v12.

high geode
#

just paste that?

frail ocean
#

No

#
bot.guilds.cache.get("699189120945094757").channels.get("707183850828070962").send(`${vote.user} voted voxility`)
high geode
#

ok

#

1 sec

earnest phoenix
#

or example when someone vote my bot, it auto dm me :
bot.users
.get("545490362568015873")
.send(``${vote.user.username} voted your bot``);

high geode
#

bot.guilds.cache.get("699189120945094757").channels.get("707183850828070962").send(${vote.user} voted voxility)
^
TypeError: Cannot read property 'channels' of undefined

#

but i have this

#
var channel = client.channels.cache.get("707183850828070962")
const bot = new Discord.Client({disableEveryone: true});```
#

what the hell

frail ocean
#

Is the IDs correct?

earnest phoenix
#

hey thereal

frail ocean
#

@earnest phoenix ?? What do you need help with? ๐Ÿ™‚

earnest phoenix
#

i console logged "a"

#

not thing

high geode
#

let me create another channel

#

707890056551202926

earnest phoenix
#

and it logged it a few times

#

just sauing

frail ocean
#

@earnest phoenix Where about's was the log?

earnest phoenix
#
  client.on("message", async (message) => {
    if(message.content !== "sh!invite") return;
    let generateinvite = `https://discord.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=392192`
    console.log("a")
    message.author.send(generateinvite)
  })```
high geode
#

/app/server.js:14
bot.guilds.cache.get("699189120945094757").channels.get("707890056551202926").send(${vote.user} voted voxility)
^
TypeError: Cannot read property 'channels' of undefined

earnest phoenix
#

here

high geode
#

the error

earnest phoenix
#

why is it sending it multiple times?

frail ocean
#

Console.,log

message.author.tag

earnest phoenix
#

me?

frail ocean
#

And confirm it's your tag, and no one is running that command except you.

#

/app/server.js:14
bot.guilds.cache.get("699189120945094757").channels.get("707890056551202926").send(${vote.user} voted voxility)
^
TypeError: Cannot read property 'channels' of undefined
@high geode

Is the first id the one of your guild aka server?

earnest phoenix
#

its saying my name

#

a few times

frail ocean
#

Alright, so your message event is being fired multiple times.

earnest phoenix
#

but why is that

high geode
#

@high geode

Is the first id the one of your guild aka server?
@frail ocean ofc

frail ocean
#

Honestly, not so sure. Not encountered it before and typically it's due to multiple instances running. If I was you, I'd save the file and create a new one, gradually adding code to where it duplicates then you got your issue. Someone else might know exactly how to help however.

earnest phoenix
#

ahm how i can make when some one vote my bot it send me his name, cuz ${vote.user} it send me id. And ${vote.user.username} it said undefiened

frail ocean
#

Is the 2nd ID a correct channel id?

high geode
#

yes

frail ocean
#
console.log(bot.channels.cache.get("ID"))```

Just confirm it gets the correct channel and the ID is correct?
high geode
#

wth

earnest phoenix
#

Lel wrong id

high geode
#

maybe i must write the server id

#

too

frail ocean
#

@earnest phoenix In D.JS:

let user = client.users.cache.get("ID")
let name = user.tag``` That'll be like `TheReal#1781`
high geode
#

but what the hell

#

imposible

#

707890056551202926

earnest phoenix
#

ok

high geode
#

this is 100%

#

the id

frail ocean
#

Try with client, you should only have bot or client for ease of purpose, but worth trying ๐Ÿคท

high geode
#

lemme test with this server

#

server id

#

264445053596991498

#

channel id

#

265156322012561408

frail ocean
#

Unless your bot is in this server, it probably won't work.

high geode
#

wait

#

i test with dbl server

#

bot.guilds.cache.get("264445053596991498
^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10

frail ocean
#

bot.channels.cache.get("ID") Same as guilds and users can only get those that the bot is in.

high geode
#

undefined

#

but the guild id

#

and channel id

earnest phoenix
#

what it will be in v11

#

?

high geode
#

are in this server

earnest phoenix
#

cuz i am using v11

frail ocean
#

@earnest phoenix just remove .cache

earnest phoenix
#

bot.users.get

#

ok

frail ocean
#

@high geode use the server that your bot is in, if it isn't in one, make a test server and use that, since it should only read the channels etc that the bot is in for that method.

earnest phoenix
#

ok it wrk

#

work

high geode
#

it is here

#

bro

#

i used

#

this server

#

discord bot list

frail ocean
#

Is your bot in this server?

high geode
#

the bot is there

#

YES

#

i pinged him

#

@frail ocean idk...

frail ocean
#

What are you trying to achieve by putting it in the ready event?

#

Like what is the end goal of this?

high geode
#

when someone votes

#

the bot

#

seend a messsage

#

on a channel

#

really voted me

#

just that

frail ocean
#

To the person who voted or as a log type thing for you (the developer)?

high geode
#

yes

#

exactly

#

but in a channel

frail ocean
#

Which one?

#

To the person who voted or as a log type thing for you (the developer)?

high geode
#

to me

#

in a channel

#

i wanna see

#

who votes

#

user voted voxility

#

in a log channel

frail ocean
#

So just for you?

high geode
#

yes

#

i just wanna see

#

who votes

#

like this one

#

for servers and who adds the bot

#

but for votes

frail ocean
#

Use the same code to get the channel from that event?

high geode
#

hmm

#

wait

earnest phoenix
#

how i can make bot send link like in html :
<a href="https://google.com">click here</a>
any same function in discord.js

high geode
#

bot.guilds.get("699189120945094757").channels.get("707183850828070962").send(${vote.user} voted voxility)

#

this

#
bot.guilds.get("699189120945094757").channels.get("707183850828070962").send(`${vote.user} voted voxility`)```
#

but lemme change

#

the v

frail ocean
#

how i can make bot send link like in html :
<a href="https://google.com">click here</a>
any same function in discord.js
@earnest phoenix

.send("https://www.google.co.uk")

high geode
#

TypeError: Cannot read property 'get' of undefined

earnest phoenix
#

link on a text

frail ocean
#

Plain text in Discord that is a link works as a link, to make it a link but not embed wrap it in < and >

earnest phoenix
#

when u klick text, behind the text it will be link

high geode
#

TypeError: Cannot read property 'get' of undefined

frail ocean
#

Ah let me fetch it

high geode
#

this is the error

#

how can i fix that

#

TypeError: Cannot read property 'get' of undefined

earnest phoenix
#

cache ??

frail ocean
#

[Text](https://google.co.uk/)

#

@high geode What's the code?

high geode
earnest phoenix
#

message.channel.send(text) ??

frail ocean
#

Where is the error though?

#

message.channel.send(text) ??
@earnest phoenix Potentially, not sure if its just on embeds, but worth a try.

earnest phoenix
#

lel

#

how i can use it on embed

#

embed is better

frail ocean
#

@high geode Can you show me the line of xxxx invited xxxx

#

embed is better
@earnest phoenix same thing. IE:

.setDescription("Hi [this](https://google.co.uk/) is cool")```
earnest phoenix
#

oh

#

hyperlinks only work in embed descriptions and embed field values

#

thanks

frail ocean
#

yep thought so

high geode
#

@high geode Can you show me the line of xxxx invited xxxx
@frail ocean what???

frail ocean
high geode
#

it doesnt work

frail ocean
#

In what way

high geode
#

bot.guilds.get("699189120945094757").channels.get("707183850828070962").send(${vote.user} a votat voxility)

#

this is the code

frail ocean
#

Take that bit of code, and just reuse it but for the voting

#

It'll have server ids, channel ids already in it for you

high geode
#

it doesnt work bro

#

TypeError: Cannot read property 'channels' of undefined

#

this is the error

frail ocean
#

That means either your channel is undefined, either wrong ID for example

high geode
#

cant be bro

#

because

#

i used this id

#

from this server

#

send me the id

#

from

#

send me

frail ocean
high geode
#

hmm

#

good point

#

wairt

#

TypeError: Cannot read property 'channels' of undefined

#

still error

frail ocean
high geode
#

its the same

#

channel

#

and guild id

#

bot.guilds.get("699189120945094757").channels.get("707183850828070962").send('a votat voxility')
^
TypeError: Cannot read property 'channels' of undefined

#

same error

frail ocean
#

bot.guilds.cache

high geode
#

in v11?

#

=)))))))

frail ocean
#

In v12 you need the cache

high geode
#

i changed

#

t o v11

frail ocean
#

So your running v11 and v12?

high geode
#

i changed to v11

earnest phoenix
high geode
#

so i use v11 rn

quartz kindle
#

fyi, v11 will stop working in october

high geode
#

still erroring

frail ocean
#

Was there a reason for that, just since I advise against downgrading

#

Yeah since it is not supported from October, and just makes it confusing for us who help people, as we prefer working in the latest version

high geode
#

i dont know

#

v12

#

i hate v12

#

i use v11

#

"discord.js": "^11.4.2",

frail ocean
earnest phoenix
#

Use v12

frail ocean
#

That guide will have all changes on for you

quartz kindle
#

ok but when october comes, your bot will stop working if you have v11

robust moth
hasty sparrow
#

Forgot the ' before Guild_Id

robust moth
#

Oops

high geode
#

bot.guilds.get("699189120945094757").channels.get("707183850828070962").send('a votat voxility')
^
TypeError: Cannot read property 'channels' of undefined

#

what error is this

#

what the hell

#

....

#

the guild id works

#

channeel id works

white anvil
#

that guild doesnt exist in your cache

high geode
#

its v11

#

smh...

white anvil
#

still doesnt exist

#

if it did it wouldnt be undefined

high geode
#

let me use

#

a new server

white anvil
#

either ur bot hasnt cached it or the guild id is invalid

high geode
#

bro it doesn work

#

TypeError: Cannot read property 'channels' of undefined

#

same error

#

and i changed the server

#

and the channel

#

what the hell

white anvil
#

just do console.log(bot.guilds)

#

and see what it logs

high geode
#

?

white anvil
#

u dont have any guilds cached then lol

high geode
#

wdym

white anvil
#

are u waiting for the bot to ready

earnest phoenix
#

brh

white anvil
#

u could be trying to fetch the guild before the websocket connection fetched all the guilds the bot is in

#
bot.on('ready', () => {
  // put code here
})
#

try this

high geode
#

how can i do that

#

1 sec

#

it doesnt work

#

@white anvil

white anvil
#

same thing?

high geode
#

can I send you the invite link

#

and do you it?

#

please

#

i dont know

#

i try this

#

for 2 hours

#

and i dont know..

white anvil
#

do you get the same error

high geode
#

no

#

the logs

#

arent update

#

ing

#

anymore

white anvil
#

what logs

high geode
#

what wrong here?

#

console.log(Logged in as ${client.user.tag}!);

#

i dont recive this

#

anymore

white anvil
#

ur bot isnt readying then

#

which will explain the errors

#

is your token valid

high geode
#

noo

#

wait

#

bro

#

bot.on('ready', () => {
// put code here
})

#

i used this

#

and now

white anvil
#

also u leaked ur dbl token

#

lol

high geode
#

trust me

#

it's much longer

#

๐Ÿ˜‰

frail ocean
#

Also I recommend you format it better, it's easier to read rather than a mix of indentations.

white anvil
#

do u have bot.login(token) anywehere

high geode
#

i regened it

#

yes