#development

1 messages Β· Page 1470 of 1

robust blade
#

i need help making a music bot

#

these music bot discord.js tutorials are not working

#

can someone recommend me a video

#

npm i enmap?

sudden geyser
#

what happens when you try it

robust blade
#

i have enmap installed

#

OMG

sudden geyser
#

bap conditions will not always be the same for everyone

#

gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************

#

that's the part that matters

robust blade
#

i need help making a music bot
these music bot discord.js tutorials are not working
can someone recommend me a video

sudden geyser
#

see the link in the error

earnest phoenix
#

Download Visual Studio

#

I believe

honest perch
#

@robust blade if you dont know how to make one dont

mellow kelp
#

literally follow the instructions you are given on the console

craggy pine
honest perch
#

And FYI, I run one and can confirm it gets expensive

earnest phoenix
#

I think so

sudden geyser
#

You need the latest version of Visual Studio.

robust blade
gilded olive
#

Music bot overated

honest perch
#

Well good luck with the ipv6 blocks

robust blade
#

ipv6?

gilded olive
#

Inb4 youtube blocks your ip

#

they dont like random people streaming their data to discord

robust blade
#

oh

craggy pine
#

Which is why IP rotators exsist.

robust blade
#

IPV6 technically stands for Internet Protocol Version 6

#

eek

#

if i do an music bot

#

i get an error saying i need an youtube identity token

gilded olive
#

Yes

honest perch
robust blade
#

ok i have another problem

#

i cant install quick.db

honest perch
robust blade
#

i have an youtube identity token

gilded olive
#

if you're expecting to go big they will rate limit you

robust blade
gilded olive
#

You have to request for more

#

In a nuthsell dude

honest perch
#

Or just scrape it

robust blade
gilded olive
#

Theres no point to them

solemn latch
#

saw someone spending over $2,000 for an ipv4 block for a music bot

honest perch
#

Thats what literally any music bot does

#

Ipv6?

sudden geyser
#

are you sure it finished

robust blade
#

ok i have another problem

#

i can not install quick.db

honest perch
#

Why not

robust blade
#

idk

#

i get lots of npm and gyp err

rough flame
#

Hey folks, fairly new to making bots for Discord and have been a frequenter of top gg for a while. thought I'd join in the conversation from time to time.
tl;dr Hello πŸ‘‹

sudden geyser
#

Did it say all done / done / something similar at the end

#

where you ran the install for build tools

robust blade
#

i think i know why i cant install quick.db

#

i have a windows 7

solemn latch
#

quickdb has a troubleshooting page, did you follow it?

honest perch
#

Update to Windows 10 but thats not the issue

hollow sedge
#

thats probably not it

honest perch
#

Or just scrap the whole os itself, who even needs one?

robust blade
#

no

#

if i update to windows 10, will my data be there?

solemn latch
#

probably shouldnt upgrade on a whim, you should take time to properly backup your stuff

hollow sedge
#

^

rough flame
#

Add --loglevel silly to the end of the command and check if the LIB environment variable has any missing or incorrect paths. That could result in node-gyp failing.

robust blade
#

i have a problem with quickdb not better-sqlite3

oak cliff
#

quick.db is built upon better-sqlite3

distant cobalt
#
setInterval(() => {
                client.on('guildMemberAdd', member => {
                    if(guild.id === guildid){
                        const embed = new Discord.MessageEmbed()
                            .setTitle(`Welcome ${member.tag}!`)
                            .setDescription(`Hey there! Welcome to ${guild.name}!`)
                            .setColor('YELLOW')
                        message.channel.send(embed)
                    }

                    else{
                        
                    }
                })
            })```
how come when a user joins, nothing happens? not a error or a message
oak cliff
#

why do you have a client event inside a set interval

robust blade
oak cliff
#

im not the best dev but im pretty sure that would be an issue

distant cobalt
oak cliff
#

take it out the setinterval and see if it works lol

rough flame
#

I'm guessing the guild.id does not match the guilid completely

solemn latch
#

it does

rough flame
#

Try using just two equal operators (==)

solemn latch
#

if it doesnt, discord sent garbage data, which it sometimes likes to do.

distant cobalt
rough flame
# distant cobalt oka

=== is a strict operator comparison so if you change the data in a very subtle way, they will no long have parity

distant cobalt
#

Okay

rough flame
#

I have a quick question: So I have a bot which has a singular backend which only drives one instance of the bot on one sever. What are peoples suggestions for expanding to allow multiple instances of the bot to run (currently in JS)?
I'm not adverse to moving to python.

distant cobalt
#

Still doesn't work

#

lemme see if i can move it out of enablewelcome.js

odd stratus
#

Does anyone know how I can get the latency of a MongoDB database to show up in my ping command

robust blade
#

i have done all steps in the github website u gave me @oak cliff

rough flame
robust blade
#

sorry for ping

oak cliff
#

i dont know any more than the github thing

robust blade
#

ok

oak cliff
#

you could try asking in the quick.db support server, if someone else here doesnt know

rough flame
hollow sedge
robust blade
#

i still have errors

#

dang

static trench
#

hello humans πŸ‘‹ .

in D.py what is the command to delete a users command message?

robust blade
#

what is the support server for quick.db xiuh?

distant cobalt
#

Okay it works

#

but

static trench
#

thank you!!

distant cobalt
#
client.on('guildMemberAdd', member => {
                    if(guild.id == guildid){
                        const embed = new Discord.MessageEmbed()
                            .setTitle(`Welcome ${member.tag}!`)
                            .setDescription(`Hey there! Welcome to ${guild.name}!`)
                            .setThumbnail(guild.iconURL())
                            .setColor('YELLOW')
                        message.channel.send(embed)
                    }

                    else{
                        
                    }
                })```
static trench
hollow sedge
#

look at the docs

distant cobalt
solemn latch
#

im sorry, i dont know what the issue is

distant cobalt
#

erm

solemn latch
#

it helps to put your question and code in the same message

distant cobalt
#

this happened. it says undefined

client.on('guildMemberAdd', member => {
                    if(guild.id == guildid){
                        const embed = new Discord.MessageEmbed()
                            .setTitle(`Welcome ${member.tag}!`)
                            .setDescription(`Hey there! Welcome to ${guild.name}!`)
                            .setThumbnail(guild.iconURL())
                            .setColor('YELLOW')
                        message.channel.send(embed)
                    }

                    else{
                        
                    }
                })```
rough flame
#

Discord returns a promise for requests like this, so you may have to await the response of the member name

hollow sedge
#

light mode 😩

#

i thought it was a website

solemn latch
#

member doesnt have the property tag

rough flame
#

Or that ☝️

hollow sedge
#

wait why do you want to say Welcome ${member.tag}

crude juniper
#

does anyone else ever get this? ```
node:4376) UnhandledPromiseRejectionWarning: Error: 404 Not Found
at IncomingMessage.<anonymous> (root\src\node_modules\dblapi.js\src\index.js:118:25)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)

serene shard
#

i need some assistance

distant cobalt
hollow sedge
distant cobalt
serene shard
#

bru not coding but like kinda of

#

so i know how to code html

#

but when i try adding style and stuff the website doesn’t read it

#

i knwo im doing it right

rough flame
serene shard
#

know

hollow sedge
#

you got the code for that

#

like it wont read it or it wont update it?

serene shard
#

yes i’m literally just testing what i can do

#

and it won’t work

#

here hold up leme send it

crude juniper
rough flame
solemn latch
# distant cobalt yeah lol

the link i sent, is all the things you can do . on for the member object.
the member object doesnt have anything called .tag

rough flame
#

Ah right

serene shard
#

nevermind

#

i forgot the #

#

LOL

hollow sedge
#

nice

distant cobalt
#

how about member.toString()?

solemn latch
#

why would you tostring it?

distant cobalt
#

Idk

#

Lol

#

erm

#

how do i fix that? LOl

#

well i got @distant cobalt

#

not the string version

rough flame
#

member in this instance is data structure which contains properties that you need to access to get the information you need. https://discord.js.org/#/docs/main/stable/class/GuildMember

distant cobalt
#

how do i fix XD

#

Okay

solemn latch
#

dont just try random things expecting something to work

rough flame
#

This is the user ID btw (698582976769818674)

errant hinge
#

How do I change the bot in my lobby skin

#

Or make it dance

solemn latch
hollow sedge
#

make his bot dance

solemn latch
#

step one turn on music

errant hinge
#

I've just joined

#

Not even been here for an hour

rough flame
#

But you would need to extract the number

errant hinge
#

So

#

@recon bot?

#

I'm so confused rn

solemn latch
#

about?

#

are you looking for support for a bot you want to use? becuase this is a dev channel for making bots.

errant hinge
#

How do I make da bot

hollow sedge
rough flame
#

If you want a ping "<@" + member.user.id + ">"

errant hinge
#

I give up

#

πŸ˜‚

distant cobalt
rough flame
#

Change const userName = await member.id;
to
const userName = await member.user.username;
And remove the <@..>

#

That should give you the base username

solemn latch
#

its probably a good idea to learn how objects, properties, and methods work.

rough flame
#

I just noticed, the reason it's not resolving to a ping is because you're doing it in the Title field. You can't ping in an embed title

solemn latch
#

as javascript is object oriented this is key stuff.

rough flame
distant cobalt
#

doensn't work, it still says undefined

quartz kindle
#

You dont need to await ids or usernames, they are not promises

hollow sedge
#

do you mean load balancing

untold scroll
#

Hi

rough flame
#

I mean, currently with my current implementation, it only targets one server. If another were to invite the bot, then they would end up sharing the same back end resources. I'm wondering how people deal with multiple requests and DB's going at once. So load balancing is probably closer.

quartz kindle
#

yes i know, that wasnt to fix it, just to avoid doing useless stuff

#

Whats your current code?

hollow sedge
#

i think thats semi-complicated

#

you might just want to go for sharding first

rough flame
quartz kindle
rough flame
quartz kindle
#

Would need some more details to have a concrete answer

rough flame
#

The fact you came back saying bots can normally handle thousands of servers fills me with more determination confidence.

solemn latch
#

well, discord starts forcing you to do some type of sharding at 2500 servers

rough flame
#

Just reading up on it now

quartz kindle
#

My bot is currently handling ~6500 servers on a single process

#

On a single core vps

crimson vapor
#

I hope the new commands system gets polished and reduced the need for sharding

rough flame
#

I'm currently just hosting on glitch.com for a jumping off point. It has been fairly robust so far. Their online IDE is a bit clunky, but you can access your projects through VsCode so it's not too bad

mellow kelp
#

how many guilds does it handle?

hollow sedge
#

i would think its more about the users than the guilds

rough flame
#

My bot? As I said, it's just a single guild at the moment. That's why I seem a bit green in the whole affair. πŸ˜…

crimson vapor
#

Hi @quartz kindle

rough flame
#

It's about 350 active users

mellow kelp
#

oh well thats understandable

#

i can see glitch handling that

gilded olive
#

Yea def would be able to handle 1 guild

solemn latch
#

problem with glitch is pretty expensive, and bots are against tos on their free tier

#

expensive for the hardware*

hollow sedge
#

you could go to repl

quartz kindle
#

Users is no longer a problem now that you dont have members intent by default

hollow sedge
#

its not against their tos

crimson vapor
#

nah, you should just use the npm testing thing

#

runkit?

#

idk its name

solemn latch
#

keeping something online 24/7 is against glitch tos for the free teir.

crimson vapor
#

what does breaking a tos even do?

#

account shutdown

gilded olive
#

Youtube clone bots real scared

crimson vapor
#

so you make a new one or smth

solemn latch
#

and you know, kinda a crappy thing to do

ebon stone
#

Hi, can someone help me ?

hollow sedge
#

i mean if you abuse their free service it affects others

crimson vapor
#

imo yes but not much you can do to stop it

hollow sedge
#

because they might increase the price or something

solemn latch
#

sure, but its still a crappy thing to do, and we shouldnt encourage it

crimson vapor
#

no we shouldnt

rough flame
#

I initially had the bot pinging itself to stop it from falling asleep, but I'm paying currently.

quartz kindle
#

If youre paying fot glitch, you might as well pay for a vps

hollow sedge
#

^

quartz kindle
#

You get way more value

gilded olive
#

Ill always glorify gcp

quartz kindle
#

gcp is only good for its free tier

#

Everything else is crap

gilded olive
#

1 year tho

#

Then you can switch somewhere else

rough flame
#

I'd be happy to move over to a suggestion. I just wanted an easy way to deploy and have module management handled easily for me to get started.

quartz kindle
#

Ye

mellow kelp
#

im testing google cloud rn

#

computing engine looks good

gilded olive
crimson vapor
#

never used google cloud

#

never even looked at it

quartz kindle
#

Their cpus are good

crimson vapor
#

ovh always worked well for me

hollow sedge
quartz kindle
#

But everything else sucks

mellow kelp
#

bad thing is i gotta go to the shell every time i make a change

#

is there some way to automate that thing

crimson vapor
#

you could run some server?

gilded olive
crimson vapor
#

hmm

solemn latch
#

worst case, you just make a program that does what your looking for.

quartz kindle
#

Then you just upload new files via ftp/sftp and it will auto restart

mellow kelp
#

i meant

#

for github commits

#

or is that just kinda

#

not possible

quartz kindle
#

Everhthing is possible

mellow kelp
#

hmm

quartz kindle
#

But i never tried doing that

mellow kelp
#

i could make a webhook maybe

#

to do some magic shit over on the vps

quartz kindle
#

I just do it manually via ssh

hollow sedge
#

theres probably a way to do it

#

in AWS theres codedeploy

mellow kelp
#

makes sense

#

i really wanna automate this tho

#

probably gonna do it eventually

quartz kindle
#

Yoi want auto deploy on commit?

quartz kindle
#

Yoi can probably do that with github actions or something

mellow kelp
#

yeah

#

but like it should probably have to enter the ssh or something

#

ill take a look

rough flame
#

Thanks for the suggestions folks. The first thing I'll do is migrate to another platform from the consensus here.

solemn latch
mellow kelp
#

is cloud run a good option for bots?

hollow sedge
#

probably will work fine

#

oh wait nvm

#

idk

mellow kelp
#

but like

#

aint cloud run for serverless or something

earnest phoenix
#

Password

#

U forgot password ig

#

Dont really know tbh

#

Mongodb is a pain to me, i only got it eork oncr

#

But it have something to do with password ig

placid iron
#

Just use sqlite Jason dB OnoderaSip

earnest phoenix
#

^^

placid iron
#

My work here is done

#

The paradox of serverless using a server

#

😩

crimson vapor
#

mentions sqlite and jason.db in the same message

#

huh

#

almost as good as /login?r=/logout

crimson vapor
#

exactly

#

should I comment my code?

mellow kelp
#

yea

crimson vapor
#

hmm

#

ill finish work on the project

#

then ill comment it

foggy river
#

can someone help me with hosting my bot to heroku because I'm getting a push failed log when deploying it

drifting wedge
#

when i open the html file, things are clickable and works fine, but when i load it on my web server, it doesnt work

#

and stuff just isnt clickable

#

and some pages work on the webserver

#

and some dont

hollow sedge
#

code?

zenith terrace
earnest phoenix
#

I use mysql

foggy river
#

@hollow sedge

hollow sedge
#

specify the node version in package.json

foggy river
#

how do I do that? lol

hollow sedge
#

now thats a good question

mellow kelp
#

google it

drifting wedge
hollow sedge
#

OOPS

#

wrong link sorry lol

mellow kelp
#

lmao KEKW

mellow kelp
#

what game was that

hollow sedge
#

its an indie game called enemy on board

mellow kelp
#

o

#

cool

drifting wedge
#

@hollow sedge like the code of what wont work?

hollow sedge
#

well which language what web server

drifting wedge
#

flask

hollow sedge
#

ok can you show me your code

#

for routes

drifting wedge
#

uhhhhhhh

#

imma hastebin it

#

a lot of it is wierd af

hollow sedge
#

ok

#

maybe i can help clean it up

drifting wedge
#

also long af

#

one of the 2 things that dont work

hollow sedge
#

@requires_authorization is that flask-login?

drifting wedge
#

nah its flask discord

hollow sedge
#

oh..

drifting wedge
#

its not that i think though

#

bc i have it for another page and it works

hollow sedge
#

wait nvm

drifting wedge
#
                          <span class="alert-text"><b>Vanity URL Updated!</b></span>
                          <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                          </button>
                      </div>```
#

this is one of the thing that dont work

hollow sedge
#

which one

drifting wedge
#

?

hollow sedge
#

nvm lol

#

but where is that button going..?

drifting wedge
#

its just a popup

hollow sedge
#

oh ok

foggy river
#

I get this thing now

crimson vapor
#

poggers css

#

tbh

foggy river
crimson vapor
#

mine is shit

hollow sedge
#

i think thats imported though

drifting wedge
#

uhh u have any ideas?

#

wait imma just try to run the page

#

with no wierd stuff

#

just render template

#

nothing else

foggy river
#

@hollow sedge

hollow sedge
#

go to the links in the error message

drifting wedge
#

ye so @hollow sedge it works

#

its something in the flask

#

in the route

foggy river
hollow sedge
#

neither do i

foggy river
#

I think it just wants me to remove node_modules from my repo

#

idk

mellow kelp
#

yeah node_modules shouldn't be in your repo lmao

#

thats what lockfiles and package.json are for

delicate shore
#
client.once('ready', () => {

  client.api.applications("716985864512864328").commands.post({
        data: {
            name: "hello",
            description: "Replies with Hello World!"
        }
    });

    client.api.applications("716985864512864328").commands.post({
        data: {
            name: "echo",
            description: "Echos your text as an embed!",

            options: [
                {
                    name: "content",
                    description: "Content of the embed",
                    type: 3,
                    required: true
                }
            ]
        }
    });
})

It doesn't work
No error
command doesn't get registered

foggy river
mellow kelp
#

add it to .gitignore

#

if its commited already i think you can use git rm -r --cached .

foggy river
#

@mellow kelp

mellow kelp
#

no

#

/node_modules

#

the whole folder

foggy river
mellow kelp
#

without the * thing

#

bruh

foggy river
#

ok lol

foggy river
sudden geyser
#

The slash should be forward btw

mellow kelp
#

and run the command i said earlier

#

to remove the folder

young flame
sudden geyser
#

okie

mellow kelp
#

epic

#

we gonna have virtual gfs soon

young flame
#

facts

#

cant wait

#

lol

young flame
foggy river
mellow kelp
#

bruh you don't have a git repository in that folder

#

make sure you run the command on the repo

foggy river
#

sorry, how do I do that, I'm a noob at this

mellow kelp
#

um

#

you using git in your project?

foggy river
#

yeah I'm using github

mellow kelp
#

i mean git

foggy river
#

idk, i don't think so

undone solar
#

Hello evryone,
Im trying by a command to get all the discord members tag , thanks to helpers πŸ™‚

young flame
#

uh

#

discord tags?

undone solar
#

yep

#

discordjs

young flame
#

cache all users in the discord server and filter them out by discriminator

#

then define the discriminator to add into a embed or message

undone solar
#

I know the theory of what I should do but I can't do it I tried for a good hour , the .filter doesn't work etc.
thank you for the help

drifting wedge
#

this is so wierd

#

i cant click stuff

#

but when i dont have any code it works

drifting wedge
#

but when i have a lot it doesnt

#

liklike stuff isnt clickabl

#

flask/html

undone solar
#

i tried :

message.guild.roles.get('roleid').members.map(m=>m.user.tag);
young flame
#
let list = message.guild;
list.members.forEach(member => console.log(member.user.discriminator)); 
#

or something like that

undone solar
#

will try

#

TypeError: list.members.forEach is not a function

#

Anything i want to do , fail

summer torrent
#

members.cache

young flame
#

o yea

#

@undone solar srry ho on

#
let list = message.guild;
list.members.cache.forEach(member => console.log(member.user.discriminator)); 
#

djs v12

undone solar
#

Np mate , i just tried to help me πŸ™‚

young flame
#

you gotta cache it first lol

earnest phoenix
#

How does the tts in a server works?

young flame
#

text to speach?

earnest phoenix
#

Ya

young flame
#

well it does what it says

summer torrent
#

test

#

nvm

earnest phoenix
#

Ik but it doesn't work

young flame
#

anyone in that channel will hear your message via ai speaking it out

undone solar
earnest phoenix
young flame
#

hol on

undone solar
#

34members on the server πŸ€”

earnest phoenix
#

It returns the actual member

sudden geyser
earnest phoenix
#

You.

summer torrent
#

do you have guild_members intent enabled

young flame
#

i said discriminator for a reason lol

#

tag is name+#discrim

#

username is your name

#

disciminator is just the discriminator

undone solar
#

Im french man don't understand what was a discriminator

young flame
#

#3000

#

thats my discriminator

earnest phoenix
#

tag displays the # followed by the discriminator

undone solar
#

That why it return only myself ?

earnest phoenix
#

First of all

#

Did you enabled guild_members

drifting wedge
#

uhh im using flask, and my buttons dont work

earnest phoenix
#

Intent

#

?

young flame
drifting wedge
#

but on normal html, and on a page with no flask code it works too

young flame
#

its discriminator

drifting wedge
#

but with the flask code, it dienst

young flame
#

not tag

undone solar
#

but i need to return pseudo#discriminator

young flame
#

then add

undone solar
#

that why i used tag

young flame
#

+ member.discriminator

#

or like

#

member.username + '#' + member.discriminator

earnest phoenix
#

Pr

undone solar
#

Still return only myself

earnest phoenix
#

Or

young flame
#

uH

earnest phoenix
#

If she uses `

young flame
#

try

#
message.guild.members.cache.filter(member => member.discrminator);
#

ig

earnest phoenix
#

She can write ${member.username}#${member.discriminator} (if she uses ``)

young flame
#

i think

earnest phoenix
#

It's more easyly

undone solar
#

i know

#

i use it for mysql INSERT or SELECT

#

πŸ˜‰

earnest phoenix
#

Ok so

#

If you wanna get an specific user

#

You can use

undone solar
#

Im trying to get all the guild users πŸ™‚

earnest phoenix
#

Oh

#

Oh right i didn't code a command like that so

#

Idk

mellow kelp
#

guild.members.cache

earnest phoenix
#

All ik is you must have guild_members intent

mellow kelp
#

yea that too

undone solar
#

I found the solution thanks all

#
let list =  message.guild.members.cache.filter(member => console.log(member.user.tag));
earnest phoenix
#

Oh rigth

undone solar
#

but it return only online members

earnest phoenix
#

Hmmm

#

idk

solemn latch
#

it only returns cached members

earnest phoenix
#

But i suggest you to use an specific channel, it's better for logging things

#

And keep clean the console for important cases

solemn latch
#

probably better to use a logger, and put it under info, as sending each user in their own message(the same method here, but sending messages) will quickly get you ratelimited

#

or just dont log every single member in cache, because why would you want that?

earnest phoenix
#

Imagine using that in a big server

#

lmao

orchid burrow
#

does anyone have an idea on how to keep your bot online forever

mellow kelp
#

vps

#

unless a meteor crashes into google or amazon

orchid burrow
mellow kelp
#

nah

#

its not worth it self-hosting

orchid burrow
#

then what to do @mellow kelp

mellow kelp
#

told ya

#

vps

#

or heroku for small-scale stuff ig

orchid burrow
#

K will research thanks

mellow kelp
#

kk

tired falcon
#

how can i get the number of members in all the guilds my bot is in

#

i was able to do

#

client.guild.cache.size

#

to get the number of guild

#

but i cant get the number of users in all the guilds

earnest phoenix
#

Use Array.prototype.reduce() and add all the member count of all guilds one by one

tired falcon
#

oh ok lemme try it

mellow kelp
#

dang what would it be of js without array methods

earnest phoenix
#

Lol

earnest phoenix
#

oop

#

discord switched channels

#

How do I get a bot host 24/7 for free without paying?

#

I know heroku is free, but you need to pay to keep it going

#

doesn't exist

#

want resources? pay for them

#

welcome to capitalism

fair axle
#

It's not actually capitalism

#

Someone is paying money for this servers

#

It is super cheap to hire a server for discord bot

earnest phoenix
#

oh

#

I think I found out a way to make it 24/7 for free without paying

#

ill tell ya if it works

fair axle
#

Okey, I need a problem

#

But I can't return because it is promise

#

How to solve this problem

earnest phoenix
earnest phoenix
fair axle
#

how?

earnest phoenix
#

make your function async

#

await the promise

#

🧠

fair axle
#

hmm

#

and then?

pale vessel
#

and .then()?

fair axle
#

It is in client.on('message', async message => {})

earnest phoenix
#

so just return

fair axle
#

and Promise is now await but it doesn't work

earnest phoenix
#

what is your code

fair axle
#

Just a minute

#

It returns promise again

earnest phoenix
#

you're not awaiting it

fair axle
#

should I await voteCheck()

pale vessel
#

take a guess

tribal siren
#

im trying to make a giveawaybot, but i have one problem

#

how to randomly take a user from the reactions?

pale vessel
#

reaction.users.random()

tribal siren
#

oh

#

thanks

fair axle
#

and none of these worked 😦

ripe laurel
#

You need to await voteCheck before you log the value.

pale vessel
#

They're not returning the value properly in their function

fair axle
#

Okey, I'm confused

#

Where should I exactly put a async and await

ripe laurel
fair axle
#

I agree with you, thanks

tribal siren
#

let winner = message.reactions.users.random()

pale vessel
#

You need to get the reaction first

tribal siren
#

oh

#

there is one

fair axle
#

I'm not sure

pale vessel
#

reactions.cache.get()

fair axle
#

probably

#

yes cache

tribal siren
#
const embed = new Discord.MessageEmbed()
      .setTitle('Giveaway!')
      .setDescription(`${giveawayPrize} \n Duration: ${giveawayDuration}`)
      .setFooter(`Winners: ${giveawayNumberWinners}`)
      .setColor('BLUE')
      .setTimestamp()
    giveawayChannel.send(embed).then(e => {
      e.react('πŸŽ‰')
      setTimeout(function () {
        let winner = message.reactions.users.random()
        const winembed = new Discord.MessageEmbed()
          .setTitle(`Giveaway Ended!`)
          .setDescription(`Giveaway Winner: ${winner}\nHosted By: ${message.author}`)
          .setColor('BLUE')
          .setTimestamp()
        e.edit(winembed)
        message.author.send(`Your Giveaway Has Ended!\nhttps://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.id}`)
      }, ms(giveawayDuration));
    })```
#

so this is my code

pale vessel
#

instead if just e.react(), you can use const reaction = await e.react() and use resction.users.random()

tribal siren
#

oh

pale vessel
#

your e function needs to be async though

fair axle
#

reaction.users.random()
or
reactions.users.cache.random()

pale vessel
#

That grabs a random reaction that's not a property

tribal siren
fair axle
#

reaction.users.cache.random()

pale vessel
tribal siren
#
const reaction = await e.react('πŸŽ‰')
      setTimeout(function () {
        let winner = reaction.users.random()
        const winembed = new Discord.MessageEmbed()
          .setTitle(`Giveaway Ended!`)
          .setDescription(`Giveaway Winner: ${winner}\nHosted By: ${message.author}`)
          .setColor('BLUE')
          .setTimestamp()
        e.edit(winembed)
        message.author.send(`Your Giveaway Has Ended!\nhttps://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.id}`)
      }, ms(giveawayDuration));```
fair axle
tribal siren
#

ok

pale vessel
#

That's not valid

#

@tribal siren try adding cache

fair axle
#

It is reaction

#

not message sorry

pale vessel
#

Reaction

tribal siren
#

oh

fair axle
#

message.reactions.users.cache

tribal siren
#

me dum dum

pale vessel
#

The users property is for a MessageReaction

tribal siren
#

yay now it worked

#

thank you

fair axle
#
msg.reactions.cache.find(r => {
    r.users.cache.random()
})
#

It is a way to do this

#

I don't know how to implement a code to discord

#

There is no users property in msg.reactions because It can be too many reactions in a message, you need to iterate all the reactions before

pale vessel
#

what are you doing

fair axle
#

??

atomic vault
#

I can run normal node js code in heroku worker buildpack but i ant run discord js codes in it why? @here

twilit geode
#

why tf would you try to ping here

crimson vapor
#

poggers development today

earnest phoenix
#

light mode

#

nasty

crimson vapor
#

fixed

earnest phoenix
#

:)

crimson vapor
#

almost 2k additions in one committ

#

poggers

#

package-lock.json doesn't count

rocky hearth
#

wht is the best method to empty the same array?

pale vessel
#

array.length = 0

rocky hearth
#

Ummm, other than setting arr.length = 0

pale vessel
#

array = []

rocky hearth
#

than it would not remain same

pale vessel
#

array.splice(0, array.length)

crimson vapor
#

thats inefficient tho

pale vessel
#

don't assign it to a variable because that will return an array of deleted element

pale vessel
#

so I told him

crimson vapor
#

hmm

#

I have better way

rocky hearth
pale vessel
#

no

#

that's the fastest way

crimson vapor
#
function clearArray() {
  arr.forEach(e => {
    const index = arr.indexOf(e);
    delete index[e];
    return;
  });
  return arr;
}```
#

poggers

pale vessel
#

you can't delete an index

crimson vapor
#

you can't?

pale vessel
#

it will be empty item

crimson vapor
#

you're right

earnest phoenix
#

@crimson vapor you meant delete arr[index]?

crimson vapor
#

fuck

#

I did

pale vessel
#

remove first return ig

earnest phoenix
#

index is a number why the fuck are there [] around it

pale vessel
#

???

#

he probably forgot

crimson vapor
#
function clearArray(arr) {
  arr.forEach(e => {
    const index = arr.indexOf(e);
    delete arr[index];
    return;
  });
  return arr;
}``` improved
#

returns an empty array

pale vessel
rocky hearth
#

y r u returning back the same arr?

earnest phoenix
#

forEach vs for...of loop

pale vessel
#

because it's a function

earnest phoenix
#

which is better

crimson vapor
#

depends probably

pale vessel
#

for of

crimson vapor
#

o

earnest phoenix
rocky hearth
#

I always use forof, when I dont need index

crimson vapor
#

I use forEach

#

easier imo

pale vessel
#

if you need key, use for in

#

if you need to pass a function, use for

crimson vapor
#

css for admin page? yes or no

opal plank
#

ForEach is shit

#

It passes an anon function

rocky hearth
#

yeah, too many callbacks

opal plank
#

Its horrid in timed

pale vessel
#

it evaluates the function on every element

opal plank
#

Times*

pale vessel
#

it fucking sucks balls

hollow sedge
#

Admins matter

crimson vapor
#

because I have to write css

opal plank
#

Though i doubt theres any need to be squeezing that performance

hollow sedge
#

For what though

earnest phoenix
rocky hearth
#

forEach is also a bit dirty

pale vessel
#

for loops are cleaner imo

atomic vault
atomic vault
#

then what i have to use?

#

free

earnest phoenix
#

@atomic vault buy a vps

#

You cant get everything for free

earnest phoenix
earnest phoenix
# atomic vault no one see

why would you ping the whole half of the server to help you
just wait for a few minutes till somebody sees

atomic vault
#

i not observer in priceing that in free you get 550-1,000 dyno hours per month and Sleeps after 30 mins of inactivity, otherwise always on depending on your remaining monthly free dyno hours.

#

so i made a plane deleting and again creating account

#

i use github

#

If some one use heroku they can try these if the use free

opal plank
#

The google translate making it quite hard to understand ngl

earnest phoenix
#

@atomic vault heroku is not meant for bots

open rune
#

I dont know how do I get interaction ID, any idea?

earnest phoenix
#

I have tested my method of 24/7 bot hosting(without paying), anddddd it seems like it is online. I have used my own economy command bot.

#

I will be making my own website so you people can host yo bots 24/7 for free

opal plank
#
  1. there isnt good free hosting
  2. the ones that are "free" require credit card, dont stay up all days of the month, lack infrastructure, or are too small and shady and will likely get your token stolen.

Dont go on this "hey guys, host ur bot with me for free" type of thing. Its too shady. Use some respected site or pay for a private one

earnest phoenix
#

who tf would want to giveaway free computers

fierce ether
#
async function remove(message, queue) {
const valuesToRemove = [playerone, playertwo]
const removeplayers = queue.filter(queue => !valuesToRemove.includes(queue))
}

remove(message, queue)``` isnt removing player one and two?
earnest phoenix
#

what

fierce ether
#

should remove the players but dosent?

earnest phoenix
#

it shouldn't...?

fierce ether
#

why shouldnt it?

earnest phoenix
#

you're not removing anything anywhere in that snippet

fierce ether
#

so what do i use?

#

queue.slice(removeplayers)

earnest phoenix
#

Astrah wat u doing?

#

oop nvm

fierce ether
#

removing two ids from an array

earnest phoenix
#

ah okay

fierce ether
#

@earnest phoenix what i use to remove?

earnest phoenix
pale vessel
#

that function didn't return anything

earnest phoenix
#

they don't seem to be using any return value anyways so

pale vessel
#

can't they return removeplayers

earnest phoenix
#

sure

#

and then replace the original array with that

#

however you're creating two arrays with that

#

best is to use splice

#

fastest and most memory performant option

opal plank
#

@earnest phoenix that is precisely why its fishy. A random guy out of nowhere propheticizing about a free vps with not drawbacks? Not buying it, sorry

earnest phoenix
#

well i will make a video on it soon! check my yt on my profile, i will be giving out the codes for glitch.com!

opal plank
#

Thats just blatently advertising at this point dude

earnest phoenix
#

it is basically just a loopback for glitch.com every 4 minutes

craggy pine
#

Soooo, why not just use glitch mexShrug

earnest phoenix
#

yeah im using the glitch "ping back script"

opal plank
#

So u dont have a free host

earnest phoenix
#

or don't abuse services because you can get in actual legal trouble

opal plank
#

U have a pingbot

earnest phoenix
#

i do it is scripting

craggy pine
#

^

opal plank
#

Pingbots are against their TOS

earnest phoenix
#

hmm okay then...

#

it's not something to be messed around with

#

"haha exploiting XDDD"

#

they can sue you

#

if you're under 18, your parents are responsible

#

even if you did it

opal plank
#

Also false advertising with Free Host, breaking tos, and advertising personal platforms

earnest phoenix
#

smells like an MLM

#

which is also illegal

opal plank
#

The proper term is uptimer bots, and no, they arent allowed

earnest phoenix
#

I meant built in

#

The server.js file in their own website?

opal plank
#

Wamna get ur app 24/7? Buy their package

#

How else are they going to be making money?

earnest phoenix
#

hmm

#

They can use incoming traffic, which is like gpu mining except you are investing into a website that gains you 2x the amount for a domain. Or they could sell your data for targeted advertising.

#

kk baii

opal plank
#

Look dude, i dont give two f's about u doing sketchy shit. But you arent doing it urself, youre dragging people into it as well, and if they dont know this is against their TOS, thats when you get into problems

earnest phoenix
#

cryptojacking is not legal by any means πŸ‘οΈ πŸ‘„ πŸ‘οΈ

#

at least not where i live

opal plank
#

If you doing illegal stuff at least dont bring people down with you in ur shady bizz

earnest phoenix
#

i mean you are using the internet(which is free), google chrome could sell your data or what you search for target advertising by advertisers paying google

opal plank
#

Not like i encourage anyone to do illegal studf regardless

earnest phoenix
#

they could just have that

opal plank
#

Internet isnt free

#

Hence why u pay ur ISP

earnest phoenix
#

ik but tik tok makes money

opal plank
#

Googlr tracking can be disabled

earnest phoenix
#

mhm

opal plank
#

Which is why a lot of peopke, guess what, use linux, vpns, proxies, and a lot of shit

earnest phoenix
#

many free apps can steal your data no matter what

opal plank
#

Wrong

earnest phoenix
#

people*

#

yes many free apps sell ur dats for advertisers

#

data*

opal plank
#

Still doesnt make any right for you to come herer advertising illegal stuff

earnest phoenix
#

okay then

copper cradle
#

I mean, I don't care about my data, idc if they know I've been thinking of buying ahegao hentai keycaps Β―\_(ツ)_/Β―

earnest phoenix
#

lol

opal plank
#

We are just a number dude. You and me are both a single digit in a panel rn

earnest phoenix
#

fu nfact

#

data is the most valuable resource

#

yeah it is

opal plank
#

If you wanna be a privacy freak, have fun

earnest phoenix
#

I wish there was an ad blocker for ios

#

it sucks

opal plank
#

If im going to have ads, i prefer google knowing i like games rather than trying to sell me bra's and golfing equipment

earnest phoenix
#

use other browsers or you can set up a pihole

#

very specific items lol

#

i've been thinking of using my old laptop which is just collecting dust as a pihole

#

I heard some vpns have ad blockers on ios

#

i haven't tried it yet

rapid wave
tribal siren
#
function skip(message, serverQueue) {
  if (!message.member.voice.channel)
    const bruhembed = new Discord.MessageEmbed()
      .setTitle('Error!')
      .setTitle('You need to be in a voice channel!')
      .setColor('#bb1414')
      .setTimestamp()
    return message.channel.send(bruhembed);
  if (!serverQueue)
    const someembed = new Discord.MessageEmbed()
      .setTitle('Error!')
      .setTitle('No songs found in the queue!')
      .setColor('#bb1414')
      .setTimestamp()
    return message.channel.send(someembed);
  serverQueue.connection.dispatcher.end();
}```
elder loom
#

Uh

rapid wave
elder loom
tribal siren
#

nvm i fixed it

earnest phoenix
#

can i pass :white_check_mark: to message.react and it'll work or do i have to pass the unicode version only?

#

I can't escape emotes on mobile cuz curse discord's fucking soul

rocky hearth
#

Is this good practice to use this in class methods again and again?
or I should rather declare a const variable equal to this.

#
const _this = this;
proven ivy
#

can discord.js move categories? (new created ones are always on the top)

proven ivy
tribal siren
#

it does

#

that's my error

proven ivy
#

k

earnest phoenix
#

can anyone help?

#

first it was giving this error but now it comes online but dont respond to commands

#

even my other bot responds but this one dont

proven ivy
#

can discord.js move categories? (new created ones are always on the top)

pale vessel
#

If you want to move it, use channel.edit()

proven ivy
clever vector
#

How to fix this

earnest phoenix
#

follow the installation guide

clever vector
#

what installation guide

#

@earnest phoenix

pale vessel
#

quickdb?

earnest phoenix
clever vector
#

Its like install quick.db right

earnest phoenix
#

oh are you using quick.db?

#

if so

#

follow the same troubleshooting guide

#

but install quick.db instead of better-sqlite3

#

quickdb used sqlite internally

haughty marten
#

I'm pretty sure await can only be used in an async function

earnest phoenix
#

bruh

#

the bot ignores the space between await and require words for some reason

#

fixed

#

but now i have a new problem

await msg.react("βœ…");
		await msg.react("❌");
		
		let filter = (reaction) => (reaction.emoji.name == "βœ…" || reaction.emoji.name == "❌") && !reaction.me;
		let collector = msg.createReactionCollector(filter, { time: 12000, max: 1 });
		
		collector.on("collect", reaction => {
			console.log(reaction);
			if (reaction.emoji.name == "βœ…") {
				message.guild.emojis.create(emoteData.image, emoteData.title).then(emote => message.channel.send(`Created new emote with name ${emote.name}`));
			} else {
				this.execute(bot, message, args, errorHandler);
			}
		});

the collector never logs anything in the console or throws any errors

#

i clicked the reactions and it doesn't do anything

pale vessel
#

do you have the guild message reactions intent?

earnest phoenix
#

@pale vessel no

#

how do i enable it

pale vessel
#

clientoptions

#

if you didn't define intents then it should be enabled by default

earnest phoenix
pale vessel
#

well idk, try defining intents

earnest phoenix
#

ok

#

wasn't there a intents generator

pale vessel
earnest phoenix
#

thanks

#

I got the number

#

5641

pale vessel
#

yo is that a sauce

earnest phoenix
#

Now i just need to pass the number to Discord.Client({ ws: { intents: ... }}); right?

pale vessel
#

tias

earnest phoenix
earnest phoenix
fierce ether
#

how do i set up custom domain?

tired panther
#

How do I get the Id when I create role.
I know I have to resolve the promise . Can someone check the code below

let crole = await message.guild.roles.create({ data: { name: 'Remind ME', permissions: ['VIEW_CHANNEL'], mentionable: true } });

SO how will I resolve the promise?
earnest phoenix
#

the promise is resolved when you use await

#

crole is a Role object

deep spear
#

where can we advertised here?

earnest phoenix
#

nowhere

deep spear
#

thats not great

#

it says advertisement but nothing to add

earnest phoenix
#
conn = sqlite3.connect('voice.db')
        c = conn.cursor()
        guildID = ctx.guild.id
        id = ctx.author.id
        if ctx.author.id == ctx.guild.owner.id or ctx.author.id == 151028268856770560:
            def check(m):
                return m.author.id == ctx.author.id
            await ctx.channel.send("**각 μ§ˆλ¬Έμ€ 60초 λ™μ•ˆ λ‹΅ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.**")
            await ctx.channel.send(f"**채널을 λ§Œλ“œλ €λŠ” μΉ΄ν…Œκ³ λ¦¬ 이름을 μž…λ ₯ν•˜μ„Έμš”!:(e.g Voice Channels)**")
            try:
                category = await self.bot.wait_for('message', check=check, timeout = 60.0)
            except asyncio.TimeoutError:
                await ctx.channel.send('λ‹΅λ³€ν•˜λŠ”λ° λ„ˆλ¬΄ 였래 κ±Έλ ΈμŠ΅λ‹ˆλ‹€!')
            else:
                new_cat = await ctx.guild.create_category_channel(category.content)
                await ctx.channel.send('**μŒμ„±μ±„λ„ 이름 μž…λ ₯: (e.g Join To Create)**')
                try:
                    channel = await self.bot.wait_for('message', check=check, timeout = 60.0)
                except asyncio.TimeoutError:
                    await ctx.channel.send('λ‹΅λ³€ν•˜λŠ”λ° λ„ˆλ¬΄ 였래 κ±Έλ ΈμŠ΅λ‹ˆλ‹€!')
                else:
                    try:
                        channel = await ctx.guild.create_voice_channel(channel.content, category=new_cat)
                        c.execute("SELECT * FROM guild WHERE guildID = ? AND ownerID=?", (guildID, id))
                        voice=c.fetchone()
                        if voice is None:
                            new_cat = await ctx.guild.create_category_channel("VOICE CHANNEL")
                            channel = await ctx.guild.create_voice_channel("Join to Create", category=new_cat)
                            c.execute("SELECT * FROM guild WHERE guildID = ? AND ownerID=?", (guildID, id))
                            voice=c.fetchone()
                             c.execute ("UPDATE guild SET guildID = ?, ownerID = ?, voiceChannelID = ?, voiceCategoryID = ? WHERE guildID = ?",(guildID,id,channel.id,new_cat.id, guildID))
                        ```
#
await ctx.channel.send("**λͺ¨λ“  μ„€μ • μ™„λ£Œ! μ‚¬μš©ν•  μ€€λΉ„κ°€ λ˜μ—ˆμŠ΅λ‹ˆλ‹€!**")
                        else:
                            c.execute ("UPDATE guild SET guildID = ?, ownerID = ?, voiceChannelID = ?, voiceCategoryID = ? WHERE guildID = ?",(guildID,id,channel.id,new_cat.id, guildID))
                        await ctx.channel.send("**λͺ¨λ“  μ„€μ • μ™„λ£Œ! μ‚¬μš©ν•  μ€€λΉ„κ°€ λ˜μ—ˆμŠ΅λ‹ˆλ‹€!**")
                    except:
                        await ```
pale vessel
earnest phoenix
#

please stop spamming blocks of code

#

nvm hastebin is down again

#

Humm...

#

c.execute ("UPDATE guild SET guildID = ?, ownerID = ?, voiceChannelID = ?, voiceCategoryID = ? WHERE guildID = ?",(guildID,id,channel.id,new_cat.id, guildID)) ^ IndentationError: unexpected indent

tribal siren
#

what do you need the client secret and public key for?

#

i just can't find the info on the net..

solemn jolt
#
message.channel.fetchMessage().forEach(m => {})

Why i have a error in forEach
Discord.js v11

pale vessel
#

you have to await the promise or use .then()

#

why are you using v11 anyway

solemn jolt
#

I have a private reson for this 🀧 πŸ”«

#

But why i can't forEach this?

pale vessel
solemn jolt
#

Ok i'll try

gaunt ermine
#

Topp.gg sucks cuse i put a bot but it does not hav much of commands so to fill the long description i just filled spaces so wat is wrong. U'll suck topp.gg

earnest phoenix
#

have you thought about the fact that maybe you're the problem

#

nvm they're gone

#

awh

#

Is that possible never end session on node express and never logout after restart or anything ?

queen crescent
#

whats the most efficient way to make an automessage which is configurable via a web dashboard?

#

ive done all the web dashboard, just need to setup the auto message it self

earnest phoenix
earnest phoenix
queen crescent
#

why would you need to clear int

earnest phoenix
#

because people might want to delete the automessage or edit it

#

both of which require you to delete the old one and make a new one

#

use react for the dashboard

#

πŸ‘

queen crescent
#

can u show an example of how you would do it?

tribal siren
earnest phoenix
# queen crescent can u show an example of how you would do it?
// lets say youre using the express server framework to make the server for the dashboard
// in your express app
app.put("/create_automessage", (req, res) => {
// create the interval
});

app.delete("/delete_automessage", (req, res) => {
// delete the interval
});

app.put("/edit_automessage", (req, res) => {
// delete the interval
// create a new one with the edited data
});
#

And also you'll need OAuth to identify users in your dashboard

queen crescent
#

yh the dashboard is fully done with the oauth etc

earnest phoenix
#

Ok

queen crescent
#

what would i put in /edit_automessage etc

earnest phoenix
#

That part you have to figure out cuz idk oauth

#

Why my bot goes offline after 5 minute?

#

I host it in terminal

#

@earnest phoenix i mean i have a dashboard for my bot and and there is a issue "its logout me automatically after restart my browser"
it mean session is not alive after restart browser

queen crescent
#

@earnest phoenix what do u use to store the session? i use mongostore and it remembers it for a long time (connect-mongo)

earnest phoenix
#

Wait a sec

#

@earnest phoenix are you using http cookies to store the user oauth token on the user browser

#

make sure they're not set to expire after some time

#

@queen crescent im using MemmoryStore

#

the issue is on the frontend not backend

queen crescent
#

@earnest phoenix try using connect-mongo

earnest phoenix
#

if people are being logged out that means the browser is deleting info about the site so the site cant identify the browser

queen crescent
#

@earnest phoenix would this just be the url to where the user configures the automessage then?

earnest phoenix
#

@queen crescent can you send me code of session part please ?

queen crescent
earnest phoenix
#

@queen crescent yep and send the data in the correct format through http PUT and DELETE requests

queen crescent
#

alright, and delete would delete all intervals, right?

earnest phoenix
#

depends on how you make it

#

i just gave you a boilerplate code

earnest phoenix
#

@earnest phoenix no he was talking about his own stuff

#

Sorry wrong reply

earnest phoenix
#

Yes

#

You're probably storing the OAuth token in cookies

#

Hmm

#

Those cookies are set to expire after the browser closes

queen crescent
#

@earnest phoenix would it start an interval every time someone loads the page tho?

earnest phoenix
#

what is the problem?

proven ivy
earnest phoenix
#

@earnest phoenix can i save cookies with auth any other side like db or something ?

earnest phoenix
proven ivy
#

oof

earnest phoenix
#

Holy. i know the problem

cosmic minnow
#
const Discord = require('discord.js');
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('TOKEN', client);

client.once('ready', () => {
    console.log('NodeJS Hosting');
    console.log('Bot Status: Online!');
    console.log(bot_version);

    setInterval(() => {
        dbl.postStats(client.guilds.size);
    }, 1800000);

    client.user.setActivity("/help", {type:"WATCHING"});
    welcome(client)
    onadd(client)
});
    dbl.on('posted', () => {
        console.log('Server count posted!');
      })
    dbl.on('error', e => {
        console.log(`Oops! ${e}`);
       })

where i added that code part my bot does not go anymore online

earnest phoenix
#

what

#

can you try to rephrase that to be in more... comprehensive english

cosmic minnow
#

my bot does not go online anymore

earnest phoenix
#

judging from that snippet