#development

1 messages · Page 1213 of 1

earnest phoenix
#

or that the style tag is in the ehader

#

go dms

#
<html>
<head>
</head>

<body>
  <style>
    body{
       background-image: url("https://images.app.goo.gl/56jXM17CEnESWa927");
        }
</style>
</body>
</html>
#

do that

#

you dont have body defined in ur file

#

or the style tag is above the body tag

#

so it doesnt work as it says it doesnt exist

#

@steep shale

steep shale
#

Oh damm that makes sense

#

I just started css today so i still dont know much

pure lion
#

new ubuntu vps cant install anything from apt, running v18.10

earnest phoenix
#

?

#

send ss

#

do sudo apt?

pure lion
#

im root

earnest phoenix
#

send ss of error

pure lion
earnest phoenix
#

where ur vps from

#

u might need to add a txt file conatining name servers

misty sigil
#

witherhosting

pure lion
#

^yeah what he said

earnest phoenix
#

lsb_release -r

#

run that

misty sigil
#

release: 18.10

steep shale
#

Yo so I made my bot’s background image as this, but how am I supposed to have all those dark letters pop out? Like be white

pure lion
#

inspect element

#

css

steep shale
#

Cause the name of the bot and the bot tags and stuff are all non-seeable

pure lion
#

inspect element
css

steep shale
#

sorry what

earnest phoenix
#

What command do I put on my bot so that he can play music from YouTube?

misty sigil
#

depends how you wanna do it

drifting wedge
#

can anyone help me embed a image?

#

the image is like a linkj

misty sigil
#

what lib

drifting wedge
#

discor dpy

earnest phoenix
#

I want to be like the rithym I want my bot to play music@misty sigil

drifting wedge
#

its for reddit images

misty sigil
#

@earnest phoenix is this your first project?

drifting wedge
#

firstly lean py

pure lion
#

its very hard

drifting wedge
#

second learn discord py

#

3 make a simplle bot

misty sigil
#

music isnt easy

drifting wedge
#
  1. spend the rest of ur life doing something useless
#
  1. make a music bot
pure lion
#
  1. learn js
drifting wedge
#
  1. die of old age
pure lion
#
  1. make an OS
earnest phoenix
#

@earnest phoenix is this your first project?
@misty sigil

Yes

drifting wedge
#
  1. some how not be dead
#
  1. turn out as bill gates
misty sigil
#

you need to
1 - fetch the video (use ytdl)
2 - join the channel
3 - play the video (play ytdl video via ffmpeg)
4 - leave the channel when it ends

#

it takes hundreds of lines of code

earnest phoenix
#

Thank YOU

misty sigil
#

and not something that you wanna be doing as a beginner

pure lion
#

does ffmpeg take a stream or an mp3?

misty sigil
#

either or

pure lion
#

epic

misty sigil
#

it can take stream

#

it can take mp3

pure lion
#

can you also edit videos x)

#

like scaling and shit

#

fuck i need to go

earnest phoenix
#

Hum

misty sigil
#

no you cant edit vids

drifting wedge
#

wait

#

can i get my bot to play vids

#

on screenshare?

misty sigil
#

no

opal plank
#

undocumented

#

you CAN, but you cant

drifting wedge
#

ok well how do i embed a photo

#

its for a reddit thing

#

also @earnest phoenix

opal plank
#

image property on the payload

drifting wedge
#

u wana make ur own music bot or just make a music bot

#

how?

opal plank
#

depends on your library

drifting wedge
#

?

opal plank
#

embed payload contains image

drifting wedge
opal plank
#

wrong link, my bad

drifting wedge
#

if i have the url

#

how can i embed it?

opal plank
#

insinde image you can use url

drifting wedge
#

yea sur

#

but do i need more

#

?

pure lion
#

you CAN, but you cant
@opal plank heh time to can

opal plank
#

its undocumented and would get you intro trouble

#

at least for production

#

there shouldnt be any problems doing it for research only

pure lion
#

PtFf the sockets and shit are there what's the big dEAL

#

😏

drifting wedge
#

how do i get a reddit posts title?

#

and upvotes?

#

using discord py

pure lion
#

It depends

#

You need to somehow fetch stuff from reddit

#

Maybe there's something on pip

drifting wedge
#

im using praw

pure lion
#

Is that a fetch thing?

#

if it is, print the raw data and see what you get

earnest phoenix
#

what have you tried

#

hi @torn ravine

#

a bot api @torn ravine

torn ravine
#

alr

earnest phoenix
#

no you cant edit vids
@misty sigil
you can, ffmpeg is often used for video manipulation

drifting wedge
#

TypeError: set_image() takes 1 positional argument but 2 were given

#

wut does it take in?

earnest phoenix
#

see the docs for your lib

digital ibex
#

0exe, a url of an image

snow urchin
#

What RegEXP expression would I need to get the first mentioned channel in a message?

earnest phoenix
#

those are probably already provided in the message object

drifting wedge
#

url = submission.url

    embed = discord.Embed(
        colour = discord.Colour.red()
    )
    embed.set_footer(text=f"memes")
    embed.set_image(url='url')

    await channel.send(embed=embed)
earnest phoenix
#

check up your lib docs

drifting wedge
#

does something like this work?

#

its giving me like some errors

snow urchin
#

I have @earnest phoenix

drifting wedge
#

it just doesnt make sense

snow urchin
#

message.mentions._channels is always null

drifting wedge
#

like i have the link

#

and it works without the embed

#

how can i add the image into the embed?

earnest phoenix
#

it's just . channels

steep shale
#

Into a link

earnest phoenix
#

where did you get the underscore from

snow urchin
steep shale
#

How do I convert a picture into a link?

earnest phoenix
#

upload it to an image host

steep shale
#

Yeah I tried a lot of links

fervent oyster
#

ok so im making a grafana graph, and i want to graph stuff like guild count and stuff, from a JSON array in postgresql the array looks like this [{"guildCount":0,"cpuUsage":49,"memUsage":70,"ping":58},{"guildCount":0,"cpuUsage":49,"memUsage":69,"ping":59},{"guildCount":2,"cpuUsage":49,"memUsage":69,"ping":58},{"guildCount":1,"cpuUsage":49,"memUsage":71,"ping":58}]
and i want to aggregate all of those together, but i cant seem to do it in raw SQL, can anyone help me?

earnest phoenix
#

How do I add commands to my bot? i'm new to bots and setting them up

drifting wedge
#

how tf do i embed imagesss

charred geyser
#

both of you what library

drifting wedge
#

py

charred geyser
earnest phoenix
#

oh

#

how to get error's path? for example im doing:
message.member.roles.add("...")
and if the bot doesnt have permissions it will say in the console "Missing Permissions" and the path to the library where its saying the error, but i want to know the path of the line, for example:
.../server.js:32:24
message.member.roles.add("...")
how to do it?

nimble kiln
#

message.member.roles.add("...").catch(e => console.log(e));
@earnest phoenix You can catch stuff, maybe this will output better informations. If not, then you can extend it and just let it output some unique response:
message.member.roles.add("...").catch(e => console.log('Something unique, this is line 1234', e));

#

catching it also lets your bot react directly on the given error.

  message.channel.send('No permissions');
}```
earnest phoenix
#

But i have many functions like that, it can take alot of time to add "catch" to all of them

#

Im searching for a better way

nimble kiln
#

Eh, maybe wrapping some of your stuff in try { ... } catch(e) { ... } blocks will help you

empty bough
#

i'm trying to creat a bot for my discord server but the discription will not exept

drifting wedge
#

how i embed image

empty bough
#

NvM

thick gull
#

i'm trying to creat a bot for my discord server but the discription will not exept
??

empty bough
#

same it just timed out for me

steep shale
#

So basically this name for the bot on my list, is dark asf

That isn’t good for when people want to see the name of the bot

#

Im using css for this too

empty bough
#

the discription won't exept and i've tryed everthing

steep shale
#

If anyone replies ping

empty bough
#

ping

karmic compass
#
console.log(x).catch(e => {
    console.log("ERROR")
    return
})
``` this just returns an error instead of the console.log
#

im talkinga bout the catch statement btw x is undefined to throw the error

stable nimbus
#

Question, is there a type of ‘or’ statement in js? Like
‘If this === this or that’

#

Without having to create a million else if statements?

earnest phoenix
#

two pipes

#

||

stable nimbus
#

Sweet thanks

earnest phoenix
#

you'll have to do the equality check again after or though

stable nimbus
earnest phoenix
#

no

#

you'll have to do the equality check again after or though
@earnest phoenix

stable nimbus
earnest phoenix
#

correct

stable nimbus
#

Okay.

#

It makes life so much easier now that I can do it like that.

#

Thanks mate.

earnest phoenix
#

the interpreter isn't smart enough to figure out what you want so you have to exactly say what to compare it against

stable nimbus
#

Makes sense.

#

Thanks mate.

drifting wedge
#

are there any erros with these?

#

url = submission.url

    embed = discord.Embed(
        colour = discord.Colour.red()
    )
    embed.set_footer(text=f"memes")
    embed.set_image(url=submission.url)

    await channel.send(embed=embed)
earnest phoenix
#

What happens if I remove the LICENSE of my GitHub repostory

#

the license file is gone

#

mind-blowing

#

your code will not be under a license anymore and anyone can do anything they want with it

#

Does the license protect my source code with anything ?

#

... it's a license

#

what else would it do other than license your code

#

if someone violates your license you can take legal action against them

#

aaaaa k

#

thx

small prairie
#
client.on("guildMemberAdd",member=>{
console.log(member)
if(member.guild.id!="517265128647950347")return
var guild=member.guild
var channel=client.channels.cache.get("751211614698471455")
channel.edit("Server Members: "+guild.memberCount)
})

client.on("guildMemberRemove",member=>{
console.log(member)
if(member.guild.id!="517265128647950347")return
var guild=member.guild
var channel=client.channels.cache.get("751211614698471455")
channel.edit("Server Members: "+guild.memberCount)
})


#

these should work right?

#

the event is being caught the console.log never happens

steep shale
#

Aight im here

dire obsidian
#

well

#

there is a css propiety

#

let me find it

#

position: relative;

steep shale
sudden geyser
#

your code will not be under a license anymore and anyone can do anything they want with it
@earnest phoenix on the choosealicense site, they say not choosing a license means no one can use it

dire obsidian
#

Well Andrew

#

Try adding the property i give to you

#

position: relative;

steep shale
#
<html>
<head>
</head>

<body>
  <style>
    body{
       background-image: url("https://media.discordapp.net/attachments/714045415707770900/751215657827303495/image0.jpg");
       position: relative;
....
``` right
dire obsidian
#

Yep

steep shale
#

Nah nothing

dire obsidian
#

But ill recommend add a landscape image

steep shale
#

How?

dire obsidian
#

so that it looks better on pc

#

Is not a how

#

Just find a image that looks like pc wallpaper

steep shale
#

The picture repeats a bunch of times

earnest phoenix
#

why are you using that picture anyways

steep shale
#

Why not?

earnest phoenix
#

any text on it is unreadable and it's ugly for web design

dire obsidian
#

Also the low resolution will make the image repeats

steep shale
#

Doesnt look bad though

earnest phoenix
#

yes, yes it does

dire obsidian
#

The desc text eww

earnest phoenix
#

choose a repeating svg pattern if you want a fancy background, check out heropatterns

steep shale
#

Heropatterns?

dire obsidian
#

You maybe can cosider change the image for a solid color

steep shale
#

idk about that

#

Wouldnt look good

silver lintel
#

whats the best hoster?

earnest phoenix
#

neumorphism has been a hot topic lately

#

check pins @silver lintel

dire obsidian
#

talking abaut web desing

#

how my web looks? (ignore blue text, that should be black but im lazy to change css)

earnest phoenix
#

other than the blue text

#

pretty good

dire obsidian
#

tahnks

#

actually is a link

#

but you know, im lazyyy

split hazel
#

i see so many launching soon pages that i hate them

earnest phoenix
#

😉

#

generic

steep shale
#

Looks nice

earnest phoenix
#

so many sites use particlejs and that exact layout it's not fun to look at anymore

#

never seen a site use that layout tbf

#

atleast any sites that i know of

#

a lot of devs will use it for their portfolio / about me site

#

u have a site?

#

i dont

#

alr

#

eh idk i just went w something easy and not time consuming

#

never had the need to, still in school so can't make a CV :p

#

yeah understandable

#

took like 20 mins

#

dont get me wrong it's a nice design, it's just very generic

#

yyhy igu

bleak crypt
#

Is there any bot that mute people that switching voice channels to fast?

#

As you surely know, some people entering and leaving vc channels in very quick succession in a short period of time. Discord plays a sound every time someone leaves/joins vc channels and doing it very quickly can be irritating for users already in the vc channels. The bot registers this behavior as spamming and auto-mutes users found to be doing it.

quartz kindle
#

never seen a bot like that, but you can easily turn off discord sounds in the settings

bleak crypt
#

@quartz kindle Would it be hard to code a bot that has this feature?

drifting wedge
#

can anyoine help with embeding images from links? its for praw (discord py)

bleak crypt
#

Or require a lot of resources?

quartz kindle
#

shouldnt be too hard

bleak crypt
#

Im wondering because I cannot find a single bot that has this feature.

quartz kindle
#

you'd need to listen to the voiceStateUpdate event

#

compare the states to determine if the user joined or left, then have a counter that counts how many times the same user did it in less than X amount of time

karmic compass
#

wait a sec, is print a function in Javascript?

#

or is it just the lib im using

quartz kindle
#

nope

near veldt
#

no

quartz kindle
#

js uses either console.log or process.stdout.write

steep shale
#

I want to change the color of those boxes from white to whatever I choose

#

<html>
<head>
</head>

<body>
  <style>
    *{
       color: lightgray !important;
    }
    body {
       background-image: url("https://i.imgur.com/nwV0SBe.jpg");
       color: gray !important;
        }
    span {
    color: black !important;
    }
    .btn-orange {
    background: darkred !important;
    }
        
</style>
</body>
</html>``` this is what I have so far
sudden tulip
#

im using c#

#

someone

steep shale
#

god damn bro

#

Use py or js

#

C# looks overkill

sudden tulip
#

Use py or js
@steep shale i literally have 98% done

#

too late now

#

Honestly c# is not widely used for discord bots, I’d try to find a specific server for it
@fleet hornet the api's discord if full of assholes

sonic lodge
#

@sudden tulip convert ctx.Member.Id to a string

steep shale
#

Where the 100+ commands is

#

And its not bot page button

sonic lodge
steep shale
#

it doesnt do anything when I tried

sonic lodge
#

of course it's not "botpagebutton" lol

#

the description is definitely not a button

quartz kindle
#

@fleet hornet discord.js has internal sharding, which you can enable using shards:"auto" in your client options

#

or the sharding manager if you want to multi-process

steep shale
#

<html>
<head>
</head>

<body>
  <style>
    *{
       color: lightgray !important;
    }
    body {
       background-image: url("https://i.imgur.com/nwV0SBe.jpg");
       color: gray !important;
        }
    span {
    color: white !important;
    }
    .btn-orange {
    background: darkred !important;
    }
    report.botpagebutton {
    color: darkred !important;
    }
        
</style>
</body>``` I’m confused
#

I want to change all of those white boxes to a different color

sonic lodge
#

what is "report.botpagebutton"

#

should be just .botpagebutton

steep shale
#

Oh forgot the .

#

It only changes the text though

sonic lodge
#

so change the background color

steep shale
#

Alr

sonic lodge
#

just curious, are you on a phone rn?

steep shale
#

Oh sht I forgot I can do that lol

#

yeah Im always on a phone why

sonic lodge
#

on a desktop you have access to ctrl + shift + i

#

you can easily find the class names yourself, make changes to their styles, etc

steep shale
#

What about the bot tags?

#

And the long description box

#

And the prefix box

sonic lodge
#

prefix box has no class

steep shale
#

What I circled/pointed to is all I need

sonic lodge
#

bot tags -> .atag
long desc -> .content

steep shale
#

prefix box has no class
Seriously?

#

And thanks Ima change them rn

#

How can I set this so its like 50% visible 50% transparent

#

If that makes sense

sonic lodge
#

specify the alpha property as well

steep shale
#

Wdym

sonic lodge
#

rgb: #ff0000
rgba: #ff000080

steep shale
#

opacity: # right

sonic lodge
#

that works too

#

it's a number from 0 to 1

steep shale
#

It blocks out the text though

#

I only want the color to fade out

#

Not the text

sonic lodge
#

instead of changing opacity, change the color

#

rgb: #ff0000
rgba: #ff000080

steep shale
#

    .content {
    color: black !important;
    background: darkred !important;
    opacity: 0.3;
    }```thought I did change the color
sonic lodge
#

you changed the opacity right there

earnest phoenix
#

hola alguien me dice como configurar DSL en mi server para que suba publicidad y me paguen??

#

Hello, someone tells me how to configure DSL on my server to upload advertising and get paid?

urban olive
#

is there a way to make your bot set stats to listening and have a song its listening to show up?

#

like how a bot can stream a url

#

can a bot listen to something on spotify?

sonic lodge
#

no iirc

steep shale
#

rgb: #ff0000
rgba: #ff000080
Do I just put a hex code and thats it?

#

like #420000

#

Thats dark red

sonic lodge
#

add the alpha part

urban olive
#

wow #420000

#

of course

steep shale
#

Its dark red

#

lmao

#

wdym by alpha part

thick gull
#

alpha

#

rgba

#

alpha = opacity

sonic lodge
#
#ff 00 00 80
 r  g  b  a
#

^

steep shale
#

oh alright

#

Is 80 the max?

#

like 80 means no opacity at all

#

Nvm it doesnt change anything

urban olive
#

anyone know if there is an actual way to get your bot to be "listening to" a song or something?

steep shale
#
    .content {
    color: black !important;
    background: darkred !important;
    rgb: #420000;
    rgba: #42000010;
    }``` that didn’t switch the opacity
sonic lodge
#

no it's just a placeholder

urban olive
#

if bots can stream a url then they should be able to have a listening to url

sonic lodge
#

it's a color

#

replace the color property with the hex

steep shale
#

So color: #420000

urban olive
#

if anyone knows how ping me

west skiff
#

ik we were allowed to before, like a long time ago like years ago, but can we use scripts in our bot descriptions?

steep shale
#
    .content {
    color: black !important;
    background: darkred !important;
    rgb: #420000;
    rgba: #42000080;
    }``` Im confused @sonic lodge
west skiff
#

no you need to change the color or background property and relace black or darkred with the color code

sonic lodge
#

^

#

i told you to replace the color property with the new hex color

zenith knoll
#

should i switch from d.js to eris?

sonic lodge
#

if you want

tight terrace
#

...

sonic lodge
#

@west skiff you need to be a certified dev to use scripts

west skiff
#

aw thats why i could before

#

ok thats sad but also im not gonna try to get recertified im sure its a nightmare now too

steep shale
#
    .content {
    color: #420000 !important;
    background: #420000 !important;
    rgb: #420000;
    rgba: #42000080;
    }```
sonic lodge
#

i dont even think they have apps open

west skiff
#

its still so weird how big this server got

#

i think i literally just talked to an admin and they were like sure when I got certified

#

they mightve messed around with my bot more first or something but that was it I think

sonic lodge
#

you aren't certified anymore?

west skiff
#

anyway ignore me acting like an old person

#

no that was like in 2016 and then my bot went offline for like 6 months and i unsuprisingly lost it

sonic lodge
#

oof

west skiff
#

yea

steep shale
#
    .content {
    color: #420000 !important;
    background: #420000 !important;
    rgb: #420000;
    rgba: #42000080;
    }``` this would be fine right?
#

Or close

west skiff
#

well you probably want the text color and background to be different im assuming but it's way closer!

steep shale
#

Yeah gimme a sec to give an example of what I want

#

Thats the example, like the white color is fading out

west skiff
#

ok so the color code for that would be something like #ffffffc8

#

and then the text in front is just black or dark grey

steep shale
#

c8 makes it kinda transparent?

#

So I can do like #420000c8

near veldt
#

lol villager bot

#

miner bot 2.0

west skiff
#

well that'd be a transparent really dark red but yeah

#

thats the idea

steep shale
#

So like css .content { color: #420000 !important; background: #420000c8 !important; }

radiant patio
#

.addField("__Activity__: ", person.presence.activities || "None")

it says it cannot send empty fields

sonic lodge
#

so you're trying to send an embed that has an empty field

tacit stag
#

building a discord music bot, but how to make it seek to a point in the current playing song?

using discord.js / opus && ytdl-core

steep shale
#

Whats the class of the prefix? I’m tryna change how it looks rn

tacit stag
#

#prefix is the id but its also a code block

#

i think the class is .color-blue but im 100% sure

steep shale
#

class of the prefix is a .color-blie?

#

Is that what it shows on pc

#

ctrl + shift + i

tacit stag
#

or code (in inspect window):

<span class="color-blue" id="prefix">
    <code>f! (customizable)</code>
</span>
steep shale
#

Alr so its css color-blue { ... then

tacit stag
#

anyways... does anyone know how to do a seek command in discord.js? (with opus and ytdl-core)
I can do time conversions if needed, but how to implement it? i.e. queue.connection.dispatcher.seek is not a function.

I want it to work like !seek 0:35

steep shale
#

How am I supposed to change the color of this prefix box?

I tried css .color-blue { color: white !important; background: #420000c8; } but that didn’t do anything

tacit stag
#

do you have code blocks in your description?

steep shale
#

no why would I do that

tacit stag
#

okay. so then try

code {
  color: white !important;
  background: #420000c8;
}
#

see if that works

steep shale
#

Alr

vale garden
#

hi

#
if (bot.on("message", function(message){}))
       counter++;
       console.log(counter);
       if (bot.on("message", function(message){}))
       counter++
       console.log(counter)
       if (bot.on("message", function(message){}))
       counter++
       console.log(counter)


if(counter % 3 === 0){
  bot.channels.cache.get(`718760245014298654`).send(`yeet`);
}

console.log(counter);
#

so this is my code

#

where every 3 messages 'yeet' gets sent

steep shale
#

Oh that worked out

#

Thanks

tacit stag
#

np

vale garden
#

but then it only gets sent when a command

#

is executed

#

how do i make it so that the message is given after any 3 messages

#

plz help

sonic lodge
#

when a message is sent, increment a counter; when the counter reaches 3, send your message

tacit stag
#
var counter = 0;
bot.on("message", function(message) {
  counter++;
  if(counter % 3 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet`);
  }
});
vale garden
#

when a message is sent, increment a counter; when the counter reaches 3, send your message
@sonic lodge thats what i did

#

wat

sonic lodge
#

this doesn't make sense

if (bot.on("message", function(message){}))```
vale garden
#

ok let me try this

#

kk

tacit stag
#

in discord.js, an on message event only needs to be written once, rather than written for each time you want something to happen.

near veldt
#

i wanna depthen my knowledge over computer science and programming. does anyone have any suggestions for the sites or apps to download for that?

vale garden
#

ok thnx it workss

tacit stag
#

its essentially a function that is called whenever a message is sent; NP

sonic lodge
#

idk if that would count as spoonfeeding but eh

near veldt
#

it doesnt

#

i think

tacit stag
#

um does anyone have insight for my question?

vale garden
#

hi again

#
  let counter = 0;
bot.on("message", function(message) {
  if (message.author.bot) {return}
  else {
  counter++;
  if(counter % 7 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet the feet`);
  }
  }
});
#

btw i made it this and now it isnt even working

#

lol

near veldt
#

"yeet the feet"

vale garden
#

lol

#

but still plz help

#

lmao

tacit stag
#

do you have two on message functions now? or just one, just edited

vale garden
#

no just one

tacit stag
#

hmmm

vale garden
#

i mean there is one more for the main bot stuff

#

but for this thing only one

tacit stag
#

you should only have one overall

vale garden
#

what

#

ok yea i will do that

#

im just testing it seperatley

#

*separetly

#

so when im done

#

i can add it back

viral spade
#

any idea why the ping is not converting? i have another embed where it works just like that (by putting the id within <@ >)

vale garden
#

rip my spelling btw

#

lol

#

it doesnt convert in embeds

#

you cant ping someone from an embed

viral spade
#

not ping, but at least the link

sonic lodge
#

you can have mentions though

viral spade
tacit stag
#

ive seen it before...

vale garden
#

wait what

#

ok

#

idk

viral spade
#

it is working in my own code at another place^^

tacit stag
#

message.author.tag?

#

ie js .addField(`${message.author.tag} you gained ${points}`)

#

try this... not much different. if this doesnt work, ill try something new

let counter = 0;
bot.on("message", function(message) {
  if (message.author.bot) return;

  counter++;
  if(counter % 7 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet the feet`);
  }
});
sonic lodge
#

is it supposed to be counter % 7

tacit stag
#

just if(counter % 7) ? Dont think so

sonic lodge
#

no, i meant did he mean that condition, or was it still supposed to be counter % 3

tacit stag
#

i think he meant that condition

sonic lodge
#

@vale garden how many messages are you sending

viral spade
vale garden
#

hi

tacit stag
#

huh...

vale garden
#

lol nvm

#

it was working

#

lmao

#

but btw

#

does anyone know

#

how i can make a command that only gets executed if a certain message is typed above

#

basically the yeet message from my bot

sonic lodge
#

@viral spade the only possible problem i can think of with <@id> is that there was a zero-width space somewhere

tacit stag
#
if(message.content == "custom_message_here") {
  bot.channels.cache.get(`718760245014298654`).send(`yeet the feet`);
}```
vale garden
#

kk thnx

#

a lot

#

wait what

#

no thats not what i meant

#

i need to know

#

if i can make a command which only excutes if the "yeet" message if above

#

somewhere

tacit stag
#

youre asking if a command is typed, then send the yeet message?
or if the yeet message happens, do something else?

vale garden
#

yea

#

the second one

viral spade
#

okay the mention only works in a Fields description field

tacit stag
#

you could just do

let counter = 0;
bot.on("message", function(message) {
  if (message.author.bot) return;

  counter++;
  if(counter % 7 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet the feet`)
    .then(function() {
        //Do something new here!
    });
    
  }
});
vale garden
#

ohh

#

kk

#

thnx

tacit stag
#

np

vale garden
#

hi im back again

#
let counter = 0;
bot.on("message", function(message) {
  if (message.author.bot) return;

  counter++;
  if(counter % 33 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet the feet`)
    .then(function() {

      if (args[0] === "yeeet"){
        message.channel.send("You have been yeeeeeted")
      }
    });
    
  }
})
#

this is

#

working

#

weirdly

#

im confused

tacit stag
#

uh

stone wren
#

Uh hi?😭💀

vale garden
#

hi

#

lol

stone wren
#

Lmao

tired nimbus
#

when you scroll using the mousewheel on another tab, do you lose focus from the original tab?

near veldt
#

question

tacit stag
#
let counter = 0;
let prefix = "t!";
bot.on("message", function(message) {
  if (message.author.bot) return;
  
  counter++;
  if(counter % 33 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet the feet`)
  }

  if(!message.content.startsWith(prefix)) return;
  
  let messageArray = message.content.split("")
      .filter((el) => el !== ""); //finds the args and removes extra spaces
  let command = messageArray(0);
  let args = messageArray.slice(1);

  if(args[0] == "yeeet") {
    if(counter % 33 === 0) {
        message.channel.send("You have been yeeeeeted");
    } 
  }
})```
#

something like this?

near veldt
#

oh, ya'll use that bot.on("example") stuff still?

#

ig its useful for simple commands

timber notch
#

can i get help

earnest phoenix
#

Send here

timber notch
#
const { client } = require('dsicrod.js');
const client = new client();

client.login(process.env.BOT_TOKEN);

client.on('ready', () => console.log(` ${client.user.tag} has logged in.`));

const usersmap = new Map();

/*
'id' => {
  msgCount: 0,
  lastMessage: 'message',
  timer: fn()
}
 */

client.on('message', message => {
  if(message.author.bot) return;

 if(usersmap.has(message.author.id)) {
   const userData = userMap.get(message.author.id);
   const msgCount = userData.msgCount;
   if(parseInt(msgCount) === 3) {
     const role = message.guild.roles.cache.get('738731627412193371');
     message.member.roles.add(role);
     message.channel.send('You have been muted.');
   }
 } else {
 msgCount++;
 userData.msgcount = msgcount;
 usersmap.set(message.author.id, userData);
 }
} 
   else {
    userMap.set(message.author.id, {
        msgCount: 1,
        lastMessage: message,
        timer: null
    });
    setTimeout(() => {
        usersMap.delete(message.author.id)
        console.log('Removed from map.');
    }, 5000);
}
});```
tacit stag
#

could you either condense it, or put it in block quotes? kinda hard to read ngl

earnest phoenix
#

Add 3 ` on beginning and 3 end

tacit stag
#

oh uh question

winter basalt
timber notch
#

there

tacit stag
#

if i restart my bot, is there a way I can disconnect it from all of the voice channels it is connected in when i take it down?

timber notch
#

idk i think so

tacit stag
#

or at least get all of the connections on ready? for some reason when i restart it, it stays in the voice channel, and i'd like it to leave before restart...

fathom topaz
#

howda

lament meteor
#

u dont need dotenv

delicate zephyr
#

you do for JS

#

and then run require('dotenv').config() at the start of your script

#

and then all you variables will be in process.env

thick gull
#

is there a reason why people use .env over json files

trail remnant
#

Is there any specific way bots reward users for upvoting their bot on top.gg?

#

Like do the bots store the users in db to know or how does it really work ? 👀

delicate zephyr
#

use the webhooks they provide

#

and store user ids in cache/db

trail remnant
#

Ahh okay I'll have to research about the webhooks

#

Thanks!

delicate shore
#

How to get number of shards

#

And also

pale vessel
#

read docs

#

bruh

delicate shore
#

How to see on which number of shards is the server

pale vessel
#

number of servers in a shard*

#

ah

#

which shard the server is in?

#

guild#shard iirc

#

try guild#shard#id

delicate shore
#

Ok

#

And total number of shards ?

#

Because in docs its confusing

pale vessel
#

look up shardingmanager

crystal socket
trim saddle
#

@delicate zephyr ree environment config bad

delicate zephyr
#

shut up skull. Your opinion is objective stop reeing at me for it

trim saddle
#

it's all fun and games til we share machine

#

and then i put in a little... $BOT_TOKEN

delicate zephyr
#

Shame you're never gonna share a machine with me

delicate shore
#

I wanna make something like this

#
t=turtle
t=turtle.Pen()
t.shape('turtle')
t.color('blue')
t.stamp()
move=20
for i in range (11):
    t.penup()
    t.forward(50)
    t.pendown()
    t.forward(25)
    t.penup()
    t.forward(15)
    t.stamp()
    t.home()
    t.right(move)
    move=move+20```
#

This doesn't work tho

dim parrot
#

@fathom topaz :(

fathom topaz
#

ik

#

actually

#

im got noobe

earnest phoenix
#

@crystal socket you’re running on localhost

#

Meaning you can only access the (I think is aiohttp) server through the local interface

#

If you want it to be publicly open (don’t do that, use a load balancer like nginx)

#

Make it bind to 0.0.0.0

#

And not localhost

earnest phoenix
#

why is it bad if my IP address is LEAKED

pure lion
#

And I will eat it

summer acorn
#

I want to track the server count daily for my bots, but I have no idea how to make a graph to track it. Could someone please help me setting it up?

still merlin
#

I’m thinking of using auth with my discord bot to fetch global guild counts and other stuff, Except I don’t know what to do first, I’d assume I need to give my bot scopes etc, But what would I do then? I’d guess id make a “auth.json” and require it, And shove something like this in auth.json (On a phone and don’t have code blocks, sorry)

{
client_id: 'bot id',
client_secret: 'client secret',
grant_type: 'authorization_code',
redirect_uri: 'redirect url with permissions api calculator or smthin',
scope: 'the scopes',
}
but like json formation, could someone explain setting up auth to me please, or give a link to a guide or something, I’m thinking of using auth with my discord bot to fetch global guild counts and other stuff, Except I don’t know what to do first, I’d assume I need to give my bot scopes etc, But what would I do then? I’d guess id make a “auth.json” and require it, And shove something like this in auth.json (On a phone and don’t have code blocks, sorry)

{
client_id: 'bot id',
client_secret: 'client secret',
grant_type: 'authorization_code',
redirect_uri: 'redirect url with permissions api calculator or smthin',
scope: 'the scopes',
}
but like json formation, could someone explain setting up auth to me please? That would be greatly appreciated

pure lion
#

You can do code blocks

#

Don't be afraid

summer acorn
#

@still merlin JSON requires ", ' doesn't work

pure lion
#

That too

#

Also oauth2 is kinda hard ngl

still merlin
#

I know, I cant type on phones well

#

Otherwise i’d have formatted it into json

vale garden
#

hi

pure lion
#

You need to make a post request to the discord API to get an auth code, then use the auth code to get the other info

#

Hu

vale garden
#
 message.reply(message.author.guild)
#

not working help pzlzllzl

pure lion
#

What are you trying to do

vale garden
#

im egtting this error

#
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guild' of undefined
#

im trying to find the users guild name

earnest phoenix
#

authord doesnt have guild

pure lion
#

authors (users) don-

vale garden
#

wat

pure lion
#

Okay I'm going to leave this channel

vale garden
#

i saw on discordjs documentation

#

that its there

#

bruh

summer acorn
#

nope, you didn't

earnest phoenix
#

what do u want the code to do

still merlin
#

Yes but do I need a auth.json file and stuff?

summer acorn
#

it's message.member.guild @vale garden

vale garden
#

ok wait nvm

summer acorn
#

member not author

vale garden
#

i was wrong

#

lol

#

kk

silk whale
#

do yall use js bruh

summer acorn
#

author is User, member is guildMember

earnest phoenix
#

message.guild

#

doesnt message have a guild prop

still merlin
#

I’m really confused about Auth, I can’t find any helpful documents on auth that work, Does anyone know any that are good?

acoustic thorn
#

Trying to get the lastMessage of a user in that server, but it's showing as null. Here's my code:

let id = message.content.split('')[1].replace(/[\<>@#&!]/g, ""); // User object of person @'ed.
let user = message.guild.member(id); // GuildMember object so I can get lastmessage
still merlin
#

That’s because the tester hasn’t sent a message recently I think

cinder patio
#

lastMessageID is not guaranteed to have a value

acoustic thorn
#

No the person sent a message like 100 times

#

Only works when @'ing myself

#

Otherwise it's null

still merlin
#

As googleFued said, It doesn’t always have a value

earnest phoenix
#

Can anyone let me know what's wrong with my code

#
const { MessageEmbed } = require("discord.js");
const { Client, Collection } = require("discord.js");
module.exports = {
  name: "serverlist",
  aliases: ["serverlist"],
  description: "Display bot's joined servers count",
  execute(message) {
    let commands = message.client.commands.array();

    let ServerEmbed = new MessageEmbed()
      .setTitle("Servers Count")
      .setDescription("List of all commands")
      .setColor("#F8AA2A");
.addFields('**SERVERS - ** ${client.guilds.cache.size}') 
.addFields('**MEMBERS - **  ${client.users.cache.size} ')

    ServerEmbed.setTimestamp();

    return message.channel.send(ServerEmbed).catch(console.error);
  }
};

vale garden
#
//err
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
#

wth

acoustic thorn
#

@still merlin what decides whether or not it gets a value?

vale garden
#
message.channel.send(message.user.guild)

#

i feel like im doin something dumb

earnest phoenix
#

Error on line: .addFields('**SERVERS - ** ${client.guilds.cache.size}')

vale garden
#

but idk what

#

someone help plz

earnest phoenix
#

Syntax Error: Unexpected Token

still merlin
#

You need to use array with addFields

earnest phoenix
#

oh

vale garden
#

someone help plz

still merlin
#

If you want to do just one field,

.addField(‘title’, ‘description’)

earnest phoenix
#
    .addFields(
        { name: '**SERVERS - **', value: '${client.guilds.cache.size}', inline: true },
        { name: '**MEMBERS - **', value: '${client.users.cache.size}', inline: true },
    )
#

is that fine?

still merlin
#
//err
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined

@vale garden Its nothing to do with your note, As the error said, “send is undefined”, we need code to help you

#

That should work, Mursaleen

vale garden
#

what

#

but send

#

wdym

#

that never happens

#

like

earnest phoenix
#

`C:\Users\Mursaleen\Downloads\Compressed\mybot\commands\serverlist.js:14
.addFields(
^

SyntaxError: Unexpected token '.'`

still merlin
#

Try “embedName”.addFields

acoustic thorn
#

Since lastMessage returns null, is there another alternative to finding the date of the "latest message" of a user?

earnest phoenix
#

Alright

still merlin
#

I don’t think so, CarrotTheFish

earnest phoenix
#

It worked @still merlin Thanks a lot ❤️

still merlin
#

Your welcome :)

acoustic thorn
#

Hmm. Prune feature in discord ignores lurkers, so I need a command that can detect non-prunable lurkers

earnest phoenix
#

How do I make it get values

vale garden
#

henlo

#

im back

still merlin
#

use the back tidldie string

vale garden
#
 let user = message.author

      message.channel.send(user.guild+" (server)")
#

this is my code now

#

it says undefined

#

for some reason

still merlin
#

Because you haven’t defined it.

vale garden
#

o

#

lol

earnest phoenix
#
let ServerEmbed = new MessageEmbed()
   ServerEmbed   .setTitle("Servers List)
     ServerEmbed .setDescription("List of all commands")
     ServerEmbed .setColor("#F8AA2A");
    ServerEmbed.addFields(
        { name: '**SERVERS - **', value: '${client.guilds.cache.size}', inline: true },
        { name: '**MEMBERS - **', value: '${client.users.cache.size}', inline: true },
    )
    ServerEmbed.setTimestamp();

    return message.channel.send(ServerEmbed).catch(console.error);
#

@still merlin help me with it please !

vale garden
#

wait how do i define a guild?

still merlin
#

right er

#

hold on

#

You know the english keybord, Next to the number one there is a weird key

sullen harness
#

Use ` instead of ' for your value.

acoustic thorn
#

This `

still merlin
#

I dont have the symbol hold on

acoustic thorn
#

It's the top left yeah

#

Called back ticks iirc

sullen harness
#

It's the key under your escape key.

#

Yes

vale garden
#

hi

#

i am back yet again

#
let guild = client.guilds.cache.find(g => g.name);

      let user = message.author

      message.channel.send(user.guild+" (server)")
#

shouldnt dis work

pure lion
#

No

earnest phoenix
vale garden
#

why

#

i didnt ask should it wor

#

i asked shouldnt it work

#

cuz it didnt

#

bruh no help

#

srsly

#

lol

still merlin
#

Do you know the basics of javascript?

sullen harness
#

I'm not going to burn my hands on that one, you're better off reading the docs.

slender lion
#

How Im Doing top.gg Voting System?

vale garden
#

b r u h

still merlin
#

I’d recommend learning, Its useful, Or at least read the guide or docs

vale garden
#

been reading it for mins

#

lol

#

dude

#

oof

still merlin
vale garden
#

this is what

#

i am reading

#

for the past

#

5647839329 mins

#

lol

slender lion
#

How Im Doing top.gg Voting System?
Someone?
Im Using Discord.js

still merlin
#

is your bot approved?

slender lion
#

Oh I Need My Bot To Be Approved?

still merlin
#

Yes

slender lion
#

Thanks

still merlin
#

You need a api token from there website

#

You get one once you’re bot is approved

slender lion
#

ok

earnest phoenix
#

@vale garden it's not our job to help

mortal dagger
#

Is it against discord tos to create a bot that can generate accounts?

pale vessel
#

yes

earnest phoenix
#

self botting is against TOS

#

@mortal dagger yes

mortal dagger
#

Alr

#

Cuz i swear there was a gen bot on top.gg

#

Idk

split hazel
#

if there is it won't last long

summer acorn
#

I want to track the guild count daily for my bots, but I have no idea how to make a graph to track it. Could someone please help me setting it up?

earnest phoenix
#

How can i make the bot send a message to a specific channel by id in discord js v12 ??????

still merlin
#

Make a variable and cache and find a channel, then VariableName.send

#

or use a webhook

summer acorn
#

err

#

client.channels.cache is a thing

#

no need for a variable when you can just do client.channels.cache.get("<channel id>").send("<message>")

#

Though, if the channel is on a different shard, you'd have to broadcastEval it

vale garden
#

@vale garden it's not our job to help
@earnest phoenix ik i didnt say that but you could

#

help

#

lol

sage niche
#

hi

summer acorn
#

@vale garden I've already told you... message.author is a User object. message.member is a guildMember object. User objects are not assigned to guild, so it doesn't have a guild property. guildMember objects are specific for a guild, so that is what you have to use if you're going to get the guild through the member.

#

But message.guild exist as well

#

And if run in dms, both message.member.guild and message.guild will error, so you gotta lock that to guildOnly unless you handle those errors by doing something differently.

#

now you've gotten the answer to your issue @vale garden

lethal pine
pale vessel
#

[title](url "optional title when hovered")

summer acorn
#

[]()

lethal pine
#

ok thankx

obtuse jolt
#

How do you use case switches in nodejs

vale garden
#

And if run in dms, both message.member.guild and message.guild will error, so you gotta lock that to guildOnly unless you handle those errors by doing something differently.
@summer acorn kk thnx

obtuse jolt
#

Beautiful

small prairie
#

Im hosting a bot on my PC and its working just fine
But it has super slow ping when i use in Raspberry pi
Both are connected through wired networks
the memory and consumption doesnt seem much during the load

#

Any ideas on why it could be happening?

#

Why is soo much of my memory for cache/reserved for cache

weak rain
#

dont host on

#

pc

small prairie
#

@weak rain read what i wrote please? :/

weak rain
ionic dawn
#

@small prairie

#

what pi

#

and, are you using the integrated wifi or using ETHN?

small prairie
#

3b+

#

wired ethn

#

The connection is fast

#

was reading some article
Could the problem be because of my SD card?

#

Dont have any way to test my theory rn

ionic dawn
#

cant really tell, ive run bots on a Pi4 and always worked fast

small prairie
#

Sd card?

ionic dawn
#

dont you have a desk pc or laptop?

#

Sd card?
@small prairie y

#

well, microSD

small prairie
#

yea i have just been working on this hobby project so i wont be running be PC 24/7

ionic dawn
#

Dont run it 24/7, just make some tests

small prairie
#

And i dont wanna host it on my VPS coz it might effect my other bots

#

Nah i need it to run that long for some reasons

#

I have 24/7 internet with UPS power supply so dont think power lose will be an issue anytime soon

ionic dawn
#

well, if you using raspbian and the right things raspi isnt a problem, ive seen many bots being hosted on Raspis

small prairie
#

yea ik

ionic dawn
#

Ive been hosting one for like 2 months, and my friend have one too

small prairie
#

And hosting the same bot on windows made it normal

#

so its not my internet

ionic dawn
#

raspbian?

small prairie
#

Old af i installed like 1 year ago

#

how to update ;-;

ionic dawn
#

since its linux you can do upgrade and stuff commands

small prairie
#

im not at all experienced with rasps
i just bought it out of the idea of that small PC never used it really till now

ionic dawn
#

or you can install it by packages from the official website

small prairie
#

The full OS can be upgraded from commands?

#

Damn

ionic dawn
#

sure, using wget etc

small prairie
#

Got it

#

thanks for the hel

#

p

ionic dawn
#

with linux you dont need to download manually or anything

small prairie
#

i'll browse the site for another year

#

Yea ik

ionic dawn
#

you can get packages and updates by commands

small prairie
#

apt-get and stuff

#

im expereinced a bit with linux due to VPS :/

ionic dawn
#

not just apt, apt is the package system for linux

small prairie
#

Its easiest afaik

#

Curl and stuff to directly download from links right?

#

or curl isnt linux

ionic dawn
#

yeg

#

curl or wget can do the job

small prairie
#

yea

#

anyways

#

i can update the raspberry from SSH right?

ionic dawn
#

but, since its a raspi its probably faster or easier to manually do it on a pc with windows and reset the sd

small prairie
#

Got it

ionic dawn
#

yeah, you can do SSH localy to raspi and update it

small prairie
#

But i dont have a reader rn

#

so imma do ssh

#

i really dont wanna take my monitor to the other side of the house

ionic dawn
small prairie
#

im lazy af

#

Whats the latest rasp?

ionic dawn
#

I always used wifi on pi so CBShrug

small prairie
#

im too far from my Router with like 3 walls in between

#

And if im just keeping my rasp right with router might as well use ethernet

ionic dawn
#

its raspi refrigerated?

small prairie
#

you mean cooled?

ionic dawn
#

yeh, my eng is poo poo

small prairie
#

Lmao

#

i thought literally refrigiated

#

Not rn since its literally my second day but yes i have been planning to add a heatsink with a little 70mm fan above it

ionic dawn
#

24/7 raspi running stuff can easly slowdown by the heat

small prairie
#

Yea ik

#

That can happen to any electronics

#

all silicones need to be coolen down

ionic dawn
#

first 2 days with my raspi and my room starts smelling like something is burning

#

so yeah... better cool it some how

small prairie
#

Lol

#

WHere you from
it depends ALOT on room temp

ionic dawn
#

30ºC rn yikes2

small prairie
#

Wait rasp isnt 64 bit?

#

i mean the OS

ionic dawn
#

Its 32

small prairie
#

sad

ionic dawn
small prairie
#

its probably better to run rasp OS rather then linux i suppose

#

How to know which version am i running on rn?

earnest phoenix
#

i see raspberry pi

ionic dawn
#

raspian is always the best way to go

#

since its prepared to that machine

#

running ubuntu or cent its a mess

earnest phoenix
#

raspberry pi doesn't run on 64bit except the latest one

#

Raspbian has been renamed to Raspberry PI Os

empty bough
#

can someone help me with the discription for my bot?

small prairie
#

raspbian is more nosaltigc and normal to sound :/

ionic dawn
#

Rasbian for ever

#

do you hear me

small prairie
#

#Raspbian4Ever

#

raspberry pi doesn't run on 64bit except the latest one
@earnest phoenix isnt 3b+ still 64 bit proc?

ionic dawn
#

anyways, always run raspian on the rpi, theres no need to install other OS, even if you can that dnst mean you should

empty bough
#

it keeps wanting to tell me to type more or i typed to much and never the right amount

ionic dawn
#

even the ubuntuserver os will make it slow af and you will have a lot of trouble by missing stuff

small prairie
#

How are VPS soo optimized?

ionic dawn
small prairie
#

Better specs?

ionic dawn
#

it depends

small prairie
ionic dawn
earnest phoenix
#

Heat can be an issue in raspberrypi, this is captured on my raspberry pi, only 30 seconds from powered up

ionic dawn
#

and VPS are not "optimized" probably at the beginning but you are the guy who controls the stuff

#

57ºC

#

i want to run mine just to see what temp it reaches

#

i want it to see if I can melt it down

earnest phoenix
#

the peek is 90oc

#

its when i run npm i alot

ionic dawn
#

didnt you buy any fan or so?

jagged sun
#

Yo, how can I check if my bot is connected to any voicechannel on a guild in discord.js?

earnest phoenix
#

My mom won't buy it

quartz kindle
#

@jagged sun check if guild.voice exists

earnest phoenix
#

Fun fact, it is hot enough to burn my finger in 5 seconds

ionic dawn
#

blacklol lol

earnest phoenix
#

Anyways, if you have a fan

#

then you can just set the pi 24/7

ionic dawn
#

2 fans

earnest phoenix
#

Actually, put water cool on it

quartz kindle
#

do PIs really get that hot? wow

small prairie
#

better yet cement cool it

earnest phoenix
#

@quartz kindle yes

#

the peek for mine is around 90 celcius

ionic dawn
#

drop your Sprite on it

quartz kindle
#

i always thought PIs were supposed to be super power efficient

small prairie
#

Drop your vodka

earnest phoenix
small prairie
#

and thats on how much load?

ionic dawn
#

@quartz kindle they are, but they reach high temp if you dont have any cool system

small prairie
#

I mean some people are literally running PI's with no heatsink or cooling
what do you expect from that poor chip

ionic dawn
#

if you are runnin the notepad obviously wont reach any risky temp

earnest phoenix
#

So,
It mean
if you have a cooling system, then you can just host your bot 24/7, if you're in asian, you will have slow pING

ionic dawn
#

but running servers or so it will

quartz kindle
#

not much different from phone cpus, and phones dont get that hot, even with 0 ventilation

small prairie
#

if you're in asian, you will have slow pING
@earnest phoenix what does that mean?

earnest phoenix
#

ping

small prairie
#

No i mean

#

if your in asia?

#

How does that affect ping?

quartz kindle
#

discord gateway is in new york

earnest phoenix
#

^

small prairie
#

Oh thats wonderful ;-;

earnest phoenix
#

That's why i hate hosting bot myself, the ping is bad

ionic dawn
#

my vps is in canada

quartz kindle
#

my ws ping is 100-130 from europe

ionic dawn
quartz kindle
#

20-25 from my vps

small prairie
#

But when im hosting the bot on my PC the ping is still super good :/

quartz kindle
#

how much is your client.ws.ping?

ionic dawn
#

you probably checking the ping to your connection

#

I mean, your internet connection ping

#

not the ping with discord

frigid mesa
#

Hosting the bot myself I get 150 ms client ping and 30 API ping

quartz kindle
#

and where are you located?

frigid mesa
#

Netherlands

quartz kindle
#

makes sense

frigid mesa
#

so EUW

quartz kindle
#

netherlands is one of the main exchange points between EU and NA

#

so you'd be very close to a direct route

charred nimbus
#

Who has a jailbroken iphone

frigid mesa
#

There is a discord remote server in amsterdam I belive

#

so that probably explains my 30 API ping

quartz kindle
#

ye

charred nimbus
#

Because i ran the terminal on it

small prairie
#

sad life to the asian hosters

frigid mesa
#

does anyone have experience with running javascript bots... after a longer time, lets say 50 hours it crashes because java is out of memory or something...

small prairie
#

SO i should buy a VPS close to NY right?

quartz kindle
#

@frigid mesa how many guilds/users? whats your memory usage like? whats your pc/vps's available ram?

small prairie
#

probably ram/CPU limitations

quartz kindle
#

@small prairie ideally yes

frigid mesa
#

My pc has 32 GB, currently running around 40 guilds

small prairie
#

32 gb ram!?

frigid mesa
#

ye

quartz kindle
#

how much is the bot using?

#

you can check internally with process.memoryUsage()

small prairie
#

discordjs using 32Gb of ram

#

Lol

frigid mesa
#

currently, 70 MB

quartz kindle
#

70mb what, rss or heap?

frigid mesa
#

MonkaZoom heap?

earnest phoenix
#

peek*

frigid mesa
#

that what the error tells me... something about heap memory

quartz kindle
#

do you have an eval command?

frigid mesa
#

gimme a sec

#
process.memoryUsage().heapUsed
#

thats what I use to get the memory

quartz kindle
#

ok, check process.memoryUsage().rss as well

#

its always good to check both

#

heapUsed is the actual memory your code is using
rss is what your system sees, including the node process itself, but excluding paged/swapped memory

frigid mesa
#

ahh... thanks... ill check it

#

what value does it output? because I had to do some math on ().heapUsed to get to MB is that the same with rss?

quartz kindle
#

if you're on windows, you can enable the "Commit Size" column in your task manager to get an accurate ram reading

#

yes the values are both given in bytes

frigid mesa
#
.addField("• Mem Usage heap", `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} / ${numberWithCommas((os.totalmem() / 1024 / 1024).toFixed(0))} MB`, true)
#

thats what I had before

earnest phoenix
#

@quartz kindle where's the commit size

small prairie
#

I was gonna ask the same

frigid mesa
quartz kindle
#

good, now monitor these values over time, and check if any of them gets to like 500mb+

#

@earnest phoenix @small prairie task manager -> details -> right click any column title -> select columns -> enable Commit Size

small prairie
#

i cant even find details ;-;

#

oh u mean more details

quartz kindle
small prairie
#

realized that the moment i said the last thing

jagged sun
#

if(!message.guild.voice) return
This does somehow not work, when my bot gets vkicked it still does not return... Can someone help me? Using discord.js latest

quartz kindle
#

you will need to check for both, voiceState and voiceState.channel

#

since discord.js keeps the state cached even after it leaves

jagged sun
#

How do I do this?

quartz kindle
#
if(!message.guild.voice) return
if(!message.guild.voice.channel) return

or

if(!message.guild.voice || !message.guild.voice.channel) return

or (node 14.8+)

if(!message.guild.voice?.channel) return

or

if(!(message.guild.voice || {}).channel) return
``` lmao
pale vessel
#

that last one

#

god damn

jagged sun
#

lol ty, I would have just needed one but nvm xD

quartz kindle
#

that last one is a pretty common trick for these kind of situations

slender thistle
#

lmao that's tricky

pale vessel
#

i use that in my functions

small prairie
#

the last one damn