#development

1 messages · Page 1203 of 1

stark terrace
#

correct

quartz kindle
#

try running it in worker mode

#

because in process mode you're wasting a ton of resources

#

18 processes for 17k guilds is way too much

misty sigil
#

aye, especially if you've only got 1 cpu

faint prism
#

@faint prism but then I can just do normal methods on it like it existed and mongodb will create the collection anyways
@earnest phoenix Try to get the value for a collection, if it returns null it doesn't exist. Unless you are telling it to insert/upsert, then it won't create the collection?

quartz kindle
#

hes got 8 threads

#

but still

misty sigil
#

aye still

quartz kindle
#

the optimal setup in this situation would be 7-8 processes with 2-3 shards each

tired gate
#

im getting an UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot execute action on a DM channel

#

what does that mean

#

in my console btw

stark terrace
#

i see, i shall give that a shot Tim

earnest phoenix
#

so if i do:

client.db("userData").collection(userID /*/ no need to worry userID is defined /*/).insertOne(userData,(err,result) => {
  if (err) throw err;
});

Will it throw an error if the collection doesn't exist since you can't run functions on null

#

yes ik i have the worst way of storing user data cuz YEEEEEEES

quartz kindle
#

im pretty sure mongodb creates it if it doesnt exist

misty sigil
#

what

#

why do you have a seperate collection for each userID

quartz kindle
#

^

tight plinth
misty sigil
#

that'll take up shit tonne of index space from what i recall

#

just use one collection and make a new doc

earnest phoenix
#

what the hell is Shoukaku

quartz kindle
#

db should be per process, for example .db(bot name)

#

then collection should be a section of your bot, for example .db(bot name).collection(users)

faint prism
#

@earnest phoenix client.db("userData").collection(userID) wouldn't this return null if it's empty?
So can't you check it like this?

let collectionData = client.db("userData").collection(userID)
if (!collectionData) // is non-existant
misty sigil
#

my db does nothing but store my bot data

faint prism
#

idk if that'd work, but 🤷‍♂️

earnest phoenix
#

k

misty sigil
#

so its .db("data").collection("prefixes") etc etc

earnest phoenix
#

What happens if we delete our bot once after we get the Dev badge

#

imagine throwing the tryitandsee bomb on yourself that's suicide

#

What happens if we delete our bot once after we get the Dev badge
@earnest phoenix but WHY

misty sigil
#

@earnest phoenix ur badge gone

#

poof

earnest phoenix
#

Imagine

#

Oh

#

Bot gone

#

Badge gone

#

Oh

faint prism
#

oops, sorry mods pandasad

stark terrace
#

how do i handle shards with shoukaku? I just change this?
@tight plinth afaik, there's nothing documented on a shard manager in shoukaku

tight plinth
#

hm

stark terrace
#

same in the source

tight plinth
#

will ask in the support server of shoukaku ig

stark terrace
#

well it seems to me its on purpose they dont have one built in

#

you could use d.js shard manager or another one out there

tight plinth
#

hm

obtuse jolt
#

2.5GHz

#

Hmm

#

What’s the difference between 2.5GHz and 5GHz other than speed

faint prism
#

Uh

#

Well it's the clock speed

obtuse jolt
#

In WiFi

#

Jesus

faint prism
#

What the difference between 5 mph and 20 mph other than speed

#

Oh the hertz difference

#

That's the wave size iirc

#

So 2.4 has a longer range and less bandwidth than 5ghz

quartz kindle
#

higher frequency gives you higher speed limit in exchange for shorter signal distance

faint prism
#

^

quartz kindle
#

higher frequency also has stronger power, which makes it less susceptible to interference

obtuse jolt
#

Sweet

#

My router doesn’t have 5GHz

faint prism
#

rip

#

Modern routers have that, and are like ~$40

obtuse jolt
#

My router is modern

quartz kindle
#

there is no difference unless your actual internet speed is 100mb+

obtuse jolt
#

And it’s $60

#

It’s a 2020 model

quartz kindle
#

802.11n's theorical limit is 300mbps

obtuse jolt
#

My router has a 150 limit

#

But it’s not like a crap 150

#

It’s a good 150 it’s just my service provider

quartz kindle
obtuse jolt
#

lol

#

This is calling out all sellers

quartz kindle
#

well, theorical limits are from the technology itself, so the sellers arent really lying

#

but real world implementations never reach these because of interference, material quality, etc

#

also, the theorical speeds are likely for a single link, while real world uses multiple links, ie upload+download

#

then you also have to factor in how many devices are connected

misty sigil
#

whats the colour for rounded embeds again

slender thistle
obtuse jolt
#

Yeah I found out my router can reach about a quarter of a mile or half a mile I can’t tell very well

misty sigil
#

thanks shiv

floral creek
#

how can u make your bot respond when he is mentioned?

#

python

faint prism
#

oh

floral creek
#

u can do it in js maybe I could translate it

faint prism
#

well in js you could split by spaces, and check if the first string[0] contains the bot's ID

slender thistle
#

Depends on if you want bot mention to be a prefix or just literally check for mention

opal plank
#

startsWith()

floral creek
#

yea but in a on_message event no?

opal plank
#

and|| operator

faint prism
#

something like:
if theMsg.split(' ')[0].contains(botId)

floral creek
#

Depends on if you want bot mention to be a prefix or just literally check for mention
@slender thistle literally check for mention

slender thistle
#

So it's not a prefix?

faint prism
#

or that yeah, but have fun parsing it

floral creek
#

no

thin turret
#
[
  '���',
  MessageReaction {
    message: Message {
      channel: [TextChannel] ...
```  ```for (const value of collected) {
                    console.log(value)
                }``` I'm Having Trouble accessing values from a awaitReactions Colllection
floral creek
#

just the mention

thin turret
#

How can I access the object?

opal plank
#

if (message.content.startsWith(prefix) || message.content.startsWith(mention)) => execute code

#

or check regex

slender thistle
#

message.content.replace("<@!", "<@") == client.user.mention

opal plank
#

cuz ! might annoy a bit

floral creek
opal plank
#

/<@!?BOT_ID>/.test(message.content)

slender thistle
#

They asked py code tho

opal plank
#

you can do regex too so you dont have to do another check for nickname

faint prism
#

haha the !? is a great use for that optional pattern

slender thistle
#

eh regexes in Python are trickier than that

faint prism
#

mhmm

floral creek
#

like this?

faint prism
#

eh

slender thistle
#

I'd use ==

faint prism
#

That's not as robust

slender thistle
#

but yeah

faint prism
#

What if its <@!botId>?

floral creek
slender thistle
#

Also, consider checking for a mention that starts with <@! as well

#

yeah

faint prism
#

Gotta handle that

opal plank
#

@floral creek remember what i said? nickname

floral creek
#

and how do u send msg in on_message event?

opal plank
#

you COULD use mentions aswell

faint prism
#

as a parameter

opal plank
#

idk how py handles it, but message payload also comes with mentions in it

slender thistle
#

message.mentions

opal plank
#

^^

#

could probably use that aswell rather than matching content if regex isnt as easy as js

opal plank
#

is js you have a test() method

slender thistle
#

Honestly, though. That'll only check if a mention is included

faint prism
#

message.mentions
@slender thistle You'd have to parse something like this then, yeah?
something @bot command
@bot command
something @bot

opal plank
#

but you could use mentions aswell to snag the id

slender thistle
#

Parse?

#

message.mentions is a list of either Member or User objects

faint prism
#

from the msg content

#

since it'll include the @mention

floral creek
slender thistle
#

add message parameter to the function

opal plank
#

dont you need in?

slender thistle
#

Also, don't use str

floral creek
#

why?

slender thistle
#

I gave them that talk a few minutes ago and meh

#

because you'd be converting True to string

opal plank
#

i assume equal operator would be perfect match

slender thistle
#

and that will be a true value always

hasty grove
#

Py?

floral creek
#

K got it

slender thistle
#

since "True" is not an empty string

floral creek
#

I know

earnest phoenix
#

How i can cut lines ?

opal plank
#

py also has startswith() no?

floral creek
#

How i can cut lines ?
@earnest phoenix ??

slender thistle
#

Yeah it does, but they want to reply to just a mention

opal plank
#

oh i see

floral creek
#

I got it

#

K thanks guys

slender thistle
#

Use == for this

#

also

opal plank
#

isnt it the other way around?

#

something in target?

slender thistle
#

they want to reply to @bot

#

so they check basically if the message.content (mention) is in the string

opal plank
#

oh i see

sterile minnow
#

Hi i ave a little Problem with discord.js: I just fresh installed it but now i cant login into the user and it just gives this error:

_http_agent.js:444
      options = req[kRequestOptions];
                   ^

TypeError: Cannot read property 'Symbol(requestOptions)' of undefined
    at Agent.removeSocket (_http_agent.js:444:20)
    at Agent.<anonymous> (_http_agent.js:171:10)
    at Agent.emit (events.js:314:20)
    at TLSSocket.onFree (_http_agent.js:362:11)
    at TLSSocket.emit (events.js:314:20)
    at emitFreeNT (_http_client.js:725:16)
    at processTicksAndRejections (internal/process/task_queues.js:79:21)
floral creek
#

so they check basically if the message.content (mention) is in the string
@slender thistle string

slender thistle
#

use == please

#

and I meant literally add a second statement that starts with or

#

or maybe I didn't even send it

#

content == mention with <@! or content == mention with <@

still merlin
slender thistle
#

Use it in embed description or field value

#

those are the only fields that support custom emojis

still merlin
#

Ah, thanks

earnest phoenix
#

how i can check length of this eval(args.slice(0).join(" ")) and slice it to 2000 characters

#

: ))

still merlin
#

Slice '2000'?

earnest phoenix
#

yes

still merlin
#

eval(args.slice(2000).join(" "))

earnest phoenix
#

no

#

the output of the eval

sterile minnow
#

Hi i ave a little Problem with discord.js: I just fresh installed it but now i cant login into the user and it just gives this error:

_http_agent.js:444
      options = req[kRequestOptions];
                   ^

TypeError: Cannot read property 'Symbol(requestOptions)' of undefined
    at Agent.removeSocket (_http_agent.js:444:20)
    at Agent.<anonymous> (_http_agent.js:171:10)
    at Agent.emit (events.js:314:20)
    at TLSSocket.onFree (_http_agent.js:362:11)
    at TLSSocket.emit (events.js:314:20)
    at emitFreeNT (_http_client.js:725:16)
    at processTicksAndRejections (internal/process/task_queues.js:79:21)
cunning gorge
#

how do u turn a int into a string

sudden geyser
#

what language

cunning gorge
#

js

#

i tried .toString() didn't work

sudden geyser
cunning gorge
#

oki

misty sigil
#

nah?

earnest phoenix
#

a init to string

misty sigil
#

that makes a string into a number afaik

sudden geyser
#

oh

#

im dumb

earnest phoenix
#

not string to number

slender thistle
#

silly Lite :p

misty sigil
earnest phoenix
#

@misty sigil how do u slice ur eval output ?

cunning gorge
#

i feel like toString() should have worked 😔

misty sigil
#

I use a paginator

earnest phoenix
#

paginator ?

misty sigil
#

yes

earnest phoenix
#

oh

#

but how u slice the first page

#

like the output is 1000+ lines

#

and how u slice it ?

sudden geyser
#

@cunning gorge how did you use it, because it should work.

cunning gorge
#

actually I got it

#

had to use Number()

simple stump
#

i genuinely cannot see the music code
@misty sigil

if (message.content.startsWith(`${prefix}play`)) {

            function play(connection, message) {
                var server = servers[message.guild.id];

                server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: "audioonly"}));

                server.queue.shift();

                server.dispatcher.on("end", function() {
                    if (server.queue[0]) {
                        play(connection, message);
                    } else {
                        connection.disconnect();
                    }
                });

            }

            const args = message.content.slice(prefix.length).split(' ');
            const command = args.shift().toLowerCase();

            if (!args[0]) {
                message.channel.send("You need to provide a link!");
                return;
            }
            /* Old connection code
            const channel = message.member.voice.channel;
            if (!message.member.voice.channel || channel.join == null) {
                message.channel.send("You must be in a voice channel!");
                return;
            } else {
                channel.join().then(connection => console.log('Connected!')).catch(console.error);
            }
            */

            if (!servers[message.guild.id]) servers[message.guild.id] = {
                queue: []
            }

            var server = servers[message.guild.id];

            const channel = message.member.voice.channel;
            if (!message.member.voice.channel || channel.join == null) {
                channel.join().then(function(connection) {
                    play(connection, message);
                })
            }
        }

Regarding: https://discordapp.com/channels/264445053596991498/272764566411149314/749639149405077534

quartz kindle
#

this part doesnt make sense

#

!message.member.voice.channel || channel.join == null)

#

your bot only joins the voice channel if the channel doesnt exist

floral creek
quartz kindle
#

you need to use attach files

#

which library are you using?

floral creek
#

python

simple stump
#

Oh heck I'm dumb lol thx tim

#

meant to put an else

floral creek
#

File *file

simple stump
#

The role not existing is not related to the music, however the last error is.

#

(once again using OpusScript and FFMPEG to malke a music bot)_

quartz kindle
#

you check if args[0] exists

#

but then you push args[1] to the queue

stark terrace
#

hey @quartz kindle so i started messing around with worker mode in dev environment and i'm getting this error: TypeError: Cannot set property message of which has only a getter it seems to be happening when using broadcastEval? i've done some digging and really haven't seen anyone come across a solution

earnest phoenix
#
const evaluted = eval(args.slice(0).join(" "));
            let array = stringTools.toChunks(JSON.stringify(evaluted), 5);
            const narary = array.slice(0, Math.floor((1500 / 5))).join('');
            console.log(narary.length);
            let output = `\`\`\`json\n${beautify(narary, {
                format: "json",
            })} \n\`\`\``
            await message.channel.send(`Type of: ${typeof(evaluted)}`);
            message.channel.send(output);
length = 1500
(node:7280) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
content: Must be 2000 or fewer in length.

Best logic ever seen

quartz kindle
#

beautify(narary, {format: "json"}).length
beautify first, check length after

earnest phoenix
#

ok

#

2117

#

wtf

#

how

#

Don't use beautify

#

This is why it gets the string bigger

#

what should i use then?

quartz kindle
#

because beautify is adding tons of spaces for indentation

earnest phoenix
#

smh

#

my bot is done, so proud.

stark terrace
#

congrats

earnest phoenix
#

Pog?

quartz kindle
#

check if beautify has an option for using tabs instead of spaces

earnest phoenix
#

pog ?

#

nvm

#

i will try

simple stump
#

@quartz kindle yes, I have that already:

            if (!args[0]) {
                message.channel.send("You need to provide a link!");
                return;
            }
            /* Old connection code
            const channel = message.member.voice.channel;
            if (!message.member.voice.channel || channel.join == null) {
                message.channel.send("You must be in a voice channel!");
                return;
            } else {
                channel.join().then(connection => console.log('Connected!')).catch(console.error);
            }
            */

            if (!servers[message.guild.id]) servers[message.guild.id] = {
                queue: []
            }

            var server = servers[message.guild.id];

            server.queue.push(args[1]);
#
            if (!args[0]) {
                message.channel.send("You need to provide a link!");
                return;
            }

And:

server.queue.push(args[1]);
misty sigil
#

why push args[1] if you're checking for args[0]

earnest phoenix
#

some how my code can't read Map() :((

quartz kindle
#

@earnest phoenix just use util.inspect

#

its node's built in way of serializing js objects and data

earnest phoenix
#

so i just need to type util ?

quartz kindle
#

it also has built in beautification

earnest phoenix
#

like process ?

quartz kindle
#

you need to require it

#

require("util")

earnest phoenix
#

thx :))

ebon kelp
#

I have this weird bug with collections and mongodb

#

If I insertOne it gets updated in my collection, without a set in the collection

simple stump
#

Matthew wdym?

dire obsidian
ebon kelp
#

I never fetch the id from mongodb

earnest phoenix
#

but it is like default

#

of mongo

#

if u remove it from database maybe it will fives error

ebon kelp
#

I know mongo uses indexes

earnest phoenix
#

ok

ebon kelp
#

But I never fetch id from mongodb and update it in the collection

ebon kelp
#

I give up

sinful belfry
#

@ebon kelp the id is returned by default unless you specify for it not to

#

which can be done using projection

simple stump
#

Still trying to make a Music bot using OpusScript and FFMPEG. I have installed everything correctly to my knowledge, however when my bot joins the channel it doesn't play anything. I also get this error:

(node:89300) UnhandledPromiseRejectionWarning: TypeError: connection.playStream is not a function
    at play (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\index.js:770:36)
    at C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\index.js:814:6
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:89300) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:89300) [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.

index.js 770 is this line:

server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: "audioonly"}));

Code: https://hatebin.com/qisvsmkwsm

waxen adder
#

hi who know if dm all members in a server is breaking TOS

misty sigil
#

yes

waxen adder
#

i wanted to know

misty sigil
#

you are

waxen adder
#

but if there is cooldown?

slender thistle
#

still violates ToS

waxen adder
#

oh ok

misty sigil
#

still does violate tos

waxen adder
#

thx

outer moon
#

hey

#

may i have ask

#

i merged nsfw function into my bot. the function is fetch an image on booru sites.

#

the question i have
,which sites that break discord TOS except lolibooru?

tight plinth
#

@simple stump .playStream => .play

sinful belfry
misty sigil
#

yes it is

tight plinth
#

it is

ebon kelp
#

@ebon kelp the id is returned by default unless you specify for it not to
@sinful belfry Yeah but how is it updated in a collection?

sinful belfry
#

wdym

ebon kelp
#

Can I DM you?

#

Screenshare*

sinful belfry
#

can you not just give screenshots/explain here?

ebon kelp
#

Okay

#

So

#

When a guild is created it adds some variables in cache

#

Collection (Key = guildId, object with variables)

#

for example prefix, ignored channels etc

#

guildCache is the collection with variables

simple stump
#

@tight plinth I'm a bit confused. What do I change?

#

I got about this far:

            if (!message.member.voice.channel || channel.join == null) {
                message.channel.send("Channel doesn\'t exist or you're not in a voice channel!");
            } else {
                channel.join().then(function(connection) {
                    channel.play(connection, message);
                })
            }

EDIT: I'm not asking for a spoonfeed. Just confused as to what connection in the documentation is

ebon kelp
#

Then it also adds it in the database

#

dbHandler.create(guild.id, defaultGuild)

sinful belfry
#

yeah...

ebon kelp
tight plinth
#

channel.play(connection)

#

no message

#

dotpost smh

simple stump
#

Ah i see. Ty

ebon kelp
#

Connects to MongoDB and adds it in collection

simple stump
#

lol i accidnetally pressed enter

ebon kelp
#

When I console log all my guildCache it shows _id in the added guild

simple stump
#

TypeError: channel.play is not a function

misty sigil
#

_id is for indexing iirc

ebon kelp
#

I know

#

Boi

simple stump
#

Error:

(node:90872) UnhandledPromiseRejectionWarning: TypeError: channel.play is not a function
    at C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\index.js:814:14
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:90872) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:90872) [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.
            const channel = message.member.voice.channel;
            if (!message.member.voice.channel || channel.join == null) {
                message.channel.send("Channel doesn\'t exist or you're not in a voice channel!");
            } else {
                channel.join().then(function(connection) {
                    channel.play(connection);
                })
            }
ebon kelp
#

Right?

sinful belfry
#

yep

misty sigil
#

its created by mongodb automatically

ebon kelp
#

Matthew shut it

#

sorry

misty sigil
#

@simple stump connection.play

ebon kelp
#

Uhm

sinful belfry
#

be nice

simple stump
#

ah ok ill try that thx

sinful belfry
#

@simple stump lol why

ebon kelp
#

MongoDB creates the _id for indexing automatically ofc

simple stump
#

wdym 😉

ebon kelp
#

But I never add this in the guildCache

#

But when I console log guildCache it contains the _id

simple stump
#

owo another error

(node:63176) UnhandledPromiseRejectionWarning: Error [VOICE_PLAY_INTERFACE_BAD_TYPE]: Unknown stream type
    at VoiceConnection.play (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:84:11)
    at C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\index.js:814:17
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:63176) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:63176) [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.
            const channel = message.member.voice.channel;
            if (!message.member.voice.channel || channel.join == null) {
                message.channel.send("Channel doesn\'t exist or you're not in a voice channel!");
            } else {
                channel.join().then(function(connection) {
                    connection.play(connection);
                })
            }

Sorry. Now I feel bad for sending so many messages 0-0

earnest phoenix
#

omg

misty sigil
#

it needs to be a file

#

or a ytdl thing

ebon kelp
#

And it puts everything in a db so when I restart the bot, everything gets loaded into guildCache.

#

And I filter _id out of there

#

Which works

latent crater
#

Before I've even completely finished my bot, I already have an idea for a new one. I ALSO have the remains of an old bot I scrapped because I had an idea before finishing Nooko too. Anyone else get that problem?

#

Too many ideas ;;

ebon kelp
#

New guilds who didn't came out of the database have _id, without this key

simple stump
#

@misty sigil it is. YouTube link

#

I'm using ytdl

misty sigil
#

ytdl(link here)

#

iirc

simple stump
#

I installed OpusScript

#

hm

ebon kelp
#

It's confusing starman

sinful belfry
#

yeah i see

ebon kelp
#

It's easier by showing in screenshare

sinful belfry
#

i see what you're saying

ebon kelp
#

console.log(client.guildCache.get("ID"));
First object = before insertOne
Second object = after InsertOne

earnest phoenix
#

You cant do get

#

You do .find(s => s.id == ID)

#

@ebon kelp

tight plinth
#

console.log(client.guildCache.get("ID"));
First object = before insertOne
Second object = after InsertOne
@ebon kelp that's internal mongo id

ebon kelp
#

I know I know

earnest phoenix
#

If it was

ID: {
Data-here
}

You couldve used get

ebon kelp
#

It is

earnest phoenix
#

Ok if u know, whats the issue

simple stump
#

I'm very confused why I get the error "Unknown stream type" when I'm using ytdl.

(node:63176) UnhandledPromiseRejectionWarning: Error [VOICE_PLAY_INTERFACE_BAD_TYPE]: Unknown stream type
    at VoiceConnection.play (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:84:11)
    at C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\index.js:814:17
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:63176) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:63176) [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.

I have installed it correctly (I'm using localhost hosting and did npm install --save ytdl-core opusscript. Got no errors whatsoever) and have added const ytdl = require("ytdl-core"); at the top of my file, however I still get that error. Below is the relevant code (I'll include my full file as well). Note that in the full file I use connection.play(message) instead of .play(connection), but I tried both ways. No luck.

            const channel = message.member.voice.channel;
            if (!message.member.voice.channel || channel.join == null) {
                message.channel.send("Channel doesn\'t exist or you're not in a voice channel!");
            } else {
                channel.join().then(function(connection) {
                    connection.play(connection);
                })
            }

https://hatebin.com/msfbqkpnks

earnest phoenix
#

Jesus man

#

How are you playing the connection 😂

#

Connection isnt a file or a buffer

ebon kelp
#

What do you think? @sinful belfry

sudden geyser
#

You're trying to play the connection to the voice channel?

tight plinth
#

^

#

you're playing nothing

#

and you're doing wrong

sudden geyser
#

In your hatebin post, you try passing message which doesn't make sense either. There are some examples on how to properly use it in the documentation: https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=play

#

Also you defined channel as message.member.voice.channel, so there's no need to repeat it in your if statement.

sinful belfry
#

honestly, i have no clue why it is changing it after it has been cached lol

#

seems very weird to me, but ig there must be a reason somewhere

ebon kelp
#

Ikr

#

It doesn't cause a problem, but I have no idea where the cache has been updated with the _id attribute

sinful belfry
#

console.log(client.guildCache.get("ID"));
First object = before insertOne
Second object = after InsertOne
@ebon kelp and here, you're definitely fetching both from cache?

ebon kelp
#

yes

sinful belfry
ebon kelp
#

Else it won't be in there

#

Anyhow about to upload this bot for the 3rd time, because it crashed twice. Like I edited 1 line and didn't test it for production sad

sinful belfry
#

oof

#

good luck lol

ebon kelp
#

90 days to get a bot approven ppSleepy

simple stump
#

Thanks Lite, e, and alhassan. It works! Accidentally did some weird stuff

earnest phoenix
#

how can i check if a user's avatar is gif?

ebon kelp
#

oof
@sinful belfry Unless simpW

sinful belfry
#

@earnest phoenix check the file extension i guess

#

if it ends in .gif then it would be safe to assume it is a gif

earnest phoenix
#

how if (kisi.user.displayAvatarURL({ format: 'gif'})))

#

?

#

thx @earnest phoenix

ebon kelp
#

[Starman] Unless simpW
@ebon kelp wouldn't be fair ofc, but saves some time peepoShy

ruby dust
#

Is anyone aware of some method for checking whether there are uncommitted changes in SQLite before committing?

earnest phoenix
#

easy but unreliable would be to check the differences in file size

#

a proper way would be to loop through everything in the database in both files (local and the most recent one in the branch)

#

you shouldn't be committing your db file anyways 👁️ 👄 👁️

slender thistle
#

it's called transparency

simple stump
#

I'm trying to create a g!stop command for my bot, however I get a GIANT error:
https://hatebin.com/noqtbgstdc
Probably the most important part is this:

TypeError: Cannot read property 'end' of undefined
    at Client.<anonymous> (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\index.js:817:23)
    at Client.emit (events.js:327:22)
    at MessageCreateAction.handle (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\ws\lib\websocket.js:797:20)
PS C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot>

I don't know why line 817 (server.dispatcher.end();) is not a thing.
Code: https://hatebin.com/sqaehshawb

snow urchin
earnest phoenix
#

how do i check if a user has the house_balance badge?

summer torrent
#

check its flags

earnest phoenix
#

türkmüydün sen

summer torrent
earnest phoenix
#

i just want to check a flag

#

how

summer torrent
#

what is your djs version

earnest phoenix
#

12.3.1

summer torrent
#

<User>.flags.has()

earnest phoenix
#

ok thanks, im trying

earnest phoenix
#

i cannot control offline users. @summer torrent

white belfry
#

Oa türk

earnest phoenix
#

😄

snow urchin
#

just do message.channel.send facepalm

earnest phoenix
#

it's not the fault

snow urchin
#

yes.. it is

earnest phoenix
#

cannot read property 'has' of undefined

snow urchin
#

message is not defined

earnest phoenix
#

i know

#

this broo

snow urchin
#

code?

summer torrent
#

show kullanıcı-bilgi.js 117th line

snow urchin
#

we aint got a clue what has is

summer torrent
#

also just do message.channel.send

earnest phoenix
#

continuous console node. I did such a thing because I applied

#

if (kisi.user.flags.has('HOUSE_BALANCE')) rozetler.push(![balance01](https://cdn.discordapp.com/emojis/744310596064903168.webp?size=128 "balance01"));

#

Otherwise I can't use node index.js

#

I made that mistake on purpose.

snow urchin
#

what is "kisi"

earnest phoenix
#

Turkish mean user

#

const kisi = blablabla

simple stump
#

I'm trying to create a g!stop command for my bot, however I get a GIANT error:
https://hatebin.com/noqtbgstdc
Probably the most important part is this:

TypeError: Cannot read property 'end' of undefined
    at Client.<anonymous> (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\index.js:817:23)
    at Client.emit (events.js:327:22)
    at MessageCreateAction.handle (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\ws\lib\websocket.js:797:20)
PS C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot>

I don't know why line 817 (server.dispatcher.end();) is not a thing.
Code: https://hatebin.com/sqaehshawb

earnest phoenix
#

@summer torrent

#

can you figure it out

snow urchin
#

const kisi = blablabla
@earnest phoenix "blablabla" very helpful mate

pure lion
#

@simple stump how do you store your queue?

summer torrent
#

@earnest phoenix what is kisi

pure lion
#

Show the definition of kisi

#

Not blablabla

earnest phoenix
#
let kisi = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(r => r.user.username.toLowerCase() === args.join(' ').toLocaleLowerCase()) || message.guild.members.cache.find(r => r.displayName.toLowerCase() === args.join(' ').toLocaleLowerCase()) || message.member;
pure lion
#

Jesus

snow urchin
#

i-

earnest phoenix
#

i got it wrong, sorry

#

:d

wicked pivot
#
if(message.attachments.size > 0){
        message.attachments.map(async(r) => {
            await bot.channels.cache.get('708100886198616064').send("save", {file: r.url})
        })
    }```it does not work
simple stump
#

@pure lion sorry for late reply. I store my queue in an array.

            if (!servers[message.guild.id]) servers[message.guild.id] = {
                queue: []
            }

and when i want to add a song:

server.queue.push(args[0]);
snow urchin
#
module.exports = (client) => {
    setInterval(() => {
      const db = client.db.fetch("cmb.commandUses", true);
      var sortable = [];
      for (var command in db) sortable.push([command, db[command]]);
      sortable.sort((a, b) => a[1] - b[1]);
      sortable.forEach((item) => {
        var objSorted={};
        objSorted[item[0]] = item[1];
        client.mostUsedCommand = objSorted;
        delete client.mostUsedCommand["total"];
        let totalUses = 0;
        client.totalCommandUses = Object.keys(client.mostUsedCommand).map(x => x == "evaluate" ? "" : totalUses = totalUses + Number(db[x]));
        client.mostUsedCommand = Object.keys(client.mostUsedCommand)[Object.keys(client.mostUsedCommand).length - 1];
        client.totalCommandUses = totalUses;
        // IF I LOG HERE, IT LOGS FINE
      });
    }, 1000);
// IF I LOG HERE, ITS UNDEFINED ALL OF A SUDDEN
  };

https://discordapp.com/channels/264445053596991498/272764566411149314/749746161195286630
what
is
wrong

pure lion
#

@simple stump what is servers

quartz kindle
#

@snow urchin because its inside an interval

#

the interval runs for the first time after 1 second, before that everything inside doesnt exist

snow urchin
#

the interval aint the issue m8, it worked before

quartz kindle
#

it is whats causing it to log undefined, which is what you asked

#

thats why it logs fine inside it but not outside

simple stump
snow urchin
steady anchor
#

the bot creates a channel

#

but how can i store the created channel?

digital ibex
#

just save that to the db?

steady anchor
#

no no

#

i mean in a var

digital ibex
#

expand on what u mean by “store”

#

const bob = the code u just sent

summer torrent
#

var channel = await ...channels.create

steady anchor
#

i want to store the channel and then send a message and some more

summer torrent
#

yes

steady anchor
#

var channel = await ...channels.create
@summer torrent and how can i send a message?

digital ibex
#

bob.send(bob)

steady anchor
#

channel.send is not a funktion

summer torrent
#

<your channel variable>.send

steady anchor
#

i'm lost

#

thanks

sharp thicket
#

Hello,anyone have an idea on how to make an afk command like a!afk Sleeping so when someone pings the user the bot replies and when the user sends a message it removes the afk?

#

i use mongoDB btw

snow urchin
quartz kindle
#

it will be undefined if you log it outside of the interval before the interval is executed

snow urchin
#

this is inside the interval..

#
        console.log(Object.keys(client.mostUsedCommand)[Object.keys(client.mostUsedCommand).length - 1])
        // => botinfo
        client.mostUsedCommand = Object.keys(client.mostUsedCommand)[Object.keys(client.mostUsedCommand).length - 1];
        console.log(client.mostUsedCommand)
        // => undefined
solemn latch
#

is that length supposed to be there 🤔

#

or is it just clipping off the screenshot

opal plank
#

im still confused as to why use ```js
Object.keys(client.mostUsedCommand)[Object.keys(client.mostUsedCommand).length - 1]

rather than ```js
client.mostUsedCommand?[0]
#

actually

#

i see

#

i guess you could sort as well technically

simple stump
#

I'm trying to create a g!stop command for my bot, however I get a GIANT error:
https://hatebin.com/noqtbgstdc
Probably the most important part is this:

TypeError: Cannot read property 'end' of undefined
    at Client.<anonymous> (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\index.js:817:23)
    at Client.emit (events.js:327:22)
    at MessageCreateAction.handle (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot\node_modules\ws\lib\websocket.js:797:20)
PS C:\Users\Ian Lew\OneDrive\Programs\DiscordBot\Test Bot>

I don't know why line 817 (server.dispatcher.end();) is not a thing.
Code: https://hatebin.com/sqaehshawb

sudden geyser
#

It means server.dispatcher is undefined. You should log the value of server to see what it is.

simple stump
#

Alright

#

It seems to work...

{ queue: [ 'https://www.youtube.com/watch?v=9Va88Kt0NN0' ] }
#

That's what's logged.

#
        if (message.content.startsWith(`${prefix}stop`)) {
            var server = servers[message.guild.id];
            console.log(server);
            if (message.guild.voice.channel) {
                for (var i = server.queue.length - 1; i >= 0; i--) {
                    server.queue.splice(i, 1);
                }

                server.dispatcher.end();

                message.channel.send("Ending the queue. Leaving the voice channel...");

                console.log('Stopped the queue!');
            }

            if (message.guild.connection) message.guild.voice.channel.disconnect();
        }
sudden geyser
#

So the object does not contain the dispatcher. All it contains is a key of queue and a value of an array of songs. Perhaps you're missing it because you never gave it.

topaz fjord
#

@steady anchor what theme is that

valid frigate
#

discordgo - bot randomly dropped connection to all shards earlier this morning, wondering if its the library or if discord api had some weird thing happen to it today

topaz fjord
#

@valid frigate

sharp thicket
#

Hello,how do i get the activity of a user like specific not just has a custom activity

#

this is my current code

#
        {
                    name: "Activity: ",
                    value: user.presence.activities[0] ? user.presence.activities[0].name : `User isn't playing a game!`,
                    inline: true
                },```
valid frigate
#

thanks matre

earnest phoenix
#

how do i check f a guild has an icon ???

sudden geyser
#

@earnest phoenix what library are you using

#

@topaz fjord I think it's material

verbal linden
#

If bot is in voice channel but isn't playing anything for 5 minutes it's gonna leave from voice channel

#

How can i do this

sudden geyser
#

What language and what library are you using

verbal linden
#

discord.js

#

v11

sudden geyser
#

Consider using the timeout API in Node.js (setTimeout) or something

#

When there's nothing left you can create the timeout and if a song starts you can cancel it (if it's not been 5 minutes)

earnest phoenix
#

(obviously remove it in both cases, when it expires and when a member joins back, we don't want ram leaks)

drifting wedge
#

how do i allow a command to be used by both someone with a role

#

and with someone with a permission?

verbal linden
#

okay guys i got it

#

thanks for helping

earnest phoenix
#

loop through their roles, if not found, check their permissions

#

or vice versa

#

the order doesn't matter

drifting wedge
#

@commands.has_permissions(manage_channels=True)
@commands.has_any_role('DJ', 'Dj', 'dj', 'dJ')

#

does this work?

#

spoiler: it doesnt

earnest phoenix
#

never worked with dpy ¯_(ツ)_/¯

drifting wedge
#
    @commands.has_any_role('DJ', 'Dj', 'dj', 'dJ')
    @command()
    async def stop(self,msg):```
#

ok thanks

earnest phoenix
#

i don't think that's or'ing the permissions though

#

that's and'ing them

drifting wedge
#

oh

#

u know how to or?

#

and do you know if i can also check it theyre alone

#

in the vc

sudden geyser
#

It doesn't work because it's checking for both cases (permissions and has role). I don't know myself how to make it only check if either one of them are true but you could make your own check. There's probably a better way of doing it though.

earnest phoenix
#

yeah i don't think you can or checks in dpy

#

you probably have to make your own one

#

from the docs: When multiple checks are specified, all of them must be True:

sudden geyser
sand skiff
#

-m invite

#

-m help

sudden geyser
#

noop

drifting wedge
#

how would i go about making my own?

sand skiff
#

-help

drifting wedge
#

@sand skiff

#

go to testing

earnest phoenix
#

the docs cover over that

#

check out the link lite sent

drifting wedge
#

didnt notrice

#

notice

#

thanks 🙂

sand skiff
#

i need help with @gilded plank

#

what is prefix

summer torrent
sand garnet
karmic compass
#

is .startsWith() something that is everywhere or just in discord.js

#

talking javascript bwt

earnest phoenix
#

...huh?

#

oh

#

you could've just googled that

simple stump
#

How do I disconnect my bot from the VC? Or stop my bot from playing anything? I get an error when I use this code:

        if (message.content.startsWith(`${prefix}stop`)) {
            var server = servers[message.guild.id];
            console.log(server);
            if (message.guild.voice.channel) {
                for (var i = server.queue.length - 1; i >= 0; i--) {
                    server.queue.splice(i, 1);
                }

                server.dispatcher.end();

                message.channel.send("Ending the queue. Leaving the voice channel...");

                console.log('Stopped the queue!');
            }

            if (message.guild.connection) message.guild.voice.channel.disconnect();
        }

Error:
https://hatebin.com/osjosjqseu

dense ridge
#

I need help getting my bot online and working because I just created an bot

earnest phoenix
#

@dense ridge

dense ridge
#

Yikes I can’t code with JavaScript at all it confuses me

solemn latch
#

what can you code with 🤔

dense ridge
#

I don’t know

earnest phoenix
#

Well then

solemn latch
#

python and js are kind of the beginner languages

earnest phoenix
#

Python is the best for beginners apparently

solemn latch
#

really depends on what your going for.

dense ridge
#

Ima learn how if I want my bot up to shape

#

Wanna know what my bot name is?

earnest phoenix
#

I missed Phpstorm and Intellij IDEA.

#

It felt more comfortable than VSC but im using VSC for now sadly since my license ended. ima go for a yearly license later

dense ridge
#

Wa I need help

#

Tho

solemn latch
#

let us know whatcha need and we might be able to help

dense ridge
#

Its the coding

#

I know nothing about JavaScript

earnest phoenix
#

Just don't expect us to spoon feed you everything though no offence. You don't gain much knowledge by that

#

^Not trying to be rude

solemn latch
#

the discordjs.guide link given earlier covers a lot of useful things.

#

it also gives some great sources on learning the basics of js.

earnest phoenix
#
earnest phoenix
#

how to fix error when install quick.db ?

solemn latch
simple stump
#

How do I disconnect my bot from the VC? Or stop my bot from playing anything? I get an error when I use this code:

        if (message.content.startsWith(`${prefix}stop`)) {
            var server = servers[message.guild.id];
            console.log(server);
            if (message.guild.voice.channel) {
                for (var i = server.queue.length - 1; i >= 0; i--) {
                    server.queue.splice(i, 1);
                }

                server.dispatcher.end();

                message.channel.send("Ending the queue. Leaving the voice channel...");

                console.log('Stopped the queue!');
            }

            if (message.guild.connection) message.guild.voice.channel.disconnect();
        }

Error:
https://hatebin.com/osjosjqseu

solemn latch
#

whats "servers"

simple stump
#

Printing out server:

{ queue: [ 'https://www.youtube.com/watch?v=9Va88Kt0NN0' ] }
#
var server = servers[message.guild.id];
solemn latch
#

server.dispatcher is undefined then

simple stump
#

Yeah. I couldn't figure out how to set it or whatever in my code

#

(going to sleep fyi)

earnest phoenix
#

wait, nvm i used svg instead of png

hazy sparrow
#

how do i get the number of emojis in a server?

#

d.js V12

pale vessel
#

guild#emojis#cache

#

cache is an extended map so you can use size to get the size of the collection

#

so guild#emojis#cache#size

hazy sparrow
#

ok ty

#

what about number of channels? it says channel is not defined

trail crescent
pale vessel
#

@hazy sparrow channels

#

plural

hazy sparrow
#

ok lemme try that

#

@pale vessel ^

pale vessel
#

=>

#

not =

#

also, name it channel to avoid confusion

hazy sparrow
#

ok... lemme try that

pale vessel
#

and it's channels.cache is it not?

#

ah never mind

#

i'm guessing you defined it as that

hazy sparrow
#

const channels = message.guild.channels.cache;

fickle dune
#

why my bot slow

#

and its only doing cod

#

using math.random

valid frigate
#

could be your host

fickle dune
#

heroku

valid frigate
#

ah

fickle dune
#

yes im broke

valid frigate
#

im gonna point it at problems with heroku honestly

fickle dune
#

sdsdasg

valid frigate
#

sure it's a free host however you should eventually move to a vps

fickle dune
#

Yes if my mom gets me a paypal

#

wait

#

I GOT IDEA

#

no

#

not idea

#

yes

#

IDEA

#

lemme shift the command

#

to another repo

white gyro
#

heroku isn't that bad, likely you execute a blocking function before running each command.

hazy sparrow
#

what happens if i shard my bot at 20 servers?

dusk vault
#

wdym what happens

#

you'd have one shard with 20 servers

hazy sparrow
#

i mean can i

dusk vault
#

yes

cinder patio
#

You can

#

But there's no benefit

dusk vault
#

except planning ahead

hazy sparrow
#

you'd have one shard with 20 servers
@dusk vault is there a way to make it 1 shard for every 5 servers?

dusk vault
#

why

hazy sparrow
#

why not

dusk vault
#

why

hazy sparrow
#

why not

sonic lodge
#

you'd have 4 separate shards for your 20 servers

hazy sparrow
#

yup

sonic lodge
#

that's 4 processes

dusk vault
#

which would be more memory intensive

#

than not sharding

#

lmao

#

and probably slower

#

shards should have

cinder patio
#

Um, you can have sharding with only one process

hazy sparrow
#

oh wow nvm then i guess

dusk vault
#

1000 guilds

hazy sparrow
#

i want to make it fast ;-;

dusk vault
#

thats not how at 20 servers

restive furnace
#

@cinder patio yes, internal one

#

ones*

hazy sparrow
#

thats not how at 20 servers
@dusk vault then how

sonic lodge
#

don't

restive furnace
#

but if you cluster, then its multiple

dusk vault
#

how am i supposed to answer how to make your bot fast

#

i dont know what your bot even is

hazy sparrow
#

yup its js

dusk vault
#

ok?

hazy sparrow
#

oh wait i misread

dusk vault
#

anyway cya

#

ima go mysql myself to death

restive furnace
#

if u want fast, bot find a vps what's close to discord's datacenters

cinder patio
#

Sharding won't make your bot faster at 20 guilds, in fact it might make it even slower because you are connecting to the gateway multiple times

hazy sparrow
#

ok good luck

#

Sharding won't make your bot faster at 20 guilds, in fact it might make it even slower because you are connecting to the gateway multiple times
@cinder patio who said my bot is in 20 server KEKW

restive furnace
#

you

dusk vault
#

you

sonic lodge
#

bruh

hazy sparrow
#

i asked that if i can do that at 20

dusk vault
#

which implies

hazy sparrow
#

i never said its at 20 alr

dusk vault
#

that you have 20

pure lion
#

Sharding === a fucktonne more CPU and RAM (it doubles and can get bigger) power

hazy sparrow
#

how do i get these emojis? do i make em or ss someone's profile and crop?

earnest phoenix
#

make em

cinder patio
#

google "discord status emojis"

earnest phoenix
#

^

#

and them to your bot support server

#

it needs a special perm to use emojis from other servers in other servers

#

i think it's called nvm i forgot ask @Tim

wheat jolt
#

@hazy sparrow right click on them and then click copy link

hazy sparrow
#

hm wait brb

#

@hazy sparrow right click on them and then click copy link
yea this is so easy ty

earnest phoenix
#

wait it's against youtube tos to make music bots

hazy sparrow
#

there goes my plans for tueusday

earnest phoenix
#

k

#

pretty sure node.js can detect when the process exits

#

so you can log when it goes offline

#

i think it's called nvm i forgot ask @Tim
No, it called Ask @Tim he know verything

sick cloud
#

tim is a god send in this server lmao

earnest phoenix
#

@quartz kindle is it better to do process.ONCE("exit"); or process.ON("exit");

#

i think the second one is better

#

because if for whatever reason node.js adds a way to force a process to stay up then...

rich trail
#

Hello

#

My bot is not accepted

sonic lodge
#

wait

#

it's only been three days since you submitted it

earnest phoenix
#

wait https://v8.dev is a JavaScript engine coded in C++ Thonk

#

@earnest phoenix dude stop ping him

#

hes offline

fickle dune
#

why does this show

misty sigil
#

Code?

fickle dune
#

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

    let reddit = [
        "meme",
        "animemes",
        "morgzmeme",
        "depressedmeme",
        "robloxmeme"
        "dankmemes",
        "dankmeme",
        "wholesomememes",
        "MemeEconomy",
        "techsupportanimals",
        "meirl",
        "me_irl",
        "2meirl4meirl",
        "AdviceAnimals"
    ]

    let subreddit = reddit[Math.floor(Math.random() * reddit.length)];

    message.channel.startTyping();

    randomPuppy(subreddit).then(async url => {
            await message.channel.send({
                files: [{
                    attachment: url,
                    name: 'meme.png'
                }]
            }).then(() => message.channel.stopTyping());
    }).catch(err => console.error(err));

};

module.exports.help = {
    name: 'meme',
    aliases: ['memes']
}```
slim heart
#

missing a ,

misty sigil
#

Robloxmeme doesn’t have a comma after it

fickle dune
#

oh

misty sigil
#

:')

slim heart
fickle dune
#

lol

#

ik

#

im editing on notepad

#

to lazy to open vsc

#

its crashes

sonic lodge
#

try notepad plusx2

slim heart
#

wait https://v8.dev is a JavaScript engine coded in C++ Thonk
@earnest phoenix javascript is interpreted into c++

fickle dune
#

what happend

#

with embed

sonic lodge
#

surround the link with < and >

slim heart
#

or surpress

weak rain
#

how to add automeme

#

command

fickle dune
#

is my bot

#

loop

earnest phoenix
#

Because it does

fickle dune
#

why

weak rain
#

how to add automemes

earnest phoenix
#

By automemes

#

Wdym

weak rain
#

memes will be sent after a certain period of time

#

like 2minutes

earnest phoenix
fickle dune
#

no post

earnest phoenix
#

@coral trellis -dotpost

fickle dune
#

oof

#

what

#

animals

#

are bad

#

imgur cant handel them

#

that loop

#

imgurr

weak rain
#

u can use api if u want

#

for animal commands

#

@fickle dune

fickle dune
#

im doing that only

#

just

#

heroku is gay

weak rain
#

xD

hazy sparrow
slender thistle
#

Upload your files, run, setup an uptime service to ping the website every 5-10 minutes to keep the bot online

hazy sparrow
#

im too lazy to run can i sit and do it

#

ty so much anyways

#

should i upload all my files or just index.js?

cinder patio
#

Upload all files index.js needs to run

balmy knoll
#

In javascript, how can I perform an action at a specific time of day?

cinder patio
#

Buut if you want to do it just once, you can use a setTimeout

balmy knoll
#

No, every day at a specific time

cinder patio
#

then cron should do the job

balmy knoll
#

Ok thanks

delicate shore
#
const { Client, MessageEmbed } = require('discord.js');
const { Menu } = require('discord.js-menu');
const client = new Client();
 const prompter = require('discordjs-prompter');

client.on("message", async msg => {
  let message = msg
  
  if(message.content == "nuke"){
    if(msg.author.id !== "587663056046391302") return msg.reply(`no`)
    prompter
      .reaction(msg.channel, {
        question: 'Are you sure?',
        userId: msg.author.id,
      })
      .then(response => {
        // Response is false if time runs out
        if (!response) return msg.reply('you took too long!');
        // Returns 'yes' if user confirms and 'no' if ser cancels.
        if (response === 'yes') {
         let channel =  await message.channel.clone()
         msg.channel.delete()
          channel.send(`done`)
          channel.send(`done`)
          channel.send(`done`)
         
         
         }
        if (response === 'no') return msg.channel.send('You chose no!');
      });
    
  }```
#

this is a testing bot

#

it says cannot use await outside async

#

but it is in async

dusk vault
#

the .then callback function has to be async to use await inside of it @delicate shore

delicate shore
#

ok

#

thnx

dusk vault
#

np

delicate shore
#

it worked Pog

knotty obsidian
#
[JDA MainWS-ReadThread] WARN GuildSetupController - Accumulating suspicious amounts of cached events during guild setup, something might be wrong. Cached: 2000 Members: 0/134411 Status: CHUNKING GuildId: 264445053596991498 Incomplete: 0/1
[JDA MainWS-ReadThread] WARN GuildSetupController - Accumulating suspicious amounts of cached events during guild setup, something might be wrong. Cached: 3000 Members: 0/134411 Status: CHUNKING GuildId: 264445053596991498 Incomplete: 0/1
[JDA MainWS-ReadThread] WARN GuildSetupController - Accumulating suspicious amounts of cached events during guild setup, something might be wrong. Cached: 4000 Members: 0/134411 Status: CHUNKING GuildId: 264445053596991498 Incomplete: 0/1
#

and the bot is very slow and sometimes doesnt even listen

crystal socket
#

ram leak

#

try restarting vps/computer

#

@knotty obsidian

knotty obsidian
#

ok

#

but what is that guild?

#

264445053596991498

#

its not mine

#

not my friends

crystal socket
#

this guild

#

if you want you can ask a mod to kick it from this guild

#

it might also fix the issue

#

(you probably don't have enough ram)

knotty obsidian
#

yeah

#

my computer is a 3 year old laptop

#

the ping of the bot is 120

#

S!ping

#

he kinda

#

decides

#

to respond or not

dusk vault
#

bots dont work here

knotty obsidian
#

net.dv8tion.jda.api.exceptions.InsufficientPermissionException: Cannot perform action due to a lack of Permission. Missing permission: MESSAGE_WRITE

#

is it muted or what

#

also the bot is fast now

hazy sparrow
#

how do i get the sum of all members of all servers the bot is in?

pure lion
#

What Lang?

slender thistle
#

-mutedbot @knotty obsidian

gilded plankBOT
#

@knotty obsidian

Your bot was likely muted because it broke one of the "bot rules" listed in #rules-and-info.

To find out why your bot was muted and by who, use the search feature in #mod-logs:

knotty obsidian
#

oh

hazy sparrow
#

What Lang?
@pure lion d.js v12

pure lion
#

client.users.cache.size

hazy sparrow
#

ok ty

knotty obsidian
#

so my bot responds to other bots ;-;

#

alright, let me fix it

#
if (event.getAuthor().isBot()) {
  return;
}
pure lion
#

What lang

#

Lib

#

Whatever

hazy sparrow
#

is there a way to change my bot's activity every x seconds automaticcly??

pure lion
#

That could be API abuse

#

@knotty obsidian what lib

knotty obsidian
#

JDA

pure lion
#

Ah nvm

hazy sparrow
#

That could be API abuse
@pure lion theres a ratelimit of 5 changes every 60 seconds

knotty obsidian
#

:)

pure lion
#

That's for messages

#

Wait

#

Nvm

#

It's generally a bad idea to automate an API like that

#

But if you must then use an array and a setInterval

hazy sparrow
#

well i dont want to change it, just reload the currect status so my server count is correct

pure lion
#

Get random from the array

#

Oh

earnest phoenix
#

hey i need help

#

Can someone help me?

pure lion
#

What is issue

earnest phoenix
#

Down Mortex 2020-08-31 08:24:22 Forbidden (403)

#

my bot is down

#

how to fix

pure lion
#

I need more info

#

Who is your host

earnest phoenix
pure lion
#

What

earnest phoenix
#

uptimerobot

#

host website

pure lion
#

Oh

earnest phoenix
#

uptimerobot

#

ye

pure lion
#

How much do you pay

earnest phoenix
#

Free 😐

pure lion
#

😅

#

Now there's your problem

earnest phoenix
#

how to fix

#

i'm new

#

i made a music bot

pure lion
#

Buy a vps

earnest phoenix
#

i can't turn on my pc 24/7 hours

#

vps?

pure lion
#

Put your bot on the vps

hazy sparrow
#

yup, its clear. DONT use a "FREE" hosting thingy

earnest phoenix
#

O

pure lion
#

Especially for music bots

earnest phoenix
#

how much does it cost?

hazy sparrow
#

wait why specially for music bots?

earnest phoenix
#

ye

#

yup, its clear. DONT use a "FREE" hosting thingy
@hazy sparrow I use one well i was the co-owner we are legit free hosting for a certain plan/stats

#

I can link one in dms

#

any other way?

pure lion
#

@earnest phoenix the one I use is £3.59, it's really good the for the price

earnest phoenix
#

name please

#

@earnest phoenix the one I use is £3.59, it's really good the for the price
@pure lion Or you can get it free

hazy sparrow
#

I can link one in dms
@earnest phoenix hmm, sure, ill see it

earnest phoenix
#

@earnest phoenix from where

pure lion
#

@earnest phoenix ✈️

#

@earnest phoenix

earnest phoenix
#

There^

#

@hazy sparrow

#

@earnest phoenix

pure lion
#

Can you don't

earnest phoenix
#

Can you don't
@pure lion dont what?

pure lion
#

Nvm

earnest phoenix
#

@earnest phoenix it's free?

pure lion
#

If you want free hosting

earnest phoenix
#

i will check

#

wait

#

@earnest phoenix it's free?
@earnest phoenix Yeah

#

it is

#

leme check

#

You have to join the discord server

#

cuz the automation system is getting redone

#

and make a ticket

pure lion
#

Official free, it's all legit and actually good

earnest phoenix
#

coughs advertising

weak rain
#

how do i set my bot that it sends a message after a certain period of time

knotty obsidian
#

i fixed the error when the bot responds to bots, how do i get unmuted now?

hazy sparrow
#

@earnest phoenix why do you guys need phone number ;-;

earnest phoenix
#

it says coming soon

pure lion
#

Lma

earnest phoenix
#

bruh

#

@earnest phoenix why do you guys need phone number ;-;
@hazy sparrow idk

hazy sparrow
#

and adress too smh

earnest phoenix
#

contact info

#

??

#

wait i didn't have to do that

pure lion
#

Use Library of code

earnest phoenix
#

you can skip it

pure lion
#

Smh

hazy sparrow
#

Use Library of code
@pure lion whats that

earnest phoenix
#

man

#

the website sucks

#

the website sucks
@earnest phoenix Why?

#

i didn't understand anything

#

i'm confuse

#

can you explain me in dm

#

can you explain me in dm
@earnest phoenix oka

hazy sparrow
#

confusion go crrrrrr

ruby talon
#

Anyone know how you would let nginx cover a localhost server.
For example.
Server runs on: localhost:1234
Domain: my.example.com
(When you visit my.example.com you see the content of localhost:1234)

knotty obsidian
#

how can i make an mute role? i made the mute role have all the roles turned off but it doesnt work

ruby talon
#

Allowed > Denied

#

Make sure your role settings don't break that rule

knotty obsidian
#

event.getGuild().createRole().setName("Muted").setPermissions(Permission.EMPTY_PERMISSIONS).queue();

#

thats what i did

#

so how do i do it

edgy knoll
#

sa

knotty obsidian
#

?

ruby talon
#

@knotty obsidian what language & library are you using?

knotty obsidian
#

Java
JDA

#

:|

ruby talon
hazy sparrow
earnest phoenix
#

blame discord

hazy sparrow
#

its always like that 😫

earnest phoenix
#

blame discord

pale vessel
#

strip indents by using the common-tags package or use \n

#

or add .split("\n").map(x => x.trim()).join("\n") after the ` mmLol

hazy sparrow
#

@pale vessel you telling to me?

pale vessel
#

yes

hazy sparrow
#

after which `?

earnest phoenix
#

ahh

hazy sparrow
#

the embed one?

pale vessel
#

the closing one

#

yes

hazy sparrow
#

ok wait

pale vessel
#

wait show code

earnest phoenix
#

want to add4add?

pale vessel
#

please not here

hazy sparrow
#

wait hold on

earnest phoenix
#

let's add each other bot

#

Uh okie

pale vessel
#

no

earnest phoenix
#

k

#

add4add dm me

hazy sparrow
#

@earnest phoenix stop

earnest phoenix
#

bro any free hosting website?