#development

1 messages ยท Page 854 of 1

finite bough
#

@earnest phoenix discord.js version?

earnest phoenix
pale vessel
#

you can use a ` or " instead of putting backslashes

#

also, member.voice.channel

frail prism
#

Hello

pale vessel
#

moved to a manager in v12

earnest phoenix
#

so @finite bough do you think i should just not the do the guild.channels.cache.first() thing or not

pale vessel
#

don't

finite bough
#

don't

earnest phoenix
#

@finite bough Library
discord.js
Version
v12.16.1

finite bough
#

it will probably give u errors most of the time

#

do msg.member.voice.channel

#

voiceChannel is for 11v

knotty steeple
#

are u trying to send to a channel when bot joins

#

pls dont

#

annoying

finite bough
#

yes

#

the max u can do is send an embed to the server owner

#

its also a bad idea but thats the max

knotty steeple
#

the max you do is nothing

pale vessel
#

and sometimes it's not even the owner that added the bot

finite bough
#

yea but still

pale vessel
#

no just don't

frail prism
#

Can anyone help me to create a bot

finite bough
#

its not a good idea coz

knotty steeple
#

just

#

dont

frail prism
#

Please

finite bough
#

most of the owners have dms off

pale vessel
#

you're just ruining the bot

knotty steeple
#

do you want someone making you a bot

#

@frail prism

pale vessel
#

hey toxic

#

long time no see

frail prism
#

@knotty steeple yes

knotty steeple
#

well

spare goblet
#

-faq 3 @frail prism

gilded plankBOT
#

@frail prism

Frequently Asked Questions ๐Ÿ“œ
knotty steeple
#

unless ur paying

#

most people wont

pale vessel
#

might as well pay for a vps and code your own bot

hoary elm
#

Anyone else having this issue with the SQL modules?


throw err;


Error: Cannot find module '/rbd/pnpm-volume/28798193-514e-4918-bd8e-d1fef507e28f/node_modules/.registry.npmjs.org/sqlite3/4.1.1/node_modules/sqlite3/lib/binding/node-v67-linux-x64/node_sqlite3.node'
spare goblet
#

What sql are you using

#

Oh sqlite

finite bough
#

sqlite3

hoary elm
#

sqlite3

finite bough
#

LOL

pale vessel
#

iara read fast

#

was just about to say that

spare goblet
#

Sounds like something from glitch ngl

finite bough
#

is that the windows thingy

spare goblet
#

Are you using glitch

pale vessel
#

because pnpm

spare goblet
#

Ye

finite bough
#

i tried sqlite on glitch it works fine

sudden geyser
#

did you try installing sqlite3? have you tried re-installing?

finite bough
#

oh yea tru

earnest phoenix
#

try uninstall and re-install it ?

hoary elm
#

For this bot ngl yes I am, was working fine but randomly crashed bout an hour ago

#

try uninstall and re-install it ?
@earnest phoenix just tried that same error

finite bough
#

on glitch its not crashing its called project shutdown bloblul

pale vessel
#

well time to switch

earnest phoenix
#

do
pnpm uninstall sqlite3
pnpm install sqlite3

#

if not

#

enable-pnpm

hoary elm
#

on glitch its not crashing its called project shutdown bloblul
@finite bough no I have a plan

#

I have the always on features

earnest phoenix
#

oh

#

do they have a plan ?

hoary elm
#

Yeah released it a few days ago

finite bough
#

u wasted 8$ on glitch...

earnest phoenix
#

well its good

earnest phoenix
#

kinda

finite bough
#

a good vps costs 5$...

earnest phoenix
#

is a vps hosting service or ?

finite bough
#

yes

earnest phoenix
#

virtual private _ ?

spare goblet
#

Virtual private server

earnest phoenix
#

ok

#

im using glitch lmao

earnest phoenix
#

even tho my bot deserve better haha

spare goblet
#

Glitch isn't good

earnest phoenix
#

ik

hoary elm
#

This bot does to honestly been debating switching to digital ocean

earnest phoenix
#

i have nothing else

pale vessel
#

but contabo-

spare goblet
#

DO Is good

pale vessel
#

why glitch

earnest phoenix
#

any suggestions on a vps?

#

free or not

finite bough
#

free vps bloblul

earnest phoenix
#

nooo

pale vessel
#

no free vps unless you post some stuff on some forum

earnest phoenix
#

i said if its free or not tell me

hoary elm
#

why glitch
@pale vessel was just a small bot at first didn't really need it online all the time

#

But it grew fast

finite bough
#

digital ocean

#

contabo

pale vessel
#

but you paid $8

hoary elm
#

Yes I know

spare goblet
#

I use vultr

earnest phoenix
#

@pale vessel your pfp describe how u look rn

hoary elm
#

Waiste of money

#

Lol

earnest phoenix
#

best vps you know ?

pale vessel
#

waist waste of time too

earnest phoenix
#

i want a good vps

modest maple
#

pay money

earnest phoenix
#

YEAH IM ASKING

modest maple
#

good vps -> gonna cost

earnest phoenix
#

IF U KNOW

spare goblet
#

Glitch was made as a testing sandbox

modest maple
#

contabo is cheap n pretty decent

earnest phoenix
#

@modest maple who said im not going to?

spare goblet
#

And like that's what it's good at

finite bough
#

@earnest phoenix what error in console

modest maple
#

Galaxy gate is what alot of bots use

earnest phoenix
#

i asked if there are any suggestions,

finite bough
modest maple
#

look at pins

spare goblet
#

You can talk about development in here

earnest phoenix
#

cya

finite bough
#

someone said u cant but ok

modest maple
#

it literally called development

spare goblet
#

Topic says otherwise but ok :)

pale vessel
#

i mean it's about bot development

earnest phoenix
#

@finite bough

pale vessel
#

you didn't even tell us the error

#

or did you

finite bough
#

WAIT OMG DISCORD IS LOADING IMAGES

earnest phoenix
#

YES

spare goblet
finite bough
#

lmao

zenith terrace
#

xD

#

How to take random message

#

And use it as an example

pale vessel
#

ken no shitposting in development

earnest phoenix
#

@finite bough ?

finite bough
#

error

#

console error

pale vessel
#

what even is the error

zenith terrace
#

I donts like the discord ss codes sad

pale vessel
#

why are you suddenly sending us your code

zenith terrace
#

For phone

earnest phoenix
#
Connected to database!
Yo this ready!
Collection [Map] {
  '696075071474761748' => Message {
    channel: TextChannel {
      type: 'text',
      deleted: false,
      id: '671783138485075977',
      name: 'test2-nfsw',
      rawPosition: 1,
      parentID: '665282871505977364',
      permissionOverwrites: Collection [Map] {},
      topic: '',
      nsfw: true,
      lastMessageID: '696075071474761748',
      rateLimitPerUser: 0,
      lastPinTimestamp: null,
      guild: [Guild],
      messages: [MessageManager],
      _typing: Map {}
    },
    deleted: false,
    id: '696075071474761748',
    type: 'DEFAULT',
    content: '2',
    author: User {
      id: '389453494911893508',
      bot: false,
      username: 'Hedi',
      discriminator: '5455',
      avatar: '0442e2f470eca8c82532e033f83d856e',
      lastMessageID: '696075071474761748',
      lastMessageChannelID: '671783138485075977'
    },
    pinned: false,
    tts: false,
    nonce: '696075070749016064',
    system: false,
    embeds: [],
    attachments: Collection [Map] {},
    createdTimestamp: 1586027629489,
    editedTimestamp: null,
    reactions: ReactionManager {
      cacheType: [Function: Collection],
      cache: Collection [Map] {},
      message: [Circular]
    },
    mentions: MessageMentions {
      everyone: false,
      users: Collection [Map] {},
      roles: Collection [Map] {},
      _members: null,
      _channels: null,
      crosspostedChannels: Collection [Map] {}
    },
    webhookID: null,
    application: null,
    activity: null,
    _edits: [],
    flags: MessageFlags { bitfield: 0 },
    reference: null
  }
}
pale vessel
#

oh my god no

#

allah

zenith terrace
earnest phoenix
#

console.log

#

xdd

pale vessel
#

did you get an error or what?

#

let's just get straight to the point

spare goblet
#

What's wrong with that

#

That log I mean

earnest phoenix
#

this is-, why?

pale vessel
#

you're not making sense here boi

earnest phoenix
#
try {
                        var response = await msg.channel.awaitMessages(msg2 => msg2.content > 0 && msg2.content < 11, {
                            maxMatches: 1,
                            time: 10000,
                            errors: ['time']
                        });
                    } catch (err) {
                        console.error(err);
                        return msg.channel.send('No or invalid value entered, cancelling video selection.');```
pale vessel
#

and? what's not working about it

#

what you sent was not the error

earnest phoenix
#
Ota-chan-DEVELOPINGBOTma 21:13-kor
Song selection:
1 - Nico-Nico-Nii! [BEATSTEP REMIX]
2 - Yazawa Niko - niko niko nii~
3 - Love Live  Nico Nico Nii Compilation
4 - (Weekly Idol EP.261) TWICE Momo imitate character &#39;Nico Nico Ni&#39;
5 - Nico Nico Nii
6 - KPOP Idols doing &quot;Nico Nico Nii- Love Live&quot; (BTS, TWICE, EXO, ZICO,RED VELVET, SUPER JUNIOR, IZ*ONE)
7 - Nico Nico Nii in 10+ Different Languages/Dub
8 - Google Translate Says &#39;Nico Nico Nii&#39; In 50 Languages
9 - Yazawa Nico Waifu | Nico Nico Nii Compilation
10 - Nico Nico Nii! vs PIKA PIKA CHU!
Please provide a value to select one of the search results ranging from 1-10.
Hedima 21:13-kor
2

Ota-chan-DEVELOPINGBOTma 21:13-kor
No or invalid value entered, cancelling video selection.```
pale vessel
#

nor that

#

it may or may have something to do with that last paragraph

#

you're not telling us what's wrong

earnest phoenix
#

so much is returned by the console

pale vessel
#

so we can't help

earnest phoenix
#

problem not playing song

#

not console error

#

error message js return msg.channel.send('No or invalid value entered, cancelling video selection.');

spare goblet
#

@earnest phoenix the message you await is a string

#

You need to parse it into an integere

cinder patio
#

I don't think maxMatches is a thing, try just max

spare goblet
#

message.content is defined as "2" in that case

cinder patio
#

It probably times out

spare goblet
#

You must parse it such as using parseInt(message.content)

earnest phoenix
#

yes await

spare goblet
#

@earnest phoenix no random emojis in development

earnest phoenix
#

K

finite bough
#

any modules to turn text into hastbin

#

hastebin

spare goblet
#

there's probably a hastebin wrapper you can find

finite bough
#

tru

earnest phoenix
spare goblet
#

@earnest phoenix I already responded to you, check above. :) and please do not ping me when I'm already in the channel.

earnest phoenix
#

sorry

pale vessel
#

or instead of wasting space on a module, do a post request

earnest phoenix
#

That if your using nodejs

spare goblet
#

A post request isn't hard to do so might be easier that way

pale vessel
earnest phoenix
#

A question, lets say i buy DigitalOcean vps, will i be able to move my code from glitch to it without errors?

spare goblet
#

Uh

#

No

pale vessel
#

no need for a module

earnest phoenix
#

Lol

spare goblet
#

Pretty sure glitch has some extra crap you can remove

earnest phoenix
#

mm

spare goblet
#

And if you use .env you have to install dotenv

earnest phoenix
#

Yep Glitch bad

finite bough
#

if a message if 2000+ any idea how to send it?

earnest phoenix
#

lmao

spare goblet
#

And add dotenv.config() in index.js

earnest phoenix
#

in a hastebin ?

spare goblet
#

@finite bough embed

pale vessel
#

you can use split option

cinder patio
#

Split it into multiple parts and send multiple messages

pale vessel
#

it sends another message

finite bough
#

wait embeds can go 2000+?

earnest phoenix
#

@finite bough why is it so big though

spare goblet
#

Ye

#

Embeds up to 6k

finite bough
#

OwO

spare goblet
#

In total

#

Description is 2046 (?) or something check docs

pale vessel
#

embed could go up to 2048 on the description and 1024 on fields

spare goblet
#

O

pale vessel
#

correct me if I'm wrong

earnest phoenix
#

I don't think so

pale vessel
#

no?

earnest phoenix
#

Or even I am wrong PepeExplosion

pale vessel
#

I could've sworn I remembered correctly

earnest phoenix
#

Yah bc I don't remember embed support up to 6k

spare goblet
#

It does, in total.

pale vessel
#

because you can have up to n fields

#

n = forgot

finite bough
earnest phoenix
#

thonkku interesting

pale vessel
#

like 15

#

idk

cinder patio
#
Embed titles are limited to 256 characters
Embed descriptions are limited to 2048 characters
There can be up to 25 fields
A field's name is limited to 256 characters and its value to 1024 characters
The footer text is limited to 2048 characters
The author name is limited to 256 characters
In addition, the sum of all characters in an embed structure must not exceed 6000 characters
A bot can have 1 embed per message
A webhook can have 10 embeds per message

Got that from the discord.js tutorial

earnest phoenix
#

Oof

pale vessel
#

ah nice

elder vine
#

You got too much text in your description. ICanseeYourPixels

earnest phoenix
#

So yeah it's 2048

pale vessel
#

i was right

finite bough
#

@elder vine i can see that

cinder patio
#

Both of you are right

earnest phoenix
#

@finite bough just split it then

pale vessel
#

25 fields tho

finite bough
#

iara said u can get upto 6k words in an embed

elder vine
#

You can (not in words)

pale vessel
#

characters

#

not words

earnest phoenix
#

Yah

#

Words oh lord that would cause major lag

spare goblet
#

Read last pata

#

Para

earnest phoenix
#

Lol

#

But I think thats totally all included author etc

finite bough
#

thats like all total

spare goblet
#

I did not say 6k words, I just said 6k (characters)

#

And yes it involves author

finite bough
#

well ok

pale vessel
#

it involves everything

finite bough
#

ima just split

pale vessel
#

yes

finite bough
#

coz hastebin gay

pale vessel
#

split: true

earnest phoenix
#

.addField('hastebin gay', true)

pale vessel
#

hastebin is good

finite bough
#

so like

pale vessel
#

split doesn't work on embed btw

finite bough
#

let embedtext1 = message.split(prefix.length, 2000).join
let embedtext2 = message.split(embedtext1 , 2000).join

pale vessel
#

no

#

that's not what I mean

#

channel.send(message, { split: true })

finite bough
#

hmm

pale vessel
#

i guess you use an embed

#

hmm

finite bough
#

yes

pale vessel
#

that's a pain

finite bough
#

ikr

pale vessel
#

what I do is make a regex expression that splits it every 2048 characters

finite bough
#

yea ik that

#

like

#

it doesnt work with embeds

pale vessel
#

it does?

#

loops exist

finite bough
#

actually

#

holdon

#

wait

#

why is it not working now

#

:/

pale vessel
#

well you're on your own

#

bye

finite bough
#

LOL

earnest phoenix
#

anyone ran into issues with having to shard, and using cache storage?

#

or have any ideas for being able to continue using cache storage with shards, versus having to switch everything do a database?

cinder patio
#

are you using discord.js? If so there are functions like broadcastEval which get stuff from all shards, though I've never had the chance to use it

earnest phoenix
#

yeah, we're on discord.js, I've got a dev working with me, I'll mention that too him. He's pretty sure we're going to have to re-work the entire storage structure, but that's going to be probably weeks of work I'd like to avoid

mossy vine
#

@earnest phoenix i made a global cache system with veza

earnest phoenix
#

ohh, nice, mind giving a short summary on how it works?

#

or have a link to veza @mossy vine

mossy vine
#

is it any good? no
does it work? yes

earnest phoenix
#

hah alrighty, thank you for the info!

#

I will look into it

mossy vine
#

fyi docs are kinda garbage

#

but the examples are good tho

cinder patio
#

Not sure if that's better than broadcasteval but it's an option

mossy vine
#

depends on your use case

#

if you want a global cache its better

#

in fact, how would you create a global cache with broadcastEval

cinder patio
#

I'm not sure why you'd want that, to my understanding broadcastEval is just a fuction which evals a bunch of code in every process and returns everything in an array

#

so you can get whatever you need

mossy vine
#

yes

#

and that is not a global cache

cinder patio
#

But then aren't you just wasting memory cause then objects will be cached twice?

mossy vine
#

say in my use case you want to keep a list of all the current users of your bot
how do you do that with broadcastEval?
you send the data to the global cache nd fetch it there

#

how am i caching twice

#

caching it in the global cache in the same place where my shardingmanager is and request data from there when i need it

quartz kindle
#

could also use something like Redis

mossy vine
#

fair point, would probably be more efficient

#

but does it feel good wasting hours on a barely working cache system that you wrote all by yourself?

#

yes

earnest phoenix
#

lol

#

I'll look into Redis as well

#

we're basically at a standstill at the moment

mossy vine
#

what are you hosting your bot on

earnest phoenix
#

didn't know about having to shard, until we hit 2500 guilds lol

quartz kindle
#

rip

mossy vine
#

yikes

#

feelsbadman

quartz kindle
#

what kind of data are you caching?

earnest phoenix
#

it's on a DigitalOcean VPS

mossy vine
#

linux right?

quartz kindle
#

also, are you on djs? v11 or v12?

earnest phoenix
#

yeah, Ubuntu

mossy vine
#

then you can just install redis and set it up with systemctl or something

earnest phoenix
#

on djs v11.5 at the moment

quartz kindle
#

ah

#

if you were on v12 you could use internal sharding

#

which would let you keep using your existing caching

earnest phoenix
#

hmmmmmmmmm console log ```js
I could not join the voice channel: TypeError: serverQueue.connection.playStream is not a function
events.js:288
throw er; // Unhandled 'error' event
^

Error: Error parsing config: Unexpected token ; in JSON at position 58858
at gotConfig (/home/dc/chino-chan/node_modules/ytdl-core/lib/info.js:123:21)
at /home/dc/chino-chan/node_modules/ytdl-core/lib/info.js:74:7
at PassThrough.<anonymous> (/home/dc/chino-chan/node_modules/miniget/dist/index.js:196:32)
at PassThrough.emit (events.js:311:20)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on PassThrough instance at:
at /home/dc/chino-chan/node_modules/ytdl-core/lib/index.js:19:14
at /home/dc/chino-chan/node_modules/ytdl-core/lib/info.js:335:25
at /home/dc/chino-chan/node_modules/ytdl-core/lib/info.js:190:21
at /home/dc/chino-chan/node_modules/ytdl-core/lib/info.js:335:25
at gotConfig (/home/dc/chino-chan/node_modules/ytdl-core/lib/info.js:123:12)
at /home/dc/chino-chan/node_modules/ytdl-core/lib/info.js:74:7
[... lines matching original stack trace ...]
at processTicksAndRejections (internal/process/task_queues.js:84:21)

mossy vine
#

wait what

#

internal caching lets you do that?

quartz kindle
#

yeah?

#

its a single process

mossy vine
#

damn i didnt know that

#

oh

earnest phoenix
#

oo hi @quartz kindle

mossy vine
#

that makes sense

earnest phoenix
#

ohh, so it sounds like if we could move to v12 that'd maybe solve a lot

quartz kindle
#

you'll have to see what will be more painful for you

#

moving to v12 or to a caching db

#

lmao

earnest phoenix
#

oof lol

#

@quartz kindle once he helped me do my musicbot, wouldn't he have done it now?

quartz kindle
#

@earnest phoenix connection.playStream is not a function

earnest phoenix
#

there are other problems

quartz kindle
#

if you're using discord.js v12, then use connection.play

earnest phoenix
#

yes discord.jsv12

cinder patio
#

Cyber, can you please elaborate? Wouldn't the separate processes cache the guilds/users/everything else their shards "handle"? I have no experience with sharding, I am not quite sure how things work

mossy vine
#

elaborate on what

cinder patio
#

how am i caching twice
caching it in the global cache in the same place where my shardingmanager is and request data from there when i need it

earnest phoenix
#

@quartz kindle okay the link music works but the other commands are not good and the music selection interface is not good either

mossy vine
#

i thought you were talking about my global caching solution

earnest phoenix
#
No or invalid value entered, cancelling video selection.```
quartz kindle
#

yes you are offloading data to a separate process, but you dont necessarily need to cache entire guild/user objects

mossy vine
#

^

quartz kindle
#

ie you can have a full copy of a user object in a shard, and only the user id and username in the cache process

#

@earnest phoenix invalid value entered. make sure you're using your libraries correctly

#

check the documentation on their npm pages

finite bough
#

tim

cinder patio
#

aha yes that makes sense, thanks

finite bough
#

is there an easy way to buffer a stream?

cinder patio
#

and then you can fetch the object with the id, that clears things up

finite bough
#

in the bot's cache/memory

quartz kindle
#

you can convert a stream into a buffer, which will contain the entire stream

#

not sure about buffering a part of the stream tho

earnest phoenix
finite bough
#

the the whole stream

#

i want to buffer the whole stream in the memory so the stream does not lagg

quartz kindle
#

you should be able to do something like js let array = [] stream.on("data", d => { array.push(d); }); stream.on("end", () => { let buffer = Buffer.concat(array); })

#

i havent tested it tho

earnest phoenix
#

@quartz kindle ??

quartz kindle
#

not enough information for me to help you

earnest phoenix
#

@quartz kindle what to give?

regal saddle
#

That ping wont work.

#

You need to give tim informations about your Bot

#

Command / Code

quartz kindle
#

"No or invalid value entered, cancelling video selection."

#

where does this come from?

#

show full error

regal saddle
#

Tim, how you doing btw?

quartz kindle
#

doing good lul

regal saddle
#

Sounds nice

#

anyway, have fun with Hedi. I hope you can help him/her aPES_HappyBlanket

quartz kindle
#

"fun" >.>

earnest phoenix
spice pier
#

Is that @surreal cedar's profile pic smh

regal saddle
#

@earnest phoenix why dont you just Copy + Paste your Error?

#

Its a bit easier for Tim then aPES_HappyBlanket

earnest phoenix
#

stop adn skip command error console

#
(node:23251) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null
    at Query.<anonymous> (/home/dc/chino-chan/muscibot.js:113:43)
    at Query.<anonymous> (/home/dc/chino-chan/node_modules/mysql/lib/Connection.js:526:10)
    at Query._callback (/home/dc/chino-chan/node_modules/mysql/lib/Connection.js:488:16)
    at Query.Sequence.end (/home/dc/chino-chan/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
    at Query._handleFinalResultPacket (/home/dc/chino-chan/node_modules/mysql/lib/protocol/sequences/Query.js:149:8)
    at Query.EofPacket (/home/dc/chino-chan/node_modules/mysql/lib/protocol/sequences/Query.js:133:8)
    at Protocol._parsePacket (/home/dc/chino-chan/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/home/dc/chino-chan/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/home/dc/chino-chan/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/home/dc/chino-chan/node_modules/mysql/lib/protocol/Protocol.js:38:16)
(node:23251) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:23251) [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.
regal saddle
#

Thank you aPES_LovePat

earnest phoenix
#

and play shearc error code nothing

regal saddle
#
  1. cannot read โ€žendโ€œ of undefined.
#

113:43

earnest phoenix
#
serverQueue.connection.dispatcher.end('Stop command has been used!');```
regal saddle
#

Js right?

earnest phoenix
#

yes

#

Library
discord.js
Version
v12.16.1

regal saddle
#

Never used Music commands...cant help you there.

#

Maybe Tim or other people will help you out sad

earnest phoenix
#

๐Ÿ˜ข

#

well then there is nothing to do just wait so good to come in this v12 v11 in it works perfectly all

regal saddle
#

Maybe its because it got changed?

quartz kindle
#

v12 is different from v11

earnest phoenix
#

i know very well that it changed just i can't find a solution to it

regal saddle
earnest phoenix
regal saddle
#

Did you already tryed to search for the error in web?

earnest phoenix
#

yes but everyone is looking for the FFMPEG error

quartz kindle
#

if you checked the documentation for v12 and list of changes, you would see that there is no dispatcher.end()

#

there is dispatcher.pause() or connection.disconnect()

earnest phoenix
#

okey and play shearc??

regal saddle
#

Bro

#

Read the Docs at first.

quartz kindle
earnest phoenix
#

Tim thank shearch working and

(node:24368) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'destroy' of null
at Query.<anonymous> (/home/dc/chino-chan/muscibot.js:107:43)

#
serverQueue.connection.dispatcher.destroy('Skip command has been used!');```
amber fractal
#

dispatcher is null

#

You should always check if it is existent or not

quartz kindle
#

there is no dispatcher.destroy()

#

read the docs

amber fractal
#

that too mmLol

earnest phoenix
#

skiped song and stopid ?

regal saddle
earnest phoenix
#

well i don't understand this alone the skip set stop command is not good

#

whatever i do

#

yeah if i put more music i don't go to the next one and it says i put it on the playlist

#

these 3 things are not good the rest are perfect

split hazel
#

My shards constantly reconnect, every once a while, a shard reconnects (about every 30 mins to an hour) should I be worried? Or is this normal

#

Running on around 15 shards

quartz kindle
#

its normal as long as its not a predictable pattern

earnest phoenix
#

please help to stop and skip the command and the playlist system is not good

#

it's just a 3 piece error

#

skip and stop command js } else if (command === 'skip') { if (!msg.member.voice.channel) return msg.channel.send('You are not in a voice channel!'); if (!serverQueue) return msg.channel.send('There is nothing playing that I could skip for you.'); serverQueue.connection.dispatcher.destroy('Skip command has been used!'); return undefined; } else if (command === 'stop') { if (!msg.member.voice.channel) return msg.channel.send('You are not in a voice channel!'); if (!serverQueue) return msg.channel.send('There is nothing playing that I could stop for you.'); serverQueue.songs = []; serverQueue.connection.dispatcher.destroy('Stop command has been used!'); return undefined;

#

handle video ```js
async function handleVideo(video, msg, voiceChannel, playlist = false) {
const serverQueue = queue.get(msg.guild.id);
console.log(video);
const song = {
id: video.id,
title: Util.escapeMarkdown(video.title),
url: https://www.youtube.com/watch?v=${video.id}
};
if (!serverQueue) {
const queueConstruct = {
textChannel: msg.channel,
voiceChannel: voiceChannel,
connection: null,
songs: [],
volume: 100,
playing: true
};
queue.set(msg.guild.id, queueConstruct);

    queueConstruct.songs.push(song);

    try {
        var connection = await voiceChannel.join();
        queueConstruct.connection = connection;
        play(msg.guild, queueConstruct.songs[0]);
    } catch (error) {
        console.error(`I could not join the voice channel: ${error}`);
        queue.delete(msg.guild.id);
        return msg.channel.send(`I could not join the voice channel: ${error}`);
    }
} else {
    serverQueue.songs.push(song);
    console.log(serverQueue.songs);
    if (playlist) return undefined;
    else return msg.channel.send(`โœ… **${song.title}** has been added to the queue!`);
}
return undefined;

}```

#
function play(guild, song) {
    const serverQueue = queue.get(guild.id);
 
    if (!song) {
        serverQueue.voiceChannel.leave();
        queue.delete(guild.id);
        return;
    }
    console.log(serverQueue.songs);
 
    const dispatcher = serverQueue.connection.play(ytdl(song.url))
        .on('end', reason => {
            if (reason === 'Stream is not generating quickly enough.') console.log('Song ended.');
            else console.log(reason);
            serverQueue.songs.shift();
            play(guild, serverQueue.songs[0]);
        })
        .on('error', error => console.error(error));
    dispatcher.setVolumeLogarithmic(serverQueue.volume / 100);
 
    serverQueue.textChannel.send(`๐ŸŽถ Start playing: **${song.title}**`);
}```
#

please

elder vine
#

What is the error?

earnest phoenix
#

stop command and skip command console erro```js
(node:25032) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'destroy' of undefined
at Query.<anonymous> (/home/dc/chino-chan/muscibot.js:113:49)
at Query.<anonymous> (/home/dc/chino-chan/node_modules/mysql/lib/Connection.js:526:10)
at Query._callback (/home/dc/chino-chan/node_modules/mysql/lib/Connection.js:488:16)
at Query.Sequence.end (/home/dc/chino-chan/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
at Query._handleFinalResultPacket (/home/dc/chino-chan/node_modules/mysql/lib/protocol/sequences/Query.js:149:8)
at Query.EofPacket (/home/dc/chino-chan/node_modules/mysql/lib/protocol/sequences/Query.js:133:8)
at Protocol._parsePacket (/home/dc/chino-chan/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/home/dc/chino-chan/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/home/dc/chino-chan/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/home/dc/chino-chan/node_modules/mysql/lib/protocol/Protocol.js:38:16)
(node:25032) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:25032) [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.

regal saddle
#

its still destroy

earnest phoenix
#

pause not working

regal saddle
#

Hedi

#

Follow my Stebs

earnest phoenix
#
  • dispatcher.end()
  • dispatcher.destroy()
#

not working

regal saddle
#

u r using v12?

earnest phoenix
#

yes

earnest phoenix
#

already sorry but from there how to get the stop and skip command

regal saddle
earnest phoenix
regal saddle
#

try pause maybe

#

i dont know what you wanna do

earnest phoenix
#

I've tried

#

Hmm

#

dispatcher.pause

#

hmm?

regal saddle
#

I dont get it at all.
Where did you get the Information from to put destroy instead of end?

earnest phoenix
regal saddle
#

stupid question, but do you import Discord.js?

earnest phoenix
crimson vapor
#

There are no stupid questions

earnest phoenix
#

i have the latest version discord.js node.js

regal saddle
#

But do you import it into your Command?

earnest phoenix
#

My code doesn't work :

const DBL = require('dblapi.js');
const = new dbl(nnkkkkc, { webhookPort: 5000, webhookAuth: 'myPassword'});


dbl.webhook.on('vote', vote => {
  message.channel.send(`${vote.user} a votรฉ pour BryXou | +1`);
});```
#

Why

#

yes

regal saddle
earnest phoenix
#

The webhook don't send message

#

Why ? Plz

regal saddle
earnest phoenix
#

But do you import it into your Command?
@regal saddle yes

regal saddle
#

How do you import it?

earnest phoenix
#

CTRL+C CTRL+V ๐Ÿ˜›

regal saddle
crimson vapor
#

im confused

earnest phoenix
#

Me ?

regal saddle
#

@earnest phoenix please go to #topgg-api and ask your question again ๐Ÿ™‚

earnest phoenix
#

Ok

#

so

regal saddle
#

Hedi, 2 Questions.

  1. Did you own that Code, like did you wrote it? Or is it just Copy Paste?
  2. You are trolling.
earnest phoenix
#
  1. I wrote in V11
    2 i am not trol
slim heart
#

how can i make jsdoc global objects to their mdn link?

earnest phoenix
#

i want the problem solved

regal saddle
#

Why are you trying to use a v11 written code in v12?

earnest phoenix
#

i say i wrote at v11 and i want to rewrite it to v12 because i don't want to rewrite it from scratch

#

i am only stuck in this part and i don't know how to solve it so please ask for help

copper cradle
#

@earnest phoenix are you blind?

#

go and learn the basics of any language and then make a bot

#

message isn't defined in that scope

#

this is the problem of copying code

quartz kindle
slim heart
#

is there a repo or something that i can copy and paste like all of them lol

earnest phoenix
stable nimbus
#

So I have the code ready for my bot to be having a rotating status, but it is erroring out under "Cannot access 'status' before initialization'. I am not sure why, could I get a little assistance?

sudden geyser
#

Can you show some code.

#

It means you tried using the variable before it was initialized.

stable nimbus
#

client.on('ready', () => {
console.log('Ready to RP!')

setInterval(function() {
    client.user.setActivity(status, {type: "WATCHING"})
        
 let status = [
 `${client.guilds.size} Servers!`,
 `RP Commands for realism!`,
 '/help',
 `Owned and Coded by Cody!`
    ]
}, 5000);

});

This is my code, but I am not using the variable before its ready however.

elder vine
#

Show error

sudden geyser
#

Interesting, can you go to the line where the error is occurring, as it doesn't seem that would be where it's happening.

slim heart
#

@earnest phoenix is that directed at me?

earnest phoenix
#

Well since you said "copy paste" pretty much yes, also directed to Twixty

stable nimbus
#

I think I see why, I have my console.log('ready') before that code.

#

Here is the error.

slim heart
#

if you read one message above it you'd see it's about jsdoc and it's really just because i've been documenting for the past 2 hours and dont want to do repeated mish mash if it's already out on the internet.
also posting "learn to code lmao" is literally the most useless thing especially if you don't even pay mind to the conversation and not know if they are or not, not to mention literally 50 minutes later for the other guy

#

all you're doing is taking mind from the help so how about you just don't

earnest phoenix
#

How about you stop wasting your time with that message and just ignore it if it doesnt suit you

slim heart
#

you were literally talking to me lmao, and again, you're just adding more space between someone looking for answers with useless links

earnest phoenix
#

"Useless"

literally links guides to code for people

regal saddle
#

chill out guys.

#

chill

slim heart
#

dms

regal saddle
#

vim

#

Stop

earnest phoenix
#

Bruh hes literally dming me over one goddamn message smh

regal saddle
#

why dont you both just stop?

#

Because you said 1 Thing and vim is tilted about that?

drowsy sentinel
#

Be civil guys, let's not get heated.

stable nimbus
#

My question has been resolved.

earnest phoenix
#
let web = message.channel.createWebhook(message.author.tag, "")
web.send("Test")

This isn't working. Can someone give me an idea why?

#

nvm lol

#

i just removed let and used .then

amber fractal
#

it returns a promise

#

you can await it if you want to use let

crimson vapor
#

you can either let web = await or do a .then

#

because it returns a promise you need to wait for it to return or once it returns you can execute code

amber fractal
#

you should know that await pauses execution of the next code, if there is any, but .then will run through it like normal going back to the function in the .then when the promise is resolved

earnest phoenix
#

it says RichEmbed is not a constructor? why?

amber fractal
#

RichEmbed was deprecated and removed in favor of MessageEmbed in v12

#

it's basically the same

astral yoke
#

I got the error that (node:15140) UnhandledPromiseRejectionWarning: TypeError: message.author.displayAvatarURL is not a function

#

What's the correct function for 11.6.1

amber fractal
#

it isn't a function in 11.6.1

#

it's a property I believe

astral yoke
#

What should I update it to?

amber fractal
#

1 sec

earnest phoenix
#

@amber fractal so does that mean all RichEmbeds should be switched to MessageEmbed?

amber fractal
#

Yes

#

@astral yoke instead of it being a function it's just a property, so .displayAvatarURL and not .displayAvatarURL(...)

astral yoke
#

I have:

#

message.author.displayAvatarURL(...)

#

And it says that ) is unexpected.

#

@amber fractal

summer torrent
#

remove (...)

quartz kindle
amber fractal
#

^

astral yoke
#

I got an error.

#

That's why I changed it.

amber fractal
#

You said you're on 11.6.1?

crimson vapor
#

do you have message.author.displayAvatarURL(...) or message.author.displayAvatarURL()

amber fractal
#

it should be neither on 11.6.1

astral yoke
#

11.6.1.

#

Indeed.

quartz kindle
#

again

amber fractal
#

Whoops

astral yoke
#

Thanks.

amber fractal
astral yoke
#

I get the same error.

amber fractal
#

share your code

#

or the part that errors

astral yoke
#
Unhandled rejection TypeError: message.author.displayAvatarURL is not a function```
#
          description:
            `You did not provide the \`username\` argument.\n` +
            `\n` +
            `Usage: ${client.config.prefix}getinfo <username>`,
          author: {
            name: message.author.tag,
            icon_url: message.author.displayAvatarURL
          },```
amber fractal
#

did you save

quartz kindle
#

either you didnt save the code

crimson vapor
#

is that the correct line?

quartz kindle
#

or the error is coming from somewhere else

astral yoke
#

I have autosave on.

amber fractal
#

Still need to restart the bot

astral yoke
#

at C:\Users\Cools\Downloads\qbot-master\commands\getinfo.js:31:44

summer torrent
#

show error stack

amber fractal
#

or reload the command

astral yoke
#

Coming from the command. @quartz kindle

#

Unhandled rejection TypeError: message.author.displayAvatarURL is not a function
at C:\Users\Cools\Downloads\qbot-master\commands\getinfo.js:31:44
at tryCatcher (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\promise.js:729:18)
at _drainQueueStep (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\Cools\Downloads\qbot-master\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (internal/timers.js:444:21)

quartz kindle
#

did you restart the bot?

astral yoke
#

Mhm.

crimson vapor
#

can you send more of the code, maybe 1-40 line

astral yoke
#

That's some of it.

copper cradle
#

learn the basics of programming scltxn

crimson vapor
#

^

#

arrogance is not going to get you anywhere

copper cradle
#

and then make a bot

earnest phoenix
#

A question Is there a way to make audio processing fats using the ytdl-core

astral yoke
#

I came here for help not to get told I need to do some type stuff, I'll worry about it on my own. Thanks.

quartz kindle
#

the error says that on line 31 of getinfo.js you have a displayAvatarURL() when you're not supposed to

#

errors dont lie, so either you didnt save the file, or the bot is still running on an older file

crimson vapor
#

What do you mean by "type stuff"?

copper cradle
#

you do you scltxn

astral yoke
#

I fixed it. Thanks.

summer torrent
quartz kindle
#

make a request to it and measure the time it takes i guess

summer torrent
#

hrtime(), yes?

quartz kindle
#

there are many ways to measure time

#

hrtime(), console.time(), performance.now(), Date.now()

summer torrent
#

ty

earnest phoenix
#
if(message.content.toLowerCase().includes(swear)){

Is there a method i can use instead of includes? I have a swear list, and when I say bypass it will delete the message for swears. Can I get a swear word alone or prevent this from happening all the time?

quartz kindle
#

to match only words, first split the message by spaces

#

then for each element, check if it exists in the swears array

summer torrent
#

^

still lily
#

how to make it so my ban command will only go through if they have permission kick members

summer torrent
#

which lib

still lily
#

java

#

in discord.js

summer torrent
#

this is javascript LUL

#

not java

still lily
#

ok

copper cradle
#

@still lily that's javascript not java

still lily
#

OK

copper cradle
#

learn the diff

summer torrent
still lily
#

@summer torrent but how do i check the permisions of who sent the message

summer torrent
still lily
#

thank

summer torrent
#

not message.author

grizzled raven
#

console.time()?

pastel gazelle
#

how might one get an update for their bot on the website

#

for changes have been made

crimson vapor
#

just edit the website

pastel gazelle
#

oh

#

i didnt uh

#

hold up

earnest phoenix
#
  kickUser(id) {
    return this.client.guilds.cache.get("538582970752172034").members.cache.get(id).kick();
  }``` error ```(node:711) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'kick' of undefined
#

Did I did something wrong

#

have you tried reading the error

#

nvm fixed it

kind yarrow
#

Hello.

earnest phoenix
#

Hello

kind yarrow
#

I have a problem with bloxlink.

earnest phoenix
#

Is it possible making a custom welcome message? Like a command where the people can customize the message etc etc

summer torrent
#

yes

earnest phoenix
#

hey anyone knows how to use async in this

#
module.exports = {
    name: 'ping',
    description: 'Ping!',
    execute (message, args) {
  const m = await reply("Pong!");
  m.edit(`*${m.createdTimestamp - message.createdTimestamp}ms*`);    
};```
#

I know it's a noob question

fleet chasm
#

ignore the supplier parts

earnest phoenix
#

@earnest phoenix if you want to make the execute property in the module a function, do:

execute: async function(message, args) {
// code
}
summer torrent
#

async execute

earnest phoenix
#

oh!

#

cause you're missing a curly bracket

#

}

fleet chasm
#

you also need a }, to handle the execute

earnest phoenix
#

oh

#

your function doesn't have a closing bracket

clear wraith
#

^

earnest phoenix
#

or you can do it separately

#
module.exports.execute = async function(message, args) {
// boring stuff
}
#

if you hate doing it in json format

copper cradle
#

เคฐเคœเคค เคฎเคฟเคถเฅเคฐเคพ#8573 learn the basics of oop

high bough
#

Can someone fetch the owner of this guild??
538361750651797504

amber fractal
#

why?

#

It's oliy

high bough
#

Rly?

#

Not this discord bot list one

#

But from this Id

#

538361750651797504

amber fractal
#

oh no, unless someone's bot is in there bots don't have access to all guilds

high bough
#

My bot is in

amber fractal
#

you can then

high bough
#

How?

amber fractal
#

well you'd have to tell us more info

#

your lib/lang

#

version

hollow granite
#
var guild = await client.guilds.cache.get("538361750651797504")
console.log(guild.owner.user.username)
high bough
#

Ah okay thanks

amber fractal
#

that doesnt fetch

#

but ok

high bough
#

well you'd have to tell us more info
@amber fractal
Discord.js@12.1.1
Node@13.x

amber fractal
#

guild.owner can return null btw

fleet chasm
#

check if guild is available

amber fractal
#

use the ownerID property, which will return the id of the owner regardless of cache https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=ownerID then fetch from that using <Guild>.members.fetch(theId) which will also, by default, cache it

#

I believe fetch internally looks through cache first

#

I'll have to look

#

so fetch will return cached result if possible but if not, fetches it from discord and then caches it (by default)

high bough
#

Okay, NVM, that would be breach of privacy

past trail
#

Well I am trying out MongoDB for Python and I've been reading docs on it and whatnot but I am getting the error pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused Is there a certain port that I have to connect to that is specific to my system or what am I doing wrong. The error is basically telling me that the connection times out and refuses to connect.

high bough
#

Guys, how do I call a file outside of a folder?

#

e.g.
My command is in app/cmd/*.js
and I want to call app/db.json

fleet chasm
#

.. folder

earnest phoenix
#

ie ../../db.json should work

dark thorn
#

Guys, I am making a reaction ticket system w/ multiple departments but when I click on one option, the bot creates a lot of tickets

#

Ping me if you need more info. or have the solution

valid frigate
#

something is running recursively (in a loop)

#

i assume the channel names don't have suffixes so i'd say go back to your reaction code and check to make sure you aren't creating a channel more than once

zinc condor
#

ok so currently i have configurable prefixes for servers

#

when you send a message it checks to see if there is a value for a key of the guild ID exists in an object

#

if it doesnt it checks the database and if it finds it it adds it to the object and if it still doesnt exist it creates it from a template and then adds it to the object before running the message

#

is this efficient?

#

too many guilds will use up too much memory or am i just worrying myself here?

marble juniper
#

the way I do it is when a message gets sent I would check if the guild is in the database for custom prefixes if not it will use the bots default prefix
and then you just check the other stuff like
startswith prefix and so on
all the basic stuff

zinc condor
#

that queries the db for every message though

#

definitely inefficient

earnest phoenix
#

how do you guys approach coding commands with optional parameters? like prefix+command+(optional)

#

async def commandname(ctx, required, optional = None)

#

if you use the superior language

#

:p

cinder patio
#

That's possible in most languages tho. Zerp I'd check if the parameter exists and if it do something

mossy vine
#

superior language my ass

#

function commandname(required, optional = undefined)

cinder patio
#

undefined is the default value anyways /shrug

fleet chasm
#

notice: do shrug at the beginning of your message it appends it

earnest phoenix
#
client.on("voiceStateUpdate", async(oldState, newState) => {
    if(!oldState.channel || !newState.channel) {
      return;
    } 

    let Before = oldState.channel.members.filter(r => { return r.user !== client.user});
    let Now = newState.channel.members.filter(r => {return r.user !== client.user});
    

    if(newState.channel.members.has(client.user)) {
    setTimeout(async() => {
      if(Before.size <= Now.size) {
        console.log("hi")
        const player = await client.music.players.get(newState.guild.id);
        if(!player) return;
        player.textChannel.send(`The queue has been cleared and leaving channel due to no one listening.`);
        client.music.players.destroy(message.guild.id);
      }
    }, 1000);
    } 

  });

help idk why it isn't working OOF

fleet chasm
#

what is error i cant read

finite bough
#

@earnest phoenix errors pla

#

pls

marble juniper
#

just showing the code won't help

earnest phoenix
#

well no error it doesn't work

marble juniper
#

(most of the time)

earnest phoenix
#

idk why

#

i am dumb in usng voiceStateUpdate

finite bough
#

hmm

marble juniper
#

r u using v11 or v12 of discord.js

#

or what library are you even using

earnest phoenix
#

v12

#

v12 is op

charred cargo
#

anybody Know how to get 24/7 free hosting

earnest phoenix
#

excuse me

marble juniper
#

you can use glitch or heroku but its not recommended if you actually pay a few dollars a month for a vps you will notice the difference @charred cargo

earnest phoenix
#

there's botghost though

charred cargo
#

thank you

earnest phoenix
#

i don't use it but i've heard of it

marble juniper
#

botghost is a bot designer

earnest phoenix
#

i use bdfd

marble juniper
#

so it doesn't allow you to use code

#

and also watermarks

#

and other stuff

earnest phoenix
#

mhm

spare goblet
#

@woven sundial jeu[0].title

cinder patio
#

The object is inside an array

quartz kindle
#

gplay.search is a promise

spare goblet
#

uwot_confused you should be awaiting it

#

and dk why you using var

marble juniper
#

if you use async you can get the results in a variable

but in sync you can just do the function and then use then to get the value instead

#

my explenations are shit but I think you understand what I mean

fleet chasm
#

yes

spare goblet
#

wh

fleet chasm
#

this confuses me

spare goblet
#

why areyou trying to .then the promise when you're already in async

#

:')

#

what you did

  const jeu = await gplay.search({
    term: args,
    num: 1
  }).then(console.log, console.log);```

what you should do
```js
  const jeu = await gplay.search({
    term: args,
    num: 1
  })
  console.log(jeu[0].title)```
fleet chasm
#

oh and if you use .then ever again in another command just put one console.log please

cinder patio
#

Also

(async () => {
    
    try {
  
  const jeu = await gplay.search({
    term: args,
    num: 1
  })
    
    }catch (error) {
      return message.channel.send(":arminerror: ERREUR : Je n'ai pas trouvรฉ "+args+" sur le Play Store");    }
  })
``` Will never execute I think
#

Because you wrap the code inside a function which you never call

mossy vine
#

why the uncalled iife

cinder patio
#

It's unnecessary, but if you want to keep it put () at the end so you call it

spare goblet
#

At the end of the function ๐Ÿ™ƒ

#

idk why you're wrapping it in a separate function but yeh

modest maple
#

iara

#

when you're done here, couldnt by any chance help in #topgg-api i dont know enough js to help with the 400 error

mossy vine
#

how could i investigate why my bot goes down randomly every now and then

#

is d.js v11 the problem?

fleet chasm
#

how much is it going down

#

like frequency*

mossy vine
#

every few days

#

pm2 says its online and working fine

#

but it aint online

late hill
#

Make sure you listen for errors and disconnect events

mossy vine
#

fair

late hill
#

I mean

#

In Eris it'll put the error as null

#

Might be handled differently in discord.js

#

It broke my disconnect handler cuz I wasn't expecting it to be null

fleet chasm
#

ill probably just take it as maintenance as im updating constantly

#

hope it doesnt shut down during testing though

mossy vine
#

my bot is not sharded and the issue has been going on for far longer than that

fleet chasm
#

have you gotten any errors in that time

broken jay
#

Is secure to generate random password, add this to bot's and backend REST API .env and then in API check equality for authentication?

fleet chasm
#

error messages*

mossy vine
#

as i said no errors

#

it just

#

disconnecs?

fleet chasm
#

ill just check the docs to see if there's any way to catch ยฏ_(ใƒ„)_/ยฏ

#

you can probably get a code from it

mossy vine
#

no xd

#

i guess ill try updating to v12 and adding that

fleet chasm
#

make it right now!!!!

mossy vine
#

its down rn

#

doesnt matter

fleet chasm
#

btw you dont need to update to v12 for that, but you can if youd like

mossy vine
#

i know i dont

charred jetty
#

"Ratings":[{"Source":"Internet Movie Database","Value":"7.3/10"},{"Source":"Metacritic","Value":"71/100"}],
So Ratings[0].?

#

If i wanna get both

quartz kindle
#

[0] will get the first one

charred jetty
#

Ok

#

Ratings[0]
And Ratings[1]

quartz kindle
#

yes

pale vessel
paper cliff
quartz kindle
#

you dont lol, its a discord joke

tight plinth
#

^

earnest phoenix
#

it would be very concerning if you went to bed and a bot starts reading you a story

modest maple
#

Audible bot when

earnest phoenix
#

this message was sponsored by audible

modest maple
#

an amazon company

zenith terrace
#

Lol

idle cave
#

@paper cliff I never find how to do so bad

tight plinth
#

with or without async

mossy vine
#

show code in index.js

tight plinth
#

it works with others events

#

like message

mossy vine
#

wtf

tight plinth
#

(of course its a different file with message)

cinder patio
#

console.log what the require returns

tight plinth
#

putted vote.js code directly inside the event, works

#

wtf

mystic violet
#

@tight plinth u use quick.db

#

๐Ÿ˜‚

#

me too

tight plinth
#

yes

#

wel it works (for now)

austere sequoia
#

so i started my discord server after not using it for a couple months
it randomly wont connect to discord servers
Then I realised none of mine would start
I will post the code below of the most simple bot that wont connect
it gets past the two console.log at the beginning
it shows up on discord but thats it
nothing happens in client.on

tight plinth
#

discordjs version?

austere sequoia
#

discord.js 12.1.1
npm 6.14.4
nodejs 13.12.0

cinder patio
#

no errors or anything?

austere sequoia
#

no errors

#

just the two console.log at the beginning and the active bot on discord without the .setActivity

quartz kindle
#

your bot logs in but the ready event never fires?

#

how many guilds is your bot in?

austere sequoia
#

i know its in a few

quartz kindle
#

try this

#
client.on("raw", r => {
  if(r.t !== "PRESENCE_UPDATE") { console.log(r.t); }
})```
austere sequoia
#

it just randomly started working...

earnest phoenix
#

Can I change text colour in an embed?

crimson vapor
#

no

earnest phoenix
#

Damn

#

So the titles of fields are always dark grey unreadable?

crimson vapor
#

yeah ik its annoying

earnest phoenix
#

Rip

mossy vine
#

thank u discord for making TITLES UNREADABLE

crimson vapor
#

Thank you discord, very cool

earnest phoenix
#

Oh well hopefully they'll fix it

#

One day

crimson vapor
#

epic

mossy vine
#

just post your question

earnest phoenix
#

and he never posted it.

wintry wing
#

for some reason when I restart my bot or my bot crashes, it doesn't turn back on, and I would have to wait 5-10 minutes of it being off just to turn it back on, is there a way to fix this? (discord.js)

earnest phoenix
#

Well how about looking at any error logs?

#

Does it tell you any errors?

wintry wing
#

Well

#

after like, some minutes

#

it tells me "Something took too long to do"

#

I do catch the error though, so it doesn't just restart

#

check if the process id is valid?

#

or, try to get the exe and if it can't find it, there

#

I don't know a whole lot about C# even though I use that in Unity

mystic violet
#

is there any more efficient way of doing this?

#
    tmp = []
        message.channel.send("Finding Servers...").then(m => {
            message.client.guilds.cache.map(async (g) => {
                guildDB = await message.client.db.fetch(`guild-${g.id}`)
                if(!guildDB) guildDB = {"joinCount":0}
                if(guildDB.joinCount > 0) {
                    console.log("Server elligible")
                    if(!g.members.cache.has(message.author.id)) {
                    console.log("Not In Server")
                    
                    channel = getDefaultChannel(g)
                    channel.createInvite().then(invite => {
                        console.log("Creating an invite for " + g.name)
                        tmp.push({"invite":invite.url, "name":g.name})
                    })
                }
                }
            })

            setTimeout(() => {
                embed = new Discord.MessageEmbed()
                temp = tmp.length > 0 ? tmp : "You've Joined All The Servers On The List! Please Wait A Day For More Servers To Be Added!" 
                if(!Array.isArray(temp)) return message.channel.send(temp)
                console.log(temp)
                temp.map(invite => {
                    embed.addField(`${invite.name}`, `${invite.invite}`)
                })
                message.channel.send({embed})
            }, 1000)

        })

    }```
#

basically any guild with a database joinCount of over 1

#

will get in the list of invites

grizzled raven
#

does djsv11 have raw events too?

knotty steeple
#

oNly oNE waY To FInd OuT

pale vessel
#

docs smh

quartz kindle
#

@mystic violet yes, for starters dont use .map, thats not what its designed to do, also dont declare tmp outside if you're only using it inside the block

slender thistle
#

I don't think you can do anything before a file is opened

quartz kindle
#

@grizzled raven yes it does

grizzled raven
#

oh ok

mystic violet
#

okay Tim thank you

quartz kindle
#

also dont use timeouts

#

especially not for waiting for db calls

slender thistle
#

Because an antivirus is running in a background

#

you would need another program running in the background to check the files you open

mental prairie
prime cliff
#

@mental prairie try with the url part too

mental prairie
#

Yes i tried that too no success @prime cliff

#

its in the screenshot my last try

prime cliff
#

You should visit the Live Bot support server then

quartz kindle
#

show code?

#

or is that bot not yours?

mental prairie
#

That's not my bot I'm not a coder just try to plug and play it

quartz kindle
#

then you're in the wrong server

prime cliff
#

-botinfo @high forge

gilded plankBOT
#
Bot info
ID

334870738257444865

Username

Live Bot

Discriminator

5263

Short Description

Notify your Discord when a Streamer goes live

Library
Prefix

@Live Bot

Total Upvotes

54

Monthly Upvotes

2

Server Count

3279 Servers

Owner(s)

@cinder vigil

prime cliff
#

Click support server ^

mental prairie
#

Ok thx

gilded plankBOT
#
Bot info
ID

264811613708746752

Username

Luca

Discriminator

1375

Short Description

Luca is a bot for managing and informing members of the server

Library

discord.js

Prefix
  • or @Luca#1375
Total Upvotes

262

Monthly Upvotes

1

Server Count

2 Servers

Owner(s)

@fossil oxide dblAdmin dblMod
@languid dragon dblCertified
@bitter sundial dblAdmin

slender thistle
fleet chasm
#

oh wait

#

oh god

#

that was a bad mistake

#

ssh its gone now

drowsy sentinel
#

yep, we want people to use it.

pale vessel
#

wrong channel sorry

sullen patrol
#

I get discord.richembed is not a constructor. Pls help

pale vessel
#

what version of discord.js are you
using?

sullen patrol
#

12.1.1

pale vessel
#

you can use Discord.MessageEmbed

sullen patrol
#

Ok

earnest phoenix
#

I'm trying to add roles with member.edit(roles=rolesToAdd) with rolesToAdd an array of roles, but it says "DiscordAPIError: Invalid Form Body"

#

Anyone know what this means?

fleet chasm
#

you did something wrong with the embed

earnest phoenix
#

Huh, which embed?

fleet chasm
#

wait no

#

wrong thing

slender thistle
#

Are you sure that's where the error is coming from

fleet chasm
#

uhh pretty sure its cause member.edit is like member.edit({ roles: something })

earnest phoenix
#

I'm pretty sure

#

But I just thought of using member.roles.add instead

#

And that seems to work fine

finite bough
#

yea do that

earnest phoenix
#

Email Logo:

              <svg width="24" height="18" viewBox="0 0 100 75">
                <path d="M100 62.5c0 2.2-.6 4.2-1.6 6L66.8 33.2 98.1 5.9c1.2 1.9 1.9 4.2 1.9 6.6v50zM50 39.6l43.5-38c-1.8-1-3.8-1.6-6-1.6h-75c-2.2 0-4.2.6-6 1.6l43.5 38zm12.1-2.3L52 46.1c-.6.5-1.3.8-2.1.8-.7 0-1.5-.3-2.1-.8l-10.1-8.8-32 35.8c1.9 1.2 4.2 1.9 6.6 1.9h75c2.4 0 4.7-.7 6.6-1.9L62.1 37.3zM1.9 5.9C.7 7.8 0 10.1 0 12.5v50c0 2.2.6 4.2 1.6 6l31.6-35.3L1.9 5.9z"></path></svg>

Twitter Logo:

              <svg width="24" height="19.4976" viewBox="0 0 250 203.1">
                <path d="M78.6 203.1c94.3 0 145.9-78.2 145.9-145.9 0-2.2 0-4.4-.1-6.6 10-7.3 18.7-16.3 25.6-26.5-9.4 4.1-19.3 6.9-29.5 8.1 10.7-6.4 18.7-16.5 22.5-28.4-10.1 6-21.1 10.2-32.6 12.4C191-4.5 158.5-5.5 137.8 14c-13.3 12.5-19 31.2-14.8 49C81.9 60.9 43.4 41.4 17.4 9.4 3.8 32.8 10.7 62.8 33.3 77.8c-8.2-.2-16.1-2.4-23.3-6.4v.6c0 24.4 17.2 45.4 41.2 50.3-7.6 2.1-15.5 2.4-23.2.9 6.7 20.9 26 35.2 47.9 35.6-18.2 14.3-40.6 22-63.7 22-4.1 0-8.2-.3-12.2-.7 23.5 15.1 50.7 23 78.6 23"></path>
              </svg>
amber fractal
#

ok?

prime cliff
#

Bruh why post the svg when you could have just posted the image

quartz kindle
#

oddly specific size

#

height 19.4976 lul

earnest phoenix
#

@prime cliff Twitter is the Normal twitter logo from twitter xD

pale vessel
#

but wai

earnest phoenix
#

In Discord bot list long description, how do you do a newline? Everything is on 1 line for me

twin iron
#

-bots

gilded plankBOT
quartz kindle
#

@earnest phoenix if you're using MD, do a double new line

#

if you're using HTML, then do <br>

earnest phoenix
#

Ok thx

rustic veldt
#

-bot info @gilded plank

summer torrent
charred jetty
#

Can i set bot Avatar per guild?

summer torrent
#

no

charred jetty
#

I saw a bot like this

true ravine
#

Bots are users and users can only have one avatar

earnest phoenix
#

?membercount

#

!membercount

#

.membercount

#

.serverinfo

#

No testing here @earnest phoenix

#

It probably used a webhook @charred jetty

finite bough
#

@charred jetty they are probably different bots with same name

cinder patio
#

Most likely a webhook

charred jetty
#

@finite bough it can be possible?

finite bough
#

why not

#

there are like 50 bots named dyno

charred jetty
#

But the description was saying that it is the only bot which can set Avatars and names per guild

earnest phoenix
#

Then it's lying

finite bough
#

can u tell me the bot name

earnest phoenix
#

It can either be done by all bots or by none

#

And it's probably just using a webhook to make it seem like it's changing pfp and name

cobalt scarab
#

anyone have a good bot creation youtube video i can watch :)
Im trying to create a auction bot on my server

true ravine
#

Threebow does good ones

cobalt scarab
#

๐Ÿ˜„ thanks!

drowsy sentinel
#

I'm going to be honest with you, any discord.js on yt is outdated or has bad practices.

earnest phoenix
#

@drowsy sentinel that's true...
If you go on yt on search for a good discord.js tutorial... All of them are outdated...

true ravine
#

Threebow has good examples though, they helped me learn the basics before I went off on my own

prime cliff
#

Ofc they would be outdated if a big version release such as v12 comes out

drowsy sentinel
#

I disagree, I have seen Threebow and there are quite a few poor choices.

#

Discord.js has also been updated so his videos are marked OUTDATED.

true ravine
#

Oh yeah I'm not saying the code is good, I've changed up most of the code I came up with from his videos

#

They were helpful in their own way tho lol

drowsy sentinel
#

The guide is more helpful, tbh.

true ravine
#

Yeah I agree

drowsy sentinel
#

It shows you how to setup an effective bot with room for growth.

cobalt scarab
#

hmmm true i just need to learn the basics and go from there, like all i need to do is make a bot that can set auctions on my server. somehow posts an item for auction for like 24hr timer, and people can bid on it etc

#

im hoping its not terribly hard to do hahah

drowsy sentinel
#

Codecademy has a great JavaScript course for free.

#

I have sent a lot of new people there and they come back with positive feedback.

true ravine
#

Yeah I did that

#

Quite a few years back but it was good

#

I already had programming knowledge before I came to bot making in other languages so that helped