#development

1 messages ยท Page 1448 of 1

quartz kindle
#

that was gonna be my next suggestion, just wanted to check if the encoding did set correctly xd

earnest phoenix
#

why are you storing guild name in the first place Thonk

quartz kindle
#

the show command is supposed to show it

obtuse jolt
#

that was one of the most complicated non-complicated things ever

earnest phoenix
#

it's just a useless piece of data you have to keep track of

crimson vapor
#

how are typings used for regular js modules

pure lion
#

@quartz kindle i got the stuff to work

sudden geyser
#

Well, why does it not work?

#

By definition you can throw an embed.

#

it's just not conventional.

#

Usually you'll return the value and instead only throw errors.

quartz kindle
#

why do you want to throw an embed lol

#

it works

sudden geyser
#

Avoid throwing logic for non-errors.

[object Object] means you put it in a string

#

You put it in some string.

quartz kindle
#

you did something like that somewhere

#

thats why it shows Object object

quartz kindle
#

likely killed due to your system running out of memory

#

if you're on linux, monitor your memory usage using top or htop

earnest phoenix
#

I made a circle on canvas. but I cannot fit the picture in this circle. how can I do it?

#
ctx.beginPath();
ctx.arc(foto.width / 2, foto.height / 2, 22, 0, Math.PI * 2);
ctx.closePath();
ctx.clip();
ctx.drawImage(foto, 138, 130)
ctx.restore();
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

๐Ÿ‘

gilded olive
#

Probably not

#

Tho i dont like when the fist is about to hit

#

Maybe ive just been staring at a screen for too long

dim wadi
#

lmaoo its the best non scary one i could find

gilded olive
#

I might actually go blind with how much I stare at a screen all day

sudden geyser
#

hm let's see

#

do you wear glasses

dim wadi
dim wadi
#

||that makes me sound old||

gilded olive
dim wadi
earnest phoenix
misty sigil
#
            this.socket.send(JSON.stringify({
                op: 3,
                d: {
                    status: t,
                    afk: false
                }
            }));``` right so i'm trying to set my status using the raw ws, and this is just causing everything to crash and i don't see why.
weary ore
#

HI i keep getting a error when i try to remove a role from a user
Code: https://pastebin.com/vKFaaPAZ
Error: UnhandledPromiseRejectionWarning: typeError: Cannot read the property 'roles' of undefined

misty sigil
#

i check if t is a valid status too

earnest phoenix
#

give me snake command

#

nodejs

#

12.04.??

#

discordjs

sudden geyser
quartz kindle
#

wtf is a snake command

earnest phoenix
#

well it obv summons an anaconda that eats the entire guild

#

bruh

#

so spawns python.exe mmLol

#

yall don't know the game snake

#

aka snek (for discord)

#

oh

#

lmao

misty sigil
#

anyone done anything with the discord api (specifically setting status with the gateway) here? i'm trying to set status using this code: js this.socket.send(JSON.stringify({ op: 3, d: { status: t, afk: false } })) and it seems it should be right according to the discord developer docs, but it just crashes the bot.

weary ore
#

HI i keep getting a error when i try to remove a role from a user
Code: https://pastebin.com/vKFaaPAZ
Error: UnhandledPromiseRejectionWarning: typeError: Cannot read the property 'roles' of undefined

earnest phoenix
#

is the user in the guild

#

get returns undefined if no element can be found

#

and since you fetch all members, that rules out pretty much everything except one thing; the user with that id is not in the guild

weary ore
#

i console.log(userID) im using my alt to test and it logs my alts id n my alt is in the guild

earnest phoenix
#

hm, you got server members intent enabled?

weary ore
#

on the developer portal yes n in the code

#

it gives the user the role but doesnt remove it

quartz kindle
#

console.log(guild,member)

#

before using guild.roles

drifting wedge
#

list1 = json.loads(list1) Expecting value: line 1 column 1 (char 0) py

crimson vapor
#

Tim could you explain *.d.ts?

quartz kindle
#

typings for typescript users and intellisense

crimson vapor
#

o

#

I tried to make it for a package for intellisense and it isn't giving anything

#

I can post code but do you know any common mistakes?

quartz kindle
#

you need to define it in the package's package.json

crimson vapor
#

oh

#

how do I do that

opal plank
crimson vapor
#

yes

opal plank
#

i heard the word typescript being said 3 times, as per contract, i am summoner

#

ship your shit with index.d.ts, ez pz

crimson vapor
#

yeah, how do I define typings?

opal plank
#

or whatever name you got

#

i assume its index.js

crimson vapor
#

ye

opal plank
#

or index.ts

#

make a .d type

#

that nomenclature automatically imports from that name

crimson vapor
#

so I have an index.js which exports a class

#

how do I do all of this you speak of

opal plank
#

you put the types in the .d file, and set the type in the main file

crimson vapor
#

the main file is index.js

quartz kindle
crimson vapor
#

im confused

opal plank
#

look at tim's example

#

iirc you dont even NEED the declaration for it, you can simply import

#

though i could be wrong about this specifically

#

by declaration i mean the typings declaration

#

<name>.d.ts should automatically be picked up by your ide(assuming vsc)

crimson vapor
#

yes

#

ok its still saying (alias) module "<module-name>"

#

when I require() it

opal plank
#

huh?

#

you made your package a module type no?

crimson vapor
#

umm

#

probably not

opal plank
#

if you didnt you either have to or change the extension file to tms or something

#

i forgot the extension

#

.js is normal js

#

but theres a .ets or some shit like that

#

lemme check rq

#

mjs

#

.mjs is automatically picked as module type

crimson vapor
#

hmmm

#

im using regular .js

opal plank
#

it doesnt matter

#

mjs is js

crimson vapor
#

o

opal plank
#

MODULE js

#

which is what the m stands for

crimson vapor
#

do you mean exports vs module. ?

opal plank
#

no i mean making your whole thing a module

quartz kindle
#

you dont need to use those things, just a typings file is enough

opal plank
crimson vapor
#

not error but just no intellisense

opal plank
#

usually module related issues come by not setting them as type of module in the package

#

though if its only intellisense it shouldnt be an issue

crimson vapor
#

yeah so the code works fine except no intellisense

opal plank
#

did you SET the types though?

#

if your index.d.ts is empty it wont import anything

crimson vapor
#

here ill send the index.d.ts

#
declare module 'loggers' {
  interface LoggerOptions {
    debug: boolean,
    method: any,
    colors: boolean,
    newLine: boolean,
    catch: boolean;
  }

  export class Logger {
    constructor(options: LoggerOptions);
    private send: any;
    public readonly options: LoggerOptions;
    private _formatArgs(): string;
    private _formatColors(): string;
    private _newLine(): string;
    public log(): boolean;
    public warn(): boolean;
    public error(): boolean;
    public err(): boolean;
    public debug(): boolean;
  }
}```
crystal wigeon
#

hey guys so

opal plank
#

hmmm

#

how you defining that in your index.js/ts?

crystal wigeon
#

im using erelajs and the setQueueRepeat is setting the repeat to true but its not actually looping the player queue

crimson vapor
#

index.js:

const pkg = require('./package.json')

const Logger = require('./lib/Logger.js')
Logger.version = pkg.version

module.exports = Logger
opal plank
#

import

#

which you dont even need tbh

crystal wigeon
#

when i skip with "player.stop()" it jsut disconnects after it ends.. but its supposed to loop

opal plank
#

since it should automatically pick up

#

you need a type

#

const Logger: Logger = require('bla bla')

crystal wigeon
#

any help?

crimson vapor
#

im a bit confused rn

opal plank
#

if you need to manually import do import {Logger} from './index.d.ts';

#

cuz you are importing types from typescript into javascript

#

you either need jdocs for js, or typings for ts

crimson vapor
#

hmmm

opal plank
#

ts can pool from both jsdocs or ts declarations

#

js can only pool from jdocs

crimson vapor
#

oh

#

wait im confused even more actually rn

#

I did something lemme explain

opal plank
#

actrually, here, rather than explaining the whole thing

#

lemme just 100iq this

#

"typings": ".index.d.ts"

#

add that to your package.json

crimson vapor
#

so I went into another project and installed it, and it is giving intellisense for logger.Logger() which I thought I defined logger() as the constructor

opal plank
#

this is what tim was on about

crimson vapor
#

yeah I added that

opal plank
#

so it should be working fine

crimson vapor
opal plank
#

aight

crimson vapor
#

it isnt tho sadly

opal plank
#

use ./

#

local path

crimson vapor
#

ok

#

added that

#

so I now know an issue

opal plank
#

now reload ide

crimson vapor
#

oh ok one sec

#

ok yeah no changes

opal plank
#

no intellisense?

crimson vapor
#

well I was gonna say that there is but it is instead of Logger() it is giving intellisense for Logger.Logger()

opal plank
#

what IS Logger?

crimson vapor
#

a class

opal plank
#

in your file

#

how you importing it

#

let Logger = new Logger()?

#

or let Logger = require('Logger')?

crimson vapor
#
const Logger = require('loggers')
const logger = new Logger()
console.log(logger)```
opal plank
#

thats why

#

do this for sanity sake

#
let Logger = new require('loggers')();
#

the issue is

#

you are requiring it

#

require is a bitch cuz it returns any type

#

you need to either type cast it or set the return

#
let Logger:Logger = new require('loggers')();
summer torrent
#

@scenic kelp nsfw

opal plank
#
let Logger = (new require('loggers')() as unkown as Logger);
#

either one or the other

crimson vapor
#

thats ts or js?

opal plank
#

ts

crimson vapor
#

im writing js

opal plank
#

thats why its annoying to use require()

crimson vapor
#

ah I see

#

ok so the issue is that the intellisense things that Logger.Logger is a thing

#

which it isnt

opal plank
#

its usually better to write everything in ts and then transpile into js

opal plank
#

wrong type declaration possibly

#

do //@ts-ignore on the line above logger

#

with lowercase

#

and run it

gray hill
#

Developer Log 1: PC is shipping, time for wait zoomeyes

opal plank
#

if js catches an error, its wrong type declaration

#

its a shit way to debug, but it works and its simple

#

if js errors, well, you declared your typing wrongly somewhere

crimson vapor
#

js errored

opal plank
#

then there you have

#

its likely what i said

#
let Logger = new require('loggers')();
crimson vapor
#

there isn't any intellisense for that either

opal plank
#

just type that in

#

and run it

#

see if it errors

crimson vapor
#

ok

#

no error, Logger is correctly defined

#

to a new logger class

opal plank
#

your typing delcarations are wrong then

crimson vapor
#

do you know how I could fix that

opal plank
#

no clue, you gotta debug it

crimson vapor
#

rip

#

ty for your help

opal plank
#

np

hollow sedge
crimson vapor
#

yeah

gray hill
#

WHO DARES PING ME

#

Oh

#

Anyway

crimson vapor
#

In ts is it possible to make an export a class? @opal plank

hollow sedge
#

oh no i pinged KitPlayingMinecraft

crystal wigeon
#

can anyone help?

earnest phoenix
#

What's the problem

#

?

crystal wigeon
#

so basically whats happening is when the queueRepeat is true it kinda doesnt work when "stop()" is called. like the queue just stops and doesnt repeat

#

im usnig erelajs

#

they have a method "setQueueRepeat"

earnest phoenix
#

Uh

crystal wigeon
#

but it only works if the song completes without any skip

earnest phoenix
#

Idk about that api

#

Sorry

crystal wigeon
#

yeah i think it was Alex who suggested lavalink and erelajs

earnest phoenix
#

Ask him so

crystal wigeon
#

i forgot which alex ๐Ÿ˜‚

earnest phoenix
#

Lol

blissful coral
#

Yes discord is having API problems

mint charm
#

wait it does again?

drifting wedge
#

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```

                       stdout=subprocess.PIPE,
                       stderr=subprocess.PIPE)
   stdout, stderr = process.communicate()
   list1 = stdout.decode("utf-8")
   list1.strip("[]")
   print(list1)
   list1 = json.loads(list1) ```
#

python

pale vessel
#

....?

#

Ah

#

list1 needs to be a valid JSON

#

What does it look like?

drifting wedge
#

its HUGE

#

it should be json...

#

it returns josn

#

so its the strip part?

pale vessel
#

What are you stripping

drifting wedge
#

well it returns the json with [] outside

#

its like {}

#

[{}]

pale vessel
#

But that's not valid

drifting wedge
#

It worked yesterday

#

I don't know what I changed

#

wait wtf

#

it works when i do python3 filename

#

but not when i do pm2

hollow sedge
#

:confusion:

celest island
#

in discord.py, is there a way to get the bot's avatar without taking it in as a command argument or putting its link directly?

red coral
#
    console.log(member.id)
    if (typeof foo !== 'undefined') {
        const channel = await member.guild.channels.cache.find(ch => ch.name === 'welcome');
        let welcomeembed = new Discord.MessageEmbed()
        .setTitle(`Member Join!`)
        .setThumbnail(member.user.displayAvatarURL())
        .setDescription(`Welcome ${member.user.tag}, Welcome to ${message.guild.name}!`)
        .setColor('#21eb67')
        .setTimestamp()
        channel.send(welcomeembed)
    }
})``` help?
opal plank
#

this is some 3000iq shit

crimson vapor
#

yes

#

Erwin you are back

#

so umm

stark trench
#

!=

opal plank
#

yes and no

stark trench
#

)

opal plank
#

im drunk, whats up

crimson vapor
#

can you set an export to a class in ts?

#

like how module.exports = Class

opal plank
#

i assume so yeah

crimson vapor
#

ok then how?

near stratus
#

won't just if(foo) work fine ?

crimson vapor
#

foo is useless

opal plank
#

a class is a function basically, after it had sex with an object

#

foo is undefined most likely

near stratus
#

what is foo anyway

opal plank
#

probably undefined

crimson vapor
#

I mean

near stratus
#

I thought it was a global variable

opal plank
#

they wouldnt ask for help if they knew what they were doing

crimson vapor
#

how would I go about telling ts that I want to export a class

opal plank
#

you dont module.export stuff my dude

#

on ts

near stratus
#

module.exports

crimson vapor
#

...

opal plank
#

export class
thats it

near stratus
#

module.exports = className

opal plank
#

es6 syntax, welcome to the civilized world

near stratus
opal plank
#

bruh what

crimson vapor
opal plank
#

require is the annoyance

crimson vapor
#

seems to me like 'loggers' has property Logger

opal plank
#

require() returns any

#

import is much better

crimson vapor
#

hmm

opal plank
#

you planning on running that on some 2005 browser?

#

if not, use es6

crimson vapor
#

possibly

#

alright time to learn import

hollow sedge
#

Wdym possibly lol

crimson vapor
#

node.js == 2005 browser?

#

true

#

perhaps

opal plank
#

no, nodejs has different flavours

#

es6 and higher is the one you should be aiming at

#

only really outdated browsers dont support es6

near stratus
#

congratulations I just learned es6 modules in 36 seconds

crimson vapor
#

yo

opal plank
near stratus
#

yeah it's kinda useful

opal plank
#

i once again repeat

#

welcome to the civilized world

crimson vapor
#

can I set a property of a string if I use new String()?

near stratus
#

specially the {} thing while importing

crystal wigeon
#

hey guys

#

umm

opal plank
#

bruh what

crystal wigeon
#

so the Erelajs "trackStart" event is looping ;-;

opal plank
#

why you even calling a string constructor

crimson vapor
#

like (new String('hi')).msg = hi

crystal wigeon
#

like its being emitted 3 times

crimson vapor
#

to do that lol

opal plank
#

no

crystal wigeon
#

if there are 3 tracks

crimson vapor
#

ok ty

near stratus
opal plank
#

you can hack its prototypes though

crimson vapor
#

it is

hollow sedge
#

Why is it showing the authors

crystal wigeon
#

okay millioon

#

you here

crimson vapor
#

extentions?

hollow sedge
#

Oh

crimson vapor
#

idk

crystal wigeon
#

you recommended me erela

crimson vapor
#

whats erela

crystal wigeon
#

lel i think im confused

#

xD

#

erelajs

#

for music bot

hollow sedge
#

Do you mean eris

crystal wigeon
#

nah nah

#

lavalink

opal plank
#

eris has nothing to do with music

crystal wigeon
#

erelajs is diff from eris

#

lavalink

crimson vapor
#

idk ive never said to use lavalink

opal plank
#

ngl dude, i dont wanna truin your dreams, but dont do music bots

#

you cant scale them

crystal wigeon
#

im almost there

crimson vapor
#

well

opal plank
#

trust me

crimson vapor
#

you can

hollow sedge
#

Well I didn't realize it was a music thing

crimson vapor
#

with lavalink

opal plank
#

you CANT scale them

crimson vapor
#

oof

#

I can't even scale my bot

opal plank
#

you better off making a json database before you are able to properly scale music bots

#

you'll need to put investment into it

#

and buy ipv4 blocks

hollow sedge
#

No you need a ton of other knowledge on actually deploying lol (million)

crimson vapor
near stratus
opal plank
#

you cant

near stratus
#

I can

#

I have

opal plank
#

you dont even understand what im talking about

solemn latch
#

Doesn't the YouTube api work with ipv6? You can just get a free ipv6 block.

hollow sedge
#

Isn't mongo slower and not async?

crimson vapor
hollow sedge
solemn latch
#

1 dedi is still a ton of ips

#

A ton of backend you can't get from your basic YouTube guide

opal plank
#

any api you hook into will need to be ratelimited, that means each ip will use up all the quota for that token, you'll need THOUSANDS of ipv4/6's and use lavalink or some other proxy/router for each request. Ive seen some stuff interanlly from rythm, you have absolutely no idea how complicated it is, dont assume cuz you have a bot on 20 servers your bot is scale friendly

#

both spotify api or youtube

hollow sedge
#

It's pretty crazy

#

They can't be making that much from it either

opal plank
#

"i made a music bot", some random user, who copied shit from d.js guide

#

people have no idea what they getting into when making music bots with the expectation of getting them popular

#

2 weeks later every single one of them comes here asking for another api that wont ratelimit them or how they can bypass it with scrapper or some other free method

hollow sedge
#

It's honestly not worth it either unless you're just trying to learn

opal plank
#

if you arent willing to put in the buck and buy ipv4 blocks, dont do it

crimson vapor
#

I agree

hollow sedge
#

There are already big bots that fulfill this function

crimson vapor
#

discord bots are not the thing to make

hollow sedge
#

And also actual streaming services that you are supposed to use to play music

#

But like if you're trying trying to learn then don't let anyone stop you lol

earnest phoenix
#

alright should i use fatjar or nah,
if yes then what should i use? maven-shade or maven-assembly or smth else?

crystal wigeon
#

Just because the reviewer thought there was no space in my bot prefix it got declined TwT i have to redo it all over again

thick gull
#

sounds like a bot reviewer problem

#

so contact them?

#

also not the channel

pale vessel
#

Just ask

slender thistle
crystal wigeon
#

I mean, yeah i did, he said there was no space on the website so he ended up using the prefix without spaces and so the bot didnt respond, i just said "ah my bad, i'll upload it once again" im too scared to ask xD >.<

#

he might be a busy person

slender thistle
#

It's fine to contact them for questions if you understand what they go through on a daily basis nekololatyou

lusty quest
#

also mongodb is easyer to scale than mysql

lean pike
#

Hi Guys

#

I have question

#

What is the best in response speed

const BaseCommand = require("../../utils/structures/BaseCommand");
const { MessageEmbed } = require("discord.js");
const Discord = require("discord.js");
module.exports = class TestCommand extends BaseCommand {
  constructor() {
    super("evel", "testing", ["top-server"]);
  }

  async run(client, message) {}
}; ```
```js
const { MessageEmbed } = require("discord.js");

module.exports = {
  name: "",
  aliases: [],
  permissions: [],
  usage: "",
  description: "",
  ownerOnly: false,
  enabled: true,
  cooldown: 5,
  exec: async (client, message, args) => {} 
}```
lusty quest
#

do a benchmark.

#

generate a timestamp when the command is initiated and when its fullfiled

#

then compare both timestamps

lean pike
#

I know

#

But i need the best

#

For big project

lusty quest
#

idk never thinked about changing the way commands are contructed. the Class will give you more flexebility i guess while the conventional method is easyer and lightweight

#

but if you want to make a really big bot i dont think js will be the way.

lean pike
#

Hmm Idk

#

I will make AutoMod bot But is not free

lusty quest
#

if you want the best overall performance a compiled language would be better.

lean pike
#

Idk but i'm use js and i'm learned ts

lusty quest
#

js is fine but at larger scales it will decline in efficency

lean pike
#

But i like js

lusty quest
#

well its easy to learn. i started to learn C# bcs i want to have a more efficent use of Resources

#

i still like js and will probably keep using it. (mostly bcs i have no idea if i can easly implement the stuff ive made in C#)

lean pike
#

its nice language and like Java

lusty quest
#

java is ok. but you have to code efficent, they used to teach it wrong in school for years.

lean pike
#

Yes

#

I don't like Java because is long

marble juniper
#

java is bad in perfomance on large scale things

#

minecraft java edition is an example of this

#

lol

#

started out as a small game

#

was fine

#

fps wasn't that low

#

now its thicc

#

and pcs struggle with it

#

lol

pale vessel
#

Just get a better PC 4head

#

joke joke

marble juniper
#

smh

#

my gaming pc is decent for its price

#

for the money I had available

#

still runs like 500 600 fps

#

lol

#

and my pc can run genshin impact 60fps consistently

#

whatever

#

bedrock edition runs better

#

than java edition

#

cuz bedrock is c++

lean pike
#

What

marble juniper
#

c++ uses more resources but in return you get more fps

lean pike
#

Minecraft Bedrock edition used c++

earnest phoenix
#

huh

lean pike
#

??

marble juniper
#

yes

#

it does

#

its not in java

#

its c++

earnest phoenix
#

that statement is bullshit lol you can make anything use more resources

marble juniper
#

they basically recreated it in c++

#

lol

lean pike
#

Why Mojang used Java in Minecraft Java and used C++ in minecraft Bedrock edition

marble juniper
#

im just talking about bedrock edition

earnest phoenix
#

the reason why people use cpp is because you can do proper manual memory management and tune it to your use case

marble juniper
#

using more than java edition

pale vessel
#

ahem microsoft

marble juniper
#

lol

earnest phoenix
#

java edition is not only running on java but its full of really really bad code that a 12 year old could've written better

marble juniper
#

thats also the thing

#

I mean orginally they didn't even make it

earnest phoenix
#

it's full of O(n^2) loops and what not

marble juniper
#

mojang just bought it from notch

#

so yeah

#

and the game is old as fuck

pale vessel
#

but also cry: bedwarstats

earnest phoenix
marble juniper
#

I litterally saw the 1.8 minecraft code

#

the variable names were

#

reeeeeeeeee

earnest phoenix
#

they're obfuscated

marble juniper
#

k

#

still ugly

earnest phoenix
#

you can't get the names that were originally there

#

unless you're an employee

marble juniper
#

lol

#

whatever

earnest phoenix
#

also yes super ugly regardless

#

the code is ๐Ÿšฎ

marble juniper
#

uglier than my code

#

and thats

#

an accomplishment

#

to not be proud of

earnest phoenix
#

1.13 and on is especially bad because they got interns

#

so they added shit code on already shitty and archaic base

#

not to mention they're still using java 8

pale vessel
#

is it still feasible to rewrite a cleaner version in java

earnest phoenix
#

yes

#

java is java and it'll be a memory hog no matter what you do

#

but

#

writing actually good code produces good results

#

just by using modern day java they would already get a fuckton of optimizations

#

but no

#

java 8 hurr durr

stable eagle
#

this is why I bought a "I write beautiful code" shirt

marble juniper
#

lol

lusty quest
#

1.12.2 is more or less the sweatspot for mods too

crystal wigeon
#
        var dt = new Date();
        dt.setHours(dt.getHours() + 1);
        dt.setMinutes(dt.getMinutes() + 10);
        stats.timestamp = dt;
        console.log(stats.timestamp);
        const interval = setTimeout(async () => {
          // do something
          clearInterval(interval);
        }, new Date(stats.timestamp) - new Date());```
Is there something wrong with this code? idk why the setTimeout is triggered before the actual trigger time
sudden stirrup
#

Is there a way to get emoji id from emoji?

#

not from emoji name

pale vessel
#

from emoji?
What kind of emoji?

sudden stirrup
#

custom emoji

pale vessel
#

Just split or parse the emoji identifier?

sudden stirrup
#

how to parse emoji

cinder patio
viscid leaf
#

Anyone got dbd codes?

pale vessel
#

Is it a string?

sudden stirrup
#

yes

#

in vscode it returns ๏ฟฝ

#

when i log message.content.toString()

pale vessel
#

That's not a custom emoji

#

That's just a unicode emoji like "๐Ÿ˜ฉ"

#

Discord uses Twemoji though but the content still use unicode

sudden stirrup
#

Oh, im idiot thanks ๐Ÿ˜„

crystal wigeon
#

ik timestamp is correct because it gave the correct timestamp 2020-12-13T09:37:40.173Z

cinder patio
#

The thing is that new Date() is always bigger than the timestamp, so it returns a negative number

#

you need to subtract the timestamp from the date, not the opposite

#

(Unless the timestamp is supposed to be bigger than the current date, then something else is wrong)

pure lion
#

I'm writing a class for something, can I somehow have this accessible when I move functions into their own files?

#

In TS*

#

Hey

#

In need of help

crystal wigeon
cinder patio
#

Weird. Try just stats.timestamp - new Date()

pale vessel
#

yeah that new Date() is redundant since it's already a date instance

#

but i'm not sure why that didn't work

ancient thunder
#

I'm bored so I'm making my own library

earnest phoenix
#

How the heck does JS store this infinite loop:

Object.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__
ancient thunder
#

it just does

pure lion
#

Isn't new Date() a date object and new Date().time() the timestamp?

#

Nvm

ancient thunder
#

new Date().now() is the timestamp

pure lion
#

new Date() - number is a thing too

#

TiL

earnest phoenix
#

The method is static

#

It can be used on the main class only not on instances

pale vessel
earnest phoenix
#

@pale vessel what does 5head mean tho

pale vessel
#

"hi".constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor.constructor

earnest phoenix
#

@pale vessel i did not run the script yet i know what it'll output Function () { [native code] }

pale vessel
#

Function's constructor is a function

ancient thunder
#

yes that's why it also has a constructor

pale vessel
#

some xss work like this

#

they just do Function("return somethingbad;")()

#

where Function can be something like string.constructor.constructor

drowsy raven
#

does anybody know how can I add a role to all the members in my server?

#

(not with my bot)

earnest phoenix
#

Everything is an object in js

#

even classes are objects

pale vessel
#

You're an object

earnest phoenix
#

no u

misty sigil
viscid leaf
#

@misty sigil what a large cock

feral aspen
ancient thunder
feral aspen
#

Why does it not let me add more? for example a rob with a value?

ancient thunder
#

hehe bots go brr

ancient thunder
#

is it a js object?

#

you can do object[newkeyname] = value

feral aspen
#
const newData = new Data({
                name: bot.users.cache.get(user.id).username,
                userID: user.id,
                lb: "all",
                money: 0,
                bank: 0,
                daily: 0,
                weekly: 0,
                beg: 0,
                work: 0,
                rob: 0,
            })

I made a new data and when I added the rob: 0,, it didn't add in the database for some reason.

#

Is there like a limit?

#

Oh wait, I found the solution! Thanks! ๐Ÿคฆโ€โ™‚๏ธ

ivory seal
#

does anyone know what the ratelimit is for guild.fetchInvites()?

earnest phoenix
marble juniper
valid oak
earnest phoenix
#

Best SQL wrapper for node.js
And best wrapper for java?
Google search wont cut it, because people wll say that their wrapper is the best.

pale vessel
#

Best SQL wrapper for node.js
For me it was mysql2 since it supports promises

quartz kindle
#

google search will cut it if people add reasons/facts/data to back up their claims

#

which they often do

earnest phoenix
#

Google cant cut it

quartz kindle
#

google will cut you

summer torrent
#

lol

earnest phoenix
#

No u, google will cut discord.js-light

slender thistle
#

I will cut Google

pure lion
#

is it better to compile ts files before pushing to npm or at client side?

quartz kindle
#

if you dont compile before pushing, commonjs users cant use them

pure lion
#

gotcha

quartz kindle
#

ts packges usually have two versions, one for ts another for js

#

and you chose which one to use in your require line

summer torrent
earnest phoenix
#

How can I do that to see what servers the bot is on?

#

Please help

dusky sundial
#

In what language?

earnest phoenix
#

djs

#

?

dusky sundial
#

I'm not that good with js, but maybe something like

    const Guilds = client.guilds.cache.map(guild => guild.name);
    console.log(Guilds);
earnest phoenix
#

thanks

#

I'll check

tribal siren
#

so i got this problem.

#

i use message.content.split(" ").slice(1).join(" ") and message.content.split(" ").slice(2).join(" ")

#

for example, i want to write <number 1 2

main trench
#

@earnest phoenix you can do client.guilds.cache.size

#

That gives you a number

tribal siren
#

i want it to give me this:

- 1
- 2```
#

it gives me this

earnest phoenix
tribal siren
#
- 1 2
- 2```
#

how do i fix this?

dusky sundial
#

@main trench I think he wants to know the names of the servers, not the number of servers

earnest phoenix
#

Yes, i know the numbers.

earnest phoenix
#

yep

tribal siren
#
#

here you go brotha

earnest phoenix
#

Its weird

main trench
#

When top.gg is more friendly then the actual d.js server KEKW

tribal siren
#

lmao

earnest phoenix
#

Hi

#

Why this command not working?

tribal siren
#

you have to do await bot.users.cache.find(mentionedMember).send(warnEmbed)

earnest phoenix
#

ok

#

thanks

#

still not working

#

๐Ÿ˜ฆ

earnest phoenix
tribal siren
#

why

earnest phoenix
#

no reason

#

but can you try to help?

tribal siren
#

then just do bot.users.cache.find(mentionedMember).send(warnEmbed)

earnest phoenix
#

ok

tribal siren
#

instead of await mentionedMember.send(warnEmbed)

earnest phoenix
#

ok

earnest phoenix
tribal siren
#

ok do it then

tribal siren
#

if you want to do it

subtle kiln
#

Hello. Do you know if MySQL have a CONV function that works on large number? Because

select CONV('05A2919F5812D0CD80', 16, 3);

gives me garbage. I expect 221122112211221122112211221122112211221122

main trench
#

@earnest phoenix define user as message.mentions.members.first() then do user.send(embed)

earnest phoenix
#

where put that?

main trench
#

Replace your original dm code with it

earnest phoenix
#

ok

tight bronze
#

Can I use SCSS for my long description?

main trench
#

I do believe so yes

tight bronze
#

Ah alright thanks

#

Doesn't work

gentle lynx
#

In discord.js if i listen to the guildMemberRemove i cant get the member's roles right?

lusty quest
#

if you have the gateway intend you get the entire member object

gentle lynx
#

Oh ok

obtuse jolt
#

how can I make my bot remove its own reactions and not need manage messages

lusty quest
drowsy epoch
main trench
#

Or you help and they tell you to read the docs since I didn't give the exact help it specified KEKW

drowsy epoch
#

lol

humble rock
#

Why my Command Handler doesn't load any command?

drowsy epoch
#

That server is weird, lots of karens

humble rock
humble rock
drowsy epoch
humble rock
drowsy epoch
#

and?

main trench
#

@humble rock its consol.log

humble rock
main trench
#

Could be how your command handler is in the actual command itself

drowsy epoch
humble rock
main trench
#

I'm not too experienced with loading commands since I don't need anything else logged in my consol

#

So probably can't help ya

humble rock
#

Someone else can help me?

robust blade
#

I need help

#

UnhandledPromiseRejectionWarning: Error: Error parsing info: Cookie header used in request, but unable to find YouTube identity token

#

I am making a music bot

#

and that error comes

drifting wedge
#

When I run a file with python3 it works, but when I use pm2 it doesn't

#

Python

#

Linux Ubuntu

#

It like gives an error

earnest phoenix
#

hi I'm doing the snipe command. how do i get all addFields.

#
snipes.unshift({
    silen: message.author,
    author_name: message.embeds[0].author.name,
    title: message.embeds[0].title,
    description: message.embeds[0].description,
    fields_name: message.embeds[0].fields[0].name,
    fields_value: message.embeds[0].fields[0].value,
    channel: message.channel.id
})
#

you might need to use a loop

#

how should I use a loop inside unshift

sudden geyser
#

Why not just have a key/value for all the fields as an array (fields: ...)

#

Then give it .fields (an array of objects)

earnest phoenix
#

@sudden geyser you are right.

pure lion
#

i have a .d.ts file but its not giving me extra intellisense in my node module

#

after compilation

misty sigil
#
 this.socket.send(JSON.stringify({
          op: 3,
          d: {
                    status: t,
            afk: false,
            idle: t == "idle" ? Date.now() : null,
            activities: this.activities ? this.activities : null,
          },
}));``` this looks right and t is "online" but discord closes the connection with code 4001
pure lion
#

could you link the opcode docs please

misty sigil
#

op 3 seems

pure lion
#

hmm

#

that's weird

misty sigil
#

all i can think of is invalid payload

pure lion
#

maybe log the stringified data

misty sigil
#

{"op":3,"d":{"status":"online","afk":false,"idle":null,"activities":null}}

#

this

pure lion
#

huh

#

i was expecting 3 to be a string because j s

median moss
#

I got noticed Discord is having kind of an API problem, and because of that problem ${client.users.cache.size} is not working. At my bot, it shows 1 user, and sometimes 3 users, but currently he is connected with more than 1000 users. But my friend's bot is normal, using the same code, same library (discord.js). Can you explain for me plis?

misty sigil
#

cache

pure lion
#

caca

median moss
#

wdum

summer torrent
#

did you enable GUILD_MEMBERS intent

median moss
misty sigil
#

nothing to do with api

median moss
#

kk

#

let me check guild_membes intent

#

@summer torrent sorry how do I enable GUILD_MEMBERS intent

summer torrent
#

check docs of library you use

#

also you have to enable that on Developer Portal.

median moss
#

kk

#

thx

summer torrent
#

if your bot is verified you have to contact with discord support

median moss
#

not yet

#

thx

pure lion
#

the first image is the compiled source files interfacing with a js file im writing

river tide
pure lion
#

you cant send to a string

summer torrent
#

welcomeChannelData is not a ChannelResolvable

#

get channel from channel collection and send

lusty quest
#

fetch the channel not get it

#

its possible that the channel is not cached

river tide
lusty quest
#

change line 5 to

#
  client.channels.fetch(welcomeChannelData)
umbral zealot
#

uhm channels aren't supposed to ever be uncached ๐Ÿ˜•

pure lion
#

discord.js light

#

:D

umbral zealot
#

Oh that thing. Nevermind, carry on.

lusty quest
#

there are cases where it can happen

pure lion
#

anyway can anyone help me

umbral zealot
#

const Discord = require("discord.js"); yay

pure lion
#

oops

#

i have eyes

#

๐Ÿ˜„

umbral zealot
#

I've literally never ever in my entire 5 years of using discord.js, ever seen a channel not be cached, if it existed.

river tide
lusty quest
#

channel created after the bot went online. then it should be only cached on a event iirc

#

yea your syntax is wrong.

#

you try to send a message to an id

umbral zealot
#

yeah I see the problem

#

welcomeChannelData isn't a channel.

#

it's... db data

#

it's not a discord.js object.

#

client.channels.cache.get(welcomeChannelData) doesn't... do anything.

#

you have to assign it to a variable

sick fable
#

Heyo! I coded a snipe command which takes out the last deleted message and when I type the command, it shows the last deleted message and when I try the same in the separate server where my bot is In. It shows the same message like I have two servers. The first server's message content is ok and it shows the same content in the second server. I want it to show the separate deleted messages of the separate servers.

lusty quest
#

well it searches for the channel in the cache. adding a few ns to the command runtime

sick fable
umbral zealot
#

but the value isn't being put in a variable

#

it's not being used

lusty quest
#

i know

umbral zealot
#

So it does nothing

lusty quest
#

but it still fires

#

and adds a few nano seconds to the commands runtime

umbral zealot
#

it doesn't magically change the value of welcomeChannelData, which is still just an ID and not an actual channel

river tide
#

how do I do that? haha I'm not that good at coding yet haha

umbral zealot
#

welcomeChannelData being an ID like "272764566411149314", he's essentially doing "272764566411149314".send("blah") which of course doesn't work because String.prototype.send() is not a function

#

If y'all don't know how to set a variable maybe you need to refresh yourself on the basics of javascript, eh?

pure lion
lusty quest
#

there is more wired stuff. you make a if check if welcomeChannel exist. and in the Else you make again a if welcomeChannel

umbral zealot
lusty quest
#

the first part will only fire tho @river tide

#

or it just returns

misty sigil
#
{"op":3,"d":{"status":"online","afk":false,"since":null,"activities":null}}
``` does this look, valid?
#

as in sending a presence update event to the gateway?

pure lion
#

yeah that really looks fine

#

like

misty sigil
#

i've had so many people say that

#

but it just

pure lion
#

wtf discord

misty sigil
#

won't work

#

im fairly sure it closes the socket

#

but without actually closing the socket

pure lion
#

there's a socket.on close

#

it will emit

#

no matter what

misty sigil
#

i know, the event isn't emitting

pure lion
#

does the process exit?

misty sigil
#

no

#

it still heartbeats

umbral zealot
# sick fable Heyo! I coded a snipe command which takes out the last deleted message and when ...

I don't program python, but I can tell you your issue is about scopes. You're defining a variable outside your message_delete event and it's being modified within it - it has no way of knowing what server you're in. You'll have to change that to be a structure (a dict? object? whatever it is you folks use in python for key/value pairs) so that you're setting a message per server ID and not just one single normal variable.

pure lion
misty sigil
#

why doesn't it get messages any more then

pure lion
#

lemme check the message handler

#

maybe you could handle the 4001

misty sigil
#

that disconnects you tho

misty sigil
#

it closes the socket

#

you can't just swallow it

umbral zealot
#

Sigh. I mean, I did say exactly what I meant.

#

what part of that answer didn't you get?

pure lion
#

matt just reconnect

opal plank
#

isnt it a tuple?

#

im not very familiar with python structures either

misty sigil
#

ok so

#

i do reconnect as dice suggested

#

but when i log back in i'm seeing a 1005 code

slender thistle
#

PYTHON

earnest phoenix
#

Hi

slender thistle
sick fable
#

@slender thistle Can you please send a short code on how to do it? ๐Ÿฅบ

slender thistle
#

The idea is literally there

#
bot.x = {}

on_message_delete:
    bot.x[message guild id] = message content
sick fable
#

Aah

#

I'll do it now

pure lion
#

@misty sigil where is tim

misty sigil
#

there

pure lion
#

matt

#

i want you to think about this

misty sigil
#

yes.

pure lion
#

ok ping tim time

misty sigil
#

no

pure lion
#

whY NoOooOt

misty sigil
#

k fine do it

pure lion
earnest phoenix
#

@pure lion You making a discord API wrapper?

pure lion
#

@earnest phoenix why yes

#

with matt

#

and misly

earnest phoenix
#

Imagine not inviting me to it

#

Smh

#

My

#

Head

pure lion
#

do you want to test it

#

also feel free to make a pull request uwu

earnest phoenix
#

What's the repo

pure lion
earnest phoenix
#

Cursed description moment

#

yikes

pure lion
#

y๐Ÿ…ฑ๏ธkes

earnest phoenix
pure lion
#

i should probably fix that

pure lion
#

i have typings

#

as you can see in the src

#

but the .d.ts doesn't want to do its thing

earnest phoenix
#

what file

#

oh found it

pure lion
#

yeah websocket.ts and websocket.d.ts have the typedefs and interfaces

#

also how can i make the listeners and their args have the intellisense

earnest phoenix
#

Oi krista, should i make many pull requests

#

Improving files and examples

pure lion
#

uhh

#

maybe later

#

we're all tired

quartz kindle
#

you uploaded it a few hours ago and already put it in npm? lmao

pure lion
#

yeah

#

i mean it works

#

:D

earnest phoenix
#

Speedrunโ„ข๏ธ

pure lion
#

:D

#

it works enough to matter

quartz kindle
#

i only put my stuff on npm when its already like v2 or v3 lmao

pure lion
#

developemnt!

earnest phoenix
#

imma fork

#

and see the typings

pure lion
#

ok that's fine

#

or you could just install it

earnest phoenix
#

might pr

quartz kindle
#

why pako lmao

#

pako is slow

pure lion
#

zlib-sync was being stinky af

#

anyway it works fine x)

quartz kindle
#

why is package.json a dependency

#

lmao

pure lion
#

ask matt

earnest phoenix
#

Lmao what

quartz kindle
pure lion
#

oooo

#

ok

#

@misty sigil oi you

misty sigil
#

aye

#

aye

#

fit like

earnest phoenix
#

Wait a minute

#

Promise<JSON>

quiet topaz
misty sigil
#

npm i ffmpeg-static

#

iirc

quartz kindle
#

you dont need to require ffmpeg in your code, you just need to have the binaries installed

quiet topaz
#

ok

earnest phoenix
#

@pure lion intellisense works fine

#

for client options

#

only one i tested

pure lion
#

@earnest phoenix show

stable eagle
#

my bot's command stops constantly when a new document is created and its being used later, is there a way to not make it not stop and rather continue?

#

mongodb

pure lion
#

did you do new Client("token", {/* sense here */})

earnest phoenix
#

yes

pure lion
#

show me a screenshot

earnest phoenix
#

Kristaaaaa

pure lion
#

voooltrexxxxxxxxxx

earnest phoenix
#

Time for PRs

pure lion
#

nOOOo

#

im too tiredddddddd

#

apikdnjghjnpiadphn

earnest phoenix
#

K, imma open them later

pure lion
#

yay

earnest phoenix
#

Also a lot of properties in the user class is nullable

#

Be sure to property? the nullable ones

woven sundial
#

Hi, does anyone know if I can fetch a user's linked account as facebook, github, ... With discord.js

sinful belfry
#

only using oauth i'm pretty sure

woven sundial
#

Yea that's what I was seeing in a 2018 api topic :/

opal plank
solemn latch
#

Oauth requires a domain too right? For the referer stuff

opal plank
#

not really, no

#

check discord for example

#

you could foward back to your ip if you fancy it

#

or your host/vps

#

express does the job fine

misty sigil
#

i wouldn't recommend redirecting to ip

#

ngl

earnest phoenix
# pure lion show me a screenshot

weird only works in the ourcord project but when i install the npm package to use it in a new project, the intellisense didn't work

pure lion
earnest phoenix
#

In JSDoc

pure lion
#

yeah exactly

#

it doesnt show as clientoptions though

#

which is really weird

#

oh shit i thought i updated that

earnest phoenix
pure lion
#

someone overwrote my thingy

earnest phoenix
#

It's the websocket.d.ts file btw

pure lion
#

ohhh

crimson vapor
#

How should I go about purging a map of data that has a property greater than another value?

terse berry
#

Hi, I have a dm command where the bot will send dm to the mentioned person or with someone's ID. Currently I have this

        message.mentions.members.first() ||
        message.guild.members.cache.get(args[0]);```
But the bot cannot dm people that are not in the server where the command was run, the bot is in a mutual server as the mentioned user though.
Any way I can make it dm someone who is not in the server where the command was run?
pure lion
#

that makes sense

crimson vapor
quartz kindle
#

@opal plank yo you're a ts lover right?

crimson vapor
#

he is indeed

terse berry
quartz kindle
#

idk if thats the right way to do callbacks and iterators

pure lion
#

@earnest phoenix

terse berry
#

does someone know how to fetch a particular user from all the servers that the bot is in?

pure lion
#

at cache just filter the servers by the user ID

terse berry
#

ummm

quartz kindle
#

you want the member object from all guilds?

terse berry
#

yes

quartz kindle
#

like member for user A in guild A, member for user A in guild B, etc

terse berry
#

a particular user

crimson vapor
#

member?

earnest phoenix
#

@pure lion Uhh

crimson vapor
#

why not use user?

quartz kindle
#

you need to fetch the user separately for each guild

earnest phoenix
#

Why is there login and connect methods

pure lion
#

wait what