#development

1 messages · Page 1979 of 1

nova basin
#

I was making a webhook and I wanted to add a button so I would like to know how to add a button

quartz kindle
#

it should be the exact same way you add a button to normal messages

hybrid cargo
#

dead tim never misses a chance

quartz kindle
#

thank you lord thor

boreal iron
quartz kindle
#

i dont need to fight for it, its just who i am :^)

boreal iron
#

:P

wheat valve
#

TypeError: Cannot read properties of undefined (reading 'send')

Getting that error when I do:

let server = await client.guilds.fetch("678717822406492187");
await server.members.fetch();```


This is in my ready.js file
full error and code: https://srcshare.io/?id=620a590e23709311a0a19b69

Discord.js v13
boreal iron
#

That error has nothing to do with the code you showed

#

I don't see any send method in there

quartz kindle
#

its from GuildMemberManager lmao

boreal iron
#

Also if you ever wanna verify your bot, permissions: Discord.Permissions.FLAGS.ADMINISTRATOR that will prevent you from doing so

#

There's no need for admin perms for a bot

quartz kindle
wheat valve
#

Its not a bot that I want verified, what does that error exactly mean though?

wheat valve
quartz kindle
#

is your bot sharded?

wheat valve
#

No, its only in one server

quartz kindle
#

and its the server you're fetching?

#

whats your intents?

#

show your client options

wheat valve
#

And yes thats the correct server I'm fetching

quartz kindle
#

btw client.guilds.cache.fetch is not correct
its either client.guilds.fetch
or client.guilds.cache.get

wheat valve
#

Yes I just noticed that, someone from another server mentioned changing to cache.fetch and i never changed it back

quartz kindle
#

in your case client.guilds.cache.get should work

lyric mountain
#

couldn't they just abstract that into client.guild.get?

quartz kindle
#

v11 was like that

lyric mountain
#

ik but why add a new word when u could just keep the .cache part internal?

quartz kindle
#

the idea was to make people aware

#

because people didnt know which methods called the api and which methods didnt

#

so they made the separation like that, everything under .cache does never touch the api

wheat valve
#

Its working now, thanks for the help

quartz kindle
#

np

red valve
#

Hi I have a problem that I can't solve.
I basically have this bot that creates 3 rooms for me.
2 textual and one voice, to which it sets permissions to hide them from the everyone role.
Some times none become private, some only 1 and some only 2.
When it deletes them it can only delete the public ones.
I can't understand the reason, giving the admin role disappears the problem, I even tried to give all the roles that discord offers, but nothing changes.

quartz kindle
#

show code

wheat valve
#

Okay nevermind, my issue is happening still for whatever reason

quartz kindle
#

did you change anything?

wheat valve
#

I removed a console.log but other than that, no

lyric mountain
quartz kindle
#

latest is v13.6

wheat valve
#
this.guild.shard.send({
        op: Opcodes.REQUEST_GUILD_MEMBERS,
        d: {
          guild_id: this.guild.id,
          presences,
          user_ids,
          query,
          nonce,
          limit,
        },
      });```

this is where the error is thrown in GuildMemberManager, if that helps at all?
wheat valve
quartz kindle
#

your issue is that guild.shard is not defined in the guild you are getting/fetching

#

guild.shard only exists when the guild comes from the websocket

#

so you need the GUILDS intent, and you need the guild to be cached at login from the websocket

#

if you fetch the guild and for some reason the guild is not already cached, it will not have the .shard property

#

or could be a bug in the older v13 versions that would remove it for some reason

#

basically if(guild.shard) exists, then guild.members.fetch() will work

#

if for some reason it doesnt exitst, then you need to get it from client.ws.shards

bright thorn
#

can I make a command to follow, outages channel of the bot support server?

#

any idea how?

severe perch
#

Anybody?

earnest phoenix
#

I have precisely 0 comments in 108 lines of code

severe perch
earnest phoenix
#

tHiS iS WhY wE uSe TyPeScRiPt

solemn latch
#

JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they're creating. This is then processed, by various tools, to produce documentation in accessible formats like HTML and Rich Text Format. The JS...

earnest phoenix
#

using comments containing jsdoc

wheat valve
#

I upgraded to 13.6.0 from 13.0.0 and now Im getting this error: [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred.

It was working fine in 13.0.0, I am also using interaction.deferReply() and then followUp to reply so Im not sure what it means

tulip ledge
#

typescript bae

wheat valve
#

From the command or where Im using deferReply?

#

if (interaction.isCommand()) {
         interaction.deferReply().catch((e) => {console.log(e)});

        let cmd = client.slash_commands.get(interaction.commandName);
        if (!cmd);

        let options = interaction.options.data;

        cmd.run(client, interaction, options);
        
    }```

```js
      interaction.followUp({
                embeds: [embed]
            })

Top is where its deferred, bottom is where im using followUp

severe perch
quartz kindle
#

otherwise you send the reply before the defering kicks in

wheat valve
#

Thanks again

split hazel
#

mogus

raw nest
cinder patio
#

Use flexbox

lyric mountain
#

using % and vw/vh is also an option

raw nest
#

can I do a % with min / max?

cinder patio
#

They're using flexbox so

raw nest
cinder patio
royal herald
#

how do i edit html video players look whitout js

#

im making a freejs project

spark flint
pulsar sierra
#

Soim building a public anti raid bot I have a ruff idea of what I want to add but can someone help me make sure I'm not missing anything

#

||if this isn't aloud question I'm sorry ||

lament rock
#

It doesn't need anything super special. It just needs to do its job. Don't waste your effort on features another bot can suppliment

pulsar sierra
#

Ok

fiery stream
#

anyone here running windows 11 and cannot select file ?

lyric mountain
#

"select file"?

#

as in, left click?

whole glen
#

why does thid work in servers but not dms

fiery stream
#

like where you select where to download games n shii

turbid peak
#

(python) I need help with this problem:

Write the Boolean function is_odd(n) that returns True when n is odd and False otherwise.

Outside the function, generate 15 random integers with possible values from 1 to 30. Invoke the function and, for each number, print if the number is odd or not. For example:

7 is odd.

18 is not odd.

etc..

#

I understand the first part which is

  return n%2 != 0```
lyric mountain
#

not windows'

fiery stream
#

its broken on windows 11

#

its blank white screen

turbid peak
#

since i want to generate 15 random integers from 1-30, do i do

for i in range(15)``` idk what to do with thesew
lyric mountain
#

is that a homework?

turbid peak
#

ye

#

i dont want just answer

#

i want to understand

lyric mountain
fiery stream
#

well nothing related to coding just in ea launcher n adobe

lament rock
#

the % symbol should be correct to determine if one number is a multiple of another number.

lyric mountain
# turbid peak i want to understand

ok so, what you're doing there is generating a random value between 1 and 30 and discarding it
then you're looping 15 times and doing nothing

lament rock
#

might want to do a test run and log results

lyric mountain
#

you need to assign the random value to a variable while inside the loop

#

not outside

turbid peak
#

so inside a ( )

slender thistle
lyric mountain
#

it'd be {}, but python doesn't use brackets

#

it uses tabs

#
while (true):
  scope
  scope
  whatever
#

so you'd have ```py
for i in range(15):
put
code
here

#

NOTE THE TABS

#

that's VERY important on py

turbid peak
#

ok, so it would look like

  for i in range(15)```
modest maple
lyric mountain
#

random.randint(1, 30) generates a number

#

for i in range(15) loops 15 times

#

you don't want to generate a number and loop 15 times

#

you want to loop 15 times and generate a number

turbid peak
#

ok

#

so far, i got this

import random
def is_odd(n):
    return n%2 != 0
for i in range(15):
    random.randint(1,30): #error messages on this line
        if is_odd(i) != 0
            print(i,"is odd.")
        else:
            print(i,"is not odd.")
lyric mountain
#

yes, for sure it'd error

#

that's not how you're supposed to use a number

#

numbers cant have scopes

#

so you cant simply put : in front of it

#

you need to assign random.randint(1,30) to a variable

#

and is_odd() returns a boolean

#

not a number

#

so is_odd(i) != 0 would also fail

raw nest
#

Quick question to Font-Awesome... I read that the free plan is completely open-source for non-commercial and commercial use. But what's with the pageviews? Do they really count them and like "block" the icons if you exceed the 10k/mo (Free plan)?

quartz kindle
#

Each time one of your pages with a Font Awesome Kit is viewed, a pageview is counted.

lyric mountain
#

I'd use some open source icon lib

quartz kindle
#

Kits
The easiest way to use Font Awesome, all without pushing code.

lyric mountain
#

like those from expo

raw nest
raw nest
lyric mountain
#

it's a react framework, but they have an icon library

quartz kindle
#

last time i used fontawesome was like 8 years ago so idk, but im pretty sure they are refering to some website builder solution

lyric mountain
#

you could probably use them in any node project

quartz kindle
#

the actual font file cant possibly count page views

#

you can simply download it and self host it

raw nest
#

true 🤔

raw nest
lyric mountain
raw nest
#

thanks I will take a look at it

lyric mountain
#

how will u extract the svg is a different story

raw nest
#

expo looks so cool in general xDD lol

lyric mountain
#

it's a simplified react native

raw nest
#

never used react native too... 👀

lyric mountain
#

easier to compile to mobile and web

#

but it's less configurable than raw RN

raw nest
#

still pretty cool

lyric mountain
#

for sure it is

raw nest
#

you use expo?

lyric mountain
#

yep, for my bot's homepage

raw nest
#

lemme take a look at it rq xD

lyric mountain
#

used to be a dashboard too, but I locked that section out

raw nest
#

aight, pretty cool things out there I don't know yet :DD

fiery stream
#

embed.add_field(name="Uptime", value=str(timedelta(seconds=int(round(time.time() - ctx.bot.created)))), inline=True) why does this work ??

#

i get this error

quartz kindle
#

why does it work or why does it not work?

fiery stream
#

doesnt

quartz kindle
#

time.time() - ctx.bot.created

#

it seems one of those is not a number

fiery stream
#

ohb yuh ctx.bot.created is the default value that python returns

#

how does one make that readable like not get the defualt discord.py value yk

thorny flume
#

I'm using node cluster in my bot with shards, but every time the cluster is generated I get multiple responses from the messageCreate event. does anyone know how to solve?

simple stump
#

Is MessageComponent and Interaction?

thorny flume
#

yes

quartz kindle
#

if created is an instance of datetime or something, you need to add .timestamp() or .time() to it as well

#

idk how py works

thorny flume
#

hey tim

quartz kindle
thorny flume
#

can you help me?

quartz kindle
#

what library are you using?

thorny flume
#

discord.js and node cluster

quartz kindle
#

show code

thorny flume
#

I'm creating 25 shards and splitting them into each cluster

thorny flume
# quartz kindle show code
const { ShardingManager } = require('discord.js')
const ClusterManager = require('../cluster/ClusterManager')
const cluster = require('cluster')

class ShardManager extends ShardingManager {
  constructor(file, options) {
    super(file, {
      totalShards: options.totalShards,
      mode: options.mode,
      token: process.env['token']
    })

    this.clusterCount = process.env['clusterCount']
  }

  async spawn() {
    await super.spawn(super.totalShards, 60000, false).then(() => {
      if (cluster.isPrimary) {
        if (this.totalShards < this.clusterCount) {
                this.clusterCount = this.totalShards;
            }

        process.RodyBrozy.logger(`shard`, `ShardManager`, `Starting ${this.totalShards} Shards in ${this.clusterCount} Clusters!`)

        const shardArray = [...Array(this.totalShards).keys()]
        const shardTuple = process.RodyBrozy.chunk(shardArray, this.clusterCount)

        for (let index = 0; index < this.clusterCount; index++) {
          const shards = shardTuple.shift()

          const cluster = new ClusterManager({ id: index, shards, manager: this })
          
          cluster.spawn()
        }
      }
    })
  }
}

module.exports = ShardManager
thorny flume
# quartz kindle show code

Thought I'd listen to the events of the shards and send the child workers' processes to the parent worker

quartz kindle
#

im having a hard time understanding the logic here

thorny flume
#

lol

quartz kindle
#

you are creating a ShardingManager with totalShards, then inside the ShardingManager you are creating a ClusterManager for each chunk of shards?

#

but the ShardingManager is spawning the shards anyway?

#

like

#

how many node clusters are you running?

thorny flume
#

i'm creating some shards and splitting them, and i'm creating the clusters with each shard split into two workers, in each worker has 12 shards

thorny flume
quartz kindle
#

whats your index.js?

royal herald
#

ok im here @earnest phoenix

#

i can refactor ur code

#

only english here iirc

thorny flume
quartz kindle
#

whatever main file you have to start everything

royal herald
#

anyways

#

refactoring ur code oki?

thorny flume
royal herald
#

we cant

quartz kindle
#

so you dont use cluster in the index? the only place you use cluster is in the ShardManager, and only to check if isPrimary?

thorny flume
#

no

quartz kindle
#

no what?

thorny flume
quartz kindle
#

show ClusterManager

thorny flume
#

I will send you the class

#
const { EventEmitter } = require('events')
const cluster = require('cluster')
const ShardManager = require('../shard/ShardManager')
const TheBrozyFile = require('../../../discord/thebrozy')

const ClusterOptions = {
    id: Number,
    shards: Number
}

class ClusterManager extends EventEmitter {
  constructor(options = ClusterOptions) {
    super()
    this.id = options.id
    this.shards = options.shards
        this.manager = options.manager
    this.worker = cluster.Worker()
  }

  async spawn() {
    this.worker = await cluster.fork({ CLUSTER_SHARDS: this.shards.join(','),CLUSTER: this.id.toString(), CLUSTER_COUNT: this.manager.clusterCount.toString() })

    process.RodyBrozy.logger(`cluster`, `ClusterManager`, `Worker ${this.worker.id} spawned in cluster ${this.id.toString()} with ${this.worker.process.pid} pid`)

    TheBrozyFile(this)

    this.manager.shards.map((shard) => {
      process.RodyBrozy.logger(`cluster`, `ClusterManager`, `Shard ${shard.id} spawned in cluster ${this.id.toString()}`)
    })
    }
}

module.exports = ClusterManager
quartz kindle
#

so you are creating multiple ShardingManagers

#

and running repeated shards

thorny flume
# quartz kindle show ClusterManager
thebrozy.on('messageCreate', (message) => {
  if (message.author.bot) return 
  if (message.content === 'teste') {
    message.reply(`teste`)
    return
  }
})

I'm getting message.reply() several times

thorny flume
quartz kindle
#

add this console.log in your ShardManager:

  async spawn() {
    console.log(`spawning ${super.totalShards}`);
    await super.spawn(super.totalShards, 60000, false).then(() => {
thorny flume
#
  shard:ShardManager [14/02/2022 17:19:06] [INFO] Starting 2 Shards in 2 Clusters! +0ms
  cluster:ClusterManager [14/02/2022 17:19:06] [INFO] Worker 1 spawned in cluster 0 with 1164 pid +0ms
  cluster:ClusterManager [14/02/2022 17:19:06] [INFO] Shard 0 spawned in cluster 0 +0ms
  cluster:ClusterManager [14/02/2022 17:19:06] [INFO] Shard 1 spawned in cluster 0 +0ms
  cluster:ClusterManager [14/02/2022 17:19:06] [INFO] Worker 2 spawned in cluster 1 with 1165 pid +0ms
  cluster:ClusterManager [14/02/2022 17:19:06] [INFO] Shard 0 spawned in cluster 1 +0ms
  cluster:ClusterManager [14/02/2022 17:19:06] [INFO] Shard 1 spawned in cluster 1 +0ms

quartz kindle
#

add that console.log and run it again

#

and show logs

thorny flume
#

each cluster has two shards

quartz kindle
#

add the log

thorny flume
#

ok

thorny flume
#

.=.

#
const manager = new process.RodyBrozy.ShardManager('./src/discord/thebrozy.js', {
  totalShards: Number(process.env['totalShards']),
  token: process.env['token']
})

manager.spawn()
#
totalShards: Number(process.env['totalShards']),
quartz kindle
#

show the full log

thorny flume
# quartz kindle show the full log
spawning undefined
  shard:ShardManager [14/02/2022 17:25:06] [INFO] Starting 2 Shards in 2 Clusters! +0ms
  cluster:ClusterManager [14/02/2022 17:25:06] [INFO] Worker 1 spawned in cluster 0 with 1616 pid +0ms
  cluster:ClusterManager [14/02/2022 17:25:06] [INFO] Shard 0 spawned in cluster 0 +0ms
  cluster:ClusterManager [14/02/2022 17:25:06] [INFO] Shard 1 spawned in cluster 0 +0ms
  cluster:ClusterManager [14/02/2022 17:25:06] [INFO] Worker 2 spawned in cluster 1 with 1622 pid +0ms
  cluster:ClusterManager [14/02/2022 17:25:06] [INFO] Shard 0 spawned in cluster 1 +0ms
  cluster:ClusterManager [14/02/2022 17:25:06] [INFO] Shard 1 spawned in cluster 1 +0ms
spawning undefined
spawning undefined




quartz kindle
#

and there's your problem

#

the ShardingManager is running 3 times

thorny flume
#

I left two clusters on my machine

quartz kindle
#

index.js
-> ShardingManger -> spawn() -> isPrimary -> Clusters spawn() -> fork() x2
-> index.js -> ShardingManager -> spawn() -> not Primary
-> index.js -> ShardingManager -> spawn() -> not Primary

thorny flume
#

and also has the master cluster

quartz kindle
#

if(isPrimary) {
super.spawn()
}

thorny flume
#

in

const manager = new process.RodyBrozy.ShardManager('./src/discord/thebrozy.js', {
  totalShards: Number(process.env['totalShards']),
  token: process.env['token']
})

manager.spawn()
#

?

quartz kindle
#

although you might want to revisit your design, because its very confusing

thorny flume
#

It's not, it's just because I sent you randomly

#

lol

quartz kindle
#

each time you use cluster.fork() you are running index.js again

#

thats why you use isPrimary to check if its the first run, or if its a forked run

#

you are running ShardingManager.spawn() outside of the isPrimary check

#

meaning both the main process AND the forked processes will create new SHardingManagers

#

which in turn spawn all shards again

thorny flume
# quartz kindle each time you use cluster.fork() you are running index.js again
  async spawn() {
    console.log(`spawning ${super.totalShards}`)
    await super.spawn(super.totalShards, 60000, false).then(() => {
      if (cluster.isPrimary) {
        if (this.totalShards < this.clusterCount) {
            this.clusterCount = this.totalShards;
        }

        process.RodyBrozy.logger(`shard`, `ShardManager`, `Starting ${this.totalShards} Shards in ${this.clusterCount} Clusters!`)

        const shardArray = [...Array(this.totalShards).keys()]
        const shardTuple = process.RodyBrozy.chunk(shardArray, this.clusterCount)

        for (let index = 0; index < this.clusterCount; index++) {
          const shards = shardTuple.shift()

          const cluster = new ClusterManager({ id: index, shards, manager: this })
          
          cluster.spawn()
        }
      }
    })
  } 
#

hm

#

I understand now

thorny flume
#

?

quartz kindle
#

yes that should fix the issue

thorny flume
#

ok

turbid peak
# lyric mountain yes, for sure it'd error

I figured it out. problem was

Write the Boolean function is_odd(n) that returns True when n is odd and False otherwise.

Outside the function, generate 15 random integers with possible values from 1 to 30. Invoke the function and, for each number, print if the number is odd or not. For example:

7 is odd.

18 is not odd.

etc..

The code is

    return n%2 != 0

import random

print(is_odd(1))

for i in range(15):
    rand_int = random.randint(1,30)
    if is_odd(rand_int):
        print(rand_int,"is odd.")
    else:
        print(rand_int,"is not odd.")```
thorny flume
#
  async spawn() {
    console.log(`spawning ${super.totalShards}`)
    if (cluster.isPrimary) {
      await super.spawn(super.totalShards, 60000, false).then(() => {
        if (this.totalShards < this.clusterCount) {
            this.clusterCount = this.totalShards;
        }

        process.RodyBrozy.logger(`shard`, `ShardManager`, `Starting ${this.totalShards} Shards in ${this.clusterCount} Clusters!`)

        const shardArray = [...Array(this.totalShards).keys()]
        const shardTuple = process.RodyBrozy.chunk(shardArray, this.clusterCount)

        for (let index = 0; index < this.clusterCount; index++) {
          const shards = shardTuple.shift()

          const cluster = new ClusterManager({ id: index, shards, manager: this })
          
          cluster.spawn()
        }
      })
    }
  } 
thorny flume
#
spawning undefined
  shard:ShardManager [14/02/2022 17:42:42] [INFO] Starting 2 Shards in 2 Clusters! +0ms
  cluster:ClusterManager [14/02/2022 17:42:43] [INFO] Worker 1 spawned in cluster 0 with 67 pid +0ms
  cluster:ClusterManager [14/02/2022 17:42:43] [INFO] Shard 0 spawned in cluster 0 +0ms
  cluster:ClusterManager [14/02/2022 17:42:43] [INFO] Shard 1 spawned in cluster 0 +0ms
  cluster:ClusterManager [14/02/2022 17:42:43] [INFO] Worker 2 spawned in cluster 1 with 73 pid +0ms
  cluster:ClusterManager [14/02/2022 17:42:43] [INFO] Shard 0 spawned in cluster 1 +0ms
  cluster:ClusterManager [14/02/2022 17:42:43] [INFO] Shard 1 spawned in cluster 1 +0ms
spawning undefined
spawning undefined

thorny flume
lyric mountain
#

you're printing something outside of its scope

thorny flume
#

ok

turbid peak
#

how do you guys make your codes color coded

lyric mountain
#

```lang
code
```

quartz kindle
thorny flume
turbid peak
#

o i c

#

tqtq ill look into it

spark flint
#

so instead of 023

#

its 23

#

remove all 0s before

thorny flume
#

lol

winter pasture
#

parseInt("0100", 10) // 100
I think?

spark flint
#

ah ok

#

i'll try

thorny flume
# quartz kindle
thebrozy.on('messageCreate', (message) => {
  if (message.author.bot) return 
  if (message.content === 'teste') {
    message.reply(`teste`)
    return
  }
})

I'm getting this event twice

fiery stream
#

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1

    - name: Copy repository contents via scp
      uses: appleboy/scp-action@master
      env:
        HOST: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}
        PORT: ${{ secrets.PORT }}
        KEY: ${{ secrets.SSHKEY }}
      with:
        source: "."
        target: "/var/www/mywebsite"

    - name: Executing remote command
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}
        PORT: ${{ secrets.PORT }}
        KEY: ${{ secrets.SSHKEY }}
        script: python3.9 Horizon/main.py``` wait why does this not pop up on my vps ?
#

the directory

boreal iron
spark flint
#

its fixed now

#

same code, just before it was still doing *1000

#

ok next thing

#

i have a photoshop file

earnest phoenix
#

hello, how do i check my bot on top.gg site??

spark flint
#

is there any way to generate images from it using nodejs

boreal iron
#

Also should be the same as Number("00320").toString();

boreal iron
earnest phoenix
spark flint
boreal iron
#

Hmm, interessting

boreal iron
simple stump
#

How do I get a slash command's ID?

boreal iron
#

When registering it, receiving an interaction and when you fetch the application interactions

simple stump
#

👍 Thank you

whole glen
#

when i run this i get this

sudden geyser
#

click on the > and see if it tells you anything

whole glen
#

No debugger available, can not send 'variables'

boreal iron
#

Even if it doesn’t make a difference but you can also use prebuilt methods to register commands

#

client.application.commands.create()

boreal iron
torn salmon
#

Hello I have a problem when a bot sends a message it gives me an error
code: https://sourceb.in/g1VwESJet4

error:

TypeError: Cannot read properties of null (reading 'permissions')
    at Client.<anonymous> (C:\Users\dionl\OneDrive\Documents\djs\events\antilinks.js:9:25)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) Promise {
  <rejected> TypeError: Cannot read properties of null (reading 'permissions')
      at Client.<anonymous> (C:\Users\dionl\OneDrive\Documents\djs\events\antilinks.js:9:25)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
}
boreal iron
#

@whole glen
You should also respect the maximum amount of chars for the name and description

torn salmon
#

ok

eternal osprey
#
if(message.content === "start"){
  const questions3 = [
    `test`,
  ]
  
      let counter3 = 0
      const filter3 = (m) => {
        return m.author.id === message.author.id
      }
  //verander deze naar dm en ga dan alles ook voor firstmember doen

      const collector3 = message.channel.createMessageCollector(filter3, {
        max: questions3.length
       
      })
  
      message.member.send(questions3[counter3++])
      collector3.on('collect', (m) => {
        if (counter3 < questions3.length) {
          message.member.send(questions3[counter3++])
         
        }
      })
  
      collector3.on('end', (collected) => {
      
     console.log(collected)
  
  })
}```Hey, i am still stuck at this issue. How would i make this messagecollector work in dm?
thorny flume
#

I have two clusters, each cluster has two shards, but each shard is responding independently; I have a messageCreate event and it returns message.reply() four times

boreal iron
#

Not that I deal with shards but I guess you need to get the instance of the origin of the event

#

In other words I guess you need to get the right shard/cluster you received that event in and need to respond in it

quartz kindle
#

like, what exactly are you trying to accomplish from a design perspective?

thorny flume
#

desing? are you talking about folders and all?

quartz kindle
#

like, discord has shards, each shard has x guilds. the discord.js sharding manager launchers 1 process per shard, or 1 thread per shard, depending on the mode, and each of those shards runs a separate client instance that processes the commands

#

how exactly do you want to organize those?

#

2 processes, with x shards each with 2 clients processing commands?

thorny flume
quartz kindle
#

or are you trying something more elaborate like threads containing shards and redirecting events to a central process where a single client instance processes the commands?

quartz kindle
#

whar are you using for communication? ipc?

#

is the shardingmanager running in process or thread mode?

thorny flume
#

yes

#

ipc

quartz kindle
#

ok so, the easiest way to do what you want, is to have the sharding manager create shards, then the shards send events back to the sharding manager, and the sharding manager file processes everything

#

there is no clustering tho

#

just a central process, with separate processes for shards

#

the discord.js sharding manager does not support clustering, no matter how you try to do it, because it inherently always launches separate processes for each shard

#

if you want to have a clustered system, where each process contains multiple shards, you have to either use internal sharding, or a third party solution like kurasuta or hybrid sharding

thorny flume
#

kurasuta ?

#

hm....

quartz kindle
#

its a library on npm

thorny flume
#

ok

quartz kindle
#

btw how big is your bot?

thorny flume
quartz kindle
#

any specific reason why you want a central process instead of normal clusters?

thorny flume
#

but if i use normal clusters how could i do that??

quartz kindle
#

i think multple machines is overkill

thorny flume
#

could i proceed from where i am?

quartz kindle
#

you dont need that unless you have millions of guilds

#

you could simply use discord.js the normal way, the same way as you would with normal shardingmanager, but instead of sharding manager you use kurasuta or discord-hybrid-sharding

#

they are both a replacement sharding manager

#

everything else in your code would be exactly the same as the normal discord.js

thorny flume
#

I know that, I exaggerated in "several machines" I would put, only in two

#

hm

#

ok

#

I'm going to study kurasuta

quartz kindle
#

kurasuta is very similar to what you were trying to do with the cluster module

#

just it doesnt redirect events into a central process, each cluster has its own events and its own client

#

like the normal sharding manager, but each process/client has multiple shards at once

thorny flume
#

And how would I deal with these clients?

quartz kindle
quartz kindle
thorny flume
#

ok

quartz kindle
#

is it a DM message?

quartz kindle
split hazel
#

the biggest mistake i ever made

#

its broken and abandoned

quartz kindle
#

better than the weird thing hes trying to do

split hazel
#

but yeah

#

i still dont know how people with apparently 40k guilds struggle with things like this

#

at that point you should be proficient enough to make good decisions on your own

#

with some guidance on the way

#

unless your hello world bot got very lucky and gained a lot of servers quickly

quartz kindle
#

thats usually what happens

#

bots accidentally getting too big, then struggling with infrastructure

quartz kindle
#

happened to me too at the 2.5k milestone

split hazel
quartz kindle
#

btw my bot completely stopped growing since the certified bot thing was removed from topgg

#

lmao

round cove
split hazel
#

rip

#

idk why they stopped and eventually removed certified bots

#

it was a pretty good idea

round cove
#

imagine mailing oily

split hazel
quartz kindle
#

everytime my bot was featured in the cert section i would get like 200 new guilds in a day

#

now i've been stuck at 9.5k for half a year

#

xD

split hazel
#

it's time for you to use auctions

quartz kindle
#

with what money

split hazel
#

uh

#

your job

#

if you have one old man

quartz kindle
#

i kinda dont

#

lmao

split hazel
#

rip

quartz kindle
#

you dont have the luxury of stable income when you're your own boss xd

split hazel
#

bro just join some crappy nodejs startup lmao

quartz kindle
#

ew

#

im only getting a job if they pay me average US software engineer wages

#

which is like 80k+ a year

round cove
#

brazilian moment

quartz kindle
#

otherwise its not worth selling my soul to help make someone else rich

round cove
#

right lmao

quartz kindle
#

been there done that

split hazel
#

lol yeah

#

thinking about doing some entrepreneur crap once I'm able to

quartz kindle
#

yeah dude, thats is the way

split hazel
#

I'll start by being a reseller on amazon lol

quartz kindle
#

xD

#

dropshipping used to be a hot thing

split hazel
#

it's decent money but sometimes crap won't sell

quartz kindle
#

get into the gpu market

#

by low sell 3x the price

#

lmao

split hazel
#

people will definitely pay anything to get their hands on the latest sold out gpu

quartz kindle
#

if you like cars/bikes, dismantling old vehicles and selling parts can be very profitable

#

but it does take a lot of work

wheat mesa
#

my gpu I bought almost 3 years ago for 500 bucks is worth more now than it was then

#

lmfao

marble juniper
#

Sell it and make stonks

wheat mesa
#

an interface in ts like ts interface Test { name: string; age: number; isAlive: boolean; } can be represented with Record<string, any> right?

#

My ts is yelling at me

marble juniper
#

Or you could add something like
[key: string]: any
idk

wheat mesa
#

that's confusing then!

#
interface ModalArgs {
    name: string;
    description: string;
}

            run: async (modalContext: InteractionModalContext, args: ModalArgs) => {
                console.log(args);
                return modalContext.editOrRespond(`${args.name}, ${args.description}`);
            },
// run's args are of type InteractionModalArgs, which is Record<string, any>
``` but ts yells at me saying ```
Type '(modalContext: InteractionModalContext, args: ModalArgs) => Promise<unknown>' is not assignable to type 'InteractionModalRun'.
  Types of parameters 'args' and 'args' are incompatible.
    Type 'InteractionModalArgs' is missing the following properties from type 'ModalArgs': name, description
marble juniper
#

Not really

marble juniper
wheat mesa
#

I'm assuming this is some sort of obscure ts fuckup

#

the thing is that it works for everyone else

#

which is just odd

marble juniper
#

Im pretty sure this is not the fault of ts

#

Cuz if it fucks up its either the lib has bad typings or you did something wrong

wheat mesa
#

I believe it's something wrong with my setup, it works for everyone else in an identical setting

#

The lib doesn't have bad typings

#

It's made in ts to begin with

marble juniper
#

Ok

wheat mesa
#

just really odd ig

#

it compiles and runs just fine too

#

so it's not a huge deal, it's just annoying

quartz kindle
#

Record<string, any> doesnt make much sense there tho

wheat mesa
#

it's the internal type provided by the lib so that it works with different types of interfaces

quartz kindle
#

well try making name and description optional then

#

because record any wont satisfy an interface that demands those props to exist

wheat mesa
#

yeah it works when I make it optional

#

it's still odd though considering it works for everyone else

quartz kindle
#

no idea

wheat mesa
#

either way, setting them as optional works well enough for me

#

since I know which fields are guaranteed to be there

boreal iron
#

I wonder how much time you can effort

wheat mesa
#

is there a way to make the vscode debug terminal pop out automatically

quartz kindle
earnest phoenix
#

And the first thing I see when I enter this channel is the forsaken Detritus, may god save us

vocal elk
#

i get the problem in replit that,

#

before it was fine but after i reinstalled ffmpeg, this happened

wanton canyon
#

A

short pilot
#

game development progress is coming along nicely

wheat mesa
waxen idol
#

Hold on

wheat mesa
#

you're probably in a bot farm

waxen idol
wheat mesa
#

a discord server that abuses the discord API/service by adding every bot they can find

#

potentially spamming your commands

waxen idol
wheat mesa
#

yes

#

you're definitely in a bot farm

waxen idol
#

:(

wheat mesa
#

I'd recommend finding a way to leave it

vocal elk
wheat mesa
#

because it can cause problems like ratelimits

wheat mesa
vocal elk
waxen idol
#

I don't want the top.gg staff to think I change the number myself

wheat mesa
#

use lavalink or something like that instead, it will be a hell of a lot easier than using ffmpeg and trying to optimize it

vocal elk
#

but will i be able to use it with youtube_dl

wheat mesa
#

probably, lavalink is a music server

#

I haven't done a whole lot with music

#

I've used ffmpeg to play music into a vc but it's by no means "easy"

#

this is something similar to what I use, but it's in typescript and I'm not using discord.js ```ts
const args = [
'-i',
url,

        '-f',
        'avfoundation',

        '-ac',
        '2',

        '-f',
        's16le',

        '-ar',
        '48000',

        '-loglevel',
        '0',

        '-analyzeduration',
        '0',

        'pipe:1',
    ];

    this.currentStream = spawn('ffmpeg', args, { shell: false, windowsHide: true });

    MusicPlayer.encoder.bitrate = this.connection.channel?.bitrate ?? 96_000;
    MusicPlayer.encoder.complexity = 10;
    MusicPlayer.encoder.signal = 'music';
    const packets = MusicPlayer.encoder.encode_pcm_stream(960, this.currentStream.stdout);
    const iter = packets[Symbol.asyncIterator]();

    let seq = 0;
    const start = Date.now();
    let stopped = false;

    while (true) {
        if (this.state.skip) {
            break;
        }

        if (this.state.stop) {
            stopped = true;
            break;
        }

        const { done, value } = await iter.next();
        if (!this.state.speaking) this.state.speaking = (this.connection.setSpeaking({ voice: true }), true);
        if (done) {
            break;
        }
        this.playing = true;
        this.connection.sendAudio(value, { isOpus: true });
        if (seq >= u16_max) seq = 0;
        await sleep(20 + 20 * seq++ - (Date.now() - start));
    }
#

I'm not sure if that helps you in any way but the basic idea is spawning a ffmpeg process and piping the stdout of said process into packets

waxen idol
#

Ok I found the guild, its id is 906938940618051655 and its name is │ 𝓬𝓾𝓭𝓭𝓵𝔂 ™

earnest phoenix
delicate shore
#

Guys please help!

waxen idol
delicate shore
#

VPS vs Localhost
I don't know why this is happening

#

I am using ReactJS and running same command on both of them

waxen idol
#

Idk what is ReactJS bruh

#

I dev bots with pycord

earnest phoenix
#

then just don't reply to their question

waxen idol
#

I thought I could help

earnest phoenix
waxen idol
#

I didn't know it was with js

earnest phoenix
#

oh i didn't read the rest of the convo

waxen idol
earnest phoenix
#

sigma tip #69: don't reply to anyone in development unless you know what they're actually asking

earnest phoenix
waxen idol
wheat mesa
delicate shore
#

My API is about a year old, I have been using that name and he was fine with it.

#

I learnt about Some Random Api after making my own api

#

Amazing Cloudflare is down!

earnest phoenix
#

check your browser console

delicate shore
#

It shows an unrealated error

#
      auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/master/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
    ```
earnest phoenix
#

you're using http on localhost instead of https

#

which is why it's not working

delicate shore
#

Yea I cannot use https

earnest phoenix
#

try using a cloudflare tunnel

delicate shore
#

I cannot because their website is down

#

I cannot do anything

earnest phoenix
#

ngrok?

open bough
#

can anyone gimme any cool ideas which u wanted em to implement in bots
but never did

delicate shore
#

Amazing

earnest phoenix
open bough
open bough
earnest phoenix
#

no more ideas

open bough
#

hmmm

delicate shore
sudden geyser
delicate shore
#

bruh

#

what should I do

earnest phoenix
#

I suggest you cry about it

delicate shore
#

Why I am getting this shit now

#

omg reactJS is pain

earnest phoenix
#

cry about it

#

the problem ain't reactjs

#

it's the auth0 lib you are using

quartz kindle
#

its a 404 from nginx lol

#

nginx cant find your reverse proxy

delicate shore
earnest phoenix
#

why are you using nginx instead of an actual react server such as nextjs

delicate shore
# quartz kindle nginx cant find your reverse proxy

I honestly dk wh I am doing at this point

upstream bruh {
    server HIDDEN_IP:8675;
    keepalive 8;
}

# the nginx server instance
server {
    listen 80;
    listen [::]:80;
    server_name api-info.pgamerx.com
    access_log /var/log/nginx/api-info.pgamerx.com.log;

    # pass the request to the node.js server with the correct headers
    # and much more can be added, see nginx config options
    location / {
      try_files $uri /index.html;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;

      proxy_pass http://bruh/;
      proxy_redirect off;
    }
 }

I don't think there is anything wrong here

delicate shore
earnest phoenix
#

not upstream

quartz kindle
#

upstream is fine lol

#

why hidden ip? just use localhost

earnest phoenix
quartz kindle
#

also

#

didnt you say you were using secure domain?

#

or is it just couldflare flexible ssl?

delicate shore
#

Yes, but not from the server side

#

Yea^^

#

Funny thing is that this was something I made months ago (most of it is non functional ), this has the same configuration as the other one (diff ports ofc) but this works

quartz kindle
#

is your node server running?

delicate shore
#

yep

quartz kindle
#

try accessing yourvpsip:nodeport in your browser

delicate shore
#

I did, it is white

#

It is blank white but favicon is visible

#

pm2 serve build/ 8675 --name "my-react-app" --spa
I served the server like this

quartz kindle
#

if it works with direct access but not with nginx, then nginx is the issue

delicate shore
#

ikr

quartz kindle
#

try removing the tryfiles line

delicate shore
#

whichone?

#

Oh this: try_files $uri /index.html;

quartz kindle
#

ye

delicate shore
#

nothing changed

boreal iron
#

I wonder about the upstream name as well as the proxy pass

#

Try bruh.local

earnest phoenix
boreal iron
#

You usually need to follow the RFC guidelines for virtual hostnames or use IPs

earnest phoenix
#

I got some good ones, like ADHDStorage.local wheeze

delicate shore
#

I have always used weird names

#

they have always worked

boreal iron
#

Idc about the name but the TLD

delicate shore
#

Waig guys

#

Wait*

#

it is running script

earnest phoenix
#

At least it doesn't look like it

delicate shore
#

😩

#

wait

#

on stackoverflow someone pointed out that it might be because I am using browserList

earnest phoenix
delicate shore
#

lemme try thnx

#

Wait

#

my build is blank?

#

I mean blank white page

earnest phoenix
#

point your sub domain to vercel's CNAME

#

after you deploy it ofc

delicate shore
#

alright

#

nvm

lament rock
#

Select menus are OP.
idk why I was using buttons to go through pages.
A module I wrote to handle associations with specific message components and callbacks makes my code super fucking clean and responsive.

export function paginate(pageCount: number, callback: (page: number) => unknown) {
    let page = 0
    if (pageCount > 1) {
        let menuExpires: NodeJS.Timeout
        const component = new BetterComponent({
            type: Discord.Constants.MessageComponentTypes.SELECT_MENU,
            placeholder: "Select page",
            maxValues: 1,
            minValues: 1,
            options: Array(pageCount).map((_, i) => ({ label: `Page ${i + 1}`, value: String(i), description: null, emoji: null, default: i === 0 }))
        })

        component.setCallback(interaction => {
            interaction.deferUpdate()
            page = Number((interaction as import("thunderstorm").SelectMenuInteraction).values[0])
            callback(page)
        })

        // eslint-disable-next-line no-inner-declarations
        function makeTimeout() {
            clearTimeout(menuExpires)
            menuExpires = setTimeout(() => {
                component.destroy()
            }, 10 * 60 * 1000)
        }
        makeTimeout()
        return component
    } else callback(page)
    return null
}
delicate shore
#

OH MY GOD I HATE THIS

#

I HAET EVERYONE

#

I HATE VERCEL, REACTJS, NGINX, PM2, MY HOSTING SERVICE AND MYSELF

delicate shore
#

bruh wtf

#

it kind of worked but now

#

If I press login it says this

delicate shore
#

I will cry

#

Thank you @earnest phoenix, vercel is a lifesaver
!

torn salmon
boreal iron
#

In a direct message, a property member does not exist
Therefore a permission check for the non-existing member isn’t valid, too

#

Either you check the channel type before checking the member permissions or you check if a property member exists

#

For example simply by using optional chaining

#

message?.member.permissions.has(…)

#

In your statement you’re checking the permissions

earnest phoenix
delicate shore
#

yeah that too

spark flint
#
router.route("/redeemCode")
        .post(async (req, res) => {
                const check = await codes.find({code:req.body.code}).toArray()
                if (!check.length > 0) {
                        return res.json({error:true, errormsg:"Unknown code!"})
                }
                if (check[0].uses > check[0].maxuses) {
                        return res.json({error:true, errormsg:"Max uses reached!"})
                }
                const user = await users.findOne({_id:req.user.id})
                await users.updateOne({_id:req.user.id}, {$set:{balance:Number(user.balance}+Number(check[0].value}})
                await codes.updateOne({code:req.body.code}, {$set:{uses:Number(check[0].uses++)}})
                return res.json({error:false, value:check[0].value})
        })```
#

SyntaxError: Unexpected token < in JSON at position 0

#

am i just stupid

delicate shore
#

God AI is tough

spark flint
#

It was me being stupid

bright thorn
#

i want to delete this type of data from mongo db after 7d

#

anyone can guide me

#

please

pale vessel
#

collection.deleteOne()?

bright thorn
#

after

#

7d

#

how can its works

spark flint
#
router.route("/redeemCode")
        .post(async (req, res) => {
                try {
                        const check = await codes.find({code:req.body.code}).toArray()
                        if (!check.length > 0) {
                                return res.json({error:true, errormsg:"Unknown code!"})
                        }
                        if (check[0].uses >= check[0].maxuses) {
                                return res.json({error:true, errormsg:"Max uses reached!"})
                        }
                        const codeclaims = await claims.find({code:req.body.code, userid:req.user.id}).toArray()
                        if (codeclaims.length > 0) {
                                return res.json({error:true, errormsg:"You've already redeemed this code!"})
                        }
                        const user = await users.findOne({_id:req.user.id})
                        await users.updateOne({_id:req.user.id}, {$set:{balance:Number(user.balance)+Number(check[0].value)}})
                        await codes.updateOne({code:req.body.code}, {$set:{uses:Number(check[0].uses)+1}})
                        await claims.insertOne({code:req.body.code, userid:req.user.id})
                        return res.json({error:false, value:check[0].value})
                }
                catch (err) {
                        return res.json({error:true, errormsg:err})
                }
        })```
#

wheres the json issue there

lyric mountain
#

is there any reason to choose h264 over h265 on ffmpeg?

white anvil
#

idk its better supported because its older

cinder patio
bright thorn
#

then

earnest phoenix
#

You can also use redis as your db

#

¯\_(ツ)_/¯

bright thorn
#

can you send any example

#

for that

cinder patio
#

then

collection.deleteMany( { createdAt: {"$lt" : Date.now() - 6.048e+8 } });
lyric mountain
#

ye, as it seems, it's VERY little supported actually

bright thorn
#

this type of object

earnest phoenix
#

we won't spoonfeed

#

store the createdAt property inside the object then delete that specific one

spark flint
#

uwu pls help

#

i took down a client panel

spark flint
#

doesn't give one

earnest phoenix
cinder patio
earnest phoenix
#

what does that do

cinder patio
#
collection.updateMany({condition}, {
    $pull: { tracks: { createdAt: { $lt: Date.now() - 6.048e+8 } } }
});
cinder patio
atomic kindle
#

seen

lyric mountain
#

ok, another question abt ffmpeg

#

is it better to use a fixed bitrate or crf?

pale vessel
#

you mean cbr and vbr?

lyric mountain
#

crf*

#

like, from what I read on trac.ffmpeg setting bitrate gives better control over filesize, while crf allows better overall quality

#

anyway, guess I'll try a few samples to see how it goes

#

doesn't help that the lib I'm using has barely any doc

spark flint
#

Error loading route from api.js file! Error details: SyntaxError: Missing } in template expression

split hazel
#

guild.channels.cache.find(c => c.name === "channel name")

split hazel
#

tfw you put a red cross with no feedback whatsoever

round cove
#

probably because the person said all servers it's in

split hazel
#

im taking it as they're not trying to spam the api by logging to every single channel at once

#

and instead meaning they want to log to a channel named x like that in every server

lyric mountain
#

oh, it isn't

#

❎ have to stay with the "error but not kinda" emoji

bright thorn
#

can we get erela js upcoming queue songs?

slow ibex
#

Hey.. @theFirebaseUsers i just installed firebase via NPM and i get "No "exports" main defined in PATH_TO_BOT/\node_modules\firebase\package.json any idea?

lament rock
#

it exports some paths like /firestore
or /database

earnest phoenix
#
client.mongo.connect(console.log("Connected to mongo"))
``` is this correct?
#

Or i have to use .then/function (=>...)

lament rock
#

Does it accept a callback param or does it return a Promise

cinder patio
#

probably both

lament rock
#

That callback is incorrect anyways, it would have to be () => console.log("Connected to mongo")

cinder patio
#

so no it's not correct

earnest phoenix
#

ok

#
client.mongo.connect(() => console.log("Connected to mongo"))
#

?

lament rock
#

Looks okay to me

earnest phoenix
#

ok

#

ty

cinder patio
#

you should check out the documentation to see if it's correct or not

#

don't make this a habit

earnest phoenix
#

ok

cinder patio
#

the connect function may have other arguments before the callback

earnest phoenix
#

ok

#

is this needed?

#

I just uninstalled git some days ago

wheat mesa
#

connect most definitely does not take a callback as the first parameter btw

earnest phoenix
#

ok

wheat mesa
#

Wait that’s the wrong connect

#

Hold on

#

Mobile skill issue moment

wheat mesa
#

Okay yeah that’s it

#

Looking at the mongodb docs it’s horrendous to navigate on mobile

cinder patio
wheat mesa
#

Lmao

#

I just googled mongoclient connect method and was looking around for it

viral spade
#

hello!
I have discord js ^13.5 and would like to get all members of a specific role.
I did const members = msg.guild.roles.cache.get(targetRoleId).members;, but i only get the cached members, which doesnt work for big servers.

Will something like const members = (await msg.guild.roles.fetch(targetRoleId)).members; give me all members with that role?

cinder patio
#

probably not

viral spade
#

So does anyone know a solution how to get ALL members for a certain role? or just the memberIds would be fine too

cinder patio
#

You'll have to fetch all members

viral spade
#

all members, as in all members for every role?

cinder patio
#

The discord API has no endpoint to get members of a specific role only, so you'll have to fetch all members and do the filtering yourself

viral spade
#

i see, thank you

simple stump
#

I'm trying to set up slash command permissions, but it doesn't seem to be working.

const fullPermissions = [
        {
            id: '942893451551309907', // delete
            permissions: [{
          id: message.guild.roles.everyone.id,
          type: 'ROLE',
          permission: false,
                id: '877309777741500487', // staff
                type: 'ROLE',
                permission: true,
            }],
        },
      {
        id: '943204857995726948', // score
        permissions: [{
          id: message.guild.roles.everyone.id,
          type: 'ROLE',
          permission: false,
          id: '882754787580457012', // scorer
          type: 'ROLE',
          permission: true,
        }],
      },
    ];
    await client.guilds.cache.get(guildId)?.commands.permissions.set({ fullPermissions });
    await message.reply("Done");

I'm testing on both my alt and my main (which has permissions), but my alt can still use the slash commands.

#

I do have role permissions added for the interaction itself, but I want to disable the command entirely for those without the role.

raw nest
#

I have some div elements which have the flex-grow property on it so it fills the free space and it wraps if the elements together are wider than the screen. But if I have less elements than the bare maximum it still grows to the screen end.
So overall the question is: How can I make all columns of a flexbox the same width, regardless of the screen width?

spark flint
#

how can i get date like 15/02/22 using javascript

raw nest
cinder patio
#

that's wrong

raw nest
#

?

spark flint
#

${date.getDate()}/${date.getMonth()+1}/${date.getFullYear().toString().substr(-2)}

#

that works

cinder patio
#

Date.now returns the current time in milliseconds

raw nest
simple stump
#

Is it possible to have a transparent side bar for embeds or no side bar at all?

#

When hovering over the embed, there isn't a side bar at all.

cinder patio
#

It's probably the same color as the background

#

switch to light mode to see if there's a sidebar

sudden geyser
#

At least, for both themes, like Feud said.

simple stump
#

There is. Huh. It's weird, cause I have the hex value for the background:
#36393F
But when hovering over the embed I created with that value, there is a side bar (at least it's somewhat visible).

#

For the embed I sent, there isn't a side bar when hovering over it. Idk it's weird

viral spade
#

Discord.js ^13.5
What does the force option of fetch do exactly? If i do not "force", can it happen that i only get part of the actual objects, or a not up-to-date version of it?

sudden geyser
#

Force just means it'll ask Discord for the data on a resource (e.g. a user) instead of first checking if you (the program, your bot) already has it stored locally (in a cache, like a map)

#

Without force, it'll check the cache first, and if that doesn't exist, it'll then ask Discord.

#

You shouldn't get partial objects with a cache.

viral spade
#

ok thanks

atomic kindle
#
spark flint
#

its only me seeing the date

#

internal

earnest phoenix
#

oh thats interesting

pale vessel
#

use padStart to keep 0 if needed

#

that last method looks dumb you probably shouldn't use it

sudden geyser
#

isn't there a custom formatter built in

pale vessel
#

Intl.DateTimeFormat I think

cinder patio
#
new Date().toLocaleDateString("en-AU", {day: "2-digit", month: "2-digit", year: "2-digit"});
winter pasture
wicked pivot
#

Here we can only make requests for things on discord or other?

spark flint
#

wdym

#

oh wait

#

i get it now

#

you can ask for any development help

slow ibex
#

Quick Sanity Check... when i define a const inside an IF/ELSE its values has to be accessible outside the IF/ELSE.. correct?

sudden geyser
#

Nah

#

let and const are bound to the scope they're declared in.

slow ibex
#

ffs

sudden geyser
#

Only var is the exception, where it's bound to the function scope (where the function was declared).

slow ibex
#

No wonder that didnt work as i expected it.

#

thx

sudden geyser
#

You could declare a variable above with let and assign it a value later.

slow ibex
#

I declared it as a var.. as long as it kinda works im happy.

pale vessel
#

nice

earnest phoenix
#

My chrome extension is on manifest v2 and is on the chrome web store. Do I need to move it to manifest v3 before I can publish its new update?

prime mist
atomic kindle
earnest phoenix
#
(node:575) UnhandledPromiseRejectionWarning: ReferenceError: db is not defined
    at /home/runner/vcodes/src/routers/partners.js:14:13
    at Layer.handle [as handle_request] (/home/runner/vcodes/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/runner/vcodes/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/runner/vcodes/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/runner/vcodes/node_modules/express/lib/router/layer.js:95:5)
    at /home/runner/vcodes/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/runner/vcodes/node_modules/express/lib/router/index.js:335:12)
    at next (/home/runner/vcodes/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/home/runner/vcodes/node_modules/express/lib/router/index.js:174:3)
    at router (/home/runner/vcodes/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/home/runner/vcodes/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/runner/vcodes/node_modules/express/lib/router/index.js:317:13)
    at /home/runner/vcodes/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/runner/vcodes/node_modules/express/lib/router/index.js:335:12)
    at next (/home/runner/vcodes/node_modules/express/lib/router/index.js:275:10)
    at /home/runner/vcodes/node_modules/express/lib/router/index.js:635:15
spark flint
#

Loving the bot list fork KEKW

spark flint
earnest phoenix
#

okay "db is not defined"

#

I wont talk to you

earnest phoenix
spark flint
#

look at what ur doing

earnest phoenix
#

dont ping me

spark flint
#

ur forking a botlist, and wondering why db is not defined

earnest phoenix
spark flint
#

well its clearly not

#

look at the error

wheat mesa
#

You have yet to show any real code for us to work with here

earnest phoenix
#

user profiles and bots and servers are being pushed to theMongoDB database

earnest phoenix
spark flint
#

hmm yes, ask for help starting a botlist in a major botlist KEKW

earnest phoenix
#

this is the only server i know of that has developers that are actually online

#

lmao

wheat mesa
spark flint
wheat mesa
#

Wtf lmfao

spark flint
earnest phoenix
#

lmfao

wheat mesa
#

Not even Tim knows 65% of javascript

#

Nobody does

earnest phoenix
#

js with ts icons

wheat mesa
#

There’s an infinite amount of frameworks and libs pretty much

earnest phoenix
#

its a random number I have been debating if I should use a list or a chart, most people use chart but idk how to tell how much of a language you know.

#

So I just put placeholder numbers till i figure it out

wheat mesa
#

It’s simple: you don’t have a percentage of a language that you know

earnest phoenix
# wheat mesa Where the error is. You should definitely learn how to use js before copying a t...
const app = require('express').Router();
const Database = require("quick.db");
const path = require("path")

console.log("[vcodes.xyz]: Partners router loaded.");

app.get("/partners", async (req,res) => {
    res.render("partners.ejs", {
        bot: global.Client,
        path: req.path,
        config: global.config,
        user: req.isAuthenticated() ? req.user : null,
        req: req,
        db: db,
        roles: global.config.server.roles
    })
})

module.exports = app;
wheat mesa
#

It’s impossible to benchmark it like that

#

db isn’t defined

#

Very clearly

spark flint
#

db is not defined

earnest phoenix
#

db isnt defined

#

god

#

and was talking about mongodb and using quickdb

earnest phoenix
spark flint
#

bruh

#

db: db

#

you don't define db

earnest phoenix
spark flint
#

advice: don't fork a botlist and then ask in another botlist how to work said botlist KEKW

earnest phoenix
#

advice: do not copy codes from the internet

spark flint
#

stackoverflow etc is an exception

atomic fox
#

how do i fix this

earnest phoenix
spark flint
#

exactly

wheat mesa
earnest phoenix
wheat mesa
#

Ok

boreal iron
#

Did I miss the drama once again?

wheat mesa
#

Asking for help with very obviously copy pasted code is not going to get you far when you have to essentially have someone else code for you

mortal python
#

if anyone has gotten their music bot verified, plz reach out to me. I have questions 🙏

real rose
#

If you've any questions for me @mortal python feel free to shoot me a dm

#

I've a music bot which was approved 👀

mortal python
#

awesome, I sent you a DM

earnest phoenix
# atomic fox how do i fix this

node-canvas (nicknamed canvas) needs the libuuid library to run, which is pre-installed in most Linux distributions, but as it seems, it's not installed for you, you can run apt-cache search libuuid to look up for the available installations, and if there's uuid-dev in the output, run sudo apt install uuid-dev -y to install it, if it's not present in the output, you'll have to install it from source:
https://noknow.info/it/os/install_libuuid_from_source?lang=en

atomic fox
#

thx but i deleted the files

#

they were useless anyway lol

split hazel
vivid fulcrum
#

bro it's licensed and you changed the copyright on it and didn't attribute the author

#

you can get sued

earnest phoenix
split hazel
#

using a uuid library for that seems highly unnecessary but fair enough

#

they could've just numbered them 💀

spark flint
#

???

#

@versed cairn ghost ping why?

versed cairn
#

Nothing

lament rock
#

I set 0x2f3136 to all of my embeds

earnest phoenix
earnest phoenix
earnest phoenix
earnest phoenix
#

Honestly 9/10 programmers are using code they didn't make anyway. It is fine as long sa you understand what said code does and how it functions

sudden geyser
#

there's nothing wrong with copying code as long as you have fair rights to use it imo

#

even if you don't understand it you will eventually

earnest phoenix
#

fair rights? pfft

#

faker.js

sudden geyser
#

you want to copy and paste some answer from stackoverflow on your final test?

#

without citing who you got it from?

earnest phoenix
#

ofc

#

Fuck credit

earnest phoenix
sudden geyser
earnest phoenix
rigid dock
#

Hey guys, been working on getting my bot verified but ran into the TOS page requirement. I don't know much about creating one for my bot, could someone point me in the right direction? Thanks!

lament rock
#

You don't need to be a legal expert to write a TOS/Privacy Policy. You can even take inspiration from other sources

sudden geyser
#

aka search tos generator, find the one that looks like it would fit a bot and isn't as long as the bible, profit

earnest phoenix
wheat mesa
#

So if I have a vector of threads in c++ that execute simultaneously, how can I stop all of the threads once one of them has completed?

#

Is there a simple solution or is it going to be wildly complex like I’m expecting

#

This is how my threads are executed by the way: ```cpp
for(auto& thread : threads) {
thread.join();
}

split hazel
#

I'll think of a solution in a minute sorry 😂

split hazel
vagrant lodge
#

how to make vote rewards for voting, the bot should dm and give rewards as soon as the user votes

vagrant lodge
#

I didnt ask spoon feed, is there any docs or something where I can find the way to do it, if giving docs is spoon feed too then get a life

woeful pike
#

I just turned off import cost and my CPU usage went from 100% to like 15

split hazel
#

tf is import cost

woeful pike
#

it shows you how big the modules you're importing to your files are

split hazel
#

o

hybrid cargo
woeful pike
#

yeah it was a good time mining crypto probably

hybrid cargo
#

mainly noticable was the intellisense. Like i noticed a really high jump in that performance after uninstalling that

woeful pike
#

definitely

charred roost
#
app.post('/topgg', webhook.listener(vote => {
  console.log(vote) // empty object
}))
```why do i get an empty objecct? (im using @ancient bloom-gg/sdk)
split hazel
#

crypto is bad for the environment!!!!! 😱 😱 😱 😱 😱

spark flint
#

omg

#

cwpyto

woeful pike
#

I fucking

marble juniper
#

cwypto bad

woeful pike
#

I hate nextjs

marble juniper
charred roost
spark flint
#

express.json

earnest phoenix
#

dbl capybara nft when????

severe perch
#

Take this nft

split hazel
#

I especially don't like working with databases on it

#

it acts more of a stateless cloud function than a backend server

round cove
#

Just use angular

split hazel
#

anything you save globally is unreliable because it may be cleared

pulsar bone
#

so how do i kick a member in events ?

winter pasture
woeful pike
#

has discord released an input field yet

winter pasture
woeful pike
#

I have no idea I haven't touched discord bots in 2 years

earnest phoenix
woeful pike
#

yes, not a bot

#

do you expect the guy selling sandwiches to work on the wheat fields as a side gig

winter pasture
#

Yes

earnest phoenix
#

Yes

sage bobcat
#

One message removed from a suspended account.

lapis meteor
#

I want to make a reminder system but I don't know if I should make a setTimeout for all reminders or a setInterval every second to check 1 by 1 the reminds. Which one is more optimized?

vivid fulcrum
#

a combination of both

#

have an interval running every few minutes that checks your database for close-to-expiring reminders, if there are any, queue those in a setTimeout with the leftover time

thick granite
#

I've been trying to insert our whole website in description
Coz I'm dumb and i dunno howtopggFacepalm

boreal iron
#

Use an iFrame

thick granite
thick granite
#

@boreal iron ty

simple stump
#

I'm trying to set up slash command permissions, but it doesn't seem to be working.

const fullPermissions = [
        {
            id: '942893451551309907', // delete
            permissions: [{
          id: message.guild.roles.everyone.id,
          type: 'ROLE',
          permission: false,
                id: '877309777741500487', // staff
                type: 'ROLE',
                permission: true,
            }],
        },
      {
        id: '943204857995726948', // score
        permissions: [{
          id: message.guild.roles.everyone.id,
          type: 'ROLE',
          permission: false,
          id: '882754787580457012', // scorer
          type: 'ROLE',
          permission: true,
        }],
      },
    ];
    await client.guilds.cache.get(guildId)?.commands.permissions.set({ fullPermissions });
    await message.reply("Done");

I'm testing on both my alt and my main (which has permissions), but my alt can still use the slash commands. I'm testing on both my alt and my main (which has permissions), but my alt can still use the slash commands.
I do have role permissions added for the interaction itself, but I want to disable the command entirely for those without the role.

wheat mesa
#

And the work they were doing was generating random strings, just messing around with multithreading tbh

#

The good ol’ monkey typewriter problem

limber sentinel
#

Can someone teach me code

lament rock
#

process.exit()

#

that's all the code you need

limber sentinel
#

Bot commands

wheat mesa
limber sentinel
#

Ok

wheat mesa
#

Damn, this is using a shitty replit server while I’m at school as well

#

11 million iterations in 4.3 seconds

#

Impressive

#

Ironically creating the threads probably ends up taking longer than iterating itself

simple stump
#

Is it possible to get the response to a Google Form?

limber sentinel
#

Yes if they were not busy

#

I’m bot dev too!

boreal iron
spark flint
#

wtf

#

i need to make my bot ultra moderated

vivid fulcrum
#

omg a moderation bot

#

how original

vivid fulcrum
#

how did you manage to come up with that idea

earnest phoenix
spark flint
#

i mean yes i have a moderation bot but its not designed entirely for user moderation

#

its an automod focussed on stopping known bad eggs KEKW

#

adapt, improvise, overcome

jovial nexus
#

Hello.
Im running a nodejs discord bot in a docker contaniner, but it needs a .env file for getting the token, etc... Im using the dotenv npm, but when running docker run bot:latest --env-file .env it doesnt detect the .env file. (The .env file is outside the contaniner, i dont want to create the container with the bot secrets inside)

#

The Dockerfile looks like this: dockerfile WORKDIR / COPY package*.json ./ RUN npm install --silent COPY . . RUN npm run build ENTRYPOINT ["npm", "run", "start"]

#

And npm run start is just node dist/main.js

spark flint
#

how can i get this gray bg to fit to screen with the m-3 already set

#

using tailwind

simple stump
#

Does djs have a feature that bans a person for a certain amount of time instead of permanently (asking for a friend)?

spark flint
#

softbanning exists

#

ban --> unban

#

instead do