#development

1 messages · Page 1490 of 1

odd stratus
#

It says its coming from: /node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js: 53:60)

marble juniper
#

wierdchamp

earnest phoenix
#

where are you hosting the bot

odd stratus
#

An Ubuntu

#

Linux

earnest phoenix
#

huh

#

is there anything else

marble juniper
#

weird

earnest phoenix
#

to that stacktrace

odd stratus
#

That's all its showing

earnest phoenix
#

and this works fine locally?

odd stratus
#

It works fine regularly but this error occurs randomly sometimes but rare

earnest phoenix
#

oh

#

it might just be discord throwing a fit

odd stratus
#

But I'm pretty sure its crashing the whole bot (aka 1 shard) which isn't good

marble juniper
#

this feels like a weird case

odd stratus
#

I read one site it said maybe its cause I'm not making it ignore the bot in a voiceStateUpdate event but idk if that's the case

earnest phoenix
#

that's definitely not it

#

the error is internal

marble juniper
#

maybe make a github issue on the repo of discord.js

#

pretty sure discord.js has a repo

#

they probably have answers

lusty quest
#

maybe ask in the Discord developers discord. there are people that know more

earnest phoenix
#

it seems like a known issue

lusty quest
earnest phoenix
solemn ocean
#

is there a bot which shows live timer with the numbers being updated

earnest phoenix
#

it's called a clock

#

and no, there is no bot that will show time in realtime due to discord ratelimits

odd stratus
#

Is autoReconnect for the options inside of new Discord.Client(<>) still a thing in V12?

pale vessel
#

RTFM

karmic merlin
#

where then for you?

odd stratus
#

Don't assume I haven't already read any

pale vessel
#

So no, it's not a thing, it's supposed to do that by default automatically

inner roost
#

😱

grave mist
# karmic merlin where then for you?

I don't usually mix server with bot, I put code for that separately as I like it that way but it's your choice, in your case, it'll be better to put inside ready event I guess since the bot must be ready to fetch the user when they vote

karmic merlin
#

ok

undone rose
#

I need an extra set of eyes to make sure i'm not doing something dumb

misty sigil
#

ok sure

undone rose
#

This is where I'm getting the error "Cannot find property: username of Undefined"

for(let u = 0; u < 9; u++) {
            let userName = msg.channel.guild.members.get(sortedVotes[u].id).username;
            let discrim = msg.channel.guild.members.get(sortedVotes[u].id).discriminator;
            topTen.push(`#${u + 1} - ${userName}#${discrim} - ${sortedVotes[u].total} votes`);
        }

and this is the sortedVotes array

[
    {
      "id": "282134235924660234",
      "total": 10
    },
    {
      "id": "378842879050776576",
      "total": 1
    },
    {
      "id": "547882440711077888",
      "total": 1
    },
    {
      "id": "145980073332310016",
      "total": 2
    }
  ]

Each of those IDs is a user ID that is on the server, so nobody has left

#

So I'm not quite sure why its getting this error if it works for some users but not all

#

It works for me but not for another user

misty sigil
#

members.cache.get

#

iirc

undone rose
#

Ah you're right, I forgot to cache all in my client settings

#

I'm a retard bruh

grave mist
#

It's members.cache.get, yes, members.get was a thing in discord.js v11 but that can't be used anymore I guess

undone rose
#

I haven't touched bots in so long

#

I'm not using d.js

#

but should be the same on eris

grave mist
#

oh that's eris?

undone rose
#

yee

grave mist
#

Looks same as djs lol

inner roost
#

:>

pale vessel
#

Are you sure that the member is cached

undone rose
#

I'm going to make sure rn by just caching them all

pale vessel
#

oh I can't read

waxen tinsel
#

I am playing a podcast over a vc for users. I have a reaction menu for stopping and playing, and I want this embed message to keep updated w/ how far into the podcast the user is. I currently plan on having a loop update messages with current time played every 40 seconds, plus an additional 20 seconds to the loop for every 2 active players. Is this considered API abuse, or am I in the clear? Should I perhaps increase the intervals at which the messages are updated? @ me when responding please.

quartz kindle
#

remember that discord disabled the guild members intent by default

#

so your bot no longer gets the online member cache on login like before, unless you explicitly enable server members in your dev portal

pale vessel
#

Except for members in VC iirc

undone rose
#

This bot is only going to be on a single server so I'll make the owner do that

quartz kindle
#

yes, except the bot itself and members in vc

grave mist
#

Like they have to give you access to guild members intent explicitly, not sure whether they do that when verifying bots

quartz kindle
#

when you apply for verification, you need to tell them which intents you need

#

and if you need members or presences, you need to tell them why you need it

#

then they will either accept or reject your application

#

they can for example accept the verification but reject the intent, if they feel like your use case doesnt justify it

pale vessel
#

If you ask for presence intent/guild members solely for "statistical reasons" (e.g. for a userinfo command), they will most likely decline your request

opal plank
#

just say your help command requires both intents and they'll surely accept it

pale vessel
#

💯

quartz kindle
#

lmao

#

@opal plank btw i ended up picking a name for my lib, i went with ftset

#

because fts (full text search) + set

opal plank
#

i still think TimmyLib was the better option

quartz kindle
#

lmao

opal plank
#

or TimTheDevelopmentMan

quartz kindle
#

if i ever make a general purpose lib, maybe

#

but im into niche stuff

opal plank
#

a library that makes libraries

#

boom

near stratus
#

Can anyone suggest me a GOOD mongoDB handler for node (something like Keyv)

quartz kindle
#

no idea, i dont use mongo

opal plank
#

me neither

near stratus
#

then suggest a better Database

pale vessel
#

"mongoDB handler" amandathink

pale vessel
quartz kindle
#

i like sqlite

opal plank
#

postgres

#

though postgres might be the wrong tool for the job

near stratus
#

I'm on Heroku so Lemme learn postgre

#

Also,
Does it work for node ?

pale vessel
#

yeah, heroku has free postgres hosting

pale vessel
pale vessel
#

I use mongoose

earnest phoenix
#

same

opal plank
#

just an fyi, postgreSQL might be the equivalent of this for you, postgres is great but if you need something simple it might not be the best option, as its a bit too advanced @near stratus

pale vessel
#

lmfao

opal plank
#

can it do mostly everything and scale? absolutely. Do you just need a simple db? go for something else

near stratus
opal plank
#

then thats the right tool for your job

near stratus
#

Cuz last time I did that I ended up with Firebase

opal plank
#

i havent used firebase, though i've heard good things abut it

#

i'll still use postgres though. Cassandra was the only other thing i personally would put on par with postgres simply due to scalability and speed

#

iirc discord is using cassandra

misty sigil
#

i think discord moved

near stratus
#

I'll try postgre then

opal plank
#

they used mongo, moved to cassandra, then idk what happened after

misty sigil
#

i think they moved to scala

opal plank
#

scylla

misty sigil
#

there we are

#

i couldn't quite remember the name

opal plank
#

ye thats right

#

i completely forgotten about that

earnest phoenix
#

yo

opal plank
#

so

#

hmmm im not really sure

#

i havent played with it at all so i cant give any feedback on that

earnest phoenix
#

if i require a typescript file would node autocompile it for me

pale vessel
#

what

quartz kindle
#

no

opal plank
#

no?

#

import for ts

#

rquire() for js

#

require() doesnt work on ts

#

cuz its expecting a module

quartz kindle
#

it does if you do import bla = require("bla")

#

no?

opal plank
#

hmmm im not sure tbh

summer torrent
#

anyone here using windows terminal

opal plank
#

probably not

misty sigil
#

requiring ts file

#

just compile the ts

#

man

opal plank
#

or import it

misty sigil
opal plank
#

write everything in ts then transpile to js

summer torrent
#

I can't type W wtf

opal plank
#

mixing js/ts is usually not a good move

pale vessel
#

W

misty sigil
#

ts compiles to something i call weird js

summer torrent
opal plank
misty sigil
#

if you wanna call it that thats fine

opal plank
#

lul

misty sigil
#

but i'm still gonna call it weird js because it's weird

earnest phoenix
#

@opal plank well how could i write commands in ts now

misty sigil
#

make a command struct mmLoL

misty sigil
#

i assume bot commands

opal plank
#

me too, but i dont get what the issue is

misty sigil
#

maybe cmd is defined as object

#

and .run is not property of object

#

or something

earnest phoenix
#

@opal plank the command handler i have literally just requires the file and sets the command data in bot.commands by reading from module.exports

opal plank
#

if its module.exports its not ts

earnest phoenix
#

if i cant require a ts file... well

opal plank
#

its js

misty sigil
#

i wanna rewrite my bot in ts

misty sigil
opal plank
#

module.exports is js

earnest phoenix
opal plank
#

export default {} is ts

#

also use import

earnest phoenix
#

ight

opal plank
#

not require()

misty sigil
#

hmm ts rewrite would be nice

#

but i feel like a lot would break

opal plank
#

you can dynamically call files just like you do with js require, just switch it to import

misty sigil
#

i should rewrite my commands first tho

opal plank
#

recommendation: AllowImplicityAny, and set everything as any

#

then start switching up after you ported everything

misty sigil
#

thats just js with extra steps

opal plank
#

did you read what i said?

misty sigil
#

yes i did

opal plank
#

clearly not

misty sigil
#

i was joking

opal plank
#

port your code to be lax ts, then add the interfaces after you got everything working into a running state

#

realistically you'd enable strict and set allowImplicityAny and AllowJs all to false, but doing that mid way of a project is shooting yourself in the foot, you'll be in a whole lot of rewriting if you do that

misty sigil
#

time to slave away for hours rewriting code

opal plank
#

someone writing an essay

misty sigil
#

typing

earnest phoenix
#

@opal plank so if i have this rn:

// Command file
module.exports = { /* ... */ };

// Command handler
for (let filename of fs.readdirSync("./commands")) {
    let data = require("./commands/" + filename);

    bot.commands.set(data.name, data);
};

kids always remember to put semicolon after object literal and loops

would this be sufficent:

// Command file
export default { /* ... */ };

// Command handler
for (let filename of fs.readdirSync("./commands")) {
    import * from "./commands/" + filename as data;

    bot.commands.set(data.name, data);
};
#

pretty new to ts

misty sigil
#

should do

opal plank
#

wont

earnest phoenix
#

and yes i did just type my command handler instead of ctrl c ctrl v

misty sigil
#

aw fuck i lose

opal plank
#

import cannot be used like that

pale vessel
#

h

opal plank
#

import() not import

earnest phoenix
crimson vapor
earnest phoenix
#

wat

opal plank
#

like i said, just like require()

misty sigil
#

import() ?

opal plank
#

yes

misty sigil
#

i've never seen it used in that way ever before.

earnest phoenix
#

maybe i went to py land

#

and used it's syntax

opal plank
earnest phoenix
#

thanks for saving me

opal plank
#

just gotta be good at ts

earnest phoenix
#

also would i have to compile all my command files before i could use them

misty sigil
#

mmuLu but i've used import * from <> as <> before

#

yes

opal plank
#

you cant import dynamically like that son

#

im telling you rn

misty sigil
#

right

opal plank
#

try a for loop with import like that inside

#

you'll get fancy af errors

misty sigil
#

ooh fancy

#

what fancy errors do i get

opal plank
#

i forgot the exact error code

earnest phoenix
#

well time to do

for (let filename of fs.readdirSync("./commands")) {
if (filename.match(/\.ts$/)) {
// compile the file by running
// tsc filename
// using child process exec

continue;
}
}
misty sigil
#

no

#

dont do it like that

earnest phoenix
#

¯\_(ツ)_/¯

misty sigil
#

just compile everything when you compile

crimson vapor
#

what the hell is this

#

just do regular imports smh

#

no need to do an index.ts inside a folder

opal plank
#

bruh

#

thats stupid

crimson vapor
#

oh are you making a command handler

opal plank
#

dont compile everytime

#

just import like i told you

misty sigil
#

compile once

#

and import

opal plank
#

wrong again

quartz kindle
#

why do you want to call an uncompiled ts file from a js program?

opal plank
#

that'll fuck up if you need to delete cache

#

use import() like i said

earnest phoenix
misty sigil
#

make all the bot files ts or none of them

quartz kindle
#

who told you you have to do that?

#

wtf

misty sigil
#

don't mix the two

opal plank
#

i already gave code the answer for his problem, dunno whats the holdback at this point

earnest phoenix
#

k

quartz kindle
#

you dont have to compile on every restart

#

you compile once

#

and then you run the compiled js files

opal plank
pale vessel
#

how about ts-node thinkowo

opal plank
#

dynamic handler

misty sigil
#

node.ts

pale vessel
#

ez

earnest phoenix
#

so... only compile index.ts and it can handle the other ts files on its own

opal plank
#

how about we dont recompile shit everytime we need to reload commands or restart the bot, like sane people?

crimson vapor
#

LOL

#

can you do that on ts?

#

like

opal plank
#

yes

earnest phoenix
#

LOL

#

imagine not having an automated system

opal plank
#

i legit said that above

crimson vapor
#

reload commands

opal plank
#

use import

earnest phoenix
#

webpack + babel and you're set

opal plank
#

just like require

earnest phoenix
#

ok

crimson vapor
#

oh I wasn't reading the entire conversation

opal plank
#

import is promisifyed

#

if you using babel and webpack to transpile ts dynamically you are doing it wrong

quartz kindle
#

tsc should compile all your ts files and long as you are importing them in your main file

opal plank
#

tsc > babel

earnest phoenix
#

before we do anything else to my command files
git add .
git commit -m "Pre-Apocalypse Backup"

#

that's how i got my workflow for my electron app

#

babel + webpack packs the main and renderer files

#

and then i obfuscate it all

opal plank
#

or you could just use import like i said which is the equivalent of require() without none of the extra stuff you doing

#

i call that bloating

quartz kindle
misty sigil
#

brain got fucked by jsfuck

earnest phoenix
#

i use webpack-obfuscator which is just a wrapper around javascript-obfuscator

cinder patio
#

typescript + webpack for me

crimson vapor
#

@pale vessel how do you update avatars on veldchat when someone changes it?

pale vessel
#

It's under user:update

earnest phoenix
pale vessel
#

It just gives the new user object

earnest phoenix
#

no errors in my code but it seems to hate on discord.js

crimson vapor
#

oh

#

poggers

#

lemme add that to caching

opal plank
restive furnace
#

no

crimson vapor
#

perhaps

#

what bot is this

restive furnace
#

it's already 2021 in UTC+0700

#

2021*

opal plank
#

the genshinutils one

crimson vapor
#

oh

#

nah ima not invite that one

opal plank
opal plank
#

still got around 9h

crimson vapor
#

more for me

restive furnace
#

americas?

#

or smth

opal plank
#

yeah, im in america

#

the south one

restive furnace
#

ah ok

earnest phoenix
#

i still dont get it

#

why does tsc say there are 170 errors with discord.js

restive furnace
#

tsc --no-check-lib or smth

misty sigil
#

cuz discord.js is stinky and doesnt have types

#

iirc

crimson vapor
#

oh

#

poggers djs

#

matthew

#

are there any big changes made in prs?

#

for ourcord

mellow kelp
misty sigil
#

wanna know what has good types

crimson vapor
#

ourcord

misty sigil
#

OU

crimson vapor
#

fuck

sudden geyser
#

auto generated types when

crimson vapor
#

typing hard

#

anyway

mellow kelp
#

Yea just let ts generate the types

crimson vapor
#

matthew if I rewrite the entire thing will you merge it?

restive furnace
misty sigil
#

as long as it works

crimson vapor
#

ok

#

ima stream it

cinder patio
#

why are you making a fake map

earnest phoenix
misty sigil
#

idk

restive furnace
#

@earnest phoenix checkout some compiler flag like --no-lib-check from tsc docs

cinder patio
#

show your tsconfig file

restive furnace
#

yeah ik

#

check the docs

#

theres a flag for it

earnest phoenix
# cinder patio show your tsconfig file
{
  "compilerOptions": {
    "target": "ES2015",
    "module": "commonjs",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Recommended",
  "exclude": ["node_modules"]
}
cinder patio
#

hmmm... what's $schema for

earnest phoenix
#

idk

#

just copied this from typescript docs recommended configuration

cinder patio
#

other than that everything looks fine to me... I have all those settings enabled and I don't get such errors. Is only discord.js affected?

earnest phoenix
#

the exclude part is different tho

cinder patio
#

no other modules?

cinder patio
#

I dunno

earnest phoenix
#

time to ping erwin ¯\_(ツ)_/¯

#

@opal plank

#

there you go

opal plank
#

huh?

#

@earnest phoenix sup

misty sigil
#

read up you bongo

opal plank
#

lazy

opal plank
#

npm i @types/discord.js

mellow kelp
#

Pretty sure discord.js comes with types already

opal plank
#

im not sure about that

mellow kelp
#

Hm

opal plank
#

@earnest phoenix are you importing or requiring discord.js?

#

welp, back to coding

cinder patio
#

it comes with types

earnest phoenix
#

and putting @types/discord.js in the repl packager says no results

pale vessel
earnest phoenix
#

@pale vessel that's the exact file that throws those errors

#

idfk why

pale vessel
static trench
#

hey guys. i wanted to add an eval command to my D.py bot. anyone know a good place to find one?

pale vessel
#

Use jishaku

static trench
#

rly?

near stratus
#

If you want more use jsk

static trench
#

ok

#

can i use python?

near stratus
static trench
#

wow

earnest phoenix
#

Best of all code it yourself

near stratus
#

It's on python

static trench
#

seperate question. is discord.js better than discord.py?

pale vessel
#

No

earnest phoenix
#

!!Yes

pale vessel
quartz kindle
#

they are both trash :^)

static trench
#

smh

#

ok

earnest phoenix
static trench
#

can i need a new invite link to use slash commands?

earnest phoenix
#

Why is it showing a error?

#

@pale vessel

sudden geyser
#

hover over the red dot

earnest phoenix
#

What?

sudden geyser
#

use your mouse to hover over the red dot

earnest phoenix
#

Why LOL?

sudden geyser
#

try it out and see what appears

#

spoiler alert: the error

earnest phoenix
#

what the fuck is that indentation

#

did you have a seizure on the tab key

#

It’s saying

#

SyntaxError: Identifier 'Discord' has already been declared

sudden geyser
#

well there's your issue

#

you already defined Discord

earnest phoenix
#

So uh what do I remove?

#

and probably copypasted code

#

bad

#

@earnest phoenix from the guide

#

Discord.js guide

#

🙄

#

Or library

#

I just need help...

#

SyntaxError: Identifier 'Discord' has already been declared ^^^^

#

Sp what do I remove?

#

take a guess

#

“Discord”

#

correct

#

Oh yeah lemme show you

#

Looks like a new error

quartz kindle
#

lmfao

earnest phoenix
#

@earnest phoenix don’t you think I tried removing discord before?

#

lol

#

this is painfully hilarious

quartz kindle
#

if you took the time to read over the links we sent you...

#

i mean, the first chapter on evie's guide talks about variables

earnest phoenix
#

He said to me to remove discord....

quartz kindle
#

variables cannot be redeclared

#

you already have a const Discord somewhere in your code, which means which means the name Discord is now taken, you cant use it again anywhere in your program

#

and you shouldnt need to

earnest phoenix
#

So why is it showing error now?

quartz kindle
#

because if you already have Discord somewhere, you just use the one you already have, you dont need to duplicate it

earnest phoenix
#

OOOH I GET IT

sudden geyser
#

ding

earnest phoenix
#

I remove the 2 first lines @quartz kindle

#

Correct?

sudden geyser
#

oh so close

quartz kindle
#

if you already have them somewhere else, yes

earnest phoenix
#

Or 3

#

Yes 3

#

I’m an idiot

quartz kindle
#

because you only need those names once in your entire file

earnest phoenix
#

I’m sorry I’m new and I am very dumb I always forget stuff

quartz kindle
#

once you declared them, there is no need to duplicate them

earnest phoenix
#

But Tim wanna see something? @quartz kindle

sudden geyser
#

Santa you may want to spend more time learning JavaScript

earnest phoenix
#

Yea I will

#

I gtg

quartz kindle
#

you're basically trying to write a book in chinese without knowing how to draw the characters

#

xD

earnest phoenix
#

My bot is sending multiple messages when its supposed to send 1, How is this

#

It just spammed my dms 47 times with hello when I sent 1 message aka 1 command

sudden geyser
#

Inspect your code with a debugger for cases where the same function may be called multiple times.

#

For example, see if you have listeners nested without properly handling multiple cases of listeners.

#

We don't know your code base, nor would we like to see it since it may be large.

crimson vapor
queen needle
#

js 100

quartz kindle
#

its GS, the new language thats better than TS

#

stands for GarbageScript

earnest phoenix
#

jython

#

jython actually exists ok

#

wow

crimson vapor
#

lmao

#

honestly

#

its kinda amazing

#

that some people can't figure this out

#

and some people can make shit like phones

#

shows the differences between people

earnest phoenix
crimson vapor
#

good video

#

imo

earnest phoenix
#

some people just can't think logically, it's a good sign programming isn't for them and they should seek a different career/hobby

crimson vapor
#

programming is part of math and science, which bot of those were created to make more sense of the world

#

so its a bit strange to me for someone to not understand it at all

#

im not talking about like C or assembly, I mean js or py

misty sigil
crimson vapor
#

thats smart

#

until you need to declare a variable

queen needle
#

I feel like when people pick up coding they think it'll be easier then they think

misty sigil
#

its hard to jump right into advanced projects

earnest phoenix
#

this

umbral zealot
#

its hard what though

crimson vapor
#

people should 100% start with java or some C

earnest phoenix
#

people overestimate their abilities because they want to feel smart

queen needle
#

^

crimson vapor
#

I prefer the word challenging to the word hard

#

hard makes no sense

#

what about it is hard

queen needle
#

Yeah

umbral zealot
#

Cry, have you suddenly realised there's such a thing as the Dunning-Kruger effect? lol.

misty sigil
#

i don't think everyone should code but everyone can code

#

if they put enough work into learning

#

and not just ctrl c ctrl v

earnest phoenix
crimson vapor
#

that just seems like programing to me

#

Dunning-Kruger

umbral zealot
crimson vapor
#

good chart

#

took me a second to understand it

haughty mirage
#

um, any ideas why this happens in console sometimes lol
just randomly on different logged info?

umbral zealot
#

you have a console log somewhere that outputs that 😂 ¯_(ツ)_/¯

crimson vapor
#

are you holding down s?

umbral zealot
#

use the search, luke.

misty sigil
#

ssssssssssstatus

queen needle
#

i have a random log on my bot in a random file and i still have not found it it haunts me

crimson vapor
#

ctrl shift f

#

find it easy

haughty mirage
#

no wait, its my host, its just changed to 'status'
lol, ill report it as bug

umbral zealot
#

It's not a bug it's parseltongue

crimson vapor
#

oh

haughty mirage
crimson vapor
#

ive not seen a harry potter reference for a while

queen needle
#

i found the random log it was in my index from a way weeks ago when i was debugging

crimson vapor
#

lmao

#

I never use console.log so its easy for me to find random logs

queen needle
#

i always use it

crimson vapor
#

actually my logging function is broken so I do use it once in my index

#

but otherwise I don't

queen needle
#

how is it broken?

crimson vapor
#

well 2 issues

#

first is that I named logger.js Logger.js in the file

#

and second is that I need to set defaults for everything

#

so without method: console.log it breaks

queen needle
#

ah

#

is it the one on your bot or the one on your sharex thingy

crimson vapor
#

sharex one

#

I think

#

yeah probably

cinder patio
#

@earnest phoenix I'm late but did you try setting the "allowJs" option to true

noble zephyr
#

where are you from

crimson vapor
#

Antarctica

kind kayak
#

How use fs and foreach for make handler of commands with subfolders

#

Hi

#

Who can help me

cinder patio
#

You can read all files in a folder and sub-folders using recursion

#

For example:

function getFiles(folder) {
    const filePaths = [];
    const allFiles = fs.readDirSync(folder);
    for (const file of allFiles) {
       const fileStats = fs.readDirSync(`${folder}/${file}`);
       if (fileStats.isFile()) filePaths.push(`${folder}/${file}`);
       else filePaths.push(...getFiles(`${folder}/${file}`));
    }
    return filePaths;
}
earnest phoenix
#

heroku is real bad don't host my bot for1 week Others servers start removing and kicking my bot

#

the problem i have no card or paypal

#

that why i use heroku

cinder patio
#

ok

earnest phoenix
#

there any host for free

cinder patio
#

if you want a successful bot buy a vps

misty sigil
#

read pins

cinder patio
#

if you treat your bot as a side-project, continue hosting on heruko

#

there aren't any good free hosts

misty sigil
#

good and free host don't go together

earnest phoenix
#

yeah i see

#

Why is it showing error?

#

Someone??

tame kestrel
#

.setColor isn't accessing anything

earnest phoenix
#

Why?

#

That is a number tho

#

Like for a color ^

mellow kelp
#

It's not chained to anything

earnest phoenix
#

Or do I have to choose an other color?

#

Alr I’ll remove it

tame kestrel
#

line 113 ends with a semicolon, so it's like the computer asking you want you want to set that color to

#

not that removing the semicolon will do anything but like

#

You might want to take a look at what you're doing in that screenshot and rewrite it a bit

earnest phoenix
#

Now why is this showing an error..

#

I want it like dyno reply

#

Like ?avatar

#

And an embed text comes and says “AVATAR and shows a picture”

#

@tame kestrel

#

And btw why does that have an error?

mellow kelp
#

Thats not how js works

quartz kindle
#

lmfao

mellow kelp
#

Just send an embed with the display avatar url as the image

quartz kindle
#

i admire your perseverance but i cant help to laugh at your attempts to shoot in the dark

earnest phoenix
#

@quartz kindle happy to make you laugh LOL

quartz kindle
#

i know you're trying your best, but you're ending up doing some very weird shit

earnest phoenix
#

I don’t like this it’s ugly lol

tame kestrel
#

I agree with Tim, I think your best option is to learn more about javascript before you interact with a library like discord.js

mellow kelp
#

Agreed

#

Don't just rush things

earnest phoenix
#

I want it like this

quartz kindle
#

embeds have a setImage() method

earnest phoenix
#

Wait can I send you the coding and then you can edit it a bit?

quartz kindle
#

nope

earnest phoenix
#

Uh ok

quartz kindle
#

thats called spoonfeeding

#

and its not allowed

earnest phoenix
#

Oh

#

Alr lol

#

@quartz kindle so if it’s an embed

#

It’s

#

In the description LMAO?

summer torrent
#

dude wtf

dusky marsh
#

😬

quartz kindle
#

the same way there is setTitle and setDescription, there is also setImage

earnest phoenix
#

So what’s the uh code for set image

#

Do I just

gilded olive
#

🤔

earnest phoenix
#

.setimage?

mellow kelp
#

Use the setImage method

earnest phoenix
#

Under setititle?

mellow kelp
#

Thats all

earnest phoenix
#

But I don’t know the coding for it

quartz kindle
earnest phoenix
#

But

#

When people do +avatar

#

I don’t want them to get 1 picture

summer torrent
#

you should learn js basics

mellow kelp
#

Yeah

earnest phoenix
#

I want them to get their own Profile pictures

#

Not just 1 stuck picture

quartz kindle
#

thats why displayAvatarURL() exists

earnest phoenix
#

I’ve tried that

#

But it’s ugly

#

Like look

#

Isn’t that ugly? Be honest

mellow kelp
#

Add a size to the options

quartz kindle
#

just because its ugly, doesnt mean its not working

mellow kelp
#

You can pass a size to the method options

earnest phoenix
#

It has to be a bit nice looking dosent it?

cinder patio
#

Look - I don't think there's a way to tell you how to do it without giving the code directly to you. So, learn javascript basics first and then start making a discord bot

earnest phoenix
#

@mellow kelp how?

#

@cinder patio fine give me the document today I’ll study on it seriously

quartz kindle
#

yes, but that has nothing to do with your idea that you're setting a fixed url

#

if you use displayAvatarURL, you're not setting a fixed url

mellow kelp
#

Learn javascript first and foremost

quartz kindle
#

you're setting the person's avatar url, just like you want

earnest phoenix
#

I know, but I want a embed reply not just a link and a small picture

quartz kindle
#

i already gave you the answer

mellow kelp
#

If you don't know what that means, learn js

earnest phoenix
#

Fine, let’s try

#

@cinder patio do I read allllll of the documents?

#

Or just the first top ones?

mellow kelp
#

How much js do you know

earnest phoenix
#

Not much ^

mellow kelp
#

The probably start at the introduction

earnest phoenix
#

And then after?

#

But the top ones are the most important right? @mellow kelp

cinder patio
#

All of it would be best, but I think Introduction, Javascript basics and Data Types are the most important

earnest phoenix
#

Alr thanks...

cinder patio
#

and objects

earnest phoenix
tame kestrel
#

@earnest phoenix

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Basics

You probably only need to learn these in order to get what you want done.

And someone wrote a guide here on embeds. https://discordjs.guide/popular-topics/embeds.html

If you have any questions you can ask here or on my dms.

earnest phoenix
#

@tame kestrel @cinder patio @mellow kelp Alr thanks! A lot of documents but ok lol @quartz kindle happy to make you laugh and you guys too LOL

quartz kindle
#

good luck xD

tame kestrel
#

I'm glad you're happy to learn :)

earnest phoenix
#

Thanks lol you too :)!

quartz kindle
#

it sounds like you'd do better with a full time teacher tho

earnest phoenix
#

Cya ima study tomorrow since its new year today

mellow kelp
earnest phoenix
#

Yea I learn very well with a teacher @quartz kindle

mellow kelp
#

The docs are free real estate

earnest phoenix
#

On my own I’m not really that good

cinder patio
#

Is this self-advertising smirk

quartz kindle
#

yes :^)

tame kestrel
#

@earnest phoenix no advertising

earnest phoenix
#

looking for reviewers 😐

tame kestrel
#

Good, you can't look here.

mellow kelp
earnest phoenix
#

which channel should i go to?

tame kestrel
#

We don't really have channels here for users to promote usage of their own services or anything

earnest phoenix
#

ok that's fine then

#

hopefully the top gg reviewers will approve my bot eventually 😄

quartz kindle
#

well you can ask if someone is willing to help you test it, but you need to phrase it like "help me test xyz" instead of "please try my xyz"

#

sounds better and less advertisy that way

mellow kelp
#

Fax

fleet scaffold
#

hello i put my bot in top.gg but why is it not showing?

quartz kindle
#

it takes a while to be reviewed

#

when did you add it?

earnest phoenix
#

My coding isn’t working :/ ^^^

#

:/

solemn latch
earnest phoenix
#

What my code isn’t damn working???

solemn latch
#

troubleshoot it? 🤔

misty sigil
#

debug it

solemn latch
#

or that

quartz kindle
#

im just gonna go ahead and say it

#

its not working because you have no idea what you're doing

earnest phoenix
#

you're following 13 different recipes and then wondering why the food doesn't taste good

blissful coral
kind kayak
#

I need a handler for a folder with subfolders commands

#

I need that the handler catch all commands of the folders

solemn latch
#

shouldnt be hard to do if you read over the fs docs.

kind kayak
#

Ok you have a doc? Please

#

Help please

solemn latch
#

sure, google would have it.

crimson vapor
#

well

#

fs docs are strange

#

ngl

#

yo woo

solemn latch
#

they are just the nodejs docs right?

crimson vapor
#

can I extend an object?

#

yes they are

solemn latch
#

isnt the nodejs docs considered good.

kind kayak
#

Yes node js

crimson vapor
#

imo they are strange

#

anyway

#

can you extend an object?

#

its a weird question

solemn latch
#

as in
object.prop = "some thing"

#

or like extend as in class extension?

crimson vapor
#

class extention

#

like class x extends Object

#

and new x()

solemn latch
#

yeah

crimson vapor
#

hmm

#

time to see how that should work

#

how would you interact with the object

#

in the class

#

this.property?

solemn latch
#

yeah

#

pretty sure a long long long time ago i did some extension on members for balances

crimson vapor
#

on djs members?

solemn latch
#

yeah

crimson vapor
#

smh

solemn latch
#

that was for millions question

#

you can find the fs docs on google

kind kayak
#

👍🏻

solemn latch
static trench
#

Do I need a new invite link for slash commands?

mellow kelp
#

I think you need to use a new scope when aurhorizing your app

#

So technically yes ig

crimson vapor
#

should I extend an object or just create a new class and use this.object

mellow kelp
#

np

solemn latch
#

i dont think theres really a problem with extends, since its pretty common to use.

crimson vapor
#

ok ima do that

mellow kelp
#

Inheritance gang

crimson vapor
#

LOL

earnest phoenix
#

everything is a fake map in js 😔

crimson vapor
#

shhh

#

I just want an object with a .set and .delete ability

#

seemed like it would make caching super easy

earnest phoenix
#

i did something similar but it's a prototype method

crimson vapor
#

oh

#

prototype pollution

earnest phoenix
#

so i can obfuscate getting and setting

crimson vapor
#

wait

#

why obfuscate?

earnest phoenix
#

closed source program

crimson vapor
#

oh

#

makes sense

earnest phoenix
#

and a lot of people just waiting to steal my code

#

lmfao

#

javascript-obfuscator is heaven for this

crimson vapor
#

all the code ive ever written is open sourced

#

wait

#

why can module.exports = { AnyClass } work

#

its not an array

mellow kelp
#

Wat

#

Why shouldnt it work

crimson vapor
#

I mean

#

how does it work

#

since its not an array

mellow kelp
#

But like

#

Why just an array

crimson vapor
#

idk

pale vessel
#

bruh

mellow kelp
#

You can export anything

#

And require it from other files

crimson vapor
#

but you're exporting an object but not giving it a name and value

mellow kelp
#

Yeah but

#

Es6

#

You dont need to explicitly set a name for an object property if it has the same name as the value you're assigning it to

crimson vapor
#

oh

#

makes sense

crimson vapor
#
module.exports = class FakeMap extends Object {
  constructor(object = {}) {
    super();
  }

  set(key, value) {
    this[key] = value;
    return this.object;
  }

  delete() {
    delete this[key];
    return this.object;
  }

  toString() {
    return JSON.stringify(this);
  }
}```
#

code p good?

misty sigil
#

it works

vague fractal
#

I want learn javascript...

sudden geyser
gilded olive
#

loggers

stable nimbus
#
roles: m.roles.map(r => ({
          name: r.name,
          id: r.id,
          hexColor: r.hexColor
        }))

I have no idea how to fix this after legit 20 google searches on how to do role list displaying of a guild user.

TypeError: m.roles.map is not a function

Thats the error ^

sudden geyser
#

It's not Google searches you should be looking for. It's the library documentation you should be looking at.

#

m.roles I assume returns a roles manager, so you'll need to use the .cache property to get the underlying collection.

#

So, m.roles.cache has the Collection which you can call map on.

hasty mulch
#

What’s a KeyError in Python?

sudden geyser
#

It means a key you tried accessing doesn't exist.

#

You can often find the meaning of an error by searching it up on your favorite search engine.

hasty mulch
pliant elbow
sudden geyser
#

Because it doesn't exist.

hasty mulch
#

It does exist

sudden geyser
#

I trust the error more.

#

Try logging it beforehand

hasty mulch
#

I do a manual pull that has the same API endpoint and it runs fine

stable nimbus
#

It worked, but now It won't list more than one member and I'll have to talk to the dashboard devs about that and how to fix that.

pliant elbow
#

huh?

#

What are you trying to do?

rocky hearth
#

how can I clone a Map, effectively??

lyric mountain
#

First result for "javascript clone map"

pale vessel
#

isn't it just new Map(oldMap);

dim isle
#

K

sudden geyser
#

I wonder, by what means effective? Performance? The easiest/most primitive way to do it? Both? smirk

dim isle
#

How do i even make a bot

lyric mountain
umbral zealot
hasty mulch
#
async with aiohttp.ClientSession() as cs:
    async with cs.get("https://api.weatherbit.io/v2.0/alerts?lat=40.72&lon=-73.71&key=[REDACTED]") as r3:
        res3 = await r3.json()
        **Alert(s):** {newline.join(alert['title'] for alert in res3['alerts']) or None}```
Produces: ```Unhandled exception in internal background task 'weatherembed_loop'.
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 101, in _loop
    await self.coro(*args, **kwargs)
  File "/home/pi/Documents/Room_Sealer/cogs/room-sealer-weather.py", line 90, in weatherembed_loop
    **Alert(s):** {newline.join(alert['title'] for alert in res3['alerts']) or None}
KeyError: 'alerts'```
#

RAW DATA:
{'country_code': 'US', 'lon': -73.71, 'timezone': 'America/New_York', 'lat': 40.72, 'alerts': [], 'city_name': 'Floral Park', 'state_code': 'NY'}

normal sage
#

I'm trying to create a command where it sends a screenshot of a website

and how would I create an else statement when a user doesnt enter a website?

@client.command()
async def ss(ctx, *, args):
  if args:
   URL = args.lower() 
   urln =   f'https://image.thum.io/get/width/1920/crop/675/ maxAge/1/noanimate/{URL}'
   r = requests.get(urln, allow_redirects=True)
   open("screenshot.png", 'wb').write(r.content)
   await ctx.send(file=discord.File("screenshot.png"))
   os.remove("screenshot.png")
  else:
   await ctx.send("Please make sure the URL is correct (ex: https://google.com)")

I tried creating an else statement, but that didn't work.

sudden geyser
#

@hasty mulch is RAW DATA the result of logging res3?

hasty mulch
#

Yes

hasty mulch
sudden geyser
#

No need to be rude

hasty mulch
hasty mulch
odd stratus
sudden geyser
#

I don't see why your code is emitting that error. The only thing that looks suspicious is why what appears should be interpreted as a string ("**Alerts(s)**: {...}") is not one.

sudden geyser
# normal sage I'm trying to create a command where it sends a screenshot of a website and how...

The reasonable way of doing things would be to try parsing the string into a URL. If it works, the URL does too. If it doesn't, it's not valid so discard it. There are ways to parse a URL, such as using the built-in library urllib (https://stackoverflow.com/a/52455972/14695788).

You should also make it impossible for the user to escape the URL by using urllib.parse.quote.

sudden geyser
#

elf I assume they removed some code to show what matters.

normal sage
#

o ok

hasty mulch
hasty mulch
sudden geyser
#

elf is also using requests it seems and that's blocking so they may want to change that too

gilded olive
#

Using non async libraries in an asynchronous library

sudden geyser
#

I know what blocking means

sharp birch
#

what the heck

misty sigil
#

can we see the actual fucking error

sharp birch
#

Yes

#

wait

sudden geyser
#

I'm asking why parsing a string into a tuple containing URL info be a blocking operation.

#

Are there signs that it's blocking?

normal sage
#

@sudden geyser Would this work? ```py
@client.command()
async def ss(ctx, *, args):
val = URLValidator(verify_exists=False)
try:

URL = args.lower()
urln = val(f'https://image.thum.io/get/width/1920/crop/675/ maxAge/1/noanimate/{URL}')
r = requests.get(urln, allow_redirects=True)
open("screenshot.png", 'wb').write(r.content)
await ctx.send(file=discord.File("screenshot.png"))
os.remove("screenshot.png")
except ValidationError, e:
await ctx.send("Please make sure the URL is correct (ex: https://google.com)")

sharp birch
gilded olive
sharp birch
#

how do i

#

ok one question

sudden geyser
gilded olive
#

I mean

sudden geyser
#

At most all I found out was urlparse always return a ParseResult and doesn't throw an error, and nor will it with the all call since all properties exist.

gilded olive
#

youre supposed to try that with a discord bot

#

Also what terminal is that

lyric mountain
#

looks like a normal console with blurred transparent background

sudden geyser
#

macOS terminal with blurred background

earnest phoenix
#

how do I change the color of hyperlinks with css?

#

in my bot desc

pale vessel
#

a

wheat valve
#

Is it considered privacy breach if only I can see server names and IDs? If this isnt the right channel to ask, im sorry

umbral zealot
#

server names, yes.

#

Oh if only you can see them? No.

#

The issue is publishing that information to anyone that asks.

wheat valve
#

No it only is logged in the console, so yes only me, myself, can see them

umbral zealot
#

yeah that's fine

wheat valve
#

Alright thanks

earnest phoenix
normal sage
#

ok

#

ty

pulsar bone
#

hey how can i make my bot react to a specific message that is sended days ago

rocky hearth
pulsar bone
#

can i make bot react by providing a link

#

@rocky hearth

rocky hearth
#

yes, u can extract the messageId from the link

#

The messageID is in the end of the link

pulsar bone
rocky hearth
#

For example, #development message
The messageID for this link is 794447204386734110
ChannelID is 272764566411149314
GuildID is 264445053596991498

pulsar bone
jade juniper
#

What app or page do you recommend to make a bot with bdb.js?

pulsar bone
#

@jade juniper nice pfp 👍

jade juniper
#

pfp?

pulsar bone
#

profile picture

rocky hearth
#

so u using python?

pulsar bone
jade juniper
#

quality above all

pulsar bone
#

@rocky hearth i am also from india wdy

blissful lynx
jade juniper
#

hi

blissful lynx
#

Xddd

rocky hearth
#

in djs I would hv did this.

const messageToReact = await <TextChannel>.messages.fetch('message-id');
await messageToReact.react('love');
opal plank
#

good example, bad execution

#

fetch may return null

earnest phoenix
# pulsar bone not that whats the syntax for adding reaction like message.add_reaction("❤️") wh...

You need to fetch to get the message object first, to fetch a message object, you'd need channel object. Then you can use that add_reaction method. But you can also use the lower level function as well where you don't need to fetch the message object, just need channel id and message id.

Assuming you're using discord.py, something like this would do ```py
emoji = discord.Message._emoji_reaction('😳')
await bot.http.add_reaction(channel_id, message_id, emoji)

opal plank
#

null.react() => error

rocky hearth
#

y would it return null?

opal plank
#

if you provide ABC, a wrong id (bad regex or something), or a message id you dont have access to

rocky hearth
#

it may either fail or pass

opal plank
#

what do you think will happen ?

rocky hearth
#

i mean it will generate error, if id is not correct

opal plank
#
messages.fetch('/16725417542') //bad regex
messages.fetch('178264812') // no access to channel

all those examples and some more will fail

#

like i said, good example, bad execution

#

the example points them towards the right direction, but its also good to let them know to address those issues that'll happen

rocky hearth
#

hmmm, I'm bit lazy, to address all of that 😜

opal plank
#

:/

#

if you gonna be that half assed dont even bother, send them to the docs then

rocky hearth
#

that's rude

opal plank
#

what part of that is rude?

rocky hearth
#

Promises can always fail to execute. Not a thing to mention, every single time

earnest phoenix
#

how to get value with code nodejs
suchas 7000 - x = 5000

#

value x will is 2000

lusty quest
#

make sure they are all Numbers then just use -

#
let value = Number(2000)

let Calc = 7000-value
#

the number thing is just to make sure if you pass a String into it

earnest phoenix
#

no bro i didn't mean that

#

i mean

#

if we don't know the value

lusty quest
#

you want to get x

earnest phoenix
#

such as

pulsar bone
earnest phoenix
#

yea i know i want to get x

#

but the value it didn't fix

lusty quest
#

then calc 7000-5000

earnest phoenix
#

i made giveaway bot i want to change time of giveaway but it didn't change

#

then i want function to this.endat - x = options.addtime

#

that way i want to know how?

lusty quest
#

where did you get x from

earnest phoenix
#

how to we know the value x

#

suchas

#

Guys how to handle error if channel doesn't has SEND_MESSAGES permission.

earnest phoenix
lusty quest
#

this will print an error in the console but the process wont crash

earnest phoenix
earnest phoenix
#

i want change that value to 2m

#

like that

lusty quest
#

just overwrite the value?

lusty quest
earnest phoenix
lusty quest
#

this where not for you

earnest phoenix
lusty quest
#

well then send it into the channel where the command is used. if this doesnt work use the system channel if this doesnt work use Reaction if this doesnt work give up, if they cant set up permissions you cant work around it

earnest phoenix
#

I dm user but it keeps executing even when user is not executing command.

lusty quest
#

so its an issue with your command handler

earnest phoenix
#

Example

#

-help

lusty quest
#

well it executes commands without respecting the prefix

earnest phoenix
#

then typing any thing after that is executing command

lusty quest
#

so it is probably an issue with your command handler

earnest phoenix
#

But with permission it works fine.

#

No Dm nothing

lusty quest
#

did you use a message collector for your help command?

lusty quest
#

there is somewhere a part of the code that is flaky then

earnest phoenix
#

I think it's not returning only once

#

The command keeps executing everytime I type.

lusty quest
#

sounds like your command handler is ducked

earnest phoenix
#

Hmm

#

Probably

cerulean ingot
#

hey guys, ive been wanting to make a discord bot recently? any ideas?

drifting wedge
#

How do I make a decorator? Python

lusty quest
#

or just jump the Hypetrain for recent games

#

iirc Genshin bots grew like crazy before the hype died down

earnest phoenix
cerulean ingot
#

whats that @lusty quest

lusty quest
#

the game?

cerulean ingot
#

oh

cerulean ingot
lusty quest
#

idk, i do not suggest making a Music bot there are already to many. maybe make one that gives users the Ability to play minigames in chat with others

#

maybe make a D&D bot

cerulean ingot
#

ooo

#

that would be a cool bot, Minigame Bot

misty sigil
#

i don't suggest a music bot either

cerulean ingot
#

yeah lmao

misty sigil
#

it can scale horribly

#

and costs a lot to maintain