#development

1 messages · Page 1936 of 1

lyric mountain
#

that'd be the other way around actually

#

damn woo

#

ye, running multiple clients in a single code will put a hell more strain than using multiple codes

vast cedar
#

But it's possible ?

lyric mountain
#

possible? yes
recommended? no

earnest phoenix
#

how do i do that?

split hazel
#

you should run them separately

modest maple
solemn latch
earnest phoenix
#

yes

#

how do i make the script recognize the image im trying to grab

lyric mountain
#

"recognize"?

earnest phoenix
#

like

#

know what image

#

im referring to

lyric mountain
#

the path you mean

earnest phoenix
#

i cant just write the name of the file

#

yeah

#

idk how to make it workk

lyric mountain
#

python right?

earnest phoenix
#

@bot.command(pass_context=True)
async def rules(ctx):
await ctx.send(file=discord.File('paste.png'))

#

yes

lyric mountain
#

also u can just append the path to the name

lyric mountain
earnest phoenix
#

it cant find it

austere scaffold
#

As the py file

earnest phoenix
#

py file?

#

i dont think so

#

its in here

vast cedar
#

how I could do so that all 5 number it add +1 to the value "number"

let number = 0;
let count = 0;

for(const i of users) {
count++
}
lyric mountain
#

what 5 numbers?

earnest phoenix
#

@lyric mountain

#

big bruh moment

lyric mountain
#

tf

vast cedar
lyric mountain
#

also big brain for pinging in dms KEKW

earnest phoenix
#

asking for help in dms

lyric mountain
vast cedar
#

no i want to add 1 to the value number

outer zenith
#

yo are free mongo db servers any godo

earnest phoenix
#

saying they can pay even though one google search would be enough to fix their problem

vast cedar
#

each five number

outer zenith
#

for bots

lyric mountain
#

this?

vast cedar
#

yeah thanks

lyric mountain
#

please forget the idea of making multi-bot code

outer zenith
#

basically can u run a discord bot using a free mongo db server effectively

lyric mountain
#

effectively? sure, why not

outer zenith
#

just wondering

#

cause when i was creating it

#

it said it was like experimental or a sandbox but idk

lyric mountain
#

just remember it'll always have a drawback for using free version of paid services

#

you can always just install the database on your vps

#

which will be cheaper and without limitations

outer zenith
#

wait how :0

#

ive been using sql and db files for my bot

#

and wanted to switch to something better

#

so i was looking at mongodb

pale storm
lyric mountain
#

they are different tools for different jobs

earnest phoenix
#

im new to scripting kinda

outer zenith
#

really?

lyric mountain
#

really

outer zenith
#

i thought mongo was a bit more cleaner

#

and faster

lyric mountain
#

faster is iffy

#

cleaner for hell sake no

outer zenith
#

hm

#

when would u use mongo then

lyric mountain
earnest phoenix
#

mysql is me

lyric mountain
#

in mongo everything is thrown where it lands

#

(scratch mysql there, put any other sql database)

lyric mountain
outer zenith
#

i think the main thing i was looking for was a cloud db

#

so mysql would work?

lyric mountain
#

mysql will never work

outer zenith
#

dam

lyric mountain
#

if u want mysql use maria

solemn latch
#

pretty sure most databases have cloud options available

lyric mountain
#

even sqlite apparently

outer zenith
#

should i just use regular db files then

lyric mountain
#

depends on the database

#

u wont use a db file for postgres

sudden geyser
outer zenith
#

using like sqllite

lyric mountain
#

cuz postgres doesn't have a db file

lyric mountain
sudden geyser
#

Nah NoSQL can be good

#

What we've seen has just sucked

lyric mountain
#

I mean, it'll always be an unorganized bunch of data

#

else it'd be sql

sudden geyser
lyric mountain
sudden geyser
lyric mountain
#

that's kinda ironic

lyric mountain
#

it's very basic regarding data types and barely allows any user management (if any)

#

but it's fast

#

boi it's very fast

#

if you'll only use basic types (and no parallel writes) sqlite might be worth it

sudden geyser
#

what non-basic type would you need anyway

outer zenith
#

like writes at the same time?

lyric mountain
#

ye

wheat mesa
#

no multi threaded writing

lyric mountain
#

sqlite allows only 1 write at a time

outer zenith
#

so in the example of leveling

wheat mesa
outer zenith
#

i cant use sqlite?

#

or

lyric mountain
#

you can

#

if you use queues

outer zenith
#

ah i see

#

ok

wheat mesa
#

Queue your queries

#

Writing to a file with multiple threads is a bad idea

lyric mountain
#

it'll be almost instant anyway

wheat mesa
#

Most of the time

lyric mountain
#

and most sql libs will queue for u

outer zenith
#

one write to each table or one write to the entire db at a time

lyric mountain
#

one write

#

doesn't matter where

earnest phoenix
lyric mountain
#

only 1 write can be happening at any time

#

but N reads

outer zenith
#

so u can read parallelly

#

but not write

lyric mountain
#

yes

#

that's probably due to file nature of sqlite

#

like, many threads changing the same file simultaneously can't result in anything good

#

that's why many json dbs die

#

but don't underestimate sqlite

#

it's extremely hard to get two writes to happen at once willingly

earnest phoenix
#

json db panic

sudden geyser
#

all my homies love json databases

lyric mountain
#

when you look at the json db, json db looks at you

earnest phoenix
#

haha

lyric mountain
#

and say: [object Object]

earnest phoenix
#

json db like:

boreal iron
#

What can go wrong with jason

split hazel
#

pov you make fun of americans

boreal iron
#

What else can do with/about Americans?

lyric mountain
#

american't use metric system

boreal iron
#

Yee they are weird

#

Also don’t use °C

#

How can they even live?

sudden geyser
#

because when it's 70 degrees we aren't burning alive

boreal iron
outer zenith
#

when would u use the connect event instead of the ready event

boreal iron
#

If you need to do something before the application is ready?!

outer zenith
#

basically what is ready for access when connected

#

like can i call anything from discord when its connected but not ready yet

boreal iron
#

Nope

lyric mountain
#

connect = before
ready = after

boreal iron
#

Any important information will be delivered within the ready event

split hazel
#

basically no reason other than debugging, extra logging or if you're modifying the library

lyric mountain
#

it's redundant cuz you can always pre-init stuff in the index file

#

but yea, for debugging it might help

proven lantern
#

doing JSON.stringify to both before and after fixes it

split hazel
#

pov you use jest

earnest phoenix
#

why it always shows the embed?

#

i used many ways

#
if(!args[0] || args[0].toLowerCase() !== "trophies" || args[0].toLowerCase() !== "gold" || !chk){
  let embed = new Discord.MessageEmbed()
  .setTitle('Leaderboard?')
  .setDescription('I have many leaderboards, you can pick\n one from below and check it with\n `cc.lb <category>`')
  .addField('🎲 Categories of Leaderboard',":troph: `Trophies` - Trophies leaderboard.\n:gold: `Gold` - Gold leaderboard.")
  .addField(':diamond_shape_with_a_dot_inside: Easy Access',"To set a leaderboard by default, you\n can just do `cc.lb default <category>` and \nthe next time you will only need to put \n`cc.lb`.")
  .setFooter('More categories coming soon...')
  .setThumbnail(client.user.avatarURL())
  .setColor("RANDOM")
  message.channel.send(embed)
} else if(args[0].toLowerCase() === "default"){

  return message.channel.send('Default what? Put a category! `cc.lb default <category>`')

} else if(args.join(' ').toLocaleLowerCase().includes("default gold")) {

   message.channel.send('Yep! Done setting your default leaderboard category to `Gold`!')
   db.set(`default_${message.author.id}`, "gold")

} else if(args.join(' ').toLocaleLowerCase().includes("default trophies")) {

   message.channel.send('Yep! Done setting your default leaderboard category to `Trophies`!')
   db.set(`default_${message.author.id}`, "trophies")

} else {
wheat mesa
#

You’re asking NOT OR NOT

#

Logically invalid

earnest phoenix
earnest phoenix
slender wagon
#

hello so i am adding a spin wheel on one of my pages and the spin is all done through clientside js, do u guys think the users can manipulate clientside js?

wheat mesa
#

Think about it like this, if you have a condition of “if user input does NOT equal “hi” OR if user input does NOT equal “bye”

#

Then you’re always going to have it evaluate to true

#

Because if the user inputs “bye” then then user input is NOT “hi”

#

So it’ll evaluate to true

#

And if the user inputs “hi” then the user input is NOT “bye” therefore it evaluates to true

earnest phoenix
#

so i remove the "args[0].toLowerCase() !== "trophies" || args[0].toLowerCase() !== "gold" "?

lyric mountain
#

never use not or not

#

it's an always-true evaluation

quaint wasp
#

which of these is outdated form v12?

#

Im trying to figure out but maybe yall will find it first

sudden geyser
#

Why not just pull up the symbols in the docs

#

or hover over them and hope your IDE tells you if it's deprecated

earnest phoenix
quaint wasp
#

?

#

am I fetching it?

earnest phoenix
#

use await message.guild.fetchOwner()

quaint wasp
#

oh..

#

you're right its the issue with the owner

#

I did some things and it returned undefined

quaint wasp
earnest phoenix
#

hmm

#

you can try await message.guild.members.fetch(message.guild.ownerId)

quaint wasp
#

alr

#

MessageEmbed field values must be non-empty strings.

sudden geyser
#

fetchOwner probably does work

#

but was used incorrectly (e.g. accessing .name on the promise rather than the value)

quaint wasp
#

oh

sudden geyser
quaint wasp
#

yea..

sudden geyser
#

You could imperatively check if the string isn't blank and call .addField

quaint wasp
#

But shouldnt || "undefined" replace it?

sudden geyser
#

Yes, but that assumes the first value is null/undefined

#

That value could itself be a blank string.

quaint wasp
#

false

sudden geyser
#

wait nvm I was wrong

quaint wasp
#

lol alr

#

so... what do you mean by accessing its value and not .name ?

earnest phoenix
#

d.js moment

quaint wasp
#

yea....

cobalt junco
quaint wasp
#

o

#

so... .member.username ?

cobalt junco
#
(await message.guild.fetchOwner()).user.username
quaint wasp
#

ah

#

thanks, it worked

stark terrace
#

yo, anyone else getting 429ed by discord rn? or in general any one-off issues with their bot today?

#

cause this is super unusual for my bot to start getting 429ed out of nowhere

wheat mesa
#

429 is a ratelimit

stark terrace
#

ik

#

its just completely out the blue this happened. like the first time this ever happened in prod

#

and a couple other bots went had issues around the same time i did apparently

#

so im just gathering info

lyric mountain
#

you're spamming something

worn sonnet
#

Oh that's because I own a server which has lots of bots joining in with common name as welcome, alerts, notifications, etc scamming the people

stark terrace
# lyric mountain you're spamming something

i dont think its on purpose tho. cpu usage for my bot hiked up for whatever reason (still trying to profile) and i believe it crashed my bot/hung up requests. when the bot had the chance to re-establish a connection to the gateway, rate limits were probably screwed

#

that’s my initial prognosis cause i was at work and trying to debug the issue at the same time

#

but i also heard from a buddy of mine that others bots went out at the same time mind did, so i was entertaining the idea of it being a coincidence

lyric mountain
stark terrace
#

yeah ik that part

lyric mountain
#

is it js?

stark terrace
#

yeah

lyric mountain
#

do you have any heavy number crunching code?

stark terrace
#

you know any good cpu profiling software for nodejs? i’ve been using dynatrace trials and it’s helped solve major issues for me in the past. but it comes with a full package that’s overkill

stark terrace
lyric mountain
#

it's quite easy to see where the issue might be

#

what is you most complex code?

#

or the one where you use loops the most

quartz kindle
stark terrace
#

im bad at this stuff lol

lyric mountain
#

cmon, you gotta have at least one code you're suspicious of

stark terrace
#

that’s why i took the easy route and used dynatrace cpu profiling. but i need to learn/utilize proper

stark terrace
# lyric mountain or the one where you use loops the most

so i actually had an old loop i found through cpu profiling with dynatrace. i removed it and unexpected restarts were a lot less frequent. but now that you mention it, i probs need to survey my code for more loops and start there

stark terrace
lyric mountain
#

just look at the biggest code you find

stark terrace
#

so only loops i have only loop through a couple items or looping through stuff like member roles

earnest phoenix
#

New Question x3

How come this doesn't lock the channel for a the role.id but only the @everyone role?

 let role = interaction.guild.roles.cache.find(x => x.name === "Members");
    if(role) return; interaction.channel.send(`No \`@Members\` role found, skipping. `)

interaction.channel.permissionOverwrites.create(
  interaction.guild.roles.everyone, 
  { 
    VIEW_CHANNEL: true,
  SEND_MESSAGES: false 
  },
  {
     id: role.id,
  SEND_MESSAGES: false
  })

  const embed = new MessageEmbed()
  .setAuthor(interaction.guild.name, 'https://64.media.tumblr.com/239ad7e946a65c9e1cbc6ed508e12269/tumblr_nwbyqyd8RJ1s9ab4to1_500.gifv')
.setDescription(`<#${interaction.channel.id}> **-** Has been locked..`)
interaction.channel.send({ embeds:[embed] })```
#

Djs v13 ^

pale vessel
#
{
  id: role.id,
  SEND_MESSAGES: false
}```doesn't make sense, does it?
earnest phoenix
#

It still doesn't lock it for "role"

earnest phoenix
#

Didn't work.

pale vessel
#

That's not the problem, Discord.js resolves role objects to IDs

pale vessel
# earnest phoenix Didn't work.

You could explicitly specify that the ID is a role by adding { type: "role" } as the third parameter or change role.id to just role

proven lantern
#

why does my project double in size when i have node-fetch in my dependencies? it should only be 99.7 kB

#

my project grows from 1.6mb to 3.0mb

#

and with axios it grows to 1.7mb

pale vessel
#

Okay then just use the http(s) module?

#

If you're going to complain that much

slender thistle
#

Bro does it matter that much though

green kestrel
#

so, who's having fun with updating log4j in their jda etc bots this morning?

earnest phoenix
#

@slim heart is having fun with log4j iirc

green kestrel
#

lol

#

I'm a fan of spdlog, no similar issue there.....yet

feral aspen
#

What's better, TailWindCSS or Bootstrap?

slender thistle
#

Better in terms of what?

feral aspen
#

Easiness, use of each?

pale vessel
#

You can't really compare them both?

feral aspen
#

Is there a difference to use A in something and use B in something else?

pale vessel
#

Tailwind is more of an ease of access framework, with utilities and classes that have no design they force you to have, unlike Bootstrap

#

I'd rather use Tailwind and design my own components than to use Bootstrap and make my website look generic (you could still override the styles, but it'd be very jank IMO)

feral aspen
#

Is bootstrap hard to use their designs?

earnest phoenix
#

bootstrap is hard to customize imo

#

tailwind makes it relatively easy with its extending and shit

#

but flaze is right

feral aspen
#

Oh, I see. Although, why? I see many websites look professional when it comes to using Bootstrap?

earnest phoenix
#

In my past experiences with bootstrap you are very limited

#

use chakra ui

#

it's accessible

#

chakra is a component library no?

#

accessibility > everything

earnest phoenix
#

with emotion for styling which makes it a bit slow to render

#

can you use component libraries without using something like react or angular

earnest phoenix
#

vue

#

well yea

#

but i mean

#

also who tf uses vanilla js

#

plain html it will be rather hard

#

me

#

at school

#

cause

#

no node

#

:c

#

then use tailwind

#

no node

#

cdn

#

ah right forgot tailwind has a cdn

#

react and vue also have cdn

#

sadly no angular

#

fake sob

#

angular would probably be a pain if it was cdn no?

#

mf huge

#

angular is already a pain

#

I use angular

#

because it requires typescript

#

I mean

#

it doesn't require it

earnest phoenix
#

you can easily use js with it

#

it just isn't recommended

#

cause ew js

#

ew browser

#

does webassembly work in safari

#

No idea

#

damn

#

i could've used rust for frontend

feral aspen
#

Anyways, it looks like TailWindCSS is better based on what I'm trying to achieve, thanks.

earnest phoenix
#

what are you trying to achieve

#

CSS Frameworks colorized
Easy: Bulma
Simple: TailWindCSS
Flexible: Chakra UI
Bad: Bootstrap

#

I hate bulma now

#

it fucked my css up

#

and im blaming bulma and not my shitty css skills

#

so

#

i clearly said easy

#

not good

#

lol

#

bootstrap is so old

#

its trying to be good

#

feels like learning programming again

#

except there are no indian guys on YouTube to help me

#

sob

#

bro

#

I watched a vid on angular

#

by fireship?

#

and I found this guy with the worst mic and indian accent

#

indian accent is not bad accent

#

n oits not

#

angry sob

#

but pair it with a dollar store mic

#

i don't even have a mic

#

nerd

#

i don't talk in vc

#

just go there to stalk

#

I talked for the first time in ages in the vc this morning

pale vessel
#

Old MangaDex website 🤮

earnest phoenix
#

flaze was there

pale vessel
#

Bootstrap 4 🤮

earnest phoenix
#

lmfao

#

tailwind > *

pale vessel
#

New site is good though

earnest phoenix
#

even on light mode

#

if I ever make a website

#

its dark theme

#

no option for light

pale vessel
earnest phoenix
#

I dont really like the orange

#

but thats cause orangei s my leas favorite color

earnest phoenix
#

lol

#

he changed it to allow any light mode

#

I will add light mode

#

cringe

#

but it will be extremely hard to activate

#

I will make you work for it

earnest phoenix
#

and the div has a full white background

earnest phoenix
#

i said it's bad

#

yes let us all hate bootstrap

slender thistle
#

It's not necessarily bad imo

earnest phoenix
slender thistle
#

Just not something that could make your website stand out

earnest phoenix
#

if you wanted to go back to the early 2000s sure

#

perfect

slender thistle
#

I personally hate PHP's syntax but it's ✨ preferences ✨

#

Hey complex is simple and simple is good

earnest phoenix
#

lmfao

earnest phoenix
#

hi xetera

#

python aint bad

woeful pike
earnest phoenix
#

wdym

woeful pike
#

familiarity most likely

earnest phoenix
#

why do people click off dark mode sites more than light mode

#

cringe

#

yea

pale vessel
#

For some users, light mode is better for accessibility

earnest phoenix
#

i can't read an ebook on light theme without crying my eyes frok the brightness

#

Darkmode with light elements is better imo

earnest phoenix
#

also every meme is in light mode

#

xet should i learn rust for backend

#

nodejs slow

woeful pike
#

Im still not gonna add light mode to my site but it's good to know

earnest phoenix
#

rust is so boring

earnest phoenix
#

I couldnt sit and use it without not knowing what to do with it

woeful pike
#

sure, rust is probably my favorite language currently

earnest phoenix
woeful pike
#

the typesystem alone is totally worth it

earnest phoenix
#

but is it better than node

woeful pike
#

it depends on your usecase

earnest phoenix
#

I like rust's error system

earnest phoenix
#

I feel like if node had rusts error system

woeful pike
#

js is stupidly easy but painful to refactor once you start building something up

earnest phoenix
#

node would be a lot more enjoyable

woeful pike
#

rust has a big learning curve and tedious to get set up with but refactoring and expanding your project is so easy

earnest phoenix
#

lol

earnest phoenix
#

I use go currently when im not doing the hackathon

#

esbuild is written in go right?

woeful pike
#

uh, it depends on your definition of low level and easy but C is certainly very simple

earnest phoenix
#

ram explosion

woeful pike
#

C has a couple core concepts and that's it. But making a program without bugs or memory leaks is not simple so it's hard to say what easy really means

earnest phoenix
#

I hate to say this but py is easy

woeful pike
#

my philosophy for programming is that the compiler should be doing as much of the work as possible, so C is out of the picture

#

so is go and javascript, python etc

earnest phoenix
#

what is the C compiler written in

cinder patio
#

C

woeful pike
#

gcc? pretty sure it's bootstrapped for decades now

#

the first iterations were written in assembly

earnest phoenix
#

what did the first person to write machine code use

#

aside from a punch card

woeful pike
#

i mean software abstractions were built on top of hardware

#

if you look at things like the Enigma machine for example

earnest phoenix
#

that thing that encrypts messages

woeful pike
#

the one that decrypts

earnest phoenix
#

i heard there's a way to break it

#

Which is better php or html :^)

earnest phoenix
pale vessel
#

TSX*

slender thistle
#

❤️

cinder patio
#

did u just get offended cause someone said they don't like the only programming language u know?

slender thistle
#

KEKW I don't blame you for not recognizing me

#

© shiv

cinder patio
earnest phoenix
#

Shiv be having new identity

slender thistle
#

I'm identityless, I do not identify as anything 😎

earnest phoenix
#

You identify as cool

feral aspen
#

I have this event handler:

const { readdirSync } = require("fs");
const colors = require('colors');

module.exports = async bot => {
    const load = dirs => {
        const events = readdirSync(`./src/events/${dirs}/`).filter(d => d.endsWith('.js'));
        for (let file of events) {
            const evt = require(`../events/${dirs}/${file}`);
            let eName = file.split(".")[0];
            bot.on(eName, evt.bind(null, bot));
        }
    }
    ["client", "guild"].forEach(x => load(x));
};

.. and I have an example interactionCreate event:

module.exports = async (bot, interaction) => {
    // Interesting code.. I know right?
};

How can I pass colors and use it like in bot, interaction, colors.

cinder patio
#

either bind it, but then the order will be: bot, colors, interaction

#

or you can include it when you run the actual function

#

you can also just attach it to your bot object

feral aspen
#

This seems to be an issue I seem to know why.

#

I got it managed. 👍

modest maple
#

damn i missed the talk about rust 😢

last tapir
#

good morning guys

#

how can i get the first word of that string

spark flint
#

What language

#

In python I would do splitword = <variablename>.split() then do splitword[0]

last tapir
#

ohh yes now i got it

#

thanks

spark flint
#

Idk then lol

earnest phoenix
#

splitword[1]

stable eagle
#

What can cause a high cpu?

quartz kindle
#

intense work

earnest phoenix
#

Which IDE/Editor should you use for Node development and what are the most benefits of them?

  • IntelliJ IDEA
    or
  • Visual Studio Code
spark flint
#

VSC is great

#

Never used Intellij Idea

earnest phoenix
#

Currently use vscode , but felt over IntelliJ and thinking about if it is worth using it.

#

Text Editors colorized
NodeJS/TypeScript or Python: Visual Studio Code
HTML, CSS, JS: JSFiddle or CodePen
Anything: Sublime Text

IDEs colorized
.NET: Visual Studio (unfortunate naming)
Java: Eclipse

quartz kindle
#

notepad++

boreal iron
#

Damn I was about to say it

earnest phoenix
#

Terachad: vim

#

Petachad: Punchcard

quartz kindle
#

write on a piece of paper, in cursive, and use ocr AI

earnest phoenix
quartz kindle
#

yes, in cursive

earnest phoenix
boreal iron
#

Shame on you Tim

earnest phoenix
quaint wasp
#

ay

#

tf is this

#
11.12 09:11:20 [Bot] internal/modules/cjs/loader.js:960
11.12 09:11:20 [Bot] throw err;
11.12 09:11:20 [Bot] ^
11.12 09:11:20 [Bot] Error: Cannot find module 'node:events'
11.12 09:11:20 [Bot] Require stack:
11.12 09:11:20 [Bot] - /node_modules/discord.js/src/client/BaseClient.js
11.12 09:11:20 [Bot] - /node_modules/discord.js/src/index.js
11.12 09:11:20 [Bot] - /index.js```
#

its not a package...

spark flint
#

My bot is logging Command raised an exception: Forbidden: 403 Forbidden (error code: 50001): Missing Access even though it has permissions to join and speak in the voice channel

sudden geyser
candid moon
#

I'm trying to make a ban command, how can I send a message without being banned from the user dm?

sudden geyser
#

Try to send the message before banning the user.

#

There's a chance the ban could fail, however, so the message sent would be useless.

#

You could try to check if banning the user would work beforehand (permissions)

#

@rustic nova !!!

#

damn banned

grizzled raven
#

uh

#

i need an opinion on something

#
data.sort((a, b) => b - a)
// or
data.sort((resultA, resultB) => resultB - resultA)
#

or do you think it really matters

sudden geyser
#

they're just parameters

#

so you can give them whatever name you want

#

b is a value from data

#

e.g. an array of objects would set b to some object in that array

grizzled raven
#

i know what they are lol

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

grizzled raven
#

i'm just asking which would you personally prefer, a single letter for a parameter like that or a bigger name

sage bobcat
#

One message removed from a suspended account.

grizzled raven
#

oh i know it doesn't matter

sudden geyser
#

then it's up to you

#

what we think shouldn't matter

cinder patio
#

In this case I'd go with letters because it's obvious what they are

sudden geyser
#

but I'd prefer single letters for small expressions

boreal iron
#

It's actually not resultA or B but instead it is arrayElementA or itemA etc.

sudden geyser
#

and actual names for larger ones

grizzled raven
#

just have people saying that "single letter variables are meaningless" or something along those lines idek

#

kinda dumb

#

lmao

pale vessel
#

data.sort((previousElementFromSourceArray, nextElementFromSourceArray) => nextElementFromSourceArray - nextElementFromSourceArray)

sudden geyser
#

in certain contexts they are

boreal iron
#

I think they can be even longer...

pale vessel
#

Please teach me

sudden geyser
#

Can you understand what this does?

function count(c) {
  return c.length;
}

Probably yes.

boreal iron
grizzled raven
#

they're meaningless sometimes but not all the time

#

i always kinda prefer them over longer ones for iterable values in short functions

#

like users.map(u => u.name)

#

but anyway

#

i don't think it really matters

main spruce
#

how to setup it?

sudden geyser
earnest phoenix
#

can you set permission like (BAN_MEMBERS) for slash commands (discord.js) ?

sudden geyser
#

You can't do it statically

#

Aka have Discord check it on the client side

#

But you can check it at runtime

#

Since they do tell you the permissions the user has

#

With the benefit that the permissions have been computed for you

earnest phoenix
#

yeah, In their doc it tells they only have it for specific role or ids

royal portal
#

am have a folder in ubuntu but no one can do anything inside it

#

i want them to be able to write stuff

#

how would i do that?!?!1

quartz kindle
#

chmod?

spark flint
royal portal
#

yes angeryBOYE

spark flint
#

SFTP*

royal portal
#

am trying to make SFTP

spark flint
#

can't you set perms with sftp

royal portal
#

using chmod 755

#

so when i use

sudo chown root:root /var/sftp
#

i can read the folder

#

but when i use

sudo chown guest:guest /var/sftp

i can modify stuff but cant read

lyric mountain
#

guest:guest means it'll belong to user guest and group guest

#

you probably want to also use -r to make it recursive

#

so files within it are also assigned to the user

#

same for chmod

#

just BE CAREFUL with chmod

royal portal
#

still doesnt work

lyric mountain
#

what is your user?

royal portal
#
sudo chown -R guest:guest /var/sftp
sudo chmod -R 755 /var/sftp
#

guest is the user

lyric mountain
#

do ls -l

#

what does it show for permissions of that folder?

royal portal
#

it outputs total 0

#

what about that?!?!1

lyric mountain
#

chown sftp to guest group too

#

guest:guest

#

then login to guest

#

you're logged into root currently

royal portal
#

cant see the files

lyric mountain
#

u sure the files are there?

#

cuz lack of read permission would prevent u from acessing the folder not from seeing the files

royal portal
#
sudo chown -R guest /var/sftp
#

that doesnt work

lyric mountain
#

is the password right?

royal portal
#
sudo chown root:root /var/sftp
#

this works

#

but cant do anything

#

just read

royal portal
lyric mountain
#

idk then, never had such issues before

#

wait

#

no write perm for group

royal portal
#

how would i enable write?!?!1

lyric mountain
#

+w

winter stirrup
#

how does 1 get an api key?

royal portal
#

what command would i use cryangeryBOYE

lyric mountain
#

chmod -r 774 /var/sftp

#

or 770 if u don't want read perm for public

lyric mountain
winter stirrup
lyric mountain
#

you need to be approved first

#

you'll receive a notification from @gilded plank and a green name if you do

royal portal
lyric mountain
#

ah flip -r wit the numbers

#

mb

#

chmod 774 -r /var/sftp

winter stirrup
#

how do you get approved? do you guys need me to provide anything etc?

lyric mountain
#

you need to submit a bot

#

then wait

winter stirrup
#

ahh okay, yeah iv done that already

lyric mountain
#

then wait

royal portal
lyric mountain
#

need to chown guest:guest

royal portal
#

still no work cryangeryBOYE

lyric mountain
#

welp, I'm out of ideas then

royal portal
#

guest isnt a group

#

its a user

lyric mountain
#

you could create a group for guest then

royal portal
#

tried that already

lyric mountain
#

it was supposed to work then

#

is /var allowed to guest?

royal portal
#

no

lyric mountain
#

well, it needs to be able to access /var too

#

since /sftp is inside it

neat ingot
#

~
is it possible to have a slash command option that only has a key and no value? ie:
/command regularkey:value -unvaluedkey

earnest phoenix
#

Wdym

neat ingot
#

like, a slash command string option that expects no additional information

cobalt junco
neat ingot
#

yea

cobalt junco
#

I dont think you can do that

neat ingot
#

rip

cobalt junco
#

Or maybe make it not required or as a subcommand?

neat ingot
#

i wanted to add a -private option to some of my commands. atm im using an optional boolean, but the 'false' option is completely pointless so was hoping to be able to just have something like -private

cobalt junco
thorn tulip
#

How to make subcommands /subcommand group?
lib: discord_slash, discord.py

neat ingot
lament rock
#

or if you want flags, just have a param labelled flags

neat ingot
#

yea thats a fair approach, but its only the one flag i want 😄

proven lantern
#

is there some sort of tool that tells you the full size of a dependency including all sub dependencies in node?

#

this is a bit better. still about 5x off

sudden geyser
#

There's also bundlephobia but that breaks often

sudden geyser
#

probably since discord is deciding to signal that every role's permission has changed to the hierarchy

#

but I'm not sure myself

earnest phoenix
#

How do I make sure a user has ADMINISTRATOR permissions before using a Slash Command? v13

#

if (member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) {?

pale vessel
#

Yes

earnest phoenix
#

It returns

if (interaction.user.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { interaction.reply({content: `You may **not** use this Command.`, ephemeral:true})

Can not read property "has" of undefined, I tried adding "cache"

#

or did djs remove that

#

users have no permissions

#

Ahh

#

Member

#

only members do

#

right

#

Tyty

#

I keep forgetting.

#

It still says it even tho I have perms

#
if (interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) return  interaction.reply({content: `You may **not** use this Command.`, ephemeral:true})
pale vessel
#

Sorry for ping, Discord mobile doesn't even show the reply option so I couldn't disable it

earnest phoenix
#

You can ping me idm

#

and ah alright makes sense

#

So confused on why it still says it even tho I have perms.

#

does your role have an administrator permission?

#

I own the server.

#

but yes, I do also have a role that has admin

#

oh

#

since it returns true it will always return the message

#

you wanna check if it is false

#

Yeah lol

#

so you wanna use !

#

Makes sense

#

if(!blah) return blah

#

Also, one more thing.

#
const filter = (interaction) => {
if(interaction.user.id === interaction.member.id) return true;
return interaction.reply({ content: "You can't use this button" })

}
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 });
const wait = require('util').promisify(setTimeout);

collector.on('collect', async i => {
#

Anyone can click that button...

earnest phoenix
#

I have always misunderstood them

#

but I have a filter on the button^

#

no need to return true

#

that check is already basically doing that

#

I dontt even think you need that if statement there

#

iirc I used to just interaction.user.id === interaction.member.id

#

Also would that check even work 🤔 I might just be tired but for some reason that looks a bit off

#

hm?

#

Idk I might just be me

#

but I never return anything in my filters so idk if returning in the filter causes any problems

#

Ah got it, tyty

#

at least I don't think you'd wanna return anything if the user id = the user id

#

since it will just return true

proven lantern
#

is it possible to send an ephemeral message before the initial message is returned using the discord api?

proven lantern
lament rock
#

that would cause it to not work

proven lantern
#

dang

#

thanks, i guess i can still make it work. i'll just wait to send that message

pale vessel
#

If you want to do that then the result must be ephemeral no matter what content it is

lament rock
#

You have to respond as soon as possible

pale vessel
#

So you can't have normal messages and ephemeral error messages if you defer

#

It's one or the other

earnest phoenix
#

So you can't send a public embed with buttons and then respond with an ephemeral message if someone who isn't supposed to press those buttons?

pale vessel
#

You can add flags while deferring

lament rock
#

you mean through follow up and such?

#

oh

earnest phoenix
#

Ah okay

proven lantern
#

i send an ephemeral message the first time someone hosts a lobby, but i also send a generic message saying there is a new lobby. i just need to send the ephemeral message second

pale vessel
#

Buttons clicks are whole new interactions

earnest phoenix
#

Ah

#

Makes sense

errant flax
#

why does the rest of the code is in gray?

earnest phoenix
#

theme issue maybe

#

or you are missing a ending quotation somewhere

errant flax
#

i replaced ` with "

#

it only highlights the string in the array

#

🤔

earnest phoenix
#

obv its going to be that fcolor

#

string literals or whatever its called doesn't work in ""

errant flax
#

no i meant theres no missing end quotationweirdsip

#

probably the code editor being weird

lament rock
#

There are quite a few grammatical mistakes

#

throwed isnt a word

earnest phoenix
#

yes it is

lament rock
#

the correct word is "threw"

earnest phoenix
#

thrown

sudden geyser
#

would be threw in this context

lament rock
#

It depends on the context.
"He threw" is correct.
"He had thrown" is correct

oak cliff
#

this is development not English class

errant flax
sudden geyser
#

development is english class

#

now let's talk about times tables

lament rock
#

This is true, but gotta help the homies

errant flax
#

any idea why theres a red highlight?

sudden geyser
#

can you show more of your code

oak cliff
#

Because it's an object probably?

#

Your highlighting is weird

lament rock
#

at reward? It may just be syntax highlighting

#

a lot of themes do for example:
orange.blue.white

maybe not that exact color scheme, but

errant flax
#

why tf wont it escape '

lament rock
#

It's not necessary to escape it

solemn latch
#

Do you need to escape

#

Yeah

errant flax
#

then why is it turning to green

lament rock
#

Probably the code editor has funky syntax highlighting logic

#

its just something you have to deal with

earnest phoenix
#

What editor is that even

lament rock
#

Yeah I've never seen something so jank

#

oh wait

errant flax
#

im hosting it in a pterodactyl host

lament rock
#

could it be that there needs to be a , after the first string

errant flax
errant flax
lament rock
errant flax
#

i deleted my cache for some reason

#

hope it works ig lol

lament rock
#

I'd probably recommend coding on vscode online and then transfer over to your host

gentle condor
#

hello i'm using discord py and i have an interaction in my message when i use that interaction it works but a message is displayed "this interaction failed"

#

how can i fix this

pale vessel
#

You need to reply to the interaction

gentle condor
#

how

#

any example

#

i want to edit that message

#

like we do in await m.edit(embed = embed)

pale vessel
#

Are you using buttons?

gentle condor
#

i'm using drop down menus

#

discord-components

pale vessel
#

This is weird though

#

Is it outdated? I have no idea

gentle condor
#

hm

#

let me try

#

ty for you time

pale vessel
#

Yeah try type 7

gentle condor
#

ty

earnest phoenix
#

Hey so, when I removed return true

It doesn't let me use the buttons.

const filter = (interaction) => {
if(interaction.user.id === interaction.member.id)
return interaction.reply({ content: "You can't use this button", ephemeral:true })

}
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 });
const wait = require('util').promisify(setTimeout);

collector.on('collect', async i => {
lyric terrace
#

How to set up my bot to respond on each vote ?

#

I am relatively new

gentle condor
#

you'll have to create an webhook

lyric terrace
#

How do i

gentle condor
#

then intergrate that webhook

lyric terrace
#

oh

gentle condor
#

watch yt

#

there's a tutorial

lyric terrace
gentle condor
#

watch

lyric terrace
#

send link

gentle condor
#

bruh

#

i'm not gonna

earnest phoenix
#

Why do my buttons work for other people? I put return true on it and I can't use it either.

#
const filter = (interaction) => {
if(interaction.user.id === interaction.member.id) return true;
return interaction.reply({ content: "You can't use this button" })

}```
#

When I have that, I cant use it.

#

when I remove return true anyone can use it.

#

should I change user.id to member.id? or something

gentle condor
#

how can i use buttons along side drop down menus discord py

green kestrel
#

sleepy discord has stopped development

earnest phoenix
#

detritus better

hybrid roost
#

I have applied for privileged intents. when I clicked the submit, the standard JS alert() window "tour submission resigned" came out to me. however, the bot's page still has the same "apply" window. This is how it should be or I made a mistake somewhere

proven lantern
#

i want to use the same custom_id, but pass different values

sacred aurora
proven lantern
#

every button will have a different lobby code, but the same custom_id

sacred aurora
#

why not putting it on the custom id?

#

with some separator like . or something

proven lantern
#

i might have to do something like that

#

but parameters are nice things to have

#

So i would have to do something like this js { type: 1, components: [ { type: 2, style: 1, label: isFull ? "Join queue for full lobby" : "Join the lobby", custom_id: isFull ? `join_lobby_queue_button.${lobbyCode}` : `join_lobby_button.${lobbyCode}` } ] }

#

oof

sacred aurora
proven lantern
#

sad times

spiral flower
#

🤔

proven lantern
#

fixed

earnest phoenix
#

How can I have my bot generate a timezone stamp

Like I have it now Ends in: 15s
but I want it to show the markdown time stamp.

#

How can a bot generate one of those?

proven lantern
#
`<t:${Math.floor(timestamp / 1000)}>`
pale vessel
#

:R

proven lantern
#

?

pale vessel
#

Needs to be relative time

proven lantern
#

like this?

`<t:${Math.floor(timestamp / 1000)}:R>`
pale vessel
proven lantern
#

hacks

deep wharf
#

Hi I have a question I bought the gun pass I had it but then it was taking away from me

#

Taken

#

???

deep wharf
#

What server do I have to go to

spark flint
deep wharf
#

I'm not about my account got hacked and it got changed to numbers

spark flint
#

Uh

deep wharf
#

I'm trying to have you ever heard of Connecticut state will play

spark flint
#

What bot are you asking about

#

Oh

#

Not bot

deep wharf
#

No

spark flint
#

Join their server

#

Not this

deep wharf
#

Ok

spark flint
#

This is the support server for the top.gg website

deep wharf
#

Well I'm trying to do training for Connecticut state role play

deep wharf
spark flint
#

I'll find their server

#

@indigo flint You're listed as an owner of the Connecticut State RP server, just letting you know that the invite for the server is expired ^^

earnest phoenix
#

slash commands are not showing up

#

any idea

#

why

#

idts there is any problem with code

#

global commands take 1 hour to show up

#

you should use guild commands for testing stuff

#

oh okay

#

wasnt it 20 mins earlier

modest maple
#

No

wooden ember
#

anyone know how to install node 16? cuz i just installed debian and want to update all my junk thats on my old server

#

however when i install node it just installs node 12

#

and i cant update it either

#

or alturnetly how to install d.js v12 so that i atleast can get all my crap back online in the mean time

#

nvm worked it out

earnest phoenix
#

How would I auto-close a tab in js that has been opened if I am making a chrome extension?

indigo flint
spark flint
indigo flint
#

i never put it there

spark flint
#

Oh

#

Odd

indigo flint
#

Oh I see what you are talking about

#

that is old

#

im not in that server

#

and i never owned it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

solemn latch
#

I didn't think extensions had access to closing tabs ngl

#

Nvm

#

Took two seconds on the docs to find it

feral aspen
#

Is try { ... } catch { false }; the same as try { ... } catch { {} };?

pale vessel
wooden gorge
#

How can I fix

quartz kindle
#

if you want to catch and do nothing, just catch {}

#

or if you want to be semantically correct, and not have eslint complain about empty blocks, do this

#
try {
  ...
} catch {
  /* no-op */
}
feral aspen
pale vessel
#

void 0 wesmart

quartz kindle
#

with try catch, you have to either return it, or assign it to a variable

#

catch { return false }

#

.catch(() => false)

feral aspen
quartz kindle
#

its not the same

pale vessel
#

{} would be undefined, no?

quartz kindle
#

one returns false, the other returns undefined

feral aspen
#

Ahh.. although.. same result?

pale vessel
#

No?

feral aspen
#

Alright.

pale vessel
#

Err, undefined and false is different if that's what you're asking

quartz kindle
#

it does not affect what happens to the error, it affects what you have AFTER the error

#

what do you want to have after the error happens?

#

false or undefined?

#

or do nothing?

feral aspen
#

Do nothing.. but not error.

quartz kindle
#

then it doesnt matter

feral aspen
#

^ alright.

#

Best way to do this in a try catch block is by returning false?

quartz kindle
#

catch {}
.catch(() => {})

feral aspen
#

👌🏼

quartz kindle
#

if you want to do nothing, you dont need the false for anything

feral aspen
#

Ohh.. I see.

#

Alright.. thanks. 🙌

quartz kindle
#

if you get eslint complaining about empty blocks, do what i said before

#

put a comment inside

#

catch { /* no-op */ }

feral aspen
quartz kindle
#

do you know what eslint is?

wooden ember
#

anyone know why nodejs isnt working in anyway?
it always trys to install v12 saying its the latetest
it will not update
npm was broken the one time it did update
reinstalled everything
node is back to v12
discordjs v12 is giving me errors
cant import moduals sometimes with errors like
SyntaxError: Cannot use import statement outside a module
or
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:
nothing runs without errors at all

#

at this point im just gonna go back to using centos 7 and never update anything ever again cuz if its gonna be like this every time i might considder moving to alaska and live in a shack with no power cuz this is pissing me off

#

all i want is to install nodev16

#

and discordjs v13

#

that is literally it

quartz kindle
#

dont install node using apt

wooden ember
#

why not

quartz kindle
#

use this

#

node.js is a fast moving project, it updates much faster than linux operating systems like ubuntu and debian

wooden ember
#

ah i see

quartz kindle
#

for the sake of system stability, linux systems are not allowed to update individual packages when they come out

#

they only update them when the time comes for a full system upgrade, and only update the packages that are properly tested

wooden ember
#

fair enough

#

how do i install it?

#

nvm i mean

quartz kindle
#

its explained in the readme

wooden ember
#

or do i have to build it from source

quartz kindle
#

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

wooden ember
#

ah yeah i just read that didnt scroll gown far enough

#

cheers

earnest phoenix
#

are you sure there's no malicious stuff in that script

wooden ember
#

i mean its on the official nvm github thing

#

and my server is basically a fresh install of debian

earnest phoenix
#

nevermind

wooden ember
#

mmm

quartz kindle
#

if anything were to happen to it, hundreds of people would notice

wooden ember
#

looks at log4j

feral aspen
earnest phoenix
quartz kindle
#

doesnt use java anywhere, doesnt care

earnest phoenix
#

javascript

quartz kindle
#

lets go hack the mars helicopter

slender thistle
#

OwO

earnest phoenix
#

lmfao

#

someone hack it to play helicopter helicopter on loop

quartz kindle
#

lmao

wooden ember
#

indeed

#

also what does this mean and how do i fix it? i guessing this is somthing to do with upgrading from node 12

earnest phoenix
#

chalk is using esm

wooden ember
#

what is that?

earnest phoenix
#

maybe they did the same thing node-fetch did

wooden ember
#

is this good or bad

earnest phoenix
#

you can't import esm from cjs or vice versa

#

chalk has enormous brain to use esm on npm

wooden ember
#

see i changed it to that befor and it gave me some other error

#

one sec

#

this is it

earnest phoenix
#

i don't recommend using esm