#development

1 messages ยท Page 669 of 1

earnest phoenix
#

you misspelled position in your code

winged thorn
#

oh yeah

#

lmao

abstract crow
#

omfg

#

I thought I checked that

#

lol

#

Thanks ๐Ÿ˜ƒ

amber fractal
#

@abstract crow for future reference tho, you can check the version of an npm package by doing npm list <package>

topaz fjord
#

@winged thorn box-shadow: none !important

#

in .columns .bot-img { ... }

#

to get rid of the white border

winged thorn
#

Oh cool i'll give it a go

#

ah didn't work

abstract crow
#

So I have a public github project going up soon. Should I just link the documentation in a readme or put in in both the website and the read me? It will include the setup and all of the commands so idk

hollow saddle
#

Iโ€™d say both

#

So the docs are accessible from every resource

wooden lance
#

Hi! I run a discord.js bot and was wondering if anyone knows how to set up a system where when a member joins a server, it checks for them in a JSON file, and if it finds them, kick them from the server and send a message to a channel called logs. Thanks in advance.

opaque eagle
#

Use a database instead of a JSON file.

#

Boom, the whole problem became so much easier.

wooden lance
#

Okay

stone dust
#

database will make the process much easier if youโ€™re scaling up

wooden lance
#

i've got a free sql database with my vps hoster

stone dust
#

if you want to go the JSON route you could just list user IDs line by line and parse that on startup

#

ah super cool

wooden lance
#

well, 25

stone dust
#

which library?

wooden lance
#

javascript

stone dust
#

ah cool

#

node has file system which you can use to read a line separated file

wooden lance
#

cool

stone dust
#

split on new line chars and record in a set-like structure probably

wooden lance
#

okay

#

do you know how to set it up?

stone dust
#

uh

opaque eagle
#

Donโ€™t use JSON for it

stone dust
#

attach it to a server join event if applicable

#

idk djs

wooden lance
#

and i have no idea what a server join event is. never used it.

stone dust
#

ah

#

probably check the docs for it then

#

the djs api should generate events somewhere and youโ€™ll attach functions to those

wooden lance
#

okay

#

thank you

stable hatch
#

can someone help me with the invite manager bot?

#

<@&304313580025544704>

wooden lance
#

@stable hatch i can help, but you don't need to ping the whole moderation team

stable hatch
#

ok sorry

spare goblet
#

]]supportserver

covert turtleBOT
#

This server is NOT the support server for ANY bot. You need to click on the "Support Server" button on the bot's page, NOT the "Join Discord" button at the top of DBL.

stable hatch
#

ok thanks

wooden lance
#

oh, i thought you meant yours

opaque eagle
#

Lol

spare goblet
#

Have a good day blobsmilehappyeyes

wooden lance
#

yeah, you'll need to go to theirs lol

stable hatch
#

ya thanks

opaque eagle
#

Mute

spare goblet
#

We don't mute if they genuinely have a question and don't seem to have meant to hurt anyone, and/or trolling

wooden lance
#

wow this discord.js site is no use to me.

#

i dont understand it at all lol

flat pelican
#

smh

#

Please think two times before pinging 15 people

#

]]atmods

covert turtleBOT
#

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

Here are some examples of emergencies:

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

Mentioning an entire moderator role without a justifiable reason is a punishable offence.

stone dust
#

@wooden lance https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-guildMemberAdd this looks like the right event. unfortunately the documentation has a bit of a threshold, and it could probably be organized better, but this is the event you are looking for

wooden lance
#

thank you so much! this is starting to make sense! ๐Ÿ˜„

earnest phoenix
#

Imagine tagging 15 people

wooden lance
#

oof

young kayak
#

I've got a question. I'm new to Javascript and am wanting to understand how to use the new method of finding a specific role (Don't know how new it is, just that I'm using a deprecated method).
Currently in my script I have

var role = member.guild.roles.find('name',  'Member');

I have seen examples that don't really give specifics or explain how the new method works, and as such, I don't know how to use it. Any answers would be appreciated

#

I think it's more in regards to any .find thing

stone dust
#

thats the new method or the old one?

sick cloud
#

use a function

#

(role) => role.name === 'Member' is the basic replacement for 'name', 'Member'

broken shale
#

Will be deprecated soon anyways

stone dust
#

oh what's the alternative

broken shale
#

the function won't be deprecated but the 'name', 'Member' will be on d.js v12

stone dust
#

ah ok

#

thanks for the help!

young kayak
#

Oh okay, thanks @sick cloud, helpful. I can understand how that works. Every other example I saw (that I can't remember off the top of my head) had no clarity or explanation to it, but I can read your example perfectly fine, so thank you ๐Ÿ˜ƒ

sick cloud
#

yep it's fine

young kayak
#

Wonderful! It works, and I no longer am receiving deprecation warnings. Much appreciated! โค

zealous veldt
copper cradle
#

ther's no jsfile

#

maybe you want to require jsfile :^)

sick cloud
#

jsfile is undefined

#

pretty obvious

ionic kiln
#

Hello everyone!
I have been trying to submit my bot here for a month now, and every time it was being reviewed a Missing Access error turned up and I don't know why. When someone called my help command on the Testing server the command returned with the mentioned error.
Anyone knows why?

lusty dew
#

Show error?

#

That'd help

ionic kiln
wet forge
#

also how do you people store stats for a user or anything of that sort without it being written into the class? as of now, im trying to go kinda with a minecraft approach, where stats are stored externally from the user, and it stores a list of stat names with an int value. all i know is that i've been overthinking this for awhile, and i need to see from a different perspective lmao

lusty dew
#

Oof python can't help ya there bud @ionic kiln

ionic kiln
#

What do you mean by that?

lusty dew
#

Idk python

#

๐Ÿ˜‚

ionic kiln
#

oh i see ๐Ÿ˜„

lusty dew
#

Sorry

pale marsh
#

You're making global checks for perms. Make the checks per command

#

Because it makes no sense for a help command to need elevated permissions

#

Also you should consider that your bot can be invited without permissions to any server. Put that in mind

#

When that happens make sure you output a message asking the user to grant the bot the required permission, and it has to make sense and be in the context of the command

ionic kiln
#

Oh ok. Thanks for helping ๐Ÿ™‚

pale marsh
#

No problem

viral spade
#

Hello i have a question.
I use discordjs.
Lets say i get a message event and with it the msg object.
In that object i can access the guild members by msg.guild.members.

Will it contain truely all users of that guild, or might not all be cached?

umbral glacier
#

Execute me, here ask for any advice.
I would like to implement bot to read image from some hosting which free and friendly for non-dev users
The image will host for a period of time (weekly)
And bot will fetch that image to show when it got command

Any suggestion for the service that approach what I said? any suggestion will be appreciate

twilit rapids
#

Define KUser...

#

Idk, what is KUser supposed to be

#

Wait i see

#

You have KUser but you use kUser everywhere

#

Note the capital k at the first

#

.-.

#

Change it everywhere

pallid zinc
#

Or u can simply change let KUser to kUser

lusty dew
#

Is it spamming if I send a message through my bot to 21 servers?

quartz kindle
#

if its "out of nowhere" yes

lusty dew
#

Hm okay

#

Well rip that idea

#

Any other ways I can get testers xd

winged thorn
#

Put the message as a footer in some of your embeds or something

lusty dew
#

Ahh good idea

#

Maybe in the support or info cmd

winged thorn
#

Or any commonly used commands

lusty dew
#

Hm true

#

Thanks

#

Help command would be used a lot Thonk

#

Okay thanks

winged thorn
sweet niche
#

w

earnest phoenix
#

u need help? @sweet niche

lusty dew
#

Does anyone know an npm package I could use to get info from discord servers like channel IDs that i can use on a website or could I use d.js

amber fractal
#

d.js

#

<Guild>.channels

inner jewel
#

you'd have to fetch that data on the backend

#

since it needs a bot token

#

and sending that to everyone who opens your site is an easy way to get banned

lusty dew
#

It's for a report function

#

But I see what you're getting at

#

Any other way I could get a guild ID without getting banned?

amber fractal
#

Wait a Guild id

#

From what, a bot

#

Or just your account

lusty dew
#

Website side

#

Without a bot

#

I need to access the guild to get the channel ID

amber fractal
#

MegaThonk if you arent in it, no

lusty dew
#

I'm in the server

twilit rapids
#

You don't have access to channels or guilds your application isn't it

amber fractal
#

OAuth2 has guilds scope

lusty dew
#

Yea

#

That's why I was gonna add a login button

#

But idk how to use the OAuth shit

#

I've tried

#

Never succeeded

twilit rapids
#

You can check what guilds someone is in, but you cannot gain specific information about channels and users within the guilds.

lusty dew
#

Shit oh well

#

What if I use a bot?

twilit rapids
#

Then it would be possible

lusty dew
#

And connect the bot with the website

twilit rapids
#

That's possible

earnest phoenix
#

Hey

lusty dew
#

Now I just need to figure out how to connect the bot with the website

#

๐Ÿ‘€ ๐Ÿ˜‚

earnest phoenix
#

Whereโ€™s the support channel ?

lusty dew
#

You're in it

earnest phoenix
#

How do you get votes ?

#

For ur server

lusty dew
#

Uhm idk

#

I don't use DBL server listing

#

Only bot listing

#

And I don't think this is the right channel for that topic

#

I thought you were talking about coding wise

stray garnet
#

how to get usertag of serverowner

im using d.js

zealous veldt
trail dagger
#

because i cant get the watching status

#

it was type=3 for watching before? what happend?

amber fractal
#

Docs?

tight heath
#

@stray garnet Guild#owner should be a GuildMember

#

so you could do something like guild.owner.user.tag

#

or, if it isn't

#

client.users.fetch(guild.ownerID).then(r => r.tag)

pallid zinc
#

How can I connect my bot with website

#

So I can add prefix and custom command

opaque eagle
#

make a website where users can set those options

pallid zinc
#

Any API?

opaque eagle
#

and when they do it, update ur database

mossy vine
#

you make the api

opaque eagle
#

^

pallid zinc
#

Lol

opaque eagle
#

Not joking

#

You make an API that your website uses

mossy vine
#

why lol? im trying to help ya here spongerino

pallid zinc
#

Ik

#

I was laughing on me

#

When someone summit any info the info should be send to my Gmail

#

And I have to edit

#

??

tight heath
#

to send email, it's probably easiest to use postfix or postal

#

or a hosted service like sendgrid

pallid zinc
#

Can I save info in db

opaque eagle
#

lol i think he wants to make a contact form with the custom prefix and custom commands stuff

pallid zinc
#

Then my bot can read it

opaque eagle
#

and then he will manually change the DB

tight heath
#

alternative use sentry and throw an error so you get an alert report

abstract crow
#

^

tight heath
#

@opaque eagle lmaoof

#

no but honestly

#

google mongodb guide or some shit

#

would be very cool if you used Google before asking here yk

opaque eagle
#

lol

abstract crow
#

@tight heath Is it worth to pay for Sentry?

amber fractal
#

@abstract crow are you a student?

abstract crow
#

Wdym by student

amber fractal
#

You get it for free with github premium

abstract crow
#

Like College?

#

Or HS

amber fractal
#

Either

abstract crow
#

HS

amber fractal
#

Yeah,youcan sign up for free github pro

abstract crow
#

Ooo

amber fractal
#

And get free sentry

opaque eagle
#

Yes GItHub Student Pack is good

abstract crow
#

Does my school need to approve it

opaque eagle
#

I get free JetBrains and free sentry

#

u need to show smth to prove u go there

abstract crow
#

Well yeah

opaque eagle
#

like a report card or student id card

abstract crow
#

All my friends that are going got there id

#

Except me.

opaque eagle
#

what about school email

abstract crow
#

Not yet

opaque eagle
#

ok

abstract crow
#

Today was a day that we can go and get it

#

Or next week

amber fractal
abstract crow
#

So I am going next week

#

Does this last only until I am in HS?

#

And if so, after HS ends, does my stuff save to go back and pay for it later

eager wasp
#

Does anyone know how to reload a js file ?

abstract crow
#

In College

amber fractal
#

You can get it throughout your entire education

#

Well middle school+

abstract crow
#

Middle school!?

#

I didn't know that lol

amber fractal
#

One of my friends got it anyways

#

Just an id

hollow saddle
#

@eager wasp delete the cache of that file

abstract crow
#

Damn you get a lot

amber fractal
eager wasp
#

ok

abstract crow
#

DO and Azure

amber fractal
#

A free .me domain mmLol

abstract crow
#

lol

stray garnet
#

how to mention an role? im using currently ${roles.name}

abstract crow
#

Better than .tk

#

<@id>

#

Oh nvm

#

That is for people

amber fractal
#

Works for roles too I believe

#

What's the trial mod id?

earnest phoenix
#

Paris #BringLucaBackToday at 5:47 PM
how to mention an role? im using currently ${roles.name}
you can either use the appropriately named property on the Role object or construct it yourself; <@&id>

tight heath
#

@abstract crow i don't pay for sentry

#

they offer OSS licenses

inner jewel
#

even the free 10k plan is a lot

earnest phoenix
#

Helo, I'm having a bit of a problem here with .forEach

lets say user has mentioned members and i wanna list each in embed
problem is: using .forEach will send message for each mentioned member and i want to somehow add them to variable

#

and send single embed with members in a variable rather than multiple embeds
(discordjs)

sudden geyser
#

You could use something like <Array>.map() to map each user to an array

pale marsh
#

Create a variable and append to it the member's tags in the forEach loop then send it after

earnest phoenix
#

i was thinking of that loop thing

#

but cant get it right

pale marsh
#

Create the variable before the loop

#

In the loop append

#

After the loop send

inner jewel
#

map/join seems to be what you want

earnest phoenix
#

o shid, it was way too simple

inner jewel
#

eg [1, 2, 3].map(x => x + " is even: " + (x % 2 == 0)).join("\n")

maiden mauve
#

x & 1

#

much more efficient ๐Ÿ˜‰

#

@inner jewel [11425, 12532, 119783].map(x => x + " is even: " + Boolean(x & 1) ).join("\n")

inner jewel
#

as if that matters

#

you save a few clock cycles you'll instantly lose with the main memory accesses it needs to do

maiden mauve
#

๐Ÿ˜ฎ

#

I just love the simplicity of it

earnest phoenix
#

๐Ÿž

maiden mauve
#

I guess it's only a viable solution for huge numbers where division would actually create processing

#

I just like the "1 condition" aspect of it

inner jewel
#

division isn't slower for larger numbers

#

it's a constant time

#

unless you're using BigInt

maiden mauve
#

It's actually been awhile since I looked at a division math library

#

We made one for practice back in the day as a subtraction loop

#

which a series of conditionals

lusty dew
#
0|clap  |     at Function.keys (<anonymous>)```
#

I keep getting that error

#

But I thought you could convert null values to a new value or smth

maiden mauve
#

undefined and null are different types

#

I don't know the exact correct description

#

but its basically "lack of a definition" vs "lack of a calculatable value"

lusty dew
#

The thing I'm checking is null

maiden mauve
#

1 method is to prevent null from occuring

#

the other is variable == ""

lusty dew
#

I don't know how to do that

#

It's for a database

#

I'm checking if res is null and if so then it would create a DB entry for that guild

maiden mauve
#

so your checking to add a new entry to DB?

lusty dew
#

Ye

maiden mauve
#

if !( db.find(res) )

lusty dew
#

Do you even know what db I'm using

maiden mauve
#

pseudocode

lusty dew
#

Ik I'm just saying

#

Lol

maiden mauve
#

but the lack of a found entry in db/array

#

creates a boolean

#

rather than iterating your db checking for a null value

valid frigate
#

shouldnt an empty entry return null

#

and not a boolean lmao

amber fractal
#

I read that wrong

maiden mauve
#
const doc = model.findOne({snowflake: message.author.id});
if(!doc) { ... } // no "snowflake" was found in database matching the message author
valid frigate
#

normally if you query your db for an entry and it doesnt find anything it gives you null

maiden mauve
#

that's mongoose syntax

valid frigate
#

yeah like that

maiden mauve
#

checking for null just tends to lead down a weird path

#

using a potential null variable to check a boolean is preferable

lusty dew
#

I'm using mongodb oof

#

Mongoose sucks imo

maiden mauve
#

I just use mongoose because the syntax was alittle quicker to pick up on

#

Also the schema validation has been useful in my project

wooden prawn
#

Is anyone here a god or just good with SQL / storing data? I need someone's opinion on implementation of storing ping logs

shy turret
#
    if (cmd.startsWith('$buy-dlc')) {
      if (!fs.existsSync('data//' + message.author.id + '.txt')) {
        oldpoints = 0
      } else {
        oldpointsstring = fs.readFileSync('data//' + message.author.id + '.txt').toString().split('\n');
        oldpoints = parseFloat(oldpointsstring, 10)
      }
      if (oldpoints < 150) {
        pointsneeded = 150 - oldpoints
        message.channel.send('You cannot buy this item. You need **' + pointsneeded + "** more points to buy this item.")
        return
      }
      stockmaxstring = fs.readFileSync('keydata//dlcmax.txt').toString().split('\n');
      stockmax = parseFloat(stockmaxstring, 10)
      stockcurrentstring = fs.readFileSync('keydata//dlccurrent.txt').toString().split('\n');
      stockcurrent = parseFloat(stockcurrentstring, 10)
      if (stockmax == stockcurrent) {
        message.channel.send('There is no more DLC keys in stock.')
        return
      }
      stockcurrent = stockcurrent + 1
      reward = fs.readFileSync('dlckeys//' + stockcurrent + '.txt').toString().split('\n');
      try {
        const embed = new Discord.RichEmbed()
          .setAuthor('DLC Steam Key')
          .setColor(0xFF0000)
          .setDescription('Key: `' + reward + '`')
        message.author.send({embed});
      } catch(temp) {
        message.channel.send(message.author + ", it seems like your DMs are disabled or you blocked me. Please enable them to claim prizes.")
        return
      }
      message.channel.send(message.author + " check your DMs! :mailbox_with_mail:")
      fs.writeFile('keydata//dlccurrent.txt', stockcurrent, function(err) {
      if (err) throw err;
      });
      newpoints = oldpoints - 150
      fs.writeFile('data//' + message.author.id + '.txt', newpoints, function(err) {
      if (err) throw err;
      });
      return
    }
#

I'm trying to make a little steam claimer bot

#

but after the command ends, the points become NaN

wooden prawn
#

Why dont you add a bunch of logging in there, logging the points at key intervals

shy turret
#

yah im trying that rn

#
oldpointsstring: 
oldpoints: NaN
stockmaxstring: 7
stockmax: 7
stockcurrentstring: 6
stockcurrent: 7
newpoints: NaN
#

file not read?

#

sometimes works sometimes not

#
oldpoints: 151
stockmaxstring: 7
stockmax: 7
stockcurrentstring: 6
stockcurrent: 7
newpoints: 1
oldpointsstring: 
oldpoints: NaN
stockmaxstring: 7
stockmax: 7
stockcurrentstring: 6
stockcurrent: 7
newpoints: NaN
#

it loads when they have less than 150 points

#

for some reason

earnest phoenix
#

JSON.parse(fs.readFileSync(''))

#

if it's in json

shy turret
#

not json

#

just console

shy turret
#

Seems like 2 file actions were kinda running at the same time. I fixed the bug

earnest phoenix
#

bruh, how do i .push json file ;

tight heath
#

w h a t

unique nimbus
#

what

earnest phoenix
#

bruh

#

i can .push item in a list

#

but im trying to .push item into .json

tight heath
#

push into the array

#

then fs.writeFile to .json

earnest phoenix
#

it will overwrite

#

nvm i figured it out

tight heath
#

oof

amber fractal
#

read it, parse it, push it, parse it, write it. Incase what you're doing doesnt work

earnest phoenix
#

Got a question

#

How the hell do I sign into github from a terminal

mossy vine
#

generate an ssh key and add it to your github account

earnest phoenix
#

Already done and connected and everything

#

But my bot fails at updating

#

I can't even clone things

#

My bot has an auto update feature

mossy vine
#

are you using the ssh links instead of https

earnest phoenix
#

No

amber fractal
#

what?

#

Why not just install git

earnest phoenix
#

Got it installed

onyx summit
#

Not because I need it, but because I'm interested on how it would work:
Let's say you have a really big bot and have to cluster it over multiple servers.
How would you do that?

#

A master that locks the shards (the other servers) to specific guilds/shards over a websocket?

sick cloud
#

@hushed berry hey nik you might be able to answer here ^

onyx summit
#

Feel free to ping be if you answer, I will have to sleep

hushed berry
#

@onyx summit youre pretty much on the right path

#

some manually assign ranges for each server

#

ie, server 1 logs into shards 0 - 4 and server 2 logs into shards 5 - 9

#

but a dynamic solution is definitely possible

#

the main issue is that its really easy for a shard to get lost

#

a few bots have had issues where shards get logged into twice, which also probably means a different shard has been logged into 0 times

#

groovy actually had that issue for quite awhile

split hazel
#

On nodejs, what's the most efficient and quick way of looping through an array of around 400 elements and running some code for each on an interval?

sudden geyser
#

You could use the setInterval method for doing an action every X miliseconds and iterate through the array with a for of loop or forEach loop.

#

"most efficient" can go a lot of ways

topaz fjord
#

thats a lot of intervals

sick cloud
#

a nicer way would be to have a master setInterval that loops through the array then runs the code for each using a for loop

broken shale
#

^

split hazel
#

I am using for each but bench marks proved to be to be one of the slowest

inner jewel
#

for 400 elements it doesn't matter

#

unless you're in a hot loop

#

aka thousands of times per second

broken shale
floral bloom
hollow saddle
#

1st and only step: don't use glitch

floral bloom
#

:/

#

I don't have much else

sick cloud
#

buy a vps

broken shale
#

or just delete the package.json and try installing all the node modules with npm i

#

ยฏ_(ใƒ„)_/ยฏ

sick cloud
#

glitch doesn't support npm

broken shale
#

If that fails get a vps

#

Then ditch glitch

#

๐Ÿ’ฏ

sick cloud
#

you need to use it's own special installer

floral bloom
#

Hmm

broken shale
#

Or copy paste node_modules into glitch?

floral bloom
#

But most of my other bots work and I do the same thing

broken shale
#

idk never used glitch

floral bloom
#

:/

sick cloud
#

step one is to not use glitch

#

that's it

floral bloom
#

No

sick cloud
#

if you want help ask the glitch forums

#

we aren't glitch support

floral bloom
#

Someone here helped me before

#

I just don't remember who

broken shale
#

@floral bloom tbh try heroku

#

Heroku's console is better and uptime is better

#

ยฏ_(ใƒ„)_/ยฏ

floral bloom
#

But I couldn't figure it out

#

Also

#

Is it free?

broken shale
#

Yes heroku is free

floral bloom
#

Hmm

sick cloud
#

heroku isn't 24/7

#

you only get x hours per month

#

any free host won't be good

broken shale
#

That's more than enough compared to glitch's 12 hour hard uptime

#

and besides you're having problems with glitch

sick cloud
#

how about

#

buying a vps

floral bloom
#

I use glitch with uptime robot to keep it online

#

I don't have many problems

broken shale
#

or how about vps like Tonybo suggested from the beginning. I don't know what else to suggest. Sorry.

warm marsh
#

Delete the line "discord.js":"version" from package.json

#

then re-add it with the "glitch package installer"

#

It's highly recommended to get a vps though. Glitch is shit.

floral bloom
#

I can't buy a VPS though

#

๐Ÿคฆ

#

Why does it need a capital D?

#

Oooook

#

I found the problem

#

It wasn't able to install the Discord.js package because the version I had for canvas wasn't a proper version

#

Welp, thanks for the help all

earnest phoenix
#

Wait, canvas is a seperate npm package how does it have any relation with discord.js ? And no it doesn't require a capital D

#

You just had to write discord.js, remove s and add it again in order to reload the search

floral bloom
#

@earnest phoenix It seems like it caught the error of the incorrect version of canvas before it loaded Discord.js.

#

_ _
Anybody know what would cause this?

- UnhandledPromiseRejectionWarning: DiscordAPIError: 401: Unauthorized
#

Ping with response please!

earnest phoenix
#

I'm trying to teach my bot how to have a conversation with people, but at the moment the bot simply finds the first trigger word and then posts that response ordered in the JSON file. How do I get the bot to look at the entire context of a message and make a somewhat intelligent response and not just respond to the first matching word typed on the list?

lusty dew
#

@paper saddle No advertising

#

@fiery birch we have an inv here

#

๐Ÿ‘€

fiery birch
#

got it ty

lusty dew
#

Np

lusty dew
#
const mReason = args[1] || 'N/A';
                if(!mReason){
                    message.reply('Please supply a reason: -mute @user reason time')
                }
#

For some reason the if statement isn't working

#

Wait

amber fractal
#

uh

#

you set it to something if it isnt there

#

so it will never run

lusty dew
#

I'm trying to check if they don't supply a reason

amber fractal
#

yeah

#

const mReason = args[1] || 'N/A';

#

|| 'N/A' will make it so there is always something

lusty dew
#

Ah true

maiden mauve
#

real quick

#

can you pass client object ?

lusty dew
#
              const mutetime = args[2];
                if (!mutetime) {
                    const mutetime = 5;
                    return message.channel.send('โŒYou did not provide a time so as default they have been muted for 5min!');
                }
``` now this is firing if they don't provide a time
maiden mauve
#

is args[0] the command itself?

lusty dew
#

Hm?

maiden mauve
#

like

#

pMute [reason] [duration]

#

is the string your checking?

lusty dew
#

args[2] will get the second thing in the command

maiden mauve
#

oh is ee above

lusty dew
#

-mute @user args[1] (reason) args[2] (mutetime)

#

Or how they would use it -mute @user test 5m

maiden mauve
#

so args[1] is user tag?

lusty dew
#

No

#

Reason

maiden mauve
#

oh you just said that

#

lol

#

hm

#

so mReason is either the existence of a string, or 'N/A'

#

is 'N/A' some defaulted value? I've never seen that

amber fractal
#

it's his chosen default

#

he added the code to make it N/A if nothing was provided

earnest phoenix
#

can some one help me get started i have visual studios?

maiden mauve
#

ah

lusty dew
#

I removed it though

maiden mauve
#

well for sure i would log exactly what the variables are

#

anytime your dealing with strings and conditionals

#

js works

#

your structure doesn't

#

๐Ÿ˜‰

earnest phoenix
#

plz

#

anyone?

#

plz help

lusty dew
#

Watch yt vids

#

Learn the lang you chosen

earnest phoenix
#

i have they nevver work for some reason tho

maiden mauve
#

they always work, you just haven't learned yet

lusty dew
#

Read the docs?

#

MDN is a good place to start

maiden mauve
#

@earnest phoenix maybe we can help you with a few things to get started

earnest phoenix
#

Learn a language before coding a discord bot

#

That always helps

#

@maiden mauve thnx

maiden mauve
#

You have visual studios, but that doesn't mean you have a starting point

earnest phoenix
#

ik js

#

oh

maiden mauve
#

You need to decide what language you want to code in

earnest phoenix
#

ok

#

js

maiden mauve
#

alright for javascript you don't need an IDE like visual studios

lusty dew
maiden mauve
#

you can use any text editor

amber fractal
#

It is recommended, however

earnest phoenix
#

ok

maiden mauve
#

try youtubing "create a discord bot in js tutorial"

lusty dew
#

Vsc is good

earnest phoenix
#

ok

#

i will try

maiden mauve
#

you will learn how to:
install npm
install nodejs

earnest phoenix
#

Yeah Vsc is pretty lit

maiden mauve
#

from there you can copy pasta some starter code

lusty dew
#

You'll learn a lot more then that

#

Lol

maiden mauve
#

and be on your way

lusty dew
#

Copy paste

#

No

earnest phoenix
#

ok thnx

lusty dew
#

Don't give them that ideality

#

Try to understand the code before anything

maiden mauve
#

bot.on('message', async message => { console.log("I'm a bot"); });

#

figure out whats happening after seeing that

#

async not required

#

๐Ÿ˜„

lusty dew
#

Ez you calling the message even though you don't need the msg event to console log that

#

Event*

#

Lol

maiden mauve
#

tbh I kinda learned backwards

#

I'm no pro just waaaay out of currency with hobby coding

#

I like to take simple copy pasta and break it down back to how i understand the syntax

#

looking at the ES6 shortcuts were super confusing at first

#

as was the concept of "promises"

#

it's almost like calculus definition of a derivative

#

you learn the long algebra

#

then you use the shortcuts

#

when the answer is the same, you figured it out

amber fractal
#

I like to think of promises like
This code might be done correctly, or it might fail, and we can wait for this to happen

maiden mauve
#

I like of promises as "hey, we're about to do this. Hold on"

#

nodejs "cannot convert type promise to string"

#

await

opaque eagle
#

When using the default http module for Node.js, how can I get bar in a route such as /foo/:bar

wheat jolt
#

any idea why?

#

nevermind

#

my bot is so slow

#

idk why

opaque eagle
#

Could be internet, discord, or if ur bot is large then just the fact that ur using discord.js

wheat jolt
#

it has many commands

#

and I am using discord.js

#

:))

onyx summit
#

5018_thinkies d.js isn't really slow
(At least for me)

#

Just eats a lot of ram

opaque eagle
#

^

#

For Discord bots I normally use Eris or non-JS libs

amber fractal
#

d.js master works like a charm for me

opaque eagle
#

Yeah I kinda like d.js master cuz of partials

#

Partials are neat af

#

It makes d.js a tad bit better to use

wheat jolt
#

i think it's because uws?

opaque eagle
#

k

amber fractal
#

uws just makes the websocket connection better I thought

#

but idk I dont use it

wheat jolt
#

it's an issue with it

#

it makes the latency very very high

amber fractal
#

Well yeah

#

did you just npm i uws?

wheat jolt
#

no

#

i did npm u uws

#

i uninstalled it lol

opaque eagle
#

npm i discordjs/uws

amber fractal
#

uws is deprecated anyways

wheat jolt
#

yup

amber fractal
#

has many problems

#

I guess

wheat jolt
#

npm uninstall @discord/uws

#

oops

amber fractal
#

idk why it's still listed as a peer dependency then lol

wheat jolt
#

like how I said, it's an issue with it

opaque eagle
#

cuz d.js devs r on crack

wheat jolt
#

by uninstalling it, you fix the high latency

amber fractal
#

@opaque eagle isnt a peer dependency on master

opaque eagle
#

yeah

#

but why not get rid of it with 11.5

amber fractal
#

idk

opaque eagle
#

exactly

amber fractal
#

idek if they update that version

#

I'd just update to master

#

much better

#

but it will refactor a lot of code, especially if you use embeds and moderation

opaque eagle
#

Plus Eris gets updated according to changes in the Discord API far more frequently

amber fractal
#

Also on the master branch tho

opaque eagle
#

All eris users use the master branch, there's no stable

amber fractal
#

Well that's probably why they get updates more frequently

opaque eagle
#

Exactly, the eris community is actually smart about things

amber fractal
#

Last commit to eris was 23 days ago.

#

Last commit to d.js master was 5 days ago

#

however it was most likely a pull request

#

if you use d.js stable, it's just asking for problems when you update and master becomes stable

#

And having a stable branch and a master branch is a good idea because master might contain bugs

#

Like an alpha version of an app

#

or discord canary for example

#

Anyways, Imma head to bed, it's 3:14 AM LOL

opaque eagle
#

Lol go to sleep

steady geode
lament meteor
#

Text only works in embeds

steady geode
#

@lament meteor thank you

winged thorn
#

Language/lib?

steady geode
#

wat

winged thorn
#

What language did you make your bot in

#

What discord API wrapper lib are you using

steady geode
#

discord.js ?

steady geode
#

anyone can help :-; ?

winged thorn
#

Read the docs

steady geode
#

ai ai captain

upper ember
#

I have this problem on my website, and it only happens when I try to enter from chrome, it works on opera, firefox, chrome incognito and chrome on other computers

lusty dew
#

Maybe chrome on the PC you are using needs to be updated

upper ember
#

but it works on incognito mode

lusty dew
#

Huh hm

#

Odd

#

Well assuming that's the error

#

Your website is being blocked

#

Is it SSL certified?

#

If it's not then it won't be an https it'd be http

real cedar
#

Any good bot names Iโ€™m making a new one

quartz kindle
#

@upper ember tried clearing your cache?

lusty dew
upper ember
#

@quartz kindle yes I did

#

@lusty dew my website is ssl certified.....

quartz kindle
#

what does the headers tab say? in the dev tools network tab

fierce thorn
#

I'd say it's your ad blocker (don't ask me how i know) try disabling it

quartz kindle
#

^ also possible yes

onyx summit
#

@lusty dew regular error you get while doing anything with the dbl api, you have to catch em

lusty dew
#

Okay thanks @onyx summit

#

How long is the time limit for hasVoted like so you don't get rate limited

#

dblapi btw

limpid raptor
#

Hey, I want to use Discord.ReactionCollector() but it doesn't work ! I think i miss the filter but I don't know what to put because the filter that I saw on Google is already used in the collector.on("collect"). Here is my code : ```js
let pollCollector = new Discord.ReactionCollector(message, {
time: 15000
}) // 604800

        let emojiUP = 0
        let emojiDOWN = 0

        pollCollector.on("collect", function (reaction) {
            if(reaction.emoji.name === "โœ…") {
                emojiUP = emojiUP + 1
            }

            if(reaction.emoji.name === "โŒ") {
                emojiDOWN = emojiDOWN + 1
            }
        })```and here is my error : ```TypeError: Function.prototype.apply was called on #<Object>, which is a object and not a function
at ReactionCollector._handle (c:\Users\Megaport\Desktop\TimeBot\node_modules\discord.js\src\structures\interfaces\Collector.js:82:48)
at emitTwo (events.js:126:13)
at Client.emit (events.js:214:7)
at MessageReactionAdd.handle (c:\Users\Megaport\Desktop\TimeBot\node_modules\discord.js\src\client\actions\MessageReactionAdd.js:24:31)
at MessageReactionAddHandler.handle (c:\Users\Megaport\Desktop\TimeBot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageReactionAdd.js:7:39)
at WebSocketPacketManager.handle (c:\Users\Megaport\Desktop\TimeBot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (c:\Users\Megaport\Desktop\TimeBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (c:\Users\Megaport\Desktop\TimeBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (c:\Users\Megaport\Desktop\TimeBot\node_modules\ws\lib\event-target.js:120:16)
at emitOne (events.js:116:13)```
#

It works now ! For people like me, I used new Discord.ReactionCollector(message, () => true, {}). Thank you @oak ore ๐Ÿ˜‚

oak ore
#

Np x)

hidden heron
#

how to let my bot send a custom server emoji in a message?

#

:emoji_name: does not work

earnest phoenix
#

the custom emoji format is actually <:emojiname:emoji_id>

#

your client does the magic of making it look like it's just :emoji:

#

e.g pepowot under the hood is actually !pepowot

#

you can get the emoji in that format by putting a backslash before sending :emoji:

hidden heron
#

yea, i get that format

#

but when i add that to my embed, it'll work?

earnest phoenix
#

depends where in the embed

hidden heron
#

in a field

earnest phoenix
#

field name or value

hidden heron
#

value

earnest phoenix
#

it should work yeah

hidden heron
#

alright, thx

earnest phoenix
#

psa your bot needs to be in the guild where the emoji's in to use it

hidden heron
#

aha got it

deep inlet
#

Anybody here have experience with writing JSDoc templates?

opaque eagle
#

Just ask the question and someone will help

deep inlet
#

Ok

#

How do I get the actual JSDoc data of all the classes and stuff in my publish?

#

Nevermind I got it

lusty dew
#

Is there a way to allow the user to vote from your bot directly or do you have to go to the DBL website

slender thistle
#

The latter

lusty dew
#

Dang

#

Okay next question

#

What is dblapi has voted time limit before it becomes a rate limit problem

#

Like .hasVoted() method

slender thistle
#

Check DBL docs

lusty dew
#

It says it?

#

I didn't see it say it

slender thistle
#

CLOSE ATTENTION COMRADE mmulu

lusty dew
#

Lol

west spoke
#

has hasvoted is a http GET so there may be a ratelimit

slender thistle
lusty dew
#

I know there is

#

Oh that's why

#

On mobile that whole section is just gone

slender thistle
#

Not for me

lusty dew
#

Won't let you navigate to it

slender thistle
#

Desktop mode wins

lusty dew
#

For me it is

#

Whaaa

west spoke
#

So 1/s

slender thistle
#

No

#

60/60s

west spoke
#

that's 1/s

slender thistle
#

They're not the same

west spoke
#

exPLAIn

lusty dew
#

Any way I can prevent rate limit exceeding

slender thistle
#

You could spam 60 requests in under a minute

#

with 60/60s

west spoke
#

ok fine

lusty dew
#

60 requests per minute that's 1 request every 60 seconds right?

slender thistle
#

But you wouldn't be able to not get ratelimited if you sent 2 requests per second with 1/1s

lusty dew
#

My math is horrible so don't mind me lol

slender thistle
#

60 requests per minute

#

Minute is 60 seconds

lusty dew
#

Wait you can send 60 requests per minute?

slender thistle
#

Yes but I don't see a reason why you would want that

lusty dew
#

Oh I thought it was 1 request every minute lol

slender thistle
sudden geyser
#

For the api, will it be checking for 60 requests every minute then clear it all when the minute passes, or hold a collection of your requests and clear it for the minute of each request.

For example: I send 30 requests every 2 seconds so it's been a minute. WIll my requests limit go back to 60 immediately, or would it slowly increase when the minute passes for each request. Confusing question I'm asking

lusty dew
#

That makes things a lot easier

#

I thought I'd run into rate limiting problems

#

Actually I still could

slender thistle
#

Most likely you would get the ratelimit reset immediately but then again, it's just my guess

lusty dew
#

I'm adding vote check to commands that get used all the time

#

And 2500 people have access to those vote locked commands wouldn't that cause problems if a bunch of people use it at once?

#

Unless I add a cooldown of 1m

#

Or 30s

#

Cause then it'd have time to reset before it's get rate limited

slender thistle
#

You're better off using s webhook

lusty dew
#

Idk how to use webhooks lol

slender thistle
#

What's your library

lusty dew
#

D.js

#

D.js master*

slender thistle
#

dblapi.js has built-in webhook feature

lusty dew
#

Oh?

slender thistle
lusty dew
#

Just saw it

#

What's webhook auth

#

And port?

#

I know nothing about webhooks oof

winged thorn
#

webhook auth is the auth phrase you put in in the website

#

port is the port to listen on for posts

lusty dew
#

Website?

#

What website

#

Confused

winged thorn
lusty dew
#

Oh

#

How do I get this auth

winged thorn
#

you defined it

#

or didn't

lusty dew
#

Uhm okay

#

I'll worry about this later

#

Thanks guys!

winged thorn
#

go to your bot's edit page

lusty dew
#

Oh

winged thorn
#

and scroll to the bottom

lusty dew
#

Okay

#

K

#

@winged thorn What do i put for the URL?

winged thorn
#

have you opened a port and forwarded it

#

and do you know your public ip

#

actually first where are you hosting your bot

trail dagger
winged thorn
#

that colour scheme should be illegal

lusty dew
#

@winged thorn on a friend's hosting service

winged thorn
#

They need to open and forward a port

#

Any port above 1024 will do

#

and the url takes the form
http://ip-address:port/optional-path

lusty dew
#

The bots ip address or the service?

onyx summit
#

Are you trying to have a vote webhook?

lusty dew
#

Yes lol

onyx summit
#

Okay, I won't open a port for you, but I will forward it

#

Gimme like 5mins

lusty dew
#

Okay

#

Thanks

winged thorn
#

the host's public ip

lusty dew
#

And whats optional path?

#

Like vote or smth?

winged thorn
#

its optional

lusty dew
#

Ah okay

onyx summit
#

What port

lusty dew
#

Doesn't matter tbh

winged thorn
#

any port above 1024

#

I use 3000

onyx summit
#

Dude I'm asking him

winged thorn
#

but it doesn't really matter

lusty dew
#

Mk port 1025

onyx summit
#

Nah

lusty dew
#

Then what port should I say

onyx summit
#

Gonna give you 30001

lusty dew
#

3001? Or 30001

onyx summit
#

30,001

lusty dew
#

Okay

#

Is the public IP address the one I use to login?

winged thorn
#

its the public ip of the host

#

I don't know what else to tell you

lusty dew
#

Not asking you

#

Asking Me CHY4E

winged thorn
#

what os is the machine running

lusty dew
#

Mr*

onyx summit
#

ubuntu

#

webhooks.chilo.space/clap/
last slash is important afaik

#

paste that into the dbl thing

lusty dew
#

Okay

onyx summit
#

And in your application you listen on port 30 001

lusty dew
#

Okayy

winged thorn
#

don't you need an http:// at the start

onyx summit
#

yeah

#

https://

lusty dew
#

Kk thanks CHY4E

#

:3

onyx summit
#

https://webhooks.chilo.space/clap/

#

Exactly that

lusty dew
#

Thank youuu

#

Is it supposed to give me an authorization thing or so I put one?

#

Do*

#

I'm assuming I have to put one so I did

onyx summit
#

yeah you have to define that

lusty dew
#

Okay

onyx summit
#

It's to compare if the votes are really coming from dbl or not just some random trying to trick you

lusty dew
#

Lol oof

#

Okay thanks!

#

โค

onyx summit
#

gay

lusty dew
#

Everyone is a little gay

#

๐Ÿ‘€

broken shale
#

yes everyone has a little happiness within us......somewhere

topaz fjord
#

look at the second example

#

it wants you to do that

#

Instead of passing 'name'

onyx summit
#
  1. It's a deprecation warning, nothing that serious
  2. See Turtles link
broken shale
#
  1. Nothing that serious until v12 comes around
onyx summit
#

Pretty sure you have to change a bit more when switching to v12

opaque eagle
#

Collection.find() is really similar to Array.prototype.find()

jolly nova
#

a little help please

sage bobcat
#

One message removed from a suspended account.

jolly nova
#
@has_permissions(manage_roles=True, ban_members=True)
async def _kick(ctx, member: Member):
await client.kick(member)```
#

this is not working for some reason

stray garnet
#

how to do prefixes like that? exapmle ki help

jolly nova
winged thorn
#

connor that isn't how has_permissions works

jolly nova
#

then?

winged thorn
#

also are you using async instead of rewrite

jolly nova
#

i know

winged thorn
#

you should upgrade

#

or migrate

jolly nova
#

async doesn't works anymore?

winged thorn
#

can you open up the python shell for me

jolly nova
#

yes?

winged thorn
#

and type these lines

import discord
print(discord.__version__)
sage bobcat
#

One message removed from a suspended account.

jolly nova
#

version 1.2.3

winged thorn
#

ok so your syntax is just incorrect then

jolly nova
#

ya

#

thatz why i need help

earnest phoenix
#

I get deprecation warnings all the time, they're a big deal believe me

winged thorn
#

has permissions is like this:

@commands.has_permissions()
not
@has_permissions()```
earnest phoenix
#

Discord.js v12 is not a joke

jolly nova
#

i know

#

i import commands

winged thorn
#

also that isn't how you kick someone

#

it's member.kick() not client.kick(member)

jolly nova
#

my kick used to work before i added has_permissions

winged thorn
#

because your has_permissions is wrong

#

use @commands.has_permissions()

jolly nova
#

whats the correct syntax

winged thorn
#

not @has_permissions

jolly nova
#
@commands.has_permissions(manage_roles=True, ban_members=True)
async def kick(ctx, member: Member, reason=None):
 await member.kick(reason=reason)```
winged thorn
#

yes

#

like that

jolly nova
#

this doesnt works aswell

winged thorn
#

Is there an error

jolly nova
#

and error handler is returning nothing

#

no error

winged thorn
#

what did you import at the top of the file

#

show me your imports

jolly nova
#
from discord import Member
from discord.ext import commands
from discord.ext.commands import has_permissions, MissingPermissions
import random```
winged thorn
#

remove these lines:

from discord.ext.commands import has_permissions, MissingPermissions
from discord import Member```
#

they are unnecesary

jolly nova
#

ok

#

they are just in case

winged thorn
#

and change the

member: Member
to
member: discord.Member```
jolly nova
#

testing now

#

and Boom

#

it works

winged thorn
#

good ๐Ÿ‘

jolly nova
#

Thnx man

winged thorn
#

nws

lusty dew
#

Hm dbl.webhook.on('vote', vote => {...})

#

Doesn't log anything is there a reason?

onyx summit
#

How did you initialize it (without token and secret kthx)

lusty dew
#
const DBL = require('dblapi.js')
const dbl = new DBL('Nahhhboi', { webhookPort: 30001, webhookAuth: 'ye no'})
#

Then I did

#
          dbl.webhook.on('ready', hook => {
                console.log(`Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`)
              })
             dbl.webhook.on('vote', vote => {
                console.log(vote)
             })
#

This stuff

#

Inside the command file as well

onyx summit
#

What does it log in the ready event?

lusty dew
#

Nothing

#

Doesn't lot a single thing

onyx summit
#

Oh so it's never ready?

#

lul

lusty dew
#

No

#

Forgot to mention that sorry

onyx summit
#

Hm, dunno

lusty dew
#

Nor do I

onyx summit
#

But you will need to edit the URL where you did earlier

#

to https://webhooks.chilo.space/clap/dblwebhook
(Not my fault, it's because the dbl package handles it like this)

lusty dew
#

Okay

#

It's fine I understand

#

I saw that in the docs just now lol

quartz kindle
#

do webhooks support passwords with spaces?

#

a lot of internet things dont like spaces in names/urls/fields/etc

winged thorn
#

But its in the auth header so i'd expect it to be ok

split hazel
#

why would one of my shards shut down and make pm2 restart it?

#

I also noticed my shards become unpredictable after being online around a day

quartz kindle
#

have you checked for errors/memory leaks?

split hazel
#

which means completely random and weird issues sometimes occur

#

my memory rises to around 1.1gb for each shard after being online for around a day, its usually at around 600mb

quartz kindle
#

how many guilds?

split hazel
#

3.2k, we also have quite alot of loops

#

and intervals

quartz kindle
#

so you're running 2 shards of 1.6k? or more?

split hazel
#

4

quartz kindle
#

4 shards? at 1gb each?

#

are you using d.js?

split hazel
#

sometimes changing the shard count causes different behaviours

#

and yes, all shards are around the same usage

onyx summit
#

limit the cache of messages or your ram goes rip after a few days

lusty dew
#

Hmph webhook still not working tf

quartz kindle
#

do you have zucc installed?

split hazel
#

me?

quartz kindle
#

yes

split hazel
#

nope

#

no clue what that is either

quartz kindle
#

then you should limit/clear caches, your ram usage is way too high

onyx summit
#

a peer dependencie of d.js

leaden crag
#

I need help

quartz kindle
#

my bot is using ~300mb at 1.5k guilds

split hazel
#

ah, that sounds pretty helpful

#

anyways, thanks for the help guys

quartz kindle
#

also, are you on stable or master?

lusty dew
#

Me?

onyx summit
lusty dew
#

Master of you're talking to me

quartz kindle
#

talking to speedy lul

lusty dew
#

If*

#

Okay

#

I'll wait for my turn :3

onyx summit
#

But the ready event never fires? dafuq

#

I dunno because I have my own server receiving votes

lusty dew
#

Hmph

quartz kindle
#

is port 30001 available?

lusty dew
#

Everything seems to hate me ๐Ÿ˜‚

onyx summit
#

Yes, I'm pretty sure it is

split hazel
#

@quartz kindle stable, will switch to master soon because it allows objects being returned through broadcast eval

lusty dew
#

Should be is it CHY4E

#

Lol

#

Shard count has an auto thing?

#

Someone told me it didn't dafuq

quartz kindle
#

@split hazel when you switch to master, be sure to install zlib-sync, and optionally also erlpack and bufferutil

#

but zlib-sync alone cuts your cpu usage by more than half

onyx summit
#

The only process listening to port 30 001 is your bot xD

lusty dew
#

I switched from stable to master and didn't install those packages

onyx summit
#

Yo yeah, it's free

quartz kindle
#

@lusty dew can you show your full code?

lusty dew
#

It's nsfw does that matter?

#

I think it would

split hazel
#

May I ask what those packages do?

onyx summit
#

He didn't mean everything

lusty dew
#

Okay

#

I'll delete the stuff not related to the topic

onyx summit
#

@split hazel some people are talking of 10x less CPU usage with zlib

#

But it's probably not that much

#

@lusty dew only show the part where you are starting the dbl server

#

everything that has to do with dbl

#

Gonna just look at the files myself hahaha

quartz kindle
#

@split hazel zlib-sync is a compression package to uncompress the packets discord sends. d.js master has pako built in, which is a pure javascript uncompressor, which works everywhere but uses a lot of cpu because of it. zlib-sync is a native C package which must be compiled, but since its native low-level, its dozens of times more efficient than pako

#

and yeah, the cpu reduction is not 10x, but realistically 2-3x

split hazel
#

alright, thanks alot for the help

onyx summit
#

I'm just repeating other people, I don't have it in prod yet

lusty dew
#
const Discord = require('discord.js');
const DBL = require('dblapi.js')
const dbl = new DBL('ha nope', { webhookPort: 30001, webhookAuth: 'ye no'})
module.exports.load = (client) => {
    client.commands['ncos'] = {
        async run(message) {
             dbl.webhook.on('ready', hook => {
                console.log(`Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`)
              })
             dbl.webhook.on('vote', vote => {
                console.log(vote)
             })
        },
    };
};
quartz kindle
#

wait what

#

why are you exporting it as a run function?

onyx summit
#

Okay you attach those listeners too late

quartz kindle
#

webhook are supposed to be silently listening at all times, and updating your database. they are not supposed to be run with a command

onyx summit
#

you have to do it in the main file, it's not supposed to be in a command

blissful wind
#

it's not different from a welcome message, it's active and listening at all times, has to be in your index.js or it won't work