#development

1 messages · Page 1946 of 1

quartz kindle
eternal osprey
#

How would I save these image web urls to a png file?

#

Could that be done with fs?

quartz kindle
#

you need to download the image

#

you can use any http library

#

like https, node-fetch, axios, etc...

#

then you can store it as a file with fs yes

spark flint
#

^

earnest phoenix
#

encrypting a password is a bad idea

spark flint
#

plain text it KEKW

earnest phoenix
#

somebody remove my embed what the fuck does discord have against mobile

quartz kindle
#

store the password bytes as bytes in a jpeg image

#

make an image of a bunch of hands and arrows pointing at a specific point in the image, and replace the pixels inside that area with the password bytes

#

people will understand but computers will never get it

earnest phoenix
#

OCR

quartz kindle
#

good luck training it

earnest phoenix
#

the arrows are made by a computer

#

so if you use top.gg server to generate the arrows not even a human can understand it

quartz kindle
#

like that

#

and store the password bytes in there

#

and randomize it with different images

#

lmao

spark flint
#

perfect

earnest phoenix
#

that would be resource intensive ,
"Gpu shortage due new safe password generation method"

#

most companies hash the password and crypto miners use the GPU for hashing

quartz kindle
#

bcrypt and argon2 are gpu resistant

earnest phoenix
#

ytho

quartz kindle
#

because we can

earnest phoenix
#

we

quartz kindle
#

wewewe

cinder patio
#

Anyone here ever used pixi.js? I'm trying to apply a filter but It aint working

#

The old film filter

compact pier
#

is that even possible?

#

will those bytes make the image diffrent?

#

like 01011101 is a
and 01011100001 is something else tho

quartz kindle
compact pier
quartz kindle
#

although with algorithms like jpeg its not so simple

#

because jpeg doesnt really use pixels in the common sense

compact pier
#

kinda complicated tho

lyric mountain
#

Jpeg has the weird habit of getting worse every time the image is saved

sudden geyser
#

What part doesn't work.

#

Maybe a syntax error somewhere

wheat mesa
#

anyone else having issues when trying to install @discordjs/opus?

#

I've just got a massive list of errors when trying to npm i @discordjs/opus

#

odd

#

one of the first errors I receive is C:\Users\...\Documents\Auxcord\Auxcord\node_modules\@discordjs\opus\deps\opus\src\opus_multistream.c(29,10): fatal error C1083: Cannot open include file: 'config.h': No such file or directory [C:\Users\...\Documents\Auxcord\Auxcord\node_modules\@discordjs\opus\build\deps\libopus.vcxproj]

#

which is an internal c error so I'm not quite sure how to fix it

quartz kindle
#

because thats not how the channel types are named

wheat mesa
#

I'm not entirely sure what's causing it

opaque acorn
#
$ npm i
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /app/node_modules/abab
npm ERR! dest /app/node_modules/.abab-YC7vESjL
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/app/node_modules/abab' -> '/app/node_modules/.abab-YC7vESjL'

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npm-cache/16.12.0/_logs/2021-12-26T19_17_07_122Z-debug.log
#

?

#

i dont know djs v13 xd

#

wait

#
.setThumbnail(message.guild.iconURL({ dynamic: true }))
#

is the same

#

Did you put .setThumbnail under .setTitle? @earnest phoenix

#

gives error?

#

try something

#

const tns = message.guild.iconURL({ dynamic: true })

#

then in .setThumbnail

#

tns

#

like

#

.setThumbnail(tns)

#

weird

#

ill send my code

#

thumbnailserver

#

my command is like that

#

try

earnest phoenix
#

forgor

opaque acorn
#

tu sabes v13?

earnest phoenix
#

nop

#

sigo en v12.5.3

opaque acorn
#

yo tambien

#

shadow wait for anyone of v13

#

we dont know

quartz kindle
earnest phoenix
#

it'll be <message.author>.displayAvatarURL() in v12

#

message.guild.displayIconURL()

#

wait a sec

#

i'm searching for it

wheat mesa
earnest phoenix
#

oh, it's without display

boreal iron
#

It’s just iconURL()

earnest phoenix
#

my browser crashed lol

quartz kindle
wheat mesa
#

yeah

#

looks like it

#

it's under my x86 program files

#

I have a bad habit of clicking on the x86 versions of things because bigger number

earnest phoenix
#

so for what I came, I came here because some irregular things are happening with my bot. It automatically deletes a random user's all the data (coins, etc..) and sometimes it deletes only some data like some cards or coins. Is there a solution for it? It's json.sqlite format and npm is quick.db (replit's database is weird and with only 50MB as I read it). I'm in replit

wheat mesa
#

I suppose I should reinstall nodejs as 64 bit instead?

quartz kindle
#

in your error log its trying to find a pre-built version of opus for win32

#

which doesnt exist, they only have prebuilt versions for x64

wheat mesa
#

Oh yeah that prob explains it

quartz kindle
#

its not a real solution, but if for some reason you cant build it, then you have to rely on a prebuilt version

earnest phoenix
#

How I can send attachments using a express server

quartz kindle
#

send attachments from where to where?

sudden geyser
#

Is GitHub slow for anyone else today

wheat mesa
#

I believe marcrock is trying to send attachments as a response to a slash command based on what I’ve seen in the detritus server

quartz kindle
#

you're running an interaction server via https?

#

you probably have to use defer

earnest phoenix
#

sad

opaque acorn
#

: |

quartz kindle
wheat mesa
#

Thanks Tim! Got it to install without any issue now

#

onRunError: Error: Cannot create a Buffer larger than 0x100000000 bytes hahahaha, now I've fucked up somewhere

quartz kindle
#

times are already in UTC, they are only converted to your local timezone when you try to see the time as a text string

#

if you want to see the text in UTC as well, you can use for example .toISOString()

#

or other methods

wheat mesa
#

for some reason my buffer is trying to create something larger than 5gb which I have no idea how it's getting that number

#

all I'm doing is ```ts
const buffer = await fetch(attachment.proxyUrl!).then(data => data.arrayBuffer());
const encoder = new OpusEncoder(48000, 2);

const encoded = encoder.encode(Buffer.from(buffer));
#

Maybe I'm supposed to use attachment.url and not attachment.proxyUrl

#

I'll check rq

quartz kindle
wheat mesa
#

Nope same thing

#

Yeah, I have no idea why it's doing that. Logging the buffer I get from fetching is this <Buffer 00 00 00 18 66 74 79 70 64 61 73 68 00 00 00 00 69 73 6f 36 6d 70 34 31 00 00 02 60 6d 6f 6f 76 00 00 00 6c 6d 76 68 64 00 00 00 00 d9 9e e0 56 d9 9e ... 17872 more bytes>

#

Which is the rough size of what I'm sending (about 17kb)

quartz kindle
wheat mesa
#

seems fine to me

#
ArrayBuffer {
  [Uint8Contents]: <00 00 00 18 66 74 79 70 64 61 73 68 00 00 00 00 69 73 6f 36 6d 70 34 31 00 00 02 60 6d 6f 6f 76 00 00 00 6c 6d 76 68 64 00 00 00 00 d9 9e e0 56 d9 9e e0 56 00 00 ac 44 00 00 b4 00 00 01 00 00 01 00 00 00 
00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 ... 17822 more bytes>,
  byteLength: 17922
}
<Buffer 00 00 00 18 66 74 79 70 64 61 73 68 00 00 00 00 69 73 6f 36 6d 70 34 31 00 00 02 60 6d 6f 6f 76 00 00 00 6c 6d 76 68 64 00 00 00 00 d9 9e e0 56 d9 9e ... 17872 more bytes>
#

You need to make sure that the length of the argument to encoder.encode() is a multiple of 2.5ms. Since you are encoding with 16000 and two channels (!) that would be multiple of 1622.5 = 80 frames that is 160 bytes. A good normal window size is 20ms, so that would make you have the data buffer at 8*160 bytes exactly.

#

Problem is I don't know where they're getting these numbers from

quartz kindle
#

then you need to align the buffer

wheat mesa
#

...how?

quartz kindle
#

you need to create a new buffer that is bigger than your buffer and whose size is a multiple of what they require

wheat mesa
#

alright

#
moment.utc(message.guild.createdAt).format('MM/DD/YY, h:mm:ssa [UTC]');
``` is generally how I do it
#

something similar

#

👍

earnest phoenix
#

do you guys recommend me heroku, github and VSC?

wheat mesa
#

I do not recommend heroku unless you have literally no other option

earnest phoenix
#

in addfield

#

it's like ```js
.addField(HI,"HI2", true/false)

#

true/false not needed tho, but te first two are needed

wheat mesa
#

I'm still struggling to figure this buffer thing out. I've got it at one of the specified intervals (a buffer length of 3840) and it still gives me the same error.

earnest phoenix
solemn latch
#

You'll need to escape those characters.

earnest phoenix
#

\

#

with this

solemn latch
#

Doing it on the fly like that will probably take some work.

Not sure the cleanest way of doing so.

earnest phoenix
#

example: h_i_

#

put \ next to _

#

this

earnest phoenix
solemn latch
#

All of them will need to be escaped.
Including | too, and possibly others

#

I'd pull up the list but can't use my pc currently

earnest phoenix
#

will there be a problem? when my bot got in 75+ servers, it asked me the host and I typed replit but now i'm going to change with local one

solemn latch
#

Probably not

earnest phoenix
#

ok

earnest phoenix
#

right

#

i forgot them

#

but you prob dont need to escape <>

#

is this a problem or something? it's not starting like 1h

#

first of all

solemn latch
#

might need to cancel and restart if its been an hour.

earnest phoenix
#

what are those on your taskbar

#

I tried

earnest phoenix
spark flint
earnest phoenix
#

ah

#

meet now, battery etc..

earnest phoenix
#

I can't even reset it because winRE missing and I tried to set the winRE a few times but it's shit

#

finally it started

quartz kindle
#

you dont need to reset windows to remove those shits

earnest phoenix
#

that's not the thing

#

I can't update windows

#

you should have done a clean install after you got your laptop

#

idk I was a kid wen I got this

solemn latch
#

@quartz kindle
know a better way of escaping characters in a username?
Was thinking just str.replace()
but that seems bad since you need to do so on several characters

earnest phoenix
#

but yeah finally it'll be 5 years old and I'll be able to get a new one

quartz kindle
#

you can try using indexOf before replacing

#

but if you need multiple chars, regex will likely be better

solemn latch
#

@earnest phoenix ^

sterile lantern
#

how would i make a command take n inputs instead of just doing args[0], args[1], etc

sudden geyser
#

If you're using slash commands no can do.

sterile lantern
#

well for text-based then

sudden geyser
#

If you're not, you just need to split the message content.

#

e.g. by a space

sterile lantern
#

oh

#

it's possible w a comma right

sudden geyser
#

It's possible with any separator you choose.

#

I'd suggest a space.

sterile lantern
#

also, once i split it, how would i make it so for every n input, it sends a request to an api with each input

#

like 4 inputs: 1,2,3,4
each of them go through the api and give a result

sudden geyser
#

Parse the input into an array

sterile lantern
#

ah ok

sudden geyser
#

e.g.

"1,2,3,4".split(",")
#

Then you can treat it as an array and do your iterations

sterile lantern
#

Yep ty

boreal iron
sudden geyser
#
"1,2,3,4".split(",").join(",").split(",").join(",");
boreal iron
green kestrel
#

anyone else having problems with github being shit slow

#

like 1990s slow

#

4kbps local checkout of a repo in an action... slow golf clap.

#

its been like this ALL DAY and nobody has acknowledged it or updated the status for github or azure

sudden geyser
#

Yeah

#

I thought it was potentially my internet/ISP

#

but see others having the issues

green kestrel
#

does the datacentre have like nobody in it on xmas?

#

thats kinda naff

earnest phoenix
#

for anyone wanting to stay up-to-date with discord.js, make sure you prepare for this change in .setAvatar;
passing strings for urls or icons is deprecated, you now have to pass a single object with options.

Old:

.setAuthor('Name', iconURL())

New:

.setAuthor({ name: name, iconURL: iconURL() })
sudden geyser
#

but why

#

unless the name is nullable that's wack

pale vessel
sudden geyser
#

but why

#

the only thing I see good about embed builders is convenience

#

modeling it after the implementation just destroys that purpose

#

and it ends up being a glorified map again

pale vessel
#

😇

#

Discord.js

sudden geyser
#

Ok there's more to it

#

They were trying to get rid of MessageEmbed in favor of Embed from their builders package

wheat mesa
#

So I have a few questions for anyone that knows what's wrong/how to fix the issue

  1. How would I calculate the Buffer length I need so that @discordjs/opus accepts it and encodes it properly?
  2. Does the sampling rate/channel count need to be changed per file in order for encoding to work?
  3. I keep getting an error of Cannot create a Buffer larger than 0x100000000 bytes, which means my Buffer is improperly aligned, since I'm only sending it about 17000 bytes of data. How would I align it properly?
sudden geyser
#

It seems the only benefit of using Embed is validation. :(

wheat mesa
#

From what I've read it either needs to be a multiple of 2.5, 5, 10, 20, 40, or 60

quartz kindle
wheat mesa
#

Yeah me neither

quartz kindle
#

as for the alignment, just use %

#

newlength = length + 60 - (length % 60)

wheat mesa
#

I just tried that and the problem persists

#
    const encoder = new OpusEncoder(48000, 2);
    const offset = 5 - (buffer.byteLength % 5);

    const aligned = Buffer.alloc(buffer.byteLength + offset, Buffer.from(buffer));

    const encoded = encoder.encode(aligned);

    connection.sendAudio(encoded, { isOpus: true });
``` I've got this
quartz kindle
#

have you tried with 60?

wheat mesa
#

nope I'll try that rq

#

same thing

#

buffer length was 17940, which is indeed a multiple of 60

#

I have a feeling I'm missing something crucial about the formula to calculate the length

#

since that guy pulled 1622.5 out of his ass

quartz kindle
#

there is something to do with your bit rate

#

those were the numbers he got from 16000 and 2 channels

#

you have 48000

#

so try something like 480

wheat mesa
#

I don't even know what to do with 480 is the thing

#

actually hold on

quartz kindle
#

multiple of 480

wheat mesa
#

it throws the same error on a multiple of 480, but when I set the aligned array to 480*8 bytes, it doesn't throw an error

#

however I don't hear anything in vc either

#

granted that might just be because there's not much voice data contained in 3840 bytes

#

less than a third of a second of data p sure

#

same thing works with 480 * 32 length

#

it seems like it throws that error if the length of the new buffer is bigger than the length of the old

#

it only seems to work with 480 * x where x is a multiple of 8 and the total does not exceed the original buffer length

maiden swan
#

idk if anyone can help me but idk how to fix the error of missing a required positional argument on an optional slash command option

wheat mesa
#

only seems to work up to 32

#

which obviously will not be enough to play most files

#

not to mention it just doesn't play any audio either

#

this just doesn't make any sense to me lol

split hazel
#

I pulled shit out of my ass

quartz kindle
#

nice

#

did it smell good?

quartz kindle
#
    Buffer<char> buf = args[0].As<Buffer<char>>();
    char* pcmData = buf.Data();
    opus_int16* pcm = reinterpret_cast<opus_int16*>(pcmData);
    int frameSize = buf.Length() / 2 / this->channels;

    int compressedLength = opus_encode(this->encoder, pcm, frameSize, &(this->outOpus[0]), MAX_PACKET_SIZE);
wheat mesa
#

I'm using somebody else's opus now, I was having too many issues with that

quartz kindle
#

lmfao

wheat mesa
#

they're helping me

quartz kindle
#

ok

sudden geyser
#

is that c or c++

quartz kindle
#

cpp

quaint wasp
#

hey

#

so...if

#

I define this person as this: ```js
let dUser = message.guild.members.fetch(message.mentions.users.first()) || message.guild.members.get(args[0]);

#

how can I send a dm to them?

#

I've tried .member.send, .send, .user.send, .member.user.send but non worked

sudden geyser
#

You can use message.mentions.users.first() by itself since it'll be a User instance.

split hazel
sudden geyser
#

You should be able to call .send(...) on it afterwards.

quaint wasp
#
TypeError: dUser.send is not a function```
sudden geyser
#

But where you go wrong is how you handle the args

quaint wasp
#

u talkin to me?

#

I mean I've just removed the args part since I found it useless

sudden geyser
#

Then can you show your current code

quaint wasp
#
        let dUser = message.guild.members.fetch(message.mentions.users.first())
sudden geyser
#

Again, you don't need to wrap it in that fetch

quaint wasp
#
       dUser.send(`...`)

sudden geyser
#

Since you already have the user instance.

#

So remove that message.guild.members.fetch part

quartz kindle
quaint wasp
#

oh

sudden geyser
#

And it should work

#

Your current error is due to .fetch returning a Promise. You're trying to use it as a GuildMember instance.

plucky sinew
#

i have a doubt...

#

ive been making this discord bot

#

but ive been getting a rate limits exceeded error

#

it happens from time to time and idk what to do to stop it

#

this is the error im getting

sudden geyser
plucky sinew
#

yea

sudden geyser
#

Then it may be due to the shared environment of the platform.

#

Other bots' activity may be influencing the rate limit.

plucky sinew
#

ohh

#

shoot

sudden geyser
#

A solution would be to get your own dedicated environment.

plucky sinew
#

oh

#

ok thx for the help

gentle condor
#
class Dropdown(nextcord.ui.Select):
  def __init__(self,client):

      options = [

        nextcord.SelectOption(label = "Moderation",description = "Set of mod commands",emoji = ":G_Moderation: "),
]
      super().__init__(placeholder = "Choose command options",min_values=1,max_values=1,options=options)
      self.client = client

  async def callback(self,interaction:nextcord.Interaction):

    if self.values[0] == "Moderation":

      mod = nextcord.Embed(description = "**Moderate your server with these commands.**",color = 0xED4245)
mod.set_thumbnail(url = self.client.user.avatar.url)

      await interaction.response.edit_message(embed = mod)


class DropdownView(nextcord.ui.View):
  def __init__(self,client):
      super().__init__()
      self.add_item(Dropdown())


class help(commands.Cog):
  def __init__(self,client):
      self.client = client

  @commands.command()
  async def help(self,ctx):
    view = DropdownView()
    await ctx.send("hi",view = view)


def setup(client):
client.add_cog(help(client))

Im trying to get my bot's avatar for my help command
but Im getting an error __init__ missing a required arguement "client"
can someone help?
nextcord

earnest phoenix
#

Dropdown requires a client arg but you passed nothing

#

DropdownView also does

earnest phoenix
#

So Im trying to make a bot that reads a message that says

{
  "value": "10"
}

and replies with

10

#

I was considering making the bot command prefix { but realized it probably would have an issue with a command of "value"

#

because of the quotations

sudden geyser
#

So you want to parse JSON

earnest phoenix
#

the message is in json format, but its not actually json, I dont think

sudden geyser
#

Well, it is some format, so using some existing parser to extract "value" would be nice.

earnest phoenix
#

I have one bot that says

{
  "value": "10"
}

as a message

Trying to get another bot to read that and reply
10

sudden geyser
#

Let's say our command is -read <message-id>

#

Assuming it is JSON, you can use Python's built-in json module.

#

Which will turn it into a dictionary

#

So you can get value easily

#

But it could be more complex

#

Maybe you want to ignore markdown or surrounding text as well

earnest phoenix
#

when I tried that I got

  File "c:\Users\Hal\Desktop\scalene\discord\bot.py", line 16, in on_message
    parsed_json = (json.loads(message))
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not Message
sudden geyser
#

That's because you're giving it a Message instance.

#

You should be giving it a string.

#

Aka the .content

earnest phoenix
#

oh ok

#

so message.content

sudden geyser
#

Yep

earnest phoenix
#

cool ^^ ty

#

cool, now to deal with 1000 other bugs 😂

#

await bot.send_message(channel, content = embed)

does this need to be ctx? Im not really sure the difference but I see ctx everywhere

sudden geyser
#

You can see if it does in the documentation.

earnest phoenix
#

I managed to get it when I type a test message of

{
"value": "10"
}

but realized the bot is actually sending

{
 "value": "10"
}
#

specifically this

#

which I believe is a poorly formatted embed

compact pier
#

@earnest phoenix read this

earnest phoenix
#

original
parsed_json = (json.loads(message.content))

updated
parsed_json = (json.loads(message.description))

#

is it this easy?

plucky sinew
#

what is message.description supposed to return

earnest phoenix
#

embed description

plucky sinew
#

oh

#

what is this whole thing supposed to do actually

earnest phoenix
#

If I get this setup the bot takes webhooks from blocknative and integrates blockchain mempool data into discord in an embed.

#

cus Im not on testnet each test costs $2.80 😅 yes I could be on testnet but I thought this would be quick and easy

#

bot command would work wonders 😂

plucky sinew
#

ok so what are u trying to do with this code

earnest phoenix
#

I'll dm you probably easier

earnest phoenix
#

Because you're sending every single result that was found, and the reason it returns many results for that query is because Tenor's search endpoint does not support punctuations properly much, only get the first result, see if it exists then send it

woeful pike
#

why would you do that when you can just grab the first result

earnest phoenix
#

Not a bad idea but some punctuations are supported

#

Then get a random result from the array of results

woeful pike
#

limit it with slice

gentle condor
earnest phoenix
gentle condor
#

ok

#

and btw does @client.group() work in cogs @earnest phoenix

earnest phoenix
#

It does, but it's not intended

#

Of course you can do it inside the __init__ method, but that's hacky

#

Use commands.group instead

gentle condor
#

im using

@commands.group(invoke_without_command=True)

#

@earnest phoenix OMG it worked ty

#

I'm probably sounding like an idioit but ty

surreal sage
#

Can you forEach a JSON structure? { }
If yes, how?

spark flint
#

<object>.forEach(variablename)

surreal sage
#

I thought I tried that but i'll double check

spark flint
#

{“1”:”2”}

variablename would return 1
<object>.variablename would return 2

#

Iirc

surreal sage
#

forEach is not a function

#

I could just toString replace { } to [ ] and back to json

sacred aurora
#

or you can do

Object.keys(theObject).forEach
surreal sage
#

Keep object like that?

spark flint
#

^

sacred aurora
surreal sage
#

Object.keys(thatJSONthing).forEach

sacred aurora
#

yup

surreal sage
#

straight up like this?

#

Ight

#

Wanted to be sure

sacred aurora
#

it'll get all the key

surreal sage
#

ty

sacred aurora
#

then you can just do theObject[key]

earnest phoenix
#

remember that the keys will not always appear in the same order

sharp saddle
#

Help me

Main.java:20: error: cannot find symbol
      Message message = event.getMessage();
      ^
  symbol:   class Message
  location: class Main
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
1 warning```
![KEKW](https://cdn.discordapp.com/emojis/727825308404940800.webp?size=128 "KEKW")
earnest phoenix
#

but the first answer seems to explain it rather well

sharp saddle
#

ok

spark flint
#

Is it possible to wildcard SSL with Cloudflare?

modest maple
#

cloudflare already manages that within it's TLS system

#

i.e just wildcard the domain

spark flint
#

Ah ok

#

Epic thanks

solemn jolt
#

hello i want a good host for my bot

spark flint
#

Kick then readd iirc

solemn jolt
#

i want per years free or payed no matter

spark flint
#

£1.50 a month for 2gb ram VPS

#

Or plox.host for haas (hosting as a service) bot hosting

solemn jolt
#

ok ty

spark flint
#

Np

solemn jolt
#

but you have any host to pay per year not months

spark flint
still storm
#

Hey guys, im making premium system to my bot. People voted to make it per-user. How can i make it, and should i make it using codes (/premium redeem <code>) or to user logged into dashboard

#

How can i make it charge every month/year

#

Patreon can be

#

But i would want to charge thru dashboard instead of redirecting to patreon

boreal iron
#

Well you define guild as ID… not as guild object

#

interaction.guild.members.kick(…)

#

Yeah I wonder why you would define a var for it

honest flicker
#

Hi

spark flint
#

No need to say hi in every channel LMAO

#

Uhh

#

Just button lol

#

Lol

#

Nice

tulip ledge
#

check perms before sending the confirmation message

#

✔️✖️ also try using these

#

instead of confirm and cancel

#

might look cleaner

drifting coral
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'dict' object has no attribute 'key'

boreal iron
#

When clicking the button you will receive another interaction event

#

No need to use collectors

small tangle
#

Give it a concise component id and process it by that

#

I mean the button

slender thistle
#

What did you do

boreal iron
#

No... the interactionCreate event

compact pier
#

message.channel.send(text).then(m => m.delete()) ?

boreal iron
#

That's the reason you gotta use unique IDs on your components

#

Once the button is pressed you check in your event if the interaction is a button interaction and taking aktion based on the unique ID

small tangle
#

The only way to make a button click locked to a user is emphemeal (?) Or? I mean you could bake the user id into the component id and parse it back

boreal iron
#

Wut?

#

how do i timeout the cmd

#

What do you need to "timeout"?

#

Well yeah a timeout is the easiest way.

#

When sending the message with the buttons, await the promise which returns the whole message object (of the sent message) and remove the components in your timeout, or disable them.

#

huh that's the easiest way I'm aware of

#

wait a second

#

And how about using then() instead of awaiting the promise?

earnest phoenix
#

map the row buttons and set them to disabled then edit the message with the new row

#

after interaction.reply()

#

hmm

#

wait i just gave you a detritus example

boreal iron
#
reply().then((message) =>
{
  setTimeout(() =>
  {
    message.edit({ content: message.content, components: null });
  }, 15000);
});
#

omg dude...

earnest phoenix
#

the .then returns a message not an interaction

boreal iron
#

paste it and watch the magic

earnest phoenix
boreal iron
#

You may wanna watch the docs

earnest phoenix
#

Can you edit a embed using embed.editReply or something?

boreal iron
#

A reponse, the text you see, is always a message

#

The interaction is what the client does

earnest phoenix
#

o-o

boreal iron
#

Dude... that can NEVER work

#

Of course it does.

#

I'm disabling my buttons, too

earnest phoenix
#

what buttons

#

``` await embed.edit({content: **Break Approved**, embeds: [embed], components: [row1]})

Error: `embed.edit is not a function`
boreal iron
#

You completelly misunderstanding the difference between the interaction and the actual message (response)

earnest phoenix
earnest phoenix
#

interaction.edit?

#

think about what you're supposed to edit

#

The embed.

earnest phoenix
earnest phoenix
#

I'm editing another embed in another channel.

short furnace
#

why do u need to be 16 or older to verify a bot

#

makes no sense

boreal iron
#

Because nobody wants kids in their system

earnest phoenix
#

message.channel.send().then(msg => msg.edit({ embeds: [modifiedEmbed] }));

short furnace
#

my bot just hit a 100 servers and i cant provide

#

an id

#

or whatever

short furnace
#

they want

earnest phoenix
boreal iron
#

Show me what you actually did.

#

I see

solemn latch
#

👀 does that actually work

boreal iron
#

We forgot the fetch reply option

pale vessel
#

Add fetchReply: true after ephemeral

boreal iron
#

Aye

earnest phoenix
#

f here to save the day

boreal iron
#

Well the docs are well written

#

Use the fetchReply option to get the bot's reply message.

#

You just have to read the BIG HIGHLIGHED TEXT, FakE

#

Yes I know.

earnest phoenix
boreal iron
#

I feel like the ghost of Erwin is around

quartz kindle
#

the ghost of erwin haunts top.gg

#

it will never go away

boreal iron
#

I knew it

earnest phoenix
#

o-o So erm

#

Anyone know how to edit a embed upon clicking a button? TC_Pepe_UwU

earnest phoenix
pale vessel
#

👉👈

quartz kindle
#

run!

earnest phoenix
pale vessel
#

Okay, how?

earnest phoenix
#

I gave a code example

#

interaction.reply().then(msg => msg.edit({ embeds: [modifiedEmbed] }));

#

Its not a reply tho!!

#

Its sending to a whole another channel

#

const updates = client.channels.cache.get('923246751442403398')
const ch = client.channels.cache.get('925045878337732719')

boreal iron
#

There's no edit function for interactions

earnest phoenix
#

ch.send({ content: ` **Pending Break Request**`, embeds: [embed], components: [row] })

boreal iron
#

You can only edit the reply

sudden geyser
earnest phoenix
#

hmm do button clicks allow you to access the message it was triggered from

boreal iron
earnest phoenix
#

im dumb

quartz kindle
#

wat

earnest phoenix
#

why can't you declare the variable beforehand

#
      const updates = client.channels.cache.get('923246751442403398')
      const ch = client.channels.cache.get('925045878337732719')


      const row = new MessageActionRow().addComponents(
        new MessageButton()
          .setLabel("Accept")
          .setStyle('PRIMARY')
          .setCustomId('accept'),

        new MessageButton()
          .setLabel('Deny')
          .setStyle('DANGER')
          .setDisabled(false)
          .setCustomId('deny'))

      const row1 = new MessageActionRow().addComponents(
        new MessageButton()
          .setLabel("Accept")
          .setStyle('PRIMARY')
          .setDisabled(true)
          .setCustomId('accept'),

        new MessageButton()
          .setLabel('Deny')
          .setStyle('DANGER')
          .setDisabled(true)
          .setCustomId('deny'))


      const embed = new MessageEmbed()
        .setAuthor(`New Pending Break Request`, interaction.guild.iconURL())
        .addField(`User:`, `${interaction.user.tag} | ${interaction.user.id}`, true)
        .addField(`Reason:`, `${reason}`, true)
        .addField(`Duration:`, `${duration}`, true)
        .addField(`Department:`, `${department || "All"}`, true)
      ch.send({ content: ` **Pending Break Request**`, embeds: [embed], components: [row] })


      const embed1 = new MessageEmbed()
        .setAuthor(`Request Approved`, interaction.guild.iconURL())
        .setDescription(`Break was approved.`)
        .addField(`User:`, `${interaction.user.tag} | ${interaction.user.id}`, true)
        .addField(`Reason:`, `${reason}`, true)
        .addField(`Duration:`, `${duration}`, true)
        .addField(`Department:`, `${department || "All"}`, true)

      const embed2 = new MessageEmbed()
        .setAuthor(`Break Approved`)
        .setDescription(`${interaction.user.tag} | (\`${interaction.user.id}\`)'s break was approved.`)
      //updates.send({content:`<@${interaction.user.id}>`, embeds:[embed2]})


      const collector = interaction.channel.createMessageComponentCollector();
      const wait = require('util').promisify(setTimeout);

      collector.on('collect', async i => {
        if (i.customId === 'accept') {
          await i.deferUpdate()
          await wait(100);
          await i.edit({embeds: [embed], components: [row1]})
          await updates.send({ content: `<@${interaction.user.id}>`, embeds: [embed2] })
#

There it all is 🤣

#

The magik

boreal iron
#

my gosh... takes like 3s to scroll through

quartz kindle
#

what is that wait for?

earnest phoenix
#

never have i been more glad i use detritus

quartz kindle
#

lel

quartz kindle
boreal iron
#

Yeah... was about to say that

quartz kindle
#

how does detritus do it?

earnest phoenix
boreal iron
#

Nobody knows why people are using collectors for interactions

quartz kindle
#

yeah

earnest phoenix
boreal iron
#

I would say because people don't understand an interaction and the event it triggers

#

But yours might be true, too

earnest phoenix
#

so erm, is there a way to edit the embed?

quartz kindle
#

i used to have a reaction menu before buttons, but i didnt use collectors

#

i used the reactionAdd events

earnest phoenix
#

It should have a message property

boreal iron
#

How dare you Tim for not using collectors

solemn latch
#

I did reactionAdd events too 👀
but because tim said he did KEKW

quartz kindle
#

lmao

earnest phoenix
#

Even the top.gg staff learns from tim

earnest phoenix
quartz kindle
#

now that i switched to buttons i use the raw event instead

earnest phoenix
earnest phoenix
quartz kindle
#

because im still running djs v12

earnest phoenix
quartz kindle
boreal iron
#

Ok... somebody throw Tim out of this channel

quartz kindle
#

lmao

boreal iron
#

v12 ... pff

#

Old ass

earnest phoenix
boreal iron
#

We're moving to v14 already, Sir

quartz kindle
#

im not even gonna use v13

earnest phoenix
quartz kindle
#

and im not gonna support light for v14 either

earnest phoenix
earnest phoenix
#

Not interaction?

#

the interaction is what the user does not your bot

quartz kindle
#

afaik it should be i.update()

#

but idk how djs does interactions

wheat mesa
#

Btw Tim I got it to work finally

quartz kindle
#

oh?

wheat mesa
#

Started using @evan/opus instead and turned my audio files into raw pcm streams with ffmpeg

earnest phoenix
#

evan

wheat mesa
#

Then the rest was easy

quartz kindle
#

god bless evan

wheat mesa
#

Yes

#

He helped me a lot getting it set up properly since I’ve never done much with audio stuff

earnest phoenix
#

god bless timotej roiko

quartz kindle
#

Lol

#

how dare you use my almost full name

earnest phoenix
#

Timotej Qt Epic Programmer Roiko

quartz kindle
#

lmao

#

guys i need name suggestions

#

for a lib

#

to compete with messagepack

sudden geyser
#

naming as a service

wheat mesa
#

Tim.js

boreal iron
#

BetterMessagePack

quartz kindle
#

besides that

sudden geyser
#

better-msgpck

#

god damn it

quartz kindle
#

lmao

boreal iron
#

Move on klay

wheat mesa
#

messagepack++

sudden geyser
#

uberpack

quartz kindle
#

its a different protocol tho, so its a different thing, not a better version of the same thong

#

thong

sudden geyser
#

is the project public

boreal iron
#

DifferentMessagePack

wheat mesa
#

DifferentProtocolMessagePack++

boreal iron
#

lmao

quartz kindle
#

lmao

#

i give ip

#

up

boreal iron
#

That was fast

#

Ha, broke Tim! goal archived

sudden geyser
#

if you can't think of anything'

quartz kindle
#

you guys know how to disappoint me

#

xD

sudden geyser
#

just look up some archaic greek word and name it that

quartz kindle
#

alphapack

sudden geyser
#

alpha male

wheat mesa
#

Sigmapack

quartz kindle
#

alphapacker + betaunpacker

boreal iron
#

huh?

#

It does only fetch the message you sent

#

The response to your interaction

near zephyr
#

hello how can support

quartz kindle
#

yes

earnest phoenix
boreal iron
#

Support very expensive

earnest phoenix
#

Unitu tekh suport

near zephyr
#

Is it free to throw my imgur links?

wheat mesa
#

yes

#

Support is free

quartz kindle
#

my name is john smith i am a certified microsoft technician and i will repair your computer for only 399 a year

wheat mesa
#

No need to confuse him if he needs help!

#

Yes but it’s mean :(

boreal iron
#

@earnest phoenix We need some indian tech support here

near zephyr
#

Look, I want to put a banner on togg, I'm uploading the imgur link, it's giving a link, I'm writing to the banner posting section, I don't accept it, I say get imgur, but I can't get the imgur link

spark flint
near zephyr
#

.

spark flint
#

oh

#

send the link here

#

make sure is the direct link

boreal iron
#

Oh I notice that's you lol

near zephyr
wheat mesa
#

Uh ok

spark flint
#

make it that

near zephyr
#

https://imgur.com/a/rzjyltj

boreal iron
#

Support denied

spark flint
#

yep

earnest phoenix
quartz kindle
#

no

near zephyr
earnest phoenix
#

@spark flint where do i get this emote

boreal iron
#

did you even exlain your issue or send some codish code?

spark flint
#

:painn

sudden geyser
#

I'm trying to sign a JWT with HMAC. Am I doing this right?

openssl rand -hex 32 # Generate random key for HMAC
openssl dgst -sha256 -hmac <key> /bin/ps # Generate secret to sign JWTs with.
spark flint
#

there

near zephyr
#

.

boreal iron
#

wtf I don't understand one word

spark flint
#

pain there @earnest phoenix

near zephyr
#

I can't put banner :/

earnest phoenix
#

h

compact pier
#

@near zephyr reload the page

earnest phoenix
#

it does h

wheat mesa
#

Your code just waits for the interaction to be replied to

#

Just remove the .then and edit the message after 15 seconds

#

If no interactions have come through on the buttons

earnest phoenix
#

top.gg is so bad they fucked up a regex

boreal iron
wheat mesa
#

I’m confused

near zephyr
wheat mesa
#

You want to edit it after 15 seconds of no buttons being pressed, right?

compact pier
boreal iron
#

It's a known issue on the site iirc

compact pier
#

@earnest phoenix dude, it is the same thing to reload the page

near zephyr
#

: |

#

yes but some

wheat mesa
#

After this reply is sent, the code then waits 5 seconds before editing the message regardless of what buttons have been pressed or not

#

From my understanding at least

compact pier
#

:v bro, why u need to so toxic. When u are asking and need help here too. People just want to help other

slender thistle
solemn latch
#

Cache stinky

gilded plankBOT
earnest phoenix
#

br fail

solemn latch
#

Remember the days brs didn't have luca tags? 👀

modest maple
#

not really

wheat mesa
#

No I pretty much agree

#

I didn’t

#

No

#

I’ve never used it

solemn latch
#

I always manually cleared cache lmao

wheat mesa
#

I’ve asked tons of stupid questions in the past

compact pier
#

well I don't care a lots, but we need stop argue here. Here is for asking question not about if ppl know something :))

boreal iron
#

SHIFT R is chrome specific, any other browser uses CTRL R

wheat mesa
#

It’s ok to not know things

boreal iron
#

just to say

sudden geyser
#

built different huh

wheat mesa
#

Nobody knows everything that’s why channels like these exist

boreal iron
#

And nobody uses chrome without a weapon at his head

wheat mesa
#

(Except maybe Tim, I’m pretty sure he knows everything)

solemn latch
slender thistle
#

Just shut the fuck up and move on you lot

#

That convo isn't worth having anymore

modest maple
#

the only difference is what level it happens at lol.

You get people shitting on beginners for making silly mistakes

and then those same people will go ahead and do the equivalent silly mistakes in front of people far more experienced going notlikeduck Normally though more experienced people dont shit on them as unintelligently lol

compact pier
#

dude, stop. I don't want to fight with u

earnest phoenix
boreal iron
#

Move on Erwin

slender thistle
wheat mesa
#

Check for buttons being pressed, and if they have then don’t run the message.edit

earnest phoenix
compact pier
slender thistle
#

If roles define my value then I'll gladly have none just to prove my point

modest maple
#

are rolls now a scale of how reasonable someone is lol 🤣

slender thistle
#

I'm not gonna continue that conversation here

modest maple
earnest phoenix
#

let buttonPressed = false;
when button is pressed buttonPressed = true;

in the timeout
if (buttonPressed) return;
// rest of the code

earnest phoenix
#

Except I'm purple name

solemn latch
compact pier
#
setTimeout(() => {
  if(buttonPressed) return message.edit(text)
}, 15000) // 15 sec
wheat mesa
spark flint
#

whatever bot gives the bot dev role is broken

earnest phoenix
#

no thanks, i can't sacrifice my life and sit all day testing every single cringe command in an indian bot

modest maple
boreal iron
compact pier
#
#

here

wheat mesa
#

...by making a variable?

compact pier
#

is the way

earnest phoenix
#

Ew

compact pier
#

here too

wheat mesa
#

Then when a button is pressed you set it to true

compact pier
modest maple
#

im confused how uneducated can people be

earnest phoenix
wheat mesa
#

After 15 seconds you check buttonPressed to see if it’s true or false

#

If it’s true then return

modest maple
wheat mesa
#

If it’s false then run your edit

compact pier
#

wrong lib

wheat mesa
#

No

#

Correct lib

earnest phoenix
compact pier
#

he use detri.. ? ( can't spell)

wheat mesa
#

No

earnest phoenix
#

say it out

wheat mesa
#

But it’s the best

#

Detritus on top

#

What

earnest phoenix
modest maple
earnest phoenix
#

use a map function

compact pier
wheat mesa
#

for(const button of row.components) { button.setDisabled(true) }

earnest phoenix
#

wait setDisabled mutates row.components

#

use a for loop instead

#

I'm confused how uneducated people can be

solemn latch
#

not this again angeryBOYE

boreal iron
#

channel very weird today

solemn latch
#

only reason I didnt give out warnings was because it looked like you all would resolve it quickly yourselves.
please stop

compact pier
#

homo time

sudden geyser
#

this server is great for beginners

wheat mesa
#

I’m confused at how educated people can be freerealestate

sudden geyser
#

so it's best not to discourage them

solemn latch
wheat mesa
#

Just use compliments instead!

#

(Tim)

earnest phoenix
compact pier
solemn latch
#

yes

wheat mesa
#

Tim is a walking js doc

sudden geyser
#

yeah, they're leading you down the right path

earnest phoenix
modest maple
#

This server is basically beginners shitting on each other lol

sudden geyser
#

to learn discord.js you need to learn javascript

#

so they're trying to encourage you to take the right path

#

of course you can learn without knowing js but it's harder

#

much harder

earnest phoenix
#

true

wheat mesa
#

Asm

earnest phoenix
solemn latch
#

I learnt binary before I learnt js

#

even wrote a bit of machine code before js

compact pier
#

have anyone tried brainfuck? it is much better

wheat mesa
#

The first ever code I wrote was in js

earnest phoenix
wheat mesa
#

Unless you count scratch as code in which case you’re a psychopath

compact pier
earnest phoenix
#

first code i ever wrote was javascript
but without the script pain

wheat mesa
#

Scratch teaches the beginnings of code

wheat mesa
#

I wrote js when I was like 7 or 8 at a summer camp

#

Was really boring

#

Then I rediscovered it later

compact pier
#

u guys just too noob, my first code is 🌟 HTML 🌟

wheat mesa
#

Thought it was really fun

compact pier
#

the best "programming language"

earnest phoenix
#

Yep

#

Just open a script tag

solemn latch
#

html is actually not bad for getting comfortable with writing technical stuff.

earnest phoenix
solemn latch
#

you can instantly see changes

compact pier
#

imagine getting an error in HTML

earnest phoenix
compact pier
#

:))

wheat mesa
#

HTML is designed so that browsers can try their best to interpret it even if it’s technically wrong

compact pier
#

"I write 5000 lines of code and it work at the first time, with no error" - HTML devs

earnest phoenix
earnest phoenix
solemn latch
#

would errors in html even make sense?

earnest phoenix
solemn latch
#

yes

compact pier
#

nah I think html is just perfect with no bugs

earnest phoenix
solemn latch
#

css errors could work.

compact pier
#

I think if the css makes error then it just won't run that part

#

it won't show the error

solemn latch
#

trying to apply properties on !important things.
no existing element etc

#

but most editors do all that

compact pier
#

and we just have to wonder why the div is not centered

earnest phoenix
#

use a bulma button and then change the background to a custom color forced with !important

#

instant break

compact pier
#

btw now using plain html and css for a website

#

uhh it sucks man

modest maple
compact pier
#

only cave man

earnest phoenix
#

dead chat xd

compact pier
#

nobody have questions tho

spark flint
earnest phoenix
#

question: is there still a use for xml

#

in js use at least

compact pier
#

json is just too good man

earnest phoenix
#

can't use json properly in other languages

compact pier
#

yeah for "old languages"

sudden geyser
#

e.g. logback

#

but that's java

compact pier
#

lol the word "ancient"

modest maple
sudden geyser
#

most libraries and frameworks will abstract XML away from you

modest maple
compact pier
#

xml is the <tag> thingy right?

modest maple
#

yes

compact pier
#

ahh

modest maple
#

essentailly

compact pier
#

then yeah

modest maple
#

its a very basic format / markup

compact pier
#

in React is very common

#

like the most importain

sudden geyser
#

I don't think that's the kind of XML we're talking about

modest maple
#

shrug It's from XML's family

#

it has every right to be included as a use for XML

sudden geyser
#

not really

modest maple
#

otherwise we would have to limit to "Is there any modern uses for SOAP still"

compact pier
#

so Html is based xml or the other way?

modest maple
#

because that's what you're talking about lol

sudden geyser
#

there are a lot of things that are part of some family but act completely different

#

It's like Java being part of the C family. Sure, it shares similar syntax, but that's about it.

earnest phoenix
#

Okay, so with buttons, how do I make it so that it does not give the role to the person who clicked the button, but the person who used the command?

interaction.member.roles.add('911236347912679424')```
That just gives it to the person who clicked the button
sudden geyser
#

I write Java so I don't have to work with pointers 🙃

compact pier
earnest phoenix
#

v13

#

I think its member

compact pier
#

they are the same

#

member == author.user

earnest phoenix
#

One is user one is member, those two are different.

#

Iirc user can't have roles.

#

Didn't think so

compact pier
#

nope

#

it doesn't

#
#

but you can get id and then from the guild.members to get it

earnest phoenix
modest maple
wheat mesa
#

User objects aren’t associated with guilds, Member objects are

modest maple
#

HTML just adds a few standard attributes to nodes

#

but HTML is valid XML

earnest phoenix
#

Yes but a user can't have roles o-o

sudden geyser
#

yeah I get that

compact pier
modest maple
#

and things like libxml are used for parsing the HTML DOM because it's just a XML DOM

compact pier
#

dude I thought about message.author

wheat mesa
#

Author is a user object though isn’t it?

sudden geyser
#

but the op probably meant XML in a way of "will I have to work with XML occasionally like we do with JSON"

compact pier
sudden geyser
#

config files, sending xml over the wire, parsing it by hand, etc.

#

that fun stuff

compact pier
#

and then access the .roles from user

wheat mesa
#

Just use message.member

#

That’s a Member object of the author

compact pier
#

but that is message

#

we mean interaction here

wheat mesa
#

Oh

compact pier
#

I missunderstood there too

#

:))

wheat mesa
#

Then use interaction.member

compact pier
#

bruh

#

it has

compact pier
earnest phoenix
#

Sounds good

#

Ty

compact pier
#

I haven't tried those button and slash command thingy, so I don't know so much about it

wheat mesa
#

The djs docs are quite nice

compact pier
# wheat mesa

I didn't saw it lol, so had to take the member from guild.members

boreal iron
#

You're speaking about OAUTH?

solemn latch
#

Most of the time that's done separately from discordjs

boreal iron
#

Members have roles, uses don't

#

(and permissions)

#

member

#

not members

wheat mesa
#

^^

#

What

#

It’s interaction.member.blah blah blah

boreal iron
#

I sometimes feel like you don't speak English... might just be me

wheat mesa
#

Alternatively if you’re checking permissions you can do interaction.memberPermissions

boreal iron
#

DUDE

#

PERMISSIONS.has

wheat mesa
#

Because you have to do interaction.member.permissions.has()

boreal iron
#

even on v12 member.has doesn't exist

#

That method still has the term "permission" in it, hasn't it

wheat mesa
#

No need to argue

boreal iron
#

member.has() doesn't

solemn latch
#

Why has this channel been so stinky today

boreal iron
#

wtf

wheat mesa
#

People getting their Christmas venting out of the way KEKW

boreal iron
#

exlpaining it until the dead end, Sir

wheat mesa
#

Personally I think a lot of the questions asked can be solved using the docs

#

That’s just what I’ve been using to answer them, I don’t even use djs lol

solemn latch
#

I tried that for a long time.
A lot of people dont like reading docs, so they don't understand and just becomes more of an issue.

boreal iron
#

yeah it does still exist

lyric mountain
#

Xwass orange?

#

Must have been my imagination

earnest phoenix
#

why tf my env ain't working (today i'm moving to VSC, git and heroku)

#
DBL_TOKEN=NOPE
lyric mountain
#

Moving "to" vsc?

earnest phoenix
#

yeah from replit

sudden geyser
#

Your app probably isn't loading it.

lyric mountain
#

You're moving to heroku, not vsc

#

Vsc is a tool

earnest phoenix
#

yeah that

#

¯_(ツ)_/¯

lyric mountain
#

Heroku has its own env

earnest phoenix
#

but I haven't connected to heroku

#

i'm with vsc

wheat mesa
#

ENVs in normal environments are different than replit envs iirc

lyric mountain
#

Terminal then

#

How are u adding env?

wheat mesa
#

Are you using the dotenv package

earnest phoenix
#

yep

wheat mesa
#

Are you getting an error when you try to access the env variable?

earnest phoenix
#

nope

#

it's saying "Top.gg token is missing"