#development

1 messages · Page 1603 of 1

lyric mountain
#

due to this, MANY websites/services block them

earnest phoenix
#

its free.. and im new

#

that could be a porblem

lyric mountain
#

http://yourdomain.ext

#

nowadays it's the same as http://www.yourdomain.ext

earnest phoenix
#

they would take u the same place?

lyric mountain
#

yep

earnest phoenix
#

will this work?

lyric mountain
#

try it

earnest phoenix
#

my side issue?

lyric mountain
#

disable cloaking then

earnest phoenix
#

ok

#

whats cloaking?

lyric mountain
earnest phoenix
#

ik

#

but what does it do?

lyric mountain
#

basically opens the website for u instead of redirecting

#

it puts the site inside a frame

earnest phoenix
lyric mountain
#

the pro is that you'll see ur .tk url in the address

earnest phoenix
#

oh, then i dont want cloaking...

#

ye

lyric mountain
#

the con is that sites that block freenom domains won't work

earnest phoenix
lyric mountain
#

no

#

that'd be cloaking

earnest phoenix
#

oh

lyric mountain
#

the only way would be to have an actual domain

earnest phoenix
lyric mountain
#

you don't

#

you can't own freenom domains

#

they can only be borrowed

earnest phoenix
#

oh

#

shit

#

then i cant get ads lol

#

and my own domain

#

to show...

lyric mountain
#

nothing that's free is perfect

earnest phoenix
#

yeah, ik

lyric mountain
#

also, some domains are cheap af

#

like .site

earnest phoenix
#

ok

#

well, thanks for your help!

lyric mountain
#

yw

earnest phoenix
misty sigil
#

try namecheap

lyric mountain
#

I was about to say that

misty sigil
#

.xyz is only a couple of pence

lyric mountain
#

.site is among the cheapest

#

same price as xyz iirc

#

btw

misty sigil
#

its £0.72 to register xyz

lyric mountain
#

consider a shorter name

misty sigil
#

and £8 to renew

#

.site is £1.72 to register and 18 to renew

buoyant creek
#

türk varmı

earnest phoenix
lyric mountain
#

mine was like

misty sigil
#

not as cheap as xyz

earnest phoenix
#

ok

misty sigil
#

oh ic 5 years at ...

lyric mountain
#

yeah

#

lul

#

stonks move

misty sigil
#

why not just buy a .gay domain

cinder patio
#

why is .xyz so cheap

lyric mountain
#

because .abc is the most expensive

#

/s

#

stupid slash cmds that don't let me be sarcastic

restive furnace
#

pls tell me what u looked

lyric mountain
#

my own bot's domain ofc

main trench
earnest phoenix
#

im not getting that...

earnest phoenix
main trench
#

If only Google sites allowed you to add custom html and css

earnest phoenix
#

.xyz is cheap....

#

0.72p per year

lyric mountain
#

that's first payment

#

0.72p for the first year

quartz kindle
#

best place to find domains and compare prices

earnest phoenix
#

if i set 1 year and auto renewal is it cheaper tahn
2 years and auto renewal?

lyric mountain
#

1 year doesn't have auto renewal smh

quartz kindle
#

renewal price is always different than 1st year price

#

best domain

earnest phoenix
lyric mountain
#

regery?

#

wtf is a regery?

quartz kindle
#

idk lmao

pale vessel
#

a registrar?

quartz kindle
#

russian domain

earnest phoenix
#

it lets me

lyric mountain
#

you see, domains are paid yearly

#

you can't auto-renew something you'll pay only once

quartz kindle
earnest phoenix
lyric mountain
#

not if u buy 1 year

earnest phoenix
#

oh

crimson vapor
#

you guys pay for domains?
this post was made by the github free domains gang

earnest phoenix
#

i see

quartz kindle
#

domains are renewed every year, and every renewal costs

earnest phoenix
#

so will I get charged the £30 or yearly costs?

quartz kindle
#

you will get charged 30 now

#

and 30 again in 4 years

earnest phoenix
#

oh

#

i see

quartz kindle
#

or more

#

likely 39

#

or 40

earnest phoenix
#

so i can do 1 year, and it will cahrge me again

quartz kindle
#

if you want to keep it, yes, you have to pay another year

#

first year has promotional price, second year onwards doesnt

#

regular price per year of .xyz is 8-11 usd

earnest phoenix
earnest phoenix
#

thx

quartz kindle
#

thats why i asked, which website are you buying from?

earnest phoenix
quartz kindle
earnest phoenix
#

so I own it until I cancel?

quartz kindle
#

exact pricing might not be up to date, but that gives you an idea of how much you're gonna pay in the second year

lyric mountain
#

do keep in mind, however, that you're paying YEARLY not MONTHLY, so what might seem high is not at all

quartz kindle
#

yes

#

technically

lyric mountain
quartz kindle
#

domains are basically rented

earnest phoenix
#

so its the same as using freenom

crimson vapor
#

ehh

lyric mountain
#

no

earnest phoenix
#

i just borrow it

quartz kindle
#

its the same everywhere

lyric mountain
#

freenom are borrowed, u don't own it

#

domains are rented, you own every bit of it

crimson vapor
#

from what I can tell freenom still owns it and its just routed to your ip

earnest phoenix
#

so.. i own dank-didi.xyz if i pay yearly

modest maple
#

Any of you guys got any idea of how to force a EOF error from a stream so im not sat waiting for minutes or hours waiting for the error to raise bloblul

lyric mountain
#

yes

earnest phoenix
#

thank you so much!

lyric mountain
quartz kindle
#

lmao

#

on python right?

modest maple
#

Well, its frontend JS

#

blobpain Which is partially why im so close to lolkms

earnest phoenix
#

Yo

modest maple
#

i also gotta fix these loading times blobpain

earnest phoenix
#

I got ubuntu and when i try to open steam

quartz kindle
#

but the eof error happens in py or in js?

earnest phoenix
#

It gives me fatal error: steam needs to be online etc

modest maple
#

Its when the player runs into a un-expected EOF and cant recover

#

alot of the times it can recover

#

but occasionally it cant and i need to reload the source, which tbh im not entirely sure how todo cuz the docs are not my best friend blobpain

lyric mountain
#

cf8 be like

modest maple
#

just like

#

i hate it so much blobpain

earnest phoenix
#

im sticking to http://dank-didi.ml/ for now... and my BT router said 'Warning, this site may scam you'

modest maple
#

probably

lyric mountain
#

what site?

#

.tk?

modest maple
#

lack of SSL will get flagged by everything pretty much

old cliff
#

Yes

inner maple
#

hey does anyone know how to add a server on top.gg?

modest maple
#

okay

#

so

inner maple
#

okay

modest maple
#

i think ive worked out how one sanely live reloads a video stream lolkms

#

pause

#

unload

#

detach

#

destroy

#

create

#

attach

#

load

outer perch
#

any other way to store objects besides JSON? compatible with ts?

solemn latch
#

A database?

outer perch
#

or there's only writing an object in .ts

mellow kelp
#

pretty much any database

lusty quest
#

use a database?

modest maple
#

just use a database and typecast?

solemn latch
#

Lol

outer perch
#

since I'm using a free DB, I don't want to store everything into it

modest maple
#

pithink yikes

lusty quest
#

then get a proper Database and store stuff in there

outer perch
#

¯_(ツ)_/¯

outer perch
lusty quest
#

get a job

whole tundra
#

Oop

main trench
#

Covid moan_cookie

#

Jobs have left daniSquare

lyric mountain
#

like, it's the host that's paid

outer perch
#

facts for the fact command, itemlist for the shop, natures for the pets and which for the which command

outer perch
lyric mountain
#

you can either host it together with ur bot

#

or use an embedded db

outer perch
lyric mountain
#

json has literally -1% reasons to be used instead

outer perch
#

yeah, sometimes I think if I should keep it like this

modest maple
#

you shouldnt

outer perch
#

😱

lyric mountain
#

is a file-based db

mellow kelp
#

well you can use json if it's static data

outer perch
#

all those are static

whole tundra
#

S.help

mellow kelp
#

just keep using json then

lyric mountain
#

if they'll be read-only then it's fine

outer perch
#

😉 hehe I knew it

#

but I asked if there's anything like JSON that TS can read without an extra flag

#

just to know

lyric mountain
#

if u want an alternative, then there're properties and CSV files

outer perch
#

Excel 😩

lyric mountain
#

properties are like

key=value
otherkey=othervalue
anotherkey=anothervalue
ohhey=there
pale vessel
#

.env database

outer perch
mellow kelp
#

the superior database

#

how could we forget about .env

outer perch
#

I don't have sensitive data, so maybe I don't need to go that far

mellow kelp
#

that was a joke KEKW

#

wait i got a question

outer perch
#

xD

mellow kelp
#

is there a way to use redis asynchronously without promisifying everything by myself

modest maple
#

async/await?

mellow kelp
#

the only async redis package i found has wack typings

mellow kelp
modest maple
#

surely anything network based JS is gonna be asyncronous already no?

mellow kelp
#

nope

#

they say async support will be coming in v4

lyric mountain
#

redis is local and buffered

lusty quest
#

currently you have to use promisify for having it async

mellow kelp
#

oof

#

well alright

lusty quest
#

but its alright

#

could be worse tbh

#

also you could attach the redis stuff to promisify so you can just call the attached function for async stuff

mellow kelp
#

yeah

#

im gonna do a custom redis object with promisifed methods

lyric mountain
#

any error?

lusty quest
#

for each dont respect async

mellow kelp
#

ew forEach

lyric mountain
#

didn't see that forEach there

#

stinky

mellow kelp
#

oh yeah i finally did a benchmark with the 3 types of for loops

#

im never using forEach ever again

drifting wedge
#

yo

#

when installing wavelink

#

it gives me an error "failed to build multidict yarl"

earnest phoenix
#

bros

#

i ned help

#
client.on("guildMemberAdd", async (guild, member) => {
        const wch = new mdb.crearDB("WelcomeChannels")
        const wchannel = wch.obtener(`${message.guild.id}`);

        let embed = new MessageEmbed() 
            .setColor("GREEN")
            .setAuthor(member.user.tag, member.user.displayAvatarURL()) // esta parte lo que hace es poner el nombre del usuario y imagen en la parte de arriba 
            .setImage('https://media.giphy.com/media/TKv4j0jA2IUfcLFCKl/giphy.gif') //el gif que quieras poner, yo te recuerdo que pongas uno de giphy 
            .setTitle(`Welcome to ${message.guild.name}`) // mensaje que pondra en el titulo puedes modificarlo , seria algo asi " bienvenido a discord ayuda" 
            .setDescription(`${member.user} Diviertete En El Servidor !`) // aqui es la parte de descripcion puedes modificarlo , es el mensaje que pondra en el embed puedes cambiarlo a tu gusto en este caso se veria asi "@usuarioqueentro diviertete en el servidor"
            .setThumbnail(member.user.displayAvatarURL({ dynamic: true, format: "png", size: 1024 })) // agarrara el url del mienbro en png en tamaño 1024 y lo pondra en la aprte superior
            .setFooter("Now we are:", message.guild.memberCount) // puedes cambiarlo como gustes asta poner el id de que entro al grupo pero pues como dije las hare lo mas indentico a discord ayuda pero pues si quisiese poner el id de la persona solo cambialo a esto "Usuario: ' + member.user.id" si quisieras poner el tiempo de mensaje solo escribe debajo : .setTimestamp() *opcional*

        client.channels.cache.get(wchannel).send(embed)



    });
#

i dont know what happens

#

but the bot

#

doesn`t sends the message

#

when somebady joins

#

😔

drifting wedge
#

you just copied this code?

earnest phoenix
#

._.

lusty quest
#

make sure the channel is cached

earnest phoenix
drifting wedge
#

oh

earnest phoenix
#

i speak spanish

#

xd

drifting wedge
#

ah

drifting wedge
earnest phoenix
lusty quest
#

then it should work, if the channel is cached. just for fun console.log your channel

earnest phoenix
#

._.

#

ok

main trench
#

(guild, member)? Im used to that just being (message)

earnest phoenix
#

ah

#

i will try with message

lusty quest
earnest phoenix
#

._.

#

ok

main trench
#

Its like that for my event smh

earnest phoenix
#

well

#

i will try

lusty quest
#

only member is a thing, guild is not a thing

lyric mountain
#

how would a memberAdd event even have a message object? lul

main trench
#

Mine does and it works lol

earnest phoenix
main trench
#

I don't question the code

lyric mountain
#

but like, there's no message involved

main trench
#

Well mine sends a message when a member joins and leaves

#

Thats why i use it

earnest phoenix
#

yes, definitively message doesnt works

#

😔

lyric mountain
main trench
#

Lol

lyric mountain
#

I'm talking about event args

#

not what u do inside it

main trench
#

Ah

earnest phoenix
#

and it doesnt works

#

yes, i know

main trench
#

Could be a issue with your db

earnest phoenix
#

is that i used other command

main trench
#

Try using the command you made to log the channel

earnest phoenix
#

to see if the channel was catched

#

and it is

#

like i dont know

main trench
#

Thats probably the issue then

earnest phoenix
#

😔

main trench
#

The main issue is one of 2 things 1. How its being fetched or 2. How its logged

#

Your actual code is fine

earnest phoenix
#

._.

main trench
#

Or another issue i missed since I have 1 braincell akkoShrug

green kestrel
#

i started logging frequency of commands to my bot and noticed something interesting

earnest phoenix
#

😳

green kestrel
#

the most commonly run command is one that conflicts with mee6, and one of the most expensive commands in my bot

#

if i change the name of that command, i can massively cut down my resource usage

solemn latch
#

Rank cards?

green kestrel
#

yes

earnest phoenix
#

nice

#

🥵

green kestrel
#

if i change !rank to !localrank, it wont conflict with mee6 any more

earnest phoenix
#

😳

solemn latch
#

Ezpz

green kestrel
#

i dunno how that might affect users that are already expecting it to be !rank though

solemn latch
#

Maybe a transition period?

green kestrel
#

yeah

#

good idea

modest maple
#

tbh i would just leave it

#

set it to another prefix if ya dont want it to conflict™️

unborn venture
#

I solved it ready to go ;3

modest maple
#

nice ghost ping

earnest phoenix
#

?

#

._.

#

it wasnt a ghost ping

#

it was a reply

#

to your message

#

._.

modest maple
#

which had the ping on mmLol

earnest phoenix
#

sorry

#

😔

#

😔

unborn venture
#

how can i solve this

zenith terrace
#

by showing your code?

eternal osprey
green kestrel
eternal osprey
#

does anyone know why my topgg backgground isn't working anymore? It was working before, but it just stopped out of nowhere.

unborn venture
green kestrel
#

that costs me a lot of image generation resources, not something i considered an issue when it only had like 1000

eternal osprey
modest maple
#

I think if it was that much of a conflict they would change it

unborn venture
#
const Discord = require('discord.js');
const config = require("./config.json");
const Enmap = require("enmap");
const get = require("get");
const client = new Discord.Client();
const db = require('quick.db');
const fs = require('fs');



client.config = config;

fs.readdir("./events/", (err, files) => {
    if (err) return console.error(err);
    files.forEach(file => {
      const event = require(`./events/${file}`);
      let eventName = file.split(".")[0];
      client.on(eventName, event.bind(null, client));
    });
});


client.commands = new Enmap();


fs.readdir("./commands/info/", (err, files) => {
  if (err) return console.error(err);
  files.forEach(file => {
    if (!file.endsWith(".js")) return;
    let props = require(`./commands/info/${file}`);
    let commandName = file.split(".")[0];
    console.log(`Attempting to load command ${commandName}`);
    client.commands.set(commandName, props);
  });
});


client.login(config.token);

green kestrel
#

no its my issue, because i have to provide the resources to render those rank card they users dont even want, theyre after mee6's rank card

umbral zealot
# earnest phoenix doesn`t sends the message

Theory: in order to know when a user joins, you must have the GUILD_MEMBERS intent activated on the bot's page in the discord developer portal. Make sure that option is turned on.

earnest phoenix
#

Oh

#

thanks you so much bro

green kestrel
#

its not insignificant.... its 59,000 rank card renders.

green kestrel
#

compared to nearly 20,000 start commands

eternal osprey
#
<style>
  body {
  background-image: url(https://wallpaperaccess.com/full/1204217.jpg);
  background-color:#FF0000;
}
</style>``` this is what i have on top.gg. It first worked and it most definitely showed a background. Then it stopped working out of nowhere *POOF* gone.
earnest phoenix
#

url(' ')

eternal osprey
#

the preview does show the background tho

umbral zealot
quartz kindle
#

check it on the inspector

#

maybe its being overridden

restive furnace
#

nice hidden adversiting

unborn venture
eternal osprey
#

I just have a general question.

restive furnace
#

but anyways seems you edit white mode but view in dark mode ig

eternal osprey
umbral zealot
eternal osprey
main trench
#

@eternal osprey f12

eternal osprey
unborn venture
quartz kindle
#

f12 or right click -> inspect

main trench
#

@unborn venture logger isn't defined

umbral zealot
#

yeah exactly

#

Stop shoveling random code into your bot and actually learn JavaScript to stop having those errors you don't understand and we can't solve for you.

solemn latch
#

Where did client.logger come from, I've seen it in random peoples code

opaque seal
#

Does anyone know how to get 10 documents with the highest value in a specific field from a mongoDB collection

main trench
#

Console.log is what he needs i think

quartz kindle
umbral zealot
solemn latch
#

Ah

eternal osprey
quartz kindle
#

no lol

umbral zealot
main trench
#

No idea

umbral zealot
#

Exactly the code they copied into their bot that doesn't have a client logger

eternal osprey
quartz kindle
#

thats not the same thing

#

client is the discord client

umbral zealot
#

No, that's not it, it's completely irrelevant, Awsome

eternal osprey
#

idk i am just suggesting something

quartz kindle
#

client.logger is something you assign to client yourself

#

it can be anything you want

#

client.logger = 10

umbral zealot
#

What we should all be suggesting is that they learn javascript instead of just shoveling random code from random places in their bot's code

solemn latch
#

Client.logger = console.log

quartz kindle
#

lol

pale vessel
#

very useful logger

quartz kindle
#

logger maxima

eternal osprey
#

btw i checked my inspector. It doesn't seem like it is overriding any images.

#

Is this just a bug or..?

#

Because i had the same image for like months

#

and it just disappeared without me doing anything.

quartz kindle
#

dm your bot's page

eternal osprey
#

will do!

quartz kindle
#

google mongodb sort and limit

opaque seal
#

I did, but that shit confusing

#

Like

#

Oh wait

#

Nvm I found a good post

cinder patio
#

literally .limit(n)

#

and .sort({property: 1|-1});

quartz kindle
eternal osprey
#

owh the preferred dark color?

#

i've disabled that

#

but still doesn't seem to be working tbh

quartz kindle
#

also

#

the image you're linking is protected

#

they already do

#

they do

#

unless you're doing something wrong

#

the sharding manager in discord.js does auto restart them

earnest phoenix
solemn latch
#

Is your bot logged in 4 times?

rose warren
#

How can I attach an embed and an image to a message?

main trench
#

The channel was logged multiple times

earnest phoenix
#

ah

#

what

main trench
#

Make a command to clear the database

#

Then relog the channel once

rose warren
#

message.channel.send({embed: embed, files: [canvasResult()]}) is giving me an error

#

canvasResult() returns this: return new Discord.MessageAttachment(canvas.toBuffer(), 'result.png');

earnest phoenix
#

bruh but in the database there is only the channel once

main trench
#

I've had this problem before

#

I just don't remember how I fixed it

earnest phoenix
#

it always happens to me that it sends the message like 4 times when i use async

#

😔

#

wtf the console logs

lusty quest
#

are you still with this issue?

earnest phoenix
#

😔

earnest phoenix
#

Is there a recomended size for the bots custome banner?

main trench
#

How do you even set the banner?

earnest phoenix
#

You go to imgur

#

Upload it

#

And copy its link

main trench
#

Ah

earnest phoenix
#

Then edit your bot and past the link in the custom banner field

#

Im trying for 30min to rescale my banner and it would look good it will always be off screen

#

like do i have to make it like 100x100 to fit or how small/big

#

I asked in support if anyone knows a recomended resolution and i got sent here

slender wagon
#
  const target = message.mentions.users.first() || message.author;
    const rawLeaderboard = await Levels.fetchLeaderboard(
      message.guild.id,
      message.guild.memberCount
    );
    const guildUserLevels = await Levels.computeLeaderboard(
      message.client,
      rawLeaderboard,
      true
    );

    const user = guildUserLevels.filter(
      (xpobj) => xpobj.userID === target.id
    )[0];
    const neededXp = Levels.xpFor(parseInt(user.level) + 1);

I need this for a rank command but everytime i run it on a big server it takes awhile to respond then it becomes normal, so basically once ran the command should be fine for a few minutes then it will have to process it all again. Is there i could get rid of all this slow process

wintry terrace
#

How can i set the bot prefix costom in my bot

solemn latch
#

you can just do + (customizable)

solemn latch
earnest phoenix
#

Is there a recomended size for the bots custome banner?

solemn latch
#

whats this Levels.fetchLeaderboard
Levels.computeLeaderboard

solemn latch
earnest phoenix
#

Ok thank you !

solemn latch
#

actually i see a lot of various sizes

#

even kinda random ones
1280x828

earnest phoenix
#

It dosnt work

#

It looks like this

#

I started at like 1270x720 i think and if i lower down it just gets blurier

solemn latch
#

looks like your looking at it from your profile, which most users wont see

earnest phoenix
#

Oh it does work

#

Il try the original one too

#

the hd one

#

do you ever look at code you wrote the other day and wonder what crack you were smoking?

#

It does work

#

me?

earnest phoenix
#

I ussualy dont look back at my code online if i need to update it or improve it

#

Like i think its a waste of time to revisit code if it works find with no error

#

can someone help me make a bot

earnest phoenix
#

This is not a bot making tutorial server

#

dam

#

If you need help please search soem tutorials on youtube/google

#

Here you can ask for help if you have any errors

#

ok

slender wagon
solemn latch
#

then its probably just a slow library

slender wagon
#

oh

pale vessel
slender wagon
#

it actually is a package

pale vessel
#

So it'll be consistent

solemn latch
#

a package is a form of library

slender wagon
#

discord-xp, i just found it and set it up

solemn latch
#

well its probably just slow

slender wagon
#

you know a better one or should i remake one?

main trench
#

@wintry terrace to make a custom prefix you gotta code it

solemn latch
#

i mean, any database can do xp systems quite easily and quickly

#

using a library doesnt make a lot of sense.

frigid warren
#

+1

slender wagon
#

ty

quartz kindle
#

i checked this library's code

#

its definitely not meant to be used like that

slender wagon
#

the way i use it?

quartz kindle
#

they have a limit option in fetchLeaderboard

#

you are giving it no limit basically

#

this library is designed to work on smaller amounts of data at once

slender wagon
#

that's for the leaderboard command

quartz kindle
#

for example top 10, or top 50

#

you're doing leaderboard for ALL members

slender wagon
#

no this is a rank command

#

it filters it

quartz kindle
#

if a guild has 100k members, it will take a while

slender wagon
#
  const user = guildUserLevels.filter(
      (xpobj) => xpobj.userID === target.id
    )[0];
quartz kindle
#

thats too late

slender wagon
#

wym

quartz kindle
#

you already did this ```js
const rawLeaderboard = await Levels.fetchLeaderboard(
message.guild.id,
message.guild.memberCount
);
const guildUserLevels = await Levels.computeLeaderboard(
message.client,
rawLeaderboard,
true
);

#

you already fetched ALL members

slender wagon
#

oh right

quartz kindle
#

limit = message.guild.memberCount

slender wagon
#

so yeah that's why i was asking if there is a way i could get rid of that

quartz kindle
#

and then computeLeaderboard fetches the user from discord one by one

#

so if a guild has 100k, it will fetch 100k users, one by one

#

it will take ages

slender wagon
#

yeah

twin marsh
#

The bot doesn't want to send the text file, no matter what how hard I try

quartz kindle
#

so that library is meant to be used in small amounts

#

for example fetchLeaderboard(id, 10) to get top 10

#

it already sorts them by xp for you

slender wagon
#

so i can't do a rank command with that library

quartz kindle
#

you want a rank like, to show what is a single user's rank?

slender wagon
#

if my bot is in servers with too many members

#

yes

#

that's what i've been talking about the whole time

quartz kindle
#

im pretty sure the library has a different function for that

slender wagon
#
 const rawLeaderboard = await Levels.fetchLeaderboard(message.guild.id, 5);
    if (rawLeaderboard.length < 1) return reply("Nobody's in leaderboard yet.");

    const leaderboard = await Levels.computeLeaderboard(
      client,
      rawLeaderboard,
      true
    ); // We process the leaderboard.
    
    const lb = leaderboard.map(
      (e) =>
``` i already sorted the leaderboard one
quartz kindle
#

fetch(userId, guildId, fetchPosition = false)

#

thats the function for that

#

Levels.fetch(user, guild, true)

slender wagon
#

oki i'll try that

#

ty

quartz kindle
#

they even have an example

#

just read their docs

#

alwaysreaddocs™️

slender wagon
#

welp seems like i am using a outdated version

outer perch
#

MegaThonk should I give ppl extra xp when doing some actions like buying in the shop, using dailies and voting, and winning games?

#

btw my leveling is global

twin marsh
#

but I tried a lot of dots and names

pale vessel
#

Have you tried `${__dirname}/runs/...`?

twin marsh
#

I'll seek a try

#

took me some time

#

but still having the same error

pale vessel
#

What's the actual error?

slender wagon
#

oh so it seems like i had a reason to fetch the whole data, i wanted to check the ranking of the user that's why i needed it

solemn latch
#

looks like you can just fetch the single user

novel hamlet
#

can someone help me? I looked at some guides for making a voice bot but can't still do it, I only want to play 1 file when a command is issued but can't do it

slender wagon
#

just loged the user.position and it comes out as undefined

#

so yeah i can see the level and everything but i can't seem to get the position on the db since i am not feching it all

#

idk how to find its position without fetching the whole server members

solemn latch
#

hmm, so the db doesnt track that?

#

not sure if theres a way to add it to the library.

quartz kindle
tired panther
#

I have a array object like:

messages:[{guildid: 11, count: 20},{guildid: 99, count: 30}]
``` How can I check if the array has the guild id 99, without a forloop?
slim umbra
#

anything you do will requure looping one way or another

tired panther
#

What would you use to check?

slender wagon
tired panther
slender wagon
#

nvm all i had to do is enable it

quartz kindle
#

or exactly the same thing with .some()

safe creek
#

got this when trying to run my bot, got told to ask here. does anyone know what these errors mean?

delicate zephyr
#

What intents are you requesting

#

or have you set any

safe creek
#

idk im very tired so please excuse me haha

#

its something like asyncio\lib\base_events etc

#

which im not sure what that means

delicate zephyr
#

No, its when you try and login with your bot

#

is there any value named "intents" in the base client code

safe creek
#

let me checj

#
intents.members = True
intents.reactions = True```
#

here

delicate zephyr
#

Oh

#

I see

livid sentinel
delicate zephyr
safe creek
#

it worked before tho

#

on my test bot but now that i wanted it to work on my main

#

it just did that :/

#

ive activate the intents thingy

#

should i try starting it agsin?

delicate zephyr
#

yea

crimson vapor
#

is Tim here?

#

oh wait I think im just being dumb

#

yeah im just dumb

tardy hornet
#

i have a leaderboard command

#

and it does not show the top 10, it shows the top 10 of the people that recently sent a message

rustic nova
#

make that opt-out, unless it is only per server

tardy hornet
#

yes, its serverly

#

@rustic nova

earnest phoenix
#
fs.writeFileSync(this.dir, JSON.stringify(mData, null, 2), (err) => { 
if (err) throw err;
console.log('Saved file to' + this.dir);
})``` shouldnt it console log when this runs?
#

everything else works

#

the file writes and stuff

#

it just dont console log

copper cradle
#

how can it not log wtf

earnest phoenix
#

thats where im at

#

heres the file that came from if you wanna carve your eyeballs out

#

anyways imma go eat and do schoolwork

#

not sure what cmd is doing with all that ram

#

only a discord bot...

drifting wedge
#

if i restart the ipc client instance, the dashboard gives errors asking to restart dashboard too

#

how can i fix this?

#

dpy

#

like have the dashboard reconnect with the ipc after i restart one of them?

opal plank
#

when will you stop using a json db?

drifting wedge
#

me?

opal plank
#

jjj

#

well, if you using one, stop it

snow urchin
#

god i remember my first db being a json file, was very very sad

drifting wedge
#

@opal plank are you talking to me!?

eternal osprey
#

hey

snow urchin
#

no

#

he is talkin to jjj

opal plank
eternal osprey
#
const n = require("../n.json");
const Discord = require("discord.js");
const human = require('humanize');
const client = new Discord.Client();
exports.run = (client, message, args) => {

   let prestring = args[1]
   if(prestring == "ban"){
   const Embed1 = new Discord.RichEmbed() 
   .setColor("RANDOM")
   .setTitle("Ban Help Command")   
   .setDescription("Usage: !ban <@user> <reason>")
   .addField("This command will ban the selected user.")
   .setFooter("AwsomeCord || Moderation")
   message.channel.send(Embed1)
   }
```why is this not giving any errors nor work?
drifting wedge
#

OHHH
lol

opal plank
#

cuz u mking a new client

#

stop it

#

dont create a new client

#

wtf

drifting wedge
#

im so confused

opal plank
#

BRUH

drifting wedge
#

oh

eternal osprey
#

for fuck sakes bro don't fucking mock me

opal plank
#

i dont know python exe

eternal osprey
#

i am trying my fucking best right

opal plank
#

you didnt read the docs before even doing it

eternal osprey
#

just tell me once it's wrong and that's enough

eternal osprey
#

ofc i did, how else would i make a fucking bot

opal plank
# eternal osprey just tell me once it's wrong and that's enough

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!

drifting wedge
opal plank
#

you know have an understanding of how objects or function parameters works

#

learn js before attemping to make a bot

#

you need the basics to do it

#

you're copy pasting from the internet without knowing what i does

#

learn it first

eternal osprey
#

no cap.

earnest phoenix
#

tfw we are at a point people get offended when you tell them to educate themselves about something

eternal osprey
#

it is the fact how he states it

opal plank
#

you still dont know js enough to be making a bot, all your dependencies are unecessary except Discord, and you dont know how functions work

eternal osprey
earnest phoenix
opal plank
#

^^

crimson vapor
#

hello erwin

#

would you like to rate some of my js?

eternal osprey
opal plank
#

hmmm

#

how big is it million?

earnest phoenix
#

I lear ed JS 2 years ago and dont remeber any of it lol.

crimson vapor
#

like 70 lines

earnest phoenix
#

then you didn't learn it

opal plank
earnest phoenix
#

I make a program that writes other programs

#

if you truly learn something, you don't forget it

crimson vapor
#

disregard the bottom part im not that dumb

#

line 107*

earnest phoenix
#

And and multi code translator but I havent touched it in awhile

opal plank
#

then its not 70 lines u dork

crimson vapor
#
  • comments
opal plank
#

lmao

crimson vapor
#

smh

opal plank
#

fair

#

let me go back at reading it

earnest phoenix
opal plank
#

dont use colors
require stuff at the top of your file for consistency
dont name your functions with retarded shit like runShit() if you plan to show this code to anyone (lmao, wtf million)
you could swap your function to be async so you dont do stuff like channel.join().then(connection => { this often, chaining thens, its mostly redability
i sure hope thats not ur token at the end

thats all i gotta say @crimson vapor

#

the rest isnt too bad

#

also if your TIME is hardcoded, why declare it?

#

run directly in the interval

celest schooner
#

maybe put ur functions in different files to make it index cleaner

opal plank
#

also im not sure its a good idea to have this command open to everyone

#

cuz you are not checking for yourid

celest schooner
#

also is that ur token right there

crimson vapor
#

ik

opal plank
#

so anyone can start multiple of this

celest schooner
#

is that really your token

crimson vapor
#

honestly I wasn't expecting so much

modern bronze
#

Hey is there any good documentation on prefix commands? My bot uses the Slash command, and I'd like to check that method out as well.

crimson vapor
earnest phoenix
#

Fun fact java and JS are diffrent. JS original name was mocha

eternal osprey
#

btw erwin, i gotta be honest... what i did was very wrong and stupid. I wasn't thinking clear. I ofc had to split it first, as args[1] just gets the first letter. Sorry!

crimson vapor
#

yeah so time is declared at the top for readabilty

#

easy to change

celest schooner
modern bronze
#

I assume the bot is only pinged when the prefix is used? Hopefully...

crimson vapor
#

I prefer constants above imports

earnest phoenix
crimson vapor
#

and yeah ik the standard of having imports above all else

celest schooner
opal plank
#

usually the format i have is imports above, functions below, then split the code into sections

earnest phoenix
#

Look it up! 😃

crimson vapor
#

idk the standards for formating

#

I just do what works mostly

earnest phoenix
#

Thonk if I remember correctly though java can do more. Cause JS is web based but I may be wrong

crimson vapor
#

nodejs isn't web based

#

js was build for the web

earnest phoenix
#

Never said node was

celest schooner
#

js is for the web

crimson vapor
#

but nodejs is a runtime

earnest phoenix
#

Ok

#

I'm dumb

crimson vapor
#

no

hallow shell
#

hmm for some reason the computer is forgetting my constant variables literally right after logging them i'm guessing thats bad

earnest phoenix
#

I dare someone to make a Mrs. Frizzle bot

#

And have it do random stuff that has to do with rhe show or random memes lol

#

Idk I'm just bored with no water

rapid harness
#

when i try to login on the discord bot / top.gg site it goes back to the main page but still says loging = i cant vote

#

can someone help me

earnest phoenix
#

Site need bud

#

Site news

crimson vapor
earnest phoenix
#

honestly it's up to you whether to use them or not

#

i personally use them to highlight my log level and some important information in the log message

crimson vapor
#

I mean he said not to use colors, I assumed he meant the lib

earnest phoenix
#

oh

#

right

crimson vapor
#

ye

earnest phoenix
#

Ight stupid question. I made a bot (has no code dont hate me) awhile ago but it doesnt stay on 24/7 like I want. If it has to do with a server well what do I have to do. Or is it code?

quartz kindle
#

a bot is a program

earnest phoenix
#

Ima guess MySQL?

#

ok

quartz kindle
#

it only stays online while the program is running

crimson vapor
earnest phoenix
#

How do I keep it running forever

quartz kindle
#

run the program forever

earnest phoenix
#

Ok

solemn latch
#

VPS's can run 24/7 without having your pc online forever

crimson vapor
#

so can I

earnest phoenix
#

how to sleep deprivation 101

crimson vapor
#

being a student is the easiest way to commit sleep deprivation

celest schooner
#
console.log(window.document.forms.length)
//returns 0
function validateForm() {
    console.log(window.document.forms.length)

  } // returns 1```
#

why does the number of forms change

earnest phoenix
#

Whats a VPS

solemn latch
#

virtual private server

earnest phoenix
#

Ah

solemn latch
#

a cheap way to host things

earnest phoenix
#

Lemme bust out my Raspberry pi 4

#

Lol

celest schooner
#

any ideas on my problem

earnest phoenix
#

Yes

earnest phoenix
#

See? Idea XD

#

My humor sucks

solemn latch
#

are they running at different times?

earnest phoenix
#

Whatz

#

Oh nvm

celest schooner
#

techincally ones at the start of the load

#

and antoher is when i click a button

#

but nothign changes to the forms on the html page

solemn latch
#

so the form hasn't loaded yet?

celest schooner
#

ah

opal plank
solemn latch
#

im just guessing

earnest phoenix
#

you should do all interaction in the dom ready event

celest schooner
#

okay

crimson vapor
eternal osprey
#

does anyone know why my bot on topgg can't have a background?

opal plank
#

not adding useless dependencies to your code that are 3 lines long?

crimson vapor
#

ah

#

thats fair

eternal osprey
#

I am using html to set a background but it just doesn't apply it, only in preview.

opal plank
#

its like adding is-undefined to your code

#

absolutely stupid

eternal osprey
#
<style>
  body {
  background-image: url('https://i.pinimg.com/originals/3b/8a/d2/3b8ad2c7b1be2caf24321c852103598a.jpg');
  
}
</style>```
crimson vapor
#

bro is-is-odd is the best /s

opal plank
#

aight back to

solemn latch
#

the most overused image on top.gg right there 👀

eternal osprey
solemn latch
#

not sure why that doesnt work, its typically done on body iirc.

eternal osprey
#

but like, it doesn't save it now. It once worked for like months, then the image dipped out

solemn latch
#

honestly I wouldnt do custom css right now since the rework is coming out soon

eternal osprey
#

yeah i read that..

crimson vapor
eternal osprey
#

But yeah, still it would be already nice to just put a background.

opal plank
crimson vapor
#

ah im just hoping it wasn't what I thought

#

pretty sure it is

rough obsidian
#

did they change markdown shit?
(moderation field used to be yellow and utility was green :/)

opal plank
#

actually

#

yeah i think its apache

#
test
#

yeah, apache

crimson vapor
#

properties is poggers

#
a b
b: a```
quartz kindle
#
+ diff is more
- huehuehue
#
# or md is also cool
#

or you can use hljs visualizer to test them all

lucid prawn
quartz kindle
#

options is not an object

opal plank
#

reading do be hard sometimes

solemn latch
#

token leak 👀

lucid prawn
lucid prawn
opal plank
#

okay wtf

#

BRUH

quartz kindle
#

INT eresting

solemn latch
#

capital D discord is just better

opal plank
#

WOT

#

wot is this

solemn latch
#

copy pasting code op 😄

opal plank
#

why

viral mortar
quartz kindle
#

ghey

viral mortar
#

lmao

opal plank
#

i like lua

lucid prawn
solemn latch
#

its all the same thing

opal plank
#

you do know they are all the same right?

solemn latch
#

just named diffrently

opal plank
#

actually im curious now

solemn latch
#

const 0 = 1
const 1 = 1
const 2 = 1
its all still 1

#

👀

opal plank
#

funfact

solemn latch
#

and yes, i know variables cant just be a number

opal plank
#

im amazed that code even runs

quartz kindle
#

but they want to have different ones, so they can chose which one they want to use :^) ```js
const one = 10;
const two = 10;
const three = 10;

lucid prawn
opal plank
#

all 11 errors?

quartz kindle
#

lmao

lucid prawn
opal plank
#

so i assume it should run now

#

and PLEASe

#

PLEEEEASE

#

use formatting

quartz kindle
#

you're not understanding what erwin is showing, are you?

opal plank
#

eslint

#

prettier

#

linter

#

anything

lucid prawn
opal plank
lucid prawn
#

i forgot to press the button

opal plank
#

also this

#

also not using a command handler

lucid prawn
#

ik

#

ik

quartz kindle
#

btw erwin, yarn v2 basically forces you to install typescript

#

its such bulshit

#

lmao

lucid prawn
#

i can only use 100Ram

opal plank
#

also merging this

lucid prawn
# opal plank

im using a host and i can only use 50.66 MB / 100 MB

opal plank
#

that has nothing to do with what i just said rika

#

absolutely nothing

lucid prawn
quartz kindle
#

code blocks are language highlighters

#

you select the language you want to highlight

#

and it adjusts the colors accordingly

viral mortar
#

hope that helps

lucid prawn
#
hi

opal plank
#

i like lua

quartz kindle
#

the syntax is like this basically:
```languagehere
code here
```

opal plank
#
it higlights numbers, which is quite handy
like this
server: 30
quartz kindle
#

for example ```js

#

yes

opal plank
#

a language, but yes

#

oh

#

my bad

#

ignore me

#

misread the question

quartz kindle
#

each language has special rules for where and when to apply what colors

#

for example the md language colors blue all lines starting with #

something
#something
#

the diff language colors red all lines starting with a minus sign, and greenish all lines starting with a plus sign

#

when we share code snippets, we put them in the code's own language, so the snippet is easier to read

earnest phoenix
#

JavaScript

viral mortar
#

YES

#
[:] I do like the blue of makefile
stark abyss
#
[nice]```
viral mortar
#

there is actually a ton of different stuff you can do

stark abyss
#
    message.channel.send(confirmation).then(async msg => {
      setTimeout(function(){msg.react('❎')}, 2500)
      const cancelFilter =  (reaction, user) => reaction.emoji.name === '❎' && user.id === message.author.id;
      const cancel = msg.createReactionCollector(cancelFilter, {time: timeout})
      cancel.on('collect', r => {
        try{
          msg.delete()
        }catch{
          return
        }
      })
})```
(node:9336) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
msg is defined tho
quartz kindle
#

you delete it

#

before you react

stark abyss
#

nephehL i see

#

but i got other reaction that i wanna react so i need it to wait couple sec so that i don't hit the rate limit

quartz kindle
#

but you're not waiting for it

#

you are reacting 2500 ms AFTER the rest of the code ran

#

setTimeout is a "set it and forget it" function

#

it doesnt wait around to see the result

stark abyss
#

hm

opal plank
#

turn it into a promise if you wanna do that

quartz kindle
#

also, you shouldnt be using a reaction collector for this

blissful coral
#

Getting that testWebhook() is undefined

stark abyss
#

then what am I supposed to use

quartz kindle
#

msg.awaitReactions()

#

a collector is good for long term usage, for example "listen to all reactions for X amount of time and to Y for each reaction"

#

awaitReactions is better for "listen to this specific reaction then send a reply or do something"

stark abyss
#

okay I am using two reactions

quartz kindle
#

where's the other one?

stark abyss
#

i just didn't show it in code

quartz kindle
#

dont hide code when asking for help, otherwise you may get incomplete answers

#

we answer based on the code we see

stark abyss
#

No that wasn't my intention I just found it unnecessary to show all code and thought to keep it to minimum

#
    message.channel.send(confirmation).then(async msg => {
      msg.react('❎')
      setTimeout(function(){msg.react('✅')}, 2000)
      msg.awaitReactions('✅')

      const proceedFilter =  (reaction, user) => reaction.emoji.name === '✅' && user.id === message.author.id;
      const cancelFilter =  (reaction, user) => reaction.emoji.name === '❎' && user.id === message.author.id;
      const proceed = msg.createReactionCollector(proceedFilter, {time: timeout})
      const cancel = msg.createReactionCollector(cancelFilter, {time: timeout})

      proceed.on('collect', r => {
//code
        })
      })

      cancel.on('collect', r => {
        msg.delete()
      })
#

I already heard and know this is definitely not the efficient way to do it, but that is working for me

quartz kindle
#

is that code supposed to listen for one answer only?

#

or can multiple people keep reacting and it will do different things?

stark abyss
#

i am trying to have it only one person and answer

quartz kindle
#

then you're doing it the wrong way

#

a lot of that code is very redundant and unnecessary, if not completely broken

stark abyss
#

i just get rid of all reaction in proceed after doing something

#

that pretty much stops from other inputs

#

honestly don't see a problem in this except it's giving an error even though it's working

quartz kindle
#
let msg = await message.channel.send(confirmation);
await msg.react(yes);
await msg.react(no);
let response = await msg.awaitReactions((r,u) => u.id === message.author.id && [yes, no].includes(r.emoji.name), {time:10000, max:1});
if(!response.size) {
  did not respond
} else if(response.first().emoji.name === yes) {
  proceed
} else {
  await msg.delete()
}
stark abyss
#

what is r, u? is r yes and u no

quartz kindle
#

(reaction,user)

stark abyss
#

oh okay thank you

quartz kindle
#

async await is your friend

stark abyss
#

yeah nephehL

blissful coral
#

anyone able to help?

quartz kindle
#

make sure the function is in the global scope

#

and not behind some wrapper or onload event

blissful coral
#

I imported the file in the head

#

and the external file is just the plane function testWebhook() with a feq require()s at the top

quartz kindle
#

is it live? can you dm link?

#

<link rel="text/javascript" href="../../../post.js">

#

<script> not <link>

#

<script src="myscripts.js"></script>

copper cradle
#

ah yes

pale vessel
#

<script src="main.css"></script>

quartz kindle
#

ah yes, the negotiator

wicked pivot
#

Hello, does anyone have a good handle on puppeteer here?

blissful coral
mighty ember
#

is anyone willing to give an example of how to make my bot send a message when someone votes my server?

quartz kindle
blissful coral
mighty ember
#

i'm asking how to have my bot SEND A MESSAGE when someone votes for my SERVER

misty sigil
#

use a webhook

#

what language are you using

mighty ember
#

python

mighty ember
misty sigil
#

use a webhook

blissful coral
#

^

mighty ember
misty sigil
#

the top.gg webhook posts to your webserver

#

which sends a message through your bot

misty sigil
mighty ember
misty sigil
#

yes

brazen stone
#

webhook = some running server that can intercept a HTTP request