#development

1 messages ยท Page 1462 of 1

molten yarrow
#
message.guild.roles.cache.find("name", "Verified")

you should change it aswell

sterile lantern
#

Unhandled rejection TypeError: fn.bind is not a function

#

change what

#

is thatnot v12

#

message.guild.roles.cache.find

crimson vapor
#

I started using series in math and im so confused, they start at 1 not 0

mellow kelp
#

it might be because of the find function

#

it doesn't take variables themselves

#

you pass a predicate function

sterile lantern
#

message.guild.roles.cache.find("name", "Verified")

#

what should i change this to

molten yarrow
#
<guild>.roles.cache.find(role => role.name === '<role name>')
mellow kelp
#

.find(role => role.name === 'Verified')

tribal turtle
#

Random question, if I want to count the total messages send, what is the best way to keep track of that?

#

Just an int in a database, adding 1 when a message is recieved

mellow kelp
#

yea what you just said might be a solution

tribal turtle
#

Oh wait, maybe have a local variable, and once a minute push that to the DB

#

Less load for the DB

sterile lantern
#

how would i change this to v12

#
message.guild.roles.cache.find("name",data);```
earnest phoenix
#

hi

sterile lantern
#

message.guild.roles.cache.find(role => role.name === "name",data);

mellow kelp
#

no

#

you want to check for some condition

earnest phoenix
#

That's already v12

mellow kelp
#

what do you want to do?

sterile lantern
#
    rbx.getRankInGroup(groupid,body.robloxId).then(data => {
                            let RankForGroup = message.guild.roles.cache.find("name",data);
                            message.member.roles.add(RankForGroup).catch(function(err){ 
                message.channel.send(`Error: I was not able to update your discord role.`)
            });```
#

i get fn.bind is not a function from here

mellow kelp
#

yeah

#

because the find function is not valid

sterile lantern
#

yea

mellow kelp
#

you should check array higher order functions

#

there are some tutorials on yt

sterile lantern
#

wdym

#

i just want to add

#

the role

mellow kelp
#

yeah

sterile lantern
#

well actually

#

find the role

mellow kelp
#

but to understand that

sterile lantern
#

accoridng to the rank name

#

according*

mellow kelp
#

you have to know higher order functions

old cliff
#

Hi where can I find great canvas tutorials ?

molten yarrow
mellow kelp
#

i think the intellisense tells most of it

#

but yeah theres that guide

old cliff
#

oof it has very less stuff

#

html one would also work

mellow kelp
#

yeah

#

node canvas is just a recreation of the html canvas but for node

earnest phoenix
#

l

#

o

#

l

knotty obsidian
#

why this throw null pointer

.setImage(event.getChannel().getHistory().getMessageById(event.getMessageId()).getEmbeds().get(0).getImage().getUrl())

(yes, the embed im getting 100% has a image)

#

also idk how to use a debuger

#

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

umbral zealot
#

"throws a null pointer"? What eaxctly is the error?

earnest phoenix
#

find out what's null then

#

learn how to use a debugger lol

crimson vapor
#

is this java?

knotty obsidian
#
[JDA MainWS-ReadThread] ERROR JDA - One of the EventListeners had an uncaught exception
java.lang.NullPointerException
#

yep its java

crimson vapor
#

yep

earnest phoenix
#

from the ugly api yes

crimson vapor
#

why so many functions lmfao

umbral zealot
#

conditional chaining in java #when

earnest phoenix
#

java having proper getters when

#

oh yeah, that's called c# mmLol

umbral zealot
#

I would presume that one of those things doesn't exist. Either the message ID no longer exists, or there's no embed on that message, or no image.

crimson vapor
#

c# more like microsoft java

earnest phoenix
#

you're not wrong there

crimson vapor
#

never even seen c# code tbh

knotty obsidian
earnest phoenix
#

original intention was to create "the better java"

#

which they did

crimson vapor
#

can it run on linux?

umbral zealot
earnest phoenix
#

yes

#

c# can run on any platform

crimson vapor
#

o

#

fancy

#

I should learn c#

#

I have 2 weeks off of school pog

umbral zealot
#

Trying to help someone while there's completely irrelevant discussions going on ๐Ÿ˜›

mellow kelp
#

lmao

earnest phoenix
#

replies exist just for that reason

earnest phoenix
crimson vapor
#

LOL

earnest phoenix
#

no lol

crimson vapor
#

dont start a war pls

mellow kelp
knotty obsidian
crimson vapor
#

anyway might take a look a the c# hello world now

earnest phoenix
#

node is super good for creating applets that just need to be there and do something

if you want performance say bye to node

umbral zealot
earnest phoenix
#

everything is fair in love and war

mellow kelp
#

love is war

crimson vapor
#

java is like javascript except its all oop and semicolons are required

#

and faster

mellow kelp
#

not exactly

#

basically

#

java

earnest phoenix
#

they're nothing alike

mellow kelp
#

is completely different from javascript

knotty obsidian
mellow kelp
#

they just named it javascript because java was popular at the time lmao

umbral zealot
#

"I don't know Java" was meant as "I don't write it" not that I don't know how it differs from javascript.

mellow kelp
#

and wanted to get on the train

earnest phoenix
#

why do people care about super precise performance for super smol apps

#

the relation between java and javascript is equivalent to that of a car and a carpet

crimson vapor
#

o

mellow kelp
#

yea

umbral zealot
#

And clearly javascript and java are very similar, since that code looks 100% like javascript ๐Ÿ˜›

mellow kelp
#

bruh what?

earnest phoenix
#

sarcasm

mellow kelp
#

oh lmao

earnest phoenix
#

javascript more like salted ecmascript more like better java more like basically C

umbral zealot
#
embed.setImage(event.getChannel().getHistory().getMessageById(event.getMessageId()).getEmbeds().get(0).getImage().getUrl())

looks like JS to me ๐Ÿ˜›

mellow kelp
earnest phoenix
#

java is notorious for having utterly disgusting getters and setters

knotty obsidian
#

so any help? .-.

mellow kelp
#

I remember when used to tell my friend that java was always better than js

#

now i just use them for different stuff

earnest phoenix
#

meh, to me java is obsolete

umbral zealot
#

Trying to do everything in a single line can be very bad in cases like these.

mellow kelp
earnest phoenix
#

java == bad //true
javascript == bad //true
ecmascript == bad //true
python == bad //true

literally any esoteric language == bad //false

crimson vapor
#

can you use vsc for c#?

#

or are you supposed to have a real ide?

knotty obsidian
earnest phoenix
#

Yes you can

mellow kelp
umbral zealot
crimson vapor
#

ok

mellow kelp
#

but you gotta install some stuff

earnest phoenix
#

I see brackeys use c# in visual studio for his unity tutorials

knotty obsidian
mellow kelp
#

oh no visual studio

knotty obsidian
#

the embed has a image as shown in the screenie

umbral zealot
mellow kelp
umbral zealot
#

this is called "debugging" when you don't know how to use an actual debugger

earnest phoenix
umbral zealot
#

log everything

earnest phoenix
# mellow kelp y

the reason people used java back in the day is because it was one of a few that was cross platform
nowadays that's not true anymore, .net ate java up for breakfast

.net5 is more performant than java ever will be, you get crossplat support without having to install a runtime, or anything for that matter

crimson vapor
#

visual studio takes like 30 seconds to open on my 2700x so im good

mellow kelp
#

cool then

sudden geyser
earnest phoenix
mellow kelp
#

when i open visual studio my pc just

#

die

delicate shore
#

I get good performance

#

From node

earnest phoenix
#

yeah i don't trust you

delicate shore
#

Ok :(

sudden geyser
crimson vapor
#

how do you run c#?

#

just asking

#

for a friend

mellow kelp
#

hmm

sudden geyser
#

In other languages you may get x10 or x100 the performance than you do with JS

earnest phoenix
#

Anything that uses chromium is bound to squeeze the juice out of my computer

delicate shore
mellow kelp
#

i only used c# for unity so idk

sudden geyser
#

and that's on normal conditions

delicate shore
#

Only JavaScript

earnest phoenix
delicate shore
#

.net difficult

earnest phoenix
#

what

#

no

#

you use the official sdk lol

hasty mulch
#

Hey, anyone know of a weather API that displays snowfall totals on the ground?

earnest phoenix
#

create a c# project and dotnet run it to debug it

outer perch
earnest phoenix
#

dotnet publish to publish it

#

idk dootnoot so idk seasharp

knotty obsidian
#

This threw a null pointer too...

System.out.println(event.getChannel().getHistory().getMessageById(event.getMessageId()).getEmbeds().isEmpty());
mellow kelp
#

well because something there is null

sudden geyser
#

Scorpion like I told you

earnest phoenix
#

microsoft has a good intro if you want to check it out

mellow kelp
#

you have to check for variables that might be null

sudden geyser
#

You need to debug and see which method is returning null

umbral zealot
#

so print the getMessageId, then print event.getChannel().getHistory().getMessageById(event.getMessageId()), etc etc etc

earnest phoenix
#

@earnest phoenix no

delicate shore
#

Me cry

sudden geyser
#

or split each method call on a separate line so the stacktrace says which line it came from

amber sedge
#

how to use colors in long desc

#

just curious

umbral zealot
amber sedge
#

. _.

earnest phoenix
amber sedge
#

k thanks

mellow kelp
#

wait yes

sudden geyser
#

yes you should

mellow kelp
#

that makes total sense

#

i should do that too

umbral zealot
#

If you don't know how to use html and css, it's time to learn ๐Ÿ˜„

earnest phoenix
#

I POGEYRAM IN HTML

sudden geyser
#

the day html and css ceases to exist will be my peak

earnest phoenix
#

so never

crimson vapor
sudden geyser
#

please

mellow kelp
#

css gives me mental breakdowns

earnest phoenix
#

:(

earnest phoenix
#

says loggers
sends a pogey

mellow kelp
#

yes

knotty obsidian
#

this threw a nullpointer first

System.out.println(event.getChannel().getHistory().getMessageById(event.getMessageId()).getContentRaw())
#

getting the message by id

#

hm

mellow kelp
#

wait

knotty obsidian
#

how do i even get the message by reaction event?

mellow kelp
#

why are you getting the message again?

knotty obsidian
#

so i could get the image in the embed

mellow kelp
#

like doesnt the event give you the message

knotty obsidian
#

nope

#

only the messageid

mellow kelp
#

oh dang

#

hmm

delicate shore
#

why.do.I.exist()
myself.kill()

mellow kelp
#

destroy(this.gameObject)

#

process.exit(-1)

knotty obsidian
#
commit Kill = event.getJDA().getSelfUser();
mellow kelp
#

System.exit(-1)

delicate shore
#

die()

mellow kelp
#

SHINEEEE()

knotty obsidian
#

anyways

#

how get message from reaction

#

why it only give the stupid id

#

dumb

mellow kelp
#

some guys on the street are playing christmas music

#

help

sudden geyser
#

I DON'T WANT A LOT FOR CHRISTMAS

mellow kelp
#

AAAA

knotty obsidian
#

i want .getMessage() added to a reaction event for christmas

crimson vapor
#

isn't there a java equivalent of fetch?

knotty obsidian
#

hm?

mellow kelp
#

hmm

crimson vapor
#

can you get the message ID of the reaction event?

#

or not even that

knotty obsidian
#

i can

#

but i dont think thats the problem

#

i did java event.getChannel().getHistory().getMessageById(event.getMessageId);

earnest phoenix
#

might try asking in jda's support server since most of us here are discord.js peeps

discord.gg/jda

knotty obsidian
#

i think that gets it

earnest phoenix
#

Hey, where can i see the dc.js html text codes? or idk xd
Like: res.write('')

#

they don't have a support server?

mellow kelp
#

wdym text codes?

knotty obsidian
#

whatever, ill ask the question and stack overflow and wait for an answer..

earnest phoenix
mellow kelp
#

make sure it doesnt get marked as duplicate

woven quest
#

im tryin to execute a func when user has voted on topgg

#

can someone help me with this

outer perch
#

SO best friend

earnest phoenix
mellow kelp
woven quest
#

oh and im using the python api

earnest phoenix
#

no one:
dis human: lol idfk what this is but i want halp

mellow kelp
earnest phoenix
#

node.js

woven quest
mellow kelp
#

yeah

#

you have to set up a server to receive the post request

earnest phoenix
#

:/

woven quest
#

ye i have the link

mellow kelp
#

poggers

woven quest
#

but what port shud i give?

mellow kelp
#

then you're probably set

#

um

#

just the endpoint

#

if it works, it works

earnest phoenix
#

is that express

mellow kelp
#

maybe

woven quest
mellow kelp
#

like

#

is your url an ip address?

#

or is it a domain

woven quest
#

one sec

mellow kelp
#

k

woven quest
#

@mellow kelp ye so its a domain

mellow kelp
#

oh cool

#

then ig you can just put the domain itself

#

with the path to the endpoint yk

woven quest
#

alr so i dont need to provide port ryt

#
from discord.ext import commands
import dbl

class TopGG(commands.Cog):
    """
    This example uses dblpy's autopost feature to post guild count to top.gg every 30 minutes.
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'eE'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_path = "http://..../dbl",wehook_auth = "")  # Autopost will post your guild count every 30 minutes

    @commands.Cog.listener()
    async def on_guild_post(self):
        print("Server count posted successfully to topgg")
        

    @commands.Cog.listener()
    async def on_dbl_test(self,data):
        print(data)

def setup(bot):
    bot.add_cog(TopGG(bot))```
#

alr so this is the code and its not printin anythin in console when i clck on the test button

pale vessel
#

http:///?

earnest phoenix
#

NEW PROTOCOL

BOTTOM TEXT

woven quest
#

ye i removed the credentials

mellow kelp
#

yea boii

slender thistle
#

AAAAAAAAAAAAAAAAAAAAAAAAAAAAA nekoangry

BOTTOM TEXT

#

webhook_path is a route you will use, not a URL

earnest phoenix
#

HTTP:///

HOW

BOTTOM UNDER THE BOTTOM TEXT

slender thistle
#

To be specific, out of http://someip:someport/dblwebhook specified webhook path as /dblwebhook

woven quest
#

oh ok

#

and anythin else that i shud change?

earnest phoenix
#

When you host stuff on repl, the subdomain <repl name>.<user name>.repl.co is registered on the repl IP right

#

So my repl IP is visible for repl hosting right?

woven quest
#

its still not printing anythin

pale vessel
#

Did you connect it to your printer?

mellow kelp
#

e p i c j o k e

hollow sedge
earnest phoenix
woven quest
#
from discord.ext import commands
import dbl

class TopGG(commands.Cog):
    """
    This example uses dblpy's autopost feature to post guild count to top.gg every 30 minutes.
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'ey'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True,webhook_port=34473,webhook_path = "/dbl",wehook_auth = "")  # Autopost will post your guild count every 30 minutes

    @commands.Cog.listener()
    async def on_guild_post(self):
        print("Server count posted successfully to topgg")
        

    @commands.Cog.listener()
    async def on_dbl_test(self,data):
        print(data)

def setup(bot):
    bot.add_cog(TopGG(bot))```
#

whats wrong here

crimson vapor
#

someone needs to make a speedrun for opening visual studio

mellow kelp
#

lmao yes

#

any%

sudden geyser
crimson vapor
#

idk

pure lion
#

@crimson vapor code .

#

Feel the sped

mellow kelp
#

talking about visual studio tho

#

vscode is

#

i am speed

crimson vapor
#

I default my vsc terminal to wsl so when I type code . it opens in wsl mode

inner stump
#

hi

crimson vapor
#

anyone here know ts?

mellow kelp
#

hey

crimson vapor
#

hi

#

ok

#

so

mellow kelp
#

um

#

whats a node

crimson vapor
#
type node = {
  name: string,
  id: string,
  url: string,
  token: string
}```
mellow kelp
#

oh k

#

yeah thats right

#

it should be an interface tho

#

with uppercase

crimson vapor
#

what is the difference?

mellow kelp
#
interface Node {
  name: string;
  id: string;
  url: string;
  token: string;
}
#

I don't remember exactly

#

But i think it was something about errors

crimson vapor
#

wait

pure lion
#

If I'm writing for options do I use a type or an interface @mellow kelp

mellow kelp
#

interface

crimson vapor
#
Array<Node>
or
Node[]```?
mellow kelp
#

Hmm

#

Both work

#

I prefer Node[]

crimson vapor
#

ok ima do that

mellow kelp
#

k

pure lion
#

TS is fun

crimson vapor
#

im working on a wrapper for something I made

mellow kelp
#

poggers

mellow kelp
pure lion
#

Wanna make a pull request

mellow kelp
#

cant wait for deno to be actually useful

#

wut

pure lion
#

You know what

pale vessel
#

mycord

crimson vapor
#

pr on what repo?

pure lion
#

ourcord

crimson vapor
#

ok

pure lion
#

Sillype

crimson vapor
#

was my pr merged?

pure lion
#

I think so

pale vessel
#

Omg I made a PR!!!!!! I'm a contributor now!!!!!!!!!!!!

#

!!!!!!!!!

crimson vapor
#

nah not yet

pale vessel
#

million

#

use darkreader/gh dark

crimson vapor
#

not a fan of darkreader and gh dark is too blue

#

I wish they would just use amoled

#

@mellow kelp if im returning an object with properties from a function, should I use a type or an interface?

mellow kelp
#

interface

#

i just use types for stuff like

#
type Category = 'fun' | 'info' | 'images' | 'currency';
crimson vapor
#

oh

#

I see

sudden geyser
#

Does TypeScript not have enums?

crimson vapor
#

I thought it did

#

yoo

#

I commented my code pog

#

no need to reread this code to understand it

sudden geyser
#

omg same except yesterday

#

my code used to be 90 lines

#

now it's 184

crimson vapor
#

hmmm

gilded olive
#

Doc string generators peepoSnow

cinder patio
#

deno? I don't know her

mellow kelp
#

lmao

crimson vapor
#

20 minutes before class and im barely done with 2 functions

mellow kelp
#

is deno actually useful?

#

like at least how it's right now

cinder patio
#

It's node.js, but it has permissions, and require is completely replaced with import/export

mellow kelp
#

yeah

#

but i don't really like the fact that it isn't compatible with stuff like express

cinder patio
#

and it has ts by default

mellow kelp
#

and we gotta use urls for everything

#

but yeah its cool that you can run ts and its secure

#

'node'.split('').sort().join('')

#

'deno'

pure lion
#

TS does have enums

#

So like

#

Pog

mellow kelp
#

oh yeah enums

#

i don't use them that much but they're cool

earnest phoenix
#

how can i make my bot

#

log something

#

in a db

#

or json file

#

?

#

what's the function

mellow kelp
#

wdym

#

save stuff?

earnest phoenix
#

ya

sudden geyser
# pure lion TS does have enums

are they like rust enums where each variant can hold different parameters or Java enums where they all hold the same number of parameters with the same value types

mellow kelp
earnest phoenix
#

ik

#

but

#

how can i make the bot log something

#

in a db

#

or json file

mellow kelp
#

wdym log?

earnest phoenix
#

what's wdym?

#

lmao

mellow kelp
#

what do u mean KEKW

earnest phoenix
#

xd

#

just save

#

something

mellow kelp
#

yeah well

#

which database do you wanna use

earnest phoenix
#

megadb

crimson vapor
#

what is megadb

mellow kelp
#

use jason.db

crimson vapor
#

don't suggest that to beginners

earnest phoenix
mellow kelp
#

well it must have some docs

#

this is the only npm package i've ever seen in spanish KEKW

earnest phoenix
hoary junco
#

anyone know how to make a ping command in cogs in python

#
import discord
from discord.ext import commands



class Ping(commands.Cog):

    def __init__(self, client):
        self.client = client

    @commands.Cog.listener()
    async def on_ready(self):
        print("This cog is online (Ping)")

    @commands.command()
    async def ping(self, ctx):
        await ctx.send(f'Pong! {round(client.latency * 1000)}ms ๐Ÿ“')


def setup(client):
    client.add_cog(Ping(client))
#

i did that code

#

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'client' is not defined

#

^ said that

crimson vapor
#

@mellow kelp I need help with ts

#

im using node-fetch

#

and I told the function I was going to return FileResponse

#

but I actually returned response.json()

#

what do I do

mellow kelp
#

wat

sudden geyser
hoary junco
#

ohhh ok

mellow kelp
#

wdym "you told the function" freerealestate?

earnest phoenix
#

How can I know which shard the server is in? (discord.js)

crimson vapor
#

the

#

fuckin

#

): Promise<FileResponse> {

mellow kelp
#

oh um

#

what's a file response lmao?

#

does it come with node-fetch

crimson vapor
#
interface FileResponse {
  success: boolean,
  message?: string,
  fix?: string,
  id?: number;
}```
#

no

mellow kelp
#

oh k

#

so

#

what do you want to do exactly?

#

like, parse the json and just return it?

earnest phoenix
#

hi?

crimson vapor
#
      let node: Node = this.getNode(nodeID)
      if(!node) throw TypeError('Expected "Node" got "undefined"')
      let formData = new FormData()
      formData.append('file', data)
      let response = await fetch(node.url + 'save', {
        method: 'post',
        headers: {
          token: node.token,
        },
        body: formData,
      });
      let jsonResponse: FileResponse = await response.json()
      if(callback) return callback(null, jsonResponse);
      return jsonResponse;``` ill just paste code tbh
mellow kelp
#

at least if the response returns what you have in the interface, yes

crimson vapor
#

it doesn't sadly

mellow kelp
#

hmm

#

hmm

pure lion
#

It returns an empty object

mellow kelp
#

whats the type of the callback?

pure lion
#

Make an interface or class for it to return

crimson vapor
#

Erwin is here to yell at me and help?

opal plank
#

@pure lion did voltrex give you the feedback i sent?

pure lion
#

Err is probably a string btw

#

@opal plank which

opal plank
mellow kelp
#

you probably can just do const jsonResponse = await response.json()

#

That gives it an any type

#

and you can call the callback with that

crimson vapor
#

so I should return any?

mellow kelp
#

well you could do some basic type-checking

opal plank
#

any

mellow kelp
#

just to be sure it works

opal plank
pure lion
#

Read and noted

crimson vapor
#

lmao Erwin I really don't know what to do

opal plank
#

send that to the other contributors too

pure lion
#

Ok hold on

opal plank
#

make an interface for the response?

mellow kelp
#

i mean, you should use any if you're REALLY sure the response will always work

opal plank
#

you SHOULDNT use any AT ALL

mellow kelp
#

y

opal plank
#

any is saying fuck typescript

#

the whole point is types

mellow kelp
#

well yea

opal plank
#

any is saying: fuck this, just run this shit like js

crimson vapor
#

hmm

opal plank
#

whats the point of Ts without types?

mellow kelp
#

bruh thats only if you use it like

crimson vapor
#

im confused on what im supposed to do

mellow kelp
#

80% of the code

opal plank
#

not even, make an interface

mellow kelp
#

you can make a type guard

opal plank
#

unless you dealing with a shit API, you dont have a need for any

mellow kelp
#

how did those work again?

opal plank
#

theres are very rare use cases for any in your code

mellow kelp
#

(type guards)

opal plank
#

imagine the following

glacial lance
#

How can I prevent my bot from posting a file when an embed is edited?
Code I use to embed it from URL

req = requests.get("image_url_here")
embed = discord.Embed()
bio = BytesIO(req)
bio.seek(0)
embed.set_image(url=f"attachment://memes.gif")
send_file = discord.File(bio, filename="memes.gif")
await msg.send(embed=embed, file=send_file)
# Then later edit it to change something like embed colour
await msg.edit(embed=embed)

I'm guessing it might be the file kwargs but no clue how to send a file to image otherwise.
End results: https://i.alexflipnote.dev/35efjqi.png

Library: discord.py

crimson vapor
#

Erwin im a bit confused on how I can return a node-fetch response as any other type other than any

opal plank
#

an API that returns current stats for every country on the world, with a key and the keys inside are states

{
brazil: {all cities here},
germany: {all cities here},
US: {all cities here}
}

If its something insane like that with a response that might come with 200+ different keys that are optional each, sure, might as well use any

#

otherwise? dont

#

any can be used in VERY special places

#

dont use laziness as an excuse to use ANY in your code

mellow kelp
#

bonk

crimson vapor
#

I would rather send FileResponse because its easier to work with typings

mellow kelp
#

yeah

crimson vapor
#

but im really confused

mellow kelp
#

idk why the callback doesn't work tho

crimson vapor
#

ill just remove it later

mellow kelp
#

it's supposed to be FileResponse

#

well k

crimson vapor
#

or I mean add it

opal plank
#

//@ts-ignore
above the line
console.log() the response (as a string, before you parse)
check the shape, make interface

How hard is that?

crimson vapor
#

I know the api response

#

it will always respond like this

opal plank
#

then whats the issue?

mellow kelp
#

for some reason

crimson vapor
#

but how do I tell ts that the response is actually a FileResponse and not just a {}

mellow kelp
#

FileResponse isn't compatible with a parameter of type FileResponse

opal plank
#

wdym how you tell the response

mellow kelp
opal plank
#

() : Promise<returnedType(string)>

mellow kelp
#

but apart from that ts doesn't have ways of validating whole interfaces

opal plank
#

before you parse it, its a string you donkus

#

you do parse() to turn the string into an object

#

THEN that object is type of FileResponse

#

but first its a normal Promise<FetchResponse>

crimson vapor
#

ok

mellow kelp
#

yeah

#

but theres an await and everything

opal plank
#

iirc fetch is really shit for await/async

mellow kelp
#

yea

opal plank
#

i'd recommend using a better http lib

mellow kelp
#

i prefer axios

opal plank
#

axios*

#

axios is what i use too

mellow kelp
#

axios gang

opal plank
#

much more reliable

#

speaking of which, i need to upgrade the lib

mellow kelp
#

o

opal plank
#

got some shit with axios i gotta check

#

hmmmm

#

lib or bot?

crimson vapor
#

wdym

opal plank
#

i got 2 things to fuck with, dunno which i should do now

crimson vapor
#

lib

mellow kelp
#

hmm

#

bot

opal plank
#

i got the bot to add some cool shit, and the lib to put some upgrades

#

1 bot, 1 lib

mellow kelp
#

mental breakdown

crimson vapor
#

I would do the lib

opal plank
#

cool, back at the start

mellow kelp
#

ANGERY

opal plank
#

well the command is using the lib anyway

#

hmmm

cinder patio
#

axios? bruh

opal plank
#

and the upgrades on the lib will do absolutely nothing other than improve error logging to the end-user

#

which arent even coming through

#

cuz good lib

#

hmmmmmmmmm

mellow kelp
opal plank
#

fuck it, i'll work on the bot

crimson vapor
#

ok

pure lion
#

Libe!

opal plank
#

@pure lion go check it, mgiht give you inspiration

#

shameless ads

crimson vapor
#

check what?

#

oh

#

the lib so they can make a good one

#

I see

opal plank
#

krista is working on ourcord

#

so i thought i'd let em have a look at mine for some examples

crimson vapor
#

wait do you have your own custom discord lib?

opal plank
#

not discord, no

crimson vapor
#

ok

opal plank
#

but just overall

crimson vapor
#

I accidentally forked that repo im pretty sure

mellow kelp
#

yea i think so

opal plank
#

i dont plan on making a lib on discord which breaks month with break changing updates

crimson vapor
#

lol

mellow kelp
cinder patio
#

m...

#

you should only push typescript files to github

opal plank
#

well yeah, i gotta add support for js

#

its transpiled

cinder patio
#

not compiled js files

crimson vapor
#

I thought js could import from ts

cinder patio
#

ts files go to github, javascript files go to npm

opal plank
#

im currently refactoring it

#

the issue is some people might wanna pull from the github repo for dev updates

crimson vapor
#

o

cinder patio
#

They will transpile it themselves

mellow kelp
#

o

opal plank
#

since i wont be publishing all into the npm until its stabilized

#

wait really?

cinder patio
#

they can just install typescript and run tsc themselves

#

but you have to include tsconfig.json in the github

mellow kelp
#

yea

opal plank
#

too much work, specially knowing not even half of those users will be using typescript

mellow kelp
#

i think @types go in devDependencies too

opal plank
#

its a js/ts lib, not only ts

mellow kelp
#

@types are for developing with typescript

cinder patio
#

yea

earnest phoenix
#

what does adding a @ to the name of an npm package do

opal plank
#

users will be forced to use ts to transpile, makes no sense to force ts onto js users

mellow kelp
#

scoping

mellow kelp
cinder patio
#

but the js is barely readable, and the point of github repos is to share readable code

opal plank
#

but they wont need to read the js code, juts use it

cinder patio
#

do c++ libraries put the compiled code in there? No they put it in releases!

crimson vapor
#

let Erwin be lmfao

#

he did nothing wrong

mellow kelp
#

well i kinda agree on that one

opal plank
#

just sending the ts is stupid imo. Why do you force the js user to install ts, learn tsc, and do a bunch of stuff just so they can have a dev update?

mellow kelp
#

but dont be too harsh lmfao

pure lion
#

@opal plank Don't need inspiration, we have a totally completed project manager

opal plank
earnest phoenix
#

@mellow kelp wdym

mellow kelp
#

oh yea

#

that

earnest phoenix
#

scopes owo what's that

mellow kelp
#

scoping is used to "group" packages for example

#

like

#

@babel/core, @babel/cli, @babel/preset-env, etc

pure lion
#

Where's misly I need to shout at them

#

Oh well

mellow kelp
#

or @angular/core and other @angular packages

#

you can also scope it to your username if there's another package with the same name as yours

honest perch
#

Erwin its honestly funny how you're still going on about it

opal plank
#

wdym im still going on about it?

earnest phoenix
#

understood almost nothing but ok

mellow kelp
#

dang

#

hmm

opal plank
#

if you dont like my feedback, tell me to fuckoff and i'll gladly will rather than spending time trying to give you guys a hand @honest perch

mellow kelp
#

its like putting a package in a "folder"

heavy anchor
crimson vapor
#

yes sir

earnest phoenix
#

ok

mellow kelp
#

for example i made a wrapper for the reddit api and someone had already taken the name

#

so i published it as @mellow kelp/reddit-api

lost isle
#

hi, i need help im working on a discord porject and i was wondering, how do i dm the member who did the command (but an embed)

#

i mean the bot

honest perch
cinder patio
#

Erwin, do you eslint the javascript files that get generated by typescript?

opal plank
honest perch
#

no

opal plank
lost isle
#

hi, i need help im working on a discord porject and i was wondering, how do i dm the member who did the command (but an embed)

honest perch
#

you started on about it yesterday and you're still going on about it today

opal plank
#

then i'll gladly shut up about it, sorry to give you feedback

#

wont do it again, sorry

lost isle
#

can anyone help.... simple quetion......

#

hi, i need help im working on a discord porject and i was wondering, how do i dm the member who did the command (but an embed)

mellow kelp
honest perch
lost isle
mellow kelp
#

yea

cinder patio
#

if you guys need to get back at erwin: Keep repeating to not push javascript files generated by typescript

lost isle
#

thank!

mellow kelp
#

no prob ๐Ÿ‘

opal plank
honest perch
opal plank
#

you force them to install typescript, use tsc, add extra tsconfig, just so they can use it?

mellow kelp
#

well um

opal plank
#

rather than sending a pre-compiled module?

mellow kelp
#

in my opinion, typescript and @types should be in devDependencies, so that users may install those and compile by themselves

cinder patio
#

you install typescript and just transpile them. You can also push a release with the compiled javascript if that bothers you that much

opal plank
#

what sense does it make to have a js user install ts?

mellow kelp
#

but arent they gonna install a published package i think

lost isle
#

@mellow kelp where ezactly do i put that

opal plank
#

You can also push a release with the compiled javascript if that bothers you that much
this is exactly what im doing

mellow kelp
#

users have a send() method for DMs

prime glacier
#
-jsubuntu@ip-172-31-43-176:~/secret$ Fontconfig error: Cannot load default config f                    ile
Error: Error parsing info: Unable to retrieve video metadata
    at getWatchPage (/home/ubuntu/secret/node_modules/ytdl-core/lib/info.js:75:1                    3)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async exports.getBasicInfo (/home/ubuntu/secret/node_modules/ytdl-core/li                    b/info.js:84:22)
    at async Map.getOrSet (/home/ubuntu/secret/node_modules/ytdl-core/lib/cache.                    js:24:19)
    at async exports.getInfo (/home/ubuntu/secret/node_modules/ytdl-core/lib/inf                    o.js:226:14)
    at async Map.getOrSet (/home/ubuntu/secret/node_modules/ytdl-core/lib/cache.                    js:24:19)
    at async Object.run (/home/ubuntu/secret/commands/music/play.js:86:20)


pure lion
#

Members, being an extension of the user class, also have this

lost isle
#

this is my code:

client.on('message', message => {

  if (message.author.send === '/Nitro') {
    const embed = new MessageEmbed()
      .setTitle('Nitro Successfully Generated!')
      .setColor(0x0059ff)
      .setDescription('Check your Dms for a Free Discord Nitro Code! (If you didnt get a dm, please check your privacy settings and try again!)')
      .setThumbnail('https://images-ext-1.discordapp.net/external/4ONRTfM0eACv125fNvykyatoHcn-EzxqAMVPhDxyue8/%3Fv%3D1/https/cdn.discordapp.com/emojis/734413249864531979.gif');
    message.channel.send(embed);
  }
});
#

where should i put it

pale vessel
#

what

pure lion
#

Oh no

pale vessel
pure lion
#

Don't

#

Come here

#

Ever again

cinder patio
#

@opal plank What if I am a typescript user and want to contribute to your project?

lost isle
#

why

prime glacier
#
Fontconfig error: Cannot load default config file
Error: Error parsing info: Unable to retrieve video metadata
    at getWatchPage (/home/ubuntu/secret/node_modules/ytdl-core/lib/info.js:75:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async exports.getBasicInfo (/home/ubuntu/secret/node_modules/ytdl-core/lib/info.js:84:22)
    at async Map.getOrSet (/home/ubuntu/secret/node_modules/ytdl-core/lib/cache.js:24:19)
    at async exports.getInfo (/home/ubuntu/secret/node_modules/ytdl-core/lib/info.js:226:14)
    at async Map.getOrSet (/home/ubuntu/secret/node_modules/ytdl-core/lib/cache.js:24:19)
    at async Object.run (/home/ubuntu/secret/commands/music/play.js:86:20)```

error please help
lost isle
#

im making for friend

#

lol

earnest phoenix
#

NITRO GENERATORS

#

AGAINST TOS

opal plank
earnest phoenix
#

EVEN AS A JOKE

lost isle
#
client.on('message', message => {

  if (message.content === '/Nitro') {
    const embed = new MessageEmbed()
      .setTitle('Nitro Successfully Generated!')
      .setColor(0x0059ff)
      .setDescription('Check your Dms for a Free Discord Nitro Code! (If you didnt get a dm, please check your privacy settings and try again!)')
      .setThumbnail('https://images-ext-1.discordapp.net/external/4ONRTfM0eACv125fNvykyatoHcn-EzxqAMVPhDxyue8/%3Fv%3D1/https/cdn.discordapp.com/emojis/734413249864531979.gif');
    message.channel.send(embed);
  }
});
pure lion
#

Kill your friend, it's free and healthy!

lost isle
#

this is code

#

lol

earnest phoenix
honest perch
#

you know whats funny, when discord will make messages an intent and people will come crawling here for help with sending messages

lost isle
pale vessel
lost isle
#

ik making for friend

#

getting paid

pure lion
#

In the bin @lost isle

pale vessel
#

Change channel to author

pure lion
#

Flaz stfu

earnest phoenix
#

Learn javascript and PLEASE DONT MAKE ANY NITRO SHIT

lost isle
#

ok

#

thanks

crimson vapor
#

what the hell is this

#

its a fucking image

pure lion
#

No learn TS, it's betterer !

pale vessel
#

yo wtf i'm just trying to help

crimson vapor
#

let him be

pale vessel
#

you all are mean

pure lion
#

No

#

You're helping a tos kiddie

lost isle
#

for

#

my

#

firned

#

again

earnest phoenix
#

Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

pure lion
#

It's still against tos

lost isle
#

ik

#

im getting paid

crimson vapor
#

its not even a real generator

lost isle
#

like 10$

crimson vapor
#

LOL

lost isle
#

xddd

crimson vapor
#

chill

cinder patio
#

@opal plank Alright, so... if I want to contribute to your project, I would have to write my code in javascript - and you write the code in typescript and then transpile it to javascript? How does collaborating work

earnest phoenix
#

Man thinks breaking ToS for a friend is good

pure lion
#

That's like saying "I made a knife for my friend who's going to kill someone, I know they're going to kill someone and they're paying me for that"

pale vessel
#

He's saying that based off of what Erwin said

crimson vapor
cinder patio
#

That's what I'm telling Erwin, no actually the oppsosite

opal plank
pure lion
#

TS = TS
Js = Js

crimson vapor
#

but all you have to do it fucking tsc

honest perch
#

@pure lion turns out i still have node v12 installed

pure lion
#

Yes

honest perch
#

time to install v15

pure lion
#

Issue being?

pale vessel
#

how do i type tsc

crimson vapor
opal plank
#

literally standardised code with /dist /src

pale vessel
#

fuck

cinder patio
opal plank
#

it is

pale vessel
#

wait what

#

how is it not lmao

opal plank
lost isle
#

last question, How do i make a changing status (my bot)

opal plank
#

also this ^^

lost isle
#

@pure lion

#

last question, How do i make a changing status (my bot)

#

do you know how?

#

its for my bot

#

or anyone

mellow kelp
#

client.user.setActivity i think

pure lion
#

@pale vessel

pale vessel
#

but im on pc

lost isle
pale vessel
#

how do i do that

pure lion
#

Go away

lost isle
#

can you send code

pure lion
#

@lost isle no

#

Work it out for yourself

lost isle
#

ik

#

last question, How do i make a changing status (my bot)

pure lion
#

You're a big boy/girl

lost isle
#

but i dont know how

#

xd

pure lion
#

use setInterval

#

Google it.

lost isle
#

k

#

i think i got it

honest perch
#

what the fuck is this

pure lion
#

EWWWW

#

I'm gonna vomit

crimson vapor
#

idk what this is

restive furnace
#

so google is paying him?

#

ok didn't know

misty sigil
#

discord bot mkaer?

#

ewwWtf

tulip ledge
#

Hey I'm using chattriggers (it's to make mods for minecraft using js) and I want to make it so that when people talk in a discord chat the user using the mod will execute a command + that text. Now I don't know how to approach this as I don't know if webhooks can post to the chattrigger mod when someone sends a message

lost isle
#

yea i found it

cinder patio
#

Well, the mod must somehow communicate with your bot

tulip ledge
#

it doesnt it communicates wit ha webhook

cinder patio
#

the bot is hosted on a separate machine, right? It doesn't come with the mod

tulip ledge
#

I already made it so it looks for chat messages and then posts it in the discord channel

crimson vapor
#

my code actually worked fucking poggers

tulip ledge
#

Now i need to reverse it

#

No no

#

It's an alt accounbt

#

running the mod

cinder patio
#

but like, is the bot itself built into the mod, or?

tulip ledge
#

its not a bot

#

It's communcating with a webhook

cinder patio
#

aaaah

tulip ledge
#

It's a mod that picks up messages and then posts to the webhook

#

Now, I need to reverse it and make it do the same but then from discord chat to minecraft chat

#

And I have no clue how

cinder patio
#

I don't think that's possible

#

you can only post messages with a webhook

tulip ledge
#

I've seen someone do it

#

So ur saying I'm gonna need like a proxy and a discord bot to communicate between the mod and bot?

cinder patio
#

Well originally I thought that that's what you're doing

tulip ledge
#

nope

#

I've never setup a proxy

#

but that would be how to do it right?

crimson vapor
cinder patio
#

hm... I don't think you need a proxy, but maybe a TCP connection with the mod

#

For example, the bot exposes a TCP server, and your mod makes a connection to that server, and now the bot and the mod can communicate

#

the bot can send messages to the mod, and vice versa

#

But that also makes the development a lot more complex

#

I'm not sure what the right thing would be if you want to keep it simple

tulip ledge
#

Now

#

how would I setup a TCP server

cinder patio
#

It's a built-in feature so that's nice

#

Net module

tulip ledge
#

mmmh

#

seems cool

#

Now

#

1 issue tho

#

The mod is not nodejs

#

its just js

#

I think

#

let me check

misty sigil
#

nodejs is a js runtime

#

bro

tulip ledge
#

But

cinder patio
#

it's possible that it's a different runtime chill

tulip ledge
#

Net isn't built into js

#

is it?

#

it's built into node

grizzled raven
#

should i wait a set amount of seconds after the ready event is fired before performing actions?

cinder patio
#

yeah, I guess, depends on the runtime

cinder patio
tulip ledge
#

So

#

That means?

cinder patio
#

The mod is just going to connect to the server

crimson vapor
#

poggers

#

code worked 2x

cinder patio
# tulip ledge That means?

I really don't think you should start such a complex project if you've never worked with networking before

#

Maybe try a smaller project first, like a simple TCP server and client?

tulip ledge
#

yeah I'll look into that

cinder patio
#

There are other alternatives to TCP such as websockets or an HTTP server - those are also options, and are also easier than TCP

#

But also a bit slower

honest perch
#

dice

#

they dont work

#

stop trying

pure lion
#

hello misly

honest perch
pure lion
#

it does

#

idoyt

#

i have a github pages site for docs, and i have an index.html for each route. how can i get individual files to load? it throws a 404

vapid bay
#

so i have a question

#

how do you get an Id of a Discord user?

pure lion
#

its generally <user>.id

vapid bay
#

so i can add to my bot for my friend his ip

jaunty surge
#

right click their name and copy ID on bottom

vapid bay
#

thx you guys are awesome

pure lion
#

np

jaunty surge
#

by the way

pure lion
#

the by way

jaunty surge
#

developer mode first if you didn't do it

jaunty surge
#

lol..

pure lion
#

yeah do that

#

also you can do \<mention>

#

@jaunty surge

jaunty surge
#

@pure lion

pure lion
#

science

jaunty surge
#

ohhh

#

unix

#

by the way, I have issue with rich something with EasyRP tho

pure lion
#

go ahead

jaunty surge
#

I run the script but it didn't show in my status

#

rish presence

#

rich*

pure lion
#

i havent used that

hollow sedge
#

i mean maybe dont use tools that havent been updated in 2 years

pure lion
#

ah that must be why

jaunty surge
#

so which should I use tho

pure lion
#

make your own thing

#

why not

hollow sedge
#

idk

jaunty surge
#

from game activity?

pure lion
#

any

#

just check the docs at the developer portal

jaunty surge
#

yeah I'm making my own status but it didn't work with the current EasyRP thing thing

pure lion
#

there are docs

gilded olive
#

give me an idea of something I could build

pure lion
#

a bot

#

that

honest perch
gilded olive
#

doing that

pure lion
#

makes pat gifs

gilded olive
#

anything besides a bot

#

ah yea i said id try making a lib

#

lemme make a discord one

jaunty surge
#

I'm trying to learn MERN Stack but i don't know where to start lol

hollow sedge
#

well you should probably know node.js first

jaunty surge
#

yeah I do know that, i don't know the other 3 ๐Ÿ˜ญ

gilded olive
#

React

#

idk i heard mongo is pretty shit

jaunty surge
#

really?

#

mongodb

distant cobalt
#
message.channel.send('HACKING... BEEEP BEEP.')
            for(x = 0; x < 100; x++){
                setTimeout(() => {
                    message.edit(x)
                 }, 250)
            }``` how do i edit the message that the bot sent?
#

edit the message the bot sent

jaunty surge
#

I know how to make the embed edit

distant cobalt
distant cobalt
jaunty surge
#

let me try lol, I'm also really bad at coding

distant cobalt
#

ok

#

lol

hollow sedge
jaunty surge
#

ohh wait edit the bot message you mean?

hollow sedge
#

stacks suck tho

#

why cant i just use whatever is the best for my project

distant cobalt
jaunty surge
#
bot.on("message", async message => {
  
  const embed = new DiscordEmbed().setColor(0xe91e63).setDescription('text');
  const embed1 = new DiscordEmbed().setColor(0xe91e63).setTitle('TEST');
  let msg = await message.channel.send(embed)

  message.edit(embed1)
});```
this is how I can think of of it, you can try the await message if you like any custom message that the bot will edit and then edit it back
distant cobalt
#

ok

#

htanks

jaunty surge
#

lol i'm sorry I'm so bad lol

distant cobalt
#

it okay

#

it says this

jaunty surge
#

ohh

#

then you cannot edit it in any possible way it seem tho

distant cobalt
#

Okay

hollow sedge
#

do msg.edit not message.edit

#

msg is your message message is the user's message

#

@distant cobalt

distant cobalt
#

okay

gilded olive
#

ive heard when it becomes too big it just starts breaking

crimson vapor
#

what would I say for an error when a constructor doesn't have a required param?

opal plank
#

properly indexed tables wont break even with the stupid amount of stress i put into it

hollow sedge
#

there would be no point in a database if that was true

opal plank
#

175 billion scans in 4h

#

if that didnt break it, nothing will

#

it DOES however get impacted, if you get to rates at 40k+ queries per minute, then cassandra/elasticsearch are faster

#

though no, postgres wont break at higher scales, that test was me pulling around 98% of twitch's global traffic onto my server to stress test my library

gilded olive
#

tbh sometimes i be stress testing my bot

#

then it takes an absurd amount of time to fetch from the db just to realize my internet is shit

opal plank
#

stress testing is good

next ridge
#

      let newEntry = { 
      itemname: itemnamex,
      itemprice: itempricex,
      itemid: itemidx
        };
    
    let newDB = new itemDB(newEntry);
   await newDB.save();
        ```
opal plank
#

scaling is important