#development

1 messages · Page 1600 of 1

umbral zealot
#

uhhhh sorry I meant discord.com
Sorry, professional deformation kekface

opal plank
#

you can talk to eacthother

drifting wedge
#

talk in dumb people words

modest maple
#

ehhhhhhhhhhhhh you're getting massively un-reasonable for python

drifting wedge
#

like 4 letter words max

opal plank
#

those are the terms though

#

you know what IPC is right?

modest maple
#

using pipes like that is a really bad idea in python's async world

drifting wedge
#

yes

#

inter proccess communication

opal plank
#

okay, you know what process is ?

drifting wedge
#

yes

opal plank
#

okay, good

#

process.send() is a function that you can use to talk with IPC

#

it works like an emitter

#

let me get my example from leviathan rq

drifting wedge
#

alr

jovial ore
#

I literally have Discord open?? LOL @umbral zealot I don't get the issue.

quiet badger
#

just posted my new bot on the site

#

lmao

#

I hope it doesnt get rejected

umbral zealot
quartz kindle
quiet badger
#

okk do they accept semi inapropriate bots

modest maple
#

pithink Erwin this is Python not JS

opal plank
#

take a look at this example

#

wait what

modest maple
#

bro

#

did you

opal plank
#

oh, if its python

modest maple
#

dude

opal plank
#

welllll

#

nvm then LMAO

modest maple
#

I told you like

opal plank
#

xD

quartz kindle
#

lmao

opal plank
#

oopsie

quartz kindle
#

erwin be blind

#

too much caipirinhna

modest maple
opal plank
#

im legally blind, i'll let you know sir

quiet badger
#

Alright I read the rule

quartz kindle
#

or maybe caipiroska

quiet badger
#

but my bot is kinda on the limit

opal plank
#

that too

#

drunkness causes blindness

drifting wedge
#

okay so why not @modest maple

opal plank
#

causality

quiet badger
#

can I dm someone about what my bot does and you tell me if that's not allowed

drifting wedge
#

can u EXPLAIn why not?

#

so basically

quiet badger
#

or show in vc

drifting wedge
#

2 options

umbral zealot
#

and your bot will be reviewed when it reaches the top of the queue not before

drifting wedge
#

i run a specific instance of the bot for dashboard, or i can add ipc to all the bot clusters

#

and then just find a way to ask the specfic cluster to do set thing

modest maple
#

Because python web-servers work via a pre-forking moddle each worker is a new stateless process which is a new ipc client mess per server instance which makes your code even more spaghetti

quartz kindle
#

how do you spawn your clusters anyway? doesnt py have a master process? like a shard manager

modest maple
#

sharding in python is still 1 thread

#

so you can normally support upto 15-20k servers per instance on your average server

#

my pc can handle about 60k servers per instance

quiet badger
#

rip

quartz kindle
#

my understanding is hes already running multiple instance

modest maple
#

ik

quartz kindle
#

at least thats what i understand as "clustering"

modest maple
#

which he shouldnt be doing

jovial ore
#

Fixed

quartz kindle
#

so im asking, how are you spawning these instances

drifting wedge
quartz kindle
#

are they spawned by a master process?

#

or do you run 2 different files?

drifting wedge
#

2 dif files

quartz kindle
#

ah

modest maple
#

okay

#

so

#

i REALLY gotta repeat that your shouldnt be clustering

#

like no offence

#

but this is way out of your skill level from what i can gather for now

midnight blaze
#

guys pls give me some hints how to solve this problem. I am sure I am not the first who had this, I was on google and all I could find was topics with v11 js

#

djs

quartz kindle
#

i mean

midnight blaze
modest maple
#

1 instance is fine to use for the ext-ipc module

quartz kindle
#

just run an http server on each of your processes

#

no need for ipc

opal plank
modest maple
quartz kindle
#

you can

modest maple
#

only the cache local to the server

#

which you cant control

opal plank
#

jk, lets see whats up

quartz kindle
#

exactly

drifting wedge
#

prob would work

lusty quest
#

async stuff is annoying AF. returning data from a Promise that runs inside a promise, i hate it.

quartz kindle
#

same thing with ipc

opal plank
#

@midnight blaze how good is ur internet and are you sharding?

modest maple
#

exactly

quartz kindle
#

your dashboard will need to send a message to all processes

#

and have the right process respond

umbral zealot
drifting wedge
#

ye

quartz kindle
#

like discord.js does

drifting wedge
#

i can like find what cluster a guild is in

#

ye?

#

like it asks all the clusters

modest maple
#

not really

quartz kindle
#

you can find what shard it is in

drifting wedge
#

is that guild in your list of guilds?

quartz kindle
#

if you have the total shards and the guild id

drifting wedge
#

@quartz kindle yea

#

that wou;d work

modest maple
#

each cluster will only have a set amount of guilds

#

send to all then have only one respond

#

but you cant use the ipc module for this btw

opal plank
#

not really needed tho

#

what tim said is right

#

theres a formula to calculate the guild

quartz kindle
#

if you know which shard ids each process has, then you can send it only to that one

drifting wedge
#

ye?

opal plank
#

(guild id >> 22)

#

erm

modest maple
#

true

opal plank
#

fuck i forgot the rest

latent heron
#

programmer moment

opal plank
#

og right

quartz kindle
#

pwogwammer

latent heron
#

uWU pWoGrammR WoWment

opal plank
#

(GUILD_ID >> 22n) % SHARD_COUNT

#

thats the formula to see which shard your guild is in

#

so like tim said, yeah, you can directly fetch the shard the guild is suppose to be in

drifting wedge
#

yep

#

and just have the dashboard send a request to http server

quartz kindle
#

yes

opal plank
#

you would need to have a master though

drifting wedge
#

that bot cluster gets and acts on

zenith terrace
drifting wedge
opal plank
#

or somewhere so you can fetch how many shards your bot has

drifting wedge
#

ye ye

#

ill just have a config.json

#

file

opal plank
#

oof, hardcoded shards

drifting wedge
#

@opal plank OR

#

i could do guildcount / 2,5k

#

then round that

opal plank
#

well, i guess you could just read the file and send it via http

quartz kindle
#

guildcount would still be hardcoded

drifting wedge
#

wdym?

opal plank
#

when someoena dds ur bot

quartz kindle
#

just send a request to /gateway/bot

opal plank
#

then your number is already wrong

drifting wedge
midnight blaze
opal plank
#

oh yeah

drifting wedge
#

well then what can i do?

opal plank
#

i think you can fetch via API

#

./me should work no?

drifting wedge
#

how wouoldu have dynamic shards doe?

opal plank
#

or is it on the gateway?

modest maple
#

gateway iirc

midnight blaze
drifting wedge
#

dont u have to specify shardcount on bot start?

umbral zealot
quartz kindle
#

send a request to /gateway/bot with your bot's token, and you will get the recommended shard count

#

use that to know how many shards

drifting wedge
#

@quartz kindle ye but i still will need to CHANGE the shard count

#

like restart the bot

quartz kindle
#

yes, but you dont need to hard code it

drifting wedge
#

oh ye

#

i mean how does the api deal with it>

quartz kindle
#

every time your bot starts, it should be getting the right number of shards automatically

opal plank
# midnight blaze internet? It is a vultr vps?

reason why i ask is thats usually due to poor internet which makes discord send too much data and you miss ACK's and heartbeats before they become ready. Caching all users can cause that, if your bot is pretty big

modest maple
#

manual chunking™️

quartz kindle
#

manual thonking

opal plank
#

Dynamic Cluster Gang ||and ddosing twitch in the process of learning||

midnight blaze
#
require("dotenv").config();
const AutoPoster = require('topgg-autoposter')

const Discord = require('discord.js');
const client = new Discord.Client();
const { ShardingManager } = require('discord.js')




const manager = new ShardingManager('./index.js', {
    totalShards: 'auto',
    token: process.env.TOKEN
});

const poster = AutoPoster('eyJhbGci----iWt_c', manager);

manager.on('shardCreate', shard => {
    console.log(`Launched shard ${shard.id}`)
    shard.on('ready', () => {
        console.log('Shard ready')
    })
    shard.on('disconnect', (a, b) => {
        console.log('Shard disconnected')
        console.log(a)
        console.log(b)
    })
    shard.on('reconnecting', (a, b) => {
        console.log('Shard reconnecting')
        console.log(a)
        console.log(b)
    })
    shard.on('death', (a, b) => {
        console.log('Shard died')
        client.destroy()
        client.login("token")
        console.log(a)
        console.log(b)
    })
})

setTimeout(() => {
    manager.spawn()
},15000)
drifting wedge
#

whats the /gateway/bot url?

#

like how would i do it?

#

i STILL dont understand http stuff lol

opal plank
#

how many members/guilds is ur bot in and how fast is ur internet/processor

midnight blaze
#

they did tho..

opal plank
#

who?

quartz kindle
#

in the headers put Authorization: Bot tokenhere

opal plank
#

ah evie asked for it

#

well, still, theres 3 questions you didnt answer :p

drifting wedge
#

@opal plank @quartz kindle @modest maple ty all so much

midnight blaze
opal plank
#

that might be why

midnight blaze
#

I have already said that

#

😛

quartz kindle
umbral zealot
#

I feel like maybe now all the information has been gathered, but I don't do sharding kek

opal plank
#

are you caching all members on startup?

#

@quartz kindle d.js caches everything by default no?

quiet badger
#

Do you just get the bot developer role when your bot goes on the site?

drifting wedge
#

https://discord.com/api/gateway/bot is the /bot?

quartz kindle
#

delet this

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

midnight blaze
#

no

#

ok

drifting wedge
#

bot token?

drifting wedge
#

like or do i need to put it in the header

#

or whatever

quiet badger
#

cool

quartz kindle
#

but not members

opal plank
#

isnt there a chance he might be missing heartbeats due to discord sending all member data?

quartz kindle
#

nah

#

well

#

actually it is

opal plank
#

i remember cake having a similar problem on his

quartz kindle
#

because djs has a flawed fetchAllMembers

opal plank
#

indeed

quartz kindle
#

i had to fix it myself on djsl

rugged girder
#

So my bot died this morning because it sends GET requests to the Top.gg API checking if a user has voted (for certain commands). In order to solve this, I need to implement better error handling so if the top.gg API isn't working, it just bypasses and allows the user to use the command anyway.

However, with the issues, it takes around 10 seconds for it to receive the 504 error from the API. Because of this, I don't think it's feasible to just wait until the response comes back... what can I do instead? I've heard that webhooks might be a superior solution, however, how can I make my bot store the data that the user has voted within the last 12 hours (as I am not rewarding users, I am just force-voting on some special commands for the bot).

quartz kindle
#

always catch your errors

rugged girder
#

yes but that's the issue, as the catch takes like 10 seconds to work

#

because it is still waiting for the response

opal plank
#

like a champ, ts topgg.postStats().catch(() => {})
mmulu

rugged girder
opal plank
#

why is that mmulu so small?

#

d mmulu

#

thats tiny af

quartz kindle
#

wait, you're fetching votes?

#

yeah dont do that

#

use webhooks

rugged girder
#

voteParse = await got(`https://top.gg/api/bots/695011795110461520/check?userId=${message.author.id}`, { headers: { "Authorization": process.env.TOPTOKEN } });

#

like i've just been sending requests

#

this is probably a bad idea right

quartz kindle
#

thats not a good idea for many reasons yes

lusty quest
#

yea better use webhooks

earnest phoenix
#

implement a cooldown system, this will not only prevent your users from spamming the commands but it will also prevent reexecution of the same command while the first one is still executing

opal plank
#

SUPER

latent heron
#

webhooks are usually more opt for this @rugged girder

opal plank
#

FUCKING thats ur name

#

i forgot yesterday

#

i dont remember why but someone was asking about something from you

rugged girder
#

do you all have a guide for the webhooks, as I don't think it's feasible to store the data and delete after 12 hours...?

lusty quest
#

lol im getting famous here?

rugged girder
#

and then delete after 12h?

solemn latch
#

most databases can delete after 12 hours fine

lusty quest
#

if you want to store temporary i can suggest use Redis

#

it also fires an event if the TTL is reached

#

so you can send a reminder with it

quartz kindle
#

technically, you dont even need it

#

if you already have a database which stores user info

lusty quest
#

would say its better than having every x minutes a db call

rugged girder
#

but to prevent a ton of database queries, then won't you have to cache like 1000 votes?

quartz kindle
#

you can just add a field that says lastVoted: timestamp

opal plank
#

and i now forgot the reason too

lusty quest
#

do i need to lurk around here more?

midnight blaze
solemn latch
#

caching 1000 votes wouldnt be a ton of data

pale vessel
solemn latch
#

a few kilobytes if done properly

opal plank
rugged girder
#

ree

#

ok

quartz kindle
leaden lake
#

does anyone can help me ?
I am programming on discord.py, and the file I have to send guild count make my bot doesn't launch.
But the one important thing, is the file worked perfectly 2h ago, but not now.

It'n not working on both OS, Ubuntu LTS and Windows

modest maple
#

error?

umbral zealot
midnight blaze
lusty quest
#

anyways i think i did something cool.
a Expess Tensorflow integration with automatic scaling Worker threads and load balancer.

amber quiver
#

someone have a code for deleting messages? (not bulk delete)

umbral zealot
amber quiver
#

and somebody knows why for some reason when Im bulk deleting 14+ days old messages, the bot just stop working

modest maple
#

because you cant

lusty quest
#

bcs you cant

modest maple
#

the limit is 2 weeks max

amber quiver
umbral zealot
#

If you want to delete all messages in a channel, clone() the channel and delete the original one.

modest maple
#

and bulk deleting anything beyond that is API abuse

umbral zealot
#

it's 2 lines, can't be simpler.

amber quiver
#

but why its just stopping my bot

umbral zealot
#

Because you didn't code it right

lusty quest
#

catch the error

amber quiver
lusty quest
#

if you use node unhandled errors will exit the process

opal plank
umbral zealot
#

But, again, the way to do this is clone + delete. Super simple.

amber quiver
opal plank
#

which now, thankfully, crashes the process now

#

finally™️

solemn latch
#

pog

opal plank
#

imagine not handling your errors

#

imagine not handling and counting them

#

and logging

solemn latch
#

why did it not crash the process before eyes_shaking

opal plank
#

cuz pre node 14 it just dont

leaden lake
opal plank
#

they advertised it for a long ass time

umbral zealot
#

exactly 😄

opal plank
#

that it would crash the process

modest maple
#

ultimate logging™️

opal plank
#

PFFF

#

pleb

modest maple
#

im docker so i not got those colours mmLol

opal plank
#

imagine not having console variables

modest maple
#

i gotta work out where df that EOF error is coming from though blobpain

lusty quest
modest maple
#

5 different systems that can raise that message bloblul

topaz lynx
#

How do I know my bot has been reviewed

amber quiver
#

I have another question, how can I make my bot to delete the specific amount of messages that I declare to him

modest maple
latent heron
# opal plank

i feel like anyone can make a custom console error logger

modest maple
opal plank
#

my console pogs

opal plank
amber quiver
latent heron
#

you just need to have a little bit of Bash knowledge

#

fair

modest maple
amber quiver
#

thats it?

modest maple
#

just give the bulk delete a limit parameter shrug

amber quiver
#

ok

#

thx

topaz lynx
#

I Checked IN MORNING, MY BOT HAD 50%
Now, it is getting reviewed
I had to do final try for myself
Wtf should I do now

quartz kindle
#

nothing

modest maple
#

if your bot is 50% in queue its not getting reviewed now

quartz kindle
#

just wait

topaz lynx
modest maple
#

its not

modest maple
#

trust me

#

its not

topaz lynx
opal plank
#

@slim heart //@ts-nocheck > //@ts-ignore

modest maple
#

again, trust us its not read what @cinder patio sent you

slim heart
#

i dont use ts-ignore even

opal plank
#

lmao

#

i know

slim heart
#

except for twice in rose

#

cuz fuckin

opal plank
#

just 300IQ and go full on

slim heart
#

discord-api-types poopoo

quartz kindle
#

or just dont use ts in the first place

#

:^)

slim heart
#

shut up tim

#

smh

quartz kindle
#

lmao

opal plank
#

frick u tim

slim heart
modest maple
#

mmLol But the alternative is JS

#

just use NIM

topaz lynx
opal plank
#

scratch is clearly the superior

lusty quest
#

ts doesnt offer any performance improvement over js iirc

slim heart
#

its all fun and games til discord.js moves to ts tim

modest maple
quartz kindle
opal plank
#

then tim will come to detritus

modest maple
quartz kindle
slim heart
#

i mean

opal plank
topaz lynx
#

So, we can't see percentage?
Bruh

slim heart
#

djs is adding customizable caching soontm

quartz kindle
#

soon™️

modest maple
topaz lynx
#

Ye

slim heart
#

they've already added methods to stores that can do api requests without cache

solemn latch
#

the percentage is just an estimation anyway

#

it doesnt really mean much

opal plank
#

or just use an alraedy good library that doesnt need to wait until v13 to have BASIC FUCKING FEATURES like caching customization.

cough cough detritus cough cough

modest maple
#

true

slim heart
#

oK bUt ImAgInE fUnNeLlInG

#

poopy lib

opal plank
#

they already explained to you

#

its 8 per thread

topaz lynx
#

@modest maple can u suggest me a good bot except dank memer, mee6, dyno, carl

#

That has games in it

modest maple
#

🤨

topaz lynx
#

?

modest maple
opal plank
#

this channel really isnt the palce to ask tbh

topaz lynx
#

This is development

opal plank
#

yeah, BOT DEVELOPMENT, not ask-a-bot

#

if you wanna develop a bot, feel free to ask about it

topaz lynx
#

How do I do YouTube notifs

modest maple
#

webhooks™️

opal plank
#

use youtube-api or scrape

#

or that

#

i think htey have webhooks

amber quiver
opal plank
#

surely youtube api cant be that bad

topaz lynx
#

I use bot designer

amber quiver
#

with fetch()

modest maple
lusty quest
#

have fun with the Google API, this thing is not really user friendly

modest maple
#

okay well gl with that

opal plank
#

yeah bot makers and stuff wont take you far at all

modest maple
#

Google api's are ass

#

for such a massive company ive never known docs to such so much

topaz lynx
slim heart
#

master

quartz kindle
#

oh cool

slim heart
#

or maybe already in current version

opal plank
# modest maple Google api's are ass

do you have the SMALLEST HINT of idea how much pain i went through to get my mail webhooks going? its SO FUCKING SHIT, you need to add pages and get verified and shit its HORRIBLE

modest maple
lusty quest
#

bot designer is making discord bots on training wheels while driving on Instapac

topaz lynx
#

Because?

quartz kindle
opal plank
#

googles api is absolutely nightmareish

#

either im too dumb or the docs are shit

quartz kindle
#

im looking at master commits and dont see anything

slim heart
#

oh nvrm

lusty quest
slim heart
#

i woulda sworn i'd already seen it

quartz kindle
#

well you can do it through client.api

#

but thats always been there

opal plank
#

tim

#

bot still at 900MB

#

no more 4GB with d.js

modest maple
#

gasm

opal plank
#

legit tho

#

its idling at 900

slim heart
#

not nearly as far along as i'd thought but they added a few things

modest maple
#

Just enough growing room

opal plank
#

how many guilds/members cached?

modest maple
#

10.5k Guilds, dont have members

#

cuz intents™️

opal plank
#

im caching everything currently, but it'll change soon

#

gonna make it dynamically cache it

slim heart
#

does detritus have custom prop stuff

#

like only caching certain props

opal plank
#

not sure

slim heart
#

should suggest

opal plank
#

you'd have to ask them

slim heart
#

ive done that for rose

opal plank
#

i sent you multiple times

#

just go there and suggest :p

slim heart
#

it only caches channels and guilds, no props but id for guilds and channels just store nsfw props

#

its minute but it just add that little bit back

#

minute?

opal plank
#

i think it has BaseStructureData

slim heart
#

minoot?

#

idfk

cinder patio
#

That's a little overkill imo

slim heart
#

can never be too overkill when it comes to scaling

#

its overkill for tiny bots but when they get bigger it adds up

#

i did something similar with my custom lib for cb, and it dropped like 100MB off of ram

modest maple
#

Ram is pretty cheap though

#

wel..

slim heart
#

still

modest maple
#

incredibly cheap for most things

slim heart
#

i've no lack of ram

#

but regardless less resource usage is always poggers

modest maple
#

I gotta work with webRTC soon blobpain gonna not be too fun

#

im determined to learn it though

opal plank
slim heart
#

those choose what is to be cached

#

im talkin bout what props to be cached

#

within those individual caches

opal plank
#

you can select what you WANT and doesnt to be cached

quartz kindle
#

ah i guess not even detritus does that

opal plank
quartz kindle
#

i had that in mind for quite a while

opal plank
#

this is the options per

slim heart
#

yeah that's not indiv props

quartz kindle
#

im gonna do that in my future testing stuff

slim heart
onyx hare
#

Error: 504 Gateway Time-out i got this on one of my bots, did i hit a rate limit?

slim heart
opal plank
#

types for props sounds like a massive pain in the ass tbh

#

everything would have to be optional

slim heart
#

i mean look what i did

#

it's not that difficult to implement on rose at least

opal plank
#

for the user it still seems like a bitch to use

#

cuz everything would be optional

#

so it would highly increase complexity

slim heart
#

not really

opal plank
#

having to check if the data has the props you need

slim heart
#

you just pick out the props you actually use

opal plank
#

well yeah, but your compiler doesnt know that

slim heart
#

you rarely use more than 10% of props of any cache lmao

analog tinsel
#

random.js

#

index.js

#

how can i send (t) on index

#

im trying to get data from another js file

lusty quest
#

dont use var, var is deprecated and still there to not break the internet. Use Const or let instead

opal plank
#

^^

cinder patio
#

Why not just allow users handle all the caching themselves Thonk

slim heart
#

i mean you can

#

you can just do cache: false and it disables everything lol

analog tinsel
#

did you guys talking about me?

cinder patio
#

see but then why try to implement built-in caching. If I were to make a discord lib I would make it so users can easily build their own caching system that feels integrated into the lib, but in reality it's not

slim heart
#

its up to the user

#

you can customize built in caching and if u wanna do it urself just do it urself

lucid prawn
#

what this mean


(node:25) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 Hey @PokéHunt#0608, sunucuda link paylaşamazsın! listeners added to [CommandoClient]. Use emitter.setMaxListeners() to increase limit
(node:25) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 The bot is offline / restarting, please join our support server for updates: https://discord/cpYkJzd listeners added to [CommandoClient]. Use emitter.setMaxListeners() to increase limit
(node:25) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 **No i delete your message you can not share links here , @PokéHunt#0608** listeners added to [CommandoClient]. Use emitter.setMaxListeners() to increase limit
solemn latch
#

you have too many listeners

slim heart
#

Use emitter.setMaxListeners() to increase limit

#

tells you there

solemn latch
#

thats a bad solution

lusty quest
#

how many event listener did you have? like client.on(message)?

slim heart
#

not if its intended

lucid prawn
#

who is this

#

@PokéHunt#0608

cinder patio
#

You rarely need more than 1 event listener

lucid prawn
analog tinsel
#

How can I pull the value(const/let) from another javascript file?

slim heart
#

especially with djs' message collector that's just not the case

lusty quest
#

wtf?

cinder patio
#

You don't know?

lusty quest
#

how many client.on(message) etc did you got?

lucid prawn
#

yea 13

lusty quest
#

wtf?

#

why?

lucid prawn
#

afk and status and whitelist and my commands plus dm anti

#

and ect

lusty quest
#

but why?

solemn latch
#

you dont need a listener for each command

lusty quest
#

1 event or 2 would do it

lucid prawn
lusty quest
#

did you have duplicated event listeners like for ready, etc

lusty quest
#

you have to got more, otherwise you wont get this error

lucid prawn
#

i will check brb

lucid prawn
# lusty quest you have to got more, otherwise you wont get this error

client.on("guildCreate", guild => {
client.on('messageDelete', async message => {
client.on('guildMemberRemove', async member => {
client.on('guildBanAdd', async (guild, user) => {
client.on('message', ({channel, content, member}) => {
client.on('message', message => {
client.on(message, (message) => {
client.on('message', message => {
client.on('message', message => {
client.on('message', message => {
client.on('ready', () => {
client.on('message', (message) => {
client.on('ready', () => {
client.on("message", async message => {

lusty quest
#

why 8 message event listeners?

modest maple
lusty quest
#

you only need 1

#

also you only need 1 ready event

mellow kelp
#

why 2 ready events notlikenoot

lusty quest
#

if you want to have the files cleaner, split the stuff into sub files and call them inside the event

lucid prawn
#

client.on('ready', () => {
console.log('Online');
client.user.setActivity('akhelp and watching 15 servers', { type: "Watching" })
.then(presence => console.log(Activity set to ${presence.activities[0].name}))
.catch(console.error);
client.user.setStatus('dnd')
.then(console.log)
client.user.setPresence({ activity: { name: akhelp || Watching ${client.guilds.cache.size} Servers and helping ${client.users.cache.size} Senpais || Watching Commands 81 || }, status: 'dnd' })
.then(console.log)
.catch(console.error);
})

client.on('ready', () => {
const antispam = require('better-discord-antispam');
antispam(client, {
limitUntilWarn: 3,
limitUntilMuted: 5,
interval: 2000,
warningMessage: "if you don't stop from spamming, I'm going to punish you!",
muteMessage: "was muted since we don't like too much advertisement type people!",
maxDuplicatesWarning: 7,
maxDuplicatesMute: 10,
ignoredRoles: [],
ignoredMembers: [],
mutedRole: "Muted",
timeMuted: 1000 * 600,
logChannel: "antispam-logs"
});
});

lusty quest
#

out them into one ready event

lucid prawn
#

ok

lusty quest
#

do the same with the message event, then your error will also go away

lucid prawn
#

i hope my code dont broke

#

when i do this

lusty quest
#

it will probably break, but this is the price for bad code

lucid prawn
#

bruh

#

it not bad

#

just not clean

lusty quest
#

you have 8 message event listeners, this is bad code

lucid prawn
#

it for differener stuff

lusty quest
#

yes but wont change the fact that its bad

brittle fable
#

Is anyone else having an issue with the webhook voting thingy?

drifting wedge
#

@placid iron can u help me setup a aiohttp webserver?

brittle fable
#

I'm getting a 500 error

opal plank
brittle fable
#

Oh that's what causing it

#

alr

slender thistle
#

I heard aiohttp

drifting wedge
#

yep

#

@slender thistle not a mod anymore

#

WOT

pale vessel
#

I heard requests

slender thistle
#

no flazepe shush

restive furnace
#

I heard http

vestal rampart
#

I need help

drifting wedge
#

basically

#

so

#

i need 2 things

#
  1. a aiohttp server for dashboard to talk to bot
opal plank
#

@slender thistle no more mod? wot

vestal rampart
#

my bot is in a terrible server that I dont want it to be in due to what the server is about and they wont kick the bot, how would I make a command that would leave the server?

modest maple
drifting wedge
#

and 2. a way to find what proccess/shard a guildID is in

opal plank
#

welcome to the blu chad squad shiv

restive furnace
vestal rampart
drifting wedge
#

ah

#

so

opal plank
#

SHIIIIIIIIIIIIIIIIIIIIIIIIIIIV

#

we got a py here

modest maple
#

get the guild

#

await guild.leave()

drifting wedge
#

await guildOBJECT.leave()

#

@opal plank i do py

restive furnace
#

i still bet its guild.leave()

slender thistle
#

get_guild, .leave()

restive furnace
#

yes

drifting wedge
#

dummy

restive furnace
#

i was righhtttt

drifting wedge
#

😦

opal plank
drifting wedge
#

saMEE

#

#pingshivclub

vestal rampart
#

I am so confused, can someone please dm me if you know how to do it ❤️

opal plank
#

both of them already told you how to use it

slender thistle
vestal rampart
#

But where do I put that? in the console? or like how do I put that into a command

drifting wedge
#

@slender thistle well yea

slender thistle
#

I'm sure you could figure that part out on your own

drifting wedge
#

i need a way to send it to the speicific cluster

slender thistle
#

As for the shard...

modest maple
#

gotta code it yourself

drifting wedge
#

well yea

modest maple
#

WS or just REST requests mmLol

slender thistle
#

yeah chill you can take over cuz I don't know shit there

vestal rampart
slender thistle
#

LMFAO

drifting wedge
#

@modest maple i could set up a local server doe?

#

just localhost?

#

since will be on same server

#

dashboard and bot

vestal rampart
#

This is what I tried to do but it didnt work

    @commands.command()
    async def leaffs(self, ctx, guild_id: in ):
        guild_id = message
        guild = await self.client.get_guild(int(guild_id))
        channel = guild.system_channel
        await channel.send("Leaving this server due to misuse!")
        await guild.leave()```
modest maple
#

👀 You know local host is local right, so if its local what's the point of your dashboard

drifting wedge
drifting wedge
#

like dashboard backend

slender thistle
slender thistle
#

can you do guild: discord.Guild?

lucid prawn
placid iron
#

@slender thistle yes

lucid prawn
#

and it didnt break

slender thistle
#

Even better

modest maple
#

or might still be a pr

placid iron
#

😩

slender thistle
#

Well, my previous option then

slender thistle
opal plank
#

i dont think i would survive py

#

see those fancy ass names yall got?

#

self

#

ctx

slender thistle
opal plank
#

all that would be thrown in the garbage in my code lmao

#

client, payload, guildId

#

cuz fuck the rest

drifting wedge
#

@modest maple instead of setting up an aiohttp server, could i just set up the ipc on the clusters?

modest maple
#

shrug Test shit out

drifting wedge
#

mhm

modest maple
#

this links back to the whole dont cluster stuff when you dont need to because it makes your shit 10000% more complicated

drifting wedge
#

@modest maple alr

#

can you explain why i cant just set up a instance just for this?

#

like ik i shouldnt

#

but im not sure WHY

modest maple
#

i mean you can

#

but then you login every time you make a worker

#

you eat up a large amount of ram per worker

#

you connect to the websocket every time

#

extra bandwidth used from events etc...

drifting wedge
#

wdym pet worker?

#

per*

modest maple
#

your webserver should run 2 * your_servers_core_count

#

e.g. 8 cores = 16 workers

#

so thats 16 bot instances

drifting wedge
#

the webserver is running 16 webservers?

#

wot

modest maple
#

no the webserver spawns child processes

drifting wedge
#

oh

#

alr so thats not a good idea

modest maple
#

typically gunicorn etc... spawn 2 * the core count

drifting wedge
#

mhm

#

so i could setup ipc for the clusters

modest maple
#

hence why i said... its a bad idea

drifting wedge
#

or a webserver for the clusters

#

like an aiohttp

quartz kindle
#

you guys wanna see how much js objects are bloated?

lyric mountain
#

I JUST F****N IMPLEMENTED HOTSWAP HELL YEAH

drifting wedge
#

ig so

near plover
opal plank
#

hence why u use Typescript

#

and dont you dare tell me ts is js

#

shh

#

stop writing

misty sigil
#

what if I don’t wanna use ts

#

no

opal plank
#

then frick u

misty sigil
#

where n when

quartz kindle
#

enjoy

misty sigil
#

thanks tim

#

did enjoy

opal plank
#

imagine not converting to human redable

summer torrent
#

so c++ best

opal plank
#

shame on u tim

quartz kindle
#

who cares about human readable

opal plank
#

frick u

quartz kindle
#

we are machines

misty sigil
#

beep boop

opal plank
#

ha, pass this captcha then

misty sigil
#

I cannot.

quartz kindle
#

btw you see that FTSet there? thats my lib that works on strings only. which means, if you convert the entire data to string, it uses 3x less ram

summer torrent
#

tim can convert bytes to human readable

misty sigil
#

so

#

tim pog basically

flat pelican
#

Okay, I think it's the first time I need help in #development

misty sigil
#

nohello smh

quartz kindle
modest maple
#

🤣

solemn latch
#

welcome eri

misty sigil
#

it’s more a nohello tbf

flat pelican
#

it returns this weird websocket error

#

but nothing else

modest maple
#

what error

#

also what guild count

flat pelican
#

21k

misty sigil
#

weebsocket is closin

modest maple
#

on one instance?

flat pelican
#

yeah, I mean 20k guilds in a single instance should be fine tho as long as you use shard it correctly?

modest maple
#

erm well

#

not really lol

misty sigil
#

twinty shards

flat pelican
#

I'm using an autosharded client rn

modest maple
#

do you have members / presence

flat pelican
#

only have members

modest maple
#

whats your server specs?

flat pelican
#

I have members chunking disabled

#

2cores and 3GB RAM

#

the bot is using 1,2GB

modest maple
#

do you have the logging Info at hand?

near plover
#

anyone happen to have a suggestion for an ORM for java?

modest maple
#

in-all likelyhood your at the max you can support on a single instance

opal plank
#

@flat pelican can you eval stuff?

flat pelican
#

Where am I supposed to get the logging info, except my console?

opal plank
#

check os cpu and threads if they are getting clogged

modest maple
#

logging.basiconfig(level=logging.INFO) put that at the top of your main file

flat pelican
#

eval seems to be working for 1/5 of times

opal plank
#

does the vps have a montiro for that?

modest maple
#

can you get your cpu usage btw

opal plank
#

im under the suspicion it might be clogging some threads and disconnecting

eternal osprey
#

hey so i have actually put an image in top.gg as background

modest maple
#

20k is pretty high for a single instance to support

eternal osprey
#

however, it is not showing the image when i submit it? Only works in preview

opal plank
#

yeah dont trust preview

#

its borked

eternal osprey
opal plank
#

change the style with console

#

yeah preview is borked

#

broken

#

not working

eternal osprey
#

ah okay.

#
<style>
  body {
  background-image: url(https://wallpaperaccess.com/full/1204217.jpg);
  background-color:#FF0000;
}
</style>
```this is what i've done. Doesn't seem to work.
#

But it worked before.

#

So i've got no clue what's up.

opal plank
#

im fairly ceertain you need to tag a specific class

#

.class {css}

modest maple
#

body should work

opal plank
#

though i could be VERY mistaken

modest maple
#

but you probably need to force override it with !important

flat pelican
eternal osprey
opal plank
#

dunno then

eternal osprey
#

It just stopped working after a few months.

modest maple
#

looks pretty reasonable that you're just maxing out at the most your server can support per instance guilds wise

#

just looking at those spikes

solemn latch
#

those spikes look like less than 60%

modest maple
#

yeah you'd expect that

eternal osprey
#

is it maybe because i am forcing dark page?

modest maple
#

you shouldnt see a python process using 100% ever because it cant realistically

flat pelican
#

60-66% for the spikes

solemn latch
#

oh its python 👀

flat pelican
#

yeah

tranquil geyser
opal plank
#

thats why i havent touched anything further, i can only assist with stuff outside of coding language here

modest maple
flat pelican
#

Sure sure

#

give me a sec

modest maple
#

so all those WS error happen before any shards identify?

#

or is it docker just repeating logs

flat pelican
#

I don't use docker

modest maple
#

ah thats what im looking for

flat pelican
#

Wait

modest maple
#

i mean this is concerning but shouldnt be blocking that much

flat pelican
#

is it really blocking because requests fails to post stats?

modest maple
#

it shouldnt be for that long

#

it'll have a affect but it shouldnt be causing those timeouts

flat pelican
#

Lemme try to remove it, just in case

modest maple
#

mhmm

placid iron
#

why are you using requests

drifting wedge
#

@flat pelican do you have termius premium?

#

u get it with github edu

flat pelican
flat pelican
modest maple
drifting wedge
#

@flat pelican u should be using aiohttp

#

requests is sync

flat pelican
modest maple
#

ehhh i wouldnt really care that much then

drifting wedge
#

@flat pelican still should use async

#

sync stuff can really fuck stuff up

modest maple
#

litterally doesnt matter that much

drifting wedge
#

i mean theyres no reason not to

modest maple
#

i doubt that request is take several seconds to send a request

drifting wedge
#

@modest maple true

#

@flat pelican happens to me a lot

#

also

#

"websockets are closing"

placid iron
#

with aiohttp you can use a session which is poggers

modest maple
#

thats concerning considering your bot is small

drifting wedge
#

its literally just a waiting thing

modest maple
modest maple
drifting wedge
#

for me it was

#

:/

flat pelican
#

shards are waking up, let's see

drifting wedge
#

then what is it?

modest maple
#

pithink Then your code is causing some really serious issues

drifting wedge
#

if u know what it is u can help me lol

modest maple
#
  1. your internet is so bad it doesnt let the bot chunk in time blocking heartbeats
  2. your server is so week that your single instance cant cope with the influx of events
  3. your code is blocking in some way causing hearbeats to be skipped
#

which reminds me

flat pelican
#

I got my on_ready event

modest maple
#

@flat pelican do you chunk manually or default?

flat pelican
#

manually, yeeted the default because it was literally taking 100 MINUTES to chunk everything

modest maple
#

yeah do be like that

tardy hornet
#
case 'lb':
  var money = db.fetch(`money_${message.guild.id}`)
  let content8 = "";

  for (let i = 0; i < money.length; i++) {
    let user8 = bot.users.get(money[i].ID.split('_')[2]).username

    content8 += `${i+1}. ${user8} ~ ${money[i].data}$\n`
  }
    const leaderboardembed = new Discord.MessageEmbed()
    .setAuthor(`${message.guild.name} - Leaderboard!`, message.guild.iconURL)
    .setDescription(content8)
    .setColor(bsc)

  
message.channel.send(leaderboardembed)
break;

it should work as a server leaderboard, but it send an error that its 2000+ in length

modest maple
#

how you managed to get to 20k without this before amazes me tbh

drifting wedge
#

@modest maple my on_message event is really fucking up my bot

#

like its causing it to never get "ready"

flat pelican
#

I don't think clustering is needed on 20k tbh

modest maple
modest maple
flat pelican
#

Uhm

#

I think requests was causing that

modest maple
#

bearing in mind your only a single instance and most servers have a rather low clock speed

#

presence accounts for alot of load but still pretty high

flat pelican
#

What's the ratelimit for webhooks?

modest maple
#

standard message ratelimit

flat pelican
#

like, I just use it to post and log error messages

#

when a command errors out

modest maple
#

you got multiple webhooks on that channel?

flat pelican
#

only one

#

it just posts an embed with a small traceback

#

i'Ll check that later I guess

modest maple
#

how often is it doing it though

flat pelican
#

when a command errors out... so it's not supposed to happen every seconds lol

#

i'd say 1 time every minute, I get some errors for unchunked guilds

#

I'll check that later

modest maple
#

you sure you're not hitting global then with all the shards etc... if this is on startup?

flat pelican
#

but btw, the root cause of this whole shitstorm was requests

flat pelican
vernal moth
#

how do I make my bot page have server count?

quartz kindle
vernal moth
#

oh

#

so i need to npm i something?

misty sigil
#

no

modest maple
flat pelican
#

probably yeah

modest maple
#

logins are normally really quite heavy on your ip ratelimit

vernal moth
#

i don't see token anywhere on my profile ;-;

modest maple
#

bot -> edit -> webhooks

flat pelican
#

I think it was hitting the ratelimits today because of this issue, it probably attempted to post too much stuff in there

vernal moth
#

now i gotta update

flat pelican
#

Btw, thanks @modest maple and @opal plank for the help ❤️

modest maple
#

👍

tardy hornet
#

can someone who understand quick.db help me please?

vernal moth
#

so I put autoposter in my code

#

is this my problem or the server is down?

pale vessel
#

just wait

vernal moth
#

okie

vernal moth
tardy hornet
#
case 'lb':
  var money = db.fetch(`money_${message.guild.id}`)
  let content8 = "";

  for (let i = 0; i < money.length; i++) {
    let user8 = bot.users.get(money[i].ID.split('_')[2]).username

    content8 += `${i+1}. ${user8} ~ ${money[i].data}$\n`
  }
    const leaderboardembed = new Discord.MessageEmbed()
    .setAuthor(`${message.guild.name} - Leaderboard!`, message.guild.iconURL)
    .setDescription(content8)
    .setColor(bsc)

  
message.channel.send(leaderboardembed)
break;

it should work as a server leaderboard, but it send an error that its 2000+ in length, i want it to show the top 10 in the server that the command was sent.

uncut swallow
vernal moth
#

oh

#

you use discord.js?

uncut swallow
#

yes

vernal moth
#

ok

#

so

mellow kelp
#

he's basically top.gg's official stackoverflow

vernal moth
uncut swallow
#

i need to install 2?

vernal moth
#
const ap = AutoPoster('insert token here', client)

ap.on('posted', () => {
  console.log('SYSTEM> Posted stats to top.gg')
})```
uncut swallow
#

thanks

vernal moth
uncut swallow
#

ok

vernal moth
#

but you can install both

#

do you know how to get your token?

uncut swallow
#

yes

vernal moth
#

it's not the same as your bot's token

uncut swallow
#

yes i understand

vernal moth
#

okie :3

#

you are welcome :))

uncut swallow
vernal moth
#

i put it at the beginning but you can put it anywhere except inside events

uncut swallow
#

oh thanks

vernal moth
#

like this

uncut swallow
#

ohh epic

mellow kelp
#

shouldn't you be using new though?

glossy spoke
vernal moth
#

wat

mellow kelp
#

new AutoPoster('thing')

glossy spoke
#

add a new before that AutoPoster

glossy spoke
sturdy dock
#

would this work using internal sharding?

#

or would i get rid of the "servercount" since shard id and shardcount are already there

vernal moth
#

oh

#

you wanna put it in my on ready function?

mellow kelp
# sturdy dock

i think you have to use broadcastEval to get the guild count

sturdy dock
#

oh the topgg api doesn't add up the shard servers?

mellow kelp
#

not sure

sturdy dock
#

i thought each shard reported servers seperately to the api based on id

mellow kelp
#

hmm

sturdy dock
#

i'm probably wrong

mellow kelp
#

no idea, haven't used shards yet

#

you could use topgg-autoposter

#

i guess it'll handle shards correctly

vernal moth
sturdy dock
#

probably

#

but i'm using internal sharding

mellow kelp
#

o

sturdy dock
#

yeah i'll just go with that, thanks

mellow kelp
#

aight, np

vernal moth
#

so my code is wrong?

uncut swallow
#

what is shards?

earnest phoenix
tardy hornet
#

cry, you understand a bit of quick.db and arrays? @earnest phoenix

earnest phoenix
#

i never used quickdb

#

so im basically useless here

tardy hornet
#

k nvm then, ty tho

uncut swallow
#

the server count is fine in the principal page ,but why dont show ??

cosmic phoenix
#

the server count only shows on the bot's page, search/list and widget

#

not on the user profile

uncut swallow
#

oh thanks

#

for the information

#

why the command for the server count in 5 minutes say's : time out

#

only solution?

lyric mountain
#

am i supposed to be excited for this?

uncut swallow
#

TopGGAPIError [Top.GG API Error]: 504 Gateway Time-out
at Api._request (D:\DATA.C\Documents\bot_sandwich\node_modules\topgg-autoposter\node_modules@top-gg\sdk\dist\structs\Api.js:74:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Api.postStats (D:\DATA.C\Documents\bot_sandwich\node_modules\topgg-autoposter\node_modules@top-gg\sdk\dist\structs\Api.js:94:9) {
response:

#

what is it?

#

is a error from autoposter

mellow kelp
uncut swallow
#

xd

mellow kelp
#

or maybe it's your internet connection

uncut swallow
#

uhmmm probabbly

snow urchin
#

the error is coming from data.append

wise umbra
#
embed.attachFiles([{ attachment: canvas.toBuffer(), name: 'sample.png'}])

Not sure what's happening, but i'm not being able to set the image onto the Embed and i tried .setImage not sure whether i did it right or wrong.

lyric mountain
#

you use attachments://name.extension on embeds

#

then u send files with the message

lyric mountain
#

preblomo

#

postblomo

drifting wedge
#
NameError: name 'client' is not defined```
#

when im starting ipc

#

and also, if i have 2 clusters, how will the ipc like choose which one to connect to?

#

@modest maple sorry for the ping

#

but any ideas?

drifting wedge
#

like if i have 2 clusters how will i connect to both of them?

modest maple
#

you cant use it for multiple clusters like that

drifting wedge
#

so just running another instance without caching anything would be a good option?

#

like it wouldnt use resources

#

and it wouldnt respond to commands?