#development

1 messages ยท Page 896 of 1

earnest phoenix
#

Uh, could you link me?

#

I'm ready to put my head through the wall trying to figure this out

#

And I have my friend screaming "just learn js, just learn js"

tidal parrot
#

do it

#

I dare you

#

put your head through the wall

lyric mountain
#

@earnest phoenix errr dude, you DO know that you can't program a bot with only JSON, right?

#

You'll not even be able to send a POST request in first place

#

I'd say learn js, but there's also java which could be easier depending on your style

earnest phoenix
#

This is for my commands

#

This is just the commands and what their output is

#

The bot part is already done

#

@lyric mountain

lyric mountain
#

Sure but, json is not a programming language, you can't actually run it

#

Json is a data structure

earnest phoenix
#

It works just fine tbh

lyric mountain
#

JavaScript Object Notation

#

JSON

sudden geyser
#

You can't create a bot in JSON.

#

That's witchcraft.

lyric mountain
#

Happy cake day

sudden geyser
#

ty

earnest phoenix
#

This is just the commands and what their output is
The bot part is already done

lyric mountain
#

But HOW have you tested it?

sly fjord
#

it's discord bot maker lol

earnest phoenix
#

What

lyric mountain
#

Omg

earnest phoenix
#

The hell is Discord bot maker

sly fjord
#

Discord Bot Maker uses JSON type modules lol

earnest phoenix
#

I only forked the bot

sudden geyser
#

Pumpkin what program/app are you using to run/make your bot.

sly fjord
#

I had a client of mine ask me for help, sent me a DBM Bot and it looked exactly like that lol

lyric mountain
#

TIL that dbm became even stinkier

sly fjord
#

There's alternatives of Discord Bot Maker, could be one of those ๐Ÿคทโ€โ™€๏ธ

lyric mountain
#

@sudden geyser he just forked afaik

earnest phoenix
#

Idk what's being used to run it, why don't you ask adorable jade? She's the one hosting it

lyric mountain
#

Jade? Like, THAT jade?

earnest phoenix
#

Adorable Jade#3375

#

^ that one yes

queen needle
lyric mountain
#

Unfortunately very few of us will be able to help u, dbm is a no man's land for most of us

earnest phoenix
#

@queen needle does it have to do with it not working on servers that don't have an icon?

sudden geyser
#

well how does it only work on a few servers

#

is it throwing an error?

queen needle
#

@earnest phoenix maybe ill check

earnest phoenix
#

That happens to my bot, but only the commands command doesn't work on servers without an icon

queen needle
#

no

#

just added a icon still doesnt work

earnest phoenix
#

Ok, my bad

queen needle
#

ill check for errors give me a minute

lyric mountain
#

@queen needle is there any pattern for servers that don't work?

#

Like, something in common between them

sudden geyser
#

also what version of discord.js are you using

queen needle
#

11.5.3

sudden geyser
#

okay makes sense

lyric mountain
#

v11 is quickly dying

#

Like, VERY quickly

queen needle
#

no it doesnt work on a server with 4 people and 2 channels and also on one with 20 peoples and 6 channels

#

and how?

lyric mountain
#

Any error in the output?

queen needle
#

im checking rn

lyric mountain
#

and how?
@queen needle because discord will change most of its structure in the upcoming updates, and v11 is obsolete by now

#

Also v12 is by far more optimized

queen needle
#

so my bot will die soon

lyric mountain
#

You could try to implement v12

#

Is it a of work? Probably, but it's a one time thing

#

Until v13

grizzled raven
#

not that much work

#

im breezing through my rewrite

queen needle
#

all my commands that use the old embed system

amber fractal
#

All you do for that is change RichEmbed to MessageEmbed tho

tidal parrot
#

stinky embed

gloomy imp
queen needle
#

i dont that system

#

and

#

it says Discord.RichEmbed is not a constructor

lyric mountain
#

@gloomy imp d.net is far from dead

#

It's almost decomposed by now

gloomy imp
#

tf

#

why is that the one tutorial I have to find

#

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

lyric mountain
#

D.js basically threw it off the balcony

gloomy imp
#

time to redo my pi with Nodejs

queen needle
gloomy imp
#

Thanks for the answer though, clears up a lot

sudden geyser
turbid bough
#

It's not a function probably

queen needle
#

yeah but how would i make it one

turbid bough
#

filter = function(){}

lyric mountain
#

If you're into C# you could take a look at java's JDA

#

Since java is almost like C#

sudden geyser
#

a lot of collections are now managers

lyric mountain
#

But there are some people out there that use discord.net

turbid bough
#

Java is like c#, but java

sudden geyser
#

C# is like Java, but windows

lyric mountain
#

Funny thing is that C# was meant to be called Java++

#

But Microsoft couldn't buy it

turbid bough
#

But .net core

digital ibex
#

hi

turbid bough
#

Somehow I just cant work with c++

digital ibex
#
let a = client.getRESTUser(userID);
let av = a.avatarURL;
``` all i ahve is the userID, why can't i get the users avatar url with that?
queen needle
#

its having trouble reading hexColor

digital ibex
#

using eris

lyric mountain
#

Yeah, after msoft failed to get Java++ they went tantrum and made a raw vm compiler

sudden geyser
#

OfficiallyLost, getRESTUser returns a promise.

#

Resolve it first then use it.

digital ibex
#

ok, thank u

queen needle
sudden geyser
#

if you can't read the property it means it's undefined/null. did you try debugging it?

#

roles.size may be your issue.

turbid bough
#

You want to check if you find the variable first before you use the it

#

.find().variable is a guaranteed error if find is not found

tough relic
#

when we use await user.remove_roles(<role name>) how can we specify a role to remove?

digital ibex
#

hi, js let a = client.getRESTUser('475371795185139712').then((e) => e.avatar).then((e) => e).then((e) => console.log(e)).then((e) => console.log(e)) let av = `https://cdn.discordapp.com/avatars/475371795185139712/${a}.jpg`; why is it logging the users avatar but in the actual thing it says [object promise] ? i'm using eris

#

i'm trying to get the users avatar url btw

lyric mountain
#

It's a promise

#

Gotta handle it first

digital ibex
#

yes,

#

but it logs the avatar

lyric mountain
#

Ah

digital ibex
#

but it responds with object promise

lyric mountain
#

What is that url in the end?

digital ibex
#

wdym?

lyric mountain
#

You gotta return the image url from inside the last then block

#

You're just console.logging it

digital ibex
#

yeah, but it only returns the avatar anyways

#

so

lyric mountain
#

Sure but, the avatar url returned is an entire url

#

Not just the part before .jpg

#

So av should be av = e

digital ibex
#

but how can i access e then?

lyric mountain
#

Just manipulate it from inside the block

#

Idk if you can extract it to outside of the promise

digital ibex
#

u can't, pretty sure

#

@lyric mountain do u mean something like this? ```js
https/ /cdn.discordapp.com/avatars/${userID}/${client.getRESTUser(userID).then((e) => e.avatar)}.jpg

lyric mountain
#

Errr no

#

e is a complete url

#

If you want to send it in a channel just do a channel.sendMessage(e)

digital ibex
#

oh?

earnest phoenix
#

Where I can find the webhook password?

digital ibex
#

but e isn't accessible outsde of that .then thign

turbid bough
#

is there noone here that even uses a debugger?

#

for real, it helps you alot when checking for variables

#

ah nah, the question under

#

or maby both

lyric mountain
#

@digital ibex send it from inside the promise

digital ibex
#

so

#

ok, i'll try thta

#

@lyric mountain ```js
author: {
name: | ${message.channel.guild.name},
icon_url: https://cdn.discordapp.com/avatars/${userID}/${client .getRESTUser(userID) .then((e) => e.avatar) .then((e) => e)}
},

lyric mountain
#

Oh my

#

You're officially lost lol

sudden geyser
#

${client.getRESTUser(userID).then((e) => e.avatar).then((e) => e)}

#

You still need to resolve the promise. Chaining it won't actually get the value.

#

If you're doing it inline you need await

#

with async of course.

digital ibex
#

it has been resolved tho, it logs the avatar

sudden geyser
#

confused. In the code block you sent above?

digital ibex
#

same code but not exactly there

#

oh, wait nvm. i'm so dumb ๐Ÿ˜“

#

figured it out btw

sudden geyser
#

wouldn't it end with [object Promise]

#

yeah

queen needle
#
if (!message.member.hasPermission("MANAGE_GUILD") || message.author.id != "606279329844035594")
      return message.reply(
        "you don't have required permision to use this command"
      );```
#

how can i make it so that unless they have manage guild permissioin or they have that id

#

so if you have manage guild permision or thats their id they can use the command

pale vessel
#

make it && instead of ||

#

so that if one of the condition is true, it won't exit the command

queen needle
#

oh yeah thank you

clear wraith
#

TypeError: message.guild.channels.first is not a function

#

Do I need to add "cache" in that?

#

or replace cache with guild...

#

I feel like im missing something there..

earnest phoenix
#

hi
can anyone help me make a welcome and leave command for discord.js
I tried ```js
client.on('guildMemberAdd', member => {
client.on('message', (
receivedMessage) => {
let logChannel = receivedMessage.mentions.channels.first()
logChannel.send("Hey "+member.user+", welcome to T E A M G A M E R Z :tada::hugging: ! Be sure to subscribe to me! https://www.youtube.com/channel/UCJBQemgOjflI4ie7XCGs-cA?view_as=subscriber")

})

})```

copper cradle
#

message.channels.cache.first

#

omg

#

what are you even trying to do

earnest phoenix
#

what im new

copper cradle
#

that won't work

#

first

earnest phoenix
#

Trying to make a join command

copper cradle
#

why do you have a message event inside a guildMemberAdd event

#

first

earnest phoenix
#

cause receicedMessage.channel.send wont work

copper cradle
#

๐Ÿคฆโ€โ™‚๏ธ

clear wraith
#

lol

copper cradle
#

you can just expect stuff to work without even knowing how it works

sudden geyser
#

thebeast that'll cause a memory leak.

copper cradle
#

I ain't taking this case

earnest phoenix
#

ug ok ๐Ÿ˜ฆ Ive been through 2 servers and no one helped

lofty grove
#

what's the problem?

sudden geyser
#

It's not an issue. It just means you don't have the default port glitch has used.

#

aka 3000.

#

like if you had an express server.

lofty grove
#

Isn't it a problem?

#

@sudden geyser

sudden geyser
#

if you don't like spinning globes it is

#

but it isn't an issue

clear wraith
#

That usually means, you made an edit, and its saving the changes...

#

Its not an issue though

#

It there was an issue with your code, it would show this:

marble juniper
#

its just like these warns when you install discord.js

#

just ignore it

#

it has no impact on your code whatsoever

clear wraith
#

Yeah

sudden geyser
#

Roman that doesn't have to do with edits I believe.

#

Unless you don't have a watch file and you're instead having your app restart every time you type (horrible btw)

queen needle
#

how do i delete the message of a command someone sends

#

nvm i got it

clear wraith
#

Hey, when I type both avatar commands for my bot, the avatar picture doesn't show up.

queen needle
#

send code

#

and what verison

#

of discord.jw

#

.js

clear wraith
#

12.2.0

#

Here's the code

#

module.exports.run = async (bot, message, arg) => {
  var fs = require("fs");

  fs.readFile("./e/cmds.json", "utf8", function(err, contents) {
    var c = JSON.parse(contents);
    if (c.other === "0") {
      message.channel.send();
    } else {
      cc();
    }
  });
  function cc() {
    // let request = await msg.channel.send("``Generating...``");
    let taggedUser = message.mentions.users.first() || message.author;

    let embed = new Discord.MessageEmbed()
      .setColor("BLUE")
      .setImage(taggedUser.displayAvatarURL)
      .setTitle(`${taggedUser.tag}'s Avatar!`);

    message.channel.send(embed);
  }
};
queen needle
#
 const user = message.mentions.users.first() || message.author;
    message.channel.send(
      new Discord.RichEmbed()
        .setColor(0x333333)
        .setAuthor(`${user.username}'s avatar`)
        .setImage(user.avatarURL)```
#

thats my avatar code

clear wraith
#

I thought the RichEmbed changed to MessageEmbed??

queen needle
#

im using a older verison

clear wraith
#

oh

queen needle
#

but try my code

late plank
#

@clear wraith displayAvatarURL is a method, not a property..

surreal notch
#

Can I use command handler codes and normal codes in the same bot?

earnest phoenix
#

uh why not

#

your bot is a part of your application, it isn't the application

late plank
#

@surreal notch 1% of discord bots are command handling

earnest phoenix
#

@surreal notch you can use different projects but not in the same one

#

v12

late plank
#

@earnest phoenix does it.. do nothing?

earnest phoenix
#

yes nothing on my logs

late plank
#

replace speaking with speaking.has(1 << 0)

earnest phoenix
#

where

late plank
#

the if statement

earnest phoenix
#

ok

late plank
#

speaking is not a boolean value

#

it's a bitfield

earnest phoenix
#

no

#

nothing

#

on my logs

late plank
#

you should be logging the error event

#

along with failed

#

also did you install @discord.js/opus?

earnest phoenix
#

it's discordjs/opus

#

@cosmic surgejs/pus

#

opus

late plank
#

sure

#

did you install it

earnest phoenix
#

i have test but

#

i have this

surreal notch
#

How to solve this but

earnest phoenix
#

@surreal notch well we can't do anything just by seeing error

surreal notch
#

@earnest phoenix what should you want tell me

#

coz i am new to cmd handler

earnest phoenix
#

The code

#

Did you do the basic template you have set up!

#

?*

surreal notch
#

Yes

#

maybe

#

here is the code

earnest phoenix
#

Ok

#

The code seems fine

surreal notch
#

yes

earnest phoenix
#

It's a error in the exports.help = {}

#

But that seems fine tio

#

Yoo

#

Too*

surreal notch
#

Then?

earnest phoenix
#

Idk

#

Is there something else like aliases?

surreal notch
#

Idk

#

please help me

earnest phoenix
#

Idk the error

surreal notch
#

userinfo.js | :x: -> missing a help.name, or help.name is not a string.

#

This is error

marble juniper
#
  1. github forkers
  2. it litterally tells you what is missing read the error
surreal notch
#

But i can't understand@marble juniper

marble juniper
#

in module.exports

#

do you have a name property

#

which is named after the command file

surreal notch
#
exports.conf = {
  enabled: true,
  guildOnly: false,
  aliases: ["smolyeet"],
  permLevel: 0
};

exports.help = {
  name: 'warn',
  description: 'Issues a warning to the mentioned user.',
  usage: 'warn [mention] [reason]'
};```
marble juniper
#

yes

#

exports.help

#

name: warn

surreal notch
#

Ok lemme try

marble juniper
#

do you have that in your userinfo.js

#

and no I didn't mean that

#

I meant it like

#

do you also have a exports.help in userinfo

#

with the name being userinfo

#

ah forget it im outta here

surreal notch
#

no

#

wait

earnest phoenix
#

How do you make an embed in a async function? I tried and it errors so I'm wondering if it's the way I made the embed, I know there's different ways to make embeds.

#

Let me see if I have a picture...

#

Though I was doing this really late yesterday so I can't tell if I'm being stupid or whatnot. ๐Ÿ˜‚

#

${message.guild.owner.user}

#

is that still the same in djs v12

pale vessel
#

try it and see

cerulean pebble
#
let embed = new Discord.MessageEmbed()
    .setTitle("KICK NOTI")
    .addField("KICKED In", message.guild.name)
    .setColor("#bc0000")
    .addField("Moderator", message.author.tag)
    .addField("Reason", `${bReason ? bReason : "None."}`)
    .setImage(message.guild.iconURL({ format: "png", dynamic: true, size: 2048 }))
    //.setDescription(`[PNG](${message.guild.iconURL({ format: "png", dynamic: true, size: 2048 })}) **|** [JPG](${message.guild.iconURL({ format: "jpg", dynamic: true, size: 2048 })}) **|** [JPEG](${message.guild.iconURL({ format: "jpeg", dynamic: true, size: 2048 })}) **|** [WEBP](${message.guild.iconURL({ format: "webp", dynamic: true, size: 2048 })})`)
    .addField("Your feeling",`Oh, did you just get kicked? Are you very spicy? You want to take revenge on the people who banned you? so add corona-chan bot to your server so you can revenge those who banned you if they are on your server`)
    .addField("Add me to help you",`[Invite Bot](https://bit.ly/39bnfzy)|[Support Server](https://discord.gg/BNTAapF)|[Donate/Buy Premium](https://www.patreon.com/coronachan)|[Add this bot if you want to be a youtuber :/](https://top.gg/bot/681376963356524558)`)
try{bUser.send(embed)}catch(error){message.channel.send("Unable to send message to user.")}
message.channel.send(":ok: **That member has been kicked do not worry.**")
let incidentchannel = message.guild.channels.cache.find(c => c.name === "corona-chan-log")
if (!incidentchannel){
message.channel.send(banEmbed1)
} else if (incidentchannel){
incidentchannel.send(banEmbed)
}
bUser.kick(bReason)
#

how can bot PM people before kick them out

earnest phoenix
#

move the part where you message them above the part where you kick them

#

oh

#

uh

#

@pale vessel it is but the bot cant get this servers owner because its like 30k members

pale vessel
#

yes. you need to use members#fetch

#

so something like owner = await guild.members.fetch(owner id)

cerulean pebble
#

@earnest phoenix it not work

#

lol

#

fuck

turbid bough
#

is it a good idea to add an invite link to your bot when you are getting kicked by that bot though Thonk

cerulean pebble
#

is it a good idea to add an invite link to your bot when you are getting kicked by that bot though Thonk
@turbid bough hehe

earnest phoenix
#

more promotion i guess

cerulean pebble
#

do you see

#

i am putting on above but

earnest phoenix
#

maybe message the user then add a 2 second rest then kick them

#

idk

#

ive done it before but i forgot how

cerulean pebble
#

hmm

earnest phoenix
#

@pale vessel (node:4) UnhandledPromiseRejectionWarning: ReferenceError: guild is not defined

#

yet it works when i use guild in every other thing

pale vessel
#

guild is your guild

#

for example message.guild

#

don't copy and paste it blindly

cerulean pebble
#

hmm

#

do you know how to solvw my problem

quartz hill
#

I have a function that I want to run when all my shards occur. How can I do that? I looked at the sources but it is not clear enough. And the examples are inadequate. (discordjs)

pale light
#

how do i show avatar with username

earnest phoenix
#

Why does my bot say N/A for servers and is this something i can fix?

cerulean pebble
#

@earnest phoenix :/

earnest phoenix
#

So im guessing thats a no

#

Just wanted to check

slender thistle
#

You need to post your server count yourself

earnest phoenix
#

Oh ok. I didnt see that, ill taker a close look

surreal notch
#
    client.user.setStatus("idle");
});```
slender thistle
#

You can refer to official libraries on https://top.gg/api/docs or post the server count yourself through HTTP requests

surreal notch
#

why my bot doesnot going idle

#

Please help

pale light
#

@surreal notch discord.js v?

surreal notch
#

12

#

v12

cerulean pebble
#

help me :/ how to make the bot send message to user before it kicked out

surreal notch
#

@pale light do u knw what to do

pale light
#
client.user.setStatus('idle')
  .then(console.log)
  .catch(console.error);
```would you try @surreal notch
surreal notch
#

not working

quartz hill
#
client.user.setActivity("",{type: "IDLE"});
#

this?

surreal notch
#

error

#

nope not working

#

could you tell me how to add no. members and server my bot is watching in status??

#

@quartz hill @pale light

pale light
#

which

surreal notch
#

Like watching 5000 members

#

in status

quartz hill
#

I'm not good at v12.

#

I use v11.6.4

surreal notch
#

k

#

@pale light can you

pale light
#

@surreal notch ```js
client.user.setActivity(client.users.size + ' members', { type: "STREAMING", url: 'https://twitch.tv/' + client.user.username})

#

@surreal notch sory would you try "WATCHING"

surreal notch
#

ok

#

@pale light

#

@pale light sorry but pls dm me the sol. i have to go somewhere

cinder patio
#

You want client.users.cache.size if you are on v12

surreal notch
#

@cinder patio and for no. of servers what to do?

cinder patio
#

client.guilds.cache.size

surreal notch
#

ok

pale light
#

true yes

surreal notch
#

and i listen a thing presence
w

#

what was that

pale light
#

"LISTENING"

#

how do i show avatar with username
.

cinder patio
#

which library..?

pale light
#

discord.js v11.5.1

earnest phoenix
#
 **- Server Owner:** ${await message.guild.ownerID}

is there a way to make that turn into a mention

pale light
#
 **- Server Owner:** ${await message.guild.owner}
cinder patio
#

there's no point of awaiting there adam

#

and guild.owner could be undefined if the member isn't cached

earnest phoenix
#

yeah but that doesnt work because it cant find the owner

#

it can only find their id because of the member count

cinder patio
#

you should fetch the member then

#

or user

#

await client.users.fetch(message.guild.ownerID)

earnest phoenix
#

it doesnt do it like @earnest phoenix it does it like @earnest phoenix

short siren
#

@cerulean pebble No point setting stuff like the colour a ton of times it just clutters up your code.

#

You could create the embed that would be sent at the top with the colour then you could just add the required stuff to it before you send it

earnest phoenix
#

hello i need join dm message for my server please help me

cerulean pebble
#

@short siren :/ ?

#

help:/poor girl :/

short siren
#

You recreate the embed for every possible choice you could just do js let Embed = new Discord.MessageEmbed() .setColor("34565") then add to it with Embed.addField etc. it would mean you only have to create the embed once and you wouldn't have to define the same colour multiple times

cerulean pebble
#

:/ i need bot send DM

hasty sparrow
#

@earnest phoenix If it's not displaying the username in your client, then it's probably because your client doesn't have the member cached

cerulean pebble
#

before kick a uder lol

short siren
#

To the author or mentioned person

earnest phoenix
#

idk how to cache it

hasty sparrow
#

Not an issue

cerulean pebble
#

To the author or mentioned person
@short siren :/ you do not understand what i want

short siren
#

message.author.send("Hi") will send to author I believe :/

#

author returns a user object I think https://discord.js.org/#/docs/main/stable/class/User and from that their is a send function.

earnest phoenix
#

@hasty sparrow it works on my server because theres not many members but it cant find it through like 90k members here

hasty sparrow
#

Like I said, it's not an issue

trim nexus
#

ok fellas

#

whats your docker config for node + mongo app

quartz hill
#

I have a function that I want to run when all my shards occur. How can I do that? I looked at the sources but it is not clear enough. And the examples are inadequate. (discordjs)

short siren
#

There might be a better way but on shardReady you could see if there are any unavaliable guilds if there is then all shards aren't ready http://prntscr.com/s7aqm1

Lightshot

Captured with Lightshot

#

Or ShardClientUtil#count see if the expected number of shards exist

quartz kindle
#

if you're using the sharding manager

#

you can listen to shard ready events on each shard, and increase a counter

#

and if counter is equal to total number of shards, run the function

short siren
#

๐Ÿ˜ฎ

quartz kindle
#

that would run it in the shard manager, idk if thats what you want

quartz hill
#

How do I learn the number of shard that should be total.

#

I'm pretty inexperienced with Shard.

earnest phoenix
#

i have try leave

hasty sparrow
#

Most libraries will/can set the amount of required shards for you automatically

earnest phoenix
#

me?

hasty sparrow
#

No

earnest phoenix
#

ok

quartz hill
#

Yes it automatically adjusts. So I don't know exactly how many numbers there are. Is there a way to learn this?

hasty sparrow
#

@earnest phoenix d.js v11 or v12?

earnest phoenix
#

v11

earnest phoenix
#

yes but

hasty sparrow
#

.leave() doesn't return a Promise

earnest phoenix
#

oh so i can't return a message

#

ok

hasty sparrow
#

You can, just send the message after leaving the channel

earnest phoenix
#

ok

small prairie
#

d.js v12.2 bugged or something?

hasty sparrow
#

Could you be more precise?

small prairie
#

weird bug inside the node-modules file

#
/rbd/pnpm-volume/2cf580ce-3aab-403a-a265-599d1b986c83/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/Client.js:41
    } catch {
            ^
SyntaxError: Unexpected token {
hasty sparrow
#

Node version?

pale vessel
#

probably lower than 12

#

you need to upgrade to node v12 for discord.js v12

small prairie
#

Yup my bad

#

fixed

quartz kindle
#

@quartz hill manager.totalShards

quartz hill
#

thx

earnest phoenix
hasty sparrow
#

Read the first line of the error message

earnest phoenix
#

how can i change this

pale light
#

discord.js v11.5.1 how do i use .setOwner() ?

hasty sparrow
#

Don't use the property like it is a function

pale light
#

Can you tell me how I can do it

hasty sparrow
#

Read the documentation

earnest phoenix
#

look now

#

the bot don't fint the user

pale light
#

I came here for understanding sharing, I even did some research

cedar nova
#

which version of discordjs are you using?

pale light
#

I?

earnest phoenix
#

v11

quartz kindle
#

is that an unban command?

cedar nova
#

yes @quartz kindle

earnest phoenix
#

yes

quartz kindle
#

then it will never work

earnest phoenix
#

hmm

quartz kindle
#

you're trying to get the target from message.guild

#

but if the target is banned, it doesnt exist in message.guild

earnest phoenix
#

yeah and

#

how can i get target banned

quartz kindle
#

if you want to unban someone, you have to use their ID directly

earnest phoenix
#

i use their idd

#

id

quartz kindle
#

but you use their ID to get them from guild.members

#

but they dont exist in guild.members

earnest phoenix
#

ok

quartz kindle
#

you can do this

cedar nova
#

GuildPermission.BanMembers

#

await Context.Guild.RemoveBanAsync(userId);

quartz kindle
#
// check if ID is valid
let user = await client.users.fetch(args[0]).catch(() => false)
if(!user) return message.channel.send("invalid user")
// unban user
await message.guild.unban(user)
turbid bough
#

imagine being that dumb

#

"it must be something on the discord side" i thought

earnest phoenix
quartz kindle
#

@earnest phoenix sorry, bot.fetchUser() in v11

cedar nova
#
if(!message.member.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send('Yuo do not have permission')

let bannedMember = await bot.fetchUser(args[0])
   if(!bannedMember) return message.channel.send("Please use id to unban")

let reason = args.slice(1).join(" ")
   if(!reason) reason = "no reason"

if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send('Yuo do not have permission')
message.delete()
try {
  message.guild.unban(bannedMember, {reason: reason})
  message.channel.send(`${bannedMember.tag} has been unban`)
} catch(e) {
  console.log(e.message)
}
}
earnest phoenix
hasty sparrow
#

You mean username?

earnest phoenix
#

yes

#

username & avatarURL

hasty sparrow
#

Because the user is undefined/doesn't exist

earnest phoenix
#

oh ok

hasty sparrow
#

You can't get properties of a guild member who isn't cached as he is banned

jovial nexus
#

how can i detect when someone joins/leaves a voicechannel

#

?ยฟ

earnest phoenix
#

and i can't get hes id

hasty sparrow
#

How would you even fetch the user without the id?

#

@jovial nexus Try the voiceStateUpdate event

jovial nexus
#

i have this ```js
client.on('voiceStateUpdate', (oldMember, newMember) => {
let newUserChannel = newMember.voiceChannel
let oldUserChannel = oldMember.voiceChannel

if(oldUserChannel === undefined && newUserChannel !== undefined) {

  console.log("hi")

} else if(newUserChannel === undefined){

  console.log("bye")

}

})```but it only logs bye

hasty sparrow
#

d.js v11 or v12?

jovial nexus
#

v12

hasty sparrow
#

oldMember is now oldState and doesn't contain a voiceChannel property

earnest phoenix
#

What should js user.presence.game.name be in v12?

opaque seal
#

I was wondering if having a reaction collector active forever for each guild my bot is in, would require too much power from my bot. Is it possible?

earnest phoenix
#

maybe

fierce vector
#

Hello

#

Anyone know any free sites to host your bot 24/7

earnest phoenix
#

github

#

how can i use send message in something writed

lofty hamlet
#

Wtf last day my vote system dbl work and today does not work

cedar nova
#

@earnest phoenix displayAvatarURL

earnest phoenix
#

how to check if role is deletable?

surreal notch
#

my bot replies to other bots how to fix it

earnest phoenix
#

if(message.author.bot) return

surreal notch
#

@earnest phoenix should i paste it top of codes or before every cmd?

earnest phoenix
#

in your main.js

#

in the message event

surreal notch
#

In top of before every code

earnest phoenix
#

no,

#

Hello i have question

#

Do i need to isntall dbl on heroku

#

like heroku run : "npm install dbl"

surreal notch
#
  if(message.author.bot) return; // do nothing
  // if not responding to a bot, do bot stuff
})```
#

just like it?

earnest phoenix
#

into index.js paste this :

if(message.author.bot) return;
})```
surreal notch
#

ok

#

is it correct naah?

#

@earnest phoenix

earnest phoenix
#

yes ๐Ÿ™‚

surreal notch
#

Ok

sudden geyser
#

like heroku run : "npm install dbl"
@earnest phoenix you can't really install "dbl", but you can install dblapi.js, which is the library for posting to the site.

earnest phoenix
#

@earnest phoenix npm install dblapi.js

#

Ye but do i need to install it ??

#

on heroku

sudden geyser
#

what do you need it for

earnest phoenix
#

if u want use it, yes

#

i want to make that on the top.gg page show that my bot is onlint

#

How i can do it

#

check the docs :

#

thx

#

ahm one more question

#

i named the DIscord.Client() is bot

#

so do i need to change here const dbl = new DBL(botconfig.dbl_token, client);

#

const dbl = new DBL(botconfig.dbl_token, client);

#

change client to bot

surreal notch
#
      client.user.setActivity(client.users.cache.size + ' members | u?help', { type: "WATCHING", url: 'https://twitch.tv/' + client.user.username})
const activities_list = [
    "with the u?help command.", 
    "with the developers console",
    "with some code", 
    "with JavaScript"
    ]; // creates an arraylist containing phrases you want your bot to switch through.

client.on('ready', () => {
    setInterval(() => {
        const index = Math.floor(Math.random() * (activities_list.length - 1) + 1); // generates a random number between 1 and the length of the activities array list (in this case 5).
        client.user.setActivity(activities_list[index]); // sets bot's activities to one of the phrases in the arraylist.
    }, 10000); // Runs this every 10 seconds.
});

});```
#

i am trying this but it is not working

#

its not changing in 10 sec

sudden geyser
#

because they're not in the same scope

surreal notch
#

Means?

sudden geyser
#

you shouldn't even have two separate ready events.

#

do you know what javascript scopes are?

surreal notch
#

nope

sudden geyser
surreal notch
#

but how to solve that error

sudden geyser
#

You could loop over it and edit the value at the index

mossy vine
#

@surreal notch you are creating a listener after ready has already been emitted, and it is only emitted once

#

tldr you dont need the second client.on("ready

hasty lotus
#

hey, it's not really development but does anyone know how to use chmod ? (on a vps)

#

pls dm if

amber fractal
#

Depends what do you need it for

#

Are you trying to make a file executable

#

Or own it

surreal notch
#
if(message.author.bot) return;
})
#

my bot still replying to other bots

#

why

earnest phoenix
#

message.guild.members.forEach is not a function help ?

turbid bough
#

whats the code?

#

@surreal notch what library?

surreal notch
#

discord.js v12

#

@turbid bough

turbid bough
#

hmm, it shouldnt reply.

#

can you try logging the message.author.bot?

sudden geyser
#

@surreal notch most collections are now managers in v12. You need to look in the members cache.

#

oops wrong mention.

#

I meant @earnest phoenix

quartz kindle
#

@surreal notch do not use multiple .on("message")

#

they do not affect each other and only waste cpu

maiden mauve
#

I think I've spent 3 days refactoring mostly to put off the math of game balancing

#

I'm proud of my refresh button though

#

it pulls data from a iconURL to find the info it needs on mongodb

#

then builds embed with that data

hasty sparrow
#

๐Ÿ‘๐Ÿผ

maiden mauve
#

I do it all for the thumbs

#

Anyone occasionally get a failed CMD prompt on testing their bot?

#

Like, the cmd prompt loads but bot never initializes

#

or it takes forever

neat ingot
#

@maiden mauve players.findOne. that looks like mongoose. u use mongodb? โค๏ธ

maiden mauve
#

yeah all hail the mongod

#

After a 10 min video and some basic examples its braindead simple

#

I love it

#

the only thing that tripped me up was that I was still learning async vs sync coding

#

that's also when I fell in love with console logging objects

#

DURR WHY DOES MY VARIABLE NOT WORK? Oh, it's a unresolved promise

neat ingot
#

lmao

#

been there

#

yea i also love mongo db ๐Ÿ™‚

#

i recently wrote a custom module thing to umm, basically cache results for a short period of time

#

no idea if mongoose already does that

#

did it anyway

#

why not

#

cant hurt ๐Ÿ˜„

maiden mauve
#

stat balancing in an rpg is truly an art that requires test subjects

#

You just can't see how things go until you see people grind away

#

but then they all run away when you tell them your deleting their stats

neat ingot
#

ha

#

preach!

surreal notch
#

how to keep discord bot 24/7 online

maiden mauve
#

host it on a web server

neat ingot
#

host it on a server online that offers near 24/7 uptime

surreal notch
#

which

neat ingot
#

i use digital ocean cause its super easyt o get going

#

but im moving to contabo cause its super cheap and offers tons

maiden mauve
#

I found Heroku to be easy to learn, a lot of people diss it though

#

fine for a small bot imo

neat ingot
#

im gonna try them at least

#

heroku is ok until you need to add things then they want buckets of cash

surreal notch
#

but i need free one

neat ingot
#

gl

maiden mauve
#

I'm like 80% of the monthly bandwidth just having a credit card on file

neat ingot
#

i think there is actually a free service

#

but its not gonna be good

#

forget the name, alot of folks use it for bots

maiden mauve
#

honestly if its a small project try Heroku

#

if your using too much bandwidth youll figure out fast

#

nothing free will let you drain their resources

neat ingot
#

dude wants free tho ๐Ÿ˜›

maiden mauve
#

I've had my bot on heroku for 6 months without paying

surreal notch
#

Hn

maiden mauve
#

bot is on 32 servers

#

๐Ÿคทโ€โ™‚๏ธ

surreal notch
#

which should i use for free

neat ingot
#

glitch

#

thats the one

maiden mauve
#

you gotta find the pros and cons everyone thinks a little different

hybrid musk
#

hello

#

can someone help me with object Promises plz

neat ingot
maiden mauve
#

fundane general question or code?

neat ingot
#

i can, i promise

#

now you await.

hybrid musk
#

general question

maiden mauve
#

HE MAKES JOKE

maiden mauve
#

I don't know if I can answer a question that hasn't been asked

#

but ill try

#

undefined

#

sorry

neat ingot
#

rip, try reboot?

#

Ctrl+C

hybrid musk
#

just a general question on how to work with [object Promise] with javascript

maiden mauve
#

I'm gonna call my cable company and complain

#

@hybrid musk it's perfectly acceptable etiquette here to just ask your question

hybrid musk
#

i did

quartz kindle
#

not only acceptable, its the preferred one

maiden mauve
hybrid musk
#

i'm confused on how '[object promise]' works

maiden mauve
#

well a promise is an object

hybrid musk
#

i didn't ask to ask

maiden mauve
#

for example

#

a discord message is a promise

hybrid musk
#

okay

maiden mauve
#

you have to wait for the promise to resolve in order for the variable to work

neat ingot
#
const thepromize = new Promise((resolve, reject) => {
    if (/* athing */ true){
        resolve('data');
    } else {
        reject('reason');
    }
});        
#

that is an example on how to make a promize

#

you call it like a reular function

maiden mauve
#

The promise object itself is very confusing at first because there isn't any context

neat ingot
#

it will only return a value whenever the promise calls 'resolve' internally

#

else it will reject, throw error, and provide reason

maiden mauve
#

Think of a promise as "I'm waiting for the internet and code to process"

hybrid musk
#

okay

maiden mauve
#

It's a high level function to make everything work well

hybrid musk
#

are promises a low, medium or hard bit of javascript?

neat ingot
#

i'd say medium/hard

maiden mauve
#

if your going to code discord, its beginner level

neat ingot
#

not newbie friendly

maiden mauve
#

it's essential

neat ingot
#

well yea

#

for a discord bot its kinda a requirement, because you need to await a data being returned by promises

maiden mauve
#

yeah the concept is well beyond basic coding

neat ingot
#

for general javascript, its not something you get on lesson 1

maiden mauve
#

but you can wiggle your way around it

hybrid musk
#

oh

#

ok, thank u guys

quartz kindle
#
var a = 10 // a is 10, it is immediately available, you can use it whenever you want
var b = new Promise(r => r(10)) // b is a promise, it has the same value as a, but its not yet available

a + a // this will return 20, because a is available
b + b // this will not work because b is not available
var c = await b // this will put the code on hold until b becomes available and the give its value to c
c + c // this will return 20, because we waited for it to become available
b.then(c => {
  c + c // this will work because we waited for b to become available and then gave its value to c
  // however, this splits the code into two different flows, b is now available in here, but not outside here
  // what happens in here happens in a completely difference space, completely separate from the flow of befoe
  // this does not put the code outside on hold, the outer flow will continue executing at the same time. only this inner code is on hold
})
b + b // this will not work, because b is still not available here
// this is still the old linear flow where b was not yet available
hybrid musk
#

heck

neat ingot
#

lol tim

maiden mauve
#

you have to read about "async vs sync" and the structure of a promise

#

Tim's example there likely has some great info

neat ingot
#

no doubt, but also likely not newbie friendly ๐Ÿ˜„

delicate zephyr
#

holy crap tim that is beautiful

neat ingot
#

i guess its not exactly hard to understand once you look past the fact its a wall of text

maiden mauve
#

XD

#

To be honest learning promises was the biggest obstacle to free-writing my bot

#

I wish someone had a brain dead power point to walk me through it

delicate zephyr
#

i mean code shouldnt be given without an explaination. Even if its a lot to read, if it helps you understant the process of the code then its good and high quality

raven urchin
#

Where can I add setStatus in the code?

  execute: async (client) => {client.user.setActivity(`Current Shards: ${client.shard.count} Shard(s)` ,  {type:'WATCHING'});
setInterval(() => {client.user.setActivity(`Current Shards: ${client.shard.count} Shard(s)` , {type: 'WATCHING'});             
}, 20000) // every 20000 milliseconds
    console.log(`Ready on client ${client.user.tag} and loaded ${client.commands.size} commands with ${client.guilds.size} servers & ${client.users.size} users.`)
                            

}
}```
hybrid musk
#

ok

#

thank u

maiden mauve
#

@hybrid musk it will help you a lot to console.log(variableName) starting out

#

your cmd prompt will tell you what the object is

hybrid musk
#

its kind of confusing ๐Ÿ˜“

maiden mauve
#

if it says it's a promise instead of a value

#

that's because you haven't awaited the promise to get the value

#

Tim's example is a great way to play around with variables

hybrid musk
#

oh

neat ingot
#
function wait(ms) {
    return new Promise(r => setTimeout(r, ms));
}
#

thats a simple function, that returns a promise

#

i use it to 'wait' a number of ms

#

might be useful in understanding how a promise works

hybrid musk
#

ok

maiden mauve
#

With all this basic explanation, understand that something like "message.channel.send" is a promise. You can't get the message variable until it resolves

neat ingot
#

simply do

await wait(1000);
``` to wait for 1000 ms before the code processes any further
#

(providing that you call 'await' inside an async function)

#

most things have an async function setup for processing commands, assuming that is the case, within some arbitrary command you could do

    async function ThatExecutesCommand(){
        await wait(1000);
        // do things//
        await wait(1000);
        // do other things
    }
maiden mauve
#

another example of a promise is getting something from a database on the internet

neat ingot
#

not sure if that actually helps anything or not, but its information!

#

๐Ÿ˜›

maiden mauve
#

you can't just say variable = database.getvariable

#

because the code has to stop and wait for it

neat ingot
#

yea, its like, regular functions return data immediately when you ask. a promise has to go and fetch the data first, so you gotta 'await' it ๐Ÿ™‚

#

not true i guess, you only have to await if you need the data

#

if you dont, you can let the promise go off and do its thing, it promised it would after all!

#

๐Ÿ™‚

digital ibex
#

hi, to do with the issue i had yesterday er

#

embed.author.icon_url: Could not interpret "{}" as string. why am i getting this error when the icon_url is a stirng?

delicate zephyr
#

because icon_url needs to be a string

digital ibex
#

it is, er, https://cdn.discordapp.com/avatars/${userID}/${e.avatar} is the icon_url

delicate zephyr
#

show code

digital ibex
#

thats what i have as the icon_url but it says thats not a string for some reason

#
let av = client
        .getRESTUser(userID)
        .then((e) => `https://cdn.discordapp.com/avatars/${userID}/${e.avatar}`)
        .catch((e) => console.log(e));
    console.log(typeof av);
#

i just added typeof av

#

returns object oof

delicate zephyr
#

realistically for that you wanna use async/await

digital ibex
#

ok, so like this?

#
let av = client
        .getRESTUser(userID)
        .then(async (e) => await `https://cdn.discordapp.com/avatars/${userID}/${e.avatar}`)
        .catch((e) => console.log(e));
    console.log(typeof av);```
#

wrong?

#

prolly tbh

delicate zephyr
#
const _av = await client.getRESTUser(userID)
const av = `https://cdn.discordapp.com/avatars/${userID}/${_av.avatar}`
earnest phoenix
#

can anyone help me with my bot

delicate zephyr
#

there

#

whats up BowlPulp

digital ibex
#

oh, ok

#

well i fixed my issue btw

earnest phoenix
#

Luke i paid someone to make a bot for me and now he gave me a folder that has files

digital ibex
#

thank u

earnest phoenix
#

and i dont know literally anything atm

#

how can i proceed further making my bot online etc

delicate zephyr
#

What language is it in

earnest phoenix
#

idk

#

how to check

delicate zephyr
#

what do the files end in

#

.js, .py?

earnest phoenix
#

.js

delicate zephyr
#

You can have a look at hosting options here:

#

-vps

gilded plankBOT
#

A VPS or virtual private server is a virtualized server instance run in the cloud. It acts like a normal server, allowing you to remotely login and manage it just like a physical server or computer. If you're looking for a way to keep your bot online 24/7, a VPS is a great option.

Having trouble choosing a VPS provider or don't know where to start? Click here for a list of common and affordable VPS providers.

quartz kindle
#

do you want to run the bot in your pc or do you have a server?

earnest phoenix
#

but what to do after that

#

i have a server

delicate zephyr
#

and as for setup Im sure someone here will be able to help

earnest phoenix
#

not hosting server but a discord server ^ lol

quartz kindle
#

i meant hosting

earnest phoenix
#

no i dont have that.

quartz kindle
#

you can run it in your pc if you want, but then you need to leave your pc turned on 24/7

#

the bot will only be online as long as the program is running

frozen valve
#

guys what do i need to so my bot appears online?

earnest phoenix
#

nah i dont want that

#

i can prefer paying cash for hosting

#

those badges are good

quartz kindle
#

@frozen valve wait for approval

delicate zephyr
frozen valve
#

aight, okay

delicate zephyr
#

oh and wait for approval

earnest phoenix
#

and what are auctions for

quartz kindle
#

then you need to take a look at the various hosting providers available

delicate zephyr
#

-auctions @earnest phoenix

frozen valve
#

i already have it in a good hosting

gilded plankBOT
#

@earnest phoenix

What are auctions? What is #bids for? Click here to find out

quartz kindle
#

basic hosting starting at $3 per month will be good enough for your bot to handle a few thousand servers

digital ibex
#

hi again, embed.author.icon_url: Not a well formed URL. why am i getting this?

wicked pivot
#
message.channel.send(embed).then(async (msg) => {
        msg.channel.awaitMessages(m => m.author.id == message.author.id, { max: 1, time: 30000}).then(collected => {
            if(collected.first().content.toLowerCase() == result){
                message.reply("Bonne rรฉponse bien jouer !, tu ร  sans doute le niveau : " + mental + " en calcul mental")
            }else if(collected.first().content.toLowerCase() !== result){
                message.reply("mauvaise rรฉponse, tu n'a peut รชtre pas le niveau : " + mental + " en calcul mental")
            }
        }).catch((error) => {
            console.log(error)
            message.reply("Tu ร  dรฉpasser le temps imparti (Le temps imparti et de 30 secondes)")
        })
    })```when a user other than the one who made the order writes his execute the catch
digital ibex
#

they're both exactly the same but why am i getting that error?

wicked pivot
#

someone can help me ?

lyric mountain
#

@digital ibex may I see the code?

digital ibex
#

oh, nvm. i fixed it, mb. it was because it had "" around the link

lyric mountain
#

ah

raven urchin
#

I can't seem how to make it show the presence of the bot. I tried it but it doesn't do anything

  execute: async (client) => {client.user.setActivity(`Current Shards: ${client.shard.count} Shard(s)` ,  {type:'WATCHING'});
setInterval(() => {client.user.setActivity(`Current Shards: ${client.shard.count} Shard(s)` , {type: 'WATCHING'});
              
}, 20000) // every 20000 milliseconds 
    console.log(`Ready on client ${client.user.tag} and loaded ${client.commands.size} commands with ${client.guilds.size} servers & ${client.users.size} users.`)
                            

}
}```
lofty lagoon
#

little question with discord.js
how I do for my bot send a message without mention

earnest phoenix
#

send method

pallid marsh
#

is there a way to ban some1 that isnt in my server by id with discord.js

#

?

earnest phoenix
#

yes

pallid marsh
#

how

earnest phoenix
pallid marsh
#

i nee a way to ban someone if he is NOT in the server

earnest phoenix
#

ok and

pallid marsh
#

oh

earnest phoenix
#

Hi, i want to put to a serverinfo how many bots/humans are in the server, what i need to do? I know that for all users ( humans + bots ) is message.guild.memberCount (in discord.js 11.5.1)

pallid marsh
#

nvm

#

im retarded

#

omg

#

lmao

#

thx

lofty lagoon
#

send method
@earnest phoenix wait what?

earnest phoenix
lofty lagoon
#

@earnest phoenix reference error: channel is not defined

earnest phoenix
#

don't copypaste code

#

:)

lofty lagoon
#

?

earnest phoenix
#

Hi, i want to code to a serverinfo command how many bots/humans are in the server, what i need to do? I know that for all users ( humans + bots ) is message.guild.memberCount (in discord.js 11.5.1)

lofty lagoon
#

wait no

#

that cuz it's an embed

earnest phoenix
#

@earnest phoenix https://discord.js.org/#/docs/main/11.5.1/class/Guild?scrollTo=members , use the filter method on the collection to filter out what you need to then simply call the .size property

#

granted, the count won't be accurate if all members in the guild are not cached

lofty lagoon
#

why channel.send dont work :/

quartz kindle
#

@lofty lagoon messages are sent to channels, so channel.send() is correct, but you need to specify which channel to send to, or to get the channel from somewhere. when you do message.reply() the code basically does the .send() to the same channel the message came from, which you can get with message.channel

lofty lagoon
#

k

#

message.reply

#

wait

quartz kindle
#

message.reply sends to the same channel and adds a mention. if you dont want the mention, use send, but with send, you need to get the channel first

#

using message.channel

surreal notch
#

Please help me with it

royal portal
#

how do I blacklist my bot from a server?

#

so like no one can invite it to just that guild

lofty lagoon
#

message.reply sends to the same channel and adds a mention. if you dont want the mention, use send, but with send, you need to get the channel first
@quartz kindle ok gonna try

quartz kindle
#

@royal portal when the bot is invited, check if the server id matches one of the ids you dont want

#

if it does, make it leave the guild

royal portal
#

alright

#

thanks!

lofty lagoon
#

@quartz kindle it's say message is not defined

copper cradle
#

@lofty lagoon show your code and the error

#

why are you doing that

#

why did you do

const user = message.mentions.users.first();
message.guild.members.ban(user);

but then you did

const member = message.mentions.members.first();
member.kick();
#

I was indeed talking to you

snow urchin
copper cradle
#

...

quartz kindle
#

because arrays are zero-indexed

copper cradle
#

the array goes from 0 to 5

#

you're trying to index 6

#

which doesn't exist

quartz kindle
#

@snow urchin [1,2,3] has length of 3 but indexes 0 1 and 2

snow urchin
#

ah yes, stupid me

copper cradle
#

first

#

you gotta first fetch the member

lofty lagoon
#

client.on('message', msg => {
if (msg.content === '@hexed drum') {
message.channel.send('hey my prefix is a. try "a.help"');
}
});

copper cradle
#

and then ban that member

quartz kindle
#

@lofty lagoon if you use msg then use msg

copper cradle
#

@lofty lagoon ofc message is not defined

#

you defined it as msg

#

not message

lofty lagoon
#

oh

copper cradle
#

your message obj is the first param of the event callback

lofty lagoon
#

I am just stupid

copper cradle
#

bruh

lofty lagoon
#

oh boi

copper cradle
#

I told you

#

fetch the user

#

and then ban them

#
#

there's the docs

#

every dev must know how to read the docs

cedar nova
#

how do you give the distance between the posts in embed bro?

sudden geyser
#

what do you mean

hoary elm
#

Think they might mean like the .addBlankField() method ๐Ÿค”

cedar nova
#

ok

hoary elm
#

@cedar nova addBlankField will provide spacing in between the Fields them self or whatever you want it to really... If you put it before setDescription then it should add a space there.

#

Not sure if that's exactly what you're looking for ๐Ÿค” just what I gathered from how you worded the question

royal portal
#

how to dm owner when bot added

#

bot.on guildcreate doesnt work

wheat jolt
sonic lodge
#

can someone tell me what a 'snowflake' is

nocturne grove
#

that's an id, a large number that's representing things like channels, messages and users

#

they are unique

wheat jolt
nocturne grove
#

HTTPError [AbortError]: The user aborted a request.
Is there any fix for this? I couldn't find one

sonic lodge
#

the docs has 'string' listed as a type

wheat jolt
#

and?

sonic lodge
#

which means something like this would work theoretically?

var arr = ['1234567890123']
if (arr.includes(message.guild.id)) {
  // something
}```
wheat jolt
#

yes

sonic lodge
#

ok

wheat jolt
#

why not

earnest phoenix
#

Hi, why everytime i ran a command it ran twice?

summer torrent
#

reset token

earnest phoenix
#

Ok, ty

#

@summer torrent I reseted the token but the commands still run twice

lethal pine
#

@earnest phoenix sir restart your pc

earnest phoenix
#

I don't think i need to do this, the bot is hosted on glitch

lethal pine
#

hm

neat ingot
#

lmao

#

are you sure that the code isnt executing the command twice by mistake? maybe a copied line on accident? ๐Ÿ™‚

restive furnace
#

@earnest phoenix typr in console refresh

grizzled raven
#

or

#

check if you

copper cradle
#

@sonic lodge a snowflake is just a fancy name for a number that is too big that js can't store it so it needs to be stored as a string

earnest phoenix
#

@neat ingot no, it worked until that time

#

@restive furnace it worked, thx

copper cradle
#

this is what using dynamically typed langs does to people, if you were to use a statically typed lang you'd instantly know why a snowflake is a string

drifting dome
nocturne grove
#

HTTPError [AbortError]: The user aborted a request.
Is there any fix for this? I couldn't find one. Not here and not on the internet.
Anyone?

amber fractal
#

@drifting dome are you using markdown or html/css

drifting dome
#

I tried this:

.longdescription .content {
    min-height: 50px;
    box-shadow: 4px 4px 0 0 #424f80, inset 4px 4px 0 0 rgba(204, 214, 248, 0.8), inset -4px -4px 0 0 #a5b3e6;
    position: relative;
    padding: 20px;
    background: white;
    opacity: 0.1;
    font: 600 16px "Karla", sans-serif;
    text-align: left !important;
    flex-direction: column;
    flex-wrap: nowrap;
}```
but to no avail
#

also this is for my bot description

#

it's html, css and markdown

amber fractal
#

wait do you mean transparent? because opaque means the background (the white) is fully visible and you used opacity: 0.1; which is nearly transparent

drifting dome
#

yeah that was just to try seeing if it worked; it didn't

amber fractal
#

Is it not already fully opaque?

#

because the white background is fully visible

drifting dome
#

yes I'm trying to make it invisible

#

I'm trying to figure out how to modify it

#

idk how

valid frigate
#

the background?

#

can you not just set background: transparent?

drifting dome
#

yeah the white box thingy you get by default

earnest phoenix
#

sen bu iลŸin osnucunu dรผลŸรผnmedinmi laaa

drifting dome
#

where, in body or head? @valid frigate

amber fractal
#

it should be in a style tag

valid frigate
#

in that css rule you posted

amber fractal
#

<style>css</style>

valid frigate
#

also if it doesnt work try !important

#

adding*

drifting dome
#

ok that css rule doesn't work, I copied it from google inspect on the element

#

I'll try making it transparent tho

#

nope, still visible

amber fractal
#

show your long description here

#

the text behind it

#

like when you edit it

drifting dome
#

I'd send the whole thing but I think it's longer than 2k characters ๐Ÿคท

modest maple
#

background isnt what u use to change the color

#

you need background-color

drifting dome
modest maple
#

i would highly recommend using a live css editor plugin

#

for your browser

pale vessel
#

actually background works too

modest maple
#

makes editing the page and seeing how it looks much better

drifting dome
#
  margin: 0;
  padding: 0;
  background: #579FE9;
  background-color: #579FE9;
  opacity: 5;
  width: 100%;
  height: 100%;
  overflow: hidden;
}```
#

that doesn't work apparently

modest maple
#

is it in

<head>
    <style>```
#

sort of thing

drifting dome
#

o

pale vessel
#

it doesn't need to be, even though it's recommended to

#

because validators hate them if it's outside head

#

but it should still work

drifting dome
#

aaaaaaaaa

#

how do i remove this damn boxxxxxxxxxxxx

#

I can send files right?

pale vessel
#

yes but not wiruses

drifting dome
#

oop

#

ok

unborn steeple
#
bot.on('message', async (message) => {
	
	let channel = bot.channels.get("692820090831503412");
	
	let chance = Math.round(Math.random() * 1000);
	
	let amount = Math.round(Math.random() * 200);
	
	let embed = new RichEmbed()
	.setColor(0xabc123)
	.setAuthor("Reward Spawned", bot.user.displayAvatarURL)
	.setDescription("A lootbox spawned with " + amount + " tokens inside.");
	
	if (chance > 900) {
		channel.send(embed).then(function (msg) {
			message.react("๐Ÿ’Ž");
		
		const filter = (reaction, user) => {
			return ['๐Ÿ’Ž'].includes(reaction.emoji.name) && !message.author.bot && user.id === message.author.id;
		};
		
		msg.awaitReactions(filter, { max: 1, time: 200000, errors: ['time'] })
		.then(collected => {
			const reaction = collected.first();
			
			if (reaction.emoji.name === '๐Ÿ’Ž') {
				
				msg.delete();
				eco.addMoney(message.author.id, amount);
				message.reply("You grabbed the " + amount + " tokens.");
			}
		})
		})
	}
});

I cant seem to make this work so that anyone can react and not just the message author

blazing portal
#

What discord.js version?

unborn steeple
#

11.5.1

drifting dome
#

wait. couldn't I make an entire website and pate it into that?

unborn steeple
#

@blazing portal 11.5.1

true ravine
#

Your filter is checking that the reaction is from the message author

blazing portal
#

Yeah. Mr Delivery Man beat me to it

unborn steeple
#

How would i make it from everyone tho

true ravine
#

Yeah. Mr Delivery Man beat me to it
Sorry lol

unborn steeple
blazing portal
#

remove the && user.id === message.author.id

true ravine
#

Yeah

unborn steeple
#

Ight

blazing portal
#

Sorry lol

#

I forgive you ๐Ÿ˜›

pale vessel
#

did you understand what you coded wtf

drifting dome
#

absoplutely not

#

it's become ruffed up using the <head> and <body> tags

pale vessel
#

you're not supposed to anyway

#

your code is already inside a body

drifting dome
#

99^ sure the bubbles classes are supposed to be the lowest

unborn steeple
#

What about now for the eco.addMoney(message.author.id, amount); what would i put to replace the message author id

drifting dome
#

i didn't double-body did I?

pale vessel
#

you did, probably

unborn steeple
#

@true ravine What about now for the eco.addMoney(message.author.id, amount); what would i put to replace the message author id

drifting dome
#

oh lol I left 'style' in the body thing

unborn steeple
#

@blazing portal What about now for the eco.addMoney(message.author.id, amount); what would i put to replace the message author id