#development

1 messages · Page 1579 of 1

agile lance
#

it works for like for loops but i still dont use it

quaint wasp
#

..

agile lance
#

...

quaint wasp
#

ye..

agile lance
#

Did you not define it

dusky sundial
#

You won't learn much by just "watching tutorials". You need to actually learn what they're telling you.

quaint wasp
#

I guess I am a dumbass....

#

I cant deffine a message...

sterile lantern
#
* Installation completed.
* Make sure you create the node within the panel and then copy
* the config to this node. You may then start the daemon using 
* systemctl start wings
* 
* Note: It is recommended to enable swap (for Docker, read more about it in official documentation).
* Note: This script does not configure your firewall. Ports 8080 and 2022 needs to be open.
######################################################################```

im tryna deploy pterodactyl but this happens
#

This happened the first time lemme get what it showed the second time

agile lance
#

module.exports = { name: "7", run(client, message, args) => { // code });

glossy spoke
solemn leaf
#

@mellow kelp uh variable and constant

dusky sundial
solemn leaf
#

@quaint wasp learn js

sterile lantern
#

##############################################################

  • Pterodactyl Panel successfully installed @ endernodes.gq
  • Installation is using nginx on ubuntu
  • Thank you for using this script.
  • Note: If you haven't configured the firewall: 80/443 (HTTP/HTTPS) is required to be open!
    ##############################################################
#

Yea

quaint wasp
#

I am trying to...

sterile lantern
#

But it didn’t install

agile lance
#

carry on with coding

sterile lantern
#

It won’t deploy on the website

#

I’m using cloudfare

agile lance
#

use f5

#

f5 to refresh

sterile lantern
#

To refresh what?

dusky sundial
#

ctrl + f5 to refresh the cache as well

sterile lantern
#

The website?

agile lance
#

ye

sterile lantern
#

I already did

agile lance
#

Try closing the website, restarting your pc to clear cookies and cache data

sterile lantern
#

Cloudfare returns a 503 when trying to run the speed test as well

#

The only DNS records I have is the VPS IP which the domain points to and a CNAME for www

quartz kindle
#

lets try again

#

you have a command in a file, right?

#

and inside that file, you have a function called, execute, right?

quaint wasp
#

yes.

quartz kindle
#

so

#

inside that file, you are CREATING the function

#

and in your main file, you are CALLING the function, which means you're using it

quaint wasp
#

yes...

quartz kindle
#

when you CALL a function, its like you're sending things into it

#

and in the file where you CREATE it, is where you receive the things

#

so in your main file

#

you do execute(client, message, args) right?

quaint wasp
#

yes.

quartz kindle
#

that means you are SENDING client, message and args, to the function in your file, IN THAT ORDER

glossy spoke
#

it's like remoting executing that at the function's file

quaint wasp
#

oh

quartz kindle
#

so in the commands file, you are RECEIVING client message args, IN THE SAME ORDER

#

BUT

#

in the RECEIVING END, in the command file, you can RENAME them whatever you want

#

but they are still client, message, args IN THAT ORDER

quaint wasp
#

& ?
How is that useful?

quartz kindle
#

show your command file again

quaint wasp
#
const Discord = require('discord.js');
let guild = message.guild;

module.exports = {
    name: 'server-info',
    execute(client, message, args) {
  


        const Discord = require('discord.js')
        const sEmbed = new Discord.MessageEmbed()
          .setColor('#27FF00')
          .setTitle('Server Infromation')
          .addField(`Members in this server: ${guild.memberCount}`)
          .addField('ID:', guild.id)
          .addField(' ')
          .setFooter('Type **++help** for help! Time:')
          .setTimestamp();
    
        message.channel.send(sEmbed);

      }
}

quartz kindle
#

which one did you send first in your main file?

#

client or message?

quaint wasp
#

Client.

opal plank
quartz kindle
#

alright, so here, message should work

#

now that you have a WORKING message

mellow kelp
quartz kindle
#

you can get a guild FROM a message

#

using message.guild

quaint wasp
#

so that should go AFTER that?

quartz kindle
quaint wasp
#

I know that..
I learned something from watching one 3 hour vd..

quartz kindle
#

that should go wherever you want to use it

#

for example here .addField('ID:', guild.id)

quaint wasp
#

oh..

quaint wasp
#

so I dont really need message. everywhere..

opal plank
quartz kindle
#

message.channel.send(sEmbed);

quaint wasp
#

there.. I know.

mellow kelp
quartz kindle
#

and message.guild.id

opal plank
earnest phoenix
#

they said come here so

rustic nova
#

What do you mean with how to make dsl work tho

quaint wasp
#

wow.. I actiualy fixed that thing...

#

But now..

#

Its invalid body.

crystal lance
#

What does the public key do?

#

isnt that just so people can edit commands?

quartz kindle
#

invalid form body means you did something wrong in your embed

#

lets see

mellow kelp
#

i think it's the addField method

opal plank
#

.addField(' ')

#

because of this

quaint wasp
mellow kelp
#

you just added a space

quaint wasp
#

OH.

crystal lance
#

Oh?

quaint wasp
#

I forgot to take that of.

#

After I deleted the message in it..

#

and couldnt come up with anything to put in there.

mellow kelp
#

yeah

#

there's also Bot <TOKEN> for bots

quartz kindle
mellow kelp
#

apart from getting the token, nothing else really

earnest phoenix
mellow kelp
#

once you have the token it's already possible to use it

crystal lance
quartz kindle
crystal lance
#

Aint showing the whole thing

#

incase yk its important

quaint wasp
distant cobalt
umbral zealot
#

figure out what db is and what functions it does have?

#

what's db?

crystal lance
#

discord bot probably

quaint wasp
#

yeah

umbral zealot
#

no I'd assume it's database

#

but what database

distant cobalt
#

db is database

crystal lance
#

o

earnest phoenix
#

no worries i’m just gonna remove it to much hassle

umbral zealot
#

Ok but what database

#

what database module

distant cobalt
#

quick.db

crystal lance
#

Database is something that stores data used.

umbral zealot
#

ok well quick.db doesn't have a get function

#

you should read the docs thumbs_up

crystal lance
#

So like a command used it would go to the database

distant cobalt
umbral zealot
#

oh wait did they rename fetch() and break it again MarioFP

#

show us how you defined db in that code

distant cobalt
quartz kindle
# crystal lance

im not aware of what you can use it for, but a public key is a key to encrypt data. data encrypted by the public key can only be decrypted by its corresponding private key, and not by itself

umbral zealot
#

they used to only have fetch() but I guess they needed it closer to enmap's features lol

#

Show us how you define the db variable, exactly

#

in spells.js

crystal lance
quartz kindle
#

if you have the public key, you can encrypt data

crystal lance
#

Ohoh

quartz kindle
#

if you have the private key, you can decrypt it

mellow kelp
#

pog

#

but what data does that public key hold?

umbral zealot
#

It's like having 2 keys to a box, and you can only send things one way in the box, and one key doesn't work on the other side of the box. 😄

rustic nova
umbral zealot
mellow kelp
#

i mean

#

which data is it used on

umbral zealot
#

Any data.

quartz kindle
#

whatever data you want to encrypt

umbral zealot
#

Public and private keys can encrypt/decrypt anything

quartz kindle
#

so i dont know what discord uses it for

umbral zealot
#

(well, anything they've been used on)

quartz kindle
#

probably for internal things

mellow kelp
#

yeah

dusky sundial
#

It's a very common way to store password. It means that even if you hack into the password database you'll only see encrypted passwords and you can't read them unless you find the private key

umbral zealot
#

No, that's not how passwords are stored.

mellow kelp
#

bcrypt coolflushed

umbral zealot
#

Passwords are hashed and salted, not encrypted. They are not decryptable. They are not readable.

quartz kindle
#

passwords are hashed, not encrypted ^

dusky sundial
#

What would be the difference?

umbral zealot
#

The difference is hashing cannot be "undone"

#

The only way to have to check if a password is valid is to salt/hash the password being used and compare the 2 hashes.

mellow kelp
#

that's why you can't get your previous password from a website

#

you can only change it

umbral zealot
#

Exactly.

#

Unless you have a website or system that's absolutely fucking horrible and managed by monkeys in suits that don't give a fuck about your security 😉

mellow kelp
#

(unless the website doesn't encrypt passwords, in which case GET THE HELL AWAY FROM THERE)

quartz kindle
#

imagine you have a mirror, you throw this mirror on the ground and shatter it. then you take a picture of the result

#

thats the hash

#

you cannot put the mirror back together

dusky sundial
#

I thought things like password managers used your master password as an encryption key and stuff

quartz kindle
#

you dont even have the actual glass pieces

quartz kindle
#

you just have a picture of it

umbral zealot
#

passwords managers, yes, they do encrypt, because they need to store it

#

And your master password is used to decrypt it

dusky sundial
#

Yeah that's where I got it from then, my bad

umbral zealot
#

but we're comparing cars and trains here - two different purposes

opal plank
#

i think its done

#

the port is done

#

small bugs here and there, but its all somehow working

mellow kelp
#

my guess is that your 40 is not valid

trim saddle
#

@opal plank have you tried getting better

opal plank
trim saddle
#

am i? i never noticed

opal plank
#

lucky you the notification still pinged me

trim saddle
#

trying to figure out what reason you would have to block me but ok

opal plank
#

both me and xetera

#

and some other users i've seen you treating with similar entitlement

trim saddle
#

hm.

solemn leaf
#

sounds stupid

#

Im more worried about

trim saddle
#

i didn't realize i was such an ass

solemn leaf
#

HI Guys I Need Help

lyric mountain
#

What would 40 even mean in a cronjob?

trim saddle
#

sometimes i get impatient or misunderstand answers to the point of being angered, but i'm honestly sorry

blissful coral
#

Ever want to punch your monitor because your d.js doesn't work?

#

Yeah, me too

solemn leaf
#

No

lyric mountain
#

That place is for hours iirc

solemn leaf
#

there is always a fix @blissful coral

lyric mountain
#

Maximum 24

opal plank
blissful coral
#

Me neither

#

Use my own lib now

#

lmao

trim saddle
#

@opal plank whether you choose to forgive or not, know i don't wanna make you or anyone feel like shit

opal plank
#

im using detritus now

marble juniper
#

I don't use djs anymore

#

I use djs-light

opal plank
#

d.js straight up garbo

marble juniper
#

kekw

solemn leaf
#

dont start by making a discord bot start by making your own lib for discord then make a discord bot on that libbigbrain

marble juniper
#

tim's modified djs is kinda hot

#

lol

marble juniper
blissful coral
#

Uh

#

hm

opal plank
#

this is the difference using a different lib yielded

blissful coral
#

well

marble juniper
#

lol

opal plank
#

2gb reduction

marble juniper
#

3gb

#

kekw

opal plank
#

from 3gb to 1gb, 1700 server, 400k users

opal plank
marble juniper
#

my bot uses multiple gigabytes of ram

#

but thats not because of djs

#

its because of my ai

#

kekw

opal plank
#

the only difference in those 2 screenshots is the lib

#

the 3gb is using d.js

#

the 1gb is using the ts lib

marble juniper
#

k

opal plank
#

djs never again

#

bye js

#

welcome ts

marble juniper
#

I don't like typescript

#

I hate it

opal plank
#

ts is the only thing that makes js bareable

marble juniper
#

that sounds like the worst statement I have heard in here

solemn leaf
#

Js was for web development I dont know why you guys expect so much out of it

marble juniper
#

thats not true

opal plank
#

quite the opposite

marble juniper
#

bruh

#

sounds like bias

opal plank
#

imagine spending weeks fixing bugs based on user feedback or errors

#

imagine not catching bugs before even compiling

#

imagine not getting integrated intellisence

mellow kelp
#

imagine not using intellisense

opal plank
#

image not being able to compile code to older browsers and newer systems with transpilation

solemn leaf
#

imagine not having a ide

mellow kelp
#

typing is the easiest thing ever

#

: string

opal plank
#

imagine not using latest node features

#

if you using vanilla js, you should be on tim's level to be doing decent coding without aid from your IDE

mellow kelp
#

imagine having runtime type errors

solemn leaf
#

volt doesnt even have an ide

opal plank
solemn leaf
#

silly errors

opal plank
marble juniper
#

I will never ever touch typescript

solemn leaf
#

this isnt really a channel about which lang is better

marble juniper
#

not worth it

opal plank
#

just watch the damn video

marble juniper
#

I reFuSe!

opal plank
#

well, enjoy being a caveman then

solemn leaf
#

erwin

#

you are the cave person

opal plank
#

imagine being so stubborn you refuse to simply watch a 100 second video to then say "well, i dont like it"

mellow kelp
#

i mean

#

how hard is it to add a couple of types

#

most stuff gets inferred

opal plank
#

he spends the first minute just telling you why ts is good with real examples

#

after you get past the first minute, then he starts telling you how to use stuff

jolly mortar
#

what can i use eval commands for

opal plank
solemn leaf
#

@jolly mortar testing code but you dont really need one

jolly mortar
#

i got a eval system on my bot but have no clue what to use it for hashflushed

#

oh

#

thanks

solemn leaf
#

Say like reload

opal plank
#

eval is really handy for debugging

solemn leaf
#

you can use it to reload commands

opal plank
#

like REALLY handy

#

specially for getting out of scope variables

solemn leaf
#

this

marble juniper
#

I mean

jolly mortar
marble juniper
#

I watched the video already anyways

#

smh

#

but well

#

I still dont get it

solemn leaf
#

link

marble juniper
#

sure you can set typings and stuff

opal plank
#

if you can ACTUALLY say you dont like after all the features it provides, thats on you, i wont judge

solemn leaf
#

wannna stay ts virgins?

marble juniper
#

and you get errors ahead of time

opal plank
#

but i'd like you to at least know why ts is good and what its used for

jolly mortar
marble juniper
#

but why do I care about that

#

lol

opal plank
#

so you dont spend 4 weeks debugging coding

#

just 2 days

#

imagine a command you wrote is wrong

marble juniper
#

im not stupid enough to make common mistakes

opal plank
#

that same argument goes as: why you use vsc?

#

why dont you use notepad++ to code?

solemn leaf
#

if it takes 4 weeks to debug something you ight need mental health

opal plank
#

or straight up notepad?

marble juniper
#

vsc is more convenient

opal plank
#

same for ts

marble juniper
#

but

#

vsc is not fast

opal plank
#

ts is there to help you assuring you dont make mistakes

solemn leaf
#

intelli

marble juniper
#

vim makes you code faster

opal plank
#

then code in notepad

#

¯_(ツ)_/¯

marble juniper
#

so vsc is obsolete if you know vim

opal plank
#

code in nano or notepad then

#

without any extensions or aiding tools

marble juniper
#

vim is technically better

solemn leaf
#

@opal plank I code on an apple 2 running memo v0.01

lyric mountain
#

Second slot then, not the third

opal plank
#

yikes

marble juniper
#

you only use a keyboard in vim

#

no mouse involved

lyric mountain
#

Cronjobs are second-precision

opal plank
#

well, either way, you saw all the tools it provides you, remember that any valid js code is valid ts

#

theres no learning curve

#

you can set your tsconfig to be lax so it wont scream about your code

solemn leaf
#

no body cares erwin

#

but you

mellow kelp
#

bruh

opal plank
#

im not here to only talk to you

solemn leaf
#

maybe el kuu and oliy

opal plank
#

whoever wants to know about ts, i'll gladly introduce them to it

quartz kindle
#

erwin is a missionary from the church of ts

opal plank
#

its a great tool that offers great rewards

mellow kelp
#

seriously

#

using js is playing web dev in hardcore mode

solemn leaf
#

just use c#

#

actually how many people ask for help in here daily on lua

marble juniper
quartz kindle
#

you cant use "daily" for lua

opal plank
quartz kindle
#

more like twice per month

marble juniper
opal plank
#

i use prettier

marble juniper
#

requires no setup

#

lol

#

or prettier

opal plank
#

instead of eslint

solemn leaf
#

@quartz kindle dam lua dyin

marble juniper
#

I use prettier with eslint

#

as a fun fact

opal plank
#

its just personal pref

mellow kelp
#

i just use prettier most of the time

#

bad thing is it doesn't catch unused imports

#

because, well, it's just prettier kekw

marble juniper
#

but does prettier make the code actually prettier

opal plank
#

mine does catch unused stuff

lyric mountain
#

Search "cronjob generator" on google, there are a plenty of tools to help u setup cron

opal plank
#

its mainly what i use for tree shaking

marble juniper
#

eslint catches a lotta stuff for me ahead of time

mellow kelp
#

a lot prettier

marble juniper
#

lol

#

also I love that I can just use the wonderful auto fix button in vsc to 99% of errors automatically

jolly mortar
#

i got a purge command for my bot and when they trigger the fail response it keeps on spamming and i cant find out where i left out a braket KEKW

marble juniper
#

with eslint that is

#

its just S3AkatsukiGasm

mellow kelp
#

ah yes

#

i just remember another reason why i love ts

#

Add all missing imports

quartz kindle
#

who the heck codes first and imports later

mellow kelp
#

it's for when i copy and paste small chunks of code

quartz kindle
#

makes sense

marble juniper
mellow kelp
#

oh yeah code snippets

#

really handy for react

jolly mortar
marble juniper
#

what if I used vue

mellow kelp
#

yeah vue too

#

i tried it once and the snippets were useful

fresh verge
#

How does vote detection work?

opal plank
#

im assuming you mean top.gg votes

mellow kelp
#

beeg commit

opal plank
#

full rewrite

mellow kelp
#

this is how it's gonna feel like after i rewrite all my command objects into classes

#

oop gang

crystal wigeon
#

hey umm

#

redis error says max connections reached, but i have like 10k max connections..

#

does it have something to do with how frequently the redis.set and redis.get are?

dusky sundial
#

You could check it with info clients in the redis cli

crystal wigeon
#

yeah there's only 1 worker connected to it

dusky sundial
#

Are you instancing a new connection with every request?

crystal wigeon
#

nop

#

i have a global connection

#

but i have 3.5k users that access get and set like many times

#

that shouldn't be an issue tho

dusky sundial
#

You could try increasing the max clients to like 100k and see if that fixes it

fresh verge
opal plank
solid cedar
#

i have a problem with the vote for server thing

twin willow
#

How do you keep a bot online 24/7

#

?

solemn leaf
#

vpos

#

check pinned messages

twin willow
solemn leaf
#

why ping you little

fresh verge
#

Where exactly would I create a webhook? Like what server would I create the webhook in for my webhooks tab in my bot on the website?

solemn leaf
fresh verge
solemn leaf
umbral zealot
solemn leaf
#

holy stop pinging me

#

that is what Im gettign at

#

this is like the 5th person this hour I told not to ping me and they end up pinging me

umbral zealot
#

If you're not happy with being pinged, go ahead and disable mentions here - or stop interacting with people.

mellow kelp
#

then tell them to stop pinging you directly pEnSiVe

solemn leaf
#

I have

mellow kelp
#

ez

umbral zealot
#

Discord is all about pings, like literally it happens 50 time a day for me, live with it, or mute everything, geeze.

solemn leaf
#

actually

#

this is the only server out of my 20 that I get pinged on

umbral zealot
#

Great. Nobody cares.

#

Stop raising drama for crap like this.

solemn leaf
#

Imma just start blocking people that ping me

oak cliff
#

-m 485987127809671168

umbral zealot
#

You do that thumbs_up

gilded plankBOT
#

🤐 Muted 【↜𝒜𝓀𝒾↝】#9470 (@solemn leaf)

glossy spoke
#

lol

mellow kelp
#

kekw

fresh verge
#

So?

mellow kelp
#

oh yeah

#

well you should probably host the webhook along with your bot

#

in whatever vps or service you're using

fresh verge
opal plank
# fresh verge Where exactly would I create a webhook? Like what server would I create the webh...

a webhook is basically a server listening for events

imagine the following

  1. user votes
  2. top gg recieves votes
  3. top gg sends a notifaction to an IP (that you can put ur bot/webserver)
  4. the event that a user voted reaches that IP (your server or bot)
  5. you then store the ID of the user who voted, along with the timestamp

with that data stored in a database, or somewhere persistent, you can then query and search if your users voted or not

fresh verge
#

So I create the webhook within the code, and not a discord server?

opal plank
#

correct

#

so when it triggers on the code, you simply store what comes from it somewhere in a database, for example

#

i assume you use discord.js, correct?

fresh verge
#

Yes.

opal plank
#

okay, so imagine this

#

the same way you have ```ts
client.on('message', (message) => {/logic here/})

#

you would use the same, but with a webhook

#
webhook.on('vote', (vote) => {/*Vote logic here*/})
#

the link that i sent you before covers all that

#

here

fresh verge
opal plank
#

check that link

#

it gives you a snippet that you can check out

fresh verge
#

Is the webhook auth the url, or?

mellow kelp
#

it's a password to check that requests come from top.gg itself

#

it can be pretty much anything as long as it's decently secure i guess

fresh verge
#

So how would I get do I get the webhook link/url when I create a webhook via code?

opal plank
#

after you created the webhook,it would be the ip + the port you listening on

#

in the example on the docs, they use port 80

#

which is not recommended

#

so it would be

#

YOUR_IP_HERE:80/dblwebhook

glossy spoke
#

Why port 80?

opal plank
#

doesnt need to be an IP, you can use a domain that fowards to an ip too

glossy spoke
#

Isn't better port 443?

opal plank
#

cuz port 80 is default for borwsers

umbral zealot
#

It's just the default http port.

opal plank
#

and a lot of shit

umbral zealot
#

Unless you have certs you can't use 443.

opal plank
#

you'll be getting bombarded with requests there

umbral zealot
#

Basic web dev

opal plank
#

bad idea overall to use both of those ports and a couple other common ones

glossy spoke
#

Ik

fresh verge
#

What if I am hosting my bot via files on my pc and not a service, what port would I use?

opal plank
#

20, 23, 25, 53 are a couple i remember back of my head

opal plank
#

use your ip instead

umbral zealot
opal plank
#

IP:port/path

umbral zealot
#

Because that's a lot to unpack, really.

opal plank
#

lets say my ip is 177.77.77.88

#

and im using port 3000

#

you'd put http://177.77.77.88:3000/dblwebhook on top gg

umbral zealot
#

Lol and then you explain how to unblock router ports next, Erwin? Hehe

opal plank
#

yeah theres that too lmao

#

you need to have TPC ports open

#

i dont think you need UDP

umbral zealot
#

Sorry, I should not interrupt your helping. Carry on.

opal plank
#

could be wrong though, but i think TPC is the only one needed

mellow kelp
#

yeah, unless you wanna say "bye bye data"

opal plank
#

@fresh verge TLDR;

copy that snippet
replace app.listen(80) to any port you want, 3000 for example

open THAT SPECIFIC port on your router, choose TCP

go to top.gg, on the webhook, put http:YourIPHere:3000/dblwebhook

and you should ahve yourself a webhook listening to votes

cerulean pebble
#

F i can not edit my bot on top.gg

umbral zealot
#

why not

cerulean pebble
#

@umbral zealot loading status

#

but oke now ://

near stratus
near stratus
#

I mean the button
I can add the Join Discord button but have no Idea about the Add ...... button.
NVM I already googled it out

opal plank
#

Thats SDK

#

RPC has been deprecated for quite some time, so im using SDK instead

earnest phoenix
#

Hey how to make a inventory for a user

#

??

opal plank
earnest phoenix
#

Can you explain

opal plank
#

database table
|id | money | apples |
| 1235 | 10 | 2 |
| 5555 | 20 | 41 |

#

where ID is their discord id, to make sure its unique

earnest phoenix
#

Iam a JS

#

i mean JavaScript

opal plank
#

me too, its not related to js

#

its a database

earnest phoenix
#

oh

opal plank
#

you'll need a database to store your data

#

if you store everything in memory you'll lose all of it once your bot restarts

#

so you need a database to keep all data stored

earnest phoenix
#

This is correct?
```db.set(inventory.${message.author.id}, { cf: 0, am: 0, amp: 0, ufo: 0 });

if (message.content === "5!inventory") {
const cf = db.get(inventory.${message.author.id}.cf);
message.channel.send(**__Your Inventory__**\n\n- **cf**:${cf}\n);
}```

opal plank
#

i assume thats quick.db

earnest phoenix
#

Yep

#

Its a quick.db

opal plank
#

i only use Posgtres and cassandra, so im not sure how quick.db deals with that sort of stuff

#

but it looks about right

earnest phoenix
#

ok

opal plank
#

idk if get is a promise though

#

most databases are promise based

glossy spoke
#

quick.db is like EasyDB

earnest phoenix
#

@umbral zealot Sorry for pinging Please tell me how to set cooldown for a command

proven lantern
#

anyone else getting this error when connecting their bots?
Discord bot failed to initialize. Top.GG API Error: 502 Bad Gateway

glossy spoke
#

Wich of the discord libraries was created first? discord.js, discord.py, javacord...

summer torrent
#

Thonk why do you want to know that

willow mirage
#
module.exports = (client, message) => {
    try{
        await client.snipe.set(message.channel.id, {
            content: message.content,
            id: message.author.id,
            time: new Date(),
            embed: message.embeds.length > 0 ? message.embeds[0] : null
        });
        console.log(client.snipe)
    }catch(e){
        return require('../../tools/functions/error')(e, message);
    }
}

This dude is not even console.loging

#

No error

#

nothing

pale vessel
#

why await

willow mirage
#

oh

earnest phoenix
#

Hey how to set a cooldown for a command?

sudden granite
#

how to fix?

(node:2362) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 26 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(node:2362) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 26 disconnect listeners added to [VoiceConnection]. Use emitter.setMaxListeners() to increase limit

earnest phoenix
opal plank
opal plank
#

actually its not even message

#

its all under VoiceConnection and unhandled rejections

#

process.on('unhandledRejections')

#

the heck you doing on ur code mate?

sudden granite
opal plank
#

its ur second one, never put event listeners inside your commands

#

everytime you run a command, it ends up creating a new listener

#

thats a memory leak

#

@sudden granite

sudden granite
#

oof.

opal plank
#

dont EVER use .on inside a loop or a command

sudden granite
#

what should i change .on to what?

#

like alternatives to .on

#

new to developing :/

opal plank
#

you're using that as a catch block

#

you either use a catch block or a .catch

#
try {
//code
} catch(error) {
//handler error
}
#

or

sudden granite
#

so i need change .on to .catch?

opal plank
#
<Promise>.catch(error => {/*handle error*/})
sudden granite
opal plank
#

@sudden granite Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

#

you MUST know the basics before you make a bot

#

i recommend the last link

eternal osprey
#

i am trying to install a Discord.Net.Rest package

#

but it gives me the error: Please specify a path.

true ravine
#

For the question on the discord verification form about deleting data, am I allowed to say that I will retain some data (a user ID, the number of warnings they have and whether they have been blacklisted) even if the customer requests all their data to be deleted, or is that a no no?

rustic nova
true ravine
#

Ah okie thank you

summer acorn
#

@summer torrent the 1 day ratelimit has just been lifted, so now it can run, but now I am suddenly getting 429'd 😩

summer torrent
#

🤔

summer acorn
#

I don't know if this could be the reason, since it just uses cache, but I am not sure

tired panther
#

show me the function lol

earnest phoenix
#

how can i add the bot to the server

tired panther
#

createGuildstofact

summer acorn
#

makes sure that any servers that it was added to, when it was offline, will be added to the database that it uses to check whenever a server will get a fact

tired panther
#

what does guildstoFact do?

summer acorn
#

it's an array

#

of guilds' ids

tired panther
#

probably it slows up the start process

summer acorn
#

so that way I can save resources

#

and won't have to use client.guilds.cache.forEach() every minute

#

I mean, the error code is 429

tired panther
summer acorn
#

heh

#

when I used forEach on the guilds, the ram went extremely high

#

with this, I just use the id to find in the main db

#

and then check the time

#

if they are supposed to get a fact within the next minute

#

I set a timeout with res.time-Date.now()

#

and that is how it can be done in an optimized way

#

according to Tim, that is

#

I got help from him with optimizing it back when it took way too much resources

earnest phoenix
#

also forEach is shitty

#

use a for loop whenever you can

summer acorn
#

forEach is usable at times

#

let's say you're using multiple variables from arrays within an array

#

forEach is a good option

earnest phoenix
#

you can also just for loop it

summer acorn
#

rather than constantly doing like arrInArr[0] arrInArr[1]

earnest phoenix
#

forEach is slower because it needs to re evaluate the input fn everytime for every element

summer acorn
#

you can have .forEach((itemOne, itemTwo) => {})

#

that is because forEach is meant to use a function

#

for loops are meant to use an if statement a pre-decided amount of times or throughout a whole array

#

while loops are meant to execute an if statement until it returns false

crystal wigeon
#

hey guys

#

umm

#

{
"message": "DiscordAPIError: Missing Access\n at RequestHandler.execute (/home/m01425192/discord-bot/izzi-bot/node_modules/discord.js/src/rest/RequestHandler.js:154:13)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at async RequestHandler.push (/home/m01425192/discord-bot/izzi-bot/node_modules/discord.js/src/rest/RequestHandler.js:39:14)",
"level": "error",
"timestamp": "2021-02-11T06:25:31.265Z"
},

is it possible to log the file as well when ever this happens?

#

im sure the bot has all the access, but it still shows this error often

#

cant figure out which file

#

also is there some api exhaust limitations? i got like 1.1k servers and almost 4k players.. my bot restarted twice

#

and i see no crash report errors

#

in the error log

dusky sundial
#

If you're making loads of API requests in a short amount of time, then yes, it is possible that you are being rate limited

crystal wigeon
#

but how can i help the 3.5k user traffic?

#

obviously they would be making many calls

#

not the same user

#

different users

dusky sundial
#

I'm pretty sure djs handles rate limits for you so it's unlikely that that is the problem

crystal wigeon
#

indeed

#

but sometimes the embeds dont get editted

#

so thought

#

maybe some rate limit

#

is messing up

#

i do have my own delay of 1sec before i edit the embed

dusky sundial
#

So are you sure that your bot has permission to edit messages in every single server?

crystal wigeon
#

so shouldn't be a problem

#

yea

#

without that the bot wont work

dusky sundial
#

Yeah, but what if some server owner decided to remove that permission?

crystal wigeon
#

thats not the issue tho

#

well the bot will just throw a have no perms error

#

but i cant figure out why the bot would restart

#

there are no crash logs

dusky sundial
#

What exactly is the bot trying to do when this error happens?

crystal wigeon
#

just edit embeds nothing else

#

but thats the issue

#

the discordapi thing isnt the issue

#

i assume the bot doesnt need "manage message" perms to edit its own message embed

dusky sundial
#

During your bot development you will likely run into DiscordAPIError: Missing Permissions at some point. This error can be caused by one of the following reasons:

  • Your bot is missing the needed permission to execute this action in it’s calculated base or final permissions (requirement changes based on the type of action you are trying to execute).
  • You provided an invalid permission number while trying to create overwrites. (The calculator on the apps page returns decimal values while the developer documentation lists the flags in hex. Make sure you are not mixing the two and don’t use the hex prefix 0x where not applicable)
  • It is trying to execute an action on a guild member with a role higher than or equal to your bots highest role.
  • It is trying to modify or assign a role that is higher than or equal to its highest role.
  • It is trying to execute a forbidden action on the server owner.
  • It is trying to execute an action based on another unfulfilled factor (for example reserved for partnered guilds).
  • It is trying to execute an action on a voice channel without the VIEW_CHANNEL permission.
#

This is what I found on Google

crystal wigeon
#

weird

#

i do check for these

#

AbortError: The user aborted a request.

#

what about this error?

earnest phoenix
#

Hi, do someone now how to escape to a youtube ip block?

crystal wigeon
#

vpn

#

ig?

earnest phoenix
#

on vps ?

crystal wigeon
#

no

#

vpn

dusky sundial
crystal wigeon
#

there are free ones too

#

but no garuntee they wont leak your info

earnest phoenix
#

ok i'll search

dusky sundial
#

They're most likely blocked as well, I'm assuming a lot of people try to use them

earnest phoenix
#

tk

crystal wigeon
dusky sundial
#

Seems like AbortErrors usually happen if a request is taking too long, or doesn't resolve at all

crystal wigeon
#

makes sense

cinder stratus
#
--> npm install @json/presences @utils/cleanup @utils/utils @utils/responses @utils/schema node-fetch
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@utils%2fcleanup - Not found
npm ERR! 404 
npm ERR! 404  '@utils/cleanup@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-02-10T14_04_48_604Z-debug.log
exit status 1
``` error
#
{
  "name": "princess",
  "version": "2.0.1",
  "description": "lel",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "inhydrox",
  "license": "Apache 2.0",
  "dependencies": {
    "@top-gg/sdk": "^3.0.7",
    "axios": "^0.21.1",
    "canvas": "^2.6.1",
    "canvas-constructor": "^4.1.0",
    "cheerio": "^1.0.0-rc.3",
    "dblapi.js": "^2.4.0",
    "discord.js": "^12.2.0",
    "dotenv": "^8.2.0",
    "fast-levenshtein": "^2.0.6",
    "image-size": "^0.9.1",
    "img-api": "^1.0.4",
    "module-alias": "^2.2.2",
    "moment": "^2.28.0",
    "moment-timezone": "^0.5.31",
    "mongodb": "^3.6.0",
    "ms": "^2.1.2"
  },
  "_moduleAliases": {
    "@utils": "src/utils",
    "@structures": "src/structures",
    "@json": "assets/json",
    "@languages": "src/languages"
  }
}``` package.json
crystal wigeon
#

but is it not possible to log where the error originates? it literally doesnt show the file

#

;-;

#

which makes it hard to find where the bug is

dusky sundial
#

I have almost no experience with JavaScript :( someone else is gonna have to take it from here

crystal wigeon
#

np

pulsar bone
#

its a little bit offtopic but did anyone know why discord recaptcha doesn't work in clone apps

tired panther
#

How do I look if the user is in a mutual server?
just with the client?

rustic nova
# pulsar bone

What are you using to clone it? Using parallel space works for me

tired panther
rustic nova
#

Nah not really

earnest phoenix
earnest phoenix
#

yeah lmfai

#

lmfao

#

how do a i get a custom message for when a member joins

rancid bramble
#

got a solution for tons tons ping? KEKW

earnest phoenix
#

Can anyone help me with YouTube bot

#

<@&304313580025544704>

coral trellis
#

-atmods

gilded plankBOT
#

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
coral trellis
#

-wrongserver @earnest phoenix

gilded plankBOT
#

@earnest phoenix

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Top.gg Discord" button at the top of our website. If there isn't a button that says Support Server, then we can't help you. Sorry :(

flat pelican
#

😩

earnest phoenix
#

Ohh

eternal osprey
#

hey

#

dotnet add package Discord.Net.Rest --version 2.2.0 i tried to install the package with this command. It returned me this error: The project does not support adding package references through the add package command.

earnest phoenix
#

/help

#

Any python dev there? How can i prevent the error from logging in console?? Even tho i have error handler

#

@changeprefix.error
    async def changeprefix_error_handler(self, ctx, error):
        if isinstance(error, MissingRequiredArgument):
            if error.param.name == 'prefix':
                await ctx.send('works')
modest maple
#

do you by any chance have a global error handler aswell?

earnest phoenix
#

Do it needed?

#

I dont have

#

Only the CommandNotFound

modest maple
#

no but do you have a on_command_error handle just existing in your code

earnest phoenix
#

Ye

#
@Akagibot.event
  async def on_command_error(ctx, error):
   if isinstance(error, CommandNotFound):
       return
   raise error

Only this one

modest maple
#

What ive experienced is that having a global + local doesnt cause the local to silence it for the global

earnest phoenix
#

Oh

modest maple
#

solution i did was set a ctx.handled = True and then if ctx.handled: return at the top of my global handler

earnest phoenix
#

ctx has no attribute hendled blobweary

#

Oop

modest maple
earnest phoenix
#

You know what, I just wanted to point out the typo exdee

modest maple
#

toche

earnest phoenix
#

Om tysm it workss

brazen violet
#

i have created the database of the partnership in quick.db and i have made it by this.
Now how can i get those values?

pale vessel
#

You're pushing it?

brazen violet
brazen violet
brazen violet
fierce ether
#

@brazen violet you need to await the data?

brazen violet
fierce ether
#

const <serverid> = await db.get(values)

brazen violet
#

oh i will try and say u

eternal osprey
#

Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Substring(0, 8); how would i make this a fucntion and set the interval to 1000ms?

brazen violet
brazen violet
fierce ether
#

log what your trying to get, and see if it returns what you want

brazen violet
#

umm ok

zenith terrace
#

it might not work

#

but idk lol

#

maybe

db.get(`partnershipcreated_${message.guild.id}.serverid`)```
pale vessel
#

but isn't it an array

#

shouldn't they use db.set() instead

zenith terrace
#

theres a push

#

but eh

#

set looks like the one to use

#
db.set('userInfo', { difficulty: 'Easy' })```
grizzled raven
#

use set

#

and get

crimson vapor
#

is this quickdb?

zenith terrace
#

yea lol, for the guy above

brazen violet
#

umm i didnt understand that

#

which one to use ?
You guys given three ways

misty sigil
#

object Object appears when you try to stringify an object without using JSON.stringify

#

try console.log all of your variables

#

they will all be objects, guaranteed

tired panther
crimson vapor
#

you can also use util.inspect

#

but its a bit strange

slender wagon
#

7200000 is this what 2 hours in milliseconds would be or am i wrong

crimson vapor
#

1000 * 60 * 60 * 2

slender wagon
#

aight thanks

crimson vapor
#

yeah you were correct

summer torrent
#

what is second 60 and 2

#

1 hour?

#

oh ok nvm

misty sigil
#

60 to get it to 1 minute then 60 to get it to 1 hour then 2 to get it to 2 hours

summer torrent
#

yeah

crimson vapor
#

milis * seconds * minutes * hours

quartz kindle
#

do it the right way like a normal person

#

hours * minutes * seconds * milis

fierce ether
#
            const fetchChannel = await client.channels.fetch(guildData.plugins.verification.channel)
            if(!fetchChannel) return```
#

im still getting errors?

quartz kindle
#

the error being...?

fierce ether
#

DiscordAPIError: Unknown Channel

quartz kindle
#

that means the channel doesnt exist

#

and that error happens inside the promise

fierce ether
#

theres no way of checking?

quartz kindle
#

catch it

fierce ether
#

the fetch?

quartz kindle
#

yes

fierce ether
#

ok thx

quartz kindle
#

.catch(() => null)

#

which means, if an error happens, return null instead

#

which then you can use in the if()

crimson vapor
#

bro

#

thats so smart

#

@pale vessel what do you use for your color command?

pale vessel
#

i pinged you

#

bruh

#

i used color

#

literally

#

good package, it uses color-string under the hood

#

so you might just need that

crimson vapor
pale vessel
#

ye

#

use color-string actually

#

you only need the colors right?

#

that package is mainly for color manipulation

crimson vapor
#

yea I just need colors

pale vessel
#

yea

earnest phoenix
#

ayo
MANAGE_CHANNEL
Or
MANAGE_CHANNELS

pale vessel
#

@crimson vapor btw I was just trolling when your bot errored for the rank color command, I just added ZWS

crimson vapor
pale vessel
#

on the test server

crimson vapor
#

can you link the message kekw

pale vessel
pale vessel
crimson vapor
#

ah

#

I only need the hex from the color

#

but from what I can tell, none have more than like 200 colors

earnest phoenix
lyric mountain
#

did u try one of those?

slender thistle
#

plural, channels

#

or maybe it's both depending on the context

#

rtfd ftw

earnest phoenix
eternal osprey
#

hey

#

does anyone know how i can generate a new random string of 8 characters every 1 second?

#

Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Substring(0, 8); i have this atm, but i want to call the convert function every 1 second

quartz kindle
#

Math.random().toString(36).slice(-8)

#

lul

#

althoug its base 36, not base 64

eternal osprey
#

this is c#

quartz kindle
#

ah

summer torrent
#

lol

eternal osprey
umbral zealot
earnest phoenix
#

that code is so slow wtf

#

are you still stuck on generating a string

pale vessel
#

lmao yes

#

unfortunately

earnest phoenix
#

i wanna see just how slow that is

#

gonna benchmark

umbral zealot
#

I bet I could write better C# just by using google.

pale vessel
#

For sure

lyric mountain
#

just follow java's way-of-life: make a thread for it

earnest phoenix
#

benchmarking rn

eternal osprey
#

i already found a way on how to generate the random strings

#

but i need to update that string every 1 second

#

so the names will be different every 1 s

earnest phoenix
#

predefined char array about 84% faster

earnest phoenix
eternal osprey
#

yeah i tried it

#

but i can't get it working

earnest phoenix
#

have you tried looking at docs

eternal osprey
#

yeah ofc

earnest phoenix
#

...they have an example on there

eternal osprey
#

yeah i ain't dumb.

#

But i can't get it working.,

earnest phoenix
#

what doesn't work about it

eternal osprey
#

i meant, i just don't get how i would call that Program.namelmao = Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Substring(0, 8); line in the timout function

#

i honestly just don't get it.

earnest phoenix
#

you didn't read the docs then

eternal osprey
#

eventhogug i saw docs and examples.

#

i did

earnest phoenix
#

all you literally have to do is call that in the event function

umbral zealot
earnest phoenix
#

depending on which timer you use

eternal osprey
#

yup i did read that

earnest phoenix
#

that code is garbage

eternal osprey
#

yeah idk

earnest phoenix
#

share your current code in a bin

pale vessel
#

almost thought you meant an actual bin

eternal osprey
#

it probably is wrong

#

Timer timer1 = new Timer { Interval = 2000 }; timer1.Enabled = true; timer1.Tick += new System.EventHandler(Program.namelmao); this is what i found.

earnest phoenix
#

show your entire code

#

i'll help you clean up the antipatterns

cinder patio
eternal osprey
#

as it doesn't work

earnest phoenix
#

no

eternal osprey
#

``public class Example
{
private static System.Timers.Timer aTimer;

}

private static void SetTimer()
{

    aTimer = new System.Timers.Timer(1000);
    
    aTimer.Elapsed += OnTimedEvent;
    aTimer.AutoReset = true;
    aTimer.Enabled = true;
}

private static void OnTimedEvent(Object source, ElapsedEventArgs e)
{
    Program.namelmao = Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Substring(0, 8);
}

}``i think that i got it.

earnest phoenix
#

that isn't your entire code

cinder patio
#

That's the code in the example with the body of the OnTimedEvent function replaced

eternal osprey
#

yeah that would work.

#

as it is using the program.name and updating that in a timespan of 1s

earnest phoenix
#

i give up lol

#

you keep on claiming you read the docs and examples but you didn't even glance at them

#

and then when you're asked to provide your code

#

you don't

#

Hi guys does anyone here how to add images in description?

brazen violet
#

is there any way to deleted the data ? i saved the data in quick.db like this

quartz kindle
#

if you mean embeds

umbral zealot
#

I think they mean the bot's description

earnest phoenix
#

yep

umbral zealot
#

We already said <img> tag or markdown

earnest phoenix
#

description

earnest phoenix
#

i- idk how to get those links @umbral zealot like convert them

umbral zealot
#

what "links"

#

what do you mean

earnest phoenix
#

like

quartz kindle
#

you need to either upload your image to an image hosting platform, or convert it to base64

#

or use a link to an online image

umbral zealot
#

Probably just upload to imgur

earnest phoenix
#

like dis

#

imgur

#

and i added it on the description

brazen violet
quartz kindle
#

yes, add it in an img tag

#

<img src="YOUR IMGUR LINK HERE" />

earnest phoenix
#

ohhh

quartz kindle
#

in your bot's description

earnest phoenix
#

kk

#

tysm

fierce ether
#

is there a way of checking if user can receive dms without acctually sending anything?

dusky sundial
#

I don't think it's possible. Only way is to try sending a message and catching the promise

earnest phoenix
urban surge
#

In the bot's case it says undefined how do I fix it?

trail trout
# urban surge

Why can't you just...

Math.floor(Math.random() * yourVariable.length);```
#

You don't need min and max actually.

urban surge
#

okey

#

How can I show the number of members using the bot?

fierce ether
#

<client>.users.<cache>.size

trail trout
#

using the bot
Probably you need to build a gigantic codes for that.

trail trout
umbral zealot
#

Actually the best way is client.guilds.cache.reduce((x, y) => x + y.memberCount, 0)

crystal wigeon
#

hey umm, idk why i keep seeing this user aborted request error...

umbral zealot
#

Since that gives all members and not just the cached ones

crystal wigeon
#

does it have something to do with djs ver?

trail trout
trail trout
umbral zealot
#

they mean "with code"

urban surge
#

thanks

cinder patio
#

A parser I'm working on currently reads the line in the image like this:

const something = ((a, b) => a + b + c / 2).a.b();
c[d.e];

My question is... is this a bug or a feature 👁️ 👄 👁️

halcyon linden
#

Guys

#

what intent is required for clear command?

opal plank
#

huh?

halcyon linden
#

i mean

opal plank
#

you mean BULK_DELETE ?

halcyon linden
#

clear just may delete 99 messages

opal plank
#

BULK_DELETE

#

its not related to intents

halcyon linden
#

Yeah, is presence intent or server members intent?

opal plank
#

you just need MANAGE_MESSAGES to get it

#

neither

#

BULK_MESSAGES are always accessible as long as you have permissions

#

its not intents related

earnest phoenix
halcyon linden
#

I'm verificating my bot

earnest phoenix
halcyon linden
#

I need the intent to allow the clear command delete more than 99 messages

opal plank
#

BULK_DELETE messages does not need intent, if you put that they'll instantly decline your request

halcyon linden
earnest phoenix
#

thonks

halcyon linden
#

Mmmm

#

Ok

#

If I verify my bot, I have the permissions to clear more than 99 messages?

opal plank
#

permissions is NOT related to intents

halcyon linden
#

Okok

earnest phoenix
#

does anyone here knows how to add an image

opal plank
#

INTENTS just says what you want discord to be sending you in regards to events from the gateway.

PERMISSIONS is what your bot can do inside a server

earnest phoenix
#

to the description

#

@opal plank do ya know?

halcyon linden
#

I said permissions, sorry

opal plank
#

css

halcyon linden
#

is not permissions

earnest phoenix
#

what is css

#

im new sorry

opal plank
#

you need to use CSS to add stuff to your bot's description

halcyon linden
#

I just wanna know if I verify the bot, I can delete more than 99 messages with clear command

opal plank
#

you DONT need verification to delete 100 messages BULK

#

actually

#

i think you can do markdown with the <scr=> tag

cinder patio
#

You don't have to use css, people already answered your question multiple times. <img> tag or ![img]

opal plank
#

yeah my bad