#development

1 messages · Page 1880 of 1

simple stump
#

i tried 1, but the bot immediately goes to .catch and sends the message "opponent didnt react" or whatever. i also tried 10, but then it goes to .then and updates the channels. ill see what happens when i change the filter tho

#

yea even when setting the time to 10 it says the opponent didnt react

#

code ^

quartz kindle
#

if you want 2 people to react, you need max 2

#

time is milliseconds

#

time 10 is 10 milliseconds lol

#

0.01 seconds

grim aspen
#

i need help with something

simple stump
#

yea idk i prob dont understand what im doing but im just trying to get it so the user doesnt have to wait 10 sec after they react

quartz kindle
#

time 10000

simple stump
wheat mesa
simple stump
quartz kindle
simple stump
#

so like the bot reacts to a message, then the user reacts and it immediately does something. cause rn the bot reacts to a message, then the user reacts, and the user has to wait 10 sec before something happens

grim aspen
#

you know what nevermind, i figured it out

simple stump
#

ill try max tho thx 👍

quartz kindle
#

then max 1

#

if its only 1 person reacting

simple stump
#

alr

grim aspen
#

i just saw this in an example embed lol

quartz kindle
#

lol

simple stump
#

could i remove time and just have max?

grim aspen
#

actually i do need help

#

how would i do an embed in a command handler that uses module exports with interactions

#

apparently my fixes were wrong so i gave up

wheat mesa
#

Show some code

solemn latch
#

presumably the same way as without exports

grim aspen
#

imma put it in a pastebin

solemn latch
#

just with exports

wheat mesa
#

Aight

grim aspen
#

it's under ./commands with help.js

wheat mesa
#

Is that the full file?

#

Also are you getting an error?

grim aspen
#

one sec

errant flax
#

how do i get started with ts

grim aspen
errant flax
wheat mesa
#

Then you have your brackets lined up improperly and/or an extra )

#

On mobile atm so I can’t really look at formatting easily

grim aspen
#

i love it when discord.js throws a fit when you do code badly

#

});

SyntaxError: Unexpected end of input

#

you know what screw it

#

i will just put it in a google doc and pass it off at as a link

#

in the code

lament rock
#

That's not Discord.js

grim aspen
#

tf

lament rock
#

That's JS' parser telling you to fix your code

grim aspen
#

fuck

blissful coral
#

discord.js is just a lib

#

FYI

grim aspen
#

if i can't do the code i will put it in a doc

blissful coral
#

Not a language

#

Why would you do that

grim aspen
#

i gave up on it

blissful coral
#

Learn js before coding a bot

grim aspen
#

i've done coding bots for 3 years

#

well just only one

blissful coral
#

What's the error

grim aspen
#

unexpected input

blissful coral
#

give it a expected one

#

what line is it on

simple stump
#

I'm trying to add a role to a mentioned user, but I keep getting this error:
TypeError: Cannot read property 'roles' of undefined.
I've tried getting an user through mention and the current method of client.users.cache.get.
Code: https://sourceb.in/Es00bEa0BY

grim aspen
#

lemme redo it

blissful coral
#

and your calling roles on a undefined variable

wheat mesa
#

User objects don’t have roles

#

Member objects do

grim aspen
#

it's not that i didn't learn how to do js btw, it's that the new docs makes me wanna have an anuerysm

simple stump
#

message.mentions.members isnt a thing in v13 tho

blissful coral
#

use <Message>#mentions#members?

#

Wait what

simple stump
blissful coral
#

yes it does

quartz kindle
#

it does

wheat mesa
#

Rather than issues with djs

blissful coral
#

because they are

#

lmao

grim aspen
#

k fixed

#

now new error

wheat mesa
#

...which is?

simple stump
#

thx

blissful coral
#

:)

quartz kindle
#

dumfuk

grim aspen
#

description expected string to have a minimum length of 1 but got ``

#

oh shit

#

i'm a dumbass

#

nvm

blissful coral
#

Errors are in english

quartz kindle
#

dumfuk

blissful coral
grim aspen
#

i have less braincells than a doorknob would have

earnest phoenix
#

Is anyone familiar with Discord Buttons Plugin for Discord Py, if so, can you help me?

grim aspen
#

you wanna know how much of a dumbass i am, i've overlooked one piece of code that could've been easily fixed causing me to waist 5 hours

wooden kindle
#

How do u make a bot respond to a msg

#

Like this

quartz kindle
#

an embed?

grim aspen
#

oh boy

earnest phoenix
wooden kindle
#

I can’t figure it out

wooden kindle
grim aspen
#

i was just having issues with that christmasthink

quartz kindle
#

did you try reading the docs and guides?

wooden kindle
#

I can’t find any

#

I’ve looked on google and YT

earnest phoenix
solemn latch
earnest phoenix
#

Im not familar with js

solemn latch
#

Official guide

quartz kindle
wooden kindle
grim aspen
#

and back to square 1

#

amazing

#

yes i fucking fixed it

#

god fucking damnit i didn't

wheat mesa
#

What’s the error

#

Getting frustrated only results in worse code and more frustrations down the line

grim aspen
#

cannot send empty message

wheat mesa
#

Sometimes it can help to take a small break

#

You’re trying to send an empty message then, check where you’re sending messages

blissful coral
#

You can't send a empty message

#

The errors are all in english it states the exact problem

#

If read correctly

grim aspen
#

i swear to god now i'm thinking i'm illegible

tropic cliff
#

I have a quick question about posting server count to top.gg

wheat mesa
#

Go through the process of thinking about what could be wrong

tropic cliff
#

my discord bot - this thing "bot = commands.Bot(command_prefix = "$")" - is named "bot"
and then my top.gg thing is bot.topggy - this thing "bot.topggpy = topgg.DBLClient(bot, dbl_token, autopost=True, post_shard_count=True)"

are these 2 things both being named bot going to mess it up or is that what it's supposed to be

#

I just copied the automatically post server count every 30 minutes off the documentation

grim aspen
#

invalid interaction?

#

that's new

wheat mesa
#

Try reloading your discord

grim aspen
#

reloaded, let's see what it does

#

the hell?

#

so none of my messages existed for the server

#

the commands i meant

wheat mesa
#

Then you’re doing something wrong

grim aspen
#

yuppppp

wheat mesa
grim aspen
#

omg it's a catch block

#

you know what screw it, imma save the command for later

#

i'm really starting to question how i've been coding a bot for 3 years and when it comes to command handlers, i can't do jack shit

solemn latch
#

most of the above guide is copy paste tbh

grim aspen
#

they should've never done interactions

#

smoothbrain move

solemn latch
#

interactions imo are an improvement, I think most people like them

boreal iron
grim aspen
#

it's like the devs were incompetent

#

or just did it with no thought behind it

boreal iron
#

Also never got why they suggested this stupid code to register slash commands other than the inbuilt features of djs

wheat mesa
#

Djs is just bad in general

#

The devs aren’t incompetent, it’s made as a “beginner friendly” abstraction of the more difficult backend processes

#

At least that’s what I see

grim aspen
#

beginner friendly does not exist anywhere in those new docss

wheat mesa
#

They’re beginner friendly because it spoonfeeds you the code

split hazel
#

interactions would've probably been received 1000x better if discord did a better job of announcing it and a ton of other things

grim aspen
#

not as much anymore

wheat mesa
#

Just use detritus smirk

grim aspen
#

wtf is detritus

#

i keep hearing about that

wheat mesa
#

Better library for the discord api

#

Better is a subjective term, but in my opinion, it’s better

grim aspen
#

better be easier

wheat mesa
#

Typescript on top

#

If you expect to be spoonfed the proper code for detritus off the docs, then look elsewhere

#

I think djs does the job of making a “working” bot pretty well

grim aspen
#

barely working

wheat mesa
#

But scalability and general organization seems counterintuitive

#

I used to use djs v12

#

Then I was introduced to detritus by the resident detritus enthusiast, Erwin

#

I have no regrets about switching

split hazel
#

oh and with djs you constantly have to work and maintain your bot bc of the obscene amount of breaking changes

wheat mesa
#

Plus you have pretty much direct contact with the developer and maintainer of detritus

split hazel
#

since discord started releasing gateway updates more rapidly you have to update eventually you cant just stay on an old version

wheat mesa
#

Since it’s a less popular library

#

And detritus adds new features fast

#

Unlike djs where you have to either use some janky 3rd party garbage library, or wait for an entire version update to get new features

grim aspen
#

maybe i should try detritus

#

i'd probably fail

blissful coral
#

discord-rose™️

wheat mesa
#

Not if you can’t do djs yet mmulu

grim aspen
split hazel
#

discord-rose could do a bit of maintenance

wheat mesa
#

Can’t speak on the reliability of other libraries since I’ve only used detritus and djs, I’m sure they’re good

#

Most if not all are at least better than djs however

split hazel
#

discord.asm

wheat mesa
#

Djs is by far the most popular though, you’ll find answers to many of your questions quite quickly since they’ve most likely been asked before

#

Waiting on a discord.base2 library

split hazel
#

fun fact asm is easy

wheat mesa
#

Idk about that one

split hazel
#

it's just the simplicity that makes it difficult to work with

blissful coral
#

yeah

wheat mesa
#

It’s TOO simple

blissful coral
#

I like discord-rose

#

its raw api

#

works great for me

#

Amazing with TS too

wheat mesa
#

Too many things to think about to make a simple instruction in asm

#

(Compared to modern languages)

blissful coral
#

asm > js

split hazel
#

machine code is brutal its totally binary and doesn't have things like labels which asm has

wheat mesa
#

C++ already kicks my ass and asm is like a 6 step jump down from that

split hazel
#

I tried coding in machine code once with a hexadecimal editor

#

didn't enjoy it

#

it really makes you see asm as a luxury to have

wheat mesa
#

Just the thought that people used to actually use asm all the time before C was invented haunts me

split hazel
#

lol

#

asm isn't actually all that bad

#

make an os and you'll understand

#

it just requires a lot more labour to do one thing

#

instead of variables you have individual memory locations and cpu registers

#

there wasn't really any languages back then so people mastered asm

#

and made games in it

boreal iron
wheat mesa
#

Not Not Erwin

boreal iron
#

No, not not Erwin but Erwin

wheat mesa
#

Erwinception

boreal iron
#

!!!!Erwin

#

I wonder where his shady detritus ads are

tough prawn
#

Hi

earnest phoenix
#

nsfw commands all of a sudden stopped working on my discord bot. they have always worked fine from reddit now all of sudden they stopped working.

wheat mesa
#

Anyone know how to create a message with a webhook with an API request? I'm using HttpClient in java, never worked with webhooks before

#

Or do I have this webhook thing wrong

#

(I'd prefer to not use any external libraries, but if I have to then so be it)

#

Got it, nevermind

earnest phoenix
#
m = await ctx.send(
        embed=embed, 
        
            components = [
            Button(label="1", style=ButtonType().Primary, custom_id="button1"),
            Button(label="2", style=ButtonType().Primary, custom_id="button2"),
            Button(label="3", style=ButtonType().Primary, custom_id="button3"),
            Button(label="4", style=ButtonType().Primary, custom_id="button4"),
            Button(label="5", style=ButtonType().Primary, custom_id="button5")
            ]
        
        )

Anyone got any idea how to make this all go in 1 row rather than down in a column?

lament rock
#

each entry in the Array signifies it's own row

#

if there's a button row constructor, then use that. Or if Button accepts more parameters, use that

#

alternatively, look at Discord.py's docs for buttons

wheat mesa
#

Anyone know why I'm getting an Already connected error from this code? ```java
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;

public class Webhook {
private final String webhookId;
private final String webhookToken;
private String webhookName;
private final HttpURLConnection conn;

public Webhook(String webhookId, String webhookToken) throws IOException {
    this.webhookId = webhookId;
    this.webhookToken = webhookToken;
    this.conn = connectToWebhook();
}

public Webhook(String webhookId, String webhookToken, String webhookName) throws IOException {
    this.webhookId = webhookId;
    this.webhookToken = webhookToken;
    this.webhookName = webhookName;
    this.conn = connectToWebhook();
}

private HttpURLConnection connectToWebhook() throws IOException {
    URL url = new URL("https://discord.com/api/webhooks/"+webhookId+"/"+webhookToken);
    URLConnection con = url.openConnection();
    HttpURLConnection http = (HttpURLConnection) con;
    http.setRequestMethod("POST"); // PUT is another valid option
    http.setDoOutput(true);
    http.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
    http.connect();
    return http;
}

public void sendMessage(String content) throws IOException {
    if(content.length() > 2000) {
        throw new IllegalArgumentException("You cannot send a message with more than 2000 characters!");
    }
    String json = "{\"username\":\""+webhookName+"\",\"content\":\""+content+"\"}";
    byte[] out = json.getBytes(StandardCharsets.UTF_8);
    int length = out.length;
    conn.setFixedLengthStreamingMode(length);
    try(OutputStream os = conn.getOutputStream()) {
        os.write(out);
    }
}

}

#

Test
Enter message to send. Type ESC at any time to exit.

Test
Exception in thread "main" java.lang.IllegalStateException: Already connected
    at java.base/java.net.HttpURLConnection.setFixedLengthStreamingMode(HttpURLConnection.java:202)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.setFixedLengthStreamingMode(HttpsURLConnectionImpl.java:490)
    at Webhook.sendMessage(Webhook.java:45)
    at Main.main(Main.java:24)

Process finished with exit code 1
#

Not entirely sure how it could already be connected, but I'm probably missing something easy here

#

Oh wait

#

I'm stupid

#

I'm setting the fixed length streaming mode after connecting

#

whoops

earnest phoenix
#

ew java

wheat mesa
#

Would it be a no no to set the streaming mode, connect, then disconnect on the next message to set the streaming mode again?

#

Seems like I can't do that, is there a way to do something similar to conn.setFixedLengthStreamingMode() but after connection?

wheat mesa
#

Okay, fixed the first issue with using setChunkedStreamingMode, however on the second time around using the function, I'm now getting ```Exception in thread "main" java.io.IOException: Stream is closed
at java.base/sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3785)
at java.base/sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3774)
at java.base/sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3769)
at Webhook.sendMessage(Webhook.java:46)
at Main.main(Main.java:25)

Process finished with exit code 1```

#

And my brain is too small to understand what to do at this point

#

Not sure how to re-open the stream, if that's even what I'm supposed to do

lyric mountain
#

ok, I'm here

lyric mountain
wheat mesa
#

😔

lyric mountain
#

it's ridiculously outdated

worthy ivy
#

oh christ java AND http requests?

#

thats going to be fun

lyric mountain
#

like, it's the very first http package integrated into java

wheat mesa
#

without external libraries KEKW

lyric mountain
#

use apache's

#

oh

worthy ivy
#

project for a dumb company?

wheat mesa
#

Project for self use, going to be working on it at school and I'm not sure if I'm able to access external libs on their wifi

lyric mountain
#

use apache's, save the jar together with ur project

#

actually

wheat mesa
#

Can't get the jar on their wifi is the problem

lyric mountain
#

what exactly are u trying to achieve there?

lyric mountain
earnest phoenix
#

I feel java wasn't made to work with http request

wheat mesa
#

doesn't work on school computers KEKW

earnest phoenix
#

cause of how pain in the ass it is

lyric mountain
#

it's just that HttpUrlConnection is outdated af

wheat mesa
#

But the point is that I'm trying to use a webhook to send messages to a discord with friends, since discord is blocked at school and cellular data doesn't work

lyric mountain
#

it's like using primitive JS http requests

wheat mesa
#

Nothing needs to be incredibly efficient or fancy or anything

worthy ivy
wheat mesa
#

I'm using outdated tech because it's built into java

#

Aka gonna build the UI with swing

#

lmao

lyric mountain
#

ok so, use apache's

#

put the jar inside ur project

#

and reference it there

#

or are u already in school?

wheat mesa
#

At home atm

#

I'll try out apache

#

If it doesn't work then I'll figure out a different solution

#

But thank god get me away from this shitshow of an http request

earnest phoenix
#

I love working with kotlin projects and having to turn them into a jar file that uses java libs and need the depos built into the jar

#

Took me a solid 3h to figure it out cause im dumb

lyric mountain
#

@wheat mesa

#

this is basically how u open a connection, send, retrieve response and close

wheat mesa
#

looks much cleaner

lyric mountain
#

do note, JSONObject is a custom moshi adapter I wrote

#

but u can use org.json if u don't mind optimization

earnest phoenix
#

I always wondered how to parse a request body into json with kotlin

lyric mountain
#

moshi

earnest phoenix
#

Mm

#

I used gson iirc

#

which is a kotlin lib

lyric mountain
#

gson is bloated af

wheat mesa
#

dear god does java not have a package manager

earnest phoenix
#

yea

lyric mountain
#

and a configuration hell

earnest phoenix
#

I disliked it

#

but it worked

#

and I didn't know any better ones

lyric mountain
#

that's basically the reason moshi was created

earnest phoenix
#

cause all the shit I saw was for gson or some other lib

lyric mountain
#

give moshi a try, you can directly switch libs and do only minor changes

#

they tried to make migration as easy as possible

wheat mesa
#

how tf do you even install a library

lyric mountain
wheat mesa
#

raw java

earnest phoenix
#

If I ever use kotlin again I will give it a shot

#

I am focusing on golang rn

lyric mountain
#

download the jar and set classpath

earnest phoenix
#

I honestly use maven

#

cause gradle was annoying to me

#

kek

lyric mountain
#

I like gradle

earnest phoenix
#

gradle is fine if its not kotlin

lyric mountain
#

except when I'm making libs, then I use maven

earnest phoenix
#

kts files annoy the shit out of me

lyric mountain
#

give groovy a try, you'll probably like it

#

it's the lang gradle was made in

earnest phoenix
#

Eh

wheat mesa
#

Even dumber question, how do I set classpath

earnest phoenix
#

I can't be bothered to learn smth new

#

go is already using up my last brain cells

lyric mountain
earnest phoenix
#

I honestly never used just java

#

its always been with gradle or maven

lyric mountain
#

you'll ned a json parser waffle

earnest phoenix
#

and I hardly even know actual java

lyric mountain
#

org.json is the easiest

lyric mountain
#

it's just not worth it

earnest phoenix
#

I figured

lyric mountain
#

it's like using js without npm

earnest phoenix
#

ouch

#

is that even possible bro

#

I couldn't do it

#

Anyone who uses js without npm are freaks

lyric mountain
#

I guess the reason most people hate java is how they were introduced to it

#

like

#

my university used java 1.8 without any package manager

#

java 1.8 is literally the barebones regarding features

earnest phoenix
#

I wouldn't mind using java

#

I just dont have the patience

wheat mesa
lyric mountain
#

so it always ended up being a setup hell coupled with lib version mismatch

wheat mesa
#

granted it's AP CS

#

so it's fundamentals mostly

lyric mountain
#

that resulted in many people raging on java

#

if only they were introduced to java 11 + maven...

lyric mountain
wheat mesa
#

Yeah

#

I've got apache installed now, time to install org.json

lyric mountain
#

tbf, check if it doesn't already come with apache

wheat mesa
#

checked

lyric mountain
#

many libs already have it as a dependency

wheat mesa
#

doesn't come with the httpclient

lyric mountain
#

btw

#

which apache did u download?

earnest phoenix
#

If I can find a good place to learn java

#

I probably would

lyric mountain
#

baeldung

earnest phoenix
#

If I had the motivation

wheat mesa
earnest phoenix
#

I used that for kotlin stuff

#

lmfao

lyric mountain
#

what u want is HttpPost

earnest phoenix
#

One thing I disliked about java/kotlin

#

was when getting stuff from github

#

like depos

#

and you had to use the commit hash but sometimes the hash was wrong

lyric mountain
#

u can use jitpack for that

earnest phoenix
#

Yea

#

jitpack was the easiest thing to use for me but also the most annoying

#

lmfao

#

I'd use the commit hash and it'd tell me its not correct

lyric mountain
#

never had issues with it, maybe the commit didn't build sucessfully

earnest phoenix
#

Mmm maybe yea

lyric mountain
#

if u ever give it a try again, use jdk 16

#

it's so clean

earnest phoenix
#

I was using jdk 16

#

when I was using gradle

lyric mountain
#

oh

earnest phoenix
#

But it didn't support jdk 16

#

so I had to install 11

wheat mesa
#

Okay, how do I send a POST request using Apache now?

#

(Combined with org.json)

#

Just trying to rethink the structure of my program since it's different from HttpURLConnection

proud ginkgo
#

! play กอดในใจ

wheat mesa
#

this look about right from this website?

#

(The concept, at least)

#

agh

#

more magical things to import

#

stringentity

#

wait nvm

earnest phoenix
#

is a raspberry pi good for hosting a python bot?

wheat mesa
#

bruh why do I not have the StringEntity class

#

ugh

#

@lyric mountain you sure that was the right JAR to download? I'm getting ClassNotFoundExceptions

wheat mesa
#

Alright, got that fixed up

#

The program still works completely as intended, but the console spits this nastyness out for some reason

#

I'll deal with it for now

#

late at night and I'm tired of this

#

But thank you for the help KuuHaKu

#

Resident java enthusiast

#

👍

earnest phoenix
earnest phoenix
#

i think?

wispy yoke
#

its inside another function

#

oh wait nvm

earnest phoenix
#

that code as working fine unti i added in the error report stuff 😦

harsh tusk
#

O

worn sonnet
#

how do i read a txt file from attachments

#

when using attachment.read() it gives me bytes but not the content of the file

blissful coral
#

You have to convert it iirc

worn sonnet
#

how?

blissful coral
#

oh

worn sonnet
#

Thanks

blissful coral
#

yup

night spindle
#

How to create bots @blissful coral

rose warren
night spindle
#

OK

night spindle
#

How to Add code

earnest phoenix
#

lmao

#

how to add code

#

you add it

pearl trail
#

open notepad and write code ???

earnest phoenix
#

notepad in 2021

#

js when

pale vessel
#

Why?

earnest phoenix
#

AND LMAO MF MADE A NUKER

#

keqing KeqingStab @pale vessel

tulip ledge
#

isn't dpy deprecated?

earnest phoenix
#

yes

rose warren
#

-m 785472586883530753 Be helpful or don't use #development. Sharing nuking code to "help" a newbie. | 3d

gilded plankBOT
#

🤐 Muted ÆÆ#6694 (@visual gulch)

#

🤐 Muted ÆÆ#6694 (@visual gulch)

cinder patio
#

Let's also ignore the command name

pale vessel
#

Yep

#

Let's

tulip ledge
#

The double mute

earnest phoenix
#

@rose warren why double mute

rose warren
eternal osprey
#

Does djs v12 have an attribute to make a message only be visible to 1 user

earnest phoenix
eternal osprey
#

slash commands..

earnest phoenix
#

oh-

proper granite
indigo cobalt
#

:)

errant flax
#

imagine using notepad

feral aspen
#
import prompt from 'prompt-sync';
#

SyntaxError: Unexpected identifier

#

Did I do something wrong? (Trying to convert everything to ES6 based.)

earnest phoenix
#

i got an intents error, here is my base code

#

Is it possible to catch this error?

DiscordAPIError: Unknown interaction
    at RequestHandler.execute (/root/cb/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/root/cb/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
    at async ButtonInteraction.deferUpdate (/root/cb/node_modules/discord.js/src/structures/interfaces/InteractionRespo>  method: 'post',
  path: '/interactions/id/token>  code: 10062,
  httpStatus: 404,
  requestData: { json: { type: 6 }, files: [] }
}
tulip ledge
earnest phoenix
earnest phoenix
tulip ledge
#

I thought

#

maybe he was using py

#

it kind of hard if he doesn't say he's using js, ts or py

earnest phoenix
tulip ledge
earnest phoenix
#

py doesnt uses ; in importing

tulip ledge
#

can you show the error?

earnest phoenix
#

as far as i know

tulip ledge
#

yes I know

#

but maybe he was using py

#

I also did that

earnest phoenix
tulip ledge
#

when learnt py

earnest phoenix
#

aah

tulip ledge
#

because if it is

earnest phoenix
tulip ledge
#

mmh

earnest phoenix
#

it is in only one guild

tulip ledge
#

did you enable the privileged intents?

earnest phoenix
#

tf are those

tulip ledge
earnest phoenix
#

all i did for the intents was gone through the docs

tulip ledge
#

You need to enable these

#

in discord.dev

#

under applications > your bot > Bot

earnest phoenix
#

done

earnest phoenix
#

How can an interaction be unknown and i have no idea ,how i can catch it :C

tulip ledge
#

an interaction is unknown when u delete it

#

and then try to edit it

#

or do something with it

earnest phoenix
#

so ,when you defer it?

tulip ledge
#

no

#

when the interaction is gone

#

and t hen u try to do something with it

earnest phoenix
#

so after 15 mins?

#

@tulip ledge I tried enabling the intents. The bot comes online but it does'nt replies.

tulip ledge
#

can u show ur code again

tulip ledge
earnest phoenix
#

k

#

@tulip ledge ^^

tulip ledge
#

ah well

#

ur not removing the prefix

#

so you have to say

earnest phoenix
#

say what

tulip ledge
#

case "!hi"

#

for example

earnest phoenix
#

k holdup

lament stump
#

Does someone know how to send an embed into another server, like a bugreport, using slash commands?

tulip ledge
#

do like

#

client.channels.fetch("id").send()

lament stump
#

Ah okay, thanks

#

Didn't know if that still worked

earnest phoenix
#

still no work

tulip ledge
earnest phoenix
#

/g ?

lament stump
#

It's regex

tulip ledge
#

ye

earnest phoenix
#

what does it mean

lament stump
#

Complicated to explain

tulip ledge
#

it allows for iterative search

lament stump
tulip ledge
#

it stands for global search

lament stump
#

yep

earnest phoenix
tulip ledge
#

otherwise if u do "hello this is a string".split(/ +/) it will only do ["hello", "this is a string"]

tulip ledge
earnest phoenix
#

lemme try

surreal sage
#

Hey. I'm getting this error when I'm trying to install canvas on a rpi zero w with armv6l v11.15.0 node

#

@rose warren

#

DONT CLICK THE LINK

rose warren
#

ty

surreal sage
#

Thanks

pale vessel
#

Do click the link

surreal sage
#

oy

pale vessel
#

gyp moment

surreal sage
#

gyp

#

gip

#

slurp

tulip ledge
#

do u have node-gyp installed?

earnest phoenix
surreal sage
spark flint
tulip ledge
#

npm install -g node-gyp

surreal sage
#

rush install boi

#

ofc im using sudo to install it btw

surreal sage
#

@livid jackal oh who's dis den?

tulip ledge
#

u sure node-gyp got installed?

surreal sage
#

i just installed it

rich copper
#

hey, can anyone help me
I have created a discord.py Button calculator
but when I click on any button it says
"This Interaction Failed"
Is anyone here to help?

tulip ledge
rich copper
surreal sage
#

gyp install no errors but canvas go weeee

#

build error node-pre-gyp err! not ok

tulip ledge
surreal sage
#

make it a txt tho 👀

rich copper
#

ok

surreal sage
#

yea you said that...

#

you can copy paste the code..

#

into discord

#

?

rich copper
#

but I cant

#

need nitro lol

surreal sage
#

file size?

tulip ledge
# surreal sage yea you said that...

top answer on stackoverflow:

sudo apt-get update
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
#

Then install canvas

surreal sage
#

gotchu

surreal sage
tulip ledge
#

Note that libgif-dev, librsvg2-dev and libjpeg-dev are optional, and only required if you want gif, svg and jpeg support, respectively.

#

@surreal sage

rich copper
surreal sage
#

im still here

surreal sage
rich copper
#

ok

surreal sage
#

there we go

rich copper
#

@surreal sageyeah thanks for help

surreal sage
#

I don't know py very well and the slash commands n buttons and shit. I'm a legacy coder you can say (v12 discord.js'er)

rich copper
#

okay

#

anyone?

tulip ledge
#

Does the error ocur when you press a button

earnest phoenix
tulip ledge
#

so the button is the interaction which fails right

surreal sage
rich copper
#

yeah

earnest phoenix
#

my bot is not logging anything

rich copper
#

true

surreal sage
#

send code

tulip ledge
earnest phoenix
#

this is my current code

tulip ledge
#

can you log message

earnest phoenix
#

nor replies

tulip ledge
#

before checking if it starts with prefix

earnest phoenix
tulip ledge
#

before checking if it starts with prefix

surreal sage
earnest phoenix
surreal sage
#

im not stupid

earnest phoenix
#

not the only taskbar from win 1

#

1

surreal sage
#

There is a bug in the win 11 taskbar

earnest phoenix
#

also its better than 10

surreal sage
earnest phoenix
surreal sage
#

I know what it is

#

center unaligned

rich copper
#

u guys have windows 11?

earnest phoenix
#

ye

surreal sage
#

What'd you think

rich copper
#

is it pre version or global?

earnest phoenix
earnest phoenix
surreal sage
#

preview

rich copper
#

I see

#

Any glitches till now?

surreal sage
#

Windows 11 Pro Insider Preview 64-bit

earnest phoenix
#

^^

tulip ledge
#

@earnest phoenix can u log the message before checking if it starts with prefix

surreal sage
#

the 1 thing is that security takes alot of cpu and re-enables itself after each (re)start

rich copper
tulip ledge
#
client.on("messageCreate", message => {
  console.log(message)
  // Rest of code
});
surreal sage
#

canvas still installing, 512mb ram so yea

#

1ghz cpu

surreal sage
#

let me get a line of code 4 u

#
const args = message.content.slice(config.prefix).trim().split(/ +/g), command = args.shift().toLowerCase();

  if (message.author.bot) {
    if (message.author.id === client.user.id) { } else { return; }
  };
  
  if (!message.content.startsWith(config.prefix)) return;
  if (message.content.charAt(0) === config.prefix && message.content.charAt(1) === " ") return;```
#

this is from 1 of my bots

tulip ledge
#

dont make args const

earnest phoenix
#

why

surreal sage
#

it works for me so dc

tulip ledge
#

cuz then u can't edit them

#

maybe u wanna edit them sometime

surreal sage
#

when do you even edit args

tulip ledge
#

I do

surreal sage
#

i usually just args.join().replace etc

#

not change it

tulip ledge
#

thats just stupid

surreal sage
#

my ways man

earnest phoenix
surreal sage
earnest phoenix
#
//Importing libraries.
const fs = require('fs');
const discord = require('discord.js');
const myintents = new discord.Intents()
myintents.add(discord.Intents.FLAGS.GUILD_PRESENCES, discord.Intents.FLAGS.GUILD_MEMBERS);
const client = new discord.Client({intents: myintents});


//Config
const config = require('./config.json');
const prefix = config.prefix;
const token = config.token;

client.on('ready', () => {
    console.log(`Successfully logged into ${client.user.username}`);
    console.log(`Serving ${client.guilds.cache.size}`);
});

client.on('messageCreate', (message) => {
    console.log(message)
    if(!message.content.startsWith(prefix)) return;

/*
    let args = message.content.slice(prefix.length).split(/ +/g);
    switch(args[0]){
        case `${prefix}hi`:
            message.reply('hello there!');
            break;
        default:
            message.reply('ok.');
            console.log(args[0])
    }*/
})

client.login(token);
tulip ledge
#

it doesnt log anything?

#

not even an error?

earnest phoenix
#

no lol

tulip ledge
#

did you save the file?

surreal sage
#

use this for args message.content.slice(config.prefix).trim().split(/ +/g)

#

*try that as args

earnest phoenix
tulip ledge
#

does your bot have access to the channel?

tulip ledge
#

that won't fix it

earnest phoenix
tulip ledge
#

well, if your message event isn't triggering that means the bot isn't recieving any messages

#

so it probably doesn't have access

#

did u restart the bot?

earnest phoenix
#

yes

#

i am done with this shit

sick agate
#

anyway to create ramdisk without any 3.rd party libs ( c# or python)

surreal sage
#

@tulip ledge canvas installed, thanks

tulip ledge
#

np

timber fractal
#

i've got this code to get all command files ```js
const commandFiles = readdirSync(join(__dirname, "commands")).filter(file => file.endsWith(".js"));

for (const file of commandFiles) {
const command = require(join(__dirname, "commands", ${file}));
client.commands.set(command.name, command);
}``` but i want to make custom categorys cause now it gets all files from the "commands" map but i want to make for example "commands/general" and "commands/moderation" but how would i have to find them?

#

im not very experienced with reading files sorry

tulip ledge
#

you put it in a function and check if the "file" you're "scanning" is a directory or not, if it is you run that function but change the directory to include that diretory

timber fractal
#

how would i have to do that

#

like im very bad at this

tulip ledge
#

fs has a isDirectory method

timber fractal
#

i dont know where to start with that

tulip ledge
#

u do like:

const fs = require("fs")
const path = require("path") // npm i --save path

function loadCommands(dir) {
  files = fs.readdirSync(dir, error => {
    if (error) return console.log(error)
  });

  for (const file of files) {
    if (!fs.lstatSync(path.join(dir, file)).isDirectory()) {
      // Load the command
    } else loadCommands(path.join(dir, file));
  }
}
#

I think something like that should do the trick

timber fractal
#

that gives JSON errors

tulip ledge
#

woops

vivid fulcrum
#

stop copypasting

tulip ledge
#

forgot a )

timber fractal
tulip ledge
timber fractal
shadow frigate
#

why tf does this still return false?

//Check if it's the weekend (for upvoting)
var date = new Date();
if(date.getDay() === 6) { var is_weekend = true }
if(date.getDay() === 0) { var is_weekend = true }
else { var is_weekend = false };
vivid fulcrum
#

the else overrides it

#

it passes the first if check, goes onto the second, doesn't pass it and jumps to the else clause

hybrid roost
#

Hi. Why when I using

bot.users.fetch()

it returning

DiscordAPIError: 404: Not Found
shadow frigate
#

oh

#

my

#

god

hybrid roost
#

Is it because of Discord politics and i have to be whitelisted?

vivid fulcrum
#

no, it's because you gave no id argument

#

so a user with no id isn't found

errant flax
#

ye since if u fetch all discord users

#

ur pc gonna explode

hybrid roost
#

I'm trying to get users count.
When i did it with bot.guilds. It returned MAP object of guilds

errant flax
vivid fulcrum
#

what in the shitcode

earnest phoenix
#

heh

#

wait fucl

#

wrong ping

earnest phoenix
#

var date = new Date();
var is_weekend;
var done;
if(date.getDay() === 6) {
is_weekend = true;
done = true;
console.log(is_weekend)
}
if(date.getDay() === 0) {
is_weekend = true
done = true;
console.log(is_weekend)
}
else {
if (done === true){
return;
}

else{
    var is_weekend = false;
}

};

timber fractal
#

how am i supposed to define command here? ive tried alot alr but got no idea```js
function loadCommands(dir) {
files = fs.readdirSync(dir, error => {
if (error) return console.log(error)
});

for (const file of files) {
if (!fs.lstatSync(path.join(dir, file)).isDirectory()) {
const command = "??"
client.commands.set(command.name, command);
} else loadCommands(path.join(dir, file));
}
}

loadCommands(__dirname);```

hybrid roost
errant flax
#

yes but no

earnest phoenix
hybrid roost
#

So, what is the way to get users count and don't explode my PC?

vivid fulcrum
#

bro it's literally just

let day = new Date().getDay();
let isWeekend = (day === 0 || day === 6);
timber fractal
rose warren
#

My bad lol

timber fractal
rose warren
#

Yep

timber fractal
#

LMFAO

rose warren
#

Sorry I thought i was in general

#

lmao

timber fractal
#

lmao

rose warren
#

Carry on

#

👀

timber fractal
earnest phoenix
#

yes

errant flax
#

afaik

hybrid roost
#

Yep. I want to get global user count. I don't need another data about 'em

errant flax
#

just do <Client>.users.cache.size?

#

tho thats not quite accurate but its good enough

vivid fulcrum
#

that's only cached users

#

the fastest and easiest way is to sum memberCount of every guild

timber fractal
#
function loadCommands(dir) {
  files = fs.readdirSync(dir, error => {
    if (error) return console.log(error)
  });

  for (const file of files) {
    if (!fs.lstatSync(path.join(dir, file)).isDirectory()) {
        const command = require(`./commands/${file}`)
        client.commands.set(command.name, command);
    } else loadCommands(path.join(dir, file));
  }
}

loadCommands(__dirname);``` 
```Error: Cannot find module './commands/blacklist.json' ``` why?
hybrid roost
vivid fulcrum
#

what

#

it's literally just adding up numbers what are you on about

#

💀

timber fractal
#

its just located here, why does it error

vivid fulcrum
#

look at where blacklist.json is then look at the error

hybrid roost
#

@errant flax said that if I use bot.user.fetch() it can "explode my PC".
What happens if I load all guild and all members on them?

vivid fulcrum
#

sigh facepalm

#

you have a giant misconception

errant flax
#

what i mean by "explode my PC" is if djs allowed that to happen(which prolly not bc of discord) then all users will be on the bot's cache

#

and btw discord probably has 1M+ users

#

so ye

vivid fulcrum
#

bot.users.fetch() is used to fetch a user individually, you can only fetch a single user, given that you give the id in the fetch method

you can only get a user count of the guilds you're in, you can't get all users on discord.

errant flax
#

ye i was meming about "explode your pc" part

timber fractal
#

this code totally doesnt work where it was intended for

errant flax
#

since it would be ridiculous to fetch all users

hybrid roost
#

OK, I understood. Thank you. I'll try to make it as you say

vivid fulcrum
#

1 months

#

yes very legit

tulip ledge
timber fractal
#

(node:14972) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined it says its at the client.login line

vivid fulcrum
#

update node to 15.0.0 or higher

timber fractal
# vivid fulcrum update node to 15.0.0 or higher
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@7.4.1: wanted {"os":"!win32"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    !win32
npm ERR! notsup Valid Arch:  undefined
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64```
vivid fulcrum
#

??

#

you don't install node from npm

timber fractal
#

well they say it can

vivid fulcrum
#

npm is a package manager for node

tulip ledge
#

you can use n to install node tho

#

npm i -g n

#

n latest

vivid fulcrum
#

n only works on unix systems

#

so, no windows

tulip ledge
#

ah, well didn't know that

timber fractal
#

they said it could be done on windows with that but sure

vivid fulcrum
#

who is they

quartz kindle
#

aliens

vivid fulcrum
#

it's clearly written in n's readme that it doesn't work on windows

timber fractal
#
given[key] = def[key];
                   ^

TypeError: Cannot create property 'shardCount' on string 'a beautiful bot token has been censored here'```
#

what to do

eternal osprey
#

hey, how would i kick a user out of a channel?

#

Not a server, but a channel in djs v12

vivid fulcrum
#

a voice channel?

timber fractal
#

at Bot\node_modules\discord.js\src\util\Util.js:336

eternal osprey
#

text

vivid fulcrum
#

you can't kick them out per se

eternal osprey
#

ah i am dumb, i have perms set for a role. I will just remove that role.

timber fractal
eternal osprey
#

how could i make a message that's sent by a bot only be visible to 1 user?

tulip ledge
#

using slashcommands

eternal osprey
#

how would i add that into my discord bot which already uses normal commands?

tulip ledge
#

you can only make a message visible to 1 user with slashcommands

eternal osprey
#

can't i combine slash and normal commands into 1 bot?

tulip ledge
#

yes

#

but only when the command gets called with slashcommands it can be shown to only 1 user

eternal osprey
#

or will that become a bad example of intervened events.

eternal osprey
vivid fulcrum
#

ephemeral messages are only possible when you receive an interaction

#

otherwise just dm the user

#

and shout at them if they have dms disabled

eternal osprey
#

hmm okay

#

i got this from the docs:

#
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    if (interaction.commandName === 'ping') {
        await interaction.reply('Pong!');
    }
});```could i use this inside my message event
#

without fucking everythin up>?

vivid fulcrum
#

no

#

because there's no interaction in the message event

#

interactions are button clicks, dropdowns, slash commands and context menus

eternal osprey
#

uhh okay.. how would i do it then?

#

because in this case you would have to use /ping

#

which i think is okay

eternal osprey
vivid fulcrum
#

you'll have to implement a whole another command handling system for them

#

not sure if they're in v12

boreal iron
#

No.

#

That’s actually the worst guide you can find.

earnest phoenix
#
/home/ubuntu/node_modules/discord.js/src/client/Client.js:544
      throw new TypeError('CLIENT_MISSING_INTENTS');
      ^

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Clien                                                                                                             t.
eternal osprey
earnest phoenix
#

pls say fast

#

vps is on

eternal osprey
#

I guess that i will switch to v13 and implement one slash command that's needed, and the rest all normal command handlers.

earnest phoenix
#

no on help me

#

saf

boreal iron
#

Without importing any other shit you can use the existing methods in client.interaction.commands to register/edit/delete interactions

eternal osprey
eternal osprey
boreal iron
#

The guide cry mentioned is trash, useless extra work and doesn’t even use djs inbuilt features even if it’s djs guide

eternal osprey
#

As that's what i am using atm

earnest phoenix
boreal iron
eternal osprey
#

oh god. That means that i will have to switch..

#

I hope that not a lot changed

boreal iron
#

There’s no real reason why not to update

eternal osprey
#

strangely i see lots of people using v12 + slash?

eternal osprey
boreal iron
#

I didn’t say you can’t use them but they aren’t built in into djs

#

But instead of using v12 to write the correct structure of every obj down manually you would be better to update your code and use the existing methods after

eternal osprey
#

Aha thanks!

#

          if(!message.guild.channel.name === "gauntlet-game"){return message.channel.send(":x: **You can only kick users in an active game!**")}
             let userToRemove = message.member.mentions.first();
             let real = randomWords({ exactly: 5, join: ' ' })
             let collector = message.channel.createMessageCollector(m => m.author.id === member.id)
         collector.on("collect", m => {
       if(m.content == real){
       console.log("tetstt")
       }
         })```one thing tho, how would i ever implement this code in slash form.
#

As i cannot fetch arguments using slash commands can i?

near grotto
#

this returns the wrong number of usersjs client.guilds.cache.get('guild_id').members.cache.filter(member => !member.user.bot).size

pale vessel
#

not all users are cached

near grotto
#

??

boreal iron
near grotto
#

@trail patio one more

boreal iron
#

And send it as command option via the event

#

Also works with channels etc.

#

U will just enter @user like usual and it will be available as command interaction option

near grotto
#

lmao

#

ghost pingged the user

eternal osprey
#

aha okay

boreal iron
#

Sounds more complicated than it actually is

eternal osprey
#

yeah i kinda need something visual to go from

boreal iron
#

In your message event you have declare your arguments yourself

#

In your command interaction event they’re already available as interaction.options

#

Let’s say you create a slash command with one required parameter /ban discord-member

#

discord-member will be available as command.option receiving the interactionCreate event

eternal osprey
#

oowh!

boreal iron
#

You just have to get the option’s value and that’s the argument the user entered with the command

eternal osprey
#

so /ban parameter >> will give me the parameter to work with

boreal iron
#

Yes

#

And those parameter types are predefined

eternal osprey
#

How would i create a message collector then?

#

After using the slash command

#

as i suppose that the message collector won't work.

#

Maybe i could define it in a different command rather than slash ones

boreal iron
#

If you set the parameter as discord member, the user using the command can not enter anything else

boreal iron
#

The message content will be an privileged intent in the feature which means you won’t have access to it anymore

#

(Without being verified)

eternal osprey
#

i am trying to create a game where you type /kick @short wraith, it will send a pre-generated word, and boom the collector should pick it up.

eternal osprey
boreal iron
#

Each intent requires it own verification

#

*process

pale vessel
#

you could use a /verify command or some sort and receive user input through that

eternal osprey
#

mmmh yeah.

#

Sounds awesome actually.

#

Let me have a look, will get back in a few minutets

#

i am having a hard time to set the user variable

boreal iron
#

Hmm?

snow gorge
#

i make a calculator command using simply-djs package it's working but when i click on delete button it's show a error in console how to fix it?

azure lark
tulip ledge
#

I think there's a react component which allows you to make blogs

azure lark
#

im not making it in react tho

boreal iron
earnest phoenix
#

it's happening in v12

lament rock
#

managed has been a property since early days of Discord

#

managed entails if the role is managed by an integration like if it's a bot role or if it was created by twitch

earnest phoenix
#

yep

signal estuary
#
    const embed = await inter.reply({ embeds: [startEmbed], components: [row], fetchReply: true })
    const filter = (filter) => {
        if (inter.user.id === filter.user.id) return true
        return filter.reply({ embeds: [embedManager.errorEmbed(`${language(inter.guild, 'YOU_CANT_DO_THAT')}`)], ephemeral: true })
    }
    const collector = embed.createMessageComponentCollector({
        filter,
    })
    collector.on('collect', async (i) => {
       i.reply({ content: 'Enter Field Title' })
    })
DiscordAPIError: Unknown interaction
  requestData: {
    json: {
      type: 4,
      data: {
        content: 'Enter Field Title',
        tts: false,
        nonce: undefined,
        embeds: undefined,
        components: undefined,
        username: undefined,
        avatar_url: undefined,
        allowed_mentions: undefined,
        flags: undefined,
        message_reference: undefined,
        attachments: undefined,
        sticker_ids: undefined
      }
    },
    files: []
  }
}
boreal iron
#

Webhooks are only available for 4s

#

You need to defer them in order to reply after 4s

#

aka. delay

pale vessel
#

3s

boreal iron
#

Shhuush oldEyes

signal estuary
#

I had .deferUpdate()
and then after that .reply()

boreal iron
#

Keep the 3s in mind

#

Yes, or editReply()

#

however you like

signal estuary
#

Code:

console.log(value + " | " + title)
await embed.edit({ embeds: [startEmbed.addField({ name: `${title}`, value: `${value}` })] })

Console:

geg | sdsd

Error:

RangeError [EMBED_FIELD_NAME]: MessageEmbed field names must be non-empty strings.
pale vessel
#

addField(title, value)

#

Or addFields([{ name: title, value }]);

rose lance
#

so guys I'm currently trying to work with the python youtube-dl package, but when downloading a playlist I get this error: youtube_dl.utils.DownloadError: ERROR: Unable to extract yt initial data
I looked online and found someone else who seemed to have the same problem and this fix in particular seems worth trying, but I'm on windows and have no idea how to achieve what this guy did https://stackoverflow.com/a/66092779

wheat mesa
#

Quick solution: don’t use python

pale vessel
#

That doesn't help

rose lance
#

ok thanks for the help, I will redo my entire project I am working on for about a year now in another language :D

wheat mesa
#

I know 😔

#

I apologize!

lyric mountain
#

Also I'd not play with YouTube after they started hunting bots

rose lance
#

they are only hunting bigger bots that monetise their services, this now is for private use anyways

wheat mesa
#

Well... youtube can hunt any bot down that it feels like for any reason they specify

lyric mountain
#

Still, too much risk

wheat mesa
#

As long as it’s breaking their ToS they can send you a C&D

lyric mountain
#

They're hunting mostly because bots bypass ads and don't give views

wheat mesa
#

^^

#

Losing ad revenue

rose lance
#

yeah as I said it's for private use and I'm fine with the risks

wheat mesa
#

And YouTube is all about that sweet sweet ad rev

lyric mountain
#

Also, if u use the api they already know what you're using for

#

It's just that the list is too big

wheat mesa
#

They go after the big bots because they cause the most loss

honest galleon
#

So that's how groovy shut down

plucky geyser
next heron
rose lance
next heron
#

„Your form contained some validation errors"

#

Can anyone help me?

worn sonnet
#

Hi anyone know selenium in python?

#

I'm trying to select date from this box

rose warren
boreal iron
next heron
#

I only can see my iframe in preview but not on the public page

#

why?

#

btw my description is hidden

boreal iron
#

Try to reload the website

next heron
#

I did

boreal iron
#

And/or to clear the cache

next heron
earnest phoenix
#
function draw() {
    t++;
    ctx.fillStyle = bgColor;
    ctx.fillRect(0, 0, cvs.width, cvs.height);

    ctx.fillStyle = foreColor;
    ctx.strokeStyle = lineColor;
    ctx.lineWidth = lineWidth;
    ctx.beginPath();
    ctx.moveTo(offset, cvs.height - offset);

    for(let i = offset; i < cvs.width - offset; ++i) {
        ctx.lineTo(i, noise(i + t))
    }

    ctx.lineTo(cvs.width - offset, 200)
    ctx.lineTo(cvs.width - offset, cvs.height - offset)
    ctx.closePath()
    ctx.fill()
    ctx.stroke();
    requestAnimationFrame(draw);
}
#

does someone knows why it doesnt work

#

Nothing appear in screeen when i type requestAnimaton in draw function

boreal iron
#

Did you try another browser?

signal estuary
#
const MsgCollector = inter.channel.createMessageCollector({ filter, time: 15000, max: 2 });
MsgCollector.on('collect', async collected => {
})

I want to make that the first item which was collected is var1. then the second item which is collected (the last one) will be var2.
But I dont know how to do that

const MsgCollector = inter.channel.createMessageCollector({ filter, time: 15000, max: 2 });
MsgCollector.on('collect', async collected => {
  let item1 = collected.first()
  let item2 = collected.last()
  //kind of this
})
solemn latch
#

if your doing it in the collect event you'll need to make the variables above that scope, then check if item1 is set, if its not then set it. if it is, then set item2

solemn latch
#

the collect event scope

signal estuary
#

Ah ok

signal estuary
signal estuary
solemn latch
#
let item1
let item2
MsgCollector.on('collect', async collected => {
  //all code here runs every time a message is collected

  if(!item1) item1 = collected;
  else item2 = collected; // set if item1 was already set

  //all code here runs every time a message is collected
})
signal estuary
#

didnt thought about an else state xD

solemn latch
#

it honestly doesnt matter if your not using either yet.

let item1
let item2
MsgCollector.on('collect', async collected => 
  if(!item1) item1 = collected;
  item2 = collected; // set the first time, and set the second time, so it will be correct by the time you use it
})
signal estuary
solemn latch
#

so? you hopefully wouldnt be using it yet

solemn latch
signal estuary
regal seal
#

The damn commands to setup applications don’t work

#

./apply ./register ./report

#

None of them work

rocky dagger
#

https://srcb.in/3QO9FJc1mf i have this code and i get an error saying DiscordAPIError: Cannot send an empty message am i making the embed wrong in some way?

proven lantern
#
        { name: 'WANTED', value: `${target}`, },
        { name: 'Condition To Claim', value: `${requirement}`, },
        { name: 'Reward', value: `${reward}`, },
        { name: 'Additional Info', value: `${information}`, },
      )```
rocky dagger
#

when i log it (line 40) it says [ 'afas', 'xcg', 'sxa', 'no extra information' ]

proven lantern
#

await interaction.reply({embeds:[testBounty]});

#

i think that's needed