#development

1 messages · Page 1929 of 1

jolly notch
#

Also web scrape websites

proven escarp
lyric mountain
#

protocol will always either be http or https

jolly notch
proven escarp
#

bad

jolly notch
marble juniper
proven escarp
#

i dont need reasons

sly sierra
#

Loom uses uhm his mind for reasons don’t mind h
I’m

#

He’s too smart for the universe

jolly notch
lyric mountain
#

don't think u can have non-english characters on domains

#

or can u?

marble juniper
#

well

#

they could use unicode

proven escarp
marble juniper
#

well you can't click the link

jolly notch
#

you can have emojis too

marble juniper
#

but someone could still search for it

#

without the unicode

#

lol

#

thats assuming someone would even go that far to bypass a filter

lyric mountain
#

such url would sabotage itself actually

jolly notch
marble juniper
#

don't think my regex could even match the unicode

#

lol

lyric mountain
#

u can if u use codepoints

jolly notch
marble juniper
#

I will just convert the string before running the regex on it

lyric mountain
#

like, [a-Z] doesn't match letters from a to Z, it checks if the codepoint is between those two

#

emotes have an specific codepoint range

#

so u could match from the start to the end

jolly notch
#

@marble juniper straight up block any non english domain

#

then make it an option to disable

marble juniper
#

opt in or opt out

#

lol

jolly notch
#

Well it makes sense

#

If you are a chinese server and need it then disable it

marble juniper
#

how do I detect if its not english

#

do I have to use some lang detection tool

jolly notch
lyric mountain
#

u could grab the site's metadata

jolly notch
#

it's the url itself rather than what the site has

lyric mountain
#

devs who care abt their sites will put enough metadata on the head

#

like language, author, og:tag shit, etc

marble juniper
lyric mountain
#

check the site's authenticity

#

scammers wont be that detailed

marble juniper
#

how do I check how much authenticity it has though

#

how do I measure that lol

#

also what if ur a development focused server

#

and someone shares their wip website

#

lol

lyric mountain
#

I mean, make it a multi-step verification

#

first check metadata, then url, then something else

#

that way u reduce possible false-positives

#

about WHAT to check in metadata idk, there is probably some standard or convention regarding what u need to put on a site

marble juniper
#

I would probably check the url first

#

lol

#

and even then if I checked metadata

#

my bot is open source

#

you gotta remember that

#

anyone can see how I filter messages lol

lyric mountain
#

don't think they'd bother enough tho

#

you're superestimating scammers

wicked pivot
#

""

#

?

lyric mountain
#

tf a sweater

wicked pivot
#

I don't really understand

earnest phoenix
#

you wanna make this?

wicked pivot
#

ow, xDDDD google translate

#

I'm very bad at English sorry

jolly notch
#

Click on some of those steam scams and etc

#

Take the content of that and try and filter against that

feral aspen
#

Hey.

#

.. so I did sudo apt upgrade and this came.

boreal iron
#

Yeah Ubuntu firmware update 21+

#

Go with the selected one

feral aspen
#

500mb used, bruh.

#

What does this command, do? curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -

proven lantern
#

probably installs node version 11

#

i wouldn't do it

#

dont use odd numbers

feral aspen
#

I did setup_17.

boreal iron
#

Downloads and installs nodejs 11 via bash not the package manager

#

While v11 is a little bit outdated freerealestate

feral aspen
#

It keeps crashing.

boreal iron
#

That’s not nodejs fault

feral aspen
#

I see.

#

I can't access the files from a VPS?

wheat mesa
#

?

#

Nodejs processes crash on unhandled promise rejections now

boreal iron
#

Obviously the JSON file is corrupted

solemn latch
#

op

boreal iron
quartz kindle
#

you're trying to access json data from a website

#

but the website is returning html data, not json

woeful pike
#

corrupted json file

solemn latch
#

its pretty corrupted considering its the wrong file type

proven lantern
#

json was a pretty good idea

shy turret
#

how do you get motivation?

#

yes this is a development question

spark flint
#

look at others creations

#

then set a determination to build something better

shy turret
#

i have

#

but

#

i still have no motivation, im just forcing myself.

#

or well, i dont know how to get motivation on what i already created.

solemn latch
#

Like updating/improving stuff you have made?

shy turret
#

thanks, ill try

quartz kindle
#

404 Motivation Not Found

gritty bolt
#

anyone know if there's a way to fire an action upon my account being followed on tiktok?

woeful pike
#

you probably have to monitor your follower count regularly and check for changes

gritty bolt
#

ooh that's actually not a bad idea, my idea would work better if I could get the username of a person when they follow, but I might be able to do without

quartz kindle
#

they have webhooks, but i didnt see anything related to follows

gritty bolt
#

yeah I've been looking online for a while and haven't gotten far

woeful pike
#

tiktok doesn't really want you using its data from what I remember

gritty bolt
#

well that's unfortunate

spark flint
#

how do i download a file from a buffer in node.js

#

@drowsy crag

quartz kindle
#

wdym download from a buffer

#

a buffer is already downloaded

woeful pike
#

I thought you pinged nom for programming help for a second

spark flint
#

ignore the ping btw, thats for a nitrob scam

#

lmao

spark flint
quartz kindle
#

if you have the buffer, literally just write the buffer using fs

#

if you have a stream, then you have to read it first, or you can also stream it directly to a file, also using fs

woeful pike
#

are you on js? if you're getting files from a post request chances are they're already being written to disk unless you're specifically choosing the in-memory option

lament rock
#

does the built in http lib write to disk?

woeful pike
#

I have gone through every single js multipart form parsing library in this god forsaken earth. The only one that doesn't automatically try to write files to disk is multer and you have to specifically tell it not to do that

quartz kindle
#

dafuq

woeful pike
#

the built in lib doesn't parse attachments in multipart forms

quartz kindle
#

where do they write to disk? http libs give you a stream, up to you what you do with it

#

most libs give you an option to download it in various formats

woeful pike
#

which http lib does that aside from multer?

quartz kindle
#

multer is not an http lib, its just a stream parsing library for multipart formdata

woeful pike
#

well I'm assuming they're using express

quartz kindle
#

im assuming they are making a get request

#

not running a server

woeful pike
spark flint
#

i got it working now

tidal smelt
#

EEE

woeful pike
#

how did you end up solving it?

quartz kindle
#

ah well, in express almost everything is automated

#

my bad then

woeful pike
#

micro (nextjs) doesn't have anything for parsing multipart forms so I had to plug in multer in the most disgusting way possible

spark flint
quartz kindle
#

i dont like multer, idk

woeful pike
#

yeah it sucks. The js ecosystem is just terrible I hate it

#

like it's convenient but.. yeah

#

not when you need control of stuff

quartz kindle
#

i got used to working with tcp streams directly

#

they can be quite fun

lament rock
#

possible that ClientApplication is null

#

might want to log

#

idk then. Everything should be a-o-good in the ready event

earnest phoenix
#

wait an hour

#

you are loading global commands

#

you aren't loading guild specific commands so you have to wait an hour

#

if you don't wanna wait just load em specific to a guild

#

how you do that no idea

#

mhm

#

djs right?

#

if so

#

idk if there is another

#

this one uses rest directly

lament rock
#

GuildApplicationCommandManager exists

earnest phoenix
#

mmm that works then ig

#

imagine loading all commands for every guild that bot is in instantly

#

i'd guess it has part of it being that it would spam it too much trying to do that

#

could be other reasons tho

boreal iron
#

No because the server (guild) backend doesn’t query the database each second to figure out if you have registered a command or not

#

So anything is cached and has its own refresh time

#

Guilds are requesting global command once each hour

earnest phoenix
#

Ah I see

boreal iron
#

Some things are always cached, some need to be pushed just in time

earnest phoenix
#

I thought it had an issue with spamming the api to register the commands

boreal iron
#

No you register them in Discords backend and frequently any guilds ask the backend if there’s something new they should know

#

To say it simplyfied

#

And yeah I also believe this prevents spam registering and deleting commands, too

mental river
#

Help

#

I need my top.gg bot token like now

#

For my vote reward

solemn latch
mental river
#

Bruh

#

How can I dev something to get approval if I can't dev?

#

Tel me

sudden geyser
#

You don't need vote rewards to get approved.

#

How about disabling it until your bot is approved?

rocky hearth
#

Is this bad the way i hv called the hooks?

woeful pike
#

not as bad as the way you decided to show your code

rocky hearth
#

Sorry, i am on my mobile.

#

I hv been warned that react hooks should not be called conditionally. So what should I do?

earnest phoenix
#

mmm blur

woeful pike
#

if you need user to be non-nullable you should be accepting it as a prop instead of rendering an empty component

#

rendering a null component is the wrong choice 99.9% of the time. You should instead use that data in a parent component to decide whether you should render anything at all

rocky hearth
#

Ok. 👍

loud tree
#
b = int(input("Enter second Number: "))
List = []
list = []
for i in range(1, a+1):
  if a % 10 == 0 or b % 10 == 0:
    print("Invalid Input")
    break
  elif a % i == 0:
    List.append(i)
    
  for k in range(1, b+1):
    if b % k == 0:
      list.append(k)
sum1 = sum(List)//a
sum2 = sum(list)//b

if sum1 == sum2:
  print("Friendly")
  
else:
  print("Not Friendly")```
#

idk whats happening

#

it always shows Not Friendly

ripe prairie
#

so sum1 never equals sum2

#

try printing sum1 and sum2 before py if sum1 == sum2:

#

see what the values are

loud tree
#

lemme show you an exmaple

#

For example, numbers 6 and 28 are friendly as the abundancy of 6 = (1+2+3+6) / 6 = 2, is same as abdunancy of 28 = (1+2+4+7+14+28) / 28 = 2.

ripe prairie
#

also

#

why is one of your for loops inside another for loop

#

that's probably your issue

loud tree
#

coz Whole numbers are not allowed

earnest phoenix
#

looping inside a loop oof

ripe prairie
#

yeah you're looping inside a loop

loud tree
#

nested loops?

ripe prairie
#

that's a problem because you're running the second loop more than once

#

which i dont think is what you meant to do

loud tree
#

should'nt i use them

earnest phoenix
#

looping inside a loop is just slow and useless imo

ripe prairie
#

well that's not the point here

loud tree
#

bruh i am learning rn, for me solving is first

earnest phoenix
#

I don't exactly know whats going on I just saw a loop inside a loop

ripe prairie
#

not very helpful then

loud tree
#

ok wait lemme modify

#
b = int(input("Enter second Number: "))
List = []
list = []
for i in range(1, a+1):
  if a % i == 0:
    List.append(i)
    
for k in range(1, b+1):
  if b % k == 0:
    list.append(k)
sum1 = sum(List)//a
sum2 = sum(list)//b

if sum1 == sum2:
  print("Friendly")
  
else:
  print("Not Friendly")```
#

now?

ripe prairie
#

well try it

#

see if it works

loud tree
#

ya it's working

#

but i also want that if anyone inputs a whole number it should so INVALID INPUT

#

any ideas for doing so?

ripe prairie
#

if you're using an int, it'll always be a whole number

loud tree
#

F

#

i forgot lmao

ripe prairie
#

you're probably looking for float

#

which supports decimals

loud tree
#

ya

#

i'll float

earnest phoenix
#

you'll float too

#

ok I go now

slender thistle
loud tree
earnest phoenix
#

ye shiv no one asked u

loud tree
#

if you have such a great PROBLEM with my questions ask mod to ban me :)

earnest phoenix
#

eh?

ripe prairie
earnest phoenix
#

you can't really get banned based on a question

#

unless it breaks one of the rules ig

loud tree
#

ya but he gets offended always so i said

#

ok nvm no more discussions

cold meteor
#

Oh this is where everyone is

earnest phoenix
#

just a few people

ripe prairie
#

all of you gotta stop with the random ass underhand comments

#

especially you @earnest phoenix

earnest phoenix
#

what?

slender thistle
#

I should probably divide my large exponents into lots of smaller ones and multithread them to speed up my program

#

The question is, how many threads should I limit myself to? think

ripe prairie
#

Probably would be an algorithm to sort that out

#

Possibly?

slender thistle
#

I guess so. Wonder what algorithm can help me out for that though

sudden geyser
slender thistle
#

Mhm, math

ripe prairie
#

looking around, dont really think there is one

#

especially not one to include multithreading

slender thistle
#

rip

ripe prairie
#

i mean there's algorithms for fast exponential computation but at that point, you'd slow it down trying to split the exponent apart and divide it between threads i think

slender thistle
#

Not really sure myself

#

izi_sip I guess I'll worry about it when I actually have time for it

#

Time to use Wolfram

clear marlin
slender thistle
#

I'll give you 2 tries to guess

#

😛

clear marlin
#

and where, ofc.

ripe prairie
#

pythong

slender thistle
#

Almighty Rust

unique shore
#

hey everyone, anyone has recommendations for discord api libraries for javascript? I use discordjs but I've heard is not the best when it comes to performance

clear marlin
#

if there's something like a job that needs to be done every interval imho that's where you'd use coroutines

clear marlin
#

i mean implementing threading in rust isn't hard

#

if you ask me

slender thistle
#

It really isn't, it's just that I'm a lazy motherfucker right now

clear marlin
#

but just in mind, only use threading for a job you'd do after the main thread, cause the main thread would always run first.

slender thistle
#

I mean if my threads rely on, say, p and q, which I pass to a function

#

I don't think I'm spamming threads first KEKW

clear marlin
#

ofc not.

unique shore
slender thistle
#

I'm wondering how that's possible though

#

I mean, running additional threads before the main one

clear marlin
#

idk if you can do that

slender thistle
#

Same lol

clear marlin
#

all i know is that you can pass values between threads which is useful

slender thistle
#

My multithreading in few words: "Arc clones and fuck you!"

delicate shore
#

How to show people a warning thingy if the extension isn't latest version

#

chrome extension ^

slender thistle
#

Maybe I should work with references a bit more in those cases

plucky harness
#

May i know why are some bots with wayy lower votes showing above other bots with higher votes.

delicate zephyr
#

probably not posting / posted count with dev bot

woeful pike
#

otherwise there wouldn't be any point to having a search feature at all

green kestrel
#

I wrote it informally to try an explain a quite abstract issue

plucky harness
#

Even though they have more votes

woeful pike
#

relevance of content, tags, etc. I couldn't tell you because I don't work on search so I don't know

plucky harness
#

i understand. But i don't understand why would that make you place lower. And if relevance of content was indeed a thing why are some bots with anime names and moderation features in top lists

#

If all it should also be sorted according to ratings and votes. I don't know what kind of wierd algorithm is being used but i can definitely say it's not effective at all and it's way worse than the old design. Its really flawed. You're saying that it depends on the relevance of content. Thats subjective. Lets say it isnt. How are you judging the content other than the ratings of the bot. No way you're just jugding the content of the bot by the name.

bots with

Less Votes and less than 4.2 ratings are listed above the ones with More votes and 4.8+ ratings. Thats a really flawed algorithm there

Relevance of content. Hmm, Bots with tags like moderation and Music are being listed on anime. Thats the relevance of content

#

a 10k vote bot is placed above 33k vote bot

#

Same thing with auctions feature which i reported in the other channels. Oh well. All i want to do is convey the things to the person who's responsible for the search. And get the right answers or get things fixed

earnest phoenix
#

man writing an entire essay just to have their bot on top of search

plucky harness
#

I dont need my bot on top. I buy auctions for that. I just dont understand the algorithm which places the bots wierdly.

#

Earlier in this new design , There wasn't even any sorting done in the search. Now its being done but not accurately and if its done accurately i need answers on why bots with lower ratings + lower votes are placed above bots with higher ratings + higher votes so i can improve.

woeful pike
#

were still growing and there will eventually be a team responsible for dealing with search alone

#

since it's not an easy problem to tackle

#

there needs to be some kind of heavy handed approach for the time being. People were just as mad about only sorting by votes

solemn latch
#

no matter how search is handled someone will be unhappy.

plucky harness
#

Thank you for answering. All i want is to get the word across to the actual people who work on search. Also, i think people would be more mad if some bot with lower votes + lower ratings being above them.

#

Thats my question how is it handled atm.

woeful pike
#

relevance is an important metric but also difficult to get right. It's a small factor for now so votes are still the big one, it just doesn't account for 100%

earnest phoenix
#

why not use something like algolia

woeful pike
#

because algolia is unfathomably expensive

#

I don't understand how any company has the budget to pay for it

quartz kindle
#

use google's search widget :^)

earnest phoenix
woeful pike
#

what

quartz kindle
#

^

woeful pike
#

oh that's a saas company for accessibility

earnest phoenix
#

accessibe is a website that claims to make your site more accessible but it actually makes it worse

woeful pike
#

missing some context there

earnest phoenix
quartz kindle
#

accessibe without L?

#

thats their name?

woeful pike
#

seems like some cringe enterprise wordpress B2B company

earnest phoenix
quartz kindle
#

the kind of company that makes money by tricking businesses into thinking they need them

woeful pike
#

lol

quartz kindle
#

because business heads are stupid

earnest phoenix
quartz kindle
#

99% of bots are not businesses tho xd

plucky harness
#

If votes based sorting are no longer a thing and some unknown metrics are used for search. What should one aim for to reach upper spots

plucky harness
#

auctions are temporary ( a week)

#

i mean what should one aim for to reach upper search level spots

spark flint
plucky harness
#

if no of votes and 4 .8 + ratings are no longer a big factor

earnest phoenix
#

how to get better seo:

  1. don't use <div class="button"> use a fucking <button>
  2. accessibility
  3. ads
  4. don't use <div class="button"> use a fucking <button>
  5. accessibility
quartz kindle
#

well, keyword searching should always be based on title+description revelance, heavily weighted by title
other than that theres not much factors you can use besides like top by votes, or top by invites, if top.gg tracks invite clicks

woeful pike
#

add relevant keywords in your description to pop up in search results

quartz kindle
#

you could also have a "surprise me" option with randomized bots

woeful pike
#

that sounds fun but I doubt anyone would use it

#

AAHH ok it's weekend I'm done talking work

tired panther
#

Nice idea

earnest phoenix
plucky harness
#

you could also ( if possible ) if votes are being done through same ips

plucky harness
#

you could lower that bots position

earnest phoenix
#

doesn't it return the message?

#

const message = await interaction.reply();

#

idk I haven't used djs since I acquired brain cells

quartz kindle
#

xD

plucky harness
quartz kindle
#

everything is fucked up robin

earnest phoenix
plucky harness
#

haha

quartz kindle
#

its always been like that

#

:^)

earnest phoenix
plucky harness
#

Well i can give u how fucked it is in numbers

earnest phoenix
quartz kindle
#

googolplexianth

earnest phoenix
#

aleph null

plucky harness
#

Thats after 1 whole week of ad^

spark flint
quartz kindle
plucky harness
#

140$ went in trash

spark flint
plucky harness
#

it was 240$ actually

spark flint
#

mine was like $10 and i got 64 views

quartz kindle
#

i never paid for ads

plucky harness
#

240$ ad for ( 1 click ) epicness

quartz kindle
#

i got it free for being certified

spark flint
#

its sad that i only got a refund because i contacted the bank

earnest phoenix
quartz kindle
#

^:)

plucky harness
earnest phoenix
quartz kindle
#

nu

earnest phoenix
#

whyyyyyy

tired panther
#

Lol

spark flint
#

consumer laws in the uk state that a company must refund within 14 days of me contacting them, if i contacted within 14 days of purchase

#

its complicated but they have to follow it

quartz kindle
#

isnt top.gg based on netherlands?

earnest phoenix
#

you can lawsuit a website for not having accessibility

plucky harness
#

i also want refund on my 240$ which i got 1 click on

tired panther
#

Their Head Company is...

spark flint
earnest phoenix
#

my favorite lawsuit is accessibility lawsuit

earnest phoenix
plucky harness
spark flint
#

also it shouldn't take nearly 15 days just to tell me that they are looking into it

plucky harness
#

i havent gotten a reply in 2 weeks now

quartz kindle
#

this convo made me search for stupid lawsuits.. was not disappointed

Inmate Sues State for His Flatulence/Gas
Unfortunately, silly lawsuits are overwhelming many state and federal courts. Consider Case No. 9650302 in Michigan where the prisoner sued the State of Michigan stating that the food in prison was causing his flatulence problem.

plucky harness
#

probably will have to refund through bank

#

or paypal

spark flint
#

yeah

tired panther
#

They can automate the refund system

spark flint
#

they should

plucky harness
#

i'll dm u

spark flint
#

can't wait to be warned for exposing their shit refund process KEKW

quartz kindle
#

did you try to await it?

#

this means it does return a message, but in some cases a raw message or nothing

#

for example, ephemeral messages might not return a message, since well, they are not visible except to the command user

#

so await it and check what it returns

earnest phoenix
slow terrace
#
const Topgg = require("@top-gg/sdk")
const express = require("express")

const app = express()

const webhook = new Topgg.Webhook("your webhook auth")

app.post("/dblwebhook", webhook.listener(vote => {
  // vote will be your vote object, e.g
  console.log(vote.user) // 395526710101278721 < user who voted\

  // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))

app.listen(80)

How to use it from heroku webhook?

spark flint
earnest phoenix
#

Okay

#

Ty!

spark flint
#

Lol

split hazel
#

this is why i dont like these automatic webhook poster libraries

#

they assume you have a compatible environment

earnest phoenix
#

I have win7

spark flint
#

i have win69

earnest phoenix
#

if you can support internet explorer why not support win7

#

or use win7 to write apps that support win7/IE

sudden geyser
earnest phoenix
#

I chose the second one

sudden geyser
#

if you support IE

brazen jackal
#

how do i listen for the webhook in my discord bot?

earnest phoenix
sudden geyser
#

You can support people with disabilities while not supporting archaic software.

split hazel
#

whats a programming language blind people would love to use

#

c

#

that was quite deep ngl

solemn latch
slender thistle
#

Blindly poking into the dark with that humor I see...

#

I guess no one could've seen it coming

earnest phoenix
#
    let cmduser = message.author;
    let menuoptions = [ 
      {
        value: "role1", description: "Get Role 1",
        replymsg: "This is the message for Role 1", emoji: "❌" //optional
      }, {
        value: "role2",  description: "Get Role 2",
        replymsg: "This is the message for Role 2", emoji: "✅" //optional
      } , {
        value: "role3",  description: "Get Role 3",
        replymsg: "This is the message for Role 3", emoji: "✅" //optional
      } , {
        value: "role4",  description: "Get Role 4",
        replymsg: "This is the message for Role 4", emoji: "✅" //optional
      } , {
        value: "role5",  description: "Get Role 5",
        replymsg: "This is the message for Role 5", emoji: "✅" //optional
      } 
    ]
    //define the selection
    let Selection = new MessageMenu()
      .setID('MenuSelection') 
      .setMaxValues(1)
      .setMinValues(1) 
      .setPlaceholder('Click me to make a Selection!');  placeholder
    menuoptions.forEach(option => {
      let row = new MessageMenuOption()
        .setLabel(option.label ? option.label : option.value)
        .setValue(option.value) 
        .setDescription(option.description) 
        .setDefault() 
      if(option.emoji) row.setEmoji(option.emoji) 
      Selection.addOption(row)
    })
    //define the embed
    let MenuEmbed = new Discord.MessageEmbed()
      .setColor("BLUE")
      .setAuthor("Bot Help", client.user.displayAvatarURL())
      .setDescription("***Select what you need in the `Selection` down Below!***")
    //send the menu msg
    let menumsg = await message.channel.send(MenuEmbed, Selection)
    //function to handle the menuselection
    function menuselection(menu) {
      let menuoptiondata = menuoptions.find(v=>v.value == menu.values[0])
      menu.reply.send(menuoptiondata.replymsg, true);
    }
    //Event
    client.on('clickMenu', (menu) => {
      if (menu.message.id === menumsg.id) {
        if (menu.clicker.user.id === cmduser.id) menuselection(menu);
        else menu.reply.send(`:x: You are not allowed to do that! Only: <@${cmduser.id}>`, true);```
#

Discord.js v12 btw

#

Is there anything wrong with that?

rotund gorge
earnest phoenix
rotund gorge
#

v12 is deprecated I don't think people would help you

earnest phoenix
#

edw_Shrug Its worth a shot. :)

rotund gorge
#

💀

slow terrace
slender thistle
#

Free != Decent

crystal wigeon
#

is there a way i can clone the djs interaction or message object?

sudden geyser
spark flint
#

@woeful pike does the /bots?search=Luca api endpoint still work?

#

changing the search bit or removing entirely doesn't change the results

slender thistle
#

The better question would be

#

Actually, no, I don't think it applies anymore

crystal wigeon
#

MessageEmbed.attachFiles is no longer a thing on DJS?? wtf?

orchid fox
#

How to make this code

lament rock
crystal wigeon
#

I've been using messageembed.attachfiles all along and this worked fine, but upgraded to djs 13 and the entire thing is fked

#

man

orchid fox
quartz kindle
#

v11 to v12 also broke tons of shit

crystal wigeon
#

understandable but mannnnn

quartz kindle
#

its all explained in the update guide docs

crystal wigeon
#

migrating to slash commands is already discouraging to me

#

ye just saw

quartz kindle
#

well slash commands are not even djs's fault, its discord itself lul

#

but yes, everyone feels the same way about them

crystal wigeon
#

ye i mean. if i dont have to use slash commands. i dont have to update djs to 13. im happy with 12.5,

#

plus slash commands are gonna be pain for mobile users

cinder patio
#

you will have to

#

message intent

lament rock
#

v12 uses api v8 and v13 uses api v9

#

v8 will be deprecated

#

surprised v6 is still functional

quartz kindle
#

v8 and v9 were released quite fast

#

v6 was standard for several years, v8 wasnt even standard for a full year

#

and v7 was never standard

#

for it kinda makes sense they decided to keep v6 around for a while

#

v6 = windows xp
v7 = windows xp black edition
v8 = windows vista
v9 = windows 7

orchid fox
#

Brb

earnest phoenix
#

Has "guild.region" discord.js v13 been removed as well?

lament rock
#

Hope v10 won't be the Windows 8 of Discord

earnest phoenix
lament rock
earnest phoenix
#

can I do something like this?

//IN A BLANK FILE
let objectt = {
"name": {name:"HI", level: "10"}
....
...
..
.
}```
```js
//IN MY CODE
const { objectt } = require("../file.js")
let newobject = objectt
#

my question is can I store objects and then reuse it in other codes?

#

because I have a object that occupies like 200 lines of code and it has left more things so I don't like to have a 1000 lines file and then add another 200 lines

lament rock
#

Yes you can. You can even Object.assign(object, newValues) to the file that only exports an Object and that'll appear in other files.

That way is a super easy way to store db connections or your client

earnest phoenix
#

ok

#

i understood a bit

#

how does that work in js

quartz kindle
earnest phoenix
#

I just need to change the original object

#

but how do I store it in another file? json?

quartz kindle
#

yes as long as you dont change it, you can simply assign it

#

wdym other file?

#

if you mean at runtime, you just require it

earnest phoenix
#

ik

#

but i need to define the object, no?

#

where do i define it

#

to require it later

quartz kindle
#

the file that has the object has to export it

#

then in all other files, you just require that file

earnest phoenix
#

it gives me error when i define it in a blank file, there is a method or something?

quartz kindle
#

wdym? example?

#

anyway i have to go, someone else will surely be able to help

earnest phoenix
#

ok

#

thx tim

lament rock
#

Go ahead and show code where you export and require it

earnest phoenix
#

now somehow works

lament rock
#

that's the scariest part of development

earnest phoenix
#

the errors maybe were replit's code intelligent thing bug

#

or i put something badly and somehow it fixed

#

now i'm saving 300 lines of code in every commands

lament rock
#

proud of u

earnest phoenix
#

:')

earnest phoenix
#

@lament rock nah

#

now it's undefined

#

and where it works, I can't console.log it

#

idk why

#

I did this:

let { chh } = require("../../object.js")
#

where it works i used this:

console.log("HI",Object.values(chh))
``` the console log has all this because only chh doesn't work, then i used object.values and doesn't work and now with a string is same
#

nothing appears in the console

#

and in other commands it's undefined when i console log it

quartz kindle
#

show object.js

earnest phoenix
#

Are you exporting chh?

#

If you are not exporting chh then chh can't be destructured iirc

quartz kindle
#

show how you export it

earnest phoenix
#

I am curious if they are exporting at all if it shows undefined no?

earnest phoenix
#

thats not exporting

#

Show how you export chh in object.js

#

?

earnest phoenix
#

Alright so ima guess you aren't exporting at all if you don't know what we are saying

#

i only have the object there

#

When you are going to destructure something from a file

#

you have to export it

#
module.exports = { chh }
#

oh

#

i seen that many times but i don't know to use it completely so that's how I export it

#

that is a basic way of exporting something yes

#

my english sucks

#

its fine

#

ok

quartz kindle
#

you can only use require on stuff that you export

#

if its not exported, then require will not find it

earnest phoenix
#

ah ye that as well mmLol

#

Unless you are requiring the whole file that is and not trying to get a specific thing right?

#

I haven't used js in ages so I am unsure anymore

#

but you can just do

let numbers = require('numbers.js')

number.variableInNumbersjs
#

and access that variable in the file right?

quartz kindle
#

nope

#

numbers.js has to export something

#

the default exported value is an empty object

#

so if numbers.js doesnt export anything, numbers will be {} and numbers.variable will be undefined

earnest phoenix
#

Ah I see

#

I thought you could access variables if you just require the whole file

marble juniper
#

does someone know how I can prevent someone from bypassing my regex filter by doing this:
s c a m . d o m a i n

#

using javascript

#

like im trying to scan discord messages for such domains and stuff

#

I thought about removing any spaces from the message but then links that are in the message could become invalid if you know what I mean

earnest phoenix
#

can't you just also include ignoring whitespaces?

earnest phoenix
#

Ignoring whitespaces would only work ig if they only send a link

marble juniper
#

ignoring whitespaces would only work if they only send a link or the link is at the end of the message

earnest phoenix
#

yea

marble juniper
#

but if its anywhere in the message outside of that it would become invalid

earnest phoenix
#

Yep, hm

marble juniper
#

berry has something like this in censorbot but for me its more difficult to implement

#

since im not just looking for words

#

lol

earnest phoenix
#

yea, I myself am kind of unsure how to do it for any case

marble juniper
#

because rn I can detect domains or links and I can also convert unicode to normal already

#

would suck if I couldn't detect links because of someone just using spaces

green kestrel
#

lol wut github

#

fell off a cliff.

#

cant even push to repos atm

sudden geyser
#

github breaks quite often

green kestrel
#

yeh

#

more so since it all got moved to azure

sudden geyser
#

more so since it all got moved to azure
they actually did it?

#

never thought they would

green kestrel
#

yes

#

actions, sites, and the frontend are on azure linux boxes

proven lantern
#

who broke github

#

im trying to do things

green kestrel
#

me sorry

#

i'll plug it back in

proven lantern
#

thanks

green kestrel
#

i tripped my fat legs over the power cord

#

its dead jim

sudden geyser
#

damn I need github now

green kestrel
#

everything but gh pages

#

at least dpp.dev still up lol

proven lantern
#

my push was like 1ms too late

#

12:45:14.317

split hazel
#

yeah dont think this is gonna push anytime soon

#

decode?

sudden geyser
#

decipher probably

zealous veldt
#

Anyone know if there is an easy way to make VSCode not destructure autoimports? ie instead of autocreating pic 2 from the 1st pic, create pic 3?

opaque acorn
#

how can I get my bot to reject commands if they are sent by dm?

boreal iron
#

check if the channel is a DM

opaque acorn
opaque acorn
#

thx

lament rock
#

TypeScript is epic:

export default exports as typeof import("./currentFileName");

no more issues about a mod not having a default export

green kestrel
#

so github have found the issue, it's a one line fix.
problem is they have to wait for github to be back up to merge the PR. kekek

opaque acorn
boreal iron
#

ya but with the correct operator

#

not =

pale vessel
#

====

opaque acorn
#

okay but if i put a command in the dm i have an error of the custom prefix

#
 let p = prefixdb.has(message.guild.id) ? await prefixdb.get(message.guild.id) : "?";
                                     ^
TypeError: Cannot read properties of null (reading 'id')
at module.exports (/app/events/guild/message.js:11:38)
    at Client.emit (node:events:390:28)
    at MessageCreateAction.handle (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (node:events:390:28)
    at Receiver.receiverOnMessage (/rbd/pnpm-volume/c290736d-ac11-40a4-84d0-f746c6b46909/node_modules/discord.js/node_modules/ws/lib/websocket.js:983:20)
boreal iron
lament rock
opaque acorn
#

======

quartz kindle
#

= =

= =

lament rock
#

= = =

     =

= = ===

spark flint
#

=

oak matrix
#

Whata bit sequence?

sudden geyser
#

A sequence (collection) of bits (ones and zeros)?

wheat mesa
# pale vessel `====`
===========     ===========      ===========      ===========

===========     ===========      ===========      ===========```
slow terrace
#

I know what is this dm me 👀

#

Don’t know basics to use computer lol KEKW

pale vessel
#

...hear?

earnest phoenix
#
let channel = db.fetch(`setuped_${message.guild.id}`, channel.id);

     db.subtract(`setuped_${message.guild.id}`, channel.id);
    message.reply(`Reports channel deleted from the Database. `)
        }}

Error:
```let channel = db.fetch(setuped_${message.guild.id}, channel.id);
^

ReferenceError: Cannot access 'channel' before initialization```

#

I also tried this:


     db.delete(`setuped_${message.guild.id}`);
    message.reply(`Reports channel deleted from the Database. `)
        }}
#

Then it did reply and said that it was deleted, but didn't delete from quick.db's db

pale vessel
#

you accessed channel in one of the parameters but it wasn't declared

earnest phoenix
#

How might I delete it tho?

#

Just all of it from the DB

pale vessel
#

channel.id what do you think channel is?

#

it must be declared before let channel =

earnest phoenix
#

How would I fetch what the current channel is set to?

pale vessel
#

But you're also declaring a new variable called the same thing

earnest phoenix
#

mhm

#

Confusion o-o

quartz kindle
#

fetch does not have 2 parameters, its only one, the key you want to fetch

#

you cant subtract an id, its not supposed to be used as a number

#

subtract is for math only

earnest phoenix
#

Well, I want it to delete it from the db

#

So db.delete would be better

quartz kindle
#

yes, delete is correct

earnest phoenix
#

but idk how to fetch channel and define it.

quartz kindle
#

fetch only takes 1 parameter

earnest phoenix
#

So just a wee confused there lol

earnest phoenix
earnest phoenix
#

Is there a way that I can do something like:

.snippet add <command_name> <command_description> and have it save in quick.db?

#

db.add(`snippets_${message.guild.id}`, `${command_name}_${command_description}`)?

#

Is there something as such or close to that?

quartz kindle
#

depends what you want to do with it

#

do you only want to save the name and description?

#

like just that piece of text?

#

nothing else?

#

can one guild only have one snippet?

#

or can it have multiple?

earnest phoenix
#

Yeah, so when a user uses:

for example. .snippet <command_name> it comes out with <command_description>

earnest phoenix
quartz kindle
#

will you need to list available snippets in a guild?

earnest phoenix
#

Just got back to coding after a straight year of not, so getting back used to it.

earnest phoenix
quartz kindle
#

so best use an array

#

pretty sure quick.db supports them

#

or an object might be better

#

let me check if quick.db supports what im thinking

earnest phoenix
#
db.add('snippets.${message.guild.id}', '${snippet_output}')```?
quartz kindle
#

add is for math

earnest phoenix
#

o-o

quartz kindle
#

its the opposite of subtract

#

use set and get for other types of data

earnest phoenix
#

wouldn't set replace the already there snippet?

quartz kindle
#

from what i undestand, quick.db should support this

#
db.set(`snippets.${message.guild.id}.${snippetName}`, snippetDescription);

const description = db.get(`snippets.${message.guild.id}.${snippetName}`);
const allSnippets = db.get(`snippets.${message.guild.id}`);
earnest phoenix
#

Oh sweet, will go try it now, thats awesome, thanks! I will get back to you in like 30 mins "ish"

#

would the "allSnippets", contain the command name and description?

quartz kindle
#

yes, all of them

earnest phoenix
#

No error on the logs or anything, just "[object Object]"

quartz kindle
#

you tried to send an object as a string

#

objects need to be serialized

earnest phoenix
#


db.set(`snippets.${message.guild.id}.${snippetName}`, snippetDescription);

message.reply(`Snippet ${snippetName} added!`)



const description = db.get(`snippets.${message.guild.id}.${snippetName}`);
const allSnippets = db.get(`snippets.${message.guild.id}`);

const embed = new Discord.MessageEmbed()
.setDescription(`All of ${message.guild.id}'s Snippets\n> - ${allSnippets}`)
message.reply({ embeds: [embed] })
  }
}```
quartz kindle
#

JSON.stringify(allSnippets)

earnest phoenix
earnest phoenix
quartz kindle
#

yes

earnest phoenix
#

It works!

#

How might I spiff that up a bit tho?

#

Cause I would eventually want to fetch 1 of them, like

.snippet THIS sends in a embed: IS A TESTING COMMAND

#

or well

quartz kindle
earnest phoenix
#

.snippet <command_name> returns <command_description lmfao, I am bad at explaining things.

earnest phoenix
#

So that "description", just to clarify, when I use it in the command .snippet <command_name> will return the description of the snippet too?

quartz kindle
#

in my example, the description line shows how to get a single command description with a command name
the allSnippets line shows how yo get all commands and their descriptions with only a guild id

earnest phoenix
#

Ayo, your awesome!

#

That fr did help, and I learned something new lmfao

quartz kindle
#

you dont need to have both lines at once, just use the line that is appropriate for each command

#

did you log it?

earnest phoenix
#

Wym by both lines at once?

quartz kindle
#

did you await it?

#

is it ephemeral?

#

show code

#

try adding fetchReply: true

#

.reply({ embeds: [embed], fetchReply: true })

fresh bluff
#

why is my bot not counting my XP

#

is this a code error?

solemn latch
#

probably best to check the database, or code you wrote to save xp to the database

solemn latch
#

sure, but I may not be able to help. someone else may be able to

fresh bluff
#

XP code

const db = require('quick.db')
const { getInfo } = require("../../handlers/xp.js")
const canvacord = require("canvacord");
const Discord = require("discord.js");
module.exports = {
name: "level",
aliases: ["lvl", "rank"],
description: "Get the level of Author or Mentioned",
usage: "level [user]",
category: "info",
run: (client, message, args) => {
const user = message.mentions.users.first() || message.author;

if(user.id === client.user.id) { //IF BOT
  return message.channel.send("😉 | I am on level 100")
}

if(user.bot) {
  return message.channel.send("Bot do not have levels")
}

let xp = db.get(`xp_${user.id}_${message.guild.id}`) || 0;

const {level, remxp, levelxp} = getInfo(xp);

const rank = new canvacord.Rank()
.setAvatar(user.displayAvatarURL({dynamic: false, format: 'png'}))
.setCurrentXP(remxp)
.setRequiredXP(levelxp)
.setLevel(level)
.setStatus(user.presence.status)
.setProgressBar("#00FFFF", "COLOR")
.setUsername(user.username)
.setDiscriminator(user.discriminator)
.setRank(1, "a", false)
.setBackground("IMAGE", "https://cdn.discordapp.com/attachments/787340979148947466/801140313132367872/PicsArt_01-19-10.54.56.png");

rank.build()
.then(data => {
const attachment = new Discord.MessageAttachment(data, "automodRankcard.png");
message.channel.send(attachment);
});

}
}

sudden geyser
#

Can you wrap that in a code block?
```js
code here
```

fresh bluff
#
const db = require('quick.db')
const { getInfo } = require("../../handlers/xp.js")
const canvacord = require("canvacord");
const Discord = require("discord.js");
module.exports = {
  name: "level",
  aliases: ["lvl", "rank"],
  description: "Get the level of Author or Mentioned",
  usage: "level [user]",
  category: "info",
  run: (client, message, args) => {
    const user = message.mentions.users.first() || message.author;
    
    if(user.id === client.user.id) { //IF BOT
      return message.channel.send(":wink: | I am on level 100")
    }
    
    if(user.bot) {
      return message.channel.send("Bot do not have levels")
    }
    
    let xp = db.get(`xp_${user.id}_${message.guild.id}`) || 0;
    
    const {level, remxp, levelxp} = getInfo(xp);
    
const rank = new canvacord.Rank()
    .setAvatar(user.displayAvatarURL({dynamic: false,  format: 'png'}))
    .setCurrentXP(remxp)
    .setRequiredXP(levelxp)
    .setLevel(level)
    .setStatus(user.presence.status)
    .setProgressBar("#00FFFF", "COLOR")
    .setUsername(user.username)
    .setDiscriminator(user.discriminator)
    .setRank(1, "a", false)
    .setBackground("IMAGE", "https://cdn.discordapp.com/attachments/787340979148947466/801140313132367872/PicsArt_01-19-10.54.56.png");

rank.build()
    .then(data => {
        const attachment = new Discord.MessageAttachment(data, "automodRankcard.png");
        message.channel.send(attachment);
    });   
    
    
    
    
  }
}
#

there

#

but i have 2 files for XP levels

solemn latch
#

this doesnt appear to be the xp saving code, which is probably the thing you want

fresh bluff
#

class Util {
  static getLevel(xp, extra = true) {
  let level = 1;
    
    //WHILE LOOP
    while(xp >= Util.getLevelxp(level)) {
      xp -= Util.getLevelxp(level);
      level++
    }
    if(extra) return [level, xp];
    else return level;
    }

  
  static getLevelxp(level) {
    return 5 * Math.pow(level, 2) + 50 * level + 100;
  }
  
  static getInfo(exp) {
    let [level, remxp] = Util.getLevel(exp, true);
    let levelxp = Util.getLevelxp(level);
    
    return { level, remxp, levelxp}
  }
  
  static addexp(message) {
    let toadd = Math.floor(Math.random() * 3 + 3);
    let oldxp = db.get(`xp_${message.author.id}_${message.guild.id}`)
    let oldlvl = Util.getLevel(oldxp)
    let newxp = oldxp = toadd;
    let newlvl = Util.getLevel(newxp);
    
    
    if(newlvl > oldlvl) 
    message.channel.send(`${message.author}, You just reached level ${newlvl}`)
    db.add(`xp_${message.author.id}_${message.guild.id}`, toadd)
  }
}

module.exports = Util;
#

file 2

#

I don't understand why its not showing the XP

solemn latch
#

are you calling addexp?

fresh bluff
#

@solemn latch Would I do let addexp =

solemn latch
#

nope, in the location you are exporting util youd call addexp as a function

fresh bluff
solemn latch
#

depends on the location you want it to run

#

if you wrote the code you would be the only one to know

fresh bluff
#

Its in my handlers file

#

@solemn latch Im confused please help me

solemn latch
#

hmm, well when do you want to give xp to users?

fresh bluff
solemn latch
#

youll need to track how many messages they have then

fresh bluff
#

ok

fresh bluff
spark flint
#

In a json file or database

solemn latch
#

youll need to store it in your database, then if the number is divisible by 10 then give them xp

solemn latch
#

or dont even store it I guess, could just take the inaccuracies and only cache it.
doesnt need to be 100% perfect

#

if it resets who cares 😄

#

you only care if its every 10th message anyway

fresh bluff
#

i forgot how to code that lol

#

NVM

solemn latch
#

you gave an example up above, just look at your old code to see how it works

fresh bluff
#

I found a way

#

@solemn latch I wrote this code would this work

const profileSchema = require('./schemas/profile-schema')

module.exports = (client) => {
  client.on('message', (message) => {
    const { guild, member } = message

    addXP(guild.id, member.id, 23, message)
  })
}

const getNeededXP = (level) => level * level * 100

const addXP = async (guildId, userId, xpToAdd, message) => {
  await mongo().then(async (mongoose) => {
    try {
      const result = await profileSchema.findOneAndUpdate(
        {
          guildId,
          userId,
        },
        {
          guildId,
          userId,
          $inc: {
            xp: xpToAdd,
          },
        },
        {
          upsert: true,
          new: true,
        }
      )

      let { xp, level } = result
      const needed = getNeededXP(level)

      if (xp >= needed) {
        ++level
        xp -= needed

        message.reply(
          `You are now level ${level} with ${xp} experience! You now need ${getNeededXP(
            level
          )} XP to level up again.`
        )

        await profileSchema.updateOne(
          {
            guildId,
            userId,
          },
          {
            level,
            xp,
          }
        )
      }
    } finally {
      mongoose.connection.close()
    }
  })
}

module.exports.addXP = addXP```
#

Ik

#

ok

solemn latch
#

just out of curiosity, what does this line do? 🤔
const result = await profileSchema.findOneAndUpdate(

solemn latch
#

can you find out please

fresh bluff
#

sure

#

@solemn latch here it is

#

You are using it fine. Async/await works like this. You have a function that performs a task but you don't want to wait till it completes the task before it can continue another task.

Then you use the async statement to show it is a asynchronous function then you use the await when you want to perform a task that returns data so that it doesn't block the other tasks.

solemn latch
#

that doesnt explain what it does

fresh bluff
#

all i could find

solemn latch
#

are you sure you wrote this code? 🤔

fresh bluff
#

stack overflow has nothing on it

#

so not really but i did a few things

solemn latch
#

You may want to contact the owner of that github if you want support for it.
will do better than we can do

fresh bluff
#

Yeah iim going to

fresh bluff
#

Hey I need some help again

#

@solemn latch How tf do i set this up
receive a message from messageCreate event, store a messageCount in your db. then, when messageCount reaches 10, reset it to 0, add xp to user.

earnest phoenix
#

I sent one message and now it spams the embed.

#
   let array1 = []
     if (array1.includes(message.channel.id)) {

 let e = new Discord.MessageEmbed()


    message.channel.send({ embeds: [e] });
  }```
#

Djs v13, any help? lol

sudden geyser
#

can you show more of your code

#

hopefully blocks are ignored

earnest phoenix
#
client.on("messageCreate", message => {
  let prefix = config.prefix; 
   let array1 = ["873762714311360512", "873762322039058462", "873763309160132690", "873766382569914490", "873766289821290537", "873761652351328286", "873763556867313705", "873763455096750082", "873766526052868106", "873762046364233730","875270685684023356", "875270328132190220", "875270287258701855", "875270245948989530", "875270207948603552", "875270774016061450", "914254220042067998"]
     if (array1.includes(message.channel.id)) {

 let e = new Discord.MessageEmbed()
      .setColor("RANDOM")
      .setAuthor(`Thank you for using Promotion Network!`, client.user.displayAvatarURL())
      .setDescription(`\![PN_chatsymbol](https://cdn.discordapp.com/emojis/895769570969804870.webp?size=128 "PN_chatsymbol") Please make sure that your advertisement is in the right category, has a description, and an invite link.\n
\![PN_Celebrate](https://cdn.discordapp.com/emojis/910707271988818020.webp?size=128 "PN_Celebrate") We’re [hiring staff]([#908053979022364743 message](/guild/873712642185895967/channel/908053979022364743/)) join us!\n
\![PN_BlurpBoost](https://cdn.discordapp.com/emojis/908051816426643497.webp?size=128 "PN_BlurpBoost") If you want to boost EA, read #┇:sparkles:﹒perks-guide and you’ll get awesome perks!\n
\![PN_cool](https://cdn.discordapp.com/emojis/884123549223227403.webp?size=128 "PN_cool") Subscribe to our [youtube channel!](https://youtube.com/channel/UCvRwE8eachcVdVwAHkz7mzQ)`);
    message.channel.send({ embeds: [e] });
  }```
#

Thats it lmfao

sudden geyser
earnest phoenix
#
    if (message.author.bot) return;
solemn latch
#

I may or may not have been testing their knowledge of the code they wrote 👀

earnest phoenix
#

Got it, ty.

sudden geyser
#

Though with application commands you won't have to worry about that

sudden geyser
#

What library?

lyric mountain
#

Slay spoiling woo trials tsk tsk

errant flax
solemn latch
#

was mostly just curious

sudden geyser
lyric mountain
#

Doesn't reaction already return all the users?

#

Like, without needing cache

errant flax
#

<MessageReaction>.users.fetch()

errant flax
woeful pike
rotund gorge
#

⬆️

royal pumice
#
Import discord
Import DYNO
form discord.ext import command

Bot = command.prifix(['!','?'])

Bot.command()
Asyns def dyno(ctx):
    Self = ctx.self
   Await self.devolopment_DYNO

Bot.run(token=token)
#

I saw a web

#

Name dyno code

#

And i click on it

pale vessel
#

Looks a bit off

royal pumice
#

And this is the fake code

#

🤣 😂

#

Who made that fake web

#

Everyone can understand that is fake

hybrid cargo
#

lol

lavish frost
#

Better here than anywhere else, can someone briefly explain what are the rate limits? Cause i keep hearing about it but want to make sure what im hearing is right 😅

sudden geyser
#

If you're using a library, there's a good chance it handles rate limits for you.

#

But Discord expects you to be "reasonable" with the number of requests and how often you hit the API.

#

For example, a command that modifies every channel to update some role's permission will probably get rate limited, but people do it anyway since it's not an operation they'll do often.

lavish frost
sudden geyser
#

It does.

lavish frost
#

Awesome, thanks a ton for the info

viral spade
#

Hey, i am using discord.js and have a problem:

Whenever i get a DiscordApiError: Missing Permission the shard that throws the error restarts. I would like the shard to keep on going after such an error. How would i do that?

#

its not like i get an uncaught primise rejection or something

#

That is also what i want to do additionally, but i also want it to not restart if such an error is thrown anyways

#

thats an example event

#

should i make a console.log here instead of a reject?

woeful pike
#

you don't need to wrap this inside a promise constructor

#

a try catch that rejects with the error it catches is equivalent to not having a try catch at all. Exceptions bubble up the call stack by default

#

you're getting unhandled promise rejections because you fire and forget event.execute() and when that errors ur program dies because theres nothing to catch it

subtle river
#

db[id_number] = config["setup"]["default"]
anyone know why this specific line is sending a discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: string indices must be integers?
id_number i've tried to make a str and int.
config and db are dictionaries.

slender thistle
#

what's config['setup']

cinder aspen
#

the status of my bot is not working?

earnest phoenix
cinder aspen
#

I but what ?

#

I but wydm

spark flint
#

It is

#

It works

#

I use status dnd

coral sigil
#

Hey @wheat mesa! Do you have any open source detritus bots?

pale vessel
urban slate
#

yoo

#

guys is it possible to use a normal account as a bot?

solemn latch
#

its against discord tos

urban slate
#

ohhh

#

but is it possible?

solemn latch
#

no, its against discord tos.

urban slate
#

okkii

#

thnx

quartz kindle
#

technically its possible yes

#

but people who do it are pretty much insta-banned

spark flint
#

yeah

earnest phoenix
#

I cant run node in my vsc(fixed)

errant flax
earnest phoenix
#
/home/runner/noahs-testing/node_modules/discord-buttons/src/v12/Classes/APIMessage.js:9
class sendAPICallback extends dAPIMessage {
                              ^

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/home/runner/noahs-testing/node_modules/discord-buttons/src/v12/Classes/APIMessage.js:9:31)```

**__CODE:__**

const config = require("../config.json");
const Discord = require("discord.js");
const db = require('quick.db')
const { v4: uuidv4 } = require('uuid');

module.exports = {
name: "help", // Command Name
description: "List all of my commands/info about a specific command.", // Description
aliases: ["h"], // Aliases
usage: " ", // Usage
guildOnly: false, // If Command In DMs return
admin: false, // Bot Admin only
async execute(message, args, clientMessageMenuOption, MessageMenu) {
let prefix = config.prefix

let cmduser = message.author;
let menuoptions = [
{
value: "role1", description: "Get Role 1",
replymsg: "This is the message for Role 1", emoji: "❌" //optional
}, {
value: "role2", description: "Get Role 2",
replymsg: "This is the message for Role 2", emoji: "✅" //optional
} , {
value: "role3", description: "Get Role 3",
replymsg: "This is the message for Role 3", emoji: "✅" //optional
} , {
value: "role4", description: "Get Role 4",
replymsg: "This is the message for Role 4", emoji: "✅" //optional
} , {
value: "role5", description: "Get Role 5",
replymsg: "This is the message for Role 5", emoji: "✅" //optional
}
]
//define the selection
let Selection = new MessageMenu()
.setID('MenuSelection')
.setMaxValues(1) //OPTIONAL, this is how many values you can have at each selection
.setMinValues(1) //OPTIONAL , this is how many values you need to have at each selection
.setPlaceholder('Click me to make a Selection!'); //message in the content placeholder
menuoptions.forEach(option => {
let row = new MessageMenuOption()
.setLabel(option.label ? option.label : option.value)
.setValue(option.value)
.setDescription(option.description)
.setDefault()
if(option.emoji) row.setEmoji(option.emoji)
Selection.addOption(row)
})
//define the embed
let MenuEmbed = new Discord.MessageEmbed()
.setColor("BLUE")
.setAuthor("Bot Help", client.user.displayAvatarURL())
.setDescription("Select what you need in the Selection down Below!")
//send the menu msg
let menumsg = await message.channel.send(MenuEmbed, Selection)
//function to handle the menuselection
function menuselection(menu) {
let menuoptiondata = menuoptions.find(v=>v.value == menu.values[0])
menu.reply.send(menuoptiondata.replymsg, true);
}
//Event
client.on('clickMenu', (menu) => {
if (menu.message.id === menumsg.id) {
if (menu.clicker.user.id === cmduser.id) menuselection(menu);
else menu.reply.send(:x: You are not allowed to do that! Only: <@${cmduser.id}>, true);
}
});
}}```

#

Learning/Testing our Dropdown Menu's and this error has been there for the longest time 🤣

solemn latch
#

the error seems to be related to the discord-buttons library, but i dont see it being used

subtle river
#

I seem to be having errors with my code that I cannot debug, does anyone know why this is happening?
Code & json file attached

earnest phoenix
solemn latch
earnest phoenix
#

I have this in my main file:

#
const dbs = require("discord-buttons");
dbs(client);
const { MessageMenuOption, MessageMenu } = require("discord-buttons")
#

As soon as I just took that out, it worked.

#

Lemme go test the command*

spark flint
#

Try const { dbs, MessageMenuOption, MessageMenu } = require(“discord-buttons”);

earnest phoenix
spark flint
#

It’s the “

#

Re type it

earnest phoenix
#

wot?

#

thats what I put

#

not ""

#

nbm

#

nvm

spark flint
#

It’s because I’m on mobile

earnest phoenix
spark flint
#

Might be a compatibility issue

#

What discord.js version are you using

earnest phoenix
#

v12

#

WAit

#

I think v13

#

One sec.

spark flint
#

Buttons is using 12

earnest phoenix
#

oh

#

I needa downgrade

#

After I transfer EVERYTHING to djs v13

#

kill me now

#

fr lol 🤣

spark flint
#

Try a different button library

earnest phoenix
#

Its alr, I shall just re-downgrade.

spark flint
#

One which is v13 compatable

boreal iron
#

Use the inbuilt djsv13 methods...

earnest phoenix
#

Nah, those are always so extra

spark flint
#

I don’t use discord.js but some errors are easy to tell

wheat mesa
solemn latch
#

Isn't djs v12 going to stop working not far in the future anyway?

#

Or can you make it work with third party libs

spark flint
#

^

boreal iron
#

Or can you make it work with third party libs

The nonsense is to work with additional libraries if your main library already includes all possibilities.

spark flint
#

But what’s easier

boreal iron
#

Thinking about to downgrade is just a big face palm.

boreal iron
#

I mean the fucking docs of djs do explain things really good, also providing examples

#

It's not really complicated at all to understand how to deal with message components

#

But already using the library for things you understand copy & paste doesn't require an additional library for doing the same things you can do with the main one

solemn latch
# spark flint But what’s easier

easier today? or easier overall.
there will be a day when v12 isnt maintained by even third party libraries.
djs v15 could be out by then, and then you need to learn v13, v14, and v15.
while staying back might save some dev time today, devs may have so many more issues down the road.

-someone who hasnt learned v13 CB_kek

subtle river
earnest phoenix
#

THIS VIDEO IS SPONSORED BY DETRITUS

spark flint
#

Lol

earnest phoenix
#

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

    if (interaction.commandName === 'ping') {
        const row = new MessageActionRow()
            .addComponents(
                new MessageSelectMenu()
                    .setCustomId('select')
                    .setPlaceholder('Nothing selected')
                    .setMinValues(2)
                    .setMaxValues(3)
                    .addOptions([
                        {
                            label: 'Select me',
                            description: 'This is a description',
                            value: 'first_option',
                        },
                        {
                            label: 'You can select me too',
                            description: 'This is also a description',
                            value: 'second_option',
                        },
                        {
                            label: 'I am also an option',
                            description: 'This is a description as well',
                            value: 'third_option',
                        },
                    ]),
            );

        await interaction.reply({ content: 'Pong!', components: [row] });
    }
});

Am I doing something wrong? I am so confused, this is straight from the DIscord Guide, yet there is still no slash commands in the server popping up.

solemn latch
coral sigil
earnest phoenix
earnest phoenix
#

I want it multi-guild.

solemn latch
#

if you read from there, youll see on that page it covers global commands too.

earnest phoenix
#

Ah nvm, the Guide has it all.

#

Yeah just saw that. 🤣

#

It's as simple as;

    Routes.applicationCommands(clientId),
    { body: commands },
);```?
solemn latch
#

yep, just note the text above that code block includes important information

earnest phoenix
#

So confused, but lemme go try a few things and read the docs over 200 times not even joking lmfao

#
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token } = require('./config.json');
const fs = require('fs');

const commands = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));


for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    commands.push(command.data.toJSON());
}

const rest = new REST({ version: '9' }).setToken(token);
await rest.put(
    Routes.applicationCommands(client.id),
    { body: commands },
);
(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

        await rest.put(
            Routes.applicationGuildCommands(clientId, guildId),
            { body: commands },
        );

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();

#

So, that should theoretically work.... right?

solemn latch
#

looks like thats for guild specific commands

earnest phoenix
#

oh wait

#
const { Routes } = require('discord-api-types/v9');
const { token } = require('./config.json');
const fs = require('fs');

const commands = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));


for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    commands.push(command.data.toJSON());
}

const rest = new REST({ version: '9' }).setToken(token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

     await rest.put(
    Routes.applicationCommands(client.id),
    { body: commands },
);

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();```
#

o-o

solemn latch
#

looks right to me, but I havent used djs v13 before

earnest phoenix
#

Im just learning it lmfao

#
const { MessageActionRow, MessageSelectMenu } = require('discord.js');

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

    if (interaction.commandName === 'ping') {
        const row = new MessageActionRow()
            .addComponents(
                new MessageSelectMenu()
                    .setCustomId('select')
                    .setPlaceholder('Nothing selected')
                    .setMinValues(2)
                    .setMaxValues(3)
                    .addOptions([
                        {
                            label: 'Select me',
                            description: 'This is a description',
                            value: 'first_option',
                        },
                        {
                            label: 'You can select me too',
                            description: 'This is also a description',
                            value: 'second_option',
                        },
                        {
                            label: 'I am also an option',
                            description: 'This is a description as well',
                            value: 'third_option',
                        },
                    ]),
            );

        await interaction.reply({ content: 'Pong!', components: [row] });
    }
});

const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');


const commands = [];




const rest = new REST({ version: '9' }).setToken(config.token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

     await rest.put(
    Routes.applicationCommands('701018283603918869'),
    { body: commands },
);

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();

It still does not create the slash command.

solemn latch
#

global commands take an hour to show up

earnest phoenix
#

In 1 server?

solemn latch
#

yeah, they refresh at random times iirc

earnest phoenix
#

They always used to be instant... wowza

solemn latch
#

so whenever it refreshes next(1 time an hour)

#

which is why the guide suggests using guild commands during development

earnest phoenix
#

Okay, imma just to guild based ones, since it is for 1 server.

#
TypeError: Cannot read properties of undefined (reading 'toJSON')```
#

Now I just get that.

#
for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    commands.push(command.data.toJSON());
}```
#

one thing after another 🤣

wheat mesa
#

seems like you don't have a prop exported called data

#

Also, commands show up instantly in DMs

earnest phoenix
#

I'm just going off the guide.

solemn latch
#

are you sure you updated all your commands in the command folder to follow the guide?

earnest phoenix
#

Wym?

solemn latch
earnest phoenix
#

Im trying to do a drop-down menu

#
const { MessageActionRow, MessageSelectMenu } = require('discord.js');

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

    if (interaction.commandName === 'ping') {
        const row = new MessageActionRow()
            .addComponents(
                new MessageSelectMenu()
                    .setCustomId('select')
                    .setPlaceholder('Nothing selected')
                    .setMinValues(2)
                    .setMaxValues(3)
                    .addOptions([
                        {
                            label: 'Select me',
                            description: 'This is a description',
                            value: 'first_option',
                        },
                        {
                            label: 'You can select me too',
                            description: 'This is also a description',
                            value: 'second_option',
                        },
                        {
                            label: 'I am also an option',
                            description: 'This is a description as well',
                            value: 'third_option',
                        },
                    ]),
            );

        await interaction.reply({ content: 'Pong!', components: [row] });
    }
});

const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');

const commands = [];
const commandFiles1 = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));



const clientId = '701018283603918869';
const guildId = '914203218416914462';

for (const file of commandFiles1) {
    const command = require(`./commands/${file}`);
    commands.push(command.data.toJSON());
}

const rest = new REST({ version: '9' }).setToken(token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

        await rest.put(
            Routes.applicationGuildCommands(clientId, guildId),
            { body: commands },
        );

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();```
#

Thats my index.js

solemn latch
#

I see, so the code you are using above isnt compatible with the code in the guide in the section you are in

earnest phoenix
#

Wym?

#

All of that is in the guide....

solemn latch
#

sure, but you skipped steps

earnest phoenix
#

I'm not sure what steps tho..?

solemn latch
#

probably best to go to the beginning tbh

boreal iron
#

That fucking guide is just trash

#

client.application.commands

earnest phoenix
#

Okay okay, so its getting easier.

boreal iron
#

To create, delete, set (update) interactions

earnest phoenix
#
client.commands = new Collection();
                      ^

ReferenceError: Collection is not defined
    at Object.<anonymous> (/home/runner/djs-v13/index.js:23:23)```
#

Now its just that error and I fully understand it lmfao

boreal iron
#

Just use a map or the associacted discord constructor