#development

1 messages · Page 1530 of 1

drifting wedge
#

if i have a div with an id, how can i like put another div in it with html without chanfing the other divs in it, idk how to explain it well, but like, not replace, just add

sudden geyser
#

No, you'd just check guild.available

earnest phoenix
#

Oh right

rose warren
#

How exactly would I do that within the reduce function?

sudden geyser
#

Actually I was probably wrong since a number + null returns zero implicitly

rose warren
#

Hm

earnest phoenix
#

Why is it doing that :/

rose warren
#

It only seems to return null for memberCount though

earnest phoenix
#

Wdym?, it’s not that it’s just not giving him anything

rose warren
#

I wasn't talking to you

late maple
#

1

earnest phoenix
#

Oh uh, ok..

#

What about me?

lament rock
#

@earnest phoenix You should convert the argument to a number before sending it off to the database. It might not do conversions for you

#

Also check if the number is NaN and if the user actually has that amount of money

#

and make sure it's not negative

distant cobalt
#

So i used js {name:"Users Handling 👤", value: '\`\`\`' + message. client.guilds.cache.reduce((total, guild) => total + guild.memberCount, 0) + '', inline:true}, but it says NaN (not a number)

#

How do i fix this?

#

wait

#

lemme just take a screenshot

lament rock
#

filter over the Collection to see if one of the guilds has a memberCount which is NaN

#

if there is at least 1, that's the issue

distant cobalt
earnest phoenix
#

Either you're concatenating at the wrong spot, or one of the guilds is unavailable

distant cobalt
#

hm

lament rock
#

The concatenation looks correct

rose warren
#

I'm getting the same problem

distant cobalt
#

hm

rose warren
#

Scroll up a bit and see

earnest phoenix
#

Filter by available guilds

rose warren
#

returning null for one of the shards

#

for memberCount

slender wagon
#
const fetchedMessages = await starChannel.messages.fetch({ limit: 100 });
  const stars = fetchedMessages.find(m => m.embeds[0].footer.text.startsWith(settings.emoji) && m.embeds[0].footer.text.endsWith(message.id));

i have been trying to fix this but without success m.embeds[0] comes out as undefined
Cannot read property 'footer' of undefined

distant cobalt
earnest phoenix
#

Not all messages has an embed

lament rock
#

doesn't matter if you're sharded or not. Guilds can be unavailable

distant cobalt
slender wagon
lament rock
#

guilds.cache.filter(g => g.available).reduce

distant cobalt
#

k

earnest phoenix
#

Check if <Message>.embeds[0] isn't undefined then proceeded through to check for whatever you're going for

slender wagon
#

oh okay

#

thanks

earnest phoenix
#

You can use ?. or in other words optional chaining if you're using Node.js v14 or higher

distant cobalt
slender wagon
#

i am using v14 yes

lament rock
#

where you have the reduce, put a filter before the .reduce

distant cobalt
#

k

#
message.client.guilds.cache.filter.reduce((total, guild) =>  total + guild.memberCount, 0)
#

There, what do i put in the paratheeses

lament rock
#

filter is a function. Do it similarly to how I showed you

distant cobalt
#
message.client.guilds.cache.filter(g => g.available).reduce((total, guild) =>  total + guild.memberCount, 0)
``` like this?
earnest phoenix
#

Yes

distant cobalt
#

k

lament rock
distant cobalt
#

uhh

#

thanks it worked

#

but then i have less users now 🤔

lament rock
#

Since that guild is unavailable, those members would not be considered in the count

distant cobalt
#

oh

earnest phoenix
#

Nothing you can do about it unless the guild becomes available again, but user count is not something users care about

distant cobalt
#

k

lament rock
#

user cache count isn't representative of actual user count depending on the intents you have enabled

outer perch
#

uhm, bot's up, but still offline

#

it's not even doing the bot.once('ready' part

earnest phoenix
#

Meaning it can't login

lament rock
#

Then it's not online

earnest phoenix
#

Use the debug and warn events to see what's going on in the background

tardy hornet
#
 case 'active-20k':
                    var timeout = 10000//3600000
                  let active20 = await db.fetch(`active20_${message.author.id}`)
                  if(active20 !== null && timeout - (Date.now() - active20) > 0){
                    let time_to_active20 = ms(timeout - (Date.now() - active20));
                    const active20Time = new Discord.MessageEmbed()
                    .setDescription(`You get 20$ every hour, it will auto give it to you in: ${time_to_active20.minutes}m ${time_to_active20.seconds}s`)
                    .setColor("RED")
                    message.channel.send(active20Time)
                  }
                  else{
 db.add(`money_${message.member.id}`,random_money)
setTimeout(function() {
setInterval(() => {
  var random_money = 20
 db.add(`money_${message.member.id}`,random_money)
                    }, time_to_active20);
  }, time_to_active20);
 
                    
            }
            db.set(`active20_${message.author.id}`, Date.now())
                  break;   

i have this command, i want it to give the user the money even after i restarted the bot, and that he wont need to type the command again

outer perch
lament rock
#

store the expected dates something should occur in a database and on bot restart, reinitiate the timeouts

earnest phoenix
#

"and that he won't need to type the command again" giving coins on interval?

#

Yea you could save the dates or timeouts in a database and set the intervals again on restart, if the timeouts are not infinite, you gotta both set the date and timeout to get the left time from the last restart, but to do that you gotta listen to some events on process, to set the left time to the database

#

Such as uncaughtException, exit, SIGINT and SIGTERM

lament rock
#

Or just immediately set them in the database

#

Then just on load, DateToFire - Date.now()

#

storing the date as a number is easiest

#

On timer completion, remove the date

outer perch
#

@earnest phoenix breaks here const Discord = require('discord.js');

#

this happened to me after not touching the code for a long time

#

it was working until I restarted the bot

earnest phoenix
#

So, the code doesn't run at all? LULW

lament rock
#

You should probably install discord.js

outer perch
#

bro

#

are you kidding?

#

the bot is in 90+ servers

#

was running with no problems

#

until i restarted the bot casually

outer perch
lament rock
#

stuff happens :)

earnest phoenix
#

Imagine if the bot uninstalled itself, hilarious KEKW

lament rock
#

rm -rf /

boreal iron
#

Somebody here being familiar with C#? Need a conversation of a few lines of code to JS, PHP or whatever...

earnest phoenix
#

rm -rf / --no-preserve-root

outer perch
#

anyways, it's running on heroku

earnest phoenix
#

Or whatever that flag was

outer perch
#

I didn't need to install it

#

cuz heroku has those modules 100%

earnest phoenix
#

Your heroku dyno hours must have ended

#

Because free dyno hours gives you only around 559 hours or something

#

Around 23-27 days

lament rock
#

Technically you can last all month if you provide card details since it's still "free" so long as you only have 1 dyno running

earnest phoenix
#

Are you sure?

outer perch
#

yes,

earnest phoenix
#

Because if it didn't, the program should run and not die at that line

outer perch
#

heroku says "quota exceeded" or something

#

when it happens

earnest phoenix
#

That's what it means

outer perch
#

which is not the case

bright crag
#

that means u ran out of dyno hours

earnest phoenix
#

Quota exceeded means your free dyno hours ended

outer perch
#

I know

#

and Heroku didn't tell me that yet

bright crag
#

you should invest in a vps

outer perch
#

that's what I meant

#

anyways, I'm restarting the dynos

#

now it's working

#

wtf

#

maybe a server-side bug

earnest phoenix
#

Heroku™️

lament rock
#

gtav money glitch

earnest phoenix
#

Reasons why you shouldn't use Heroku for your bot:

  • Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.
  • Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.
  • Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.
  • And due to a lot of other issues....
distant cobalt
#

how do you check if the bot is in a certain guild using guild ids?

earnest phoenix
#

Use <Collection>.has() on <Client>.guilds.cache

distant cobalt
#

................

#

wut

#

I don't understand

earnest phoenix
#

.cache property returns a Collection object

#

a Collection object has a has() method

#

Bruh, I’ve asked this fifty times no ones helping me godamit

#

It’s not giving The user its money

#

Now I have to wait really long again

quartz kindle
#

you're adding coins to user_id_coins

#

and you're fetching coins from user_coins_id

earnest phoenix
#

@quartz kindle bal or give?

#

Bal

#

@quartz kindle can’t I do eco.fecth.add

#

?

fierce ether
#

how can i show only the error line in the error stack?

sudden geyser
fierce ether
#

ik but i have a code for that, i just want the error line

zenith terrace
#

@earnest phoenix for the give command, change user_${people.user.id}_coins to user.coins_${people.user.id}

earnest phoenix
#

Alr

#

@zenith terrace and in bal should I change everything to add?

zenith terrace
#

because in the bal command you are fetching user.coins_${people.user.id} and in the give command you are fetching user_${people.user.id}_coins

earnest phoenix
#

Alrighty

zenith terrace
#

why would you change them to add?

earnest phoenix
#

Hm,

#

No idea LOL

#

@zenith terrace it’s not working

zenith terrace
#

whats it showing

earnest phoenix
#

Actually my bad lemme check

#

@zenith terrace

zenith terrace
#

show your give command there

#

(newly updated)

earnest phoenix
#

Wdym?

zenith terrace
#

show what your code looks like now

boreal iron
#

@quartz kindle hey yo, you're there?

earnest phoenix
zenith terrace
#

why did you remove the , coins at the end

earnest phoenix
#

Oh yea my bad LOL

zenith terrace
#

eco.add(`user.coins_${people.user.id}`, coins)

earnest phoenix
#

Let’s see

#

Did the same :/

#

@zenith terrace

quartz kindle
boreal iron
zenith terrace
#

delete your json.sqilte file and try it again, maybe something is wrong with it @earnest phoenix ?

boreal iron
#

@quartz kindle You're familiar with C# or know somebody who is?

#

Just need a few lines of code as conversation

quartz kindle
#

i think cry uses it

earnest phoenix
#

It added nothing to bal

boreal iron
#

to JS or whatever

#

@earnest phoenix

earnest phoenix
#

@zenith terrace wtf

#

Wtf is that

zenith terrace
#

delete the actual file

#

not whats inside it

earnest phoenix
#

Alr

sudden geyser
#

pink invaded your file

zenith terrace
#

also thats quick.db for you

quartz kindle
#

also

#

change message.author to message.member

#

which is invalid

earnest phoenix
#

Um @zenith terrace where do I put the stuff inside it?

zenith terrace
#

what?

earnest phoenix
quartz kindle
#

wat

earnest phoenix
#

Like you’re saying to me to delete the file but won’t it effect the commands since it’s the storage for them?

#

Like the economy commands

quartz kindle
#

quick.db creates a new file

earnest phoenix
#

Ohhh Alr

quartz kindle
#

you lose the data thats in it

zenith terrace
#

or show

quartz kindle
#

ye

zenith terrace
#

yeye

earnest phoenix
#

Bal or give?

quartz kindle
#

yeyeye

earnest phoenix
#

Lol

zenith terrace
earnest phoenix
#

Alrighty

#

Ima change it real quick

zenith terrace
#

ok

zenith terrace
quartz kindle
#

eye

zenith terrace
#

and eye for an eye

earnest phoenix
#

Let’s try it bois

zenith terrace
#

what

earnest phoenix
#

Why tf is it saying null?

solemn elk
#
@client.command() # pages command
async def test(ctx):
    embed = discord.Embed(color=discord.Color.blue())
    embed.add_field(name='Page 1', value='this is page 1')
    mesg = await ctx.send(embed=embed)
    await mesg.add_reaction('◀')
    await mesg.add_reaction('▶')
    await mesg.add_reaction('🧺')

    def check(msg):
        return msg.author == ctx.author 

    react = client.wait_for('reaction_add', check=check)

So i want to do an if statement, do i do :

if react.emoji 
# OR
if react.reaction
earnest phoenix
zenith terrace
#

show your bal command again

#

code

earnest phoenix
zenith terrace
#

eeee, try doing the give command first maybe?

earnest phoenix
#

It says it has given me the coins but I can’t see the bal now LOL

zenith terrace
#

@earnest phoenix also its member, not members

earnest phoenix
#

Oh my bad

zenith terrace
#

it might have something to do with the reason why it shows null

earnest phoenix
#

Fixed let’s see niw

#

Now*

#

Still null...

zenith terrace
#

it should honestly work now unless i'm missing something, maybe try asking in the plexi dev server again

halcyon kite
#

Hi

halcyon kite
earnest phoenix
#

Uh no idea

halcyon kite
#

Uhhh try

#

if(bank === null) bank = 0

#

Instead of “”

#

@earnest phoenix

#

And see if it works

earnest phoenix
#

Which line?

halcyon kite
#

Ur bank === null

#

Line

zenith terrace
#

oh yea that might work but idk KEKW

halcyon kite
#

Lol

silver lintel
#

if (!bank) bank = 0;

halcyon kite
#

We can try both

silver lintel
#

or you could use a one line ternary statement

halcyon kite
#

Lol

#

This should work

#

The other one should have worked but that prob a weird issue

earnest phoenix
#

But uh what line LOL?

zenith terrace
#

where the bank line is

earnest phoenix
#

Ohh

halcyon kite
#

If(bank1 === null) bank1 = 0

#

This should be bank1 null is 0 line

solemn elk
#
    def check(reaction, msg):
        return msg.author == reaction.message.author 

    react = await client.wait_for('reaction_add', check=check)
    if react.emoji == '▶':
        await mesg.remove_reaction("▶")
        embed = discord.Embed(color=discord.Color.blue())
        embed.add_field(name='Page 2', value='this is page 2')
        await mesg.edit(embed=embed)

Error :

  File "c:\Users\K I N G\Desktop\Discord bots\a bot\bot.py", line 35, in check
    return msg.author == reaction.message.author
AttributeError: 'Member' object has no attribute 'author'
zenith terrace
#

I honestly havent used quick.db in a long time to remember that ur code could be helpful lol @halcyon kite

halcyon kite
#

Lol

earnest phoenix
#

Nope didn’t work

halcyon kite
#

Ooof

zenith terrace
#

@slender thistle ey, we got a py user here

halcyon kite
#

Hm

zenith terrace
#

oh wait

earnest phoenix
#

What could the problem be?

zenith terrace
#

message.member.author wouldnt work would it like in d.js

#

🤔

#

would it?

#

no wait

earnest phoenix
#

Huh um lol

halcyon kite
#

True

zenith terrace
#

thats reaction.message.author

#

I cant read

solemn elk
halcyon kite
#

Lol

zenith terrace
solemn elk
#

ok

#

wait no

#

it has to check the author of the command

earnest phoenix
#

Um so what should I do guys?

halcyon kite
#

Ur quick.Db think

#

replace user with people

zenith terrace
earnest phoenix
#

Alr

zenith terrace
#

that was my only suggestion

halcyon kite
#

And I guess member is author

earnest phoenix
#

@halcyon kite so umm people.coins_?

halcyon kite
#

If not then replace the message.members

#

Nono

#

Here

earnest phoenix
#

lol

halcyon kite
#

Let coins = eco.fetch( wait

#

I need the ‘

#

But the other way

zenith terrace
earnest phoenix
#

Wtf

halcyon kite
#

Normally the other part of the ~ key

#

I’m on mobile

#

This sucks

earnest phoenix
#

I’m confused what did you mean to say LOL?

halcyon kite
#

~ is the same key

#

But it is the other thing

#

On it

earnest phoenix
#

Let coins = eco.fetch(what?

#

Lol

halcyon kite
#

Nono

halcyon kite
dusky sundial
halcyon kite
#

I swear I forgot the name

earnest phoenix
#

`?

halcyon kite
#

Yes

earnest phoenix
#

So my

dusky sundial
#

ctx.guild.get_member(userId)
Why does this return None, even though the member is in the guild?

earnest phoenix
#

Let coins = eco.fetch(bruh)

#

?

#

?

halcyon kite
#

Let coins = eco.fetch(coins_${user.Id} )

#

Forgot to put backslash

#

But u know

#

That’s how Db should work

earnest phoenix
#

Hm, so uppercase L?

halcyon kite
#

No

#

Look

earnest phoenix
#

Alr Alr

halcyon kite
#

I’llretype

zenith terrace
#

lol

steel arch
uncut river
#

if there are no users, avatarlist will be undefined

#

and you cant send undefined

halcyon kite
#

Let coins = eco.fetch(\ coins_{user.id} \)

#

There

#

That took so long on mobile

#

Bruh

#

Backslash

#

` this goes where backslash is @earnest phoenix

#

Replace ur coin fetch with This code

molten yarrow
halcyon kite
#

Yes

#

Thx

#

I’m on mobile so this mess up

molten yarrow
#

np :3

halcyon kite
#

@earnest phoenix use what Alina put

#

For coins

#

Bc this is will work

#

Ur Db prob works but it will only display null

#

Uhhh

#

message.guild.memberCount

#

I think

drowsy grail
#

yes for djs

zenith terrace
#

@earnest phoenix what language do you use

#

that does not answer my question

quartz kindle
#

the status is for all servers, not just one

#

you cant have different status for each server

zenith terrace
#

or can you mmLol

buoyant aspen
#

How can I check if a user is in a guild in discord.js?

quartz kindle
zenith terrace
pure lion
#

tim thank god you're here

quartz kindle
#

if it errors, the user is not in the guild

pure lion
#

wait let me try and word my question

buoyant aspen
quartz kindle
#

await guild.members.fetch(id)

#

guild.memberCount has the number of members of each server. you need to add them together to get the total

pure lion
#

I'm making a website
the main feature of the website is uploading files, having them read and "validated", and then store the files

I'm using express
what i need to know is:

  1. Can i read files as they're sent to me through express without having to physically write the file to the disk (to then write them to disk after being validated)
  2. Can i then write a file somewhere then store an ID and get it from a directory to be sent as a download
    the file format is .cgp which holds text
#

also my vps is down so i cant run any tests

quartz kindle
#

yes and yes

pure lion
#

sounds like pog

zenith terrace
#

client.user.cache.size

quartz kindle
#

users not user

zenith terrace
#

shut it Tim

quartz kindle
#

and thats only the cache, not the total

#

no woman no cry

pure lion
#

the only thing that i dont have a grasp on is how to read the file as it comes in

#

what does a backend receive a file as over http

zenith terrace
#

@quartz kindle oi help my cutie dice here

#

dont hide

quartz kindle
pure lion
#

how can i read it without external stuff

dusky sundial
misty sigil
timid cobalt
#

Can someone help me with setting up the carlbot moderation and automod?

misty sigil
#

no

timid cobalt
#

wow

#

rude 😦

misty sigil
#

no we're not

sudden geyser
#

You may want to ask in the bot's support server.

misty sigil
quartz kindle
#

but it does have its one middleware

pure lion
#

Ah multer

#

Docs tomorrow

#

Bed now

misty sigil
#

night

zenith terrace
#

@pure lion gnight cutie

opal plank
misty sigil
#

thats a terrible way to do things

opal plank
#

im well aware, but its doable, no?

misty sigil
#

yes it is

opal plank
#

might try that

#

just for the fucks of it

misty sigil
#

no dont

opal plank
#

ill du it

zenith terrace
#

hi Erwin

opal plank
zenith terrace
#

hows it goin

misty sigil
#

nO

opal plank
zenith terrace
#

no invite?

opal plank
#

invite for what?

zenith terrace
#

drinking

crimson vapor
#

smh yall drunks

stark abyss
#

Okay so I have a bot in visual studio code and to have it online 24/7 I tried using heroku but I wasn't aware that localhost database wouldn't work with it so unsure what to do next thinkingLol

#

as of now it's online commands that don't require postgres works

opal plank
#

how come?

quartz kindle
#

with 100 guilds and 100 shards you will likely have a bunch of shard with 1-3 guilds and others with 0

misty sigil
#

nooooooooooo

opal plank
#

but thats only if you use d.js's sharder no?

quartz kindle
#

nope

#

thats discord

opal plank
#

oh, fuck

#

i was about to ask if i couldnt pull the same stunt i did with twitch

quartz kindle
#

well

#

you can always try 1000 shards for 100 guilds

opal plank
#

tru tru

#

cant see anything wrong with 1000 shards

quartz kindle
#

and try to weed out guilds

#

xD

opal plank
#

got nuff' ram

drowsy grail
#

why do you want 1 shard per guild?

misty sigil
#

for shits n giggles

opal plank
#

^^

drowsy grail
#

ah ok good reason

opal plank
#

aight, back to coding gainst my will

quartz kindle
#

the idea was a per-guild status

#

actually

#

let me try this real quick

drowsy grail
drowsy grail
opal plank
#

thats actually stupid

#

FUCK i keep coming back

drowsy grail
#

yea it's a terrible idea in practice

opal plank
#

cursed chat

#

keep pulling me out of my code

drowsy grail
#

good bye hf

earnest phoenix
stark abyss
earnest phoenix
#

shards can have their own independent presences

#

since presence is websocket onlx

#

only

#

and sharding allows you to establish multiple different websocket connections

#

fun concept in theory

#

pain in the ass in practice

quartz kindle
#

so i tried 45 shards on a bot with ~40 servers

#

not gonna wait for them all to connect, but up to shard 15 this was the guild distribution

drowsy grail
#

is that the chrome js console

grizzled raven
#

wait can you shard as a self bot

earnest phoenix
#

no

grizzled raven
#

if i'm allowed to ask

quartz kindle
drowsy grail
#

oh electron?

grizzled raven
#

oh okay

quartz kindle
#

nwjs

earnest phoenix
#

user tokens have an entirely different gateway flow than bot tokens

#

so

grizzled raven
#

ah

#

very cool

earnest phoenix
#

setInterval and periodically update it

quartz kindle
#

45 shards are fun

#

1 heartbeat every second

drowsy grail
#

lmao dblstats has a shard ranker and your bot would probably be top 100 lmao

quartz kindle
#

lmao

earnest phoenix
#

tbf you're never going to find the golden ratio, there's always going to be one shard with two or more guilds clumped together because of guild creation date

quartz kindle
#

ye

#

you might be able to do it if you increase shards to stupid numbers

#

1000 shards for 100 guilds has much lower chances of getting duplicates

crimson vapor
#

same with 10000

quartz kindle
#

is a bot with 10000 shards basically a DOS attempt?

earnest phoenix
#

discord just might refuse the connection

crimson vapor
#

or something

quartz kindle
#

would take 10 days to connect 10k shards

crimson vapor
#

LOL

quartz kindle
#

becuse of 1k per day limit

crimson vapor
#

there is 1k per day?

quartz kindle
#

ye

misty sigil
#

on identify ya

crimson vapor
#

makes sense

#

so you can only start a bot with 1000 shards once

#

lol

earnest phoenix
#

if you're a large bot your limit gets increased to 2k iirc

crimson vapor
#

probably more

#

since thats 1 boot per day max

quartz kindle
#

once per day yes

#

it still takes almost 2 hours to start it tho

misty sigil
#

people who test in prod are gonna be sad

crimson vapor
#

yea makes me sad

earnest phoenix
#

85% of this guild

crimson vapor
#

I would say more like 10% of this server but 90% of the devs

misty sigil
#

i don't test in prod often

crimson vapor
#

I do

#

its easier

misty sigil
#

but when i do everything is fucking broken

quartz kindle
#

because 90% of devs dont have a big enough user base to warrant undisturbed uptime

misty sigil
#

there is no userbase too small

earnest phoenix
#

it would be easier if there was something to mock the API (rest+gateway)

quartz kindle
#

isnt there something like that already?

earnest phoenix
#

i doubt

#

binzy was working on it in like 2018

#

got dropped though

crimson vapor
#

just selfhost discord api smh /s

drowsy grail
#

just make your own application called bisbord

quartz kindle
#

this one seems pretty recent

drowsy grail
#

i made an e2e testing thing but its quite different from mocking an API

#

i tried the whole creating mock guilds but that would just become difficult to maintain

#

this seems neat

crimson vapor
drowsy grail
#

so true

quartz kindle
#

xDDD

summer torrent
#

lmao

earnest phoenix
odd stratus
#

For shards do you recommend having the amount set to "auto" or is manually setting it better?

earnest phoenix
#

auto would be fine since it sets it to the recommended amount of shards determined by the client

quartz kindle
#

auto will be approximately 1000 guilds per shard

#

there are pros and cons for having more or less guilds per shard

odd stratus
#

I have like 7 shards right now in 7k servers
Some people said I should have more shards since music is sometimes laggy apparently but idk

quartz kindle
#

more guilds per shard:

  • faster startup times
  • less disconnections
  • less network overhead
  • less memory if using the sharding manager

less guilds per shard:

  • more redundancy
  • failures affect less guilds
  • less downtime except for full restarts
#

i have 4 shards for 7k servers rn

odd stratus
#

Is yours the AstroBot

quartz kindle
#

ye

odd stratus
#

Nice

#

And it runs pretty well with 4 shards?

quartz kindle
#

yup

odd stratus
#

Hmm I guess 7 should be fine for me then

opal plank
#

jesus christ

#

it only hits home how big bots are when you look at how many users are using it

#

thats a shit ton of people

odd stratus
#

Wow lol

boreal iron
#

@earnest phoenix u're still here?

earnest phoenix
#

yup

boreal iron
#

cool u're familiar with C#?

earnest phoenix
#

yeah

boreal iron
#

would need a conversation of some code to JS or PHP, whatever

#

just of a few lines

earnest phoenix
#

sure

boreal iron
#

CheckKey() is creating an UDP socket to the host

#

It transmitted a hash of a Steam ID, called BEGUID

#

just need the conversation of the socket connection to the host

#

I'm not sure if the hash is transmitted encoded, as bytes or whatever

#

byte[] receive_buffer = new byte[1024];

#

Just need the response string response = Encoding.ASCII.GetString(receive_buffer, 0, recv).Remove(0, 4);

earnest phoenix
#

not sure what you want

#

the response?

boreal iron
#

byte[] send_buffer = Encoding.ASCII.GetBytes(CreateRequestString(key));

#

I'm not sure how the string is send exactly

#

The var is called buffer... is it a buffer in bytes or not?

earnest phoenix
#

yes

#

it's ASCII bytes

boreal iron
#

ah ok

earnest phoenix
#

then it's just sent over the socket

boreal iron
#

is there a socket port defined I don't see?

earnest phoenix
#

the second parameter of the constructor should be the port

boreal iron
#

yeah, it's just resolving the hostname

#

ah alright

earnest phoenix
boreal iron
#

ty

earnest phoenix
boreal plaza
#

Hello, my bot suddenly stopped working today, I start it and after a time I get an error : janv. 17 00:55:38 pokpok.fr nodejs-example[1400]: Bot couldn't start! Error: Something took too long to do. janv. 17 00:55:38 pokpok.fr nodejs-example[1400]: at /home/damien/bot-discord/node_modules/discord.js/src/client/ClientManager.js:40:57 janv. 17 00:55:38 pokpok.fr nodejs-example[1400]: at Timeout._onTimeout (/home/damien/bot-discord/node_modules/discord.js/src/client/Client.js:436:7) janv. 17 00:55:38 pokpok.fr nodejs-example[1400]: at listOnTimeout (internal/timers.js:554:17) janv. 17 00:55:38 pokpok.fr nodejs-example[1400]: at processTimers (internal/timers.js:497:7)
Any idea?

odd stratus
earnest phoenix
#

setInterval and use setPresence inside of the callback

misty sigil
#

try ```js
client.on('debug', console.log)

#

see if anything goes on in there

boreal plaza
#

@odd stratus I didn't change anything

odd stratus
#

"Something took too long to do." Does your bot connect to a database or anything 🤔

boreal plaza
#

no it looks like it's the answer from discord.js

#

not my code

odd stratus
#

client.setInterval

earnest phoenix
#

🤦‍♂️

odd stratus
#

🤔

boreal plaza
#

@odd stratus I have 2 tokens, one for the bot, and one for beta tests (the same bot but only on a private discord room). And it looks like bot can connect with beta token, but not the public token (after 5 minutes of waiting I get the "too long" error).

misty sigil
#

how large is your bot

odd stratus
#

^ And where is the bot being hosted? Glitch?

boreal plaza
#

on my own server

misty sigil
boreal plaza
#

it is working fine since months

boreal plaza
misty sigil
#

how many servers

odd stratus
#

Can you check the Discord developer portal to make sure your bot hasn't been flagged or anything?

boreal plaza
#

but it uses very low resources

misty sigil
boreal plaza
#

I'll try "debug" now

odd stratus
#

Regenerate it manually as well

#

If it still doesn't work then idk

boreal plaza
#

token is already regenerated, it is fine

#

I haven't a login error

#

(with a wrong token I get a login error)

boreal plaza
#

error comes from discord.js/ClientManager, I feel confident that something changed somewhere, but not on my side 🤔

odd stratus
#

Remove node_modules and reinstall everything then

#

If its coming from discord.js's file

misty sigil
#

that seems to be something with heartbeating or somthin

boreal plaza
#

you can see the magical line : "Server is listening on port 8026"

boreal plaza
#

But if it's working with another token...

#

No need to reinstall anything

odd stratus
#

Well if its just an issue with the main bot you might need to contact Discord

#

I don't see exactly why it works on one bot but not another

boreal plaza
#

yes, same code, I just change a boolean "IS_BETA: boolean = ..." so it uses another token

drifting wedge
#

how can i make it like go to the next line when its full?

#
          <div style="display: flex; justify-content: left;">

          <div style="height: 80px; width: 80px; padding: 10px; margin-left: 10px; border-left: #00ff4c 5px solid; background-color: #23292e;">
          
            <img src="https://imgur.com/WRyF1TO.png" width="60px" style="margin-left: -2.5px;">
          
          </div>

          <div style="height: 80px; width: 80px; padding: 10px; margin-left: 10px; border-left: #00ff4c 5px solid; background-color: #23292e;">
          
            <img src="https://imgur.com/WRyF1TO.png" width="60px" style="margin-left: -2.5px;">
          
          </div>


        </div>```
tame kestrel
#

flex-wrap property iirc

drifting wedge
#

ty safe!

mellow kelp
#

flexbox is epic isn't it

wheat jewel
#

member count doesnt work

#
        const promises = [
            message.client.shard.fetchClientValues('guilds.cache.size'),
            message.client.shard.broadcastEval('this.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)'),
        ];

    return Promise.all(promises)
            .then(results => {
                const totalGuilds = results[0].reduce((acc, guildCount) => acc + guildCount, 0);
                const totalMembers = results[1].reduce((acc, memberCount) => acc + memberCount, 0);
    message.client.user.setActivity(`a.help | ${totalGuilds} servers`, {
        type: 'WATCHING',
    })                
        return message.channel.send(`Server count: ${totalGuilds}\nMember count: ${totalMembers}`);
            })
            .catch(console.error);
    ```
stark abyss
#

I am kinda bored and not sure what to code next. Anyone know some cool framework or api i could have fun with?

#

js

solemn latch
#

making an api or framework would be fun.

mellow kelp
#

how about a discord.js clone

stark abyss
#

to be honest that would be too hard for me I am learning things AHWeirdChamp

mellow kelp
solemn latch
#

the basics of api's are pretty simple.

tame kestrel
#

react.js :)

mellow kelp
#

oh yea react

stark abyss
#

Yeah I am already doing that xd

stark abyss
boreal plaza
#

@misty sigil @odd stratus Looks like it was an API version issue. I was on 11.6, updated on 12.5 and bot looks like it's starting ("Server is listening on port 8026"). I can't test it actually cause I first need to migrate some parts of my code...

misty sigil
#

d.js 11?

boreal plaza
#

yes

#

Dunno why it was working with the other token...

misty sigil
#

rrriiiiiiiiight

solemn latch
#

Djs 11 has been deprecated for a long time, generally best to not expect reliability from deprecated stuff.

boreal plaza
#

yes... I didn't care of NPM updates since a long time

#

still need to migrate my code and do a real test... It's 4 AM here 😑 ^^

earnest phoenix
#

ha i was fixing something for 4 hours, realising it was an easy fix

solemn latch
#

oof

zenith terrace
#

lol

distant cobalt
#

How do you remove an item using from an array in djs?

#

.....

#

no response...

dusky sundial
#

I'm not a js dev buy I'm pretty sure you can find the answer by googling "how to remove element from array js"

dusky sundial
#

And what did you find?

distant cobalt
#

some methods but their not what i'm looking for

#

I just wanna remove something without the position

mellow kelp
#

third result on the list

distant cobalt
#

k

mellow kelp
#

how hard is it to scroll a bit down

dusky sundial
#

I think a set or list would be a better option. Arrays are pretty inefficient when it comes to finding specific elements

distant cobalt
mellow kelp
#

yeah pretty sure one of those 9 solutions works

#

i'd say Array.filter is the most flexible one

distant cobalt
#

k

#

...

dusky sundial
#

Worst case scenario you have to loop through the entire array to find one element.

distant cobalt
#

oof

solemn latch
#

pretty sure filter works fine.

distant cobalt
#

uhh so i tried js premiumServers.splice(guildid, 1) but doesn't remove anythign

#

heres how i defined things

solemn latch
#

i think splice isnt the solution you want

#

splice removes by index, not value

mellow kelp
#

that's not how it works

distant cobalt
#
const premiumServers = [ '779410338336210954' ];
const guildid = args.join(' ')
premiumServers.splice(guildid, 1)```
distant cobalt
distant cobalt
grizzled raven
#

premiumServers.splice(premiumServers.indexOf(guildid), 1)

mellow kelp
#

the easier solution would be Array.filter i think

pale vessel
#

splice takes an index, not a string

solemn latch
#

just look through the link that was posted, they specify which ones work for values

distant cobalt
#

k

#

okay so i fixed it

#

thanks

sudden olive
#

hello helpers

#

Please help me

solemn latch
#

i might be able to help, might not, since i dont know what your question is about, no idea :p

sudden olive
#

Wait i send u Ss

#

My bot again and again

#

Say like that

#

i am in voice channel

#

After my bot says

#

U must be in voice channel

solemn latch
#

i cant solve this, i dont have enough info.

crimson vapor
#

alright I have a big brain question

#

I need to check if files with the same name are different

#

without caching the buffer

#

and they have the same name

#
+ file.ext
- file.ext
+ file.ext``` I need to check if the files are the same or not the same
earnest phoenix
#

"now solve it please" the level of entitlement people think they have

#

lmfao

crimson vapor
#

LOL

#

cry do you know how I might be able to acheive my goal?

earnest phoenix
#

are you using node?

crimson vapor
#

indeed I am

earnest phoenix
#

you can use statSync from fs

#

it returns a Stats object

#

that has a size property

crimson vapor
#

oh

#

thats smart

#

since realistically the size would never be the same

earnest phoenix
#

yup

crimson vapor
#
  const check = fs.statSync(file).size;
  if (check === lastFile) return;
  else lastFile = check;``` looks like this should work
#

ty

long marsh
#

Hey, guys! Woo, do you use the discordjs client?

#

Or, at least, does anyone here actually use the 'sweepMessageInterval' options attribute on the client?

#

Are there any cons to its usage?

slender thistle
slender thistle
odd stratus
dusky sundial
slender thistle
#

Ah

gilded olive
#

Damn intents

sudden olive
#

😫 Help plz

odd stratus
lyric mountain
#

Let the sizes ever be the same

crimson vapor
#

idk how to get hash

odd stratus
#

I asked you what your condition check looks like, you can't expect me to be able to help you if you can't answer a simple question @sudden olive

lyric mountain
odd stratus
#

Did you read the error?

#

It can't find that file

#

You're doing ../

lyric mountain
#

Just search "[lang name] sha256 hash"

sudden olive
odd stratus
#

Are you sure you're calling it from the correct place? Try ./

sudden olive
#

Ok

earnest phoenix
#

generating a hash would require you going over the buffer

#

you're not caching the buffer though so

odd stratus
#

Make sure you're calling it from the right directory

sudden olive
#

it is on home

#

Not in Any File

#

See 2 pics on up

#

This is same pics

crimson vapor
#

realistically you are never gonna take a screenshot with the same size as anther screenshot unless you take a screenshot of the same thing, then why would you want it uploaded

lyric mountain
#

That's what I meant

earnest phoenix
#

j

sudden olive
#

i creating Play.js command when i got this error

earnest phoenix
#

Wich error?

grizzled raven
#

that error

young flame
#
if(message.content.startsWith(prefix + ['cc', 'ok'])) {
      console.log('works boysssss')
  }
#

why it no work

#

unless you cant use an array oor i formatted it wrong

#

pretty sure you use ['thing, 'thing]

lyric mountain
#

You can't afaik

#

Not that way

young flame
#

oof

lyric mountain
#

It'll concat into "prefixcc,ok"

young flame
#

hM

#

how would you do it then?

lyric mountain
#

Iterate over the array

young flame
#

interesting

#

iterate as in put it in the array or-

#

o wait

pale vessel
#

you can use array.some()

#

if (['cc', 'ok'].some(x => content.startsWith(prefix + x)))

young flame
#

hM

pale vessel
young flame
#

i dont really need it as a command lol

#

im just trying to see if discord supports this

#

since i dont feel like creating aliases

lyric mountain
#

Supports what?

young flame
lyric mountain
#

Like, it's not about discord but about coding itself

young flame
#

getting info from a array to implement into a command

#

well discord.js is the lib im partially coding into

lyric mountain
#

You're only constrained by js itself

young flame
#

eH

#

it is what it is i ¯_(ツ)_/¯

lyric mountain
#

Friendly tip: spend some more time and make a command manager

young flame
#

i did

#

i just dont want to use aliases

lyric mountain
#

Aliases are nice

young flame
#

i like overcomplicating things lol

drowsy grail
#

command aliases are kinda poggers

young flame
#

i made a 300 line eval command and a 110 line ping command

drowsy grail
#

overcomplicate your features

#

not your code

young flame
#

eh

#

they both work

#

i code useless things

#

but they look cool

drowsy grail
#

yes but one day you might code useful things

young flame
#

im making a bot that gives soap suggestion

drowsy grail
#

that is wildly practical

young flame
#

lol

#

woo is supposed to be helping >:(

#

welp brb

#

i gotta finish this bot so i can start finished soap bot so i can implement the league api

drowsy grail
#

have fun

young flame
#

also

young flame
rocky hearth
young flame
#

pretty sure you meant message.content doe

lyric mountain
young flame
#

the error

#

i cant tell hwere it is

#

and im not reading threw all of that

lyric mountain
#

Failed to execute dev script

#

That doesn't say anything at all tho

young flame
#

oh

#

lol

rocky hearth
#

> shadyantra-api@0.3.0 dev D:\shadyantra-api-master
> ts-node --files src/index.ts


D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:53240
        function getBaseConstraintOfType(type) {
                                        ^
RangeError: Maximum call stack size exceeded
    at getBaseConstraintOfType (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:53240:41)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:37)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:24)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:24)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:24)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:24)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:24)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:24)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:24)
    at getTypeFacts (D:\shadyantra-api-master\node_modules\typescript\lib\typescript.js:62711:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! shadyantra-api@0.3.0 dev: `ts-node --files src/index.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the shadyantra-api@0.3.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sshukla\AppData\Roaming\npm-cache\_logs\2021-01-17T06_07_47_585Z-debug.log```
#

it is coming from ts

umbral zealot
#

That would mean you have an infinite loop in your code

#

Or in theirs

#

that's fun

rocky hearth
#

my project works fine on my machine, but not on my frnds machine

lyric mountain
#

Use git

rocky hearth
#

can diff node version might be issue for ts

lyric mountain
#

Probably

rocky hearth
#

I'm on, 1.15 and he is on 1.12

umbral zealot
slender thistle
#

I'm amazed the ratelimiter in dblpy hasn't worked for like 3 years

#

And no one noticed

pale vessel
#

Very well maintained lib

opal plank
slender thistle
#

Uhhh

#

Nah

#

No u

opal plank
#

yes u

young flame
#

lol

#

@slender thistle lemme help with it >:(

slender thistle
#

@opal plank Francis apparently stole the request method from d.py

#

But I guess he didn't bother with the ratelimiter

#

Can't blame him, neither did I until now

slender thistle
slender thistle
#

It was blocking also

#

So that was fun to figure out

young flame
#

i pushed changes to dblapi.js because no one codding it >:(

slender thistle
#

Are you sure you can maintain dblpy though? sure

young flame
#

its python right

#

how hard can it be okay

vale garden
#

hi does anyone know how you can get a list of all roles that the ctx.author has on a server discord.py

slender thistle
#

ctx.author.roles

#

make sure ctx.guild isn't None (the command is ran in a server)

opal plank
#

its now node-sdk

slender thistle
#

I hate being consistent with the docstrings

#
        limit: int[Optional]
            The number of results you want to lookup. Defaults to 50. Max 500.
        offset: int[Optional]
            The amount of bots to skip. Defaults to 0.

I'm such an idiot KEKW

earnest phoenix
#

hello sir I wanted to tell you that I cannot code my bot and start it I suck in development I need help to do it I am on such no pc but do not want and I am autistic et I’m fresh

wanton knoll
#

I’m fresh

I’m French

earnest phoenix
#

@dire plank basically you need a guide?

#

they left

#

tfw

wanton knoll
#

How to use CSS in text

drowsy grail
#

?

#

style text?

sharp python
#

hi

earnest phoenix
#

@wanton knoll in your long description?

sharp python
#

i need help to do bot with dashboard

wanton knoll
#

@drowsy grail @earnest phoenix

In this
earnest phoenix
#

that's a discord codeblock

wanton knoll
earnest phoenix
#

yeah that's how you style with that

#

put the code language after the backticks

wanton knoll
#
Hello
#

Not working

earnest phoenix
#

because that isn't valid css...

sharp python
#

can you come in dm@earnest phoenix

earnest phoenix
#

cant help in dms

wanton knoll
earnest phoenix
#

and idk how to make a bot dashboard anyways

earnest phoenix
#

also #development is not a place to ask for help with codeblocks

wanton knoll
sharp python
#

i have new bot for SABOTEURS LIST @earnest phoenix

paper fjord
earnest phoenix
#

he IS on desktop

paper fjord
#

nope

#

he is on mobile

sharp python
#

yep

wanton knoll
paper fjord
#

yea

earnest phoenix
#

not scam

#

markdown is not fully supported on mobile

paper fjord
#

yea right

sharp python
#

can some one help me !!!

wanton knoll
#

But I can see color messages

earnest phoenix
#

how da fuck are they gonna keep a textarea box in sync with the styling on every keystroke

paper fjord
#

only py and js supports on mobiles

earnest phoenix
paper fjord
#
1234567890 haha only py and js supports on mobiles
wanton knoll
#

Ok wait let me try something

#

It should work

earnest phoenix
paper fjord
#

lol yea

sharp python
#

"a"

earnest phoenix
#

who cares

wanton knoll
#

Yeah

earnest phoenix
#

markdown is a code languagr

#

¯\_(ツ)_/¯

paper fjord
earnest phoenix
#
if py and js work on mobile what does this appear to you
slender thistle
#

Well, it's not exactly a dev discussion

earnest phoenix
#

k

#

bye imma go take a bath

slender thistle
#

I'm not doing typing annotations for this shit

earnest phoenix
#

what does this refer to

sacred trout
#

Can anyone add my bot in their servers?

#

Please?

slender thistle
#

This

#

and this

slender thistle
sacred trout
#

Sorry

drowsy grail
#

just use function.bind() 😃

slender thistle
#

List[Dict[str, Any]] UwU

slender thistle
young flame
slender thistle
sharp python
#

@here

earnest phoenix
#

@sharp python embeds?

#

can i maybe find a person here to teach me how to make economy commands?

lusty quest
earnest phoenix
#

ok

#

thats okay as well

#

as i cant find any good tutorials

lusty quest
#

you can use any database the flow inside the commands / events is the same

earnest phoenix
#

thx

slender thistle
#
        query = ""
        for key, value in opts['colors'].items():
            query += f"&{key}={value:x}"
        q = query.lstrip("&")

This is probably the only efficient way I could find to make query params from a dictionary

#

I don't think using a boolean in this case will improve the performance?

#

or apparently it does...?

#

Eh. The difference isn't that significant in any case

tribal siren
#

how to check if there's an emoji in the message content?

slender thistle
#

Custom or default?

tribal siren
#

custom

#

like if i want to do <emojicreate :emoji:, how would i make the bot fetch guild emojis to get the :emoji:?

earnest phoenix
#

I'm trying to create an event that triggers every 2 weeks and lasts for 2 days. I'm using Js, can someone give me an idea of how i would be able to do that?

topaz epoch
#

why my bot is offline or is online ?

golden condor
#

Hi, my message event is taking around 5s after a message is sent and it happens on my VPS and on my local machine, and I don't know why, can anyone help me (using discord.js-light)?

pure lion
#

how long does it take the raw event to come in?

glad violet
#

one question

#

and support 24/7

earnest phoenix
#

hi