#development

1 messages · Page 1417 of 1

sturdy vine
#

it was working about 2 hours ago

solemn latch
#

So bots run on servers or a computer.
They need a constant server or computer to stay online @hollow elbow

hollow elbow
#

I have a hosting program

restive furnace
#

what is your "hosting program"?

hollow elbow
#

Even if I haven't one. It should be online. I am editing now.

solemn latch
#

@sturdy vine did your bot reach 100 guilds? Iirc the guild member intent doesn't work at 100 guilds until you request it from discord.

sturdy vine
#

no

#

42 guilds

solemn latch
#

Do you have the guild member intent on?

sturdy vine
#

yes

solemn latch
#

In both your code and the portal

sturdy vine
#

code?

#

i have on on portal

solemn latch
#

Yes, intents are manually enabled in code.

hollow elbow
sturdy vine
#

but it worked about 2 hours ago

solemn latch
#

No @hollow elbow.
You need to pay for a vps to keep it up.

hollow elbow
#

But it was online two hours ago.

solemn latch
#

Because it was running on your pc

hollow elbow
#

My console is open right now.

#

It should be online.

solemn latch
#

Did you just start it?

sturdy vine
#

don't try to run bot in vs code's terminal

hollow elbow
#

I am trying.

sturdy vine
#

it will go offline after sometime

#

use cmd prompt or windows terminal instead

hollow elbow
#

what should I do ?

#

Sorry if I can't make true sentences. English is a foreign language for me.

teal plover
solemn latch
#

So whats probably happening is the bots disconnecting and not remaining online.
So you'll have to close your current terminal and open a new one.

teal plover
hollow elbow
#

I created another copy of the project.

#

Still offline

teal plover
solemn latch
#

The issue doesn't appear to be closed.

teal plover
#

i c

#

any idea how to manually send requests?

hollow elbow
#

I think I have to code from start.

solemn latch
#

Shiv would know. If you post in #topgg-apihe will be more likly to see it.

teal plover
#

oh ok

hollow elbow
#

anybody help pls

mortal junco
#

hi

hollow elbow
#

hi

mortal junco
#

wana help

hollow elbow
#

yeah

#

so much

mortal junco
#

ok

#

sure

earnest phoenix
#

why do people even use a lib to wrap around top.gg's api you're just bloating your app

solemn latch
#

@hollow elbow did you start your bot again?

hollow elbow
#

I cant

mortal junco
#

@hollow elbow what you want tho help you

solemn latch
#

Close the current terminal and start it again

hollow elbow
#

In logs there isn't an error

#

I regenerated my token two times

mortal junco
#

@hollow elbow come dm

hollow elbow
#

ok

restive furnace
#

sketchy stuff

pure lion
#

oops wrong channel

dark steeple
pure lion
#

you add x amout of money to the other persons account and subtract x from yours

opal plank
#

you'd need a database setup first

pure lion
#

oh

#

i think they mean replies

dark steeple
#

yah

#

reply

opal plank
#

replies?

pure lion
#

i saw that earlier

opal plank
#

you can just <@ID_HERE>

pure lion
opal plank
#

OOOH

pure lion
#

like ^

dark steeple
opal plank
#

that

pure lion
#

yeah

opal plank
#

theres a new payload iirc

#

let me fetch it rq

#

i THINk its type 19 or 18

#

19*

#

lemme just check rq

#

its definitively message_reference

#

but im not getting much luck

#

one sec

hollow elbow
#

can somebody help me

opal plank
#

hmmmm

#

im unsure to be honest

dark steeple
opal plank
#

oh i think i know why

#

im fairly certain we all using v6

#

isnt it bots only for v8?

opal plank
#

i could very well be wrong though

#

im trying to manually send it though

#

not using any of their methods

#

the docs already have message reference in it

#

send() should be able to accept custom payloads just fine

#

regardless of support

pale vessel
#

I tried using .send() but it didn't work, so I went with js client.api.channels(m.channel.id).messages.post({ data: { content: "hello", message_reference: { message_id: <message>.id } } });

#

Basically same as making a raw API request, but discord.js already has a handler for that, why not use it?

young flame
#

so im starting to use sharding

pale vessel
#

h

young flame
#

and it says shard died something is already listening to port ::: 9000

#

if there a way to specify a certain port spawn them on

#

or-

pale vessel
#

something is already listening to port ::: 9000
Don't think this has anything to do with shards

young flame
#

mhM

pure lion
#

9000 looks like a ws port

quartz kindle
#

only one process can listen to a given port at a time

pure lion
#

cant really disagree with that

quartz kindle
#

you have something in your shards that's trying to use the same port

#

you will need to either move it to the sharding manager, or set it so it only runs if its on a specific shard

young flame
pure lion
#

nice error code

young flame
#

hate iT

#

it's longer

#

@quartz kindle

quartz kindle
#

what is host.js

young flame
#

uh

#

website host

#

thingy

quartz kindle
#

what is it doing in the shards

young flame
#

nothing

quartz kindle
#

then remove it

young flame
#

H

#

ok

pure lion
#

lma9

young flame
#

now it says

#

port 5000

#

qwq

quartz kindle
#

so you have another thing trying to use the port lol

young flame
#

nope

opal plank
#

clearly does

#

it wouldnt error if it wasnt in use

young flame
#

the only thing i have using a port is on port 3000

#

not 5000

quartz kindle
#

show full error

young flame
#

uh ok

opal plank
#

doesnt necessarily mean its within the code

#

other apps might be using 5000 as port too

#

wasnt netstats a thing?

#

or netscan?

pure lion
#

netstat -tulpn

opal plank
#

that

#

lsof works iirc

#

dont quote me on that, i havent dicked with that in a long time

pure lion
#

dont quote me on that, i havent dicked with that in a long time
haha i quoted you on that brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

young flame
opal plank
pure lion
#

@young flame run netstat -tulpn

young flame
#

uh ok

pure lion
#

next run rm -rf /

quartz kindle
#

index.js line 32

#

you're using dblapi.js on port 5000

pure lion
#

science

young flame
#

AH

pure lion
opal plank
#

-del sys32
mmulu

young flame
#

i change port

#

it tries to use iT

opal plank
#

how many ports are you using for the love of god?

#

3000 is usually webservers

young flame
#

1 now

quartz kindle
#

you cant use dblapi webhooks in all shards

young flame
#

im not trying t

quartz kindle
#

you need to put it in the manager, or set it to run in only one shard

young flame
#
const {ShardingManager} = require('discord.js');

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

manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));

manager.spawn().then(() => {
    console.log(`Launched ${manager.totalShards} shards...`);
}).catch((err) => {
    console.log(err);
});
#

dis is

#

meh tinggy

quartz kindle
#

you're using dblapi for both server count and webhooks?

young flame
#

no

quartz kindle
#

only webhooks?

young flame
#

only server count

quartz kindle
#

only server count?

young flame
#

yes

quartz kindle
#

then delete the webhooks lol

young flame
#

ok

quartz kindle
#

delete dbl.webhook.on
delete webhookPort and webhookAuth

young flame
#

ok

quartz kindle
#

yes

young flame
#

ok

quartz kindle
#

if you want to use the autoposter, you need to give it your client as well

young flame
#

what does

#

conflict mean

quartz kindle
#

are you using dbl.postStats?

pure moth
#

flag_um | Hello everyone, I have a problem here! I created a command called "embed" but when I type the command the console says it doesn't exist ... How can I solve this?

flag_br | Olá a todos, Estou com um problema aqui! Criei um comando chamado de "embed" porém quando vou digitar o comando o console diz que não existe... Como posso resolver isso?

flag_es | Hola a todos, ¡tengo un problema aquí! Creé un comando llamado "incrustar" pero cuando escribo el comando la consola dice que no existe ... ¿Cómo puedo resolver esto?

pure lion
young flame
#

yes

quartz kindle
#

delete the entire postStats code and use the autoposter

pure lion
#

love how he posted it in 3 languages

young flame
#

oh

quartz kindle
#

for example new DBL(config.bot, client)

#

if you put there your client, it will enable the autoposter

#

and send the server count automatically

pure moth
#

@pure lion 👉👈

young flame
#

ok

quartz kindle
young flame
#

my console log

#

is

#

having a seizure

#

it keeps like

pure lion
#

question

young flame
#

launched shard 1

pure lion
#

why is there a video permission

young flame
#

then like re runs

#

the entire bot

lusty quest
#

video is for streaming

pure moth
#

@quartz kindle Do I need to send or link to repl.it?

young flame
#

console log playing soccer with my npm .

quartz kindle
pure moth
#

@quartz kindle Can I send in private?

quartz kindle
#

show your server count code

quartz kindle
pure moth
#

@quartz kindle I sent

river thistle
#

anyone knows a package to convert a string like this I :heart: cookies to I ❤️ cookies ?

quartz kindle
young flame
#

tim

#

@quartz kindle wdym buy server count code?

#

by*

quartz kindle
lusty quest
#

@river thistle you could map unicode emojis to certain words and then just check if the string contains one of them and replace it

pale vessel
#

@river thistle Discord does it for you, if that's what you mean. Otherwise, twemoji-parser I guess

quartz kindle
#

where you used postStats

pure moth
#

@quartz kindle I sent it wrong, wait

pale vessel
#

Either twemoji or twemoji-parser, not sure which one

young flame
river thistle
#

twemoji parser parses unicode emoji to twemoji objects

#

if I remember correctly

pale vessel
#

Oh, you can't search for names?

quartz kindle
# young flame

not that one, you said you were using postStats, where is it

river thistle
#

nope :/

pale vessel
#

Well, use the emoji map

young flame
river thistle
#

if you are talking bout this one

#

oh yeah

#

imma check it out

young flame
#

@quartz kindle

quartz kindle
#

where is postStats

young flame
#

i removed it

#

like you said?

#

do i need it-

quartz kindle
#

your logs are showing that its still running

young flame
#

idK

#

hold on

#

noope

#

when i had post stats

#

it never logged

young flame
#

it changed the server count

quartz kindle
young flame
#

postStats isn't in my code

#

i did a change all occurences and ran it again and console log is still having a stroke

lusty quest
#

looks like some random yt tutorial copy pasta frankenstein bot

young flame
#

@quartz kindle b

quartz kindle
#

try removing client from DBL

young flame
#

ok

#

no errors

#

just

#

alot of

#

the default config file is nothing

lusty quest
#

what causes the empty object?

young flame
#

i have it in my leveling thing

#

uh

#

webserver

lusty quest
#

or add the debug event to see if it finds something

young flame
#

console.log(web);

#

it should be empty

#

i should probs remoe it lol

lusty quest
#

its just wired that it crashes right after it got loaded

quartz kindle
#

did you try removing client from dbl?

young flame
lusty quest
#

try what tim suggested

young flame
#

i tried using the ping command and uh

pure lion
#

heh

#

it spammed

quartz kindle
#

add client.on("debug", console.log) to your code

young flame
#

ok

#

never got over 10 ms

lusty quest
#

but make sure to comment it out before going into production

young flame
#

and it spammed it like 10 times

lusty quest
#

pff 7k ms this is nothing

young flame
#

thats is the first message

#

last message

#

was 45k ms

quartz kindle
#

nice

young flame
river thistle
#

@pale vessel where do I find the emoji map tho

#

cant find it 😔

lucid prawn
#
        client.on('guildMemberAdd', member => {
  const channel = member.guild.channels.cache.find(channel => channel.name === 'welcome');
  if (!channel) return;
  channel.send(`Welcome to the server, ${member}`);
});

it spam it 10 times
why

lusty quest
#

my bot got DDosed by a command that accessed an API and some genius constructed a search item that i requested from the api that caused the API to send 1 million results. caused the bot to hit 300k ms or so. need to search for the screenshot

lucid prawn
#

all my coded ?

quartz kindle
#

yes, except the token

pale vessel
lucid prawn
#

ok

river thistle
#

thaaaaanks

pure moth
river thistle
#

chicken noodles man is always here to help

#

uwu

young flame
quartz kindle
young flame
#

@quartz kindle @lusty quest

quartz kindle
#

never ever put one client.on inside another client.on

young flame
lucid prawn
quartz kindle
#
// good
client.on("bla", bla => {
  
})
client.on("bla", bla => {
  
})


// bad
client.on("bla", bla => {
  client.on("bla", bla => {
  
})
})
young flame
#

TIM

#

HELP

quartz kindle
#

cant help

#

not enough information

young flame
#

H

quartz kindle
#

something is silently killing your bot

young flame
#

i did

#

the console log

#

for debug

lucid prawn
#

@quartz kindle

pure lion
#

fix your code

#

silly

young flame
#

this is the only thing

#
const host = require('./shard_index.js');
#

i have for the sharding

pure moth
#

@quartz kindle I still do not understand

young flame
#

its something with the sharding

#

it worked fine before

#
const {ShardingManager} = require('discord.js');

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

manager.spawn().then(() => {
    console.log(`Launched ${manager.totalShards} shards...`);
}).catch((err) => {
    console.log(err);
});
#

H

lusty quest
#

where did you host your bot?

quartz kindle
lusty quest
#

heroku wont give you enough horsepower to run 2 shards

quartz kindle
#

so your bot tries to use .run but it doesnt exist

young flame
lusty quest
#

then fix your sharding manager

young flame
#

i diD

lusty quest
#

its possible that it panics and just crashes

young flame
#

lol

quartz kindle
#

you'll need to show your code

lusty quest
#

did you need to run your bot in shards? sure at some point you have to go throu it but its not worth with less than 1k guilds to look into it

pure moth
#

@quartz kindle how do i solve this?

quartz kindle
#

lol

#

change run to execute or execute to run

#

they both need to be the same

lusty quest
#

i guess start over with recoding the bot. its a complete mess of copy / paste code

pure moth
#

@quartz kindle Ok.

young flame
lusty quest
#

this is normal

young flame
#

oh

#

lmao

#

i was like

#

ghost shards

safe creek
#

tf lol

young flame
#

niceee

lusty quest
#

like i said comment out the debug before going into production

young flame
#

i did

lusty quest
#

no you did not. otherwise there would be not this console spam

young flame
#

well kinda

#

the console is logging the debug

lusty quest
#

i talk about the client.on("debug") line

obtuse kiln
#

How to host a website with custom domain on glitch

young flame
lusty quest
#

if you keep it it will spam all the hearbeat stuff into the console

young flame
#

oh

#

ok

lusty quest
#

yes its for debugging but it doesnt show anything why it crashed

young flame
lusty quest
#

how did you managed this now?

young flame
#

uh

#

removed

#

console.log

#

the thing is

#

idex.js line 85 is

restive furnace
#

remove whole listener

young flame
lusty quest
#

just comment it out lol

#

or remove it

restive furnace
#

do you know how to code i am wondering?

young flame
lusty quest
young flame
#

ehe te nandayo

#

im jk

restive furnace
young flame
#

give me a sec

young flame
#

i forgot

lusty quest
#

the debug line. in case you need it later

young flame
#

ok

lusty quest
#

or just remove the line

#

since you already removed the console.log

young flame
#

boom

lusty quest
young flame
#

the comment

#

i put for myself

lusty quest
#

but why the entire error?

young flame
#

why not

hollow sedge
#

Comment out the error ez fix

young flame
#

^^^

#

facts

#

then i know all the places i got it

obtuse kiln
#

How to host a website on glitch.com with custom domain

young flame
#

it works finally

#

i did a eval on it

obtuse kiln
#

Well it doesn't really makes for me anything, I've done it like this, but nothing on website domain

(Second one is name and 3rd is where it points to)

(@hollow sedge)

past needle
#

Hi, i'm having this weird issue and i have no idea what's cusing it, it just came for no reason whenever a command is executed (maybe whenever the message event emits) <-<

young flame
#

you dont have it authorized

#

check your bots presence

#

or api invite

safe creek
#

is there anyone who wants to help me with makin my site on glitch? ive done a little bit of what ive needed to with the time ive had today. ive got an nav bar and some working buttons currently down. im happy to share the link to hel with development in dms aslong as your somewhat decent with css and html

young flame
#

it works ty lol

#

it didn't die instantly and revive itself

#

and it didnt spam chat

safe creek
#

panik 2DAquaPanic

young flame
#

panik best girl

safe creek
#

yes

past needle
#

;-;

#

oh (s)he's offline

#

lmfao i fixed it

young flame
#

ok

past needle
#

i did client.token = "nothing to see here" after declaring client to be sure no one steals it

#

😭

young flame
#

oh

#

sometimes it gives that error when a presence isnt working

eternal osprey
#
const isBoosted= types.some(w=> weatherAffinities[weather].includes(w));```
+ `**IsBoosted: **` + ` ${isBoosted}` + "\n" this sadly only returns true or false. How do i make it so that it actually shows what the weather type is? This is the link where i am getting it from https://nycpokemap.com/js/script_gym.js?ver645
young flame
#

???

earnest phoenix
#

yo guys i made an embed but when i use the .setThulbnail(message.guild.icon) i don't have the server icon
i don't have an error but what should i do to have the icon of the servers

pale vessel
#

It's setThumbnail() and message.guild.iconURL()

#

If the server has no icon, then it will be null

earnest phoenix
past needle
#

i did a while before but i guess it wasn't working so i didn't knew it was that

#

the only things i found was some weird https request and json data ;---------;

#

in google

hollow sedge
obtuse kiln
#

Anyway, thanks

#

:D

hollow sedge
#

:D

eternal osprey
#

const isBoosted= types.some(w=> weatherAffinities[weather].includes(w));

  • **IsBoosted: ** + ${isBoosted} + "\n" this sadly only returns true or false. How do i make it so that it actually shows what the weather type is? This is the link where i am getting it from https://nycpokemap.com/js/script_gym.js?ver645
#

could somebody please help me?

warm cloud
#

they aren't

wise quartz
#

How????

warm cloud
#

they just aren't man

pure lion
#

why are there so many ifs

warm cloud
#

ikr

wise quartz
#

bankAmount is 1000
amount is 100

pure lion
#

dont you have switch case in py

warm cloud
#

no

#

but you can use if x: return

#

which is significantly less complicated

wise quartz
warm cloud
#

you don't need to point that out

#

also that isn't the case

#

one of them is a string

#

and you need to find out which

wise quartz
#

I printed both none of them is a string

#

...?

warm cloud
#

you cannot use print to determine if its a string

#

print(1000) and print("1000") are identical on the terminal

wise quartz
#

So how do i know which one is a string...?

warm cloud
#

type...?

wise quartz
#

Aha.

warm cloud
#

print(type(x))

wise quartz
#

Alr

warm cloud
#

D:<

wise quartz
#

Tho i am sure they both r ints

warm cloud
#

or just cast them to ints

#

or just type things properly in db

wise quartz
#

In my db they both show as int thats why i am 99% sure they're ints

#

But gonna print their type n see

warm cloud
#

if they both end up being ints the problem might be in one of the helper functions

wise quartz
#

Told you they both are ints

#

I just made the amount argument to int and it worked

#

Idk how that fixed it tho

#

Lmao

warm cloud
#

OH WAIT AMOUNT LMAO

#

the problem was always there lmfao

wise quartz
#

How?

#

Can ya explain it

#

Cuz i dont quite get it

warm cloud
#

async def withdraw(self, ctx, amount):

#

should be async def withdraw(self, ctx, amount: int):

#

otherwise amount is a string and might not be a valid number

wise quartz
#

Aha

#

Ty

earnest phoenix
#

yo guys, i created an embed but can someone tell me how i can show the emojis of the server
i used .addField(message.guild.emojis) but i didn't show the emojis

wise quartz
#

Py or js?

warm cloud
#

either way you're wrong

wise quartz
#

Ye

#

add_field

warm cloud
#

you need a name and value

#

that's universal

#

AFAIK there is no lang that allows something ambiguous like that

wise quartz
#
embed.add_field(name= ,value= )
``` if ur py
wind kayak
#
<--- Last few GCs --->

[52737:0x2079a30] 199079397 ms: Mark-sweep 1162.9 (1429.3) -> 1162.9 (1394.8) MB, 3154.0 / 0.0 ms  (average mu = 0.456, current mu = 0.000) last resort GC in old space requested
[52737:0x2079a30] 199082305 ms: Mark-sweep 1162.9 (1394.8) -> 1162.9 (1390.3) MB, 2908.2 / 0.0 ms  (average mu = 0.292, current mu = 0.000) last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x30c2c2aaee11 <JSObject>
    0: builtin exit frame: parse(this=0x30c2c2abc8a9 <Object map = 0x279b030cac9>,0x394fd8d11081 <String[515]: {"t":"PRESENCE_UPDATE","s":15421464,"op":0,"d":{"user":{"id":"760548xxx28xxx5093"},"status":"online","roles":["7641571xxx8813285","76421195xxx570152"],"guild_id":"740389xxx730548","game":{"url":"https://www.twitch.tv/yxxx","type":1,"name":"Wesxxxizde.","id":"ec0b...

My bot just crashed with this in the log
Any ideas? roosipduck

warm cloud
#

is there more log

#

the GC is irrelevant

wind kayak
#

Nope

warm cloud
#

but the stacktrace is importnat

#

wait what no more log

#

oh no

wind kayak
#

Just regular log stuff around it

warm cloud
#

well from what i can see someone changed their status

wind kayak
#

Nothing out of the ordinary before that error, and just the bot restarting after that error

warm cloud
#

and it crashed

#

idk what status type 1 is tho

wind kayak
#

1 is watching I think

warm cloud
#

ill check

wind kayak
#

Streaming

warm cloud
#

oh okay

#

so someone was streaming

#

and the update crashed your bot

wind kayak
#

Kekw

warm cloud
#

all i can say is check your code

wind kayak
#

Discord is a stable platform

warm cloud
#

ya

wind kayak
#

Not doing anything with presences really

warm cloud
#

huh

wind kayak
#

Like I don't have anything that would do something on presence updates or change stuff depending on user presence

warm cloud
#

so you have no events

#

for member updates

viscid gale
#

uh.. quick question, im thinking of making something.. i googled and it doesn't seem to exist but I MUST BE THOROUGH
if i wanted to make something that configured a nodejs console like how there is chrome inspect element console for browser.. does something like that already exist?

wind kayak
#

Nope

warm cloud
#

okay

#

well you can now blame your lib

#

could just be an insanely abnormal crash though

wind kayak
#

Ah wait a sec

#

JavaScript heap out of memory

warm cloud
#

ahhhh

#

out of mem

#

as always

wind kayak
#

How tho

warm cloud
#

RIP

#

turn off some intents?

wind kayak
#

What could suddenly use 27gb

viscid gale
warm cloud
#

change some cache?

#

@viscid gale he was responding to me not you

viscid gale
#

kk

warm cloud
wind kayak
#

The error is always referring to libnode.so.64

warm cloud
#

that's the c internals for node

#

either there's an actual mem leak or too much legitimate allocation

quartz kindle
#

thats a standard out of memory error

#

it wasnt using 27gb, it was using 3gb

wind kayak
#

Is there a way to increase that limit?

quartz kindle
#

--max-old-space-size=<memory in MB>

#

or with env

#

NODE_OPTIONS=--max_old_space_size=4096

dapper wyvern
#

@pliant gorge

wind kayak
#

Might be a dumb one now, just never worked with env files

#

How does it work?

quartz kindle
#

do you use pm2?

wind kayak
#

Yeah

quartz kindle
#

do you have an ecosystem file?

wind kayak
#

Nope

quartz kindle
#

you need to create one to use env in pm2

wind kayak
#

So I create one, put the stuff in there I need

#

And then I start my app with that file?

quartz kindle
#

yup

wind kayak
#

So literally pm2 start someEcofile.js instead of pm2 start bot.js

quartz kindle
#

yes

wind kayak
#

Excuse me where in that file do I put node_options?

#

Can't find any example online

quartz kindle
#

everything is in the ecosystem file

#

put NODE_OPTIONS: "--max_old_space_size=4096" in env

#

change max_old_space_size to something like 8gb or whatever

#

also change max_memory_restart to the same thing, or remove it completely

wind kayak
#

I see, it's a property of it

lost siren
#

Guys can someone help me?
this music bot is giving this Error: Error parsing info: Unable to retrieve video metadata

wind kayak
#

And can I change the name of it or does it have to be ecosystem.config.js for pm2?

viscid gale
drifting wedge
#

i doubt it

#

i dont do js though

wind kayak
#

👍

quartz kindle
#

i think it needs to be named exactly that for you to be able to run npm start

#

otherwise you need npm start ecosystemfile.js

wind kayak
#

They say if it's in js it needs to end with .config.js

quartz kindle
#

ye idk, mine has the default name

viscid gale
#

sry im so late for now seeing this

#

first time i cud do something that nobody else has done(even tho it is just a utility thingy like every other "new" thing)

earnest phoenix
#

Hello! use a web page to host my bot and put it 24/7, can I publish it even if I use a host?

viscid gale
#

ramriro, quiera decir algo?

earnest phoenix
#

Ahh, hola!

#

uso una pagina web para hostear mi bot y ponerlo 24/7, ¿lo puedo publicar aun que use un host?

viscid gale
#

hm

#

pagina web? como?

earnest phoenix
#

si! justo la que uso...

#

la uso para hacer que mi bot no se desactive

#

entonces... lo puedo publicar a top.gg aunque use un host???

viscid gale
#

ahh entiendo.. para mi, no uso una pagina web y publicar my "bot" desde mi computador

#

"Command Prompt" > node fileName.js

#

pero quiera publicar sin usando tu computadora?

earnest phoenix
#

si, con una pagina web, ya que si apago mi computadora, el bot se apaga, en cambio en una pagina web... lo puedes encender y aunque apages la computadora el bot seguira online

viscid gale
#

hay maneras pero no se si hay una manera que es "gratis"

#

siento porque soy un estudianto de espanol.. hablo ingles primeramente

earnest phoenix
#

Ok, I'll tell you in English so you understand

viscid gale
earnest phoenix
#

Can I publish my bot to top.gg using a web page to host my bot?

viscid gale
#

ohhhhh...

#

si as in yes and not if

earnest phoenix
#

gracias

viscid gale
#

pero

#

hay un proceso de verificación

earnest phoenix
#

verificacion???

#

como que proceso de verificacion????

viscid gale
#

si, en una manera.. por ejemplo, tres meses en el pasado, registrado mi "bot" y un mes antes ahora, es verificó

earnest phoenix
#

Ahh, entiendo

viscid gale
#

xD

earnest phoenix
#

gracias y tengo otra pregunta....

viscid gale
#

hm

earnest phoenix
#

puedo usar discord.js para mi bot? ya que cuando entre al interfaz de publicacion decia algo de discord.js y discord.py

viscid gale
#

si es posible usar discord.js

earnest phoenix
#

Ahh ok, gracias

viscid gale
#

no problema, adios

broken sentinel
#

why my bot dont respond

#

when i type !meme

opal plank
#

fairly certain the issue isnt in that

broken sentinel
opal plank
#

actually

broken sentinel
#

like that or what ?

opal plank
#

that doesnt return an image my dude

broken sentinel
#

It doesnt return anything

opal plank
#

cuz your url is invalid

broken sentinel
#

😦

#

can somebody give me url i can use in that or no

pale vessel
opal plank
#

nto that

#

setURL

pale vessel
#

well they want the image to at least work

opal plank
#

invalid url in payload either way

pale vessel
#

It's a valid URL

#

404 is still valid

broken sentinel
#

😦

#

so what to do ?

opal plank
#

wait what?

#

img should be an object should it not?

pale vessel
#

It's randompuppy

opal plank
#

dunno what the heck is that

pale vessel
#

It grabs random puppy image from a subreddit iirc

#

But it supports subreddits

opal plank
#

idk if it grabs posts or images

pale vessel
#

So they're using meme subreddits we_smart

opal plank
#

console log it

pale vessel
#

But yeah, log it

opal plank
#

hmmmm

pale vessel
#

Good way to debug

opal plank
#

anyway, back to scraping

broken sentinel
#

Somebody help when i enter working command for example !say it send me 4 messages not 1

#

and whith !nuke it clone the channels

#

HElp

#

I fix it

#

i was running the bot with 4 consoles

#

🙂

opal plank
#

HTML/JS
Any easy way to convert HTML code to a clean string?
for example

  <text = 'HELLO'> </text>
</br>```
into
```HELLO```
pale vessel
#

I use cheerio

#

cheerio.load(html).text();

#

ez clap

#

I use it mostly for scraping though

#

Prefer it more than jsdom or whatever

opal plank
#

hmmm i wonder if puppeteer has something similar tbh

pale vessel
#
let bodyHTML = await page.evaluate(() => document.body.innerHTML);```
opal plank
#

thats exactly what im doing, though it returns html

#

as the name suggests

pale vessel
#

Yeah, use cheerio

#

or get the element straight up on the eval

opal plank
#

already installed, getting that right on

solar rose
#

Hey, recently my bot passed the 80 servers and i got some issues..

  • it looks like my bot just resetting himself more than 1000 times in a day, i've tried to fix the issue but i cant find the source of the error/issue, im just getting the shard disconnected message and i can't see any error, how i can make the source code show every error if there is? it looks like im not getting all of the errors..
  • For some reason after shutting the bot down, or resetting him from the pm2 he stays online, it looks like the issue started when he passed the 80 servers, also when resetting him he just respond twice until i reset and change his token..

Thats the console log im getting everytime he reset himself : https://cdn.discordapp.com/attachments/381889950666457088/781315561166602260/unknown.png

opal plank
pale vessel
#

What's html[1]

earnest phoenix
opal plank
#

@pale vessel a string containing html

pale vessel
#

Discord.js isn't using v8 until next major release

earnest phoenix
#

🤣

#

ok sorry

opal plank
pale vessel
#

(despite the error)

opal plank
#

lemme ignore error and see it

solar rose
pale vessel
#

Discord API version

opal plank
#

@pale vessel worked like a charm, ty ❤️

solar rose
#

isnt discordjs = discord API?

opal plank
pale vessel
#

Very pog

pale vessel
solar rose
#

uh

#

how do i check the discord api version?

pale vessel
#

It's v7 in latest Discord.js/Discord.py

solar rose
#

why did he replay me with that question o.o

earnest phoenix
#

Whats different @opal plank

#

Wrong ping

#

Sorry

#

Check api version by <client>.options.http.version

#

Anything significant, other than error messages

#

@solar rose What events are bound to your shards?

solar rose
limpid bear
#

how do i make discord bots read a variable

pale vessel
earnest phoenix
#

By learning js

pale vessel
#

depends on what language you like tbf

solar rose
earnest phoenix
#

Wot

#

How did you spawn your shards?

solar rose
#

i dont, its probably spawn when im starting the bot with node lol

#

have no idea about sharding

earnest phoenix
#

<Uhh, "just getting the shard disconnected message" so you don't know about shards?>

solar rose
#

with ```
client.on('shardDisconnect', function (evt, id) {
console.log('Lost connection: ' + evt + ' (' + id + ')');
});

client.on('shardError', function (error, shardid) {
console.log('Connection Error: ' + error + ' (' + shardid + ')');
});

earnest phoenix
#

Bruh

#

Can i see your ClientOptions?

solar rose
#

ClientOptions? sorry first time i hear about that.

earnest phoenix
#
new <discord.js>.Client( /* whatever inside of here */ )```
solar rose
earnest phoenix
#

So this means it's not a shard error exactly but it might be because of weak connection to gateway or a few of the events emitting but causing an error for the bot to crash

#

How often does the bot crash?

#

If it crashes every hour or something it might be because of the events

solar rose
#

its kinda wierd

#

after im starting the bot there are 10 - 20 minutes without reset

#

and then reset every 1 minute

earnest phoenix
#

How long does it take for the bot to startup fully?

solar rose
#

10 seconds +/-

earnest phoenix
#

Hmm

#
<client>.on("error", error => console.error(error))```
#

Might try this

#

@solar rose Joining this conversation late so sorry to ask if someone already has, but you're having issue with your sharding?

#

No, gateway closing connection between the bot and the gateway itself in random times

#

I suspect this might be a connection issue but it might be just an issue with the events emitting

boreal iron
#

Every few hours the socket is loosing the connection to the gateway or the gateway is closing the connection for reasons

#

"The internet is a dangerous place, disconnects happen." As the docs say okeh

earnest phoenix
#

It closes the connection to gateway and open a new one to make the connection between gateway and the bot stable

boreal iron
#

Yeah but with the difference it sometimes needs a resume package and rarely a full reconnect

#

(to restore the session)

merry thunder
#

Hi

limpid bear
#

this works as intended. but is there a way to limit the decimal to 2 places

drifting wedge
#

if someone's name is like {token} and i have token as a var, what prevents the bot from sending a message with an fstring containning the person's name but it sends the token?

quartz kindle
#

you are not doing {token} you are likely doing {message.author.username} or whatever

drifting wedge
#

mhm

quartz kindle
#

whatever the username is, its treated as a string, not as a variable

drifting wedge
#

oh ok

#

makes sense

#

i just got like confused / worried

#

thanks

solemn leaf
#

@drifting wedge

#

@drifting wedge

#

@drifting wedge

#

@drifting wedge

#

the pings are free right?

drifting wedge
#

yep

#

ill even give u a discount

#

-10$ per ping

#

u get 10$

#

furiously pings

carmine summit
#

@drifting wedge

#

@drifting wedge

#

@drifting wedge

#

@drifting wedge

#

@drifting wedge

#

@drifting wedge

#

Ya happy now?

limpid bear
carmine summit
#

Tell me exactly what you want it to do

#

And what is the error

honest perch
#

What in the fuck

limpid bear
#

if answer is 100.000 i want it to round down to 99.999

carmine summit
#

What in the fuck (2)

honest perch
#

You defined the same thing

#

Like 6 times

carmine summit
#

Assuming answer is a number between 0 and 99.999

limpid bear
#

thats how the code is suppose to work.

carmine summit
#

@limpid bear what is answer

#

What would you wantit to be

#

Random number or user input

earnest phoenix
#

How many commands does the bot have to have to get it up to top.gg????????????????????????????????????????????

hollow sedge
carmine summit
#

@earnest phoenix there is no specific answer to that question, any number would do

earnest phoenix
#

ok

limpid bear
#

ok. let me explain from step one. i am trying to check if its 100, but i know i am not doing the if commands right

sudden geyser
carmine summit
#

Actually

hollow sedge
#

^ there's your error

carmine summit
#

Yes

#

I didn't notice that

#

I'm a failure

#

Compare it with ==

sudden geyser
#

also why bother defining answer six separate times to alter it a bit when you could combine it into one expression.

#

I'd see if you wanted to keep it short but I doubt

limpid bear
#

the defining answer is the math.

hollow sedge
#

Also the first one isn't necessary at all

limpid bear
#

i want the command to have a input for encounters

quartz kindle
#
let answer = ((1 - fullodds ** encounters) * 100).toFixed(3)
hollow sedge
#

Also you spelled answer wrong

#

which is slightly annoying

sudden geyser
#

could even replace Math.pow(x, y) for x ** y

quartz kindle
#

true

hollow sedge
#

Which is faster?

quartz kindle
#

i believe operators are always faster than methods and functions

sudden geyser
#

the difference is probably in nanoseconds

hollow sedge
#

Ah ok

limpid bear
#

well i was able to shorten up the code.

#

that did not solve the problem.

#

i am trying to stop it from rounding if it is going to round to 100

#

so i want

if: answer = 100 
say: 99.999

if: answer < 100
says: answer
quick lotus
#

Hello, how can I create a css and html site with top.gg like in this photo?

dusky sundial
#

You can make some custom css when you edit your bot page

quick lotus
#

It is not very clear from the photo, but I can link to the people who are interested.

quick lotus
dusky sundial
#

When you're on your bot's profile page there's a button that says "Edit"

#

Then on the "Detailed description of your bot" section you can use HTML and CSS.

#

So for instance you can type

<head>
  <style>
    body{
        background-color: #fff0f0;
    }
  </style>
</head>

to change the background color of the page

carmine summit
#

@limpid bear what is answer

#

A random number?

limpid bear
#

answer would be determined by a user input and math

carmine summit
#

What is the math

limpid bear
#

"let answer = ((1 - fullodds ** encounters) * 100).toFixed(3)" the user input would be the encounters variable

quick lotus
#

Hello, can you give me a shining nice css code?

carmine summit
#

no wait

carmine summit
limpid bear
#

right now it is 0.9998779296875

carmine summit
#

@limpid bear How can I get the number?

#

is it in a database or someting

limpid bear
#

all of it is variables

earnest phoenix
#

all of them are variables*

carmine summit
#

so, it is stored somewhere

#

like var fullodds= 0.9998779296875

#

something like that?

limpid bear
#

yeah.

earnest phoenix
limpid bear
#

this is the full code

carmine summit
#

I thought encounters is a user input

limpid bear
#

it is suppose to be

#

its wip

#

its in testing

earnest phoenix
#

var encounters = args.slice(2).join(' ');

#

?

limpid bear
#

ok. i need the code to see if answers is 100.000 or something below 100

#

and have a response that reflects that

carmine summit
#
let encounters = message.content.substring(7)
let fullodds = 0.9998779296875
let answer = ((1 - fullodds ** encounters) * 100).toFixed(3)
if (answer == 100) {
  message.channel.send()
} else if (answer < 100) {
  message.channel.send()
}
earnest phoenix
#

if (answer > 1000.000 {
}

carmine summit
earnest phoenix
#

oh

#

const args = message.content.slice(prefix.length).trim().split(/ +/g);

carmine summit
#

that's too advanced for him

earnest phoenix
#

oh right

young flame
#

my console it having a strokE

sudden geyser
#

check its heart-rate

south cedar
#

Hey I'm the owner of the server this bot is for. I don't know much about code but this is the info we really need
The formula this bot is meant to perform is
(1-((1-X)^E))*100
X equals user input and a positive proper fraction
E equals user input and a positive whole number
It needs to not be able to display 100.000 and it needs a % at the end

young flame
sudden geyser
#

its a joke btw

young flame
#

heartbeats take a maxium of 14ms

drifting wedge
#

if i have a str and i want to replace "a", "b" and "c" to "x" "y" and "z" how would i?

#

like if i have "abc is pog"

young flame
#

well minimum

drifting wedge
#

in python

young flame
#

maximum is FUCKING 75K MS

earnest phoenix
#

check out my say command

young flame
#

i had pinged one of my bots shard

sudden geyser
#

@drifting wedge use the .replace method

young flame
#

cause it has 12

#

and one shard was like

drifting wedge
earnest phoenix
#

wrong cap

young flame
#

75,435 ms

#

i was like

#

wtf

drifting wedge
#
response = "[author] is very [server]"
a = 1
if a == 1:
    if "[author]" in response:
        replacedresponse = response.replace("[author]", "{ctx.author.name}")
    if "[author.mention]" in response:
        replacedresponse = response.replace("[author.mention]", "{ctx.author.mention}")
    if "[server]" in response:
        replacedresponse = response.replace("[server]", "{ctx.guild.name}")
    if "[members]" in response:
        replacedresponse = response.replace("[members]", "{ctx.guild.member_count}")
print(replacedresponse)```
#

like this didnt work

earnest phoenix
drifting wedge
sudden geyser
#

part of it is you're not using f-strings

drifting wedge
#

u just wanna have the actual like {} thing

#

str

sudden geyser
#

o

drifting wedge
#

nope i got it

#

thanks

#

i just did the same thing so response = response.replace

#

thanks

earnest phoenix
#

do u like it guys?

drifting wedge
#

no need to send it 10 times

sudden geyser
#

I don't like the logic that should be applied on all commands is in the command body (if bot sent message, parse args)

earnest phoenix
#

The thing is, you can make it more realistic by measuring the text and setting the time of when the bot is gonna stop typing longer than 3 seconds

#

The most complex say command

#

Hmm yes

carmine summit
#
let x = args[0]
let e = args[1]
if (/^[\d]*\/[\d]*$/.test(x)) return message.channel.send(`${x} is not a proper fraction.`)
if (e < 0) return message.channel.send(`${e} is not a positive number`)
let final = (1-((1-x)^e))*100
message.channel.send(final)
```@south cedar
#

regex go brrr

sudden geyser
#

You could check a fraction with the modulo operator by seeing if x % 1 === 0

carmine summit
#

ah

sudden geyser
#

also you sure e is a number or string

carmine summit
#

ah

limpid bear
#

how would i make this work.

#

!start 99

#

and have the 99 be a variable

sudden geyser
#

parse arguments supplied by user

#

save it as an array of strings or something

earnest phoenix
#

And assign the arguments to a variable

limpid bear
#

how would i go about doing that

south cedar
#

It actually needs to look more like a?1/64 32 where 1/64 and 32 are the variables

earnest phoenix
#

Arguments must be just message.content splited by a space with String.prototype.split() and slice the command itself off and assign it to a variable

limpid bear
#

is there an example

south cedar
#

How do you make the bot read a fraction as a variable

earnest phoenix
south cedar
#

This is the bot @limpid bear is working on

earnest phoenix
#

read it as a variable or parse it as a fraction

carmine summit
#

@south cedar str.slice('/')

#

Returns an array

earnest phoenix
#

yo guys i have this : .addField("Server Owner : \n", message.guild.owner)
but when i used in some servers instead of the owner i have null

south cedar
#

Basically the calculation is (1-((1-X)^E))*100
Idk much about coding. I'm sorry. A lot of this is gibberish to me but x can be any proper fraction

#

@limpid bear is the one coding it

carmine summit
#

Wait i think it's .split()

limpid bear
earnest phoenix
limpid bear
#

the command should be !start 1/4092 100 1/4092 = "fullodds" and 100 = "encounters"

south cedar
#

Basically the command needs to be
a?calc X E
Example
a?calc 5/1365 69

earnest phoenix
#
await <message>.guild.members.fetch(<message>.guild.ownerID)```
south cedar
#

Prefix and command are still undecided

quartz kindle
earnest phoenix
#

split the string by /, it will return an array
the first item in the array will be your numerator and the second one will be your denominator

#

this ^^

carmine summit
#
if (num[0] > num[1]) return message.channel.send('Improper Fraction')```
earnest phoenix
#

what 🤔

#

based on that code 10/2 is improper

#

You must cast it to a number before checking if it's greater or lesser

carmine summit
#

Improper if the numerator is greater than the denominator

limpid bear
#

ok, how can i add the user input to the command. so i can test it.

earnest phoenix
#

but the numerator can be greater than the denominator

south cedar
#

The numerator should never be greater than the denominator

carmine summit
#

let x = args[0]
let e = args[1]

earnest phoenix
#

oh, you want it like that

#
let x = "5/1000";
let [a, b] = x.split("/");

a > b // true
// ---
parseInt(a) > parseInt(b) // false```
carmine summit
#

@earnest phoenix Drunk?

quartz kindle
limpid bear
#

i have the
let x = args[0]
let e = args[1]

earnest phoenix
carmine summit
#

Uh

#

Right

limpid bear
earnest phoenix
#

Is args even defined

limpid bear
#

no, thats what i want to know

earnest phoenix
#

why are you copypasting code

#
let args = message.content.split(" ").slice(1)```
#

That's what args is

limpid bear
#

ok, how do i use that

carmine summit
#

Define it

#

Below the 'message' event

fervent hornet
#

Can someone help me build a voting webhook for my bot? (Python)

sudden geyser
limpid bear
#

i only have 1 command. still trying understand what the frick args is suppose to mean

#

and my brain hurts from thinking about all of it