#development

1 messages · Page 646 of 1

carmine echo
#

Formatting code is very easy

vague chasm
#

then developer mode on

cursive gale
#

ok

mossy vine
#

noone will help with unreadable code. if you want us to help, dont make us decipher the code as well

cursive gale
#

kk

opaque eagle
#

Behaviour?

#

For me it's under Appearance

cursive gale
#

installing beautify as said by @carmine echo

vague chasm
#

@opaque eagle I am in discord beta

cursive gale
#

installed

#

now ?

opaque eagle
#

oh

mossy vine
#

use it

opaque eagle
#

PTB or canary?

cursive gale
#

how?

opaque eagle
#

Oh

cursive gale
#

how to use beautify?

mossy vine
#

im not on beta/canary and its in behaviour for me as well

opaque eagle
#

Weird'

vague chasm
#

canary on desktop

opaque eagle
vague chasm
#

Monster is on phone

cursive gale
#

i installed it now?

opaque eagle
vague chasm
#

ios

somber verge
cursive gale
#

uhh

somber verge
#

i found it here

vague chasm
carmine echo
#

Press F1 and search for beautify file

opaque eagle
#

Doesn't Discord use some sort of framework to convert web code to mobile code

#

kinda like electron for mobile

carmine echo
#

As I've already told you @cursive gale

cursive gale
#

it lagged

#

done

carmine echo
#

If your pc is so slow as you say, you should consider using sublime text instead of vscode

#

but if vscode works use it

cursive gale
#

i do use it

earnest phoenix
#

@vague chasm thanks I'm copy id

cursive gale
vague chasm
#

@earnest phoenix now give id here

earnest phoenix
#

Then

cursive gale
#

now?

earnest phoenix
#

553230054830899250

vague chasm
cursive gale
#

there

carmine echo
#

btw you can send code in discord like this:
```js
// code goes here
```

vague chasm
#

lol we did it at same time

cursive gale
#

ik

vague chasm
#

go to this link @earnest phoenix

carmine echo
#

Is user id the same as client id?

cursive gale
#

yee

vague chasm
#

that one

#

@carmine echoye

cursive gale
#
  let commandfile = bot.commands.get(cmd);
  let cooldown = new Discord.Collection()
  let coolsecs = commandfile.help.cooldsecs
  console.log(cooldown)
  console.log(cooldown.get(message.author.id))
  if (commandfile) {

    if (cooldown.has(message.author.id)) {
      console.log('User was on cooldown')
      console.log(cooldown)
      console.log(cooldown.get(message.author.id))
      let cooldownemb = new Discord.RichEmbed()
        .setColor(287361)
        .setTitle(`You have to wait ${coolsecs} before you do that command again`)
        .setFooter(" © Skymod 2019 by typical Gta#5594. Current ping = " + bot.ping.toFixed(0), 'https://i.imgur.com/B4yHD4K.png')

      return message.channel.send(cooldownemb)
    } else if (!cooldown.has(message.author.id)) {
      console.log('User did not have cooldown')
      cooldown.set(message.author.id, coolsecs)
      commandfile.run(bot, message, args);
      console.log('I have set cooldown for ' + coolsecs + ' seconds (' + (coolsecs * 1000) + 'ms)')
    } else cooldown.set(message.author.id, coolsecs)
  }

  setTimeout(async () => {
    cooldown.delete(message.author.id)

  }, coolsecs * 1000)```
#

@carmine echo

#

that's my code

earnest phoenix
#

No option here choose server

carmine echo
#

why do you have so much async everywhere

vague chasm
#

wait no

cursive gale
#

uhh @vague chasm put all those async

vague chasm
#

@cursive gale it didnt work without async too

cursive gale
#

tru

carmine echo
#

What if the bot is private? 🤔

vague chasm
#

Noo... we forgot to add scope=bot

carmine echo
#

oh ok

cursive gale
#

await needed async that's y

earnest phoenix
#

@vague chasm thanks

#

Done

cursive gale
#

:))

vague chasm
#

:D

earnest phoenix
#

Thanks all😁😁😁

cursive gale
#

see @vague chasm u r good

earnest phoenix
#

588611335311458304

#

This

#

Why make link

cursive gale
vague chasm
#

@cursive gale nu

cursive gale
#

nu

vague chasm
#

nu infinite and reverse card

earnest phoenix
#

Invalid

split hazel
#

ads??!?!?!!

cursive gale
#

np

#

wait

#

this?

split hazel
#

i was getting that on my invite url aswell

#

you need to whitelist the url

vague chasm
#

@split hazel no that user did not know how to make invite link

split hazel
#

oh i see

earnest phoenix
#

😥

cursive gale
#

who user?

#

yes

#

you can't add that bot then

earnest phoenix
#

Why

vague chasm
#

Loco was a game i used to play

#

and its that bot's name

cursive gale
#

cauz owner dosen't want u to

#

bot's can be private @earnest phoenix

#

and you can do nothing to make it not private

#

except for begging to the owner of the bot

earnest phoenix
#

How I'm invite in my server @cursive gale

cursive gale
#

you can't

earnest phoenix
#

Private bots

cursive gale
#

invite private bots

earnest phoenix
#

Yes @cursive gale

mossy vine
#

you cant

cursive gale
#

you can't invite private bots

#

hey @mossy vine can you help me

mossy vine
cursive gale
#

i sent it

#

multiple times

earnest phoenix
#

I want loco @mossy vine

cursive gale
#

no way to

#

invite it

#

sry we can't help you

#

only bot owner can

earnest phoenix
#

@cursive gale please bro

abstract crow
#

What is going on?

cursive gale
#

it'a not our hands

#

nothing just people asking for help

slender thistle
#

If the bot is private, you can't invite it. Talk it out with the owner or stop trying

cursive gale
#

many people want their bots to be limited to their server only

#

so people do that to their bots and only bot owner can make it public @earnest phoenix

#
  let commandfile = bot.commands.get(cmd);
  let cooldown = new Discord.Collection()
  let coolsecs = commandfile.help.cooldsecs
  console.log(cooldown)
  console.log(cooldown.get(message.author.id))
  if (commandfile) {

    if (cooldown.has(message.author.id)) {
      console.log('User was on cooldown')
      console.log(cooldown)
      console.log(cooldown.get(message.author.id))
      let cooldownemb = new Discord.RichEmbed()
        .setColor(287361)
        .setTitle(`You have to wait ${coolsecs} before you do that command again`)
        .setFooter(" © Skymod 2019 by typical Gta#5594. Current ping = " + bot.ping.toFixed(0), 'https://i.imgur.com/B4yHD4K.png')

      return message.channel.send(cooldownemb)
    } else if (!cooldown.has(message.author.id)) {
      console.log('User did not have cooldown')
      cooldown.set(message.author.id, coolsecs)
      commandfile.run(bot, message, args);
      console.log('I have set cooldown for ' + coolsecs + ' seconds (' + (coolsecs * 1000) + 'ms)')
    } else cooldown.set(message.author.id, coolsecs)
  }

  setTimeout(async () => {
    cooldown.delete(message.author.id)

  }, coolsecs * 1000)```
#

my code

#

it dosen't add to the map welp

#

@mossy vine now?

carmine echo
#

Wait

#

why are you using a map for this in the first place

#

Use an object

cursive gale
#

how?

#

like?

carmine echo
#

cooldowns[id] = coolsecs

cursive gale
#

hmmm

carmine echo
#

let cooldown = {}

mossy vine
#

maps are more efficient tho

cursive gale
#

tru

#

sooo many people have told me to use map

#

u mean to make an array?

daring trellis
#

Is it possible to check whether the bot is connected to mongoDB and, depending on the result, perform a certain action? P. S. Module: mongoose Thanks in advance!

cursive gale
#

@earnest phoenix is typing for the last 15mins

#

@mossy vine sorry to ping but can you tell me why it's not adding it to the map? i sent my code and problem over 5times now

abstract crow
#

Maybe he doesn't know. I wouldn't continually ping him

cursive gale
#

ok sry

#

do you know?

abstract crow
#

No

cursive gale
#

ok ;-;

spare goblet
#

@cursive gale Is this within message event? You need to make it oustide of message event

because if not, then on message event it is creating a new collection

idk if this is your question

cursive gale
#

@spare goblet thanks for your help and yes i think i know why i was getting the issue

spare goblet
#

Great, have a good day! blobsmilehappyeyes

stray garnet
#

how to log a deleted message?

onyx summit
#

add a listener for the messageDelete event

#

depends on the library

spare goblet
#

which library and which language?

lofty bane
#

Guys please

#

what is this ?

onyx summit
#

what is what

lofty bane
#
const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  console.log(`Online`);
});

client.on('message', message => {  ///By KillerFox_ 
  var prefix = "$" ;
    if(!message.channel.guild) return;
       if(message.content.startsWith(prefix + 'ac')) {
        let modlog = client.channels.find('name', 'verify-yourself'); /// m غير اسم الروم اذا تبي
       if(!message.channel.guild) return message.channel.send('**هذا الأمر فقط للسيرفرات**').then(m => m.delete(5000));
       var b = ['5587' ,' 9978' , '3785' , '7734' , '9864' , '7681' , '3758' , '7834' , '3489' , '1382' , '7389' , '8762' , '0889' ,  , '7681' , '3758' , '7834' , '3489' , '1382' , '7389' , ' , '9524' , '0964' , '5930' , '5678' , '9567' , '603' , '9876' , '9846' , '9685' , '8574' , '8975' , '9845' , '9862' , '0069' , '0807' , '0673' , '0813' , '1235' , '6879'];
        var b3 = Math.floor(Math.random()*x.length)
       message.channel.sendMessage(`\n \`${b[b3]}\` ** : اكتب الرقم التالي للتفعيل **`).then(msg => {
          var r = message.channel.awaitMessages(msg => msg.content == b2[b3], { maxMatches : 1, time : 60000, errors : ['time'] })
               r.catch(() => {
            message.delete()
            r.delete()
            msg.delete()
        })
  r.then(s=> {
 
                                   message.member.addRole(message.guild.roles.find("name", "test")); /// الربته التجي للشخص
       
                            msg.delete();
                                   message.channel.send(`**تم تفعيل حسابك.**`).then(m => m.delete(1000));
     
                                   })
       })
                                   }
                                   });

client.login(process.env.BOT_TOKEN);
#

var b3 = Math.floor(Math.random()*x.length)

#

x is undifiend

#

how

#

2019-06-30T14:34:51.311244+00:00 app[worker.1]: ReferenceError: x is not defined

onyx summit
#

you didnt define x lol

lofty bane
#

XD

onyx summit
#

I don't see anything in that code that shows const x = stuff or let x = stuff

#

and start beautifying code

lofty bane
#

yea you are right

#

i will do this , sorry but iam new in coding

#

for give me

onyx summit
#

just saying

#

and get a linter

lofty bane
#

@onyx summit

empty delta
#

sa

lofty bane
#

as

onyx summit
#

whats the matter?

empty delta
#

bana kim yardım edebilir

#

türk

earnest phoenix
#

Can someone help me, i want to do my bot in my phone using Dcoder app

lofty bane
#

i know where i should put the const x = stuff

#

but i dont know where i put the let x - stuff

#

forgive me for the bad english

onyx summit
#

let and const are the same, only that you can't modify the variable that was declared with const

lofty bane
#

oh

#

yea now i know

#

thx ❤

#

here in this server i always get help ❤

empty delta
#

ya hiç türk ve bana yardım edecek yokmu

#

tamam yokmuş

#

hi

#

Is there anyone who can command me to make the bot active 24/7

vital prawn
#

Oof

earnest phoenix
#

i command you to make the bot active 24/7

opaque eagle
#

How do I check if a certain npm package is installed globally via code?

vale fossil
#

Anyone have some suggestions for my bot

loud matrix
empty delta
#

sa

obtuse wind
#

I need some help, I have no idea how to make multiple userID's able to access a command, and I've checked the documentation along with trying everything I could think of, I have set up a JSON file called botmasters, in there I have ID's of my most trusted users who are "bot masters" and should have access to every command, but the commands keep denying the bot master's perms anyone know what I could do?

west spoke
#

@obtuse wind what lang

#

most have <manager>.author.id

#

so

obtuse wind
west spoke
#

Ah

#

Py

obtuse wind
#

And I dont use Py I use Atom, & Node.js

west spoke
#

Oh

#

They are very similar to py then

#

honestly I just would make it "if equal" to your id

#

Otherwise just do nothing

#

That's what I do for my eval and say command

obtuse wind
#

aight thx, oh and nice PFP

west spoke
#

crity

#

Not mine.

#

Just a edit

obtuse wind
#

still a nice pfp though

west spoke
#

ty

#

My bot's pfp gonna be changing soontm

vale fossil
#

I'm proud about it too

earnest phoenix
#

wat

unique nimbus
#

eh

earnest phoenix
#

you literally use that which is why it's in an embed

#

stop lying

unique nimbus
#

@earnest phoenix You can put images in embed

earnest phoenix
#

i know

#

that's why i said

#

"which is why it's in an embed"

#

the image url of the embed is set to the above's generator url

vale fossil
#

Don't need to be a shit about it dude

#

We all have our own achievements

earnest phoenix
#

wot? i just said you lied about having image manipulation and instead using a website for it, aka exposed you

vale fossil
#

It uses that site for the image manipulation tho

unique nimbus
#

No Argue

slender thistle
#

This is getting off-topic, stop arguing

unique nimbus
#

Argue bad

cyan crag
#

Alright

#

Can someone help me

opaque eagle
#

What's your question?

amber fractal
#

dont ask to ask

cyan crag
#

Does anyone know how to tag a bot to a server?

#

I mean channel

opaque eagle
#

tag a bot to a channel?

cyan crag
#

Yes

opaque eagle
#

What does that mean exactly?

cyan crag
#

One sec

opaque eagle
#

You mean like invite a bot to your server?

cyan crag
#

First of all you need to tag the channel where you the message that you would like the ReactionRole to go onto.
You need to reply within 5 minutes of this message before I cancel it, this also goes for every single question that will follow.

You can also reply with cancel any time and I will stop asking you questions and stop setting up this reaction role.

opaque eagle
#

Looks like you need help with a specific bot, in which case you should go ask in their support server.

cyan crag
#

Thats what I received from reaction role bot

#

Ahh

opaque eagle
#

This place is for developers who write bots

cyan crag
#

Why does it have to be so difficult?

#

😫

loud matrix
#

How would I achieve what @vale fossil has done, and create a minecraft sign generator in discord.js

earnest phoenix
loud matrix
#

What do Ido though?

#

There's no api for it

earnest phoenix
#

that is the api

loud matrix
#

How does it work

earnest phoenix
#

http://bimmr.com/signs/Sign.php?Line1=&Line2=&Line3=&Line4=

loud matrix
#

idk how to customize that and get the file back

earnest phoenix
#

the url already sends a file, all you have to do is populate the url parameters

loud matrix
#

via?

earnest phoenix
#

wat

loud matrix
#

how? i'm so lost

earnest phoenix
#

by... typing in your value in the url parameters

#

??

loud matrix
#

how do i get my bot to do it

earnest phoenix
#

with magic

loud matrix
#

😞

#

do you not know

unique nimbus
#

rtfd

#

read the docs

idle basalt
#

http request

loud matrix
#

what

idle basalt
#

build the url in your code then send a get request

loud matrix
#

i seem like such a noob, how do i do that? How doi get it user customizable as well

mossy vine
#

use an http lib to send the request

#

construct the link to fit your needs

idle basalt
#

node-fetch, request-promise, axios, etc

mossy vine
#

url*

idle basalt
#

lot of libs

#

build the url with the users arguments

#

and then send a get request to the url with one of the libs

earnest phoenix
#

that's really unnecessary

#

the site returns the image already

#

you can put the url that generates the image in an embed

idle basalt
#

oh wow even better

#

great api lol

#

then its super easy just populate the fields and youre done

neat falcon
#

request-promise is bloated as hell

earnest phoenix
earnest phoenix
#

if you need to refresh the render call forceUpdate

next bluff
#

never set state in a render call or other lifecycle functions because it will cause a loop of rendering

wooden lance
#

Does anyone know of a way for my bot to start up again on server restart? Thanks in advance!

next bluff
#

what library are you using?

wooden lance
#

Javascript

next bluff
#

well actually now that I think about it that's irrelevant, are you using linux?

wooden lance
#

I'm using node.js

mossy vine
#

you can use pm2

next bluff
#

what are you hosting it on

mossy vine
wooden lance
#

It's running on a Linux vps with node. But, ill give @mossy vine's thing a try. Thanks!

#

and great pfp cyber 😂

mossy vine
#

it is exactly what you need for restarting your bot when the server or the bot restarts/errors

#

thanks

wooden lance
#

😀

#

Thinking i want pm2 runtime?

mossy vine
#

imo pm2 is one of those things that a developer working with node.js must be familiar with

#

yes

wooden lance
#

Okay

mossy vine
#

you can install it directly with npm

next bluff
#

does it configure linux services automatically as well?

mossy vine
#

wdym

next bluff
#

I've never used node.js backend

mossy vine
#
Once started, your app is forever alive, auto-restarting across crashes.
Restart even across server restart with startup scripts that can be generated with `pm2 startup`.```
next bluff
#

ah

#

whoa remote deployment as well

wooden lance
#

Installing on my vps now! 😀

steel cloak
#

in discord.js is there anyway to make the bot go offline immediately.
cause if you just stop the code it takes like a minute to go offline

mossy vine
#

process.exit()?

earnest phoenix
#

call destroy on the client

mossy vine
#

oh wait you mean

#

yeah

#

that can work

earnest phoenix
#

it stays alive for like 15 seconds if you exit the process because of how heartbeating works

steel cloak
#

ahh okay thanks a lot

split hazel
#

And if discord doesn't receive a heartbeat back by the set interval it will mark it as offline

thick bough
#

hello guys, I have a problem with the api in my bot, it does not show how many servers my bot is on, neither in the profile of my bot or in the widget.

Excuse my English, I speak Spanish.

split hazel
#

On your DBL bot page or on discord?

tulip wave
#

Make sure you are a: using correct headders when posting and b: make sure you're actually posting the server count

quartz hill
#

There is a hashmap that all shards should use during shanding, how can I give them all hashmaps? discordjs

#

they can both read and edit hashmap

split hazel
#

You should ask something like that on their support server

quartz hill
#

I couldn't find a good answer.

broken elm
#

uhh

#

im kinda stuck

#

im usin djs commando

#

and i'm thinking of ways to do a daily command to get credits of some sort

#

but i can't think of an efficient way

#

i'm gonna use mysql for the currency storage btw

topaz fjord
#

@quartz hill why would you use a hashmap

#

If you use internal sharding it treats all shards as one

#

But normally you can access them by doing broadcastEval

#

Also you don't need to individually give them hashmaps

#

The way sharding works is that it makes an individual process for each shard

#

So having a map in the code will give one to all of them

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

onyx summit
#

just go to my teacher, he will do the same but scream while doing it

#

and don't do linq, or he will scream even louder

ember atlas
#

Command looks fine
https://hatebin.com/lybkziqqao
error

(node:9552) UnhandledPromiseRejectionWarning: RangeError: RichEmbed field names may not be empty.
    at RichEmbed.addField (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\structures\RichEmbed.js:163:33)
    at Object.exports.run (C:\Users\Aidyj418\Desktop\CB Helper\commands\mason.js:13:4)
    at Client.client.on (C:\Users\Aidyj418\Desktop\CB Helper\index.js:104:8)
    at Client.emit (events.js:193:13)
    at MessageCreateHandler.handle (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\Aidyj418\Desktop\CB Helper\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:193:13)
(node:9552) 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(). (rejection id: 1)
(node:9552) [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.
#

DJS

#

There isnt a field name that is blank so idk

onyx summit
#

Is that code from mason.js?

ember atlas
#

mhm

inner jewel
#

are you sure that's the version loaded by the bot?

#

eg you didn't just edit the file without retarting the bot/reloading it

ember atlas
#

mhm

onyx summit
ember atlas
#

No

#

I literally just restarted the bot

#

lets test

#

Nvm

onyx summit
#

Btw

ember atlas
#

I was restarting the bot

#

It wasnt registering

onyx summit
#

Client is already defined in the upper scope

ember atlas
#

I throw that in anyways

#

¯_(ツ)_/¯

olive path
#

Hey, so how would I get the number of all the users in all the servers my bot is in, without counting any multiple times? I know how to exclude bots, but I need help with the rest.

#

Thanks

inner jewel
#

lang/lib?

olive path
#

Oh lmao so sorry Discord.js

inner jewel
#

if you're not sharded/using internal sharding, counting the number of users in client.users should work as long as you fetch all users

#

otherwise there's no reliable way (besides sending tons of data around between processes)

olive path
#

Ok, I'll try that, thank you!

drowsy sentinel
#

@olive path This caches all members as guilds over 250 will lose some users in memory.

ember atlas
#

Is it possible to make a command that will send a message to like 6 channels and I can specify the message that it sends?

inner jewel
#

yes

ember atlas
#

how would i get all the channels?

drowsy sentinel
#

Yes, but you'll need to use a delayed task as sending messages to multiple channels will cause a ratelimit.

smoky spire
#

depends on the lib how

ember atlas
#

djs

smoky spire
#

if you have the ids of the channels you can use client.channels.get("id") for each channel

inner jewel
#

the library should handle ratelimits

ember atlas
#

individual lines?

onyx summit
#

@drowsy sentinel arent the ratelimits per channel

inner jewel
#

but even if you stay inside them you can still get banned for api abuse

ember atlas
#

couldnt i use await in an async function

smoky spire
#

get isn't async

ember atlas
#

no one said it was

drowsy sentinel
#

_>, he's referring to the command execution

#

That's too much @smoky spire, you could just do foreach textchannel in guild.channels

smoky spire
#

but he said specific 6 channels

ember atlas
#

^

smoky spire
#

you'll have to get each channel individually

onyx summit
#

Just filter for then

smoky spire
#

that would also work

ember atlas
#

I think I know how to do it

#

I just dont wanna get banned for api abuse

onyx summit
#

D.js handles ratelimits and if you only once send 6 messages at the same time nothing will happen

ember atlas
#

Ok thanks!

smoky spire
#

but I think the message send ratelimit is per channel anyway

onyx summit
#

Yop

inner jewel
#

there's also the global one

smoky spire
#

Six messages isn't gonna hit that

ember atlas
#

So If i get all channels and have it send a string it will work?

smoky spire
#

yes

ember atlas
#

Thanks

thick bough
#

how do I implement this after the "rewrite":
bot.remove_command("help")

earnest phoenix
#

How to know bot commands @thick bough

thick bough
#

i just want to remove default help command

#

on python*

earnest phoenix
#

@thick bough please understand me clearly how I know bot commands @thick bough please

grim aspen
earnest phoenix
#

@cursive gale help

robust acorn
#

@thick bough {bot instance}.remove_command('help')

#

this should still work for rewrite

thick bough
#

my instance is client but

#

client.remove_command('help') doesnt works

robust acorn
#

can I see whats right before and after the line?

#

it should be one of the first lines after creating that bot instance

thick bough
#

sure

robust acorn
#

you put that line before you actually defined client

#

place it three lines after its current position

thick bough
#

are you sure ? :S

earnest phoenix
#

@thick bough help me bro

thick bough
#

dude i'm newbie xD i'm here asking for help

robust acorn
#

what do you need help with?

earnest phoenix
#

I don't know my bots commands @robust acorn

robust acorn
#

what do you mean? can you be more specific?

earnest phoenix
#

How I know any bots commands @robust acorn

robust acorn
#

what library or language are you using?

#

@thick bough you really shouldn't define client twice

thick bough
#

how can i do this man? sorry but i'm really newbie

robust acorn
#

what about the Bot(command_prefix="=") part? try getting rid of the two lines after and use that line without the #

#

it should work fine

#

Im assuming the purpose of the two lines is so the bot analyzes messages that ping it?

#

the prefix can be a list like (prefix1, prefix2)

earnest phoenix
#

589372091615150081

thick bough
#

I put the "#" to temporarily disable that line, does that affect anything?

earnest phoenix
#

This bot id

grim aspen
#

that's not even here

earnest phoenix
#

This is bot client id

#

589372091615150081

#

Please create a link

grim aspen
#

i'm confused what you're trying to do

#

?

earnest phoenix
#

@grim aspen I have a bot

grim aspen
#

i can tell

earnest phoenix
#

@grim aspen but I don't know this bot commands

#

How I know bot commands @grim aspen

#

Sorry bro but I'm not know very well English

#

Please help anyone

broken elm
#

@earnest phoenix look up “discord permissions calculator” check the perms you want to give it. then insert your client id where i tells youtoo

robust acorn
#

can you guys be more specific?

#
prefix = ("prefix1", "prefix2")
client = Bot(command_prefix=prefix)```
#

this is enough to define client, @thick bough

#

if you want the bot mention to be a prefix, use <@{id here}> as a string

earnest phoenix
#

What is this

wheat jolt
#

Was that bot made by you?

earnest phoenix
#

No

wheat jolt
#

Then it is private

#

You can't add it without owner's permission

earnest phoenix
#

How I made a bot

wheat jolt
#

You want to make a bot?

earnest phoenix
#

Yes

wheat jolt
#

What coding languages do you know?

earnest phoenix
#

@wheat jolt sorry I don't know coding

#

@wheat jolt you know?

wheat jolt
#

There is a way how to create bots, but they can't be just "powered on". They need to be writed in node.js/python etc and they need to be hosted

#

If you want to keep it 24/7

#

Sorry for typo

slender thistle
#

It isn't just js or python

earnest phoenix
#

@wheat jolt bro will you make a bot

#

For me

wheat jolt
#

@earnest phoenix sorry but I can't

earnest phoenix
#

I think you're gonna have to try and learn to code by yourself bud. If you want to make a discord bot you should take some time with learning a programming language and using tutorials to get started. There is plenty out there, so no need to ask people here to make bots for you
@earnest phoenix

robust acorn
#

take your time to actually read the documentations

wheat jolt
#

Yeah, you can search on youtube for "how to make a discord bot"

#

Or something like that

earnest phoenix
#

We all start somewhere. If you want to make something, take the initiative and go out and learn and try :)

#

@earnest phoenix thanks

#

@wheat jolt thanks

#

@robust acorn thanks

wheat jolt
#

You're welcome

earnest phoenix
#

How do for this? this be red?

slim heart
#

With the different code blocks

earnest phoenix
#

not

#

in help command

#

Like this


- ${prefix}help```
#

bit for it be red.

slim heart
#

which part is red?

earnest phoenix
#

The help

#
  • ${prefix}help
#
-test```
#

how do like this for bot?

slim heart
#

what was the code block u used?

#

like
````___ etc.`

earnest phoenix
#

Nvm.

slim heart
#

Well with the bot you can add a code option so for example .send("msg", {code: "css"})

#

if thats what youre asking

#

@earnest phoenix

earnest phoenix
#

Thanks.

earnest phoenix
#

diff\n - words here xD

broken elm
#

i have this code

#

it tells me i cant do the daily command

#

when i havent even used it yet

#

im making it record the time

slim heart
#

please dont crosspost

#

in different servers still count

#

you're already getting help

broken elm
#

well... id di ask in here a fwe times...

#

but sorry

slim heart
#

its ok

#

its just ur already getting helped by someone super experienced :p

quartz hill
#

@topaz fjord The reason I use a hashmap is to prevent other commands from accessing the currently used database line.

cursive gale
#

@earnest phoenix ?? How may i help you?

slender thistle
#

Their question was answered

cursive gale
#

Please don't ping me when I'm not on as it's very painful to check all the pings an answer all of them

#

Ohh ok @slender thistle

red atlas
#

Mmm

#

Someone knows a good neko api?

earnest phoenix
#

nekos.life

red atlas
#

its banned from here

#

owo

earnest phoenix
#

But i think nekos.life has nsfw

red atlas
spare goblet
#

@red atlas heard of nekos.xyz but i think most are also nsfw

nekos.life has many lolis/minors so thats why it's not preferable

red atlas
#

the command is nsfw i just has a problem with lolis

#

i'll try that

tight zealot
#

What is a vpsw

#

Vps

earnest phoenix
#

Virtual Private Server

slim heart
#

um

#

no pls be serious

#

It stands for Virtual Private Server

earnest phoenix
#

Ah yeah private

latent oasis
#

Js
What library can I use to make xp bar?
Like in mee6

earnest phoenix
#

Hello My Bot Dm answered he was thrown. But don't you have to ask me or warn?

#

@latent oasis js

#

xp bar in a canvas

#

or in a embed?

tight zealot
#

Could anyone dm a link for vps

earnest phoenix
#

Digital ocean good vps

tight zealot
#

OkY

earnest phoenix
#

And ovh

#

A little bit expensive but good

tight zealot
#

Oh cost money

#

Do vps cost money

earnest phoenix
#

Yes its not free

tight zealot
#

Oh

earnest phoenix
#

You can find a free vps

#

But

#

Not so good

tight zealot
#

What is the vps for

earnest phoenix
#

Heroku, glitch

tight zealot
#

WhT is that

earnest phoenix
#

Not a vps, but you can host your bot here

slim heart
#

You can’t host on glitch it won’t start but ok

earnest phoenix
#

So use heroku

tight zealot
#

Okay

earnest phoenix
#

Or if you dont want to use free vps, use your computer

tight zealot
#

How

#

I have to leave it on right

earnest phoenix
#

Yes

tight zealot
#

Damn

#

How do I put my computer light down

proper inlet
#

How can I get count of all messages in guild? discord.js

tulip wave
#

Turn off the monitor

tight zealot
#

It’s a regular pc

earnest phoenix
#

@proper inlet not possible

#

api allow you to get only last 200 messages

tulip wave
#

Unless you count every message as it's sent

earnest phoenix
#

message.channel.messages.map(u => u. content)returning last 200 messages

#

and message.channel.messages.size returning 200

#

But yeah, if you want to count every message, add a count in the client.on('message') events

broken elm
#

can someone explain 1. how shards are used
2. what they are used for
3. when should i implement them

earnest phoenix
#

Its for reduce lag

#

And you need to have minimum 2500 guilds

broken elm
#

ok

toxic grove
#

you don't necessairly need 2,500 guilds, it's best to start a bit earlier than that actually.
It's like say, instead of one big walmart there are a lot of small walmarts

tulip wave
#

It's best to start sharding around 2000 guilds as it gives you time to work out issues

toxic grove
#

I just added sharding support for my bot and it made the 2nd shard whenever it wanted to

earnest phoenix
#

How do I add a welcome command to my bot?
in discord.js

#

In the guildMemberAdd event

#

It gives an error

#

Send the error

#

I don't think he sent a mistake right now.

#

I will try and come

#

@earnest phoenix Does Not Send Error, but Does Not Work

#

Maybe a bad return

#

I guess the command is wrong

#

Is there anyone who can send me this command?

#

No spoonfeeding

#

Just send your command

#

Maybe someone can help u

#

Why not?

slender thistle
#

It is indirectly

#

It is kinda related to suicide, I wouldn't suggest putting that as your activity

teal ridge
#

or just add "with a parachute"

#

problem solved

warm oak
#

whats the best thing to write javascripit in

earnest phoenix
#

sublime text

warm oak
#

i dident know java worked on visual studio

#

cool

craggy summit
#

Thats visual studio code

tight heath
#

@craggy summit wyd here smh

#

Go write some klasa

craggy summit
#

Shoo

tight heath
#

Decorators whentm

craggy summit
#

What for? Dm me owo

tight heath
hoary current
#

My bot dont send any message when I run a command
it doesnt have errors on console

split hazel
#

Show us some code, otherwise its like a murder mystery without any evidence or clues

spare goblet
#

Library and Language?

hoary current
#

`const Discord = require('discord.js');

split hazel
#

Is that all?

quartz goblet
#

hi

earnest phoenix
#

hi

quartz goblet
#

help please

split hazel
#

Try doing npm rebuild sqlite3

quartz goblet
#

did not work

split hazel
#

Are you using sqlite 3 or keyv Seninial#9628

#

@earnest phoenix what library

quartz goblet
#

no

#

Speedy#9302

split hazel
#

Could you show me your package json @quartz goblet

quartz goblet
#

which

#

project language turkish

#

computer language turkish

split hazel
#

Package.json file

quartz goblet
split hazel
#

Was about to show you but np

quartz goblet
#

Speedy

split hazel
#

Try running
node-gyp rebuild

quartz goblet
#

Speedy

warm marsh
#

Glitch for you.

quartz goblet
#

Dillon Yes

split hazel
#

Try running npm install -g node-gyp

warm marsh
#

Also, Your version of quick.db is behind. Latest is like 7.0.0

quartz goblet
#

has failed

#

Speedy

west spoke
#

Download better sqlite

#

:b

red atlas
quartz goblet
#

It was not

#

@west spoke

west spoke
#

@red atlas once or twice a second I believe.

#

@quartz goblet then download it

soft plaza
#

can you not add emojis in embed fields?

#

like in the title

quartz goblet
#

ıt was not

#

@west spoke

west spoke
#

@quartz goblet then fucking download it I dont care if it's not. Download it.

#

@soft plaza the title you can.
Format:
<:name:EMOTEID>

#

Tho I need to change it dont i

quartz goblet
#

Speedy

#

Help

#

Please

soft plaza
west spoke
#

No

#

One sec

#

:supporter:

#

oh come on

#

:supporter:

soft plaza
#

code block

west spoke
#

Discord I hate you

#

:supporter:

soft plaza
#

add \

west spoke
#

There God damn it

#

Reeeeee

soft plaza
#

yeah but its not a custom one

west spoke
#

Then I believe you would use unicode symbols

#

At least that's what you can do for reactions

soft plaza
#

yeah i tried that but it does work either

#

must be something in my code thx

west spoke
#

Ah.

hoary current
#

guys no module found name "discord.js"

west spoke
#

Download discord.js

#

You need the dependencies first

hoary current
#

heres my code

west spoke
#

no

#

I dont care about your code

#

you need to install discord.js

#

npm install discord.js

#

@hoary current

hoary current
west spoke
#

that's 10x worse

#

Just run it on a computer

stray garnet
#

Wtf is my bot logo not Changing?

west spoke
#

hm?

earnest phoenix
#

@quartz goblet let me dm u?

#

I think I know this

plain bough
#

Your bot xx was declined. Reason: Your bot has a publicly available token.

what does it mean? Tokens is accessibility by everyone? I didn't understand this.

earnest phoenix
#

@plain bough Token on github

plain bough
#

i dont using github

#

can someone help? any info?

earnest phoenix
#

@plain bough ask to @coral trellis

hushed berry
#

@plain bough you do

topaz fjord
#

@quartz hill what database are you using

#

Most have an auto locking so that data doesn't get messed up

olive path
#

Ok, so I thought I knew how to do this... but apparently I don't... Oops lol sorry. I'm using Discord.JS and for some reason this is returning errors. (I'll send the errors in a pastebin in a sec) bot.users.filter(member => !member.user.bot).size (I tried replacing the use of bot with Client for the whole file, but got the same error)

#

I'm trying to get the number of all non bot users

hushed berry
#

the error would def help

earnest phoenix
#

you're thinking that the collection holds guild members

#

in a sec

#

it holds users, not members

hushed berry
#

oh yeah there ya go

topaz fjord
#

it should be user.bot

abstract crow
#

You mixed up member and user. Just make it (user => !user.bot).size

#

Because you used the member variable on the filter, it kinda just confused ya. That is my guess

quartz hill
#

mysql free host I don't think it's such a feature.

olive path
#

Wait I get it. Sorry I was just getting the error to put it in a pastebin

topaz fjord
#

@quartz hill it does

#

I've ran multiple shards with MySQL and haven't had any issues with reads and writes

split hazel
#

@earnest phoenix run npm rebuild sqlite3 it should fix it

olive path
#

I got it thanks

#

I guess no need for a paste bin

quartz hill
#

If an operation is confirmed within 10 seconds, a command executes the operation. I'm disconnecting access to the row in that database in 10 seconds.

plain bough
#

is this possible to handle every missing permissions error with one code?

earnest phoenix
#

hi guys, can a friend using lavalink in music commands send me a private message? my code javascript.

muted ridge
#

Singularity, use the .hasPermission method on the bot's guild member.

plain bough
#

is there any other way?

muted ridge
#

Uh, if you want to just ignore the error, then you can connect to the error event and match the "Missing Permissions" keyword, I guess?

plain bough
#

i tried a few hours ago but not worked. i ll try again

#

yeah not working

muted ridge
#

🤔

plain bough
#

i want to ignore all missing perms errors

ember atlas
#

How would I have multiple args in one command?

#

Such as h!command <arg 1 goes to one field> <arg 2 goes to another> etc

west spoke
#

What lib

ember atlas
#

djs

west spoke
#

You can split by spaces

ember atlas
#

I got half of it I just need to split the args into multiple ones

#

    .setTitle(args.join(' '))
    .setDescription(args.join(' '))
    .setFooter('ChannelBot Suggestions')
    .setTimestamp()
    .addField('Category', args.join(' '))
    .setColor('00e3ff')
``` So far I have this
#

So How can I split the args

molten yarrow
#

dont .join() them or .spit()

ember atlas
#

How do i define split

topaz fjord
#

It's a method on a string

abstract crow
#

^

red atlas
abstract crow
#

@red atlas Well it shouldn't be spamming editing messages

red atlas
abstract crow
#

Yes because we need to check if NSFW content is in non-nsfw channels

spice mango
#

Wait a second, isn't message logging forbidden by Discords ToS?

red atlas
#

I log the google command and its responses

#

i made it yesterday and its full of errors

jolly sentinel
#

I'm getting an Error 403 on any command that uses Request(url, headers={'Mozilla/5.0'}) then does an urlopen(req).read()

It's hurting my head as to why and I just woke up so brain is not 100% working. This was working completely from the day I wrote the code to sometime last night, I can assume.

red atlas
#

needed to monitor it

spice mango
#

Anyway, who maintains the Github Repositories and the DBL Libraries for Golang?

ember atlas
#

Is it possible to auto add reactions in a command?

smoky mica
#

how to over write permissions of a channel when a new channel is created?

slim heart
#

@spice mango look at the GitHub the person who commits likely does

#

@ember atlas explain what you mean by “auto”

ember atlas
#

you mean me?

slim heart
#

@smoky mica what lib

smoky mica
#

discord.js

ember atlas
#

I write a command and the message that the bot sends, auto adds 2 reactions

smoky mica
#

await and then msg.react('emoji')

slim heart
jolly sentinel
#

assign the message send a variable so you get the message object, then check the docs for a way to add reactions once you have a message object, i'd assume

#

it's like that in discord.py but i wouldn't know for .js

#

i'd assume it's not too different?

ember atlas
#

@smoky mica I can add the emoji id right?

plain bough
#

how to check members permissions on the channel?

slim heart
#

@ember atlas await the message send or put it in a .then and you can .react on the new message

plain bough
#

code

slim heart
ember atlas
#

I cant just use msg.react('emoji') ?

slim heart
#

In the new message you have to

jolly sentinel
#

when the bot sends a message, assign a variable to it

slim heart
#

Cuz you have to wait for said new message

plain bough
#

thanks

jolly sentinel
#

aaa = //blahblah send message

#

i'm assuming how .js works here

ember atlas
#

so i can await the msg.react under the message.channel.send?

smoky mica
#

yes

slim heart
#

Example
.send().then(newmsg=>newmsg.react(etc))

ember atlas
#

ok ty

jolly sentinel
#

or that

#

that is more .js

#

anyways

slim heart
#

Or newmsg = await .send()
newmsg.react(etc$

jolly sentinel
#

i'm still dying because of this dumb 403

slim heart
#

To the discord api?

jolly sentinel
#

It grabs a request from a site like some-random-api.ml or nekos.life and it worked fine before

#

but now it's just sending me 403

#

let me repost the initial message;

#

I'm getting an Error 403 on any command that uses Request(url, headers={'Mozilla/5.0'}) then does an urlopen(req).read()

It's hurting my head as to why and I just woke up so brain is not 100% working. This was working completely from the day I wrote the code to sometime last night, I can assume.

ember atlas
#
    message.channel.send(suggestionembed)

    await msg.react('![cbthis](https://cdn.discordapp.com/emojis/595288390782550036.webp?size=128 "cbthis")')
    await msg.react('![cbthat](https://cdn.discordapp.com/emojis/595288463373238272.webp?size=128 "cbthat")')
#

Would this work?

slim heart
#

Boss no

jolly sentinel
#

no

slim heart
#

You have to await the .send

ember atlas
#

why

slim heart
#

Not the reacts

#

Please learn js async and promises

ember atlas
#

Im good

#

but ty for the offer

slim heart
#

Then no you can’t automatically do it lmao

#

Cuz no one is going to help you

#

Yea it’s called the internet

ember atlas
#

Isnt it just wait the message, and then add the reacts

slim heart
#

Google it

jolly sentinel
#

i have like two full sections of my bot closed off because of this 403

ember atlas
#

Well then I dont need to be getting help from you if youre gonna act like this. I actually learn better by getting help from others.

slim heart
#

Pythr it means you don’t have permission to do something specific, this is really endpoint specific based cuz they can all mean different things

jolly sentinel
#

I understand what a 403 is

#

It's just the fact that it worked perfectly before

#

Which is throwing me off

slim heart
#

Right but no one is gonna hold your hand 24/7 if you can’t learn yourself don’t even consider yourself a developer. You’ve got your answer please stop talking here unless u have a new question. That wasn’t meant to be rude I can’t express well over text lol

onyx summit
#

then they changed their auth system or your token expired

slim heart
#

403s usually mean you have the right auth you just don’t have access to that endpoint

#

Atleast In dapi it is

onyx summit
#

dbl uses 403 for exactly that

slender thistle
#

401 is token
403 is endpoint

ember atlas
#

So it doesnt work. Its saying msg isnt defined.

mossy vine
#

of course it doesnt

#

you didnt define it

ember atlas
#

well i changed it to message

earnest phoenix
#

lol

#

its the same thing

onyx summit
#

still not defined

abstract crow
#

So that would be why msg isn't defined?

earnest phoenix
#

ur using js right?

ember atlas
#

well message is defined.

abstract crow
#

But msg isn't

ember atlas
#

Because I got a diff error when trying that

onyx summit
#

but msg not

mossy vine
#

whats your code now

ember atlas
#
const discord = require('discord.js'); 

exports.run = async (client, message) => { 

    const suggestionembed = new discord.RichEmbed()

    .setTitle('Reaction Permissions')
    .setDescription('It is almost like a reaction role, but instead when you react you get permissions to view a channel.')
    .setFooter('ChannelBot Suggestions', 'https://cdn.discordapp.com/avatars/594568982342664194/275908a4c33320f641404a8afa74288d.png?size=2048')
    .setTimestamp()
    .addField('Category', 'Channel Management')
    .setColor('00e3ff')
    await message.delete()

    await message.channel.send(suggestionembed)

    message.react('![cbthis](https://cdn.discordapp.com/emojis/595288390782550036.webp?size=128 "cbthis")')
    message.react('![cbthat](https://cdn.discordapp.com/emojis/595288463373238272.webp?size=128 "cbthat")')

}
mossy vine
#

msg = await message.channel.send

msg.react

ember atlas
#

then why doesnt it say message isnt defined

mossy vine
#

because you delete the message

earnest phoenix
#

because u have it in the async

ember atlas
#

im just trying to get it auto react mswearylegs

#

It worked fine till this

earnest phoenix
#

don't u have a test bot or something

ember atlas
#

this is my test bot

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

a 24mb pdf lmao

ember atlas
#

im not reading 430 pages

#

im trying to get this to autoreact and i dont know why its ot working

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

as others already told you, you're trying to react to the message you deleted, not to the message you just sent

ember atlas
#

well i need to fix that

jolly sentinel
#

@ember atlas


msg.react(...)```
ember atlas
#

and what will work

jolly sentinel
#

that

mossy vine
#

that will work

plain bough
#

this place is so helpful, thanks for your help

mossy vine
#

which is also what i told you to do before roeesip

jolly sentinel
#

which is what i think

#

two other people, including i, told you what to do prior

ember atlas
#
(node:13356) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
emoji_id: Value "595288390782550036>" is not snowflake.

mswearylegs

abstract crow
#

Its not a valid ID

#

You have a > at the end of the string

jolly sentinel
#

insert repost of the have you tried: reading the error image

ember atlas
#

Wait you dont need <> for the emoji id?

jolly sentinel
#

no

ember atlas
#

damnit

#

thats the issue

abstract crow
#

No. An ID is numbers in a string

#

Well even that it messed up

#

Even if you were supposed to

#

You had one >

jolly sentinel
#

unless you're using discord.py-rewrite, in which case, ids are ints because life hates you

abstract crow
#

lol

ember atlas
#

See it says unknown emoji

#

yet its not an unknown emoji

abstract crow
#

Is it a Discord Nitro emoji?

jolly sentinel
#

do you have an emoji in that guild

abstract crow
#

Like ones across different servers

ember atlas
#

no

#

and yes

jolly sentinel
#

with that id

ember atlas
#

yes

abstract crow
#

I would make sure it is the correct ID again. Just re copy it

mossy vine
#

ads

jolly sentinel
#

I just looked at my code and had a 'ohhh, that's what i did wrong' moment, then I got the same exactly error.

earnest phoenix
#

lol

jolly sentinel
#

lol

mossy vine
#

@abstract crow someone is spamming ads lmfao

ember atlas
#

It was a my bad

abstract crow
#

Where?

ember atlas
#

I was trying to do it all in one

#

I separated them into 2

#

and it worked

bright meadow
#

I have a question.
Example:
If my bot is in 1000 servers and has 2 shards and I want to post shards+servercount to the DBL api, do I post (shard id, 500 (for 500 server per shard)) or (shard id, 1000 (full server count))?

split hazel
jolly sentinel
#

the problem that i have with my 403 issue is that every single report of the problem online leads people to say "well use a header" and links some useragentstring website yet no header has worked for me, despite all of these commands working fine yesterday

slender thistle
#

403? Authorization!

jolly sentinel
#

the reason I think it's related to my agent-user is because the first time I got a 403 relating to these commands was because I needed the agent-user to make it work

#

and that's the only part of the command that I can change really to make it work

#

aka i have no clue what to do by you saying 'authorization' i am very lost

split hazel
#

Google status 403

jolly sentinel
#

you know

#

that response just now

#

means you have not read

#

any of what i have said

slender thistle
#

User Agent doesn't really matter

#

403 is endpoint being locked for you usually but I have no clue what endpoint exactly

jolly sentinel
#

and any command relating to those two don't work

slender thistle
#

Do those require authentication upon requests

jolly sentinel
#

I had to switch from urllib to Request() just to use them because of the User-Agent thing

#

Because before it would spit a 403 at me if I used urllib

slender thistle
jolly sentinel
#

It was working fine for a few weeks

#

and now it's coming back at me with the error

slender thistle
#

403 for undefined user agent...

jolly sentinel
#

well, that would be a neat way to solve this, but i've tried three different user-agents that I've obtained through three different ways.
'User-Agent': 'Mozilla/5.0' (it worked fine up until now and I had no reason to change it)
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0' (found from a list of user-agents)
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0' (from a network tab off the site itself)

#

It's also not throwing a 403 through the request

#

it's throwing a 403 through my urlopen(req).read()

#

I feel like there's something blatantly wrong here but I really can't see what it is

opaque eagle
#

Just to make sure, these two are the same, right? js Object.assign(this, { client, name }); this = { client, name, ...this };

sudden geyser
#

I haven't tested it myself, but I'm pretty the first one keeps the instance while the 2nd one just contructs an emtirely new object. So it wouldn't have the <Constructor Name> {...} for the 2nd one

#

which I think are different

opaque eagle
#

ok

#

also one more thing

#

Nothing shows up on the console when the client logs in```js
class Client {

constructor() {
    const functions = Object.getOwnPropertyNames(this).filter(e => typeof this[e] === "function");
    for (const func of functions) {
        this.on(func.slice(2), (...args) => this[func](...args));
    }
}

onReady() {
    console.log("Connected!");
}

}```

sudden geyser
#

Are you sure that line is being executed/where you ran it

grave pilot
#
    if (!message.member.roles.has(["594588784671064065", "594588905190326297", "594588967144390656"])) return message.reply("You need to have a premium subscription to use this command!");

I have one of the roles
Am I dumb or something? Why does that not work? I am on master discord.js

quartz kindle
#

@grave pilot use .some() instead of .has()

grave pilot
#

Will try

#
(node:5904) UnhandledPromiseRejectionWarning: TypeError: fn is not a function
    at Map.some (C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Collection.js:280:11)
    at Map.store.(anonymous function) [as some] (C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Util.js:459:23)```
#

Did not really work

#

I never even used fn

#

That is why I am lost

#

I know what it says

opaque eagle
#

Check the location for the stack trace @earnest phoenix

grave pilot
#
const { Premium, Users } = require("../databases/manager/db.js")
const moment = require('moment');

exports.use = async (client, message, args, command) => {
    if (!message.member.roles.some(["594588784671064065", "594588905190326297", "594588967144390656"])) return message.reply("You need to have a premium subscription to use this command!");

#

Mind telling me where I use fn?

opaque eagle
#

C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Collection.js:280:11

#

that error is coming from node_modules

grave pilot
#

The issue is .some

opaque eagle
#

the stack trace is the stack trace...

#

It's this part... 🤦 at Map.some (C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Collection.js:280:11) at Map.store.(anonymous function) [as some] (C:\Users\erikn\Desktop\manager-v3\node_modules\discord.js\src\util\Util.js:459:23)

#

stable or master? @grave pilot

grave pilot
#

Master

opaque eagle
#

You need to pass in a function then

#

It was deprecated in stable, and now removed in master

grave pilot
#

Awe

opaque eagle
#

Pass in a function to thatjs message.member.roles.some(["594588784671064065", "594588905190326297", "594588967144390656"])

grave pilot
#

Then I need to make a function

opaque eagle
#

What do u wanna do with that code in the first place?

grave pilot
#

To much work

opaque eagle
#

That's not too much work

grave pilot
#

Check if author got the role

#

Corresponding the one of the IDS

opaque eagle
#

oh

#

And it can be any one of those roles?

grave pilot
#

Yea

opaque eagle
#
["594588784671064065", "594588905190326297", "594588967144390656"].some()```
#

Now in that function check if the author has the role with Map.has() for message.member.roles

grave pilot
#

Lemme check

#

Would

["594588784671064065", "594588905190326297", "594588967144390656"].some(message.member.roles.map())

Work?

opaque eagle
#

No

quartz kindle
#

nope

opaque eagle
quartz kindle
#

you can also just do t => [].includes(t.id) in the .some

opaque eagle
#

Yeah that works too I guess