#development

1 messages Β· Page 1775 of 1

tardy hornet
#

probably lol

opal plank
#

you need to send a user with this

#

not a webhook

#

and no, you cant send webhooks to a user

#

so you have 2 options

#

if u have ur bot accessible in that code snippet, you can use that

#

otherwise you'd have to use the api to send that

#

using axios, curl or something else

deep linden
#

Hello people. I am new here. I made a new and working bot. How to get it reviewed and posted on top.gg? Any help will be appreciated

deep linden
#

How? And where

opal plank
#

login and add ur bot

#

theres a button at the top

#

the heck is this?

deep linden
#

I am using my bot on the test server. It is working fine.

opal plank
#

nice

deep linden
#

But i am stuck on a point. The bot code is running on my laptop. Any way where i can get it to the cloud. To make it 24*7 online.
P.S. I am cheap. Please suggest something free

opal plank
#

buy a vps

round cove
#

Google Cloud gives you a year free with $300 credits.

#

There are plenty of other alternatives.

deep linden
#

I was thinking about free tier at AWS EC2 server. Any comments?

opal plank
#

should work

#

AWS, google Micro f1, or a vps, all should work fine

deep linden
#

Cool. So adding the bot on top.gg will get it reviewed and posted, correct?

opal plank
#

yes, it'll take a while tho

#

so keep that in mind

round cove
#

I ran it for a short period.

deep linden
deep linden
round cove
#

I'm aware, but the trial period will expire.

deep linden
deep linden
#

Oh okay.

#

Thanks bud. πŸ™‚ Appreciate it

opal plank
#

no problomo

#

may i recommend u code with detritus?

deep linden
opal plank
#

do you code with javascript?

deep linden
#

python

opal plank
#

ah, then nvm

#

detritus is a js lib for discord

deep linden
#

Everything self learnt. Planned to learn js java in the coming months

opal plank
#

fair

solemn latch
#

JS and java, pog

crimson vapor
earnest phoenix
#

Was never able to enter this channel without seeing erwin say detritus

deep linden
#

Sorry this might be a stupid question. But is it safe to share the bot invite url that was generated in the discord bot application with my friends.

#

i mean would this pose any harm to the bot or the code?

solemn latch
#

its just an invite url

opal plank
#

not at all

deep linden
#

Cool.

opal plank
#

and you can ake your own invite even without an invite

#

you can just use the id instead

deep linden
#

Oh i see.

sick agate
#

and id is public so

deep linden
#

Okay

opal plank
#

for example

#

thats ur id btw

#

just replace client_id with the id of the bot

#

and boom, you got yourself an invite

#

luca for example

#

the forbidden invite

zenith terrace
opal plank
#

i wonder how many mods would fall for that in #general

solemn latch
#

i fell for it angeryBOYE no ads erwin wow!

opal plank
#

lmao

deep linden
#

Okay thanks a lot Erwin.

opal plank
#

no problomo

bronze vault
#

omg this is painful
this is google support GOOGLE
I whent to ask a question about DNS forwarding stuff on my Domain to my VPS and I get this

lyric mountain
#

Vertical Pointing Stick

bronze vault
green kestrel
#

@bronze vault VPS obv stands for visible pee stains

bronze vault
#

LMFAO

earnest phoenix
#

Very Popular Sus

opal plank
#

Vanity per Server

green kestrel
#

very pathetic server

#

or is that just the $2 offering 🀣

#

im currently watching my bots graphs to see if i fixed a ram leak

#

spot the leak anyone? πŸ˜› lol

earnest phoenix
green kestrel
#

lol

#

"profesinal" dervs πŸ˜„

earnest phoenix
#

hi me bot need good host
sorry me 9 age cant buy vps

old cliff
#

can I add multiple functions to an event like I can do with an express app?

like in Express

const verify (data,next) =>....;
app.get('index', verify, (dat) => {/*code*/})

can I do the same with an EventEmitter class?
like

const handle (data) => ...;
myObj.on('whatever', handle, (dat) => {/*code*/})

Or do I have to code my own system?

green kestrel
#

lol, dont even joke. someone could right click your message and report you @earnest phoenix

blazing gyro
#

Guys, with what hosting service you host your bot?

cinder patio
green kestrel
lament rock
#

mfw the "memory leak" is caching

stable eagle
#

Im trying to connect with my host, im using bitvise to connect. I’m trying to input my user password but it doesn’t work? Typing neither copy pasting works

Anyone know why?

lament rock
#

Discord.js moment

green kestrel
#

@lament rock nah thats not caching, thats a new without delete, when handling a certain type of command

lament rock
#

Ah I see

green kestrel
#

caching should show a steady increase over weeks, about the same shape of graph as my users graph

lament rock
#

<1GB is really good for how many guilds you're in

green kestrel
#

this one is users

lament rock
#

I need to look at my stats page for my bot

green kestrel
#

what do you use?

#

grafana?

lament rock
#

Idk. I leverage the cheweybot stats api. I just have a redirect on my site for easy access. Idk what Chewey uses specifically. I think he mentioned graphjs a while back though.
https://amanda.moe/to/stats

green kestrel
#

ah, cheweybot is good

#

i used that in sporks, then took its page, and fed it my own stats db for triviabot

#

there were some things chewey couldnt do well, like this:

lament rock
#

thats fair

#

I didn't need anything over the top

#

I do store all my stats in a db, so I could make my own if I really wanted to or needed to

green kestrel
#

i got pie charts too, for things like how many guilds use which prefixes, and which languages etc

#

and thats interesting, a whole three servers play in chinese. talk about wasted effort lol

earnest phoenix
lament rock
green kestrel
#

the library stores number of btytes in/out/compressed/uncompressed for each shard

#

i just record differences per minute, divide by 60 to get bytes per second

lyric mountain
green kestrel
#

chart.js, mysql and php

#

and a C++ reporting module within triviabot to post to the mysql

#

a set of mysql views keep the dataset size sane by taking averages, the older the data the further apart the readings

#

which is why the older data has smoother curves

lyric mountain
#

damn js gets all the fancy charts

green kestrel
#

lol, chart.js is the only js part of my entire bot

#

and thats only because its web frontend

earnest phoenix
#

what language do you use for your backend?

cinder patio
#

php for the site probably?

green kestrel
#

yes php 7.1

earnest phoenix
#

no

green kestrel
#

i want to upgrade to 8, maybe some time soon

earnest phoenix
#

for the bot

cinder patio
#

C++

green kestrel
#

oh for the bot? C++

#

C++17 and the D++ library

cinder patio
#

shameless plug

earnest phoenix
#

cool

opal plank
green kestrel
earnest phoenix
#

dotcc

#

i hate github sometimes

green kestrel
#

yeah cant have . in a github name 😦

#

but i have a lot of names like that, facebook is the same

#

because they wouldnt release my old name to me

#

basically, i had facebook years ago... and i closed it down because i thought fb sucked, still do. completely deleted my account. turns out that doesnt delete your pages, fb take 'stewardship' of them, and wont release them

cinder patio
# opal plank detritusjs best lib

Only problem I have with ditritus is that the api is very unorganized and without looking at the source code yourself it'll be hard to get things going

green kestrel
#

in the end i filed a DMCA request against my own page they were holding to ransom to get it closed down, but then STILL couldnt use the hold name

cinder patio
#

and the docs don't help

green kestrel
#

they put an administrative/legal hold on it

opal plank
#

we all working on getting it better

green kestrel
#

i dont know enough js to say for sure but maybe detritus is the best js lib? dunno

#

or is it ts?

cinder patio
#

I don't think y'all should be focusing on guides or example code

green kestrel
#

πŸ˜„

cinder patio
#

true lmao

#

that doesn't justify it tho

#

Everything's all over the place

#

I have to import interfaces from a million places

green kestrel
#

interesting πŸ˜„

#

i didnt realise, but i made my lib in such a way theres lots of ways to make a bot with it, i didnt intend it but the first real world example of a bot someone made with it that wasnt my own, they derived the main class

#

like you would in py ig

#

so then they could do like cpp this->some_api_call()

cinder patio
#

Plus the docs are generated which generally isn't a bad thing but in this case it is because of how disorganized everything is

#

you'll see a million things in the sidebar that are most likely not what you want

green kestrel
#

my docs are generated too, its too complex to write them otherwise, not exactly a REST API when youre dealing with C++

#

got namespaces and all sorts to concern about

cinder patio
#

discord.js' docs are also generated and they're really really good, but that's because the lib is well organized and well... predictable

#

detritus is far from that

#

that's my main problem with it

green kestrel
#

you should learn C++. everyone should learn C++. C++ master race.

#

πŸ˜‚

cinder patio
#

I know a lot of modern C++ but I don't like it's ecosystem, it's almost non-existant, which means tons of boilerplate n stuff

lament rock
#

saying it's organized is a blatant lie.

cinder patio
#

Isn't it written in js

lament rock
#

Yes, but you can still make proper use of JSDoc to properly annotate internally

opal plank
cinder patio
#

how's that a bad thing

opal plank
#

its quite annoying jumping from file to file to find a type

lament rock
#

Unnecessary classes which would just be simple interfaces

opal plank
#

usually you'd group things together in files

#

but a lot of the times they are TOO organized in their own files/folders

cinder patio
#

Why are you jumping from file to file to find a type? It's a js library, all the typings are in a single file, and also, why not use the docs, which are amazing

opal plank
#

so i use intellisense

cinder patio
#

that's just wrong ;c

#

or are you talking about detritus

opal plank
#

detritus

cinder patio
#

ah thought you were talking about d.js

opal plank
#

nah, we moved from there

#

garbage in the trash can, usable trash(hahah detritus joke) in the table to be used

cinder patio
#

yeah looking up things in detritus is like going to a treasure hunt in the lib's source code

opal plank
#

i would help with the typings if i had time

#

since im with covid, im not working, and when this shit ends i'll have to commit to work a lot more

lament rock
#

write lib in ts

opal plank
#

and its annoying af to focus on coding while you coughing half of your lungs out

cinder patio
#

get well soon

opal plank
#

sankyu

#

but i can do some 30-40m spree

#

hopefully the docs receieve a good update now that he finished 15.3

#

slashClient is fully out now

cinder patio
#

Honestly it's not a problem with the docs generator

opal plank
#

i say it is

cinder patio
#

it's with the structure of the lib

#

I have a ts project that uses tsdoc and the docs are fine

opal plank
#

without examples and explanations, the docs are a mood-killer for any entry level dev

cinder patio
#

They can have examples and explanations via comments

opal plank
#

which is what im trying to do

sterile lantern
#
client.on('clickButton', async (button) => {
await button.clicker.fetch();
console.log(button.clicker.member.id)
const yellow = button.guild.roles.cache.get('842790304607109120')
  if(button.id === 'yellow') {
  if(button.clicker.member.roles.cache.has('842790304607109120')) {
     button.clicker.member.roles.remove('842790304607109120')
     let e = new Discord.MessageEmbed()
     e.setTitle('Role Removed'); e.setDescription(`Successfully removed the ${yellow} role from you.`); e.setColor('GREEN');
        button.reply.send({embed: e, ephemeral: true})
     }
    else {
      button.clicker.member.roles.add('842790304607109120')
      let e = new Discord.MessageEmbed()
     e.setTitle('Role Added'); e.setDescription(`Successfully added the ${yellow} role to you.`); e.setColor('GREEN');
     button.reply.send({embed: e, ephemeral: true})
    }
  }
});

does anyone know why this only works after restarting?

#

its supposed to remove/add depending on if they have the role or not

#

it works once, then i have to restart the bot for it to do the opposite action

cinder patio
opal plank
#

its better to provide a full lib than a half assed one

#

anything you need IS there, its just a matter of WHERE

#

thats where the examples and better docs comes in

#

for now the best source is asking in the server if u cant find it

#

but that shouldnt be the case

#

it'd be much better to have better docs instead

cinder patio
#

You could write the docs manually then

opal plank
#

thats the plan

lament rock
sterile lantern
cinder patio
#

gl with that

sterile lantern
#

its supposed to check on click of button

#

even if they have the role or not

opal plank
lament rock
#

is that client.on inside of a command that gets called often or is it in a root scope

opal plank
#

but imo ACTUAL docs would be equally as important

lament rock
#

cant read code too well on mobile

sterile lantern
#

idk its just weird that it sends that it "removed" the role that i didnt even have

#

or added the role i already had

hardy loom
#

does anyone have any bot command suggestions?

opal plank
hardy loom
#

uh

#

πŸ‘€

thorny flume
#

Does anyone know how I can insert information into a message? example: Hello, this is a test and my server is with ${guild.memberCount}

opal plank
#

thats called Template literals

#

just google it up

thorny flume
#

Ok

thorny flume
opal plank
thorny flume
#

Ok...

stuck dawn
#

why this is taking so long?

quiet pawn
zealous stirrup
#

`/workspace/ASTEROID/node_modules/discord.js/src/client/ClientDataManager.js:81
guild.channels.set(channel.id, channel);
^

TypeError: Cannot read property 'id' of undefined
at ClientDataManager.newChannel (/workspace/ASTEROID/node_modules/discord.js/src/client/ClientDataManager.js:81:36)
at Guild.setup (/workspace/ASTEROID/node_modules/discord.js/src/structures/Guild.js:307:68)`

How do I solve it?

zealous stirrup
#

I get it, what do I have to do?

sick agate
quiet pawn
sudden geyser
#

It's probably due to outdated Discord.js like tak said

earnest phoenix
#

You can hard code the library you use

quiet pawn
earnest phoenix
#

Or if you wanna show the version get it from the library

zealous stirrup
sick agate
#

No

#

Gtg

opal plank
#

in topgg at least

quiet pawn
#

o

opal plank
#

u can always have an info command, however

sudden geyser
#

aCtuaLly iTs a TranSpilEr

boreal iron
#

Those cheap ads anywhere… oldEyes

opal plank
boreal iron
quartz kindle
#

well i have djs-light on my info command as well

lusty quest
#

Didnt you want to deprecate d.js-light this month when v13 drops?

quartz kindle
#

v13 is still gonna be supported

#

v14 i dont know

#

djs-next for sure not

cinder patio
#

cause it's typescript?

#

or cause it's a rewrite

quartz kindle
#

cause its a rewrite, and judging from the amount of complaints they are probably gonna make it better, maybe not to the point djs-l is no longer needed, but close i hope

#

also, i dont wanna deal with their shit code anymore

#

im either gonna transition my bots to no lib / pure api

#

or make my own mini lib

opal plank
quartz kindle
#

brb making detritus-light

opal plank
#

what would u even change lmao

quartz kindle
#

make it not ts

#

:^)

opal plank
#

even the examples in the docs are in js tho

opal plank
quartz kindle
#

but not the source

#

i wanna make the source js

#

because fuck ts

#

:^)

opal plank
#

ts good, frick u

crimson vapor
#

ts is just spicy js

lost heath
#

lol

#

so true

woeful pike
quartz kindle
#

lmao

woeful pike
#
const rollRandomNumber = (num: RandomNumber) => num
round cove
#

Xet ??????

opal plank
crimson vapor
opal plank
#

sure did

crimson vapor
#

why???

#

when???

opal plank
#

i wrote this too

crimson vapor
#

how???

opal plank
crimson vapor
#

yikes

prime mist
#

Hmm, those screenshots make me want to commit Seppuku.

crimson vapor
#

I, of course, only write amazing code

#

any code that isnt amazing just wasn't written by me

#

ofc

earnest phoenix
#

Typescript is the language of the gods of js

#

js is weak compared to ts

opal plank
#

measly js users

#

The plebs will never understand our power

earnest phoenix
#

I used to use js

#

ts opened my eyes

opal plank
#

Ts is our lord and saviour

earnest phoenix
#

I understand true power

#

😩

opal plank
#

All hail the power of typescript

earnest phoenix
#

Yes

slender wagon
#

how can i host some javascript files on my site like mysite.com/script.js
and then use them as cdn's on my other sites

earnest phoenix
#

I was about to make a dark joke but lets not

earnest phoenix
slender wagon
#

no servers

#

it's like static

earnest phoenix
#

What kind of site is it

#

that doesn't require a backend webserver

slender wagon
#

it's like a landingpage

earnest phoenix
#

Well apart from serving the files from the webserver

#

no idea

slender wagon
#

i got 350 domain names and i'll control them from 1 js file

#

so i need to use it as a cdn

earnest phoenix
#

You bought 350 domains

slender wagon
#

well yes

earnest phoenix
#

may I ask why

slender wagon
#

cuz my customer wanted em

quartz kindle
#

is it like the same domain on 350 different TLD's?

slender wagon
#

no

earnest phoenix
#

He wanted 350 domains

slender wagon
#

350 different domain names

earnest phoenix
quartz kindle
#

lmao

#

probably for reselling

earnest phoenix
#

Buys em for a 1$

#

sells em for 10

#

prime real estate

slender wagon
#

he wanted me to make some good SEO

#

some fresh content

#

so he can get the price higher based on the visits

earnest phoenix
#

Just serverside render a welcome page

slender wagon
#

but i'll control all his paypal links from 1 file

earnest phoenix
#

ez

slender wagon
#

hosted on 1 main site

quartz kindle
#

you have no server at all?

slender wagon
#

no

earnest phoenix
#

pain

slender wagon
#

vanilla js

#

cries

quartz kindle
#

you need to host it somewhere

earnest phoenix
#

Yea

slender wagon
#

i did the github thingy

#

with this

earnest phoenix
#

The pain it will feel to setup nginx for all of them

slender wagon
#

but he wants me to do it with one of his domain names

slender wagon
earnest phoenix
#

pfft

slender wagon
#

i aint gonna point all the domain names to a vps

earnest phoenix
#

if you doing it do it right man

#

spend hours setting up nginx for 350 domains

slender wagon
#

no he doesn't want that

#

lmao

earnest phoenix
#

and waiting hours for all the nameservers on them to update

#

as well as changing the dns records to point to the IP

slender wagon
earnest phoenix
#

Sounds like fun

slender wagon
#

idek if i can get it to work like that

earnest phoenix
#

Probably can

slender wagon
#

it only has these options

earnest phoenix
#

rip

slender wagon
#

201 domain names are related to weed

quartz kindle
#

you can try setting one of his domain names as a redirect

slender wagon
#

hm?

#

redirect to where?

quartz kindle
#

to the file on github

earnest phoenix
#

redirect all 350 domains to each other

#

ez

slender wagon
#

oh

slender wagon
earnest phoenix
#

Just make it a giant loop

#

so the last one redirects back to the first one

slender wagon
#

maybe they have options for custom domains

#

and not just github

earnest phoenix
#

And each one displays one word and each word makes up a sentence

#

the game is to remember each word

slender wagon
#

bro what

earnest phoenix
#

It is me speaking nonsense

slender wagon
#

E

earnest phoenix
#

Honestly tho that would be funny

#

Just make each domain display a character

#

and it spells out a youtube link

slender wagon
#

the js i've used for his sites killed me

earnest phoenix
#

the youtube link is a rick roll

#

ez

#

biggest internet troll

slender wagon
#

bruh

#

lol

#

350 domain names redirecting to eachother

#

all rickrolls

earnest phoenix
#

Yep

#

Good seo

#

;)

slender wagon
#

lol

earnest phoenix
#

a lot of clicks

slender wagon
#

price high

earnest phoenix
#

well visits

#

Exactly what he wants

#

and what the world needs

slender wagon
#

E

drifting wedge
#

python gamers

#

how can i have more than one subdomain in flask

earnest phoenix
#

well I don't think that is how subdomains even work.

#

Your subdomain is prefixed on the main domain. I don't think you really wanna stack em on each other that would get confusing

drifting wedge
#

alright

#

also wot does this mena

#

mean*

#

AssertionError: View function mapping is overwriting an existing endpoint function: payment_webhook

#

ok i fixed it

gleaming turret
#

Hi

boreal iron
zenith knoll
#
``` returns undefined, not sure why (remaking a cmd handler from anson devs tutorial since my old one was messy)
ruby sun
#

can someone explain to me why

[1,2,3].join``

works ? (JS/TS)

#

been doing JS since 1998 and some kid just threw this at me

#

mind blown

crimson vapor
#

what in the fuck

crimson vapor
ruby sun
crimson vapor
#

thats so random

#

can you call any function like that?

ruby sun
#

right?

crimson vapor
#

with the ``

round cove
#

I thought you were being stupid and I was like "That doesn't work lmao okaybuddy"

#

then ran it

ruby sun
#

good question

amber lion
round cove
amber lion
#

1998 man

#

thats a lot ago

crimson vapor
ruby sun
#

yeah it's messed up

#

I ain't that old lol

round cove
#

Does it have to do with the prototype?

crimson vapor
amber lion
#

since 1988

crimson vapor
#

maybe

amber lion
#

1998*

ruby sun
#

1998 yes...it's not that long ago

#

unless you're a student

crimson vapor
#

@ruby sun you've been doing JS longer than most people here have lived

ruby sun
#

what

amber lion
#

ig u have more than 30

ruby sun
#

of course

round cove
#

Most users here are 14-18

ruby sun
#

wat

round cove
#

I'm almost 24 myself.

amber lion
#

I have 14 and middle

crimson vapor
#

L

ruby sun
zenith knoll
#

damn man

round cove
#

I know your feeling my guy.

zenith knoll
#

how life treats you πŸ™ƒ

amber lion
#

does people older than 30 use discord lol

ruby sun
#

of course

crimson vapor
#

im going to start using `` for functions to fuck with people

#

thank you for sending that here

round cove
#

LOL

ruby sun
#

np Million

wheat mesa
#

I'm new to using public APIs, what would be the best way to extract some of the data out of a JSON response like this in js? ```json
{
chess_rapid: {
last: { rating: 761, date: 1622040874, rd: 38 },
best: {
rating: 1215,
date: 1609875931,
game: 'https://www.chess.com/game/live/6529890705'
},
record: { win: 121, loss: 106, draw: 10 }
},
chess_bullet: {
last: { rating: 515, date: 1621969059, rd: 100 },
best: {
rating: 1023,
date: 1614054833,
game: 'https://www.chess.com/game/live/9572121805'
},
record: { win: 2, loss: 11, draw: 0 }
},
chess_blitz: {
last: { rating: 332, date: 1614897727, rd: 111 },
best: {
rating: 1118,
date: 1612282413,
game: 'https://www.chess.com/game/live/6427598544'
},
record: { win: 3, loss: 12, draw: 0 }
},
fide: 0,
tactics: {
highest: { rating: 798, date: 1612888354 },
lowest: { rating: 772, date: 1612888446 }
},
lessons: {},
puzzle_rush: {}
}

ruby sun
#

it's messed up right lol

zenith knoll
#

impress your peers with brainf*ck-level of js

round cove
amber lion
#

imagine a 95 yr old progamming it would be [candy,crush,cool] string

crimson vapor
#

ts mad

#

sadly I can't do that then

round cove
#

Depends if you set your TS environment to ES6 or not I guess.

ruby sun
wheat mesa
#

Well if I'm trying to get to chess_rapid.last.rating, is there anything wrong with just saying ```js
let CurrentRapidRating = MyJSON.chess_rapid.last.rating

slim heart
#

how the fuck

wheat mesa
#

I've never really done anything with JSONs before

slim heart
#

and why the fuck

ruby sun
#

🀯

slim heart
#

i refuse to believe this is intended functionality

wheat mesa
#

alright, just making sure I'm doing things the right way, thanks!

ruby sun
#

np!

drifting wedge
#

how do i make subdomains work in stripe?

#

like the route subdomain="" thingy

copper cradle
#

I know about that

#

forgot its name tho

#

actually chalk has some pretty good examples of where it could work

drifting wedge
#

talking to me?

copper cradle
#

no

#

I'll ping them at the end

drifting wedge
#

oh ok

copper cradle
#

instead of doing

chalk.cyan("text")

you can do

chalk`{cyan ${anything here lol}} {red ${something more lmao}}`
#

these are called tagged template literals and are from ES2015

copper cradle
copper cradle
ruby sun
#

oh yeah I knew template literals but never seen it used in this way

#

that's interesting

copper cradle
#

yeah

#

I learned about it while reading chalk's docs

long crow
ruby sun
#

Because the fact that I was doing JS in 1998 blew his mind away lol

long crow
#

Β―_(ツ)_/Β―

crimson vapor
drifting wedge
#

the fact thay there are people here born before the 2000s blows my mind

ruby sun
#

The fact that people from the generation who built the modern-day internet are on the internet blows your mind ? KEKW

#

Pretty sure half the staff working at Discord are +30~40

drifting wedge
#

not what i meant

#

yeah

#

thats not that i meant

ruby sun
#

alright

drifting wedge
#

it doesnt "blow my mind" its just cool to think

ruby sun
drifting wedge
#

that like bot devs arent just a bunch of 15 year olds

ruby sun
#

Yeah, diversity is good

drifting wedge
#

wondering

#

@ruby sun wat do you do?

#

like whats ur job

#

is it tech related?

ruby sun
#

part-time tech related

#

I have a business totally not tech-related

#

which takes most of my time

drifting wedge
#

ah

#

u make any bots?

ruby sun
#

Yeah I have one

drifting wedge
#

why dont u have the role then?

#

havent added it?

#

oh boy i remember i waited like 6 months for them to get to mine

#

it was all time high

ruby sun
#

Never really looked into it

#

How do I get the role

drifting wedge
#

you add ur bot to topgg?

#

it helps with exposure

ruby sun
#

Still waiting for approval, probably not gonna happen until August at this rate

#

not that I care about waiting πŸ€·β€β™‚οΈ

drifting wedge
#

not helps, it fucking like THRUSTS your bot into fame lmao

#

topgg is like my only form of advertisement

#

and i got from like 100 servers to 1.4k

#

for basically no effort

ruby sun
#

I doubt my bot will become famous though

#

not like it's the purpose either

drifting wedge
#

yeah

#

it just puts it out there i mean

ruby sun
#

It's a real-time earthquake warning for people here in Japan

drifting wedge
#

oh this is like actually useful

#

lmao

ruby sun
#

yeah

drifting wedge
#

only bot ever that isnt useles

#

less*

#

just a suggestion

#

maybe make a role setting

#

where u ping the role

ruby sun
#

I guess there's no harm in doing so

#

the channels where alerts are sent is already server-owner specified though

#

I like having the alerts to be seen by everyone as people can check on others

#

Had a few +M6.0 quakes lately

drifting wedge
#

the bot has potential tho

#

u could expand to all over the world and other hazards

ruby sun
#

Yeah but Discord isn't really a thing in Japan KEKW

#

I don't have any intentions to do so, sounds like a lot of work

#

I'm plugged directly in the seismographs here

drifting wedge
#

yeah

#

how so?

ruby sun
#

so I actually get alerts before even feeling the quake

#

the organization owning those take applications

drifting wedge
#

and u live in japan

ruby sun
#

If they deem your purpose good eneough, they give you access to the raw data

#

yes

drifting wedge
#

ok ur bot is really useful lmao

ruby sun
#

I think so

#

Thanks

drifting wedge
#

no problem

#

what lang did u make it in>

ruby sun
#

TS

drifting wedge
#

oh

#

stinky

#

pietune best lang

#

pifoon

#

pinephoon

#

python

ruby sun
#

I only do Python when I actually need performance

drifting wedge
#

python is the antithesis of preformance

ruby sun
#

I'm less comfortable writing python so I only do it when it's really necessary

#

lmao

#

Python is way more performant than TS

drifting wedge
#

python is as scared of performance as a backend dev doing css

formal girder
#

Hey

zenith terrace
drifting wedge
#

oh boy ts is garbage then

ruby sun
#

What do you code in to think Python is so trash?

#

Rust ?

sudden geyser
#

People today are not writing Python for performance.

drifting wedge
#

it cant be worse than python

#

i love python

sudden geyser
#

They're writing it for convenience.

drifting wedge
#

i use python for everything

#

its just not fasr

#

but i love it

#

python and i are in a 1 year long commited relationship

ruby sun
#

1 year long KEKW

sudden geyser
#

get married already

ruby sun
#

I still remember when Python 2 was released

#

those were the days

drifting wedge
#

py3 is pog

ruby sun
#

it was not so long after the "Turbo" button disappeared on PCs

drifting wedge
#

oh anybody here know flask

#

how make subdomains

drifting wedge
ruby sun
#

it was the first time I understood the term "false representation"

#

it was a button on PC which basically reduced the speed of your CPU

drifting wedge
#

lmfao

ruby sun
#

On IBM PC compatible computers, the turbo button selects one of two run states: the default normal speed or a reduced "turbo" speed. It was relatively common on computers using the Intel 80286, Intel 80386 and Intel 80486 processors, from the mid 1980s to mid 1990s. The name is inspired by turbocharger, a device which increases an engine's power...

#

found an article about it

drifting wedge
#

@ruby sun fr?

wheat mesa
#

How do I extend the length of an embed in djs? My embeds are automatically putting inline fields on new lines because it runs out of space.

crimson vapor
#

width? You can't

copper hound
#

I don't think that's possible

wheat mesa
#

agh

#

djs docs lied to me!

copper hound
#

you could try to workaround it by making just one field with all 5 names in the title

#

the description will look a bit weird though

crimson vapor
copper hound
#

maybe you could try putting it in a code block?
something like
Rapid Rating Stats

CR   BR   W    L    D
761  1215 121  106  10
ruby sun
#

hmmm

crimson vapor
#

he meant add more inline fields to the same line, I thought

ruby sun
#

I can't english

#

sorry

#

Misunderstood

crimson vapor
#

nah its fine

#

took me a second to understand what he meant

wheat mesa
#

I think I'll stick to just paginating the embed so all the data can fit instead

earnest phoenix
#

yo uh im making a discord bot that uses ai to mimic how people talk by recording conversations and it works but it doesnt look pretty

#

if anyones a frontend dev who wants to team up let me know

lament rock
#

what front end is there other than sending text?

earnest phoenix
#

idk like help menu

#

oh wait like what if since each person has their own ai when you're being mimicked it would nickname itself and change its pfp

#

oh that'd be cool

fiery stream
#

is it possible to terminal log data in php

wheat sun
#

Lol

#

Might as well do the mimicking like how Impersonator bot does

lost wadi
#

Can someone help me please?

wheat sun
#

It's easier if ask what you need to help with, rather than asking to be helped

lost wadi
#

someone knows how to send this information, is that the description of the embed comes out empty

let NivelesMap = niveles.map((v, i) => {
  fetch(`https://gdbrowser.com/api/level/${v.id}`).then(res => res.json())
  .then(x => `**${++i}.** [${x.name}]() Por ${x.author}\n β€’ **ID:** ${x.id}`)
})

const NivelesEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true }))
.setDescription(NivelesMap)
.setColor("#00FFEC")
message.channel.send(NivelesEmbed)
#

"niveles" is an array of objects

wheat sun
#

I don't know js, but try sending the embed with a string for testing

#

I don't think can send an array

lost wadi
#

if someone knows they ping me

wheat mesa
#

Is there any way to set a default value for a variable if the value assigned to it throws an error? For example I have this code:

let CurrentRapidRating = ChessStats.chess_rapid.last.rating || "No matches played"
``` which does not set the value of `CurrentRapidRating` to `"No matches played"` when ChessStats.chess_rapid is undefined
proper bolt
#

you could set props for the entire object

#
if (!ChessStats.chess_rapid) {
  ChessStats.chess_rapid = {
    last.rating: "No matches played",
  };
};
#

something like that

#

or use ternary operators to do something like
let CurrentRapidRating = ChessStats.chess_rapid ? ChessStats.chess_rapid.last.rating : "No matches played"

wheat mesa
#

good idea

#

I'll try to figure something else out that works for many variables at once, since I would rather not do that for 15+ variables, but this will work as a temporary solution

prime mist
#

Newer version of node support the nullable operator, so you can do:

const CurrentRapidRating = ChessStats.chess_rapid?.last?.rating || "No matches played";
wheat mesa
#

Didn't know about that, thank you! Worked perfectly.

proper bolt
#

o yea forgot about that

#

havent worked with node in a while

lavish bramble
#

My console Giving me this and my not logging

lusty quest
#

try to figure out what caused it, if you login automatic after a disconnect make sure to add a delay to it bcs you have a limited amount of logins per day (normal bot about 1000 times)

lavish bramble
#

client.on("warn", console.log)
client.on("debug", console.log)

lusty quest
#

someting caused you to get ratelimited

lavish bramble
#

First it consoled Preparing to connect the gateway

lusty quest
#

429 is the Error code for Ratelimited

lavish bramble
#

Or how can I fix this

lusty quest
#

you have to wait, the debug event should tell you for how long you are ratelimited

lavish bramble
#

Its still spamming

#

My console

lusty quest
#

yea thats normal with the debug event

lusty quest
#

does the theme matches the version of the software? maybe the theme is ancient and with newer versions they changed some stuff

rocky hearth
#

can I make a specific property in an interface which could be undefined, defined using any utility types?

pale vessel
#

Like a partial?

rocky hearth
#

for example, here I just want the b to not be undefined.
So the obj, should have, a and b as required

type Test = {
  a: string
  b?: string
  c?: number
}
const obj: SomeUtility<Test, 'b'> = {...}
prime mist
#

Hmm, might have to do this:

Omit<Test, "b"> & { b: string }
#

Otherwise you could make your own utility type for it.

long crow
rocky hearth
#

na na, that was a ts question

long crow
#
let customer = {
  name: "Carl",
  details: { age: 82 }
};
const customerCity = customer?.city ?? "Unknown city";
console.log(customerCity); // Unknown city``` The example it give
#

It will log "unknown city"

pale vessel
earnest phoenix
#

@long crow he wants a typescript type

long crow
#

oh

#

Thought he referring to null property

earnest phoenix
#

also wdym a and <b> should be required

rocky hearth
#

I dont hv access to Test as it is coming from a lib.
so i wanted to change that, with Utilities

umbral lake
#

hey

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

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

client.on('message', message => {
    if (message.channel.type == 'dm') {
        return message.channel.send("Si tu as un quelquonce problΓ¨me, je te conseille de contacter le #πŸ†˜γƒ»support");
    }
});

client.login("ton daron c'est mega")
#

when the bot

#

recieve a message in dm

#

the bot spam

#

:/

rocky hearth
#

This is fine right? @pale vessel

type MakeRequired<T, S = Test> = Omit<S, T> & Required<Pick<S, T>>
const obj: MakeRequired<'b'> = { ... }
earnest phoenix
#

when the bot recieves a message you arent checkig if the bot sent it in the dm

rocky hearth
umbral lake
earnest phoenix
#

that's why it spams

rocky hearth
#

return immediately if the message is coming from a bot
message.author.bot

wide wharf
#

How do I change my bot's nick in all servers on "ready"?

slender thistle
#

Why

wide wharf
#

I want to include the prefix in the nick

#

the name of the bot is IsmailZ 2.0 so the nick will be [!] IsmailZ 2.0

wide wharf
slender thistle
#

Oh fucking hell

#

Pointless

cinder patio
#

you should put your prefix in the bot's status

#

not in it's nickname

#

not all servers will give your bot permission to change the nickname

slender thistle
#

Not everyone cares about it either

#

Not all servers use that nickname system

wide wharf
#

They can edit it later

cinder patio
#

at that point they'll just turn off it's permission to change nicknames

slender thistle
#

Just use your bot's status

pale vessel
#

@rocky hearth

wide wharf
#

or nvm

#

I'll just use the status lmao

slender thistle
#

This

#

Better idea and anyone who wants to can see it

vivid fulcrum
#

im getting on my pc just to see if that exe is infectionous

pale vessel
#

most likely

vivid fulcrum
#

.net program per usual

#

they stored an entire virus dll

#

hardcoded as a byte array

#

in hopes that it'll fly by an antivirus

rustic nova
#

OH THEY SENT IT HERE TOO

vivid fulcrum
#

that person is a moron lol

rustic nova
#

just delete from your pc kthx

#

if you want the analysis stuff

vivid fulcrum
#

yeah im going through the dll code now

#

this is such a badly written virus 😭

#

it isn't even obfuscated properly

rustic nova
#

ping me next time when someone sends a virus in here topggLikeThis

pale vessel
#

I kind of did and you said nah

rustic nova
#

oh

#

lmao I thought that link just went to a message in the same channel, not in #development

#

my bad KEKW

cinder patio
#

Hey at least they made it themselves

rustic nova
#

probably not the only one who analyzed it tho

pale vessel
#

It do be FpsBoost.exe.exe

rustic nova
vivid fulcrum
#

it's effort that counts

rustic nova
vivid fulcrum
#

they thought that using file:/// would go around windows checking file calls to the kernel i guess??

#

but file:/// literally does that except it's done for you

#

is this x new

exotic lotus
#
InternalOAuthError: Failed to obtain access token
    at Strategy.OAuth2Strategy._createOAuthError (/home/runner/MBL/node_modules/passport-oauth2/lib/strategy.js:408:17)
    at /home/runner/MBL/node_modules/passport-oauth2/lib/strategy.js:175:45
    at /home/runner/MBL/node_modules/oauth/lib/oauth2.js:191:18
    at passBackControl (/home/runner/MBL/node_modules/oauth/lib/oauth2.js:132:9)
    at IncomingMessage.<anonymous> (/home/runner/MBL/node_modules/oauth/lib/oauth2.js:157:7)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)```Getting this error when trying to login on my website using discord
vivid fulcrum
#

@rustic nova

summer torrent
#

you can delete attachments

#

just like embeds

royal herald
#

oh

timber fractal
#

so i have this code that should change the slowmode based on the amount of messages sent in the server and everything works fine except line 17 because it doesn't set the slowmode to 0 but the messagecount in guilds.json is 0 can somebody help
https://srcb.in/DWuvSmEKnv

wide wharf
#

My bot can't join Stage channels for some reason

#

It sends an error "This channel does not exists" in the console

#

And if I let it join a normal vc and move it to a stage channel later, it just disconnects

vale garden
#

hi

wide wharf
vale garden
#

huh

wide wharf
vale garden
#

i know i can

#

thats why i did

#

lol

wide wharf
#

uh

#

mk

#

lol

wide wharf
silk wadi
#

what language

wide wharf
silk wadi
#

maybe read their docs

#

or maybe bots cant join stage channels atm?

wide wharf
#

All music bots I know can join stage channels

#

MEE6 can't become a stage mod tho

#

but Rythm etc can

#

But my bot can't even join the channel

#

It directly disconnects

silk wadi
#

idk then

#

perhaps ask in discord developers

pale vessel
#

don't ask there

#

it's probably lib related

#

they most likely won't be able to help you

wide wharf
#

Oh

#

RIP

long crow
#

what lib are you using? if it djs v12, it intended like that way

earnest phoenix
earnest phoenix
#

if you are using

wide wharf
#

Cus all music bots I know can join stages

wide wharf
earnest phoenix
wide wharf
#

Discord.js

earnest phoenix
#

discord.js v12 πŸ‘

wide wharf
#

I want my bot in a stage channel

earnest phoenix
wide wharf
earnest phoenix
#

It technically is

#

While its still in development

#

its the master branch of discord.js

wide wharf
#

And I need to rewrite my whole script huh?

earnest phoenix
#

Well depends

earnest phoenix
#

Β―_(ツ)_/Β―

wide wharf
earnest phoenix
#

v13 doesn't really introduce anything game breaking yet i don't think

#

So not a lot of rewrite

wide wharf
earnest phoenix
#

I am not even sure if bots can to begin with

earnest phoenix
#

They can't raise their hand

#

so how do they speak

wide wharf
#

Yeah if they're stage mods

#

they can speak

earnest phoenix
#

I mean ig

#

But that is a big if

wide wharf
#

just like Rythm

earnest phoenix
#

I haven't seen rythm go into stage channels so idk

#

But I assume it just has to do with getting the stage channel and telling the bot to join it

#

and making sure it has the right perms to speak

wide wharf
#

I'll show you

earnest phoenix
#

no thanks

wide wharf
#

k then

#

Wait can I send screens here?

#

Yup I can

wide wharf
#

See?

earnest phoenix
#

as stated I don't know how to do it

#

but probbaly just takes getting the stage channel and making em join it

#

I assume a stage channel is similar to a voice channel with limitations

wide wharf
#

If I drag my bot to a stage channel it auto disconnects

earnest phoenix
#

πŸ€·β€β™‚οΈ

#

Probably has to be a stage mod

wide wharf
long crow
#

do npm ls discord.js

wide wharf
earnest phoenix
#

K

wide wharf
#

Has all perms too

#

in my server

earnest phoenix
#

Ask in the support server for discord.js then

#

idk

#

They'd be better suited for this question

long crow
#

v12 doesnt support stage

wide wharf
#

Can you give me a link?

#

nvm

earnest phoenix
#

v12 can only recognize stage channels iirc

#

since it was breaking code if they didn't implement that much

long crow
earnest phoenix
#

Yep

#

all v12 has for stage channels though is telling its a stage channel

#

nothing more then that

wide wharf
#
(node:26) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'user' of null
    at Client.<anonymous> (/home/container/index.js:135:204)
    at Client.emit (events.js:326:22)
    at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:314:20)
    at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:834:20)
(node:26) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

Which line is the error?

#

(can't understand error messages yet)

earnest phoenix
#

I'm validating slash command names. The docs say it has to match ^[\w-]{1,32}$ but /^[\w-]{1,32}$/.test(name) always returns true even if there's a number in there

slender thistle
#

Probably intentional

#

it's just a limit of 32 characters

earnest phoenix
#

there shouldn't be a number in there because of the anchors

slender thistle
#

Ask regex gods

earnest phoenix
#

wait

#

i can just match the string with the regexp and check if it returns the exact same string

#

it works

#

:)

placid iron
#

how code

earnest phoenix
#

[a-zA-Z] should work

slender thistle
#

\W is only letters, right?

earnest phoenix
#

\W is everything that's not an alphabetical character

pale vessel
#

Non alphanumeric (uncapitalized would be the opposite)

slender thistle
#

Regex is pain

lyric mountain
#

regex is fine

wide wharf
#
(node:26) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
    at async MessageManager.delete (/home/container/node_modules/discord.js/src/managers/MessageManager.js:126:5)
    at async Client.<anonymous> (/home/container/index.js:134:36)
(node:26) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
``` Where (which line) is the error?
earnest phoenix
#

uhhh almost all

quartz kindle
#

unknown message means you tried to access an invalid or deleted message

wide wharf
#

Oh

quartz kindle
#

this can happen on messages.fetch(), message.edit() or message.delete()

wide wharf
#

What's an invalid message?

wide wharf
#

not a bug in my code r smth

quartz kindle
#

it is your fault that you dont handle it

#

you need to have code to handle the possibility of the message you are editing or deleting hving already been deleted

quartz kindle
#

just have a generic catch

#

message.edit().catch(console.log)

wide wharf
#

where to place it tho

quartz kindle
#

everywhere where you use the api

#

all api requests have a possibility of failure

wide wharf
#

what api

quartz kindle
#

the discord api

wide wharf
#

Where I fetch the message you mean?

quartz kindle
#

yes

wide wharf
#

okayyy

quartz kindle
#

fetching, sending, editing, deleting, etc... all of those send requests to the api, therefore they may fail

wide wharf
#

client.channels.cache.get ()
is this counted as fetching a message?

quartz kindle
#

no

#

cache functions are internal

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

they dont access the api

quartz kindle
wide wharf
quartz kindle
#

they overlap a bit but have two different purposes

#

get -> try to get object from the cache, if not found return undefined
fetch -> try to get object from cache, if not found try to fetch it from the discord api

#

fetching from the discord api needs to be awaited, and may fail

quartz kindle
#

no

wide wharf
#

ok

quartz kindle
#

fetch will error if not found, get will not

#

because when fetch doesnt find, its a discord api error

wide wharf
#

I only edit message once

#

in my whole code

#

so I have to put this message.edit().catch(console.log) there?

quartz kindle
#

its generally a good practice to catch errors on all requests

#

even channel.send() can fail

wide wharf
#

why

quartz kindle
#

if you dont have perms, if the channel was deleted, if your bot was kicked/banned

wide wharf
#

if the bot doesn't have perms

earnest phoenix
#

If the bot doesn't have perms

quartz kindle
#

async operations are vulnerable to race conditions

wide wharf
quartz kindle
#

since they take a while to take effect, due to latency and network speed, other operations can happen in the mean while

earnest phoenix
#

Be a chad and don't catch anything

quartz kindle
#

for example a channel can be deleted while the bot's message is in process of sending

#

so all api requests can fail

#

hence its good practice to always have error handling

wide wharf
#

WHY DOES IT DELETE MY MESSAGE

#

Oh it deleted dots

quartz kindle