#development

1 messages · Page 987 of 1

dapper lynx
#

So it'd be

"dankmemes": attachFiles(`./images/dankmemes.png`), 
#

?

pale vessel
#

no, attachFiles can be used on embeds

#

embed.attachFiles(path, name);

dapper lynx
#

Oh, i'm trying to do it for my object thing

pale vessel
#

in the embed, you can use attachment://name for the thumbnail

#

name must have an extension

#

you can just put image.png

indigo matrix
#

yes, i am looking at the source for top.gg rn

#
<p class="is-flex"><span class="bot-name">Centauri</span>```
dapper lynx
#

So if it's in a folder then my current setup is correct?

"dankmemes": "./images/dankmemes.png", 
pale vessel
#

yeah

#

that would be the path

quartz kindle
#

if you're going to reuse those files, you could preload them into buffers

pale vessel
#

i'm assuming you can use path for attachFiles, if i'm wrong, you have to use new MessageAttachment()

#

Tim can you use paths for attachFiles?

quartz kindle
#

pretty sure you can

dapper lynx
#

I am able to use paths for embed.setThumbnail right?

quartz kindle
#

not directly for local paths, only remote url's can be used directly

pale vessel
#

you need to use the name you gave from attachFiles()

quartz kindle
#

local paths need to be in attachment form

pale vessel
#

so let's say you added an attachment called file.png using embed.attachFiles(subredditImages[subreddit], "file.png"), you'll need to set the thumbnail to attachment://file.png

dapper lynx
#

Honestly if doing it with paths is just going to complicate stuff more than it should, i'll just upload the images to imgur like i did last time lol

pale vessel
#

it won't, just an extra line of code to attach the image to the embed

#

i gave you an example

#

you can use attachFiles like addField(), just add it to your embed

jovial nexus
#

is there a way to set in an embed the days since the server was created?

pale vessel
#

sure

#

grab the created timestamp

jovial nexus
#

I have 03/03/2019 and i want 03/03/2019, (105 days ago) for example

dapper lynx
#

So do i just do this my subredditThumbnails[json.subreddit] thing and also include attachFiles without breaking my setThumbnail

pale vessel
#

yeah

quartz kindle
#

subtract the created time from the current time

#

then convert it to days

pale vessel
#

attachFiles requires a second parameter which is the file name

jovial nexus
#

how do i do that

quartz kindle
#

its basic math lol

pale vessel
#

name is optional actually

quartz kindle
#

Date.now() gives you the current time in milliseconds, in javascript

pale vessel
#

just add attachment:// before thumbnail name then

#

sorry for the confusion

#

and attach the file using attachFiles(path)

jovial nexus
#

how do i know in miliseconds the date when the server was created?

dapper lynx
#

Wait so i'd put "attachment://./images/memes.png"

pale vessel
#

just the name

quartz kindle
#

in discord.js you have a guild.createdTimestamp property

pale vessel
#

that's why giving it a name is easier

#

path, name

#

name would be something like "file.png"

#

so that you don't need to change anything on the thumbnail

dapper lynx
pale vessel
#

wait

#

add attachFiles first, you can put it after setFooter

quartz kindle
#
embed
.attachFiles([{attachment:"./my/path/here.png",name:"randomNameHere.png"}])
.setImage("attachment://randomNameHere.png")
pale vessel
#

should probably just use file options since it's just one image

night bridge
quartz kindle
#

your bot is running out of memory

#

how big is your bot?

dapper lynx
#

I'm pretty sure doing it with paths will stop my custom object from working

#

Or not idk

quartz kindle
#

it wont

#

why would it

night bridge
#

how to clear memory?

dapper lynx
#

Bruh so how do i add all 3 files .attachFiles

pale vessel
#

why three?

night bridge
#

i think i just made code mistake to get out of memory

pale vessel
#

ah images

dapper lynx
#

The 3 images to attachFiles

pale vessel
#

nah, only the ones that are local

earnest phoenix
#

hi

quartz kindle
#

you only need to attach files when the file is local, you dont need to attach remote files, such as the urls you get from the subreddit api

pale vessel
#

like your thumbnails

#

so one

night bridge
#

how to make your bot offline?

pale vessel
#

delete it from discord developer portal

quartz kindle
#

but if you want to attach more than 1 local file, .attachFiles takes an array, if you havent noticed: ([{}])

dapper lynx
#

Well i have 3 images in my directory and i want to be able to use all 3 so that my Thumbnail will work properly

quartz kindle
#

so you can just add more attachments to the array

dapper lynx
#

Okay

pale vessel
#

you only need to use one per command right?

quartz kindle
#

you dont need to use all 3 in a single embed tho?

pale vessel
#

why attach three?

quartz kindle
#

unless you're using them in different places

pale vessel
#

only attach the ones that you need to use

dapper lynx
#

Because the thumbnail will be random

quartz kindle
#

like thumbail, image, icon

slender thistle
#

Anyone speaking Pascal here?

dapper lynx
#

Because my subreddits are random

pale vessel
#

grab a random one first and then attach the random one

#

wait no

quartz kindle
#

but each message only sends 1 embed, right? for 1 subreddit

night bridge
quartz kindle
#

and only has 1 attachment

#

and only 1 thumbnail

night bridge
#

i tried loop that and get out of memory

dapper lynx
#

But then the subreddit changes on the next command execute

pale vessel
#

it's literally the same way you set the current thumbnail

#

no really

quartz kindle
#

@dapper lynx the embed.attachFiles() method works on that single embed, not all embeds. for each different embed you need to attachFile again

#

no reason why you cant attach a different file every time

pale vessel
#

but you only need to add one line and change the thumbnail to a fixed name

dapper lynx
#

So then if i attach just the memes png for memes subreddit then the other 2 won't have thumbnails

quartz kindle
#

dude

#

you have to attachFile on every single embed

pale vessel
#

the path will be different dude

quartz kindle
#

the others will be different distinct embeds

#

not the same embed

pale vessel
#

it changes every time you send the embed

dapper lynx
#

I only have the 1 embed, it uses an api

quartz kindle
#

a single embed cannot have multiple thumbnails

pale vessel
#

no like the path is based on the subreddit you get

#

so it'll be according to the subreddit, random or not

#

so you only need to attach one image

dapper lynx
#

But then that one image will display on all subreddits?

quartz kindle
#

dude

#

what are you not understanding

#

on each command, you check which subreddit it is, then from this subredit data you pick an image, then you attach this image, and you send the embed

#

rinse and repear

pale vessel
#

ok, here's a simple example:

.setFooter("bla");
.attachFiles(subredditThumbnails [json.subreddit], "name.png")
.setThumbnail("attachment://name.png")```
pure lion
#

Can't you just use setImage multiple times?

pale vessel
#

no

#

you can only have one image per embed

quartz kindle
#

that will replace the previous image

pure lion
#

Oh makes sense

#

Btw dumb question but is there an eval I can run that logs the perms for my bot in the guild?

dapper lynx
#

But if i hardcode a certain image to attachFiles then how is it going to change to a different image according to the subreddit

pale vessel
#

it's not hard coded

#

it's based on the subreddit your bot got, i even gave you the example

dapper lynx
#

So do you just literally put "name.png"?

pale vessel
#

yeah, any name

#

so that you can use the same name for the thumbnail

#

otherwise, you'd need to get the file name from the file path, etc.; annoying

quartz kindle
#

@pure lion if you have an eval command, just do the same thing you would do in a command

pure lion
#

But idk what it is

pale vessel
#

guild#me

pure lion
#

Oh thx

quartz kindle
#

something like message.guild.me.permissions

pale vessel
#

that would be your bot as a guild member, which then you can get permissions

dapper lynx
#

Because paths are invalid url

pale vessel
quartz kindle
#

...

#

lmao

pale vessel
#

LMAO

#

so you can't use local path

#

dude you can just use urls man

#

it's not even worth it at this point

#

just upload it to imgur

dapper lynx
#

That's what i said about the imgur but you two are insisting that this will work when it wont

quartz kindle
#

look, you have 3 urls, for 3 subreddits right?

#

here's what happens

dapper lynx
#

It will work just not how i intend

pale vessel
#

attachFiles(new Discord.MessageAttachment(path, "name.png")) try this @dapper lynx

quartz kindle
#
  1. you receive a command
  2. you read the reddit data from the reddit api
  3. you receive the reddit data
  4. you check which subreddit it is from the reddit data you received
  5. based on this subreddit, you pick the relevant path that you have saved for this subreddit
  6. you use this path and put it in embed.attachFiles()
  7. embed.attachFiles() lets you define a custom name for the file
  8. you use this custom name you defined to set it in embed.setThumbnail()
  9. you send the embed
dapper lynx
#

The api, changes the data after a refresh, so it isn't as simple as 1 command for only 1 sub reddit and then a different command for another, everytime you run the same command with the same code the api has different data, so putting a certain image will not work because that same code will have different data from the api when it is next executed......

quartz kindle
#

nobody said that

pale vessel
#

oh my god

quartz kindle
#

you dont hardcode anything

#

dude

#

you pick a path based on the subreddit information you received

pale vessel
#

this

quartz kindle
#

it can be as simple as ```js
if(subreddit === "memes") { path = "./images/memes.png" }
else if(subreddit === "dankmemes") { path = "./images/dankmemes.png" }
else if ....
embed.attachFiles([{attachment:path,name:"randomnamehere.png"}])

#

where subreddit is the data you received from the api, not from the command

#

aka json.subreddit

pale vessel
#

do you actually understand now xd

earnest phoenix
#
if (message.member.hasPermission("KICK_MEMBERS") || message.member.hasPermission("BAN_MEMBERS") || message.member.hasPermission("MANAGE_GUILD") || message.member.hasPermission("MUTE_MEMBERS") || message.member.hasPermission("DEAFEN_MEMBERS") || message.member.hasPermission("MOVE_MEMBERS") || message.member.hasPermission("MANAGE_NICKNAMES") || message.member.hasPermission("MANAGE_ROLES") || message.member.hasPermission("MANAGE_WEBHOOKS") || message.member.hasPermission("MANAGE_EMOJIS ")) return;```

When i try to send a message(for an anti link) with a user without them:

`(node:27019) UnhandledPromiseRejectionWarning: RangeError: Invalid bitfield flag or number.`

Discord.js: 11.6.4
pale vessel
#

use an array dude

#

anyway

earnest phoenix
#

I hate array and this isn't the problem for this error i think3684_feelsthinkman

pale vessel
#

yeah that's why i said anyway

earnest phoenix
#

Oh wait

pale vessel
#

anyway

earnest phoenix
#

Ok sorry

quartz kindle
pale vessel
#

one of the name is an invalid permission

earnest phoenix
#

Yeah lol

#

Sorry

#

I have found this

#

one of the name is an invalid permission
@pale vessel yeah

#

When i have sent the message here I've been thinking about the spaces

pale vessel
#

you can use an array, like .some

north burrow
#

ahh

earnest phoenix
#

Thanks PES_SadShrug

#

you can use an array, like .some
@pale vessel good suggestion, thanks!

north burrow
#

@pale vessel good suggestion, thanks!
@earnest phoenix no problem 🙂

earnest phoenix
#

🙂

grizzled raven
#

please

#

discord.js accepts arrays and converts them into bitfields

earnest phoenix
#

Ik lol

grizzled raven
#

if (message.member.hasPermission(["KICK_MEMBERS", ...permissions])) return

earnest phoenix
#

Yeah

north burrow
#

robux

pale vessel
#

he's using || so he needs to use .some

quartz kindle
#

will that behave like || tho? or behave like &&?

earnest phoenix
#

I use || because i check only one permission per one permission PES_SadShrug

pale vessel
#

&& [Tim]

earnest phoenix
#

&&
@pale vessel and i need || not &&

pale vessel
#

he's using || so he needs to use .some
@pale vessel

earnest phoenix
#

Mmmh

#

But

quartz kindle
#

just compare the bitfield directly :^)
bitfield & bitfield

earnest phoenix
#

Lol

#

Too smart

pale vessel
#

tim mentioned the array (hasPermission(array)) so i said that it acts like &&

#

so yeah

earnest phoenix
#

Oh ok

pale vessel
#

&& would be .every

earnest phoenix
#

Ok ok

#

Nice to know

wheat valve
#

how would you get a link from the other args in a command? Like ?command (link) and have the bot respond with the link in the message, for example, "message (link from the command)". If that makes sense, I use discord.js

tight plinth
#

Use args

#

And check if every arg is a url or not

#

And send the one who is a url

placid cobalt
#

hey. does anyone here have any experience making web dashboards that could help me?

quartz kindle
dire stag
#

guys

still merlin
#

yes?

dire stag
#

the code wont work

#

i think all the videos are old

#

node index.js wont work

#

says MODULE_NOT_FOUND

solemn latch
#

you better find it

dire stag
#

i cant even ones form 3 weeks ago are not working

solemn latch
#

modules need to be installed

vale garden
#

hi

solemn latch
#

or put in the proper folder

vale garden
#
const Discord = require("discord.js");
const client = new Discord.Client();
const db = require('quick.db')
const economy = new db.table('economy')
const ms = require('parse-ms')

module.exports = {
  name: 'work',
    description: "provides users money for working",

  async execute (message, args) {

    let timeout = 3.6e+6
    let amount = Math.floor(Math.random() * 900 + -100)

    let timer = await db.fetch(`timer_${message.author.id}`);

        if (timer != null && timeout - (Date.now() - timer) > 0) {
            let time = ms(timeout - (Date.now() - timer));
            message.channel.send(`You can only work again in **${time.hours}h ${time.minutes}m ${time.seconds}s**`)


        } else {
          if (amount > 0){
            let embed = new Discord.MessageEmbed()
            .setColor("GREEN")
            .setTitle(`**Work Money**`)
            .setDescription("You have received **`"+amount+"`** coins. Nice work kid!")
            message.channel.send(embed)}

            else if (amount === 0) {
            let embed2 = new Discord.MessageEmbed()
            .setColor("YELLOW")
            .setTitle(`**Work Money**`)
            .setDescription("You have received **`0`** coins [No Money] for doing a terrible job lol.")
            message.channel.send(embed2)
            }

            else if (amount < 0){
            let embed3 = new Discord.MessageEmbed()
            .setColor("RED")
            .setTitle(`**Work Money**`)
            .setDescription("*You have gained* **`"+amount+"`** *coins for doing a great job*. Yeah we fired you for destroying our office. Goodbye")
            message.channel.send(embed3)
            }

            db.add(`money_${message.author.id}`, amount)
            db.add(`daily_${message.author.id}`, Date.now())
        }


  }
}

this is my work command's code

#

but the cooldown isnt working

#

im using quick.db

dire stag
#

...

#

...

vale garden
#

can someone elp

#

help

#

what

dire stag
#

...

vale garden
#

wat

solemn latch
#

cooldowns should be done in the command handler

vale garden
#

what

#

for the daily and weekly commands

#

i did them here

solemn latch
vale garden
#

and they worked

#

wait nvm they didnt

#

lol

solemn latch
#

why not do all of them in the command handler

vale garden
#

what

#

by command handler

#

you mean index.js

#

?

solemn latch
#

if your command handler is in index.js, yes

vale garden
#

yea

#

the commands

#

ok

#

ok but how do i do it in the command handler

vale garden
#

ok

#

oh ok thx

#

but how do i

#

oh

#

wait nothing

#

nvm

#

lol

dire stag
#

the bot still wont respond with ready

#

i even scrapped the youtube videos

solemn latch
#

you using discordjs @dire stag ?

dire stag
#

?

#

yeah

#

is it old?

solemn latch
#

no

#

its used all the time

dire stag
#

so whats the porblem...

#

yeah just did it

solemn latch
#

this guide is up to date 100%

dire stag
#

tells me to make a index.js file and run a code

solemn latch
#

it also tells you to install some things

#

like discordjs, nodejs, linters, code editors

dire stag
#

discord.js

#

and node.js are downloaded

quartz kindle
#

you need to explain whats going on better, else we cant help

#

like showing the errors, showing your code

#

for example you said you were getting module not found

#

which module? show the full error

dire stag
#

i will redo again

#

i deleted the codes 3 times

#

Error: Cannot find module '/Users/private'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []

quartz kindle
#

what command did you run?

#

did you run it from cmd or from visual studio terminal?

#

or from powershell

#

show which files you have in your bot folder

dire stag
#

visual

#

i had

#

main.js

#

index.js

#

nodemodule

#

and two jsons

quartz kindle
#

show the contents of both main.js and index.js

#

also show the contents of package.json

tulip ledge
#

Somewhere in your code you are requiring /Users/private wich doesn't exist

dire stag
#

i have deleted theö

#

them

quartz kindle
#

...

vale garden
#
bot.on('message', async message => {

if (!message.content.startsWith(PREFIX)) return;

let args = message.content.slice(PREFIX.length).split(" ");

let messageArray = message.content.split(" ");
let command = messageArray[0];

if (!cooldowns.has(command.name)) {
    cooldowns.set(command.name, new Discord.Collection());
}

const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 3) * 1000;

if (timestamps.has(message.author.id)) {

  const expirationTime = timestamps.get(message.author.id) + cooldownAmount;

    if (now < expirationTime) {
        const timeLeft = (expirationTime - now) / 1000;
    function cooldown () {
         return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`);
    }
    }

}
dire stag
#

once i have re coded them i will

tulip ledge
#

Then press ctrl + S

vale garden
#

im pretty sure this is how a cooldown is written

#

but it isnt working

#

^

#

can someone help

quartz kindle
#

nor command.cooldown

tulip ledge
#

No its not that

vale garden
#

oh

tulip ledge
#

He made a function but he isn't calling it

quartz kindle
#

you're defining command as the first word in the message content

#

not as a command from your command handler

tulip ledge
#

Also that

vale garden
#

what

tulip ledge
#

You also have to call your function or it won't work either

quartz kindle
#

you did this ```js
let messageArray = message.content.split(" ");
let command = messageArray[0];

#

meaning

#

messageArray is the content of the message split by spaces

#

and command is the first word of the message

#

so command is a string, a piece of text

solemn latch
#

i need to stop giving people guides on what they want.
they skip to the part that says what they want, and ignore everything else

quartz kindle
#

therefore, command.name and command.cooldown dont exist, because command is a piece of text, not an object

dire stag
solemn latch
#

all of this was covered in the link i sent

vale garden
#

oh

tulip ledge
#

@solemn latch many people just come here expecting people will do the work for them and not do anything themselves

#

I used to aswell but then I realized it's way more fun if people set you on the right track but you find the solution yourself

vale garden
#
bot.on('message', async message => {

if (!message.content.startsWith(PREFIX)) return;

let args = message.content.slice(PREFIX.length).split(" ");
const command = args.shift().toLowerCase();

if (!cooldowns.has(command.name)) {
    cooldowns.set(command.name, new Discord.Collection());
}

const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 3) * 1000;

if (timestamps.has(message.author.id)) {

  const expirationTime = timestamps.get(message.author.id) + cooldownAmount;

    if (now < expirationTime) {
        const timeLeft = (expirationTime - now) / 1000;
    function cooldown () {
         return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`);
    }
    message.channel.send(cooldown)
    }

}
#

i changed it to this

quartz kindle
#

makes no difference

#

command is still a piece of text

vale garden
#

what

earnest phoenix
#

cooldown()

vale garden
#

ok so

#

how do i define command

#

cuz

#

isnt that

solemn latch
#

its in the guide

quartz kindle
#

if you want to use command.name and command.cooldown you need to define command as a command object from your command handler

#

ie client.commands.get(command) or something like that

solemn latch
quartz kindle
#

idk where your commands are stored

vale garden
solemn latch
#

and on the next page...

dire stag
#

where do i store the index.js files?

#

ppl say that it should not be in the node section

quartz kindle
#

in the same folder as package.json

solemn latch
#

your just copy pasting code into yours, and not reading what it does

vale garden
#

ih

#

oh

solemn latch
#

and then saying it should work

earnest phoenix
solemn latch
#

read a line, understand what it does, then add it.
then go to the next line, read what it does then add it.
repeat.

earnest phoenix
#

@solemn latch WowPls

solemn latch
earnest phoenix
dire stag
#

alright

#

im about to run it again

vale garden
#

okok

dire stag
#

what type of screenshots you need?

quartz kindle
#

everything you got

dire stag
vale garden
#

aaaaaaaaaaaaaaaaaaa

#
bot.on('message', async message => {

if (!message.content.startsWith(PREFIX)) return;

let args = message.content.slice(PREFIX.length).split(" ");

try {
    bot.commands.get(command).execute(message, args);
} catch (error) {
    console.error(error);
    message.reply('there was an error trying to execute that command!');
}

if (!cooldowns.has(command.name)) {
    cooldowns.set(command.name, new Discord.Collection());
}

const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 3) * 1000;

if (timestamps.has(message.author.id)) {

  const expirationTime = timestamps.get(message.author.id) + cooldownAmount;

    if (now < expirationTime) {
        const timeLeft = (expirationTime - now) / 1000;
    function cooldown () {
         return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`);
    }
    message.channel.send(cooldown)
    }

}

#

this is it now

#

still says command is not defind

quartz kindle
#

lol

vale garden
#

now i srsly dont understand how to define it

#

lol

dire stag
#

...

solemn latch
#

you need to define command hmmm

vale garden
#

how

dire stag
#

woo can yall help me than help him?

quartz kindle
#

@dire stag you showed exactly the file i dont need lmao, but good now i can see how your folder looks like

#

show your package.json and your index.js

dire stag
#

i know

#

the other had my token in it

#

aight il take it out

quartz kindle
#

yes

vale garden
#

what do i do

quartz kindle
#

@vale garden combine this with what you had before

#

take the word from the message content, like you were doing before, and use the word to obtain the command from the command handler

quartz kindle
#

@dire stag ok, first as you can see, your index.js is unsaved

#

so save it

dire stag
#

yessir

solemn latch
vale garden
#

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

quartz kindle
#

@dire stag now in your package.json, where is says "main":"main", change it to "main":"index.js" and again save the file

vale garden
#
bot.on('message', async message => {

if (!message.content.startsWith(PREFIX)) return;

const args = message.content.slice(PREFIX.length).split(/ +/);
const command = args.shift().toLowerCase();

    if (!bot.commands.has(command)) return;

    try {
        bot.commands.get(command).execute(message, args);
    } catch (error) {
        console.error(error);
        message.reply('there was an error trying to execute that command!');
    }

if (!cooldowns.has(command.name)) {
    cooldowns.set(command.name, new Discord.Collection());
}

const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 3) * 1000;

if (timestamps.has(message.author.id)) {

  const expirationTime = timestamps.get(message.author.id) + cooldownAmount;

    if (now < expirationTime) {
        const timeLeft = (expirationTime - now) / 1000;
    function cooldown () {
         return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`);
    }
    message.channel.send(cooldown)
    }

}```
#

see this

#

looks good to me

#

but the cooldown doesnt work

solemn latch
#

your executing the command

#

above the cooldown

dire stag
#

alright

vale garden
#

oh

#

lol

quartz kindle
#

@dire stag now open your terminal, and send a pic of your terminal

solemn latch
#

plus you need to define cooldown in your command itself, if you havent yet

dire stag
#

should ı run it ?

quartz kindle
#

confirm that your terminal is in the correct folder

#

run ls

#

and if its in the correct folder, it should show your index.js and package.json files

dire stag
#

i tested run as if it would work

#

hehe

daring musk
#

This doesnt work```ts
const server = http.createServer((req, res) => {
if (req.method === "GET") {
res.writeHead(200);
res.end("Hello!");
}
});

// Discord Bot List Client
const dbl = new DBL(token, {
webhookAuth: password,
webhookServer: server,
});

// Post Server Stats
const postStats = () =>
dbl
.postStats(guilds.size)
.then(() => log("Posted Stats", "DBL"))
.catch((err) => handleError(err, "Posting stats to DBL"));

postStats();
setTimeout(() => postStats, 1800000);

const webhook = dbl.webhook;
if (typeof webhook === "undefined")
throw new Error("DBL Webhook is undefined!");

webhook.on("ready", (hook) =>
log(Webhook running at ${JSON.stringify(hook, null, 2)}, "DBL")
);

// Every upvote means an extra boost
webhook.on("vote", (_, userId) => {
const main = async () => {
// If user exists good else create one
const userDoc =
(await User.findById(userId)) || new User({ _id: userId });
// Add one boost or two on weekends
userDoc.availableBoosts += (await dbl.isWeekend()) ? 1 : 2;
await userDoc.save();
log(User voted! ${userId}, "DBL");
};

main().catch((err) => handleError(err, "DBL Webhook"));

});```

earnest phoenix
#

What is this?

daring musk
#

Ngrok Logs ```HTTP Requests

GET / 200 OK
POST /
GET / 200 OK
Console Logs[DBL] Webhook running at {
"hostname": "0.0.0.0",
"port": 0,
"path": "/dblwebhook"
}
[DBL] Listening on 5000
[DBL] Posted Stats

#

What do you mean by what is this?

vale garden
#

plus you need to define cooldown in your command itself, if you havent yet
@solemn latch how

#

all i saw in the guide was

daring musk
#

Anyone??

vale garden
#

cooldown: time

solemn latch
#

ye

vale garden
#

so i did that

#

lol

solemn latch
#

okay

quartz kindle
#

@daring musk why are you doing (_, userId) => {

vale garden
#

none of the commands are working

#

no error

#

nothing

#

just commands not working

daring musk
#

@daring musk why are you doing (_, userId) => {
@quartz kindle I dont need the botId, Just need userId

quartz kindle
#

yes but the event gives you a single object

daring musk
#

WTF

quartz kindle
#

obj => {

#

obj.user

daring musk
#

The types are fucking messed up

quartz kindle
#

assuming you're using dblapi.js

daring musk
#

I am

faint spade
#
user[message.guild.id] = {
userid: message.author.id
}```
I want to list all the values in the array as <@user[message.guild.id] .userid> how can I do this?
or how should I search this on the internet my english is not good
vale garden
#
TimeoutOverflowWarning: 86400000000 does not fit into a 32-bit signed integer.
daring musk
#

This is the second time I see your discord lib is mesed up

vale garden
#

does anyone know

#

what i can do

#

for that problem

#

wait

#

no nvm

quartz kindle
#

never trust ide/ts intelli/typings

dire stag
#

tim

#

whats next?

quartz kindle
#

did you run ls as i told you?

dire stag
#

ls?

#

i cant read the text

daring musk
#

never trust ide/ts intelli/typings
@quartz kindle Welp, tsc complains if I dont trust them

quartz kindle
#

dont use ts then :^)

daring musk
#

WTF

quartz kindle
#

@dire stag what text

dire stag
#

ls

quartz kindle
#

ls

#

literally

dire stag
#

whats ls

quartz kindle
#

type ls

#

and press enter

daring musk
#

On your cmd

#

Or Terminal or whatever it is

dire stag
#

(node:9148) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
cans-MacBook-Pro:JARbot ckara$ ls
index.js package-lock.json
node_modules package.json

quartz kindle
#

ok

#

is your index.js saved?

#

did you save it again after putting your token back in?

dire stag
#

yes

quartz kindle
#

then run node index.js

dire stag
#

nhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict

quartz kindle
#

what is the error

#

there should be more info above

dire stag
#

ok

#

cans-MacBook-Pro:JARbot ckara$ node index.js
(node:9155) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (/Users/can/JARbot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:135:26)
at Client.login (/Users/can/JARbot/node_modules/discord.js/src/client/Client.js:221:21)
(node:9155) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9155) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

quartz kindle
#

invalid token

dire stag
#

hmmm

#

ok i will change and save

quartz kindle
#

where are you getting the token from?

#

you have to get it from the Bot section not the Application section

dire stag
#

yes

#

said the same thing

#

could it be because we changed main to index.js

cinder patio
#

Any idea on how to sort strings in javascript? I know array.sort() would sort all strings in the array in ascending order but the problem is that the array contains objects, not strings

quartz kindle
#

@dire stag no

#

if it says that the token is invalid, it means everything else is correct, except the token

cinder patio
#

I could map the array so it contains the strings that need to be sorted, but I need the array with the objects sorted as well

quartz kindle
#

sort takes a sorting function

dire stag
#

bruh

daring musk
#

WTF Still doesnt work

dire stag
#

hmmmm

quartz kindle
#

so you can do .sort((a,b) => b.string - a.string)

#

if the object is {string:"something"}

cunning aurora
#

Hi

#

Hi

#

Hi

#

Hi

#

Hi

quartz kindle
#

stop spam

cinder patio
#

But doesn't string - string equal NaN?

solemn latch
#
function sortByDate( a, b ) {
  if ( a.created_at < b.created_at ){
    return -1;
  }
  if ( a.created_at > b.created_at ){
    return 1;
  }
  return 0;
}

myDates.sort(sortByDate);//myDates is not sorted.
cunning aurora
#

!p panda

cinder patio
#

so it's not sorting them

dire stag
#

Last login: Tue Jun 23 10:56:17 on ttys000
cans-MacBook-Pro:~ ckara$ node index.js
internal/modules/cjs/loader.js:969
throw err;
^

Error: Cannot find module '/Users/can/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
cans-MacBook-Pro:~ ckara$

slender thistle
#

@cunning aurora please don't spam, and #commands for commands

dire stag
#

token is correct

cinder patio
#

Every article about sorting strings is using .sort() and .sort().reverse() but that's if the array is containing strings only? I can't imagine what the function for sorting strings in an ascending/descending order

quartz kindle
#

@cinder patio ```js
function compare(a, b) {
if (a is less than b by some ordering criterion) {
return -1;
}
if (a is greater than b by the ordering criterion) {
return 1;
}
// a must be equal to b
return 0;
}

#

thats what the .sort() function wants to receive

solemn latch
#

^

cinder patio
#

I know, but how would I compare the strings

quartz kindle
#

you can compare with < >

cinder patio
#

That's a thing??

quartz kindle
#

ye

#

it evaluates to the character's ascii codes afaik

solemn latch
#

could you just use localeCompare

quartz kindle
#

@dire stag you opened your terminal to the wrong folder now

dire stag
#

have i

solemn latch
#
function compare(a,b) {
  return a.localeCompare(b)
}
quartz kindle
#

localeCompare is good because it handles accents and stuff as well

solemn latch
#

PogSpin i said something useful

dire stag
#

i used the terminal even from the index.js files

#

wont work

quartz kindle
solemn latch
#

oo

quartz kindle
#

@dire stag what error now

dire stag
#

how can i see which file im opening it from?

quartz kindle
#

you see the current folder in the text before the area where you write

cinder patio
#

thanks

dire stag
#

which file do you want me to open it from ?

quartz kindle
#

from the same folder

#

in your previous terminal, you had cans-MacBook-Pro:JARbot ckara$

#

in the current you have cans-MacBook-Pro:~ ckara$

#

the previous was in the JARbot folder, the latter is not

dire stag
#

ok

quartz kindle
#

you can do this

#

with your bot folder open in finder

dire stag
#

im on it

#

Last login: Tue Jun 23 11:50:51 on ttys000
cans-MacBook-Pro:~ ckara$ cd JARbot
cans-MacBook-Pro:JARbot ckara$ node index.js
(node:9206) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (/Users/can/JARbot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:135:26)
at Client.login (/Users/can/JARbot/node_modules/discord.js/src/client/Client.js:221:21)
(node:9206) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9206) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
cans-MacBook-Pro:JARbot ckara$

quartz kindle
#

still invalid token

#

did you save the file after replacing the token?

dire stag
#

yes

#

if ypu want i can get rid of the file and re code it ?

quartz kindle
#

well then you're either doing something wrong or using the wrong token

dire stag
#

token is correct

quartz kindle
#

recoding it wont make a difference

dire stag
#

let me re code it

#

oh

#

than il make a new bot and use its token

quartz kindle
#

how are you inputting your token?

dire stag
#

copy and paste

quartz kindle
#

like this? client.login("uiuUHRNPR#Yc938MP@C839832h")

#

with the quotes

dire stag
#

single quotes

#

no

#

no dont tell me

#

it was double

quartz kindle
#

no

#

it can be single

dire stag
#

is it double ?

#

okey

quartz kindle
#

and you're copying it from the Bot section of your developer portal?

dire stag
#

lets try double

#

yessır

quartz kindle
#

did you try regenerating it?

dire stag
#

lets do it agaın

paper phoenix
#

Just checking my logs while at work and noticed several 500 errors from Top.gg. I'm assuming this is just failing to post server/shards, etc?

dire stag
#

ok i have regenarated it

slender thistle
#

Ehh... little issues here and there, so best you try to ignore them and wait until it's fixed

dire stag
#

saved it

#

should İ run it

#

here you go this is how the index file looks

paper phoenix
#

@slender thistle - Cheers. It's not affecting anything or causing any issues on my end. Could that be why my vote count seems to differ from Top's? Seems it missed sending me some

dire stag
slender thistle
#

I assume so, yup

pure lion
#

Yeah that should work @dire stag

dire stag
#

so lets place the token

#

opps

restive furnace
#

its node

dire stag
#

😩

restive furnace
dire stag
#

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9242) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
cans-MacBook-Pro:JARbot ckara$

#

followed everything on the guide

pure lion
#

E h?

restive furnace
royal granite
#

eey

server.createChannel("testy", "text")```
so i have this
and it says server not defined
i tried `discord.server` but doesnt work
pure lion
#

@royal granite message.guild

royal granite
#

ooh thats right

#

thx

pure lion
#

Lol

restive furnace
#

its guild nowdays

#

almost every lib

pure lion
#

Oh ye that too-

royal granite
#

wait so message.guild or just guild

pure lion
#

Message.guild

restive furnace
#

@royal granite message.guild

earnest phoenix
#

Does anybody how to resize the image that's filled to a circle in canvas by clip so it doesn't zoon in like this?

pure lion
#

Message holds all the info including IDs of the guild, roles, and other cache shit

royal granite
#

oh rip message.guild.createChannel is not a function

solemn latch
#

Display image can crop and resize.

pure lion
#

Uh

solemn latch
#

Or just resize

earnest phoenix
#

<message>.guild.channels.create()

#

@royal granite

#

@solemn latch i mean an image filled into a circle

#

Not one before it's filled

solemn latch
#

Why not resize it first, then fit it to a circle

pure lion
#

Can't you use ffmpeg?

earnest phoenix
#

What?

#

@solemn latch ik lemme try then

pure lion
#

Not entirely sure but doesn't it have an image resize function ://

royal granite
#

<message>.guild.channels.create()
@earnest phoenix wow it actually works, thx

solemn latch
#

I've made a few canvas games, resizing is entirly possible in canvas

#

Its just not very efficent

royal granite
#

wait so can i just do "message.guild.channels.delete()"

#

to delete a channel

restive furnace
#

<message>

#

your msg variable what ever it is

#

but yes

royal granite
#

yeah its message for me lol

solemn latch
royal granite
#

how can i just delete all channels and catagories

#

oh yeah thanks

#

helps

restive furnace
#

iterate through them

solemn latch
#

You shouldn't delete a group of channels imo.
Thats just one mistake command from deleting a lot of stuff

royal granite
#

ill make a confirmation thing i guess

#

im making a bot which will automatically set up a premade discord server

#

so u just choose a template and u type start and it works

earnest phoenix
#

@solemn latch this is what i did... Have no idea

let canvasC = canvas.createCanvas(700, 329);
let ctx = canvasC.getContext("2d");

let mit = await canvas.loadImage("https://wompampsupport.azureedge.net/fetchimage?siteId=7575&v=2&jpgQuality=100&width=700&url=https%3A%2F%2Fi.kym-cdn.com%2Fentries%2Ficons%2Ffacebook%2F000%2F027%2F424%2Fjoke.jpg");

await ctx.drawImage(mit, 0, 0, 700, 329);

let itl = await canvas.loadImage(message.author.displayAvatarURL({
dynamic: true,
size: 2048,
format: 'png'
}));

itl.width = 50;
itl.height = 50;

await ctx.beginPath();
await ctx.arc(465, 150, 115, 0, 2 * Math.PI, true);
await ctx.closePath()
await ctx.clip();

await ctx.drawImage(itl, 0, 0)

await ctx.beginPath();
await ctx.arc(0, 0, 25, 0, 2 * Math.PI, true);
await ctx.clip();
await ctx.closePath();
ctx.restore();

message.channel.send({ files: [{ attachment: ctx.canvas.toBuffer(), name: "Canvas.png" }] });
})()```
restive furnace
#
//for of loop.
for let c of message.channels {...}```
solemn latch
#

I'd make it not be able to delete groups of channels that are older than a few days then

#

Since that function will likely only be used during the setup process anyway, it'll stop a lot of mistakes

#

Just a thought tho

dire stag
#

im going to restart from scratch again

quartz kindle
#

i already told you, changing the code wont help

#

the issue is the token

#

for some reason the token is invalid, and it will keep being invalid no matter how much you change the code

dire stag
#

i will make a new bot

#

give me a sec

solemn latch
#

@earnest phoenix
ctx.drawImage(image, x,y, desired width, desired hight)

earnest phoenix
#

Where should i put that tho

paper phoenix
#

for some reason the token is invalid, and it will keep being invalid no matter how much you change the code
@quartz kindle - From his post earlier he's using the secret, not the token

solemn latch
#

Is itl the users avatar?

earnest phoenix
#

@solemn latch yea

quartz kindle
#

i already told him to get the token from the Bot section, he claims he did

solemn latch
#

Thats what you wanna scale, add , desired width, desired height
To it

#

Then make the circle the size you want

earnest phoenix
#

Lemme see

dire stag
#

made a new bot

#

the token is still invalid

paper phoenix
#

i will make a new bot
@dire stag Don't copy the secret from General Information. Copy the token from Bot.

dire stag
#

the coding is wrong probably

solemn latch
#

I can get a screenshot

dire stag
#

nooooo

#

nooooooooo

#

haha

#

stev you are right

#

guess who will be coding the 6 time today

quartz kindle
#

i told you to get it from the Bot section before, and you said you did it...

dire stag
#

love you stev

paper phoenix
#

I could tell because you posted your client secret earlier...

pure lion
#

Ohmygod well done-

solemn latch
dire stag
#

wait what

#

what secret

#

the token?

solemn latch
#

the secret

dire stag
#

ohhhhhhh

paper phoenix
#

No, when you posted an example of what you were trying earlier, it had the secret that you were trying.

dire stag
#

yessir

#

that was the porblem

#

anyways

#

il get back to you guys soon

#

thanks @quartz kindle for your effort

#

and the rest

#

i kinda enjoyed it

lusty quest
#

time to recode 2 bots to use MongoDB instead of Mysql. yay ....

solemn latch
#

o

#

why are you moving away from mysql?

lusty quest
#

mongodb is performanter. got already a Cluster Running -> 3 Nodes that work as a single Database

earnest phoenix
#

Is array random function possible?

lusty quest
#

i can set it up to write over the master node and read over the slave nodes

#

what did you want to have random?

earnest phoenix
#

some texts

solemn latch
#

you want to get a random thing from an array?

#

array[Math.floor(Math.random() * array.length)];

earnest phoenix
#

no not it

#

I want to use everywhere

pale vessel
#

what do you mean

amber fractal
#

just make a rng function then

compact kite
#

What Kyoya?

amber fractal
#

give it maxes and mins

#

then just do like array[getRandomNumber(0, array.length)]

royal granite
#
message.guild.channel.delete()```
`TypeError: cannot read property 'delete' of underfined`
solemn latch
#

Channel must be defined

amber fractal
#

message.guild.channel doesnt exist

#

you need a single channel instance

#

so you need to get the channel first

solemn latch
#

If you want to delete the channel the message was sent from
message.channel.delete()

#

Or what Steven said

royal granite
#

yeah i want to delete the channel where the message was sent in

compact kite
#

If you want to delete the channel the message was sent from
message.channel.delete()
@solemn latch

#

Sorry for the @ woo

solemn latch
#

Np

royal granite
#
message.guild.channels.forEach(channel => channel.delete())```
`message.guild.channels.forEach is not a function`
pale vessel
#

did you...you know... upgrade to v12?

royal granite
#

?

sudden geyser
#

Are you using Discord.js v12

royal granite
#

lol how do i check that

pale vessel
#

i tried to avoid asking that because it's so obvious what i was going to say lol

#

console.log(Discord.version) or npm ls discord.js

royal granite
#

it literally says (empty)

summer torrent
royal granite
#

oh nvm

#

im using 12.2.0

#

@pale vessel

pale vessel
#

well, read the migrating guide

#

channels have a manager now so you have to use channels.cache to access the cached channels

#

this applies to channels, roles, members, emojis, and users

restive furnace
#

especially for embeds

#

if youre using richembed

solemn latch
#

everything you need like, how to get the channels in a guild, or how to get the channel a message was sent from is easily accessable on the docs

lusty quest
#

@weak willow you can ask the API how many guilds the bot is in

woeful pollen
#

heya
could someone show me the usage of .delete
to delete webhooks, ive been struggling to do it for ages and i can't find example online

lusty quest
#

d.js?

#

if yes ```javascript
webhook.delete([reason])

earnest phoenix
#

Hello guys, I know how to make bots and I just wanna know how do I invite my bot in this server?

weak willow
#

you can ask the API how many guilds the bot is in
@lusty quest dumb question, but how buddy ?

earnest phoenix
#

Or get the role?

lusty quest
#

@weak willow what coding language did you use?

#

@earnest phoenix sorry

earnest phoenix
#

I know how to use discord.js I just wanna know how to invite my bot in for testing?

lusty quest
#

wrong

earnest phoenix
#

I know how to invite bots

lusty quest
#

login

earnest phoenix
#

I am on top.gg and where do I go?

lusty quest
#

then a button Add Bot appears on the top row

weak willow
#

@weak willow what coding language did you use?
@lusty quest js

earnest phoenix
#

But will my bot be in the website? I wanna invite my bot in this server for testing, like #commands

#

For the Bot developer role.

lusty quest
#

if you add the bot to the website they will add the bot for Approving it, If Approved you get the Role and can use the bot here (if he uses a non common prefix)

earnest phoenix
#

Okay, will they test it?

lusty quest
#

@weak willow ```javascript
console.log(bot.guilds.cache.size)

#

yes @earnest phoenix

earnest phoenix
#

K

weak willow
#

console.log(bot.guilds.cache.size)

@lusty quest thnks sir

woeful pollen
#

if yes ```javascript
webhook.delete([reason])

@lusty quest
I can't do it

#

it just deletes the message and not the webhook itself

lusty quest
#

did you got the webhook object?

woeful pollen
#

(wb => wb.delete(['e']))

lusty quest
#

i never worked with webhooks inside of d.js but its possible that you cant delete them with code

woeful pollen
#

ohh oops

earnest phoenix
#

Bruh, adding a brief description can be hard because of the errors.

#

I don't know if I have like 300 characters of letters in there.

cinder patio
#

just wait until the errors are fixed it shouldn't take long

amber fractal
#

300 or less

#

dont need exactly 300

solemn latch
#

its 300 or more isnt it hmmm

earnest phoenix
#

Even though it is less than 300.

pale vessel
#

did you count spaces or empty chars

misty sigil
#

hello

earnest phoenix
#

I counted spaces

split hazel
#

Just copy the whole thing with ctrl + a and paste it into a character count website

earnest phoenix
#

And empty spaces

misty sigil
#

how do i get the amount of members in a guild

split hazel
#

What library are you using?

quartz kindle
#

its 300 or more, not less lol

misty sigil
#

d.js

earnest phoenix
#

discord.js

#

It says I got 281 chars

split hazel
#

Assuming you're on latest, client.guilds.cache.size

#

oh oops

solemn latch
#

it actually looks like you have two errors

misty sigil
#

thats users

#

of the bot

elder vine
#

Are you able to ban users using ID anymore? djs v12

split hazel
#

guilds*

solemn latch
#

your breif description is too long, and your detailed description is too short

pale vessel
#

yes leny

#

of course

prime sapphire
#

it says at least 300 and hes got 281

pale vessel
#

id is a member resolvable

split hazel
#

That's actually a bit more complicated since the members are not guaranteed to be cached, you should fetch them all with await guild.members.fetch(); and then run guild.members.cache.size

elder vine
#

If they are not in the guild

earnest phoenix
pale vessel
#

you can't ban a member that doesn't exist

misty sigil
#

so i need async

split hazel
#

If you'd like

quartz kindle
#

@misty sigil you can combine all guild's .memberCount property

solemn latch
#

your commands, and a explanation of your bot

quartz kindle
#

you dont need to fetch all members

pale vessel
#

like reduce

split hazel
#

Oh true discord returns that

misty sigil
#

so just message.guild.memberCount

pale vessel
#

yeah

quartz kindle
#

@earnest phoenix in that black text area is where you should write a description with 300 characters or more.

earnest phoenix
#

But what should I right in there?

#

It said html or something.

quartz kindle
#

your description

#

either text, or markdown or html+css

#

anything you want

earnest phoenix
#

Of what the bot is about?

quartz kindle
#

yes

earnest phoenix
#

K I will write it in.

#

And see if it works

misty sigil
#

can i change the favicon

#

in there

quartz kindle
#

no

misty sigil
#

makes sense

#

i wanna make some fancy stuff

earnest phoenix
#

Bruh, This detailed description thing is so hard...

#

I am having trouble setting this up.

solemn latch
#

its just 300 chars

restive furnace
#

just use html/css

earnest phoenix
#

I don't know what I should do with html/css

pale vessel
#

bot description

#

website development

solemn latch
#

you dont need to put anything in html or css, you can just write text

pale vessel
#

discord bot

restive furnace
#

i can easily get up to 2000 chars with html+css

pale vessel
#

they won't count those

restive furnace
#

ah ok

earnest phoenix
#

you dont need to put anything in html or css, you can just write text
@solemn latch Bruh

#

I didn't put anything in it in html description

solemn latch
#

you have to put something

earnest phoenix
#

Like what?

solemn latch
#

it just can accept html

#

TEXT

cinder patio
#

List your bot's commands, info about the bot... etc...

solemn latch
#

hi this bot is "bots name"
it is a general purpose bots
its commands are
!help - get help info for the bot
!ban - ban a user

#

etc etc

#

thats all it wants

misty sigil
#

yes

earnest phoenix
#

It says Spaces or empty spaces are not counted...

misty sigil
#

aslong as it is 300 chars

solemn latch
#

they are not counted for 300 chars no

earnest phoenix
#

Oh my god...

#

UGH

solemn latch
#

300 chars is just a few sentences

misty sigil
#

how do i add a background to my bot site

pale vessel
#

use css

#

and background-image

misty sigil
#

background-image

pale vessel
#

if you want color use background-color

#

or background for both

earnest phoenix
#

Finally my bot is now pending!

quartz kindle
#

nice

#

now you just have to wait 2-3 weeks

earnest phoenix
#

😐

amber fractal
#

The error says what it is

#

500 is a server error

#

which means you cant control it

earnest phoenix
#

Anyone know of a way to reward users who vote for your bot?
I have an economy system but i can't figure out how to give them a rewards AFTER they voted

amber fractal
earnest phoenix
#

My bot doesn't respond to any command , any idea why ? I got no errors and the bot worked 2 hours ago, i didn't change anything in the code

solemn latch
#

is the bot online

earnest phoenix
#

yes, the bot is online

willow river
#

Hi
i want help code for discord bot, I want it to be simple

#

PLZZ 😇

earnest phoenix
#

which means you cant control it
@amber fractal I know.

pale vessel
#

@willow river no 😇

willow river
#

😢

#

😖 PLZ

#

😭 @pale vessel

solemn latch
#

what language are you coding in @willow river and what library?

willow river
#

JS 😊

solemn latch
willow river
#

I just want the code ready ,Please @solemn latch PLS PLS PLS PLS

digital ibex
#

if u wanna use eris ^^

topaz fjord
#

no one's gonna give you code

solemn latch
#

^

#

hire a developer if you want someone to make you code @willow river

willow river
#

🥺 😖 OK TY

earnest phoenix
#

I'm still having trouble trying to link voting rewards with the webhooks. The examples it gives is just for a specific user. How do i change it to recognize any user that votes?

#

Can i somehow make bot to send message in random channel?

#

anyone?

#

client.channels.random()

#

Guys help me
How i can find the the word A in a Array

let array = ["a", "b", "c"]
#

ty

#

array.includes('a')

#

?

#

lol

#

nah that is checking does array has a

quartz kindle
#

you want to see if it exists in the array? or you want to get it from the array?

pale vessel
#

just use .find if you need something advanced

earnest phoenix
#

and want to get it from array and then change it

pale vessel
#

that requires splice

quartz kindle
#

change it inside the array?

earnest phoenix
#
{
    "comp":["beta"]
}
quartz kindle
#

you can use .findIndex()

earnest phoenix
#

well this is the json file

pale vessel
#

is there a difference between findIndex and indexOf

earnest phoenix
#

and i want to find "beta" and change it to "alpha"

solemn latch
#

object.comp[0] = 'alpha'

earnest phoenix
#

Is there any ways ?

solemn latch
quartz kindle
pale vessel
#

you can find the index and change the value using splice if the index exists

quartz kindle
#

@earnest phoenix ```js
a = [1,2,3,4,5];
a[a.findIndex(item => item === 4)] = 20;
console.log(a) // [1,2,3,20,5]

earnest phoenix
#

:0

#

that is more easier

#
if(!a[a.findIndex(item => item === 4)]) return console.log("error") 

this will work ?

#
a = [1,2,3,4,5];

How i can delete the 5

amber fractal
#

using splice would probably be the easiest way

#

a.splice(index, 1) will delete 1 item from a at index

earnest phoenix
#

at index ?

amber fractal
#

Yes, the index provided

true pawn
hardy vector
#

how do you put a widget in an embed

#

@true pawn you got ratelimited

true pawn
#

how can i fix it?

hardy vector
#

you cant

#

just wait for a while

#

what is this for?

#

an api?

true pawn
#

yep

hardy vector
#

yea just dont use the cmd for a few hours

true pawn
#

ok thanks

hardy vector
#

or however long the api ratelimit lasts for

#

np

earnest phoenix
#

Can i somehow create channels with bot like client.channels.create()?

blazing portal
#

yes

earnest phoenix
#

function?

#

it shows error to me

blazing portal
#

discord.js v12?

earnest phoenix
#

yes

#

TypeError: client.channels.create is not a function

blazing portal
earnest phoenix
#

ty

still merlin
#

How do I get how many times a certain command was used? for example: .addfield('Case', '#16')?

blazing portal
#

save the already used numbers somehow. since you say case, i assume this is for mod actions, then you'd want to persist this number in a db

still merlin
#

Not for mod actions, each case for a contact command

hardy vector
#

https://hastebin.com/idipuyozew.js
(node:1500) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\Rank.js:16:46)

solemn latch
#

do you want it persistant or since the bot was last booted?
if just since the last boot, just add one each time a command is run

blazing portal
#

still, save the already used number somewhere. array, object. whatever. If you want to keep it even if the Bot restarts, persist it in a db

#

discord.js?

tulip ledge
#

@earnest phoenix In discord.js v12 (I'm assuming you're using this) avatarURL needs to be a function

pale vessel
#

bruh

tulip ledge
#

avatarURL needs to be a function

#

I literally said what I ment

pale vessel
#

how do you define a function?

#

answer

hardy vector
#

ur trolling

pale vessel
#

it's a rhetorical question

tulip ledge
pale vessel
#

because they couldn't differentiate a function and an assignment

tulip ledge
#

We don't need ur code lol

#

I said what you had to do

#

avatarURL needs to be a FUNCTION

solemn latch
#

hint ()

pale vessel
#

xd

tulip ledge
#

Woo don't spoon feed xD

pale vessel
#

it's hard not to tbh

earnest phoenix
#

I say .setThumbnail(client.user.avatarURL) and it isn’t show it
@earnest phoenix it's .setThumbnail(client.user.avatarURL())

tulip ledge
#

True

lethal pike
#

^

tulip ledge
#

This kid is just full on spoonfeeding lol

blazing portal
#

no need for you to be salty about it

tulip ledge
#

Wellp I tried to guide him 🤷‍♂️

pale vessel
#

some people just don't get it until they see it

tulip ledge
#

Not salty lol

pale vessel
#

but hey, they know what functions are now

#

cool

tulip ledge
#

^

lethal pike
#

bruh

pale vessel
#

unless they just copy and pasted it and now it knowing that it does

tulip ledge
#

bruh x2

pale vessel
#

think again, can you use that?

solemn latch
pale vessel
#

see the difference between your and their code

#

a function

earnest phoenix
#

@earnest phoenix ++

#

and why r u even asking