#development

1 messages · Page 1306 of 1

balmy anchor
#

@balmy anchor Best way to do this is

let channels = [...<Guild>.channels.cacge.array()];

let permissionSetInterval = setInterval(() => {
if (!channels.length) return clearInterval(permissionSetInterval);

channels[0].overwritePermissions(<overwrite here>);

channels.splice(0, 1);
}, 180000);```

@earnest phoenix ok ill try thx

shell sand
#

Im trying to figure and find a bot that does response and reminds like this
@shell sand can someone help

balmy anchor
#

@earnest phoenix what am i supposed to put in overwrite (sorry im pretty new to all this djs and js thing)

cinder sandal
#

you can use

#

setTimeout

#

or

earnest phoenix
#

The overwrite you want to apply in the channel

cinder sandal
#

setInterval

balmy anchor
#

like setting permissions and these things?

earnest phoenix
#

Yes

faint prism
#

what are you trying to do

#

you need a margin from that login button and the form

dark kestrel
#

make the login center

trim saddle
#

that's not specific

balmy anchor
trim saddle
#

how exactly do yo want the page to look

faint prism
dark kestrel
#

make the form to ceneter

#

@faint prism i tried

trim saddle
#

margin: 0

faint prism
#

You tried all those methods?

#

And none of those worked?

#

there is like 20 different ways to center it, and 0 worked for you?

earnest phoenix
#

@balmy anchor instead of that do this

channel[0].updateOverwrite(<Role ID>, {
deny: []
});```
pale vessel
#

if only that site is public

delicate shore
faint prism
#

Auger#8261 i tried
@dark kestrel send link to the site

dark kestrel
#

nope i fixed

#

@faint prism and it is localhost

balmy anchor
#

It didnt worked @earnest phoenix

boreal iron
#

make the form to ceneter
margin: 0 auto; on the prev div or table tag

earnest phoenix
#

@balmy anchor How so?

balmy anchor
frosty saddle
#

Can somebody help me

#

I wanna make a .invite and then a link

#

Of the bot

earnest phoenix
#

discord.js can generate you a link for that

#

client.generateInvite() i think

#

or createInvite()

frosty saddle
#

Oki thnx

earnest phoenix
#

if not, refer to docs

balmy anchor
#

This is what i did
@balmy anchor @earnest phoenix

earnest phoenix
#

How do I put my bot on streaming?

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

@balmy anchor What are you trying to put in deny: ?

balmy anchor
#

send messages

earnest phoenix
#

Oh

#

Instead of deny: do

SEND_MESSAGES: false```
#

What lib
@sage bobcat I do not understand

balmy anchor
#

wait ill try

earnest phoenix
#

How do I put my bot on streaming?

still merlin
#

what libary are you making your bot in

earnest phoenix
#

Repl it

sage bobcat
#

One message removed from a suspended account.

balmy anchor
#

It doesnt works @earnest phoenix

earnest phoenix
#

Discord.js @sage bobcat

balmy anchor
earnest phoenix
#

client.setPresence

#

Discord.js starter**

#

bruh

#

Please someone responds

ember lodge
earnest phoenix
#

@ember lodge gateway intenets?

ember lodge
#

Yeah

earnest phoenix
#

does your bot use them

#

you need to be verified again to use them iirc

ember lodge
#

I mean, it is necessary for +100 guilds

earnest phoenix
#

did you start using them AFTER verification

#

discord probs didn't check tbe intent stuff or smth

#

can u send me the embed message code

#

?
?

ember lodge
#

Yeah, like 2 months after it got verified BobaYep

earnest phoenix
#

can u send me the embed message code
@earnest phoenix spoonfeeding

#

no what language
@sage bobcat Discord.js starter

#

we can teach you the basics tho

#

@balmy anchor What doesn't work tho

balmy anchor
#

it doesnt even add the role to the channel's options

earnest phoenix
#

It will edit them every 3 minutes

#

imma go play among us bye guys

#

To prevent api abuse

balmy anchor
#

bye

#

ok

#

can i make it faster?

#

or it must be 3m?

earnest phoenix
#

The ratelimits are mostly unknown so 3 minutes would be best to avoid API abuse

balmy anchor
#

but what happens if u api abuse i dont understand?

earnest phoenix
#

How can I put my bot on streaming mode? On the Repl it platform

#

If you do, your bot gets ratelimited, and while it's ratelimited, it can't do anything @balmy anchor

balmy anchor
#

oh

#

i understand now

deep hornet
#

How do I host my bot for free?

hearty wren
#

why repl it and not heroku ?

balmy anchor
#

so after the first edit it'll wait 3m and then edit again?

earnest phoenix
#

None of the repl, glitch or heroku are recommended because they're not meant for bot hosting

#

@balmy anchor Yes, but even for the first edit it's gonna wait 3 minutes

balmy anchor
#

ohh

#

ok

#

so ill just wait tho lol

#

@earnest phoenix do u have any simple mute command?
cuz im spending like 2 days trying to make it

earnest phoenix
#

Mute commands are made best with a database, so a mute time doesn't get reset after restart, if you want a simple mute command without time, it's easy

dark kestrel
#

Finnaly im done with the comunication betwen bot and web

#

using express

balmy anchor
#

Mute commands are made best with a database, so a mute time doesn't get reset after restart, if you want a simple mute command without time, it's easy
@earnest phoenix I dont care about timing and these

#

omg

#

it was channel and not channels

#

loll

earnest phoenix
#

bruh you missed an s

balmy anchor
#

lmao

dark kestrel
#

help me my css is not launching

#
boreal forum
#

How i can do that my bot add custom emotes on message?

dark kestrel
#

ooh

#

it works now

earnest phoenix
#

@boreal forum Get the emoji or use it's identifier

#
<:Emoji Name:Emoji ID>```
delicate shore
#

@earnest phoenix I love you ❤️

#

It worked

#

Thansk

#

Thanks

earnest phoenix
#

Np

delicate shore
#

One more thing

#

Like you taught me the token one

#

Can I do it with prefix

#

By first declaring prefix as null

balmy anchor
delicate shore
#

Then whatever person enters will take value

#

Of prefix

earnest phoenix
#

I mean, if you have a prefix variable, it's possible, like really

boreal forum
#
<:Emoji Name:Emoji ID>```

@earnest phoenix No bro

earnest phoenix
#

@balmy anchor Which version of discord.js are you using?

balmy anchor
#

how do i check it?

earnest phoenix
#

npm ls discord.js

balmy anchor
#

12.3.1

earnest phoenix
#

show the code

balmy anchor
delicate shore
#

I was thinking something like

Let prefix = null

module.exports = {
prefix: function prefix(string) {
prefix = string
return prefix
}
};

earnest phoenix
#

Why did you remove the ...

delicate shore
#

Idk if it would work

balmy anchor
#

?

earnest phoenix
#

Go back and look at my code

#

I had a ...

delicate shore
#

You are saying me ?

earnest phoenix
#

No i was talking to finally

delicate shore
#

Oh sorry

balmy anchor
earnest phoenix
#

Yes

balmy anchor
#

ok ill try now

humble wasp
earnest phoenix
#

I was thinking something like

Let prefix = null

module.exports = {
prefix: function prefix(string) {
prefix = string
return prefix
}
};
@delicate shore I mean, the prefix shouldn't be null because it would mess up the bot

#

At least make it !

balmy anchor
#

use member.guild.roles.cache.find() i guess

delicate shore
#

Ok

#

How can I warn user if prefix isn't there then it says prefix not found so prefix set to ! By default

humble wasp
#

use member.guild.roles.cache.find() i guess
@balmy anchor Why if in () have role => role.name ???

delicate shore
#

@delicate shore I mean, the prefix shouldn't be null because it would mess up the bot
@earnest phoenix
And rear is fine ?

balmy anchor
#

just add the things u need to add in the ()

humble wasp
#

just add the things u need to add in the ()
@balmy anchor Hallooo is already in

balmy anchor
#

but add the .cache
"Haloooo"

#

@earnest phoenix its working but is there a way that it'll not be an api abuse and i can make it faster?

delicate shore
#

Voltrex to be typing for so long

balmy anchor
#

xD

earnest phoenix
#
let prefix = "!";

module.exports = {
prefix: function prefix(string) {
if (!string || typeof string !== "string" || string.length > 10) throw new TypeError("Expected a string and it's length must be between 1 to 10");
prefix = string;
return prefix;
}
};```
#

@delicate shore There it's

balmy anchor
#

@earnest phoenix its working but is there a way that it'll not be an api abuse and i can make it faster?
@balmy anchor

earnest phoenix
#

@earnest phoenix its working but is there a way that it'll not be an api abuse and i can make it faster?
@balmy anchor Idk but you can try 1 minute if you want

balmy anchor
#

ok ill try

#

its in milliseconds right?

earnest phoenix
#

Change 180000 to 60000

delicate shore
#

Thanks voltrex

#

I love you ❤️💛💛💛💛💛💛💛💕💛💕💛💕💛💛

tardy hornet
#

if my bot have admin perms, i know how to make him that he wont respond in a channel, but i want to make it a command, so everyone could, is it possible?

balmy anchor
#

me 2
@earnest phoenix WidePeepoHappy

earnest phoenix
#

Np

balmy anchor
#

lmao this sticker

earnest phoenix
#

@delicate shore @balmy anchor dblpat

charred geyser
#

we need spooky dbl pat pat

delicate shore
balmy anchor
#

@earnest phoenix some of the channels dont have didnt override or something

charred geyser
#

we also need to keep this channel development only 😄

balmy anchor
#

the most of them did

earnest phoenix
#

¯\_(ツ)_/¯

balmy anchor
#

lol

#

voltrex u think i should make a setup command to do this override thing?

earnest phoenix
#

What kind of setup

balmy anchor
#

idk like
!setup <what do u want to setup like mute and these>
and then it does that

earnest phoenix
#

Maybe, perhaps

tardy hornet
#

if my bot have admin perms, i know how to make him that he wont respond in a channel, but i want to make it a command, so everyone could, is it possible?

faint prism
#

Might need to reword that a bit better... A bit hard to understand what you mean

tardy hornet
#

ok

#

my bot have admin perms, so he can type in every channel, and i want to make a command for example: !disable and then if someone type in that channel that i "disable" the bot wont respond.
is it possible?

hearty wren
#

guys, is eval() in js same as in python ? and would a bot need that?

tawdry glacier
#

Hi, I want to know how to do an advantage when someone votes for my server, they get the rank of voter, how do I do it😭

#

?

faint prism
#

my bot have admin perms, so he can type in every channel, and i want to make a command for example: !disable and then if someone type in that channel that i "disable" the bot wont respond.
is it possible?
@tardy hornet Yeah, you'd need to have your bot remember to not respond in that channel. This would require a database to store channel IDs

balmy anchor
#

@earnest phoenix Thanks for everything you very very helped me! Hearts

earnest phoenix
#

@balmy anchor dblpat

balmy anchor
tawdry glacier
#

plz help me

faint prism
#

plz help me
@tawdry glacier You'd need to use DBL's api to check for votes

tawdry glacier
#

@faint prism how ?

faint prism
#

They can help you with that in #topgg-api
And once you have a list of all the voters, you can just assign a voter role to the user in your guild

earnest phoenix
#

Why DBL's api?

#

He said server

faint prism
#

he wanted voters, I assumed he meant on dbl

earnest phoenix
#

DSL's api possibly?

flint yew
#

anyone help with problem sqlite

#

sql.get is not a function

tawdry glacier
zinc condor
#

tip, use waifu.pics instead of nekos.life, DBL people dont like nekos.life because it has an alarming number of ToS disallowed content even in their normal sections. waifu.pics allows user uploading and also has mod team for verifying and deleting illegal posts that somehow made it through on accident. Basically, its better and your bot wont get blocked

#

dorime also its hosted like... normally and not in such a way that it could die at any moment because some dumbass decided to restart nginx

flint yew
#

?

#

?

mild flower
#

hey im having trouble exporting and importing the client from the main index file to one of the commands

zinc condor
#

@flint yew im talking about anime image api's

flint yew
#

ah k

zinc condor
#

dbl doesnt like the popular public one

#

PepeLaugh just saying theres an alternative

mild flower
#

just @ me if you have an answer

#

hey im having trouble exporting and importing the client from the main index file to one of the commands

tawdry glacier
#

plz help me

#

plz

balmy anchor
#

@earnest phoenix do u know how do I use:

    channels[0].updateOverwrite(role.id, {
        SEND_MESSAGES: false
    });

only for text channels?

quartz kindle
#

channels.filter(channel => channel.type === "text")

balmy anchor
#

oh

#

i didnt thinked about it

#

ill try thx

#

Tim do u know what's the minimum time to api abuse maybe?

drifting wedge
#

how can i make the prefix for my bot a variable or a mention?

#

and how can i like send something when the bot is mentioned?

tardy hornet
#

@tardy hornet Yeah, you'd need to have your bot remember to not respond in that channel. This would require a database to store channel IDs
@faint prism
i cant, i tried and apparently i cant because i do it with js, not py

quartz kindle
#

@balmy anchor there is no minimum time

#

they consider api abuse any form of continuous automated requests that are not initiated by users

#

you will be fine if you make it reasonable tho

#

which particular request are you thinking about?

balmy anchor
#

i fixed it already but thx

blazing portal
#

Is there a way I can find a guild member by display name that is not in the cache via discord.js?
If I do guild.members.cache.find(...) it does not account for the uncached members...

quartz kindle
#

yes

#

guild.members.fetch({query:"abc",limit:10})

#

i believe the max limit is 100

#

that returns all guild members with abc in their names

blazing portal
#

Oh right, the fetchmemberoptions. Thanks, I can figure it out from here ❤️

quartz kindle
#

not sure if it works on nicknames or only on usernames tho

blazing portal
#

I'll test it. thank you 🙂

#

Also works with nicknames!

faint prism
#

@faint prism
i cant, i tried and apparently i cant because i do it with js, not py
@tardy hornet You definitely can do it lol.
If you can do it in one language, you can do it in another

harsh blade
sudden geyser
#

Not always the case, but you can definitely block your bot from responding to messages in a certain channel

compact echo
#

<Client>.user.setActivity('Activity', { type: "WATCHING" }) @harsh blade

tardy hornet
#

@tardy hornet You definitely can do it lol.
If you can do it in one language, you can do it in another
@faint prism when i dowloand quick.db its sending errors that is saying that i dont have py

harsh blade
#

Thank u guys

obtuse wind
#

Should (below) work? cause im getting target.hasPermission is not a function as an error

const target = message.mentions.users.first();
if(target.hasPermission("KICK_MEMBERS")) return errors.equalPerms(message, User, "Kick members")

umbral zephyr
#

no

#

it has to be in one line

faint prism
#

@faint prism when i dowloand quick.db its sending errors that is saying that i dont have py
@tardy hornet You're trying to do this in JavaScript right?

#

If so you should be using NPM

tardy hornet
#

i am

still merlin
#

@obtuse wind what is target defined as?

obtuse wind
#

the first mention

#

of a message

still merlin
#

oh sorry didnt see that

pale vessel
#

it needs to be a member

#

that would be mentions.members

earnest phoenix
#

how to get Ip of website visitor in html

pale vessel
#

why

earnest phoenix
#

I want to make purchase system

#

so i need to know ip to stop scam

#

;-;

obtuse wind
#

oh im dumb 🤦‍♀️

#

and Empty i dont think this server supports website development (stated in channel topic)

tardy hornet
#

why it send it like that

earnest phoenix
#

is development

pale vessel
#

we went through this 500 times

faint prism
earnest phoenix
#

=E

pale vessel
#

doctor

tardy hornet
#

ik

#

but i still dont get it

pale vessel
#

we even told you why

tardy hornet
#

sometimes it do it right

#

and sometimes not

faint prism
#

Send code

tardy hornet
#
.addField(`host: ${message.author}`,  "\u200b" )
faint prism
#

I'm going to need more than that

obtuse wind
#

@tardy hornet doing message.author.tag works best it'll post the name like this "Doctor#6969" or if you want it to ping the person thats a dif story

tardy hornet
#

ping

obtuse wind
#

Pinging in embeds dont work on the titles

faint prism
#

No it doesn't lol

pale vessel
#

it's just your imagination

obtuse wind
#

you can put the pings on the value of the embeds and that'll work

pale vessel
#

it was probably inside a field's value instead of name

faint prism
#

You might be able to click it, but any mention in an embed isn't going to actually notify the mentioned user

pale vessel
#

or description

obtuse wind
#

unless v12 got rid of the pinging completely

tardy hornet
#

ok i fixed that

drifting wedge
#

with ytdl how do i get a songs duration?

solemn latch
#

i feel like the ytdl docs cover that

drifting wedge
#

i cant even find the docs lol

pale vessel
#

don't you use python?

#

i remember you asking about pillow

delicate shore
#

Rip my bot

#

It's verifies

#

It's only the damn intents

sonic lodge
#

if it's verified you have access to those intents right?

pale vessel
#

if they approved them, that is

quartz kindle
#

did you enabled those intents in the verification form?

#

when you fill up the form you need to say which intents you need and describe why you need them

solemn latch
#

oh gosh, thats a pain

quartz kindle
#

if you verified without the intents and then you enable those intents later, then you likely have to update your verification

#

GUILD_MEMBERS and GUILD_PRESENCES require a separate verification, sort of

#

they have to be approved separetely

solemn latch
#

im so glad i dont see any bot ill ever make need either thonkku

pale vessel
#

that is a sign that your bot is original

#

unlike mine, i needed both 😔

quartz kindle
#

one of my bots only needs GUILD_MEMBERS, and i included it when i filled the form, and it was approved for both

solemn latch
#

so, are bot owners that didnt understand this screwed now?

#

until they go through approval again

pale vessel
#

yep

#

should've read the article thoroughly

#

they gave you months

delicate shore
#

did you enabled those intents in the verification form?
@quartz kindle
No 😭😭😭

#

I just mailed

pale vessel
#

what are the links for?

solemn latch
#

bots that are already verified should get an express queue for getting the extra intents

#

i guess they kinda do since they dont need to be ID'd again

quartz kindle
#

there doesnt seem to be any way to edit your verification form, or write a new one

#

so i guess contacting them is the only option

solemn latch
#

ah, so it probably is a ton faster

#

maybe not right now, because im sure a lot of people didnt read it

quartz kindle
#

you cant even enable the privileged intents anymore in your developer page

pale vessel
#

yeah, what's up with that?

quartz kindle
pale vessel
#

mine is the opposite

quartz kindle
#

you cant disable them?

pale vessel
#

both enabled, can't be disabled

quartz kindle
#

lmao

#

true

#

this is my other bot

pale vessel
#

is it a temporary thing?

solemn latch
#

is it where it was before the change?

quartz kindle
#

it basically locks in what you have before verifying

#

once you verify you cant change it anymore

#

this is my unverified bot

#

can still change both

#

i guess they assume once you get to 75 servers you're already pretty sure about the features your bot is supposed to have, and wont really change it much anymore

#

so you have to plan ahead what you need

slender wagon
#

is there a way i can run a certain command once in a few minutes, there is a api that is supposed to autopost but it doesn't autopost on heroku for some reason, so i need to autopost manually

quartz kindle
#

use an interval?

solemn latch
#

talking about uptimerobot not working?

slender wagon
#

me?

#

?

solemn latch
#

yeah

slender wagon
#

no

#

it is some statcord thing which uses api to get information about my bot

#

but it doesn't autopost in heroku

#

is this something i should do for a certain command to run once in few mins?

#

var interval = setInterval (function () {

pale vessel
#

yeah, setInterval(function, 60000 * 2) for example

#

that will run it every two minutes

slender wagon
#

oh okay

#

ty!

quartz kindle
#

why 60000*2 and not 120000

#

lmao

slender wagon
#

what's the difference

quartz kindle
#

an extra math calculation, a waste of a couple nanoseconds

slender wagon
#

i like no extra

quartz kindle
#

xD

slender wagon
#

now i need to remind my self how i can call a function

pale vessel
#

shout the name

slender wagon
#

pooost

#

doesn't work

faint prism
#

why not 60*1000*2

pale vessel
#

😔

delicate shore
#

I disabled my intents

#

So my bot can be. Added to other servers

solemn latch
#

did you need them if they are disableable oliythink

delicate shore
#

Yes

#

For moderation command

#

Btw many people are saying npm js says my package is version 2.0.4 but I just released 3.0.4 can anyone check it for themselves?

quartz kindle
#

whats your package name?

delicate shore
#

djs-tickets

#

Lol I forgot to give name 😂

quartz kindle
#

its 3.0.4 on npm

drifting wedge
#

whats a good cooldown for commands?

quartz kindle
#

but since its a major version update, if they already have v2 installed, they need to force install it, it wont update automatically

drifting wedge
#

my bot is at 0.65 secs /guild

delicate shore
#

Thanks Tim

quartz kindle
#

my cooldown is 5 messages per 5 seconds per channel

drifting wedge
#

mine is just per guild

delicate shore
#

My package was released today only

drifting wedge
#

is that like fine?

solemn latch
#

i have a per channel and per user.

drifting wedge
#

i might raise it to .75

#

so if i like spam api

solemn latch
#

well, i have two per user and one per channel.

quartz kindle
#

discord's rate limits are per channel

drifting wedge
#

oh

solemn latch
#

which is weird, but im weird christmasthink

drifting wedge
#

how do i make it per channel? @cooldown(1, 0.65, BucketType.guild)

#

this is how i do it?

quartz kindle
#

i dont use python so idk

solemn latch
#

probably BucketType.channel

#

ay

#

that guess

#

thats actually super easy in py

still merlin
#

client.guilds.cache is returning '[Object map]' in discord.js, Can someone help me please?

solemn latch
#

bet you could have cooldowns for multiple buckets too

#

its a collection
long objects get logged as [Object]

still merlin
#

My bots only in 5 guilds though

solemn latch
#

each guild is a long object

still merlin
#

Oh

solemn latch
#

you can stringify the object to see the whole thing iirc

still merlin
#

How do I return just the guild name?

solemn latch
#

pretty sure youd map it

still merlin
#

ok ty

drifting wedge
#

should i give an error message on the cooldown? its 0.65secs/channel

#

or just ignore the command if its sent like betweeb .65 secs

solemn latch
#

I would definitely give a message.

#

I would also make sure the cooldown message isnt spammable

knotty sigil
#

why when i do this code

  if( command === "please") {
  setInterval(() => {
  const stocknew = message.channel.send({ files: ['./fortnite.txt']} )
  const stockchannel = message.guild.channels.cache.find(channel => channel.name === 'stock')
  if (!stockchannel) return;
  stockchannel.send(stocknew)
  console.log(error)
  }, 10 * 1000)
}

I get this error:

[Function: bound consoleCall] // console.log(error) i think
(node:10992) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
solemn latch
#

is the const stocknew = message.channel.send({ files: ['./fortnite.txt']} )
message being sent?

pale vessel
#

you are...sending a message a message that is being sent?

open rune
#

you are...sending a message a message?

#

message of message

solemn latch
#

i think he can do that, but the stocknew message isnt awaited

#

so theres nothing in it

pale vessel
#

why would one pass message to send()

#

edited message maybe

solemn latch
#

I was thinking logging

#

then again, not sure why one would log this

pale vessel
#

they might mean stockchannel.send({ files: ['./fortnite.txt']} )

#

is that even valid

hollow harbor
#

or probably trying to send the text inside the file

open rune
#

you'd probably need to change var stocknew to be require('./fortnite.txt')

solemn latch
#

shoot, i dont even know

pale vessel
#

shouldn't it be files: [{ attachment: <url/buffer>, name: "name" }]

solemn latch
#

all my files go through embeds christmasthink

open rune
#

embed guy

pale vessel
#

you still need to use files if you use embeds with local files

#

well i use the embed object so i need to pass that

solemn latch
#

your right

#
// Send a local file
channel.send({
  files: [{
    attachment: 'entire/path/to/file.jpg',
    name: 'file.jpg'
  }]
})

hollow harbor
#

@knotty sigil the way youre trying to send the file is only for remote images (links), to send a local file youd need

.send({
  files: [{
    attachment: "./file/location",
    name: "file.txt"
  }]
});
#

daw

#

lmao

drifting wedge
#

I would also make sure the cooldown message isnt spammable
@solemn latch well i mean its 0.65 secs

#

so i mean it could happen

#

but i dont think it would

#

?

#

should i really?

solemn latch
#

@drifting wedge ive found people love spamming once they see a cooldown message

drifting wedge
#

wdym?

pale vessel
#

attachment should be a buffer or a url iirc

#

you can't provide a path

drifting wedge
#

they should really make a dev 2 lol

#

but then ppl would cross post and id be bad

solemn latch
#

no problems for days, then once a cooldown message comes up users spam commands 40 times

#

and others join in until the bot gets ratelimited

drifting wedge
#

i made it channel limit

pale vessel
drifting wedge
#

so likt .65 sec per channel

solemn latch
#

so the cooldown message is also ratelimited?

drifting wedge
#

i dont have a cooldwon message currenntly

solemn latch
#

your question was should you add one

#

my response was that if you do, you should ratelimit it too

drifting wedge
#

yes

#

but do you tihnk i should?

solemn latch
#

i would, since users wont have any warning why the bot didnt respond

drifting wedge
#

i mean i can add in the help command

solemn latch
#

imo every command should be responded to and if something doesnt work, the user needs to be informed why

drifting wedge
#

ill just add like something

#

should i also add like a command not found?

#

or just not do anything about that?

#

i find it really annoying

#

like bot with same prefix

#

its customizable

#

but still

solemn latch
#

those are not worth adding, since its pretty standard to find commands in the help command

drifting wedge
#

alr alr

#

well ill figure it out soon

#

just started doing errors

solemn latch
#

depends on your lib and language

fringe axle
#
B = B.sort(function(a, b) {
          return b.submittedOn - a.submittedOn;
        });
        const bBots = [];
  
        for (let i = 0; i < B.length; i++)
``` Hey, so I want to set the limit length to 10 but how?
drifting wedge
#

do you guys know how can make that my bot will send a message in a channel when it's starts on?
@knotty sigil like every channel?

#

or like on a dev server?

#

its its d.py u can download a pip package which is webhooks

#

and send a webhook request

#

or u can do on_ready

pale vessel
#

like B = B.slice(0, 10)? @fringe axle

fringe axle
#

Will this work?

sudden geyser
#

@knotty sigil what library are you using

fringe axle
#

I mean everything will be listed but I want a limit of 10 @pale vessel

pale vessel
#

can you elaborate?

fringe axle
solemn latch
#

could he do something like this

i < (B.length > 10 ? 10 : B.length)
fringe axle
#

Okay

solemn latch
#

i actually dont know if this works

fringe axle
#

Okay

#

But thx

eternal osprey
#

hey guys

fringe axle
#

Not working but thx

drifting wedge
#

@fringe axle

#

can i add my bot lol?

fringe axle
#

Yes

eternal osprey
#

my code only saves 1 line of code in the txt file

#

they replace each other.

fringe axle
#

Uh, I don't know if it's advertising

eternal osprey
#

how do i fix it?

solemn latch
#

ay I think my solution works

sudden geyser
#

You could also use Math.min

ionic shard
#

how common is it for bot to lose its status randomly?

solemn latch
#

if it restarts it will iirc

ionic shard
#

i have nothing in my logs it just does it randomly

solemn latch
#

or dc's

fringe axle
#

ay I think my solution works
@solemn latch but the length is from a database and it will short very weird

eternal osprey
solemn latch
#

whatcha mean?

eternal osprey
#

it only saves 1 line and replaces the past code.

#

any solutions?

fringe axle
#

The length is a count of bots that are submittedOn

solemn latch
#

.length would be the same regardless.

#

i just happened to take the length of a string

#

but lites solution is cleaner

forest trench
#

Hi, I would like to know: as @Lyss#0001 told me, the incorrect number of shards and servers on top.gg site is coming from my side, so please can someone tell me what's wrong with my request ?
My discord bot has 36 shards for 35,980 servers but on the top.gg web page we can see only 24 shards for 26,400 servers (https://top.gg/bot/318312854816161792).
I have checked and all my requests are sent by the bot and the send interval is 3600000 (1 hour) to be sure to not overload the top.gg services.
Here the code i use to send my shards stats:

const fetch = require('node-fetch');

Client.setInterval(() => {
    fetch(`https://top.gg/api/bots/${Client.user.id}/stats`, {
        method: 'post',
        body: JSON.stringify({
            server_count: Client.guilds.cache.size,
            shard_id: Client.shard.ids[0],
            shard_count: Client.shard.count,
        }),
        headers: {
            'Authorization': process.env.topgg_token,
            'Content-Type': 'application/json',
        },
    });
}, 3600000);```
dark kestrel
#

36 shards for 35,980 servers flex

opal plank
#

@forest trench can you not use the library for it?

balmy anchor
opal plank
#

i havent looked into the actual code, i just did the typings for it, so i havent seen the outgoing payload, only the incoming

balmy anchor
#

Like in the last time it called

solemn latch
#

ive been trying to find the difference between what hes doing and what the lib does

#

and i dont see it

#

it gets the shard count, guild count, and shard Id the same way

balmy anchor
#

Is it possible to send a message when this code is over?
@balmy anchor ?

solemn latch
#

at the end of each interval? or when the interval is cleared

balmy anchor
#

when its cleared

solemn latch
#

just add brackets to your if where you clear it

opal plank
#

bad

solemn latch
#

{
send(whatever);
return clearInterval(...
}

opal plank
#

that'd return from the brackets

#

scopes woo

#

return a function

#

return only returns from scope

#

it wont stop the function from continuing

solemn latch
#

then do it twice? Thonk

balmy anchor
#

i just want to send a message whenever it ends

#

cleared or something idk lol

#

Like when u download something

#

and then in the end it says "Download Completed, Enjoy blablabla!"

opal plank
#

Again

#

You keep explaining

#

But i already understood

#

And explained what u need to do

balmy anchor
#

ok

opal plank
#

Return a function as a callback ish

#

Self invoke it

#

Pc died, sigh

solemn latch
#

rip pc

#

you will be missed

opal plank
#

Nah just restarted

#

Forced updates

solemn latch
#

ah

#

windows being windows

fringe axle
#

@solemn latch it's working! I forgot something. Thank you!

novel fjord
#

any C# botters?

fringe axle
#

@solemn latch and any idea how to shuffle it?

solemn latch
#

Randomize the order?

earnest phoenix
#

Hey, what database do you think is best to use for a website in node.js ?

solemn latch
#

I think researching that is a good option.
The pros and cons of each database is a bit much for me to explain.

cinder patio
#

Depends on the data you want to store

opal plank
#

it works

faint prism
#

@earnest phoenix Unless you want a Non-relational database

opal plank
#

it frecking werks

#

i think im ready to push the slave test to the dev server

#

passed all local tests

fringe axle
#

Randomize the order?
@solemn latch Yes

#

Best will be if you reload the page it will be short again randomly

opal plank
fervent goblet
solemn latch
#

150 listeners?

#

well 300

opal plank
#

yup lmao

#

to resolve the promises dynamically

#

since it creates a new listener, waits for it for 5 seconds max, then removes it if it didnt listen to a return

#

thats how many attempts im doing at twitch

#

this is 10000% abooze

#

i guess clustering works similarly, so it should be fine

#

under normal circumstances this test would be ran in 4 minutes, thats how long it took with cluster, barely 20 seconds

#

@solemn latch

fervent goblet
#

if i resolve the promises dynamically will it be faster?

opal plank
#

im doing a completely stupid project, dont listen to my advice lmao

#

what im attempting is completely retarded

solemn latch
#

so, like a 500% improvement?

opal plank
#

basically yeah

misty sigil
#

idiots be like: OMG @opal plank USES SLAVE

solemn latch
#

thats pretty intense

opal plank
#

and i can make it faster

solemn latch
#

i had a 300% improvement once and it was so exciting

opal plank
#

i could calculate the number of slaves and dynamically update the listeners based on the amount of slaves i generate

#

which is actually a good idea now that i think about it

#

lets try 20 slaves and see how fast i can query 40k streams

#

actually, im gonna run both side by side

faint prism
#

Using slave and master naming convention in 2020

opal plank
#

caught a little bug but this should be fine, its just visual

#

it rounds up to 1 minute, but it actually took 18 seconds

earnest phoenix
#

How does one do slaving in nodejs

opal plank
#

you dont

#

do cluster

#

and trust me, dont do it

#

your library does sharding for you

#

im creating basically sharding for twitch

#

just gonna add the dynamic slave count rq

solemn latch
#

rq, ezpz

faint prism
#

Is Manager/Worker PC?

opal plank
#

worker would be a fine name too

#

since its all internal basically

#

the libraries work exactly the same

#

just added slave count to the configs

#

time to push this bad boy

#

and run a retarded query amount and see how long it takes

faint prism
#

any C# botters?
@novel fjord Yeah. Mine is D.NET

dark kestrel
#

does my web design posible ?

obtuse jolt
faint prism
opal plank
#

this is about to go boom really fucking quick

clever thunder
#

turns text to speech on

#

i made a mistake

balmy anchor
#

Does anyone knows why it doesnt send the message in the clearInterval() ?

restive furnace
#

How I could make proper tests for my project with GitHub CI? rn I make real HTTP requests into the api, but I thought it's not the proper way doing it? How do those libraries test their stuff?

#

(if you wan't to know for some reason, my project is in JS)

faint prism
#

@restive furnace Unit Tests

balmy anchor
#

Does anyone knows why it doesnt send the message in the clearInterval() ?
@balmy anchor ?

earnest phoenix
#

./src/components/Navbar/NavigationBar.js
Module not found: Can't resolve 'mdbreact' in '/workspace/imok/client/src/components/Navbar'

restive furnace
#

@restive furnace Unit Tests
Assertion or? And how I could do that? Check the objects or smth similar what the function returned?

earnest phoenix
#

Wanna send NavigationBar.js code?

faint prism
#

Typically when you check in code, you'd have a CI pipeline run a few steps to make sure you didn't break the project:

  • Build
  • Unit Test

A Unit Test is testing "Units" or functions within your code to check if they produce the expected output, that way, if you change your code somewhere else it doesn't break another area of code

#

However (I use C# not JS, so Idk if this applies to you guys the same), you must write your code to be Unit Testable in the first place

#

To implement unit testable code, you have to write it using design patterns such as: SOLID

#

@restive furnace

restive furnace
#

Hmm

#

Got it, thank you! agooglethumbsup

balmy anchor
#

Does anyone knows why it doesnt send the message in the clearInterval() ?
@balmy anchor I fixed already doesnt matter lol OwO

faint prism
#

Abstractions and dependency inversion is the key to testable code.
The goal is to run a test for code without it spamming your database or some api like it would do otherwise in production

restive furnace
#

Alright. I'll rewrite my codebase using some design pattern - might go for SOLID.

faint prism
#

SOLID is a collection of design patterns. Good luck! It'll probably be a pretty big refactor

restive furnace
#

Yeah true, thanks.

faint prism
#

Yeah true, thanks.
@restive furnace I have a fantastic resource for implementing SOLID in C#. Obv is isn't your code base's language, but the principles are similar if you want it

restive furnace
#

Good to know

faint prism
#

Alright, lol

restive furnace
#

Well thanks for explaining me this, and I got to go. ablobwave

drifting wedge
#

i get this error when running my LL servrs

#

like when trying to start lavalink server

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

drifting wedge
#

where?

#

like how lol/

sage bobcat
#

One message removed from a suspended account.

drifting wedge
#

but like where do i change it?

sage bobcat
#

One message removed from a suspended account.

drifting wedge
#

??

#

my brain hurts

#

wuts jvm?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

drifting wedge
#

pyyytooon

opal plank
#

okay, i broke it

#

@faint prism @slender thistle @quartz kindle @misty sigil @solemn latch

#

im wheezing so hard rn

misty sigil
#

Is after broken or before

opal plank
#

i broke it in a good way

#

from 225 minutes down to 0 with sharding

misty sigil
#

pog

opal plank
#

who needs to respect rate limit when you can spawn new connections to get everything in one go?

misty sigil
solemn jolt
#

Why i have a error in this code

misty sigil
#

install opus

solemn jolt
#

@misty sigil ok

opal plank
#

guesses on how many will 100k channels be?

#

lets break it more

novel fjord
#

right on auger

opal plank
novel fjord
#

i might talk to you about your bot another time when i'm not so busy with life @faint prism

#

and coding my other stuff

grave jolt
#

Can I make a bot?

#

How do I make a bot?

opal plank
grave jolt
#

what do I do

sudden geyser
#

Read the last message in the channel

grave jolt
#

Memes-and-media

#

I mean afk?

#

Bot-hell?

solemn jolt
#
            ytdl("https://youtu.be/M7g7Pfx6zjg", { filter: "audioonly" })
          );```
blissful coral
#

(using js), what is a good package for if I input 2h it will set a timeout for 2 hours in milliseconds.

solemn jolt
#

Why the bot don't play anything?

opal plank
#

@blissful coral moment

haughty mirage
#

@blissful coral I used moment in the past for time and date stuff...

#

Lmao u type faster

blissful coral
#

Ok thanks <3

#

The double ping PING
Cry

faint prism
#

Alright, lets see if I can write my own performance testing framework

blissful coral
#

gl

misty sigil
opal plank
#

it error'd in the end cuz of the lib, that can only mean one thing

#

Not enough slaves, time to double the quota again

misty sigil
#

rate limit

opal plank
#

this shit legit joined 11k channels within 15 seconds

misty sigil
#

WHEWW

#

that’s a lot

opal plank
slender wagon
#

what's that

opal plank
#

lemme increase quota again

#

thats me aburdely abusing Twitch's API

slender wagon
#

oh

opal plank
#

800 slaves?

#

that should do the trick hopefully

drifting wedge
#

@opal plank wtf

faint prism
#

IIT: Erwin ddos twitch

opal plank
misty sigil
#

@opal plank 1200?

opal plank
#

did someone say 2000?

#

i hear 2100 in the back!

#

2200 for the lady in the corner!

misty sigil
#

3000

opal plank
#

running another test

#

will show results soon

#

im starting to think its my internals that arent handling that big ass traffic tbh

#

GOT IT

#

no errors

#

2.3 minutes

#

since 200 worked, lets see 1k

misty sigil
#

try 10k

opal plank
#

actually, lies

#

that was a lie

#

that timer counts within the population queue

misty sigil
#

I’m angyr now

opal plank
#

it took 15 seconds to get 11k

#

15 seconds for 11k

#

lets hammer it more

#

i havent seen tears yet

inland pulsar
#

pog

opal plank
#

was not expecting to have this much fun with sharding tbh

molten tree
drifting wedge
#

is arg1 a thing?

#

like arg1 arg2?

earnest phoenix
#

@opal plank Help me setup slaving on nodejs

#

pls ;P

#

I need slaves

opal plank
#

no you dont lmao

earnest phoenix
#

yea i do ;P

blissful coral
#

lol

earnest phoenix
#

why doesnt

opal plank
#

most of the libs you use already have

#

sharding/clustering

earnest phoenix
#

Im making my own lib sosad

opal plank
#

im 100% sure d.js or whatever lib you using already has it

#

why tho?

earnest phoenix
#

im messing w/u

blissful coral
#

waitWhat What is the point of making your own library

#

Oh thank god

opal plank
#

then might as well

earnest phoenix
#

I mean.. djs-light is all ur gonna need

opal plank
#

cant give too much adivcee on it though, its hella complicated

earnest phoenix
#

or even go to eris

opal plank
#

you'd need to know at least a bit of IPC and websockets to get it done correctly

#

47k in less than a minute

earnest phoenix
#

What does ur bot do

opal plank
#

totally legit

earnest phoenix
#

Seems rlly interesting

opal plank
#

30k in 15 seconds dude

#

what?

#

yeah i know im in dev, this is dev chat technically

blissful coral
#

Yeah I noticed lol sorry

earnest phoenix
#

Yo what does ur bot do, Erwin?

prisma oriole
#

imagine developing

#

these nerds ^^^

opal plank
#

lots of things, its hard to explain it all in one thing

#

its basically a all in one bot for multiple platforms

earnest phoenix
#

got a website or smth?

opal plank
#

yes and no

earnest phoenix
#

?

#

I mean a public one that shows info

opal plank
#

working on it

#

nah, stats are private

#

you'd need a login in grafana to get past it

drifting wedge
#

How do you link grafana @opal plank

earnest phoenix
#

carefully

opal plank
#

wdym how do i link it?

crisp turtle
#

lmao

drifting wedge
#

Like how does grafana have ur stats

opal plank
#

i export it

blissful coral
#

export

crisp turtle
#

probably just nginx server to a localhost grafana server or smth

drifting wedge
#

Do you input every message????!

#

Lol

opal plank
#

grafana is just graphs, you need to set everything up

#

yes

earnest phoenix
#

What kind of queue is that Erwin, guild queue?

opal plank
#

i have a counter that gets flushed and exported every 15 secs

#

thats twitch queue

#

i wanna see the slaves/workers die with this massive querry

earnest phoenix
#

are those stats even real

opal plank
#

yeah

earnest phoenix
#

HAHAHAHAH

#

LMAO

opal plank
#

its connected to all those channels in the list

#

and caching them too

#

yeah

drifting wedge
#

how do you export them?

opal plank
#

any way you want

#

theres multiple ways

earnest phoenix
#

Show us code pog

opal plank
#

hell naw

drifting wedge
#

like HOW DO YOU DO ITTTT

opal plank
earnest phoenix
#

xd

opal plank
#

private repos

earnest phoenix
#

@drifting wedge Really carefully..

opal plank
#

almost half of it done

blissful coral
#

43%

earnest phoenix
#

What happens when that ends

#

Do all the slaves die

opal plank
#

each 1 of those ticks is 100 channels cached btw

#

rn its just populating the queue with all the channels/streams

earnest phoenix
#

child processes, right?

blissful coral
#

yep

opal plank
#

once it populates the queue, it'll split the work into the workers/child processes/slaves to join them

crisp turtle
#

are you using like

#

new Worker("file.js");?

#

or what

opal plank
#

no

#

lmao

earnest phoenix
#

Who the hell named them child processes/slaves

opal plank
prisma oriole
#

const slaves = require(‘child_process’)

crisp turtle
#

oh yea

#

found it already

opal plank
#

lmao i never said it was gonna be fun

#

i just wanna see this whole thing crash

solemn latch
#

i can make it crash real quick

opal plank
#

lemme see the link rq

earnest phoenix
#

counting on it to die

opal plank
#

from 225 minutes down to 1 with slaves

#

nah, its actually connecting to them

#

just like guilds

#

we recieve messages

earnest phoenix
#

Imagine queuing

opal plank
#

events

#

gifts

#

all of it, just like discord

earnest phoenix
#

Imagine queuing xd, do it all at once

opal plank
#

it should recover fine

blissful coral
#

Wanna watch it slowly die

opal plank
#

it just recovered

earnest phoenix
#

Watching slaves die at 5AM

opal plank
#

rn, yes

low shard
#

hello

#

guys

earnest phoenix
#

fuckk that sounds wrong

#

@low shard Yo

blissful coral
#

very

opal plank
#

prob 10 more mins

blissful coral
#

Let's not say that

opal plank
#

yeah

low shard
#

@earnest phoenix you can do my dream pls

opal plank
#

i warned it wasnt going to be fun lmao

low shard
#

?

earnest phoenix
#

Yea

#

I dont make em for free tho

low shard
#

oh

#

nag

#

nah

earnest phoenix
#

broke ass

blissful coral
#

instant pass

#

LOL

earnest phoenix
#

Imagine doing development for free

#

ok this got boring im outa here

low shard
#

@opal plank wat are you doing

opal plank
#

abusing twitch

#

in t-10m

low shard
#

oh

#

lmao

#

GG

opal plank
#

brb

sweet ruin
#

(Also Please Ping Me If you Have an Answer)

quartz kindle
#

Canvas doesnt have a concept of text boundaries, it does not know when its supposed to end

opal plank
#

@quartz kindle come watch errors

#

Quick

#

You got 10 secs

quartz kindle
#

You need to calculate the text length

#

@sweet ruin

#

@opal plank i cant see anything, im on the phone lul

#

Screen too small

sweet ruin
#

Thank you @quartz kindle !

#

I went ahead and did a slice on the original recieved msg

quartz kindle
pure lion
#

@sweet ruin measure the text and if it goes over then wrap the line

#

You can do this with the measureText function that Tim just linked fuck

quartz kindle
#

lmao

pure lion
#

:( speedy tim

sweet ruin
#

xd

opal plank
#

@quartz kindle i just casually joined 100k channels on twitch within 5 minutes

crisp turtle
#

lmao

opal plank
#

i legit might implement this on my main bot

balmy anchor
#

Does anyone know what is the method to check if a member has a specific role

#

?

opal plank
#

member => roles => cache if you have caching enabled => has (roleid)

balmy anchor
#

ok thx

opal plank
#

yes it is @sand dune

#

put a \ and post an emoji to see its actual name, thats what you put on the bot

#

for example

#

\dance

#

type that

#

just type that

#

\ and then an emote

obtuse jolt
#

how can I get the current shards id

#

for like error logging

earnest phoenix
obtuse jolt
solemn latch
#

docs cover it

obtuse jolt
#

i cant find anything for it in docs

solemn latch
#

djs?

obtuse jolt
#

yes

solemn latch
#

client>shard>ids

obtuse jolt
#

shard 1 doesn't give the error

solemn leaf
#

Does MANAGE_ROLES also let you edit the roles a member has?

obtuse jolt
earnest phoenix
#

How can I install music bot on windows?

solemn latch
#

typically you make them, or use someone elses

sweet ruin
#

am I doing this right?

#

because it seems to be adding the - onto any string and ignoring the tweetmsg charAt check :/

#

ping me if you can help me

pure lion
#

What's the difference between from {} import * and import {}?

coral stirrup
#

because it seems to be adding the - onto any string and ignoring the tweetmsg charAt check :/
@sweet ruin && instead of &