#development

1 messages · Page 89 of 1

lyric mountain
#

because u can just to SELECT * FROM table ORDER BY row_n DESC LIMIT 1

#

the last row will always have the same number as the total count

#

or -1 if u start with 0

crystal wigeon
#

Yea but if I use filters it won’t

#

Something like filtering by name

lyric mountain
#

still

#

use a subquery

crystal wigeon
#

Row number will be what position it’s on but total count might be different

lyric mountain
#

simply use a lone subquery to get the highest entry

crystal wigeon
#

brb hang on

crystal wigeon
#

so this is the full query

lyric mountain
#

told ya what u can do

crystal wigeon
#

yeah trying to re-do it haha

lyric mountain
#

also, use GROUP BY instead of OVER (...) whenever possible

crystal wigeon
#

gotcha

#

going back to this query, what would i do if im trying to choose multiple row numbers?

#

like 5, 10

#

maybe run the same query twice hmmm

lyric mountain
#

WHERE row_n IN (row_numbers)

crystal wigeon
lyric mountain
#

no, you'll need to retrieve rows normally

#

using a where clause

crystal wigeon
#
SELECT *
FROM collections
WHERE user_id = 1
  AND NOT is_item
ORDER BY rank_id DESC, id
OFFSET :row_n LIMIT 1```
lyric mountain
#

using offset is much faster, but it only allows 1 row

crystal wigeon
#

ye figured, so make this a sub query or split query ig

#

alr

#

should be faster either way, thanks

lyric mountain
#

yw

sterile brook
#

Interesting thing, any thoughts?
i have slash command that works just fine on my pc as host, but when i setup bot on another host , command gives that error
Can provide command code if needed

lyric mountain
#

lag probably

crystal wigeon
#

happens with me as well mmm, for every message it sends

solemn latch
#

Is it possibly slower?

crystal wigeon
# lyric mountain lag probably

btw for the get all query, when a filter is passed like a -name, i will need to count how many rows exist with that name right? if i moved the total count and row number outside, how would i be able to get this total count

#

for example: full inventory = 500 rows, but if filtered by name it would be 200 rows,

lyric mountain
crystal wigeon
#

so multiple queries

#

gotcha

lyric mountain
#

yes, to get the total it'll always be a single, lone query

#

regardless of the rest

crystal wigeon
#

whats the API route to update server count on topgg again?

neon leaf
#

did anyone ever work with prisma before? How can I only push if I dont already have the id in the array? (I know I could fetch before and check with that but is there a more efficient way?)

digital swan
neon leaf
#

well there isnt an error

#

it just pushes, like the function says

digital swan
#

ohhh i misread

lyric mountain
crystal wigeon
#

yeah i found it

surreal sage
#

I'm trying to get the number before any other non-number character in strings such as 40/notifications,{"sid":"xxxx"}
I'm using the regex /^[0-9]{0,}/g
However, on the string I just showed, javascript returns null

#

Might be the global parameter

#

ok yep

#

lol

sudden geyser
#

I don't see how the global flag would impact the match given you're using ^

surreal sage
#

Welcome to Regex in JavaScript
Hella inconsistent (in my cases)

sudden geyser
#

though I'd replace {0,} for +

lyric mountain
#

regex is supposed to be standardized across everything

lyric mountain
sudden geyser
#

so is sql

lyric mountain
#

since it includes 0 matches

surreal sage
#

zero or more indeed

sudden geyser
#

why'd you want to match nothing

surreal sage
#

regex is magic once you know how it works

sudden geyser
#

+ would signal that no numbers were matched

surreal sage
#

regexr shows no results when using *

#

wait

sudden geyser
#

even they recommend it!

surreal sage
#

might be stupid

#

no idea

#

sticking with what works for me

lyric mountain
#

wait

#

"any number before non-numbers"?

surreal sage
#

Is what works for me

#

What is matched is consistent

lyric mountain
#

what exactly are u trying to match?

#

like, an overall example

surreal sage
#

all but the first*

#

I get the first number before any other character with /^[0-9]{0,}/

#

And then I put the result in a switch

#

And if the result is "42" it goes to the second regex

#

Which works

lyric mountain
#

is it supposed to stop right before {?

surreal sage
#

Not really needed

surreal sage
lyric mountain
#

so it'll always end in { right?

#

you can simply do a boundary match

lyric mountain
surreal sage
#

(can also start with [)

lyric mountain
surreal sage
#

(can you copy paste good sir :))

lyric mountain
#

no

surreal sage
#

man I hate typing

lyric mountain
#

also \ is unnecessary apparently

lyric mountain
surreal sage
#

I have a tool

#

no idea on how to use it tho 🥶

lyric mountain
#

the thing is less than 15 chars

surreal sage
#

potato potata

#

Can you use 0 instead of null or undefined in the second parameter of JSON.stringify?

#

Originally: JSON.stringify({}, null, 4)
What I'm thinking of: JSON.stringify({}, 0, 4)

lyric mountain
#

why don't u simply use with 1 param?

surreal sage
#

3rd one is indentation/formatting

lyric mountain
#

ok but why do u need it formatted?

surreal sage
#

without

#

with

lyric mountain
#

still doesn't answer

#

having it formatted on the log will just pollute it

surreal sage
#

So I can view the whole json at once without being thrown with [Object] everywhere

#

I'm still in testing LUL

spark flint
#

Getting request to https://users.roblox.com/v1/usernames/users failed, reason: Failed to fetch when trying to use node-fetch, same thing happened with axios

#

but when I visit it in browser or use postman/thunder client, it works

solemn latch
#

are you missing any headers?

spark flint
#

headers used on the thunder client request

solemn latch
#

the other image shows three headers

#

👀

spark flint
#

it had accept: * and application: thunderclient

#

i removed both and it still works

solemn latch
#

is it possible the username isnt a real username?

spark flint
#

its a real username why

#

its my roblox name

solemn latch
#

no idea then

spark flint
#

i tried console.log(err) and i get that

wheat mesa
#

try adding Accept: application/json

spark flint
#

oki doki

wheat mesa
#

just in case

spark flint
#

nope same errror

#

i found error

#

its a cors error

lyric mountain
#

It had to be cors

spark flint
#

of course

lyric mountain
#

Of cors*

spark flint
#

😭

lyric mountain
#

Cors is the bane of every developer, because u simply can't solve it sometimes

warm surge
#

who knows how to fix this?

green kestrel
#

get a faster vps?

#

or request less data

warm surge
#

its faster

green kestrel
#

faster than?

warm surge
#

it got 20ms

green kestrel
#

20ms what?

warm surge
#

of client ping

#

client.ws.ping

green kestrel
#

https request response time in 20ms? I doubt that...

#

client.ws.ping is the websocket response time

#

not requests

warm surge
#

hm

green kestrel
#

ws is an already established connection

#

are you requesting guild members of a huge guild?

warm surge
#

yea

green kestrel
#

split the request into chunks

warm surge
#

it starting doing that when someone invited it to big server today

warm surge
green kestrel
#

you should probably use the events from the websocket like guild create etc not a request to get all guild members

#

and the cache

warm surge
#

ah i see

green kestrel
#

btw my advice is general concepts, I don't personally use js

#

but the approach applies to all libs

warm surge
#

friday is ts and js it is mix of both

green kestrel
#

you using discord.js?

warm surge
#

yeah

warm surge
#

sorry, I lost brain cells while i was at school

sudden geyser
#

every fucking time I open the mdn page for cors I'm left more confused

blissful coral
#

Having issues with influxDB and nginx on my ubuntu server - anyone able to help?

dry imp
rustic nova
#

Tbf, i end up just allowing everything on cors during testing

#

Just to not have to deal with it

hushed robin
#

anyone know what equation mee6 uses for its leveling

quartz kindle
warm surge
quartz kindle
#

are you trying to fetch all members at startup?

warm surge
#

It usually do that

quartz kindle
#

do you have more than 120 guilds?

warm surge
quartz kindle
#

how many guilds?

warm surge
#

31

quartz kindle
#

does this error happen for all guilds?

warm surge
#

I think so

quartz kindle
#

do you have the intent enabled in both the bot code and the developer portal?

warm surge
#

Yup

quartz kindle
#

which djs version?

warm surge
#

13.12.1

quartz kindle
#

do this ```js
client.on("raw", data => {
if(data.t === "GUILD_MEMBERS_CHUNK") {
console.log(data.d)
}
})

#

then try to fetch members from a guild

#

and see if the members are actually being received

warm surge
#

Alr

#

Thanks

crystal wigeon
#

anyone here using flask and cors?

#

for some reason cors is not sending allow-headers

#

Access-Control-Allow-Headers: content-type

#

this is what it sends instead of Access-Control-Allow-Headers: *

#

im basically trying to allow all headers

#

CORS(app, supports_credentials=True, origins="*")

#

my cors config

#

idk what else to do, i tried adding allow_headers="*" from their docs, but nothing seems to work

#

in the preflight response i still see content-type as the only allowed header

#

maybe im understanding something wrong, hmmm

#

but the set-cookie header im setting in response im able to see it in the request but on the server axios side i dont see it in the interceptors

stiff dust
#

what are these HUH

trim spire
#

Damn bro 🤣

crystal wigeon
#

uh

stiff dust
#

and also why ffmpeg.exe is this much

trim spire
#

How many cmd do you have open

crystal wigeon
#

hey so im using flask, and flask cors
but in the response headers im not able to see set-cookie
i can see it in the request, but not in the axios interceptors
CORS(app, supports_credentials=True, origins="*")
this is my cors config
pretty much a basic app

#

someeone help ;-

stiff dust
crystal wigeon
#

lmao

trim spire
#

Bruh that's a lot of code 😂

stiff dust
#

wdym

crystal wigeon
stiff dust
#

my memory usage is on 98%

#

ig my VPS will explode soon 😂

lyric mountain
#

for ffmpeg it's expected

trim spire
#

When you run commands thru cmd it can over load alot

lyric mountain
#

wait, "vps"?

#

that windows screenshot is from the vps?

trim spire
#

Ooh... Damn

#

Also try to not compile cmds cause that can over heat and overload the pc

stiff dust
# lyric mountain for ffmpeg it's expected

well what should I do? there isn't any way to don't use ffmpeg... also my music bots are private (only have 1 server) so they shouldn't take this much ram! should they?

trim spire
#

When you write scripts and code

#

That takes up space

#

Whether it's ram or pc

#

Code once sourced and running take up memory

lyric mountain
trim spire
#

Alot depending how large and or servers are running it

lyric mountain
#

even worse, why windows?

#

like, nothing against, but having a windows vps WITH gui will eat most of your resources

trim spire
#

That too on top of everything

lyric mountain
#

so you're getting about 60% of what u paid for

stiff dust
trim spire
#

Omg gui is important to watch

lyric mountain
stiff dust
#

but still...

#

why this is happening HUH

trim spire
#

Not enough space

#

Overall

lyric mountain
#

it's normal for ffmpeg to spawn many processes

#

it's an encoder afterall

trim spire
#

But not that many cmds he has

#

He has more active then popped up

crystal wigeon
#

yo anyone used python flask?

#

im having issues with cors

trim spire
#

I use vs code so

lyric mountain
#

everyone has issues with cors

trim spire
crystal wigeon
#

fr

lyric mountain
crystal wigeon
#

its not sending headers correctly at all, axios interceptors cant access, cookies or authorization header

#

hey so im using flask, and flask cors
but in the response headers im not able to see set-cookie
i can see it in the request, but not in the axios interceptors
CORS(app, supports_credentials=True, origins="*")
this is my cors config
pretty much a basic app

lyric mountain
#

do u have anything in-between?

crystal wigeon
#

nop

lyric mountain
#

like nginx or apache

crystal wigeon
#

just cors

#

localhost

lyric mountain
#

localhost is an address

crystal wigeon
#

ik its just a basic backend server flask

#

and client react

#

with axios making the req

lyric mountain
#

ah, ur testing locally?

crystal wigeon
#

ye

#

i can see the calls etc coming through

#

but axios interceptors cant access the cookies or authorization headers

#
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Methods: DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT```
#

the response coming back from cors

#

i see the "set-cookie" as well

#

but axios interceptors are not able to see this

#
: 
"18"
content-type
: 
"text/html; charset=utf-8"```
#

this is all it has

lyric mountain
#

I'm not well versed in flask, so idk if I can help

crystal wigeon
#

mmm

lyric mountain
#

you need to rent a vps

#

because a bot is nothing more than a program that stays running indefinitely

#

no

#

u can also leave ur pc overnight, but it'll be more expensive than a vps due to energy bill

#

you dont "install" a vps

#

vps is a computer running somewhere else in the world

#

you buy one and u get access to it

lavish berry
#

Does anyone know what he's talking about?

lyric mountain
#

there are a ton of tutorials around the net, u just need to search

lyric mountain
#

u run a bot and use a single command to get it, once every 30 days

lavish berry
#

I see

lyric mountain
#

absolutely a waste of effort, but anyway

rustic nova
lyric mountain
#

Found this gem on reddit recently

#

the guy who tried to fight discord and topgg doesn't know how to download releases from github apparently

rustic nova
#

"yes this is how you can get the badges"

Doesnt understand the basics of downloading files

crystal wigeon
#

Lmaoo

eternal osprey
#
.addComponents(
        new MessageButton()
        .setCustomId("activate_list")
        .setLabel('Activate')
        .setStyle('SUCCESS'),
        new MessageButton()
        .setCustomId("deactivate_list")
        .setLabel('Deactivate')
        .setStyle('DANGER'),
        new MessageButton()
        .setCustomId("delete_list")
        .setLabel('Delete')
        .setStyle('DANGER')
        ).addComponents(
        new MessageSelectMenu()
        .setCustomId('select_list')
        .setPlaceholder('Select action')
        .addOptions([
          {
            label: 'Add Messages',
            description: 'Add a message',
            value: 'message_add',
          },
          {
            label: 'Remove Messages',
            description: 'Remove a message',
            value: 'message_remove',
          },
          {
            label: 'Change interval',
            description: 'Update interval',
            value: 'interval_change',
          },
          {
            label: 'Add channel',
            description: 'Add a channel',
            value: 'targetchannel_add',
          },
          {
            label: 'Remove channel',
            description: 'Remove a channel',
            value: 'targetchannel_remove',
          }
        ]),
            )```Does anyone know which is exceeding the maximum width?
deft wolf
#

Is it possible to add buttons and select menu to one message at all?

lyric mountain
#

I think u can, but select menus take a whole row

deft wolf
#

So the solution to this problem is probably to make a second row with the select menu itself

surreal sage
#

Being thrown {"size":0,"timeout":0 when logging the response from node-fetch v2

#

I want to access the headers

lament rock
#

use the built in fetch if node 17 or up otherwise use undici

surreal sage
#

"let's try axios!"

lament rock
#

node fetch bad

#

actually

#

just use the built in http client

surreal sage
lament rock
#

Everything else is just node module bloat in the name of "making dev work easier"

surreal sage
#

Lovely "invalid url"

lament rock
#

well. Log the url

surreal sage
#

😊

#

looks fine 2 me

#

oh

#

might be the method

#

since it's capital

#

nope

lament rock
#

no. The error clearly says url

#

is the url URI encoded

surreal sage
#

https://discord.com/api/webhooks/1068184401105653871/xxxxxxxxxxxxxxxxxxxxxxxx

#

xxxxxxxxxxxxxxxxxx is the webhook token

#

no query no params

lament rock
#

if there are any special characters in the url, you should encode it

surreal sage
#

There aren't

lament rock
#

Just for hahas, try passing it through the URL constructor

surreal sage
#

hollup

surreal sage
#

oh

#

interesting

#

request is a string

#

Now gotta fix the "request body invalid json"

#

even when the body is stringified, nun

#

ok fixed

#

"body" had to be "data"

next storm
#
TypeError: Cannot set property member of [object Object] which has only a getter
``` like I'm trying to do `message.member = <guild member>`, and it's showing this.
Any way to fix?
solemn latch
#

you're trying to change the member of a message?

next storm
#

yes 💀

#

it was working fine before, but now I've changed all my commands into class format

#

so it's showing this

solemn latch
#

I dont think djs has support for that, you'd probably want to create a custom message class

#

its certainly not the intended way of doing things though

next storm
#

umm, can't I delete the 'member' property of message?

#

using delete message['member']

solemn latch
#

djs can misbehave and throw weird errors doing that

next storm
#

umm

solemn latch
#

if your goal is to change things in this way a custom class is the way to go.

next storm
#

can you explain me a bit more about it, like what to do basically

solemn latch
#

I don't know what you're doing, so I cant really tell you exactly what to do.

next storm
#

actually I've a command which's a owner only command. basically owner can execute any command by selecting a different user

civic scroll
#

copy the object to a new one

#

why do you need to delete that field anyway

next storm
#

I don't want to delete it, i want to change it

civic scroll
#
// ... @interface DiscordJS.Message
readonly member: Member
#

it's readonly

#

you can't change it

#

why do you wanna change

next storm
#

tf, but I was able to change it earlier, infact in my old src, it's working fine

civic scroll
#

put it inside a variable

solemn latch
#

👀 doesn't this feature seem very abusable?

civic scroll
#

and send along with new request if that's what you meant

next storm
civic scroll
# next storm

that returns the result of the expression regardless the assignment was successful or not

#

also

#

like woo said

#

make a custom handle class

#

that wraps around and escape sensitive data

next storm
civic scroll
#

there's no reason to modify it

next storm
#

how can I check when will the ratelimit get removed of my bot 💀

rustic nova
#

tbf

#

let your library handle it

solemn latch
#

👀 how are you getting rate limited so much?

#

this is the third ratelimit youve had in the past 30 days isnt it?

#

and the last one was a disable because your bot hit the ratelimit so often.

next storm
#

it got rate limit for 40 mins (at that time)

sudden geyser
#

why can't your library handle the rate limit

solemn latch
#

Your bot is probably pretty close to getting disabled permanently by discord

next storm
#

wtf ¯_(ツ)_/¯

solemn latch
#

I've never seen a bot get a You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. before

sudden geyser
#

it's been a feature for like a year or two

solemn latch
#

I knew it existed, just seems like theyve been getting ratelimits pretty consistently to get that warning

rustic nova
#

I NEVER got ratelimit messages lol

next storm
#

I don't understand how other security bot like wick & security doesn't get ratelimit

rustic nova
#

because they're controlling their own ratelimits

#

and maybe have gotten ratelimit raises by discord

solemn latch
#

tbh, I dont understand how you do get ratelimits.

spark flint
#

me neither

next storm
#

that's why carl, dyno never get it

wheat mesa
#

A small bot should certainly never reach the ratelimit like that

#

I can maybe see it hitting the channel ratelimit but definitely not the global one

next storm
wheat mesa
#

If you’re making a “security” bot then you should have good ratelimit handling

#

You should be expecting people to try to break it

solemn latch
next storm
#

I literally saw a live stream in which a user created a bot, and literally he did scratch bans and it banned around 13k members within 2 mins

wheat mesa
#

A good developer tries to account for all feasible sources for error

wheat mesa
rustic nova
#

you can get globally banned for a while if you actively get ratelimited

earnest phoenix
#

Or permanently banned for continuously abusing the API

next storm
#

):

#

what should I do

solemn latch
#

Disable the commands causing the ratelimits until you can solve it

next storm
#

hm, I'm working on it, I'm making some limits to it and large cooldown on heavy commands too

tiny harness
#

Is the python library topgg limited to discord.py or can used on forks as well?
Particularly disnake

eternal osprey
#
  embed.edit({embeds: stafflocked1, components: [row1, row2]})```I am trying to edit an embed that has 2 components with these values
#

However it's throwing me an error

#

any suggestions?

rustic nova
#

damn

#

if only we could know what error

earnest phoenix
#

What's the error?

eternal osprey
#

TypeError: embed.edit is not a function

earnest phoenix
#

Because <TextChannel>.messages.fetch() returns a promise, you didn't resolve it

eternal osprey
#

owh i am dumb

#

tysm voltrex! Will try it atm

earnest phoenix
#

You're welcome

eternal osprey
#
 TypeError: this.options.embeds?.map is not a function```
earnest phoenix
#

Show your code

eternal osprey
#

embed.edit({embeds: stafflocked1, components: [row1, row2]})
coming from here again

earnest phoenix
#

What's stafflocked1 declared as?

eternal osprey
#

it's an embed

#
const stafflocked1 = new MessageEmbed()
      .setFooter({text: `🔒 | Maximum Server Security`})
      .setTimestamp()
     
      .setDescription(`**List Message Container:**\n\n${messages}`)
      const row1 = new MessageActionRow()
      .addComponents(
      
        )
        const row2 = new MessageActionRow().addComponents(
        new MessageSelectMenu()```some reduced code so that it would just make clear what the vars are
#

is it because i cannot edit a message using .edit({components etc})?

#

should it rather be embed.embeds[0]?

earnest phoenix
#

Basically [stafflocked1]

eternal osprey
#

Owh wow obv, thanks once again!

eternal osprey
#

Do hyperlinks only work in embeds?

#
[Through here](https://discord.com/channels/${interaction.guild.id}/${staff.id}/${miauw.id})`})```This works within my embed but not really within a singular message
quartz kindle
#

yes, only in embeds

hushed robin
#

or interaction replies

eternal osprey
#

okkii thanks

urban cape
#
import WebTorrent from 'webtorrent'
const client = new WebTorrent()

I get an unexpected identifier error

file:///C:/code/websites/webtorrent/node_modules/webtorrent/index.js:21
import info from './package.json' assert { type: 'json' }
                                  ^^^^^^

SyntaxError: Unexpected identifier
    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:139:18)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:236:14)
[nodemon] app crashed - waiting for file changes before starting...

Changing to commonjs does not work
Any idea?

earnest phoenix
urban cape
#

16.13.2

#

Since when is that possible assert?

earnest phoenix
urban cape
#

Thx

slender wagon
#

so i have been ignoring this error thrown in typescript

import stream, { Readable } from 'stream';
import { promisify } from 'util';
const pipeline = promisify(stream.pipeline);
await pipeline(response.body!, res);

the error is coming from " response.body "

slender wagon
#

18.10

#

using its own fetch

quartz kindle
#

there should already be an async pipeline from 'node:stream/promises

slender wagon
#

the experimental one

quartz kindle
#

no need to promisify

#

do you have node types installed?

#

@types/node

slender wagon
#

doesn't seem like i do

slow ibex
#

Hey there, anybody come up with a simple solution to transfer Data between a button and its Callback?

slender wagon
#

should i install them?

quartz kindle
#

if you're using typescript, yes install types/node as a dependency or a dev dependency

slow ibex
quartz kindle
#

small data: serialize it and put it inside the button's unique ID

lyric mountain
#

big data: use a global map

quartz kindle
#

^ and put the key in the unique ID

slow ibex
#

Hmm.. i thought about using a table inside a database

lyric mountain
#

not good

#

it'll add unnecessary calls to the database + its latency

#

if u don't need it to persist through restarts, just use a map

#

even if u do, I'd just dump the map into a file before exiting and restore it on next start

slender wagon
#

after using the Node promise

slow ibex
#

The Problem is, when i attach it to the buttons uniqueID the callback wont fire because my loader doesnt work that way

quartz kindle
slender wagon
#

new promise

quartz kindle
#

? show code

brave elbow
#

Hello i want to display the number of servers on my website how i can do this?

deft wolf
brave elbow
#

how?

deft wolf
#

You can use one of several npm packages if you are using node.js or make an api request yourself. See the documentation

brave elbow
#

ok

quartz kindle
#

they want to display it on their website

lament rock
#

@sharp geyser when we had our chat about rabbitmq, I got a few things wrong. Multiple clients can listen to the same queue and messages will persist in a queue until acknowledged. Amqp can be implemented over both udp and tcp, but rabbitmq only implements tcp and as such, most or all node clients are tcp only. RabbitMQ does not broadcast messages to all listeners of a queue unless you are using what's called a fanout exchange. By default, RabbitMQ is round-robin sending messages in a queue to listeners. There are channels in amqp, but those are per connection and tbh I have no clue what they are exactly.

brave elbow
lament rock
#

After getting this info clarified, I am moving my bot to use RabbitMQ and gonna scale all of my stuff. Only fun thing will be that interactions can be sent to clusters which watch over different guilds than which guild it was sent into if there are multiple workers and per guild gateway actions will need to be routed somehow

quartz kindle
#
  1. you can put a small webserver inside your bot, that your website makes a request to using js
#

then the bot responds to the request with the number

#
  1. you can store the number in a database, and have the website access the same database to get the number
#
  1. you can setup a websocket communication between the bot and the website, but this is not really a good idea unless you want something specific and more advanced
#
  1. you can basically build the website inside the bot lol
lament rock
#

which is a bad idea

#

scalability becomes 0

brave elbow
slender wagon
quartz kindle
slender wagon
#

Stack overflow

quartz kindle
#

thats wrong on so many levels lol

#

node has built in promisified streams under "stream/promises"

wheat mesa
quartz kindle
#
import { pipeline } from "node:stream/promises"
slender wagon
#

Oh

#

Lmao

craggy pine
#

Is it possible for a server to only have bots in it? Not even users? This server just invited it, and normally my count is correct, but this thru me off.

hushed robin
craggy pine
#

interesting...

rustic nova
#

Still need one user to invite bots

craggy pine
#

I'll research it more tomorrow. Still weird

rustic nova
#

unless theres like, someone so dedicated on the server that they're inviting a bunch of bots, then leaving the guild, then joining it again, inviting a bunch, then leaving etc

craggy pine
#

i mean the bot farm servers seems dedicated to the point ive seen a server grow 10k members (all bots) in a week

rustic nova
#

should still have someone invite them if they're growing that fast

light jungle
#

Anyone know where I would put the invite link?

trim folio
#

maybe it's in oauth2 -> general category, there's a field to add an authorization link at the bottom

loud tree
#

guys, I have a bot which is connected to my FiveM server, the purpose of the bot is to fetch logs of the fiveM server, but the thing is that the traffic is too high, so my bots get rate limited frequently

#

any solution?

rustic nova
#

Control your Ratelimits

lyric mountain
#

how fast are u even fetching it?

eternal osprey
#

hey guys

#

does anyone know a good site where i can create a graph or table based on this relation: let m = xp / (5 * Math.pow(2, lvl-1));

#

I am trying to create a leveling system looking like this:

#

wait hold on a sec

#

isn't it just messages(level*2) - messages(current_level)?

#

I am fucking stupid

#

or no

#

could anyone help me to find a direct formula for this sequence lmao

rocky hearth
#

I've this *.log* in my .gitignore, what does it mean by 2nd * at end?

eternal osprey
#
const Topgg = require("@top-gg/sdk");
  const express = require("express");

  const app = express();

  const webhook = new Topgg.Webhook("hula!");
  app.get("/", (req, res) => {
    console.log(req.body); // Call your action on the request here
    res.status(200).end(); // Responding is important
  });

  app.post(
    "/dblwebhook",
    webhook.listener((vote) => {
      console.log(vote);
    }
        };```would anyone know by any chance why my voting system doesn't work?
lyric mountain
#

* is a wilcard for "anything"

#

so <anything>.log<anything>

rocky hearth
#

Okay, thanks
But why that doesnt work by .env.* for these files,

.env.local
.env.development.local
.env.test.local
.env.production.local
compact pier
#

so

local.env
development.local.env
test.local.env
production.local.env
rocky hearth
#

I've put the * at end here .env.*, so the matching files should starts with .env. NO?

lyric mountain
#

that should work yes

eternal osprey
#

does the togg api accept server votes?

#

Like an event for it

#

because my event doesn't trigger

lyric mountain
#

don't think server votes have an endpoint

#

at least I only saw for bots

radiant kraken
#

c++ hates me

#

a simple hello world returns 1?

sudden geyser
#

have you tried not using c++

#

is it not even printing?

wheat mesa
#

Granted that doesn’t matter because you’re only printing

#

Unless ofc you did a little bit of trolling and made your own printf function above it

radiant kraken
#

it turns out that i can't even run the goddamn compiled executable

radiant kraken
lament rock
#

moving my bot to microservices

#

this shit difficult

quartz kindle
#

nice

wheat mesa
#

Desmos on top

lyric mountain
#

desmos is in another level entirely

tribal nacelle
#

Hey

sudden geyser
#

hi

icy burrow
#

Anyone else's bot suddenly appearing in servers like this?

rustic nova
#

bot farms

icy burrow
#

Figured

icy burrow
# rustic nova bot farms

I would probably have to contact discord to get it removed right? because atm I have no idea how to remove it the system I have to force my bot to leave servers wont work on this one server for some reason

wheat mesa
icy burrow
wheat mesa
#

1068135541360578590

icy burrow
wheat mesa
#

👍

frosty gale
#

How would I get into programming with java?

#

It looks very interesting

wheat mesa
#

With java I'd start off with a few basic tutorial sites for basic projects by following along with them and trying to add in extra features with your own ideas

#

Then as you get more comfortable, try to make your own basic projects without a tutorial (looking up how to do something specific within the project is perfectly fine, but experimenting around with what you can do is fun and will teach you more)

spark flint
#

it got terminated again

lyric mountain
#

for java I'd recommend baeldung courses

spark flint
#

2nd one in the last day

lyric mountain
#

they cover everything from frontend, backend, databases, RESTful apps, etc

spark flint
icy burrow
#

Wowza

spark flint
#

i call them api fuckery servers

icy burrow
#

Is that a bot just for blacklisting servers? XD seems useful

spark flint
#

its for a few things

#

it blacklists users (mostly raid users) and it has a server blacklist

#

for phishing servers

#

anyways that server, they do it to ratelimit the bot and the channel, a lot of the bots they add do not handle errors and they crash meliodas_heartcry

icy burrow
spark flint
#

yeah

#

one of the bots i am admin for

sudden geyser
icy burrow
#

My bot went from like 2 ping to 24,000 ping and I was like holdup lol

spark flint
#

they were spamming .help

#

ah lol

lyric mountain
#

jetbrains is doing courses now?

sudden geyser
#

hyperskill / jetbrains academy has been a thing for years

#

but it was mostly in beta for a while

#

and free then

#

but it's paid now

#

and you know how jetbrains is with pricing

#

don't bother clicking on the pricing section

icy burrow
#

probably the easiest thing to automate

lyric mountain
#

is it included in toolbox license?

spark flint
#

yeah true

sudden geyser
#

don't know

#

probably not

spark flint
#

either way, they got terminated again it seems

#

lemme check

icy burrow
#

I hope so

sudden geyser
#

yeah it's not

spark flint
#

yep terminated

quartz kindle
#

someone should start making lists on bizarre discord servers, the same way they do with bizarre subreddits

spark flint
#

i did start one ages ago

#

but they get terminated fast so no point

rustic nova
#

its gonna be filled with scam discord servers

#

im certain

spark flint
#

oh i already have one

lyric mountain
#

tos?

spark flint
#

it varies

#

lemme get an examople

#

can't think of one off the top of my head

quartz kindle
#

servers that break the discord tos?

spark flint
#

a roblox phishing server

#

added yesterday

spark flint
lyric mountain
#

time of sleep mmLol

quartz kindle
#

lmao

spark flint
#

but they get categorised

quartz kindle
#

whats qr?

spark flint
#

QR scam servers

quartz kindle
#

ah

spark flint
#

those fake 18+ servers with fake wick

quartz kindle
#

like fake qr codes and stuff

spark flint
#

yeah

lyric mountain
#

skid I can guess

spark flint
#

skid is an old tag

icy burrow
spark flint
#

that got migrated into tos

spark flint
#

like 3 added today

#

theres a bunch of contributors for this list, we generally catch them pretty quck

#

we love marengo

#

he handles most of the qr server reports

icy burrow
#

Thats an awesome project I would 100% contribute if I could

spark flint
icy burrow
#

But yea this is crazy I've never heard of servers made just to crash bots 💀

spark flint
#

lmao

#

they are annoying af

rustic nova
spark flint
#

i have before

rustic nova
#

LMAO

spark flint
#

a bunch of us have tried to get him to join the cybersecurity server we're in

#

we have a bunch of dstaff there

#

anyways he has yet to reply

#

they get clyde closed

icy burrow
spark flint
#

not enough reports icl

rustic nova
#

fuck clyde, all my homies hate autoresponse dude

spark flint
#

i have like 10 pages of reports

#

lmao

#

i hate discord support sometimes

#

one of the bots i made for combat warriors got blocked by discord antispam

icy burrow
#

typical discord L

spark flint
#

we held mod apps through the bot, the user clicked a button to get a dm to start an application, yet discord claimed 500 dms were sent without the user's consent?

#

the worse part? the name of the support worker that replied is the name of our mod bot 😭

#

taunting me fr

#

full message, they are fully ignoring all contact now

icy burrow
spark flint
#

literally

#

it sent 500dms in 5 mins

rustic nova
#

caching

craggy pine
#

Because when the bot restarts it's no longer cached

rustic nova
#

do message ids still get passed?

craggy pine
#

What you can do is store the IDs of starboard messages, and on bot ready() fetch all the messages by ID and they'll be cached.

quartz kindle
craggy pine
#

The hard part is, if you cache literally every single message, that will probably cause some latency of the bot booting especially when it becomes larger.

quartz kindle
#

djs guide has a guide on this topic

craggy pine
#

Maybe I am a little incorrect depending on what this guide says. Never knew it existed KEKW

#

Ah partials. That actually pretty nice ngl. Forgot those existed.

quartz kindle
#

what djs version btw?

whole glen
#

It was the partial thing

#

Partials: [Partials.Message, Partials.Reaction] is what it should have been

quartz kindle
#

yeah thats what i thought

craggy pine
#
    // When a reaction is received, check if the structure is partial
    if (reaction.partial) {
        // If the message this reaction belongs to was removed, the fetching might result in an API error which should be handled
        try {
            await reaction.fetch();
        } catch (error) {
            console.error('Something went wrong when fetching the message:', error);
            // Return as `reaction.message.author` may be undefined/null
            return;
        }
    }
quartz kindle
#

since v14 they dont accept strings anymore

craggy pine
#

don't forget about reaction.partial

whole glen
quartz kindle
#

ye

earnest phoenix
#

Use the official guide instead of random tutorials

quartz kindle
#

djs, breaking our user's bots on every major update since 1999

#

:^)

rustic nova
#

coming soon in 2023: djs v50

lament rock
#

I just really spent the last 2 hours trying to debug why an http route wasn't working only to figure out I forgot a / at the beginning

rustic nova
#

this so me

#

had that too

lament rock
#

I shouldn't touch front end stuff with a 10 foot pole

#

On the plus side, I got interactions moved from being sent over the gateway to being sent over a webhook and made a decision of having my website store all of the queues and lavalink node connections in memory and be the authority versus each client. Now the clients are almost stateless and can be scaled endlessly

#

downside is that now my website has slash command code

quartz kindle
#

xD

#

which reminds me, i need to change my interaction server a bit

#

offer the option to respond via rest instead of via webhook response, because when you respond the webhook response directly, there is no feedback from discord

#

so no way to confirm a defer went through for example

lament rock
#

Well with webhooks, you either loopback the results to the webserver to 200 to Discord or defer. You can't 202 accepted

#

and cant use discord rest actions either

quartz kindle
#

pretty sure you can, i've done it before

lament rock
#

I just tried

quartz kindle
#

an interaction received via webhook can be responded to via another rest request

#

instead of responding to the webhook

lament rock
#

I have to defer all of my stuff and then edit the original response

#

If you can find a working system, do tell

quartz kindle
#

nice 404

#

:^)

lament rock
#

keys being right next to each other

#

I hate my fat fingers

quartz kindle
#

i'll need to try it again but i remember being able to do it to send files without defering

lament rock
#

every time I tried, I just got unknown interaction

quartz kindle
#

btw discord does unofficially accept file upload via webhook response, but they have a file size limit of 150kb for some reason

lament rock
#

such an arbitrary system

quartz kindle
#

i asked them about it

#

let me post what they said

#

lmao

lament rock
#

better not be like encoding your response in an image format

quartz kindle
#

lmao

lament rock
#

what

#

support for what

#

oh

#

nvm

#

really really weird

quartz kindle
#

also, yes you can ignore the webhook and send the response via rest

#

i need to retest it to confirm, but im pretty sure all you need to do is delay the webhook response until you make the rest call

radiant kraken
#

@wheat mesa nvm i just realised that i did test.exe instead of .\test.exe

#

powershell why

hushed robin
#

what would cause .toLocaleString() not to work?

radiant kraken
#

wym

hushed robin
#

ah nevermind

#

found my issue

sudden geyser
#

they were forced to implement it for some client

#

but did a horrible job and never wanted to touch it again

quaint wasp
#

How would I get the value of the dropdown..?

    <form method="get" enctype="application/x-www-form-urlencoded" action="/html/codes/html_form_handler.cfm">
        <legend><b>Encrypt in:</b></legend>
        <span class="custom-dropdown small">
          <select id="options" name="options">
              <option value="atvash">Atbash Cipher</option>
              <option value="vigenere">Vigenère Cipher</option>  
              <option value="railfence">Rail Fence Cipher</option>
          </select>
      </span>
        <br>
        <input id="start" type="button" value="Cipher" class="startButton" />        
        </form>```  I currently have : ```js
              let e = document.getElementById("options");
              let cipher = e.target.value;
#

When I console.log the cipher it just says it can't read its value, but when I do just e for cipher and not e.target.value it returns the whole form

#

never mind..

#

I am an idiot

#

ignore this

lyric mountain
#

Rubberducking is surprisingly effective

whole glen
#

How would i see if a reaction author is a bot? user.bot works

earnest phoenix
#

And after you have the user you want, you can check if they're a bot with the <User>.bot property

whole glen
#

How would i do reaction.count but just for one type of emoji?

earnest phoenix
whole glen
#

Ok whoops

earnest phoenix
craggy pine
bright thorn
#

How can we get unavailability guilds and resolve them

earnest phoenix
carmine summit
#

how do yall call client in another file without creating a circular dependency?

carmine summit
#

managed to do this by creating a new file client.js in the root directory and just requiring that in index.js and exampleCommand.js. Is there any better other way to do this?

//client.js
const { Client, GatewayIntentBits } = require("discord.js");
const client = new Client({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
});

module.exports = client;
deft wolf
#

Where do you need this client?

#

Because when it comes to interactions, you can just use interaction.client

#

Same with message.client

wheat mesa
#

Generally speaking it’s probably best to pass your client into functions as a parameter instead of having a global client object

lofty cipher
#

How can i make a button with when 2 users are reportet and i click on the first one then this ban the first user?

solemn latch
#

sounds like a bad idea, anyone can just make two accounts and ban anyone

#

but, youll probably want a database for that if you're using buttons.

lofty cipher
sudden geyser
#

so like a mod panel

#

could you re-explain your question though

quartz kindle
lofty cipher
rigid maple
#

Hi, i am trying to convert audio to text using wit.ai but it gives me blank output no matter what i do. Since wit.ai only supports mono in raw format, I convert stereo to mono and send it that way, but it still gives blank output. Any idea what i can do?

rigid maple
#

I thought if it did the stereo to mono conversion correctly, but I couldn't come to a conclusion. First buffer stereo, second buffer mono

quartz kindle
#

does that converted audio even play if you save it as a file?

#

that doesnt look like it would work, audio frames are much more complex than simply skipping every 2 bytes

wheat mesa
#

this might be useful to you

crystal wigeon
#

uh peeps, i was wondering if anyone experienced wouldl ike to start a project with me together

#

i have some ideas

#

tim?

#

experienced guys ofc

#

@quartz kindle @lyric mountain you guys interested?

oak cliff
#

This isn't the place to look for co-developers

deft wolf
#

You can start on your own and if you have a problem, ask the guys for advice

wheat mesa
#

^^

#

Also I've got sort of a stupid question, but how would I dynamically instantiate child classes of an abstract class? I'm trying to have an abstract InteractionCommand class that all slash commands will extend, but I don't know if I'm approaching this right (typescript)

#
export abstract class InteractionCommand {
    name: string;
    guildOnly: boolean;
    permissionsClient: Array<PermissionFlags>;
    permissionsUser: Array<PermissionFlags>;
    abstract run(client: Client, interaction: Interaction): Promise<void> | void;
}
``` something similar to this
#

Oh wait

#

I can just make the default export an instance of said class

#

(Maybe? gonna try it)

#

Ok got it to work

charred prism
#

Hi, im trying to get all the information top.gg and bot testing staff need to test my bot. what information would be helpful for a tester that I can prepare in advance to make the process easier?

deft wolf
#

It probably depends on how complex your bot is. Put yourself in the place of an ordinary user who may not understand how your bot works at all and try to explain it to him as best as possible

wheat mesa
#

If anything you know how your bot works better than anyone else, try to test all of your edge cases and anything that you're concerned about

#

And then also try everything with the dumbest and most unexpected usages ever, never assume the end user understands how everything works

charred prism
#

Thank you so much! I see your points there nynu and waffle!

#

if the tester comes across an issue, would they reach out to me to learn more? the bot is complex and I am worried that it might get declined for something that I wasn't able to share in advance

#

would submitting a doc like this be overkill? sorry for all the questions. this is the first bot im submitting for approval in a very long time.

wheat mesa
#

You'll see a decline reason for your bot if it gets denied, and you also get the chance to contact the reviewer if you feel your decline reason wasn't justified

#

I suggest looking through #mod-logs for common decline reasons to see if your bot matches any of those

charred prism
#

Thank you so much Waffle, i'll take a look at the mod-logs! thank you for answering my questions!

#

thank you to you as well NyNu!

lone spindle
#

☁️ ERROR AL CONECTAR A LA BASE DE DATOS DE MONGODB
Error: querySrv ENOTFOUND _mongodb._tcp.cluster0.z2bwm.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/callback_resolver:47:19) {
errno: undefined,
code: 'ENOTFOUND',
syscall: 'querySrv',
hostname: '_mongodb._tcp.cluster0.z2bwm.mongodb.net'
}
C:\Users\angel\Desktop\EloBot\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:151
const err = new MongooseError(message);
^

MongooseError: Operation sorteos.findOne() buffering timed out after 10000ms
at Timeout.<anonymous> (C:\Users\angel\Desktop\EloBot\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:151:23)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7)

can you help me on that please

deft wolf
#

@lone spindle

earnest phoenix
#

Does anyone know how to clean an update in Replit?

#

i gave npm update

#

agr keeps giving error

wheat mesa
#

What's the error?

earnest phoenix
#

I accidentally ran npm update, now I don't know how to fix it

wheat mesa
#

Anyone know what the methods are to upload slash commands in djs, I know the guide says to do that rest bullshit but I remember @boreal iron saying there was built in methods for handling that stuff

#

As much as I want to compare whether or not my local commands match to the uploaded commands, I'd prefer to use built in stuff if it already exists

earnest phoenix
#

You can access the client application via the <Client>.application property

wheat mesa
#

I see

#

Does this handle pretty much everything for me or do I still have to compare the commands to see if they match my local version when I "upload" a command?

earnest phoenix
#

It already handles everything for you

wheat mesa
#

Oh sweet

earnest phoenix
#

You can post all of your slash-commands at once with the set() method of that application command manager

sudden geyser
wheat mesa
#

I know but I didn't want to hit ratelimits for it, since you can only make 200 PUT requests to that endpoint per day is my point

#

(iirc)

wheat mesa
sudden geyser
#

I thought that only counted to new commands

wheat mesa
#

From my understanding I thought it counted everything

#

I could be wrong though I suppose

#

Either way this is much easier than using the rest dogshit

earnest phoenix
#

Yeah, I really don't see why the discord.js maintainers are recommending to use their REST library for that instead of just the built-in methods

#

Makes absolutely no sense

sudden geyser
#

maybe it's just outdated?

wheat mesa
#

They've had it in the guide for a while, but I'm pretty sure the built in methods existed back when the guide was written for that

earnest phoenix
#

The built-in methods existed before that REST library

wheat mesa
#

Yeah

sudden geyser
#

hmm

wheat mesa
#

Seems so extra to do it the way they "recommend"

#

ok so thanks for that method @earnest phoenix, saved me probably 50 some odd lines of confusing and convoluted logic that didn't work properly

earnest phoenix
#

You're welcome

wheat mesa
#

Now I've got this, super clean and simple ```ts
async checkAndUploadSlashCommands() {
if (!this.token) {
return;
}

    const guildCommands = new Map<string, Array<SlashCommandBuilder>>();
    const globalCommands = [];
    for (const [name, command] of this.slashCommands) {
        if (command.guildIds?.length > 0) {
            for (const guildId of command.guildIds) {
                const commands = guildCommands.get(guildId);
                commands.push(command.data);
                guildCommands.set(guildId, commands);
            }
        } else {
            globalCommands.push(command.data);
        }
    }

    await this.application.commands.set(globalCommands);

    for (const [guildId, guildCommandArray] of guildCommands) {
        await this.application.commands.set(guildCommandArray, guildId);
    }
}
#

Probably could be better but works for me afaik

#

Nice it works perfectly!

rustic nova
#

question for the front-end devs that make web interfaces that actually look good

#

where

#

the fuck

#

do i start

wheat mesa
#

lol

#

@civic scroll

rustic nova
#

because it unironically pisses me off that I am trying

#

but fucking cant cuz am a stupid backend-dev

wheat mesa
#

I lowkey gave up on frontend for the time being

#

I'd prefer to stay behind the scenes because frontend is genuinely hard for me 😭

earnest phoenix
rustic nova
#

Literally ANYTHING I wanna try to do requires fucking frontend which kills the motivation for me

wheat mesa
#

felt that

rustic nova
#

so pov me github be like

#

dust

#

unironically makes me depressed

wheat mesa
#

honestly what I would do is just experiment around with some stuff like react and a lib to go with it like mantine, it makes the process a lot easier

#

it's not perfect or anything but it teaches you a lot

rustic nova
#

i looked at react for like, 5 minutes

#

gave up right away

wheat mesa
#

with component libs for react you can make some pretty decent looking stuff without having to fuck around with CSS for 27 years

earnest phoenix
rustic nova
#

YES ITS THE CSS

wheat mesa
#

react is just object oriented HTML essentially

wheat mesa
#

Java style baked into my brain

wheat mesa
#

especially if I end up needing to modify something in that scope, i don't have to fuck around with adding brackets and stuff

earnest phoenix
#

Though some people use to stay consistent with the styling of multiple operations, which is understandable

rustic nova
#

it is if thats the only thing between like:

int something = somecode.method.code.return();

if (something) return;

...
#

not if

if (something) return;
if (something) return;
if (something) return;
if (something) return;
if (something) return;
if (something) return;
if (something) return;
if (something) return;
if (something) return;
wheat mesa
#

I have a problem with people not using brackets, a lot of people assume that if you just keep the indentation the same then the scope continues on like it's python or something

#

it hurts me

#

I've just had enough horror stories from reading my classmates' code and seeing the brackets

earnest phoenix
wheat mesa
#

So I keep mine clean and consistent

earnest phoenix
#

That's understandable

wheat mesa
#

still don't know how I'm gonna handle subcommands yet but that's a bridge for me to cross later

sudden geyser
#

{ bracket gang }

wheat mesa
nocturne sail
#

.

rustic nova
#

yeah I know that site

#

its fucking pog

earnest phoenix
sudden geyser
#

no brackets kills readability imo, and sucks if you need another statement since you need to rewrite the whole expression

wheat mesa
#

Nah for loading it, I gotta do some stuff with my handler to handle subdirectories and I also need to figure out how to route the request to the right execute function

#

as of right now my slash command loader is pretty scuffed

#
    try {
        const slashCommands = fs
            .readdirSync(path.resolve(__dirname, '../commands/slash'), { withFileTypes: true })
            .filter(file => ['js', 'ts'].some(e => file.name.endsWith(e)) && !file.name.endsWith('.d.ts'));

        for (const file of slashCommands) {
            const ret: CommandImport = (await import(
                `file:///${path.resolve(__dirname, `../commands/slash/${file.name}`)}`
            )).default;
            client.slashCommands.set(ret.default.data.name, ret.default);
        }
        
    } catch (e) {
        console.log(`Error occurred whilst loading commands: ${e}`);
    }
earnest phoenix
wheat mesa
#

Ah I see

#

I'll check that out

#

Thanks

earnest phoenix
wheat mesa
#

Got everything working now, I have an infrastructure for creating a bot C:

#

(Ignore the name, I haven't decided on one and just needed something to differentiate between my other bot)

#

I'm pretty happy with the way commands look at the moment as well: ```ts
import { CommandInteraction, SlashCommandBuilder } from 'discord.js';
import { WaffleClient } from '../../types/WaffleClient';
import { BaseCommand } from '../BaseCommand';

class TestCommand extends BaseCommand {
constructor() {
super({
data: new SlashCommandBuilder().setName('test').setDescription('testing new method'),
permissionsClient: [],
permissionsUser: [],
});
}

async run(client: WaffleClient, interaction: CommandInteraction) {
    await interaction.reply('Test works!');
}

}

export default new TestCommand();

#

The builder is undesirable but makes my life easier

earnest phoenix
#

Very nice

wheat mesa
#

Now I have a very nice level of control and customizability

wheat mesa
#

Just spent like 30 minutes implementing a permissions system just to realize that discord has slash commands permissions built in already

#

Damn

rustic nova
#

they didnt before, now they have yeah

wheat mesa
#

I suppose it’s not a complete waste since I can keep the required bot permissions system and just get rid of the required user permissions

rustic nova
#

always good to keep a non-discord side backup

#

I dont trust the permissions on discord's end catching right

wheat mesa
#

The permissions on discord's end allows server owners to configure them on their own

#

So if they configure it different than mine via discord then it'll be a mess

rustic nova
#

yeah, but tbf I dont trust em lmao

wheat mesa
#

Thankfully I don't have to worry too much because my bot isn't going to have any moderation or anything like that in it

#

Too many moderation bots out here already

rustic nova
#

lmaoo yeah

lyric mountain
rustic nova
#

this explains it all

#

agreed

wheat mesa
#

ok so I'm having some really weird behavior

#

I have a string that I created by joining an array of strings together with \n, and when I try to send that in a codeblock in a message I'm getting only the first value

#

Oh wait

#

It's because the backticks need a newline

#

nvm then

#

Any reason why this regex isn't working? I'm not quite sure what the issue is: ```ts
input.replace('/([A-Z])/g', ' $1').trim();
// Seperates "MyString" into "My String"

#

Oh I'm a moron

#

I put quotes

#

lmfao

lyric mountain
#

Rubberducking saves the day again

wheat mesa
#

I think I've done that like 10 times today tbh

#

sometimes I miss java's strongly typed catch blocks

lyric mountain
#

Eh, u can't have typed exceptions in js?

wheat mesa
#

can't even have them in ts

lyric mountain
#

Like, inside catch

#

Weird

wheat mesa
#

I can set the type but I can't have multiple catch blocks for different types

#

hence why I have to use instanceof

#

now I think my next step is figuring out how to implement subcommand handling here

wheat mesa
#

well this looks like it's gonna suck

sudden geyser
#

think it should be simple

#

given a subcommand is just a kind of command

#

though I did it a few days ago and it was kind of cancerous at first

wheat mesa
#

my problem is that I'm still using the slash command builders for data

#

which is just a bad idea

#

and it was a bandaid solution at best

#

now I have to think of a way to post the data to discord and also differentiate between subcommands and regular commands on the local end

#

Ideally everything would inherit from my InteractionCommand class

#

But I just can't think of a way to do that feasibly

sudden geyser
#

just create some index (object/map) with the stuff you need?

wheat mesa
#

Maybe I could create some other class that keeps instances of InteractionCommands as "options"? No idea how I would represent that to discord's end though

#

I'm gonna take a quick food break and then I'll come back to think about it

lyric mountain
#

Just check the command signature

#

And compare with ur commands

#

You'd need to make a signature parser tho, so you have something to compare against

sudden geyser
#

wdym signature

wheat mesa
#

Dear god no

#

There’s a simpler solution I’m sure

lyric mountain
#

This is a command signature

#

So say, if u have /cmd <int> <string> you can match with your slash input

#

Alternatively, u can compare argument names

sudden geyser
#

please tell me you've never written something like that before

lyric mountain
sudden geyser
#

NO

wheat mesa
#

That’s what he did a while back

#

I remember it

sudden geyser
#

though I really don't see how something like this isn't possible:

const commands = {
  avatar: {
    data: ..., // builder stuff
    instance: ..., // actual command class?
    options: {
      guild: { // subcommand maybe?
        instance: ...,
        ...
      }
    }
  }
}

I do something akin to this and just transform the object into different forms I want

wheat mesa
#

Yeah I just have to think about how to specifically integrate something like that into my design

#

Okay I think I'm going to replace the builder type with my own type so it's easier to work with

#

since this is super simple

#

(And I'm not going to end up using half of it anyways)

#

That way instead of the stupid builders I can manually manipulate the data

#

agh nvm I don't think that even matters

#

If slash commands have subcommands, can they also be a standalone command?

#

Like if you have /a b, can there also be /a only?