#development

1 messages ยท Page 1809 of 1

earnest phoenix
#

@sudden geyser

snow urchin
sudden geyser
#

A command for a bot (e.g. !ping), or a command for your command-line interface?

lusty quest
sudden geyser
#

You may be interested in <#502193464054644737 message>.

In order to create a command, you need to create a bot. In order to create a bot, you need a programming model. There's a lot to learn in the programming world.

snow urchin
sudden geyser
#

so it isn't in your path

lusty quest
#

pm2 status also gives you the same error?

snow urchin
#

I can run the commands just fine without it being in a sh script

lusty quest
#

then there is probably an error in your script

snow urchin
#

nope

#

it literally says "command not found"

lusty quest
#

what did you try to start with your script?

snow urchin
#

thats not really relevant

lusty quest
#

maybe you could just use a ecosystem.config.js

lavish galleon
#

hello, I made my bot from glitch, but in an error that only happened today, my bot was only online, so it seemed to be broadcasting, now it just doesn't respond to online commands, please help

#

@round cove sorry for the tag, can you see if there is a solution to my problem, please?

round cove
#

No.

#

Sorry. ๐Ÿ™‚

earnest phoenix
#

ah yes pinging random mods for help

round cove
#

I know nothing about glitch.

lavish galleon
lavish galleon
earnest phoenix
sudden geyser
#

It's asking you to create a folder for your bot.

earnest phoenix
#

what do they mean my folder

sudden geyser
#

For example, you could create a folder called bot on your desktop.

earnest phoenix
#

like this?

sudden geyser
#

If you can access it, that works.

earnest phoenix
#

ok

#

Shift+Rightclick

#

Am I just blind or is there nothing named "secret"

vivid fulcrum
#

๐Ÿ‘๏ธ ๐Ÿ‘„ ๐Ÿ‘๏ธ

#

the "secret" in the article is just an adjective

earnest phoenix
#

oh im dumb

vivid fulcrum
#

you can just open powershell

earnest phoenix
#

so uhh what do i do

#

oh

sudden geyser
#

You want to try following the article as best as you can. A lot All of your questions can be answered by Google.

earnest phoenix
#

damn

slender thistle
#

Shift + Right mouse button as it says. There will be an option to open command prompt

vivid fulcrum
#

command prompt was replaced with powershell like a while ago

#

you need to edit regedit files to bring back the cmd prompt option

#

that's the part where they got confused at ig

earnest phoenix
vivid fulcrum
#

oh my god

earnest phoenix
#

LOL

sudden geyser
#

is that even a token

vivid fulcrum
#

yes

earnest phoenix
#

no

vivid fulcrum
#

regen the token

earnest phoenix
#

ok imma stop being dumb

#

lol

#

ok even when im not dumb i still dont know what to do

wheat mesa
#

Now that's a new one that I haven't seen

#

Powershell

vivid fulcrum
#

powershell is so much more better than cmd

#

combine it with ohmyposh and winterminal and you've got heaven

wheat mesa
#

...Or just use VSC or at least Notepad++

earnest phoenix
#

I have VSC

wheat mesa
#

That's probably a lot easier than trying to use powershell

vivid fulcrum
#

pretty

earnest phoenix
#

i feel so dumb

#

what do i do next

vivid fulcrum
#

pray to discord gods

earnest phoenix
#

๐Ÿ’€

vivid fulcrum
#

why aren't you following the article

earnest phoenix
#

i am

wheat mesa
earnest phoenix
#

idk how to save it

wheat mesa
#

Use VSC

solemn latch
#

uh, powershell isnt an editor

earnest phoenix
#

ok

sudden geyser
wheat mesa
#

Real devs take screenshots of their code and save them as PNGs, then they run them from there!

vivid fulcrum
#

red means it worked

wheat mesa
#

you forgot to name the file index.js.py.cpp.cs

earnest phoenix
#

not sure what this means

vivid fulcrum
#

i-

#

my screenshot was sarcasm

#

don't copy what i did there without knowing what it is lol

earnest phoenix
#

ik

earnest phoenix
#

i know

#

LAG

vivid fulcrum
earnest phoenix
#

ok damn

solemn latch
solemn latch
vivid fulcrum
#

you're throwing yourself in the lion's den, creating a bot obviously needs skills that you lack, you should probably familiarize yourself with CS basics first

earnest phoenix
#

AYYYY I DID IT

sudden geyser
#

congrats

wheat mesa
#

Congrats

#

You still have a long ways to go, but that's a good start I suppose

dim hearth
#

Ayy congrats

earnest phoenix
#

i didnt download discord.js

#

thats why

#

i geuss i just skipped over it

#

lol

#

face palm

dim hearth
#

Lol

lyric mountain
earnest phoenix
#

me smart

lyric mountain
#

Ignored topggHurt

earnest phoenix
#

ok

wheat mesa
#

I'm assuming he's not doing library-less

wheat mesa
lyric mountain
#

He said he skipped installing d.js, that's why I asked

wheat mesa
#

Yeah, I think he just meant he forgot to install it

earnest phoenix
wheat mesa
#

Do bots need the ATTACH_FILES permission to set the image in an embed?

rocky mountain
lyric mountain
#

only if you're the one uploading the image

#

afaik you don't need it for external links

earnest phoenix
lyric mountain
#

I might be wrong tho

wheat mesa
#

Alright

lyric mountain
plain talon
#

yeah, embed images just use a url

lyric mountain
#

a bot doesn't have a finish line

#

it's an eternal project

rocky mountain
#

has anyone here worked with webrtc?

earnest phoenix
#

ok i am being dumb again

lyric mountain
#

oh hell

quartz kindle
lyric mountain
#

oh hey timotei

plain talon
#

use 1 command event

earnest phoenix
#

why is it like this

#

i am dumb

vivid fulcrum
#

dante would be proud

wheat mesa
wheat mesa
earnest phoenix
#

tf does that mean

lyric mountain
#

you should learn javascript before trying to make a bot

#

you're skipping many steps

rocky mountain
wheat mesa
#

You're using client.on("message", (message) => {}) 3 times

#

That's redundant

vivid fulcrum
#

why my bot use so much ram!!!

wheat mesa
#

use detritus

#

๐Ÿ˜ˆ

quartz kindle
#

me

vivid fulcrum
#

me ;-;

earnest phoenix
#

nbm

wheat mesa
lyric mountain
#

I count dracula

earnest phoenix
#

i know

#

im just dumb

wheat mesa
#

@earnest phoenix you should learn more about Javascript before attempting to make a discord bot

quartz kindle
#

if you want to

wheat mesa
#

You'll get confused sooner or later, it's better to learn the basics of the language first.

lyric mountain
#

sooner in this case

quartz kindle
#

do you know what javascript is?

earnest phoenix
#

yes

#

but

#

where am i supposed toi learn more about it

quartz kindle
#

internet

wheat mesa
#

^^

quartz kindle
#

guides, courses

earnest phoenix
quartz kindle
#

codecademy codacy etc

lyric mountain
#

w3schools, mozilla, baeldung

graceful mortar
#

wouldnt recommend hopping into js if its your first day. discord.py should be much easier to digest

wheat mesa
#

Personally I like to make something, then when I encounter problems I look for solutions online. It's important that you don't just copy paste everything a site says, and that you actually understand WHY it works.

graceful mortar
modest maple
#

Both libs will fuck you if you dont know what you're doing

#

if you dont know python d.py will fuck you even more

graceful mortar
#

of course, that applies for everything

wheat mesa
#

Yeah, python imo probably more confusing than js

#

For beginners

graceful mortar
#

how so?

lyric mountain
#

python is reeeeeally different from pretty much any other lang

wheat mesa
#

Syntax

modest maple
#

Python's async system is far more complicated than JS

earnest phoenix
#

ahem

#

so like i know

#

but idk

lyric mountain
#

for example, if you start learning C you automatically understand the syntax of most available langs

#

that's because the syntax is really close to each other

quartz kindle
lyric mountain
#

python is....unique

earnest phoenix
#

ok

earnest phoenix
modest maple
#

I mean learning syntax takes less than an hour tbh

#

its the fundamentals that take time

#

and those fundamentals can be used from language to language

graceful mortar
#

wait, so dayo has past programming exp?

rocky mountain
earnest phoenix
#

ok got it

earnest phoenix
wheat mesa
#

Personally I just dislike python due to the fact that indentation controls the behavior of the language

rocky mountain
#

10/10 wouldn't recommend js as a starting programming language

wheat mesa
#

I think js is a great place to start

graceful mortar
#

i wouldnt recommend js to start off with.

modest maple
wheat mesa
#

Just not building a discord bot

quartz kindle
#

what would you recommend then? C?

#

lmao

rocky mountain
lyric mountain
#

I recommend java

graceful mortar
#

python

lyric mountain
#

although I might be biased

earnest phoenix
#

we shouldnt be the ones telling which language to learn
we should tell them what to learn

graceful mortar
#

i mean, i have coded a bot using C++, it wasnt too good

modest maple
#

If they just want to code a bot

#

i say JS

#

just because its more baby proof as a language

graceful mortar
#

can you list out WHY js, rather than saying js?

sudden geyser
#

The issue is all these languages set you up to fail, and the ones that don't aren't beginner-friendly.

modest maple
#

JS doesnt give a fuck about 90% of the stuff that Python will beat you for

earnest phoenix
#

f js go for py but I won't say why

rocky mountain
vivid fulcrum
#

if you plan on making a resource intensive and scalable bot, c# and python are you best choices

#

otherwise

wheat mesa
#

Eh

vivid fulcrum
#

it literally does not matter

earnest phoenix
#

i dont believe it
cry and tim joined a language war

#

hey also golang is good btw

modest maple
#

go lang is ehhhhhhhhh

wheat mesa
#

I'm not sure if starting off with Java and those types of languages is a great place, because of concepts like encapsulation that can get confusing to a beginner

earnest phoenix
#

I made one in go it was quite good

vivid fulcrum
#

go is interesting, i didn't benchmark it though

modest maple
#

Great principles but some really awful design choices that made me stop using it along with work

quartz kindle
#
  1. js is arguably simpler to understand
  2. js is by far the most popular lang, which means tons of resources and help available
  3. easy transition to web development and other specializations
wheat mesa
#

Well put!

near stratus
lyric mountain
earnest phoenix
lyric mountain
#

as with almost all langs, you can start with only the basic stuff

vivid fulcrum
#

same here

#

but like

#

really dull cpp

wheat mesa
#

Yeah

lyric mountain
#

when you feel "something is wrong here" then it's the time for the next step

earnest phoenix
#

like printf

#

or scanf

vivid fulcrum
#

i.e. "print this to console!" and "do math operations!"

wheat mesa
#

They had us start with Java in high school

quartz kindle
#

I CAN HAZ STDIO

earnest phoenix
#

Yall are forgetting QBasic
Best language of 2021

near stratus
modest maple
#

Sip In reality I litterally dont think it matters whether you pick JS or Python

graceful mortar
#

why are we mixing discord bot with web development?

modest maple
#

if you have any interest in programming you'll learn several languages anyway

#

so shrug

near stratus
earnest phoenix
#

why they start w those

#

I do not understand

vivid fulcrum
#

theoretically, discord bot deving is web development mmLol

earnest phoenix
#

like f u

vivid fulcrum
#

you're connecting to the web

sudden geyser
graceful mortar
#

its like saying, go for python..why? tensorflow my dude

lyric mountain
near stratus
vivid fulcrum
#

yes

earnest phoenix
vivid fulcrum
#

i literally wrote a websocket server with asp.net core a month ago for my finals lol

earnest phoenix
#

lol

near stratus
vivid fulcrum
#

depends which language

#

๐Ÿ˜

#

in c# i'd give it like

#

6-7

near stratus
vivid fulcrum
#

js is like a 2 lol

quartz kindle
#

lel

vivid fulcrum
#

it's mind numbing how much the ws package handles for you

modest maple
#

I think alot of the complexity comes down to if you're actually writing your own protocol handler and IO handler

earnest phoenix
#

I wish people read rule 4

quartz kindle
#

the ws package has so many unnecessary things

quartz kindle
#

you can easily write a discord ws client without ws

vivid fulcrum
#

although i wouldn't ever write websocket servers in js simply because you can't thread easily

quartz kindle
near stratus
modest maple
#

really doesnt take much

#

looks complicated

near stratus
modest maple
#

in reality you can write the protocol and IO handler in < 1000 lines if you really try

quartz kindle
#

the websocket specification has this dumb rule that you have to xor mask your data on every single message

#

but you can easily xor by 0

vivid fulcrum
#

i'm going to pick up rust within the next few weeks, some rust HTTP server libs are one of the fastest ever and that's what's been picking up my interest for a while

quartz kindle
#

to make it ignore the rule

#

lul

slender thistle
#
HAI 1.2
I CAN HAZ LOLCORDE
GIMMEH TOKEN
BTW BOT SHUD RUN
I HAS A NUMBAH GUILDS
KTHXBAI
modest maple
vivid fulcrum
#

nah, it's just to toy around with

modest maple
#

Like when i see people going with actix web just because 'speed' without realising that they're sacrificing tokio's perfect parallel load balancing

vivid fulcrum
#

in an actual production case, as long as your language is capable of threading, it doesn't matter what you use as your HTTP server

quartz kindle
#

do people still use nginx proxies when using rust servers?

vivid fulcrum
#

because what's going to be slow is your and the client's internet speed, not the code

modest maple
#

generally yes

#

because often you're still running more than one server setup or more than one domain and want the reverse proxy side

#

although My setup i use Kong which wraps Nginx to add a bunch of QOL stuff

earnest phoenix
#

i am dumb help please

modest maple
#

Recent times though been working on a reverse proxy written in rust that works off QUIC tunnels bloblul

quartz kindle
#

last time i tested adding nginx made everyting 3x slower compared to exposed node.js server

modest maple
#

do be speed

#

it is

#

Nginx and Apache are actually pretty limiting if you're server supports HTTP/2 and want to make use of that multiplexing

#

Nginx and Apache will only proxy pass HTTP/1.x or HTTP/0.9 and pipelines which cuts a reasonable amount of concurrency performance

#

although 3x still seems a lil high

earnest phoenix
#

um

quartz kindle
#

i was testing uws's http server

#

got 30k reqs/s

#

only 10k with nginx in front

modest maple
#

Like, Kong adds 4ms latency

quartz kindle
#

didnt even test ssl yet

modest maple
quartz kindle
#

pretty barebones

#

fresh installs, node was like a fixed text response

#

nginx had a few optimizations from some researching

modest maple
#

what did you use to test the thoughput?

quartz kindle
#

that terminal program, whats the name again

#

wrk?

modest maple
#

oof

quartz kindle
#

thats what i see most people use

modest maple
#

Yeah blobpain Real shame we're still using tech that was designed 8 years ago for the web 8 years ago

quartz kindle
#

lel

lyric mountain
modest maple
#

its not even that

#

Its the fact that people take wrk's numbers as gosphel even though it still uses a system that has been removed from modern clients for the last 8 - 10 years

#

like Pipe lining is dead, stop using it, support HTTP/2 blobpain

#

Sip Just 12,000 images left to process

lethal trout
#

does anyone know cli?

earnest phoenix
#

for?

lethal trout
#

nodejs?

#

npm

modest maple
#

have i introduced you to the --help flag?

lethal trout
#

so i am following a vid and doing the same thing, but now i am getting a err

earnest phoenix
#

what am i doing wrong lol

#

wait

#

oh ok

#

wait

#

no

#

im not doing it right

#

HELPPP

vivid fulcrum
#

bestie

#

are you okay

earnest phoenix
#

ikr

#

anyways

cinder patio
#

Is that.... a dick in your activity

earnest phoenix
#

maybe

stable eagle
#

wtf

earnest phoenix
#

lol

slender thistle
#

What are you even supposed to do there

earnest phoenix
#

Hello How can I make premium commands and connect my patreon page so that when a user subscribes they will get all premium commands?

stable eagle
earnest phoenix
#

am i doing this right

obtuse stone
slender thistle
#

Did you try it?

stable eagle
earnest phoenix
earnest phoenix
obtuse stone
cinder patio
#

wut

obtuse stone
#

in the screenshot

earnest phoenix
obtuse stone
#

add ' ' before and after the number ones

earnest phoenix
#

ok

cinder patio
#

but it says to print the number

obtuse stone
#

oh u probs have to put '20.49'

earnest phoenix
obtuse stone
#

u forgot a ' after 20.49

earnest phoenix
#

oh

#

why ios it asking this

#

nvm

#

OMG LMAO

obtuse stone
#

oh wait thats not right

earnest phoenix
void axle
#

Bro

#

I tried to use github

#

To make my bot

#

And I cannot make the bot leave the voice channel

#

And now he can't enter

obtuse stone
# earnest phoenix

forget what i said and remove the ' before and after the number ones then correct the spelling for the 3rd line

void axle
#

Because he hosting time ended

lethal trout
earnest phoenix
#

uhm what

obtuse stone
lethal trout
obtuse stone
earnest phoenix
obtuse stone
#

add ; at the end of all of them

earnest phoenix
earnest phoenix
obtuse stone
#

oh im stupid

earnest phoenix
#

ok it worked

lethal trout
lethal trout
#

it isnt in my code

#

@obtuse stone this is the vid i am using

earnest phoenix
#

and manually putting the options with default value in options object

#

why not make a defaults object and use Object.assign

lethal trout
#

bruh

knotty talon
#

anyone help me

plain talon
#

ask the question or no one can help bud

knotty talon
#

how can I do that

#

to

#

Current Prefix: !

plain talon
#

add a back slash

knotty talon
#

not working

#

I added 2 on both sides

plain talon
#

\thing\

knotty talon
#

ohhhhhhh

#

ty ily

plain talon
knotty talon
#

@plain talon so sorry to bother you but its not working

plain talon
#

show me the full line of code

knotty talon
earnest phoenix
#

line and entire file are two different things

plain talon
#

just use '' instead of ` for all your quotes

#

or is that not how it works

knotty talon
#

yea

#

${prefix} will not be rea

#

read

plain talon
#

ok

earnest phoenix
#

snake_case for variable names :(

plain talon
#

then

#

make it

#

value: `\`${prefix}\``
#

like i suggested

knotty talon
#

lemme try

knotty talon
#

thank you so much

#

mb

plain talon
#

no problem

slender thistle
#

@rustic nova

rustic nova
#

@zinc fable yeah that was a ban now lmao

zinc fable
#

wha

#

o

#

will bonk

drifting shell
#

wait

zinc fable
#

oh you got it pog

drifting shell
#

what happened ๐Ÿ‘€

earnest phoenix
#

im a dumbass

#

i was using a python code in js

quartz kindle
#

limรฃo

slender thistle
#

Javathon

sudden geyser
#

Is it just me or does IntelliJ have the worst UI

earnest phoenix
#

can someone help

#

fuck

wheat mesa
#

...if you tell us whatโ€™s wrong yeah

earnest phoenix
#

ok ther

#

lร  je developpais mon deuxieme bot discord

#

mais jfais une pause

#

et toi?

wheat mesa
earnest phoenix
wheat mesa
#

You might have the wrong path, or it might not exist altogether

#

Iโ€™m going to assume it doesnโ€™t exist

earnest phoenix
wheat mesa
#

...?

wheat mesa
#

Ok I guess

earnest phoenix
#

dms

#

@wheat mesa sent

signal estuary
#

Is it API abuse to change the bot status every 30000 milliseconds?

wheat mesa
#

I donโ€™t see why it would be

#

API abuse is usually many more requests than that

mellow epoch
#

@solemn latch

#

oh

sudden geyser
#

@drowsy crag nitro alert

lyric mountain
#

it's like, the other way around

#

plus you can always change themes

sudden geyser
#

I feel it's too bulky and shoves a lot of stuff in your face. 75% of the actions I can perform on screen, for example, are stuff I'm not going to use. In comparison, editors like VSC display like 10-20% of features I won't use (even if browsing their settings is a pain) and try to minimize them (grayed, small, and in the bottom/top).

Heck, even the editor window is small. It's like half the screen as opposed to other editors getting you 70-90%. I feel IntelliJ just puts a lot of stuff you probably won't use in your face, even if you can try to hide/disable them. I use Material to clean up the actual look, but that's about as far as it goes. I just see it displayed awfully. Even Xcode is much better to actually use and so many features are missing.

lament rock
#

So. You have plenty of head room

stray birch
#

i defined m but still gave me an error

pale vessel
#

Where did you define it?

solemn latch
#

Don't forget about scope

latent heron
#

^ scope is important

lyric mountain
#

you can remove most stuff

slate kestrel
#

Where do i get the dbl_token for webhooks?

dense flame
#

Bot Page > Edit > Webhooks

slate kestrel
#

404

dense flame
#

Try refreshing the page

slate kestrel
#

ah dang, i see. thank you

dense flame
#

You're welcome!

#
const Hello = 123
#

of course

slate kestrel
#

Uh - what exactly do i put here? ๐Ÿ˜…

dense flame
#

url to a webserver you host

slate kestrel
#

Alright - Would this be my IP-adress, if the bot is being hosted on my own desktop?

dense flame
#

yes, correct

slate kestrel
#

Alright, cool, thank you ๐Ÿ˜„

dense flame
earnest phoenix
#

is sharding a thing in discord only?

#

same goes for clustering?

lyric mountain
#

well, no

#

sharding only means you're splitting a whole application into chunks

long crow
#

I'm building/creating my discord bot at a tortoise level of slow

lament rock
#

clustering and sharding happens on professional scale as well. Redis is a popular database and offers clustering which takes the form of multiple slave instances performing I/O OPs while the master acts as a central connection hub and governor of the slaves

#

the result is vastly increased performance which is very scalable horizontally which is much cheaper and doable than vertical scaling

lethal trout
#

can someone help me in this

lusty quest
#

is the module installed you try to run?

flat copper
#
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import 'bootstrap/dist/css/bootstrap.min.css';
import './index.css';

ReactDOM.render(
    <App />,
  document.getElementById('root')
)```
Why this is giving me error?
earnest phoenix
#

Webpack should have fixed those errors but it didn't

#

Are you running your code directly in node? @flat copper

lethal trout
#
PS D:\DATA FOLDER\ETHAN\School\Coding\Test NPM> create-project typescript --git
ERROR Invalid template name
[Error: ENOENT: no such file or directory, access 'D:\D:\DATA%20FOLDER\ETHAN\School\Coding\Test%20NPM\templates\typescript'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'access',
  path: 'D:\\D:\\DATA%20FOLDER\\ETHAN\\School\\Coding\\Test%20NPM\\templates\\typescript'
}
PS D:\DATA FOLDER\ETHAN\School\Coding\Test NPM> ```
https://pastecord.com/elanizozaj.js
solemn leaf
#

@opal plank

#

I need you to compare

#

Djs to detruis or whatever

marble juniper
#

detritus uses less memory usage

#

and detritus is probably better anyways

#

just haven't used it myself really

#

in an actual bot

errant flax
#

whats detrius

marble juniper
#

a discord lib

errant flax
#

for?

marble juniper
#

discord bots

#

its a discord lib just like discord.js is

#

it has the same purpose
interacting with the discord api

#

lol

errant flax
#

no what I'm questioning what language

marble juniper
#

javascript

errant flax
#

imma try that out hmm

marble juniper
#

do it ig

errant flax
#

i cant find a tut KEKA

#

guess ill use there guide

pale vessel
#

Guide = tutorial smilingBlackGuyWithQuestionMarks

solemn leaf
#

flaze

errant flax
#

is it me or detritus is kinda like a command handler but from a package lookaround

pale vessel
#

It has a built-in command handler, that's why

lethal trout
#

it does exsit

errant flax
#

what r u trying to do/whats ur code?

wheat mesa
#

Detritus is actually great though

#

Iโ€™ll become an advocate for it just like Erwin

#

Gladly

earnest phoenix
#

im trying to make a leaderboard command for a economy system, and im not sure how to make it check what users are in the guild, then output them using map

#

using mysql

#

i have a table named user, then a column named 'user_id', and the money they have is another column 'networth'

#

i thought of making another table and having it log the guild id, but i cant have people having different networths in different servers, its supposed to carry over

#

so basically i just have to check what users are in the guild, then get the data from those user_id's, but im not sure how to do that

lusty quest
# solemn leaf <@!188836645670223872>

depending on the configuration they perform memorywise relatively simliar (detritus and d.js V13) but detritus gives you some stuff that d.js dont, like Sharding is easier, build in command handler and some other nice features.

eternal elbow
#

I run cron jobs every 30 seconds (really demanding jobs) and pull data from the database. Do you think the performance of the application will increase if I cache and pull from the cache instead of pulling from the database?
I noticed that when I close these things and run the app, I get lower ping

spare badger
#

If it slows down the performance and if caching would also work, why not try it?

slender thistle
#

Pulling from cache will definitely be faster. It might consume a lot of RAM depending on how much data you store

spare badger
#

If it's too much data to store in RAM you can even try to build it so it stores it in a temporary file.

eternal elbow
spare badger
#

You could to some tests before putting a lot of time into it right?

#

I don't know what you are trying to do exactly obviously but I'm sure you can do something temporary to see if it increases performance.

eternal elbow
spare badger
#

lol just trying to help

slender thistle
#

My friend you don't know the real difference between help and obsession

eternal elbow
eternal elbow
slender thistle
#

Probably ยฏ\_(ใƒ„)_/ยฏ

haughty mural
#

Hii

eternal elbow
#

Yes caching really works :>

#

It doesn't make sense to pull an average of 5k data from a database every 10 seconds.

eternal elbow
long crow
#

That the longest code line I've made so far, thanks to the subcommand

earnest phoenix
#

Why oh why does my site and bot have such high response times, usually about 1,000 ms but the bot response instantly when you use it (status.eternaltesting.xyz)

modest maple
#

seems about right

#

your site taking about 800ms to even load the raw content

#

742ms for aws bucket holy fuck

#

The fuck is going on there

earnest phoenix
#

XD

#

The actual website is just a html js template

#

The php is badly written tho I havent coded since 2007

#

Also it's a cheap host. $3/mo

lusty quest
eternal elbow
slender thistle
errant flax
vivid fulcrum
#

i was an idiot when i had a public bot and i barely cached any data

#

um

#

prefixes weren't one of those things

#

so i made a call to my database on each message in a guild

errant flax
#

am i dumb for not knowing what cache is

vivid fulcrum
#

telling your code to remember something

#

storing things temporarily in memory

errant flax
#

does cache means temporary info or something

vivid fulcrum
#

yup

errant flax
#

ooo pd_pepethumbsup

lusty quest
#

you have to find some middle ground with caching, not enough and the app will feel sluggish /unecessary API / database calls. to much and you waste resources.
a example would be probably caching discord Presence, most people dont need it, and it takes a fair amount of memory to be cached.

vivid fulcrum
#

free ram is wasted ram mmLol

boreal iron
karmic sundial
#

Hey guys is anyone having issues when clicking on the announcement button when editing your server or it's just me ?

slender thistle
restive furnace
#

but why can't they allow me to use over 4GB though ๐Ÿค”

near stratus
#

How can I fix this ?

src/res/db.ts![69](https://cdn.discordapp.com/emojis/593774451250823188.webp?size=128 "69")18 - error TS2339: Property 'db' does not exist on type 'typeof Database'

well db does exist

export class Database {
    private readonly dbName: string;
    private readonly db: Db;

    constructor(_db: Db, _dbName: string){
        this.db = _db
        this.dbName = _dbName;
    }
signal estuary
#

How do I get the number of text channels, voicchannels and roles in a server?

zinc fox
#

hihihi i just joined

earnest phoenix
signal estuary
boreal iron
#

Youโ€™re trying to filter the cache size?
Filtering 1000 for example seems to be a weird step. oldEyes

#

(the value 1000)

lethal trout
#

how to upload a npm package from github?

sudden geyser
signal estuary
#

How can I get the number of channels in v13?

    let textChannels = (await guild.channels.fetch()).filter(c => c.type === "TEXT").size
    let voiceChannels = (await guild.channels.fetch()).filter(c => c.type === "VOICE").size

This does not work because it always returns 0

pale vessel
#

Also it's keyof Database

quartz kindle
pale vessel
quartz kindle
#

lol more unnecessary changes

pale vessel
#

Oof

signal estuary
signal estuary
pale vessel
#

Can you try logging the channels types?

#

console.log(new Set((await guild.channels.fetch()).map(({ type }) => type))) Maybe this is too extreme

quartz kindle
#

why new set?

pale vessel
#

Yes

quartz kindle
#

lol

pale vessel
#

This is not a good way to debug at all

#

Best way is to just log everything and check them manually

#

I'm being a clown

#

Or well, use the damn debugger

plain talon
#

console.log('a');

console.log('aa');

pale vessel
#

(which I have never done)

pale vessel
plain talon
#

whats a debugger

pale vessel
#

Lul I agree

#

Seriously

#

I never had a need to use it, console.log always works S3mmLol

plain talon
#

i dont think ive ever used the debugger

#

can i even use a debugger for a website

earnest phoenix
#

Imagine using the debugger keyword instead of just console.log() mmLolBounce

spare badger
#

const debugger = console.log;

#

At the start of every script you write.

earnest phoenix
#

That'll error out

plain talon
#

dis is de wey

spare badger
#

const plsWork = console.log;

plain talon
#

const fuck = console.log;

#

fuck("fuck");

sudden geyser
#
function spy(arg) {
  console.log(arg)

  return arg;
}

spy(spy(spy(spy(await message.guild.channels.fetch()).deeply()).nested()).insertions())

big brain move

earnest phoenix
quartz kindle
#
function log(arg) {
  console.log(arg);
  return log;
}

log(1)(2)(3)("abc")("haha")
near stratus
# earnest phoenix Is the error happening at `this.db = _db`?

sorry I'm late
No it's not at this.db = _db
It occurres at

this.db.collection("Users")
     ~~

Full code

export class Database {
    private readonly dbName: string;
    private db: Db;

    constructor(_db: Db, _dbName: string){
        this.db = _db
        this.dbName = _dbName;
    }
    async GetUserByID(_id: string): Promise<User> {
        return new Promise ((resolve: any, reject: any) => {
            const users = this.db.collection("Users")
             // Some useless code here
        })
    }
}
near stratus
#

nvm I used .bind() and it works now

dark ore
#

An id named avnoor(dev- id 732137013620244512) wasn't able to vote the bot can you tell me why?

sudden geyser
#

An error occurred? They didn't want to vote for your bot? Their computer died? All the possible possibilities and yet we don't know.

wise epoch
#

what should i fill here??

sudden geyser
#

What the text between <> tells you.

#

You seem to be following a tutorial.

sudden geyser
#

then they died

near stratus
sudden geyser
#

I thought top.gg stopped blocking adblockers

modest maple
#

ram goes nom

boreal iron
modest maple
#

holy fuck postgres eating 5GB of ram

#

i didnt think this was possible

knotty talon
#

yo anyone know how to fetch server in JavaScript

#

I did message.client.guilds.cache.get('Guild ID') but its not working

#

I tried to removed message aswell

boreal iron
#

very bad idea

cinder patio
#

There's no point in "fetching" a server because your bot gets all the server objects on startup

knotty talon
#

oh wait I did 2 config.json

#

hmpppp

#

im so dumb

drifting flower
#

anyone got any bot ideas

knotty talon
#

iit should work now

#

yeah

#

im so dumb

drifting flower
#

cuz i added a level system and all to mine and now idk what else to add to it

signal estuary
pale vessel
#

That's odd

signal estuary
#

bruh it was rly the different between TEXT and text

pale vessel
#

Ah, wait

signal estuary
#

it works when i write it lowercase

pale vessel
#

You are using the master branch, right? I recall you asking a question about it

sick sluice
#
File ".../venv/lib/python3.7/site-packages/discord/gateway.py", line 582, in poll_event
    raise ConnectionClosed(self.socket, shard_id=self.shard_id, code=code) from None
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 4011
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fcf5b1d1f10>

anyone know how to debug this error? which discord gateway domain should I check?
suddenly my bot stopped working on live env, probably due to some network problems

pale vessel
sick sluice
#

yes

#

it's related to network things, anyone know the domain?

#

i can run it on my local machine

sacred tartan
sick sluice
#

yeah I know

sacred tartan
#

it cant connect to session

#

it terminates unexpectedly

#

kinda the ERR_CONNECTION_CLOSED u see on chrome

#

when u disconnect

slender thistle
#

4011 says sharding required

sick sluice
slender thistle
#

Or at least Discord opcodes page says so

sacred tartan
#

prolly u copied the code

slender thistle
#

Not helpful at all

sacred tartan
#

and forgot to change shard id

slender thistle
#

In any way, shape, or form

sick sluice
sacred tartan
sick sluice
#

recently it's stopped due to some network problem on live server

sacred tartan
#

Shard ID None

#

see

sick sluice
#

omg lol

sacred tartan
#

maybe it couldnt connect to shard

slender thistle
#

Try sharding

sick sluice
#

i didn't ask code-related question

#

i asked maybe if someone knows discord gateway ip adress

slender thistle
#

You send a request to /gateway and get the URL to connect to

#

Discord may have removed it at some point last week though, not sure what's going on with that

#

Are you using the sharded client?

clever agate
#

my code is giving an error:

import fetch = from 'node-fetch';

Typescript

earnest phoenix
#

import fetch from 'node-fetch'

signal estuary
#

How can I filter user? So bots wont be countend.

let user = members.filter(m => m.user.user).length
// returns 0
clever agate
#

ยฏ\_(ใƒ„)_/ยฏ

sick sluice
earnest phoenix
summer torrent
clever agate
earnest phoenix
#

oh wait !x.user.bot*

summer torrent
#

try reading it

earnest phoenix
summer torrent
#

and = isn't a thing

clever agate
#

so I draw the =?

earnest phoenix
#

no

#
import fetch from 'node-fetch';```
clever agate
#

THAT!

clever agate
#

yay

#

It worked

#

@earnest phoenix @summer torrent tysm

earnest phoenix
#

i dont even use ts lol

slender thistle
#

Might be helpful in the future

sick sluice
#

yes yes, thanks @slender thistle

slender thistle
knotty talon
#

How to make the bot send a message to a channel when restarting. Is it possible?

inner fulcrum
#

it is

#

possible

earnest phoenix
#

ready event

inner fulcrum
#

ye

pale vessel
#

When restarting?

#

Wouldn't that be before restarting?

inner fulcrum
#

mmmmmmm

sudden geyser
pale vessel
#

READY event would be after

onyx hare
#

im getting pissed rn
${user.username} user is set as my ID under a "let user = ID" (So if my nickname is changed in the server the bots in itll show my username but the username in user.username returns undefined

sudden geyser
#

because it's probably a string/number instead of a user instance

onyx hare
#

o, what do i need to change to get it to show the username

sudden geyser
#

you need to get the user instance

#

there are a lot of ways

#

e.g. bot.users.fetch(...) returns a promise resolving to a user

onyx hare
#

so id need to client.users.fecth(300695488414351362)?

sudden geyser
#

fetch is spelt wrong

#

and the id should be a string

onyx hare
#

ik i noticed

#

how weould i string it

#

would*

sudden geyser
#

like how you'd use a string

#

just wrap it in quotes

onyx hare
#

ahh

tired panther
#

The Class Middleware has a constructor, which contains app, which I can access with this.app. Why doesnt this.tokens work?

I tried with Middleware.tokens, but does not work too

onyx hare
#

so like this: let user = client.users.fetch("300695488414351362")

#

still getting undefined

summer torrent
onyx hare
#

what do i need to alter

tired panther
sudden geyser
#

You could write your own.

onyx hare
#

this is the full code:

const Discord = require('discord.js')

exports.run = (client, message, args) => {
let guild = message.guild
    if (!message.member.permissions.has("ADMINISTRATOR"))
    return message.channel.send("You Have Been Denied Use Of This Command ~ Have A Nice Day!");
    message.channel.send('Getting Admin Commands...').then(sent => {
        sent.delete().catch(console.error);}).catch((e) => guild.channels.cache.find(i => i.name === 'crystal-crash-logs').send('Error: ' + e));
        let user = client.users.fetch("300695488414351362")
        let embed = new Discord.MessageEmbed()
        .setColor("#2F3136")
        .setTitle("Administrational Commands List")
        .setImage("https://google.com")
        .setFooter("Commands Last Revised 11/07/21 By " + `${user.username}`)
        message.channel.send(embed).catch((e) => guild.channels.cache.find(i => i.name === 'crystal-crash-logs').send('Error: ' + e));
    message.delete({timeout:10});
}
sudden geyser
#

Or use one that already exists

#

Eris also comes with its own command framework

long crow
#

Write your own, you have full control of it

sudden geyser
#

Full control is not everyone's goal

sudden geyser
#

If you just want one, you can use Eris's command framework via CommandClient. However, just because you don't how to make one doesn't mean you can't learn. Many people who use Discord.js learn to copy write their own primitive command handlers.

knotty talon
#

anyone help me allow my bot to message to a channel if it is restarting

cinder patio
#

client.channels.get("channelId").send("np");

knotty talon
#

cause that's the one locate the channel

#

like opposite of this

umbral lake
#

Hey!
I have a problem, when I do this:

fs.readdirSync('./Commands/Misc').forEach((file) => miscCmds += `${prefix}${file.slice(0, file.lastIndexOf('.'))}, `);
console.log(missCmds)

the bot send this: s!botinfo, s!botsuggestion, s!bugreport, s!invite, s!ping, s!support,
and I want the last , was removed :/

sudden geyser
#

You could map all the commands into an array and .join(", ") it.

#

Or you could get the index and original array from .forEach and see if the last element has been reached.

knotty talon
sudden geyser
#

The restart((message, arsg) => {...}) bit is an example.

knotty talon
#

it cant ready args

umbral lake
sudden geyser
#

You'd need to map the strings to an array

#

e.g. .map instead of .forEach and no miscCmds += or ending ,

#
let files = ["what.js", "you.js", "know.js", "about.js", "rolling.js", "down.js", "in.js", "the.js", "deep.js"];

files.map((file) => `${prefix}${file.slice(...)}`); // This is an array of strings. Now you can call `.join(...)`
umbral lake
#

wait

umbral lake
#

no?

sudden geyser
#

yes

umbral lake
#

so

#

I replace forEach to map?

sudden geyser
knotty talon
#

ReferenceError: restart is not defined

sudden geyser
#

May I ask how much experience you have with JavaScript?

wheat mesa
#

Then your function named restart isnโ€™t defined

knotty talon
knotty talon
#

Except this restart thing hahahaha

sudden geyser
#

Then you may want to spend more time learning via other sources.

knotty talon
#

I'm learning from here

sudden geyser
#

It's not an efficient source of growth.

knotty talon
#

ah

earnest phoenix
#

ellooo

knotty talon
#

I figured it out now

sudden geyser
#

I recommend you read https://developer.mozilla.org/en-US/docs/Web/JavaScript for an excellent source of resources to learn it.

JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threade...

knotty talon
#

I figured it out now ty tho

earnest phoenix
#

How do I get the text "Urushi" in the following HTML code using JavaScript?

#
<h1 itemprop="name"><b class="color-90">Urushi</b></h1>```
#

change of value name

boreal iron
#

๐Ÿคฆโ€โ™‚๏ธ

sudden geyser
#

Where did you even get that from

pale vessel
#

If you're scraping (there would be no way to add an ID), try js document.querySelector(`h1[itemprop="name"]`).innerText;

#

Only works if there's only one element

#

Unless there's multiple of them but you want the first one, that would also work

cinder patio
#

The typescipt compiler API is so annoying ๐Ÿ˜ฉ

earnest phoenix
boreal iron
#

The facepalm was for somebody else who has deleted his message.

inner fulcrum
#

boiz how can i make it so that if a message is sent in a particular channel the bot dm's the person a message?

wheat mesa
#

What lib

inner fulcrum
#

.js

wheat mesa
#

You want to dm the author of a message in a particular channel, right?

inner fulcrum
#

my brain no work today

wheat mesa
#

Do you know the channel ID?

inner fulcrum
#

ye

onyx hare
wheat mesa
#

If you do, you can fetch the channel through its ID, check the channel id containing the message, and if they match, then you can dm the author of the message using message.author.send()

inner fulcrum
#

i did fetch the channel but it just dosent work ;-;

wheat mesa
#

Are you getting an error?

inner fulcrum
#

no error ;-;

wheat mesa
#

Are you actually checking if the ID matches

inner fulcrum
#

mmm wait let me retry

wheat mesa
#

Assign a variable, like mychannel to the channel that you fetch, then see if mychannel.id matches the channel where the message is coming from

inner fulcrum
#

ah ok

#

ima try

#

u got sum big brain lol

wheat mesa
#

Iโ€™ve encountered a similar problem before

inner fulcrum
#

omigod it worked thx

wheat mesa
#

Np

jovial nexus
#

how can i advance to a exact second in a song using the dispatcher

lament rock
#

what Discord.js version are you use and are you using @discordjs/voice

jovial nexus
#

im using @discordjs/opus in v12

lament rock
#

You can't seek using the Dispatcher. You have to re-call connection.play and pass in the seek option to the streamOptions https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=play

#

This would require you to restart the stream to the audio as well

jovial nexus
#

thats what im using, but i want a command that jumps to a exact second of the video

lament rock
#

I don't think you can since audio data is sent in chunks

#

depending on how large your stream buffer is, your precision may be off

brittle hamlet
#

while running my bot I got this error

TopGGAPIError [Top.GG API Error]: 403 Forbidden (You don't have access to this endpoint)

how to resolve this?

zinc wharf
#

I haven't worked with the top.gg api, but that to me is a missing api key

brittle hamlet
#

Oh but I did insert the token

wheat mesa
#

#topgg-api would probably have people that know what to do for that error

brittle hamlet
#

Ohk ty lemme post it there then

quartz kindle
brittle hamlet
mild agate
#

guild id or any id is a string or BigInt?

sudden geyser
#

string usually

#

it could be a bigint if you wanted

pale vessel
#

`${bigint}` /s

mild agate
#

I am trying ts... just tell is it by default string or bigint

sudden geyser
#

string

mild agate
#

ok

pale vessel
#

discord-api-types types it as `${bigint}`

#

But it's still a string

mild agate
#

thats a string yes

obtuse stone
#

whats the code to get the total member count from every server?

#

javascript discord.js btw

pale vessel
earnest phoenix
#

Where can i find the migrating guide for discord.js v13?

lyric mountain
#

is djs 13 even out yet?

earnest phoenix
#

unofficial on Master Branch

#

They have this guide preview,which i am searching for

pale vessel
#

Either they haven't finished it yet or they removed the page

#

It's still WIP

lyric mountain
#

migrating to a WIP is quite a risky move

pale vessel
earnest phoenix
#

thx

earnest phoenix
lyric mountain
#

still, many thing can change before official release

#

and deprecation doesnt mean it'll instantly stop working

earnest phoenix
#

that will be a pain to edit 400 files :C

lyric mountain
#

laughs in intellij migration tools KEKW

earnest phoenix
#

migration tools?,How does that work?

lyric mountain
#

it detects deprecated methods and help you migrating to replacements

#

like, earlier JDA replaced sendMessage(<MessageEmbed>) with sendEmbeds(<MessageEmbed>...)

#

all I need to do is replace where it was used, and intellij grabs to me where they are

earnest phoenix
#

nice

earnest phoenix
uneven fulcrum
#

@tired panther how do i get the price of the product and its name

#

with the api

tired panther
#

lol

uneven fulcrum
#

or i dont get it

#

@tired panther

uneven fulcrum
#

oh

#

but

#

1 sec

#

here

tired panther
#

but doing a call on the Endpoint gives you some info

uneven fulcrum
#

how do i get the json values

#

@tired panther

tired panther
uneven fulcrum
#

mean

#

how do i even get the values from that

#

idk how to use json

#

do u have some course

tired panther
#

you have to do a request on the path

#

with a auth header

uneven fulcrum
#

how

#

can u show example @tired panther

tired panther
uneven fulcrum
#

how do i use the api with that

tired panther
#

yeah you fetch on the given link with a auth header

uneven fulcrum
#

i dont get it

#

sorry for being dumb @tired panther

#

ive never done anythign like this before

#

json

uneven fulcrum
#

nvm got it

royal portal
#

anyone here used express-rate-limit package before, need help with it

cinder patio
#

hey Tim u here

royal portal
uneven fulcrum
#

when trying to create my server

royal portal
#

use a different port or end that one

uneven fulcrum
#

@royal portal

royal portal
#

example is

uneven fulcrum
#

with node

royal portal
#
var server = app.listen(9999);

server.close();
lost wadi
#
let e = require("../../database/models/simulator.js")
e.findOne({usuario: message.author.id}).then(async x => {
await x.update({
reencarnacion: 0
})
})

You know why I don't add the property to the DB?

uneven fulcrum
royal portal
#

didnt you want to end it

uneven fulcrum