#development

1 messages · Page 1930 of 1

boreal iron
#

If you've included the discordjs package already

#

const discord = require("discord.js");
let something = new discord.collection();

earnest phoenix
#

read the error

#

Got it now lol

earnest phoenix
#

I'm learning!! Ayo @solemn latch (ik ur a mod and you don't like pings), but I have been striggling with Slash Commands for the longest time, this fr helped me out SOO MUCH! Your awesome.

solemn latch
#

pog, np.
lmk if you need more help

#

(not dms though, angeryBOYE )

boreal iron
#

opening a DM with Woo

earnest phoenix
solemn latch
#

just not for dev help 😄

boreal iron
#

Booooring... just doing things I'm not allowed to

fresh bluff
#

Time to create a new discord bot today!

split hazel
#

nice

sudden geyser
#

What theme?

split hazel
fresh bluff
sudden geyser
#

ah

#

I recently picked up making bots again

fresh bluff
#

Im thinking a Bot that can play games

#

if not i'm going to think of more themes

split hazel
#

among us imposter theme

wheat mesa
#

:C

split hazel
fresh bluff
#

@sudden geyser I know what Theme Im doing

#

Klay Im doing a YouTube Notification bot

#

for my servers YouTube channel

sudden geyser
#

Are you sure you want to do that? There are many bots that offer that feature already.

fresh bluff
solemn latch
#

Should be relatively straightforward to create

wicked pivot
#
Object.values(StatsTop).map(r => {
DateChart.push(moment(r.date).format('YYYY/MM/DD'))
VocalChart.push(r.voice)
})

var configuration = {
            type: 'line',
            data:{
                labels: DateChart,
                datasets: [
                    {
                        label: "Vocal Hour",
                        data: VocalChart,
                        backgroundColor: '#dc143c'
                    }
                ]
            }
        }```
fresh bluff
#

@sudden geyser Nvm my bot won't turn on gotta scrap this on

sudden geyser
#

That just means you have to try harder

#

Improvise. Adapt. Overcome!

fresh bluff
#

WAIT

#

WAIT

#

I FOUND SOMETHING I MISSED

#

Hey guys I got this error how do i fix it?

boreal iron
#

You're missing the start script in your package json file

fresh bluff
boreal iron
boreal iron
#

You should always use npm init -y to initialize a new project.

#

That will create a package json for you

fresh bluff
#

Know what Ima go Use my Other bot for music while i code my other bot

boreal iron
earnest phoenix
#

are you coding multiple bots at once

fresh bluff
#

I'm working on a 2nd bot

fresh bluff
#

YES ITS WORKING

earnest phoenix
#

there's bots that are amazing at one thing
multi purpose bots that are mediocre at everything
and then there is you
with both of them

fresh bluff
#

Yes

#

lol i typed dubstep wrong

#

it still knew what song i wanted

#

forgot i need to sign back into github

jovial vapor
#

Just wondering. Would a /lastseen or !lastseen command that displays the time when a user sent a message last/was last online?

wheat mesa
#

is that a question..?

rigid shadow
#

I mean there is clearly a question mark, but I don't get the question tho 😅

lyric mountain
#

ig he forgor the question terminator

#

like "Would X be useful?" instead of "Would X?"

sudden geyser
#

I meant adding the details to a more general command (/user info, which displays other stuff)

#

which could include the last time they were seen?

#

it is user information after all

jovial vapor
grim aspen
#

I used to have that for my bot until discordjs fucked mentions

sudden geyser
#

It's not baked into the API, but certainly possible.

jovial vapor
#

Noted. Thanks!

idle coral
#

Heya, how would I import clean_code. It says it isn't a module.

sudden geyser
#

A file by that name probably doesn't exist or its path is wrong

earnest phoenix
#

and then there is you
bad at both

sudden geyser
#

jack of all trades, master of none

blazing jackal
#

Ppp

proven lantern
#

i have a configuration like this for my slash command

  "name": "config",
  "description": "Customize.",
  "options": [
    {
      "name": "server",
      "type": 2,
      "description": "Customize server.",
      "options": [
        {
          "name": "matchmaking",
          "type": 1,
          "description": "Customize matchmaking for you server.",
          "options": [
            {
              "name": "visibility",
              "description": "Matchmaking Visibility.",
              "type": 3,
              "choices": [
                {
                  "name": "Public (Default)",
                  "value": "public"
                },
                {
                  "name": "Private",
                  "value": "private"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}```

The options come in looking like this ```{
    "options": [
      {
        "name": "server",
        "options": [
          {
            "name": "matchmaking",
            "options": [
              {
                "name": "visibility",
                "type": 3,
                "value": "public"
              }
            ],
            "type": 1
          }
        ],
        "type": 2
      }
    ],
}```

but all i care about is ```{
  "options": [
    {
      "name": "visibility",
      "type": 3,
      "value": "public"
    }
  ]
}```

If i refactor the group names then the options change making my code coupled to the group and subgroups. is there a good way to get around this? i was thinking about writing a marshaler that dynamically traversers the options and finds the actual options. any other ideas?
lavish dove
#
import java.io.IOException;
import java.util.Scanner;

public class AppPilotos {
    public static void main(String[] args) throws InterruptedException, IOException {
        final int MAX_ELEMENTOS = 20;
        int opcao, qtdCadastrados = 0;
        String[] pilotos = new String[MAX_ELEMENTOS];
        Scanner in = new Scanner(System.in);
        int x;
        String nome;
        int cpf;
        int localCPF;

        do {
            System.out.println("\n****\nMENU\n****\n");
            System.out.println("1 - Cadastrar piloto");
            System.out.println("2 - Listar pilotos cadastrados");
            System.out.println("3 - Localizar piloto pelo CPF");
            System.out.println("4 - Aumentar espaço de armazenamento");
            System.out.println("0 - Sair");
            System.out.print("Opção: ");

            opcao = in.nextInt();
            in.nextLine(); // Tira o ENTER que ficou na entrada na instrução anterior

            if (opcao == 1) {
                // Se não tem mais espaço no vetor, caio fora
                if (qtdCadastrados == MAX_ELEMENTOS) {
                    System.out.println("\nNão há espaço para cadastrar novos pilotos.");
                    voltarMenu(in);
                    continue;
                }

                //Cadastre seu piloto aqui
                if (qtdCadastrados < MAX_ELEMENTOS) {
                    System.out.println("\nQual o nome do Piloto: ");
                    nome = in.nextLine();
                    cpf = qtdCadastrados;
                    pilotos[qtdCadastrados] = nome + qtdCadastrados;
                    System.out.println( "\nNome: " + nome +"\nCPF: "+ cpf);
                    
                    qtdCadastrados = qtdCadastrados + 1;
                }

                System.out.println("\nPiloto cadastrado com sucesso.");
                voltarMenu(in);```
#
                // Se não tem ninguém cadastrado no vetor, caio fora
                if (qtdCadastrados == 0) {
                    System.out.println("\nNão há motoristas cadastrados para exibir.");
                    voltarMenu(in);
                    continue;
                }
                if (qtdCadastrados > 0) {
                // Exiba os pilotos aqui
                System.out.println("\n   Pilotos cadastrados   \n");
                for(int posicaoPiloto = 0; posicaoPiloto < qtdCadastrados; posicaoPiloto++){
                    System.out.println(pilotos[posicaoPiloto] + " - CPF: " + posicaoPiloto);

                }
            }
                voltarMenu(in);
            } else if (opcao == 3) {
                if (qtdCadastrados == 0) {
                    
                    System.out.println("\nNão há pilotos para serem localizados.");
                    voltarMenu(in);
                }                
                
                if (qtdCadastrados > 0){

                    System.out.println("\nQual o CPF do piloto: ");
                    localCPF = sc4.nextInt();
                    System.out.println("\nPiloto com o CPF " + localCPF + " é o: " + pilotos[localCPF]);

                }
                voltarMenu(in);
            } else if (opcao == 4) {
                System.out.println("\nQual sera o novo tamanho do armazenamento: ");
                x = in.nextInt();
                String[] pilotos2 = new String[x];
                System.arraycopy(pilotos, 0, pilotos2, 0, qtdCadastrados);

                System.out.print("\nArmazenamento aumentado!");
                voltarMenu(in);
                continue;
            }
            else if (opcao != 0) {
                System.out.println("\nOpção inválida!");
            }
        } while (opcao != 0);

        System.out.println("Fim do programa!");

        in.close();
    }```
#


    private static void voltarMenu(Scanner in) throws InterruptedException, IOException {
        System.out.println("\nPressione ENTER para voltar ao menu.");
        in.nextLine();

        // Limpa toda a tela, deixando novamente apenas o menu
        if (System.getProperty("os.name").contains("Windows"))
            new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
        else
            System.out.print("\033[H\033[2J");
        
        System.out.flush();
    }
}```
#

thats it

#

I'm having problems with the "pilots" array. Its limit is 20, and I have "option 4" which has the functionality to increase it, in this case I create a new array, copy the values ​​from the old one and put it in the new one. But apparently, the other options in the code do not use it, what should I do?

proven lantern
sudden geyser
#

It looks fine

#

I found the options structure limiting as well

#

So I made some functions to conveniently extract values

#

But it didn't rely on recursion like yours did

earnest phoenix
#

Can I make it so what a slash command can only be used by a specific number of users.

sudden geyser
#

Yours is probably better since subcommands and subcommand group options are quite static

proven lantern
proven lantern
#

i have another fix

sudden geyser
#

aw

earnest phoenix
#

How can I make a function when someone vote my bot ?

sudden geyser
#

Use the webhooks API

proven lantern
#

works

const x = {
    "options": [
        {
            "name": "server",
            "options": [
                {
                    "name": "matchmaking",
                    "options": [
                        {
                            "name": "visibility",
                            "type": 3,
                            "value": "public"
                        },
                        {
                            "name": "visibility",
                            "type": 3,
                            "value": "public"
                        }
                    ],
                    "type": 1
                }
            ],
            "type": 2
        }
    ]
}

const cleanOptions = options => {
    if (!options[0].options) {
        return options;
    }
    return cleanOptions(options[0].options);
};

console.log(cleanOptions([x]))

Broken version

const x = {
    "options": [
        {
            "name": "server",
            "options": [
                {
                    "name": "matchmaking",
                    "options": [
                        {
                            "name": "visibility",
                            "type": 3,
                            "value": "public"
                        },
                        {
                            "name": "visibility",
                            "type": 3,
                            "value": "public"
                        }
                    ],
                    "type": 1
                }
            ],
            "type": 2
        }
    ]
}

const cleanOptions = options => {
    if (!options.options) {
        return options;
    }
    return cleanOptions(options.options[0]);
};

console.log(cleanOptions(x))
proven lantern
wheat mesa
#

ejs newbie here... For some reason CSS is not being applied on my page, when my head.ejs is as follows: ```html
<meta charset="UTF-8">
<title>WaffleBot</title>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../../styles/style.css">
<script src="../../src/index.js"></script>
and my `index.ejs` imports `head.ejs` ashtml
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); %>
</head>

<body>
<header>
<%- include('../partials/header'); %>
</header>

<main>
<div>
<h1>Test</h1>
<p>Test2</p>
</div>
</main>

<footer>
<%- include('../partials/footer'); %>
</footer>

</body>
</html>

#

as a basic test, my style.css is just ```css
body {
background-color: #343434;
margin: 0;
}

proven lantern
#

any errors in the network tab?

wheat mesa
#

yeah, I got a 404... Interesting

proven lantern
#

probably off by a directory

#

../../styles/style.css

#

maybe an absolute reference would be better

wheat mesa
#

Oh yeah you're right, I'm starting the program from a different directory haha

#

stupid relative paths

fresh bluff
#

well thats great my dashboard is experiencing 2 304'S

proven lantern
fresh bluff
#

now it has 6 304'S

#

Just Great

proven lantern
fresh bluff
#

is it bad that my bots dashboard is at 5000 MS!?!?!?!

wheat mesa
#

I've changed it to use absolute paths now, but the console is telling me localhost/:10 Not allowed to load local resource: file path

#

Is there something I'm missing here? Whenever I was using raw html/css I didn't ever have this problem

proven lantern
#

can you find the styles manually

#

like if you type it into the address bar

wheat mesa
#

wdym

#

It's a local CSS file on my pc

#

My project is structured like this, and I'm loading the CSS file the way I would normally do it. Although a big difference between what I normally do is that I'm using express now

#

I'm gonna take a break and come back to this later

sudden geyser
proven lantern
#

i added the full clean options function here

earnest phoenix
#

Welp, I'm back again.

#
const { SlashCommandBuilder } = require('@discordjs/builders');
const Discord = require('discord.js')
const wait = require('util').promisify(setTimeout);

const { Client, Intents, MessageActionRow, MessageButton, MessageEmbed, MessageSelectMenu } = require('discord.js');

const cool = new Client({
  intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});
const { r1 , r2 ,r3 ,r4 , r1m , r2m , r3m , r4m } = require('../config.json')

module.exports = {
    data: new SlashCommandBuilder()
        .setName('roles')
        .setDescription('Dropdown!'),
    async execute(interaction, message) {


    
      const rw = new MessageActionRow().addComponents(
        new MessageButton()
          .setCustomId("r1")
          .setLabel("Role 1")
          .setStyle("DANGER")
          .setEmoji(r1m),
        new MessageButton()
          .setCustomId("r2")
          .setLabel("Role 2")
          .setStyle("DANGER")
          .setEmoji(r2m),
        new MessageButton()
          .setCustomId("r3")
          .setLabel("Role 3")
          .setStyle("DANGER")
          .setEmoji(r3m),
        new MessageButton()
          .setCustomId("r4")
          .setLabel("Role 4")
          .setStyle("DANGER")
          .setEmoji(r4m),
      
      );
      const roles = new MessageEmbed()
        .setColor(`AQUA`)
        .setTitle(`Roles`)
        .setDescription(
          `Take your roles by clicking on the corresponding buttons!\n Click on them again to remove them!`
        );
      interaction.reply({ embeds: [roles], components: [rw] });
  }
}
cool.on("interactionCreate", async (interaction) => {
  if (interaction.isButton()) {
    if (interaction.customId == "r1") {
      if (interaction.member.roles.cache.some((role) => role.id == r1)) {
        interaction.reply({
          content: `The role <@&${r1}> was removed from you`,
          ephemeral: true,
        });
        interaction.member.roles.remove(r1);
      } else {
        interaction.member.roles.add(r1);
        await interaction.reply({
          content: `The role <@&${r1}> was added to you`,
          ephemeral: true,
        });
      }
    } else if (interaction.customId == "r2") {
      if (interaction.member.roles.cache.some((role) => role.id == r2)) {
        interaction.reply({
          content: `The role <@&${r2}> was removed from you!`,
          ephemeral: true,
        });
        interaction.member.roles.remove(r2);
      } else {
        interaction.member.roles.add(r2);
        await interaction.reply({
          content: `The role <@&${r2}> was added to you!`,
          ephemeral: true,
        });
      }
    } else if (interaction.customId == "r3") {
      if (interaction.member.roles.cache.some((role) => role.id == r3)) {
        interaction.reply({
          content: `The role <@&${r3}> was removed from you!`,
          ephemeral: true,
        });
        interaction.member.roles.remove(r3);
      } else {
        interaction.member.roles.add(r3);
        await interaction.reply({
          content: `The role <@&${r3}> was added to you!`,
          ephemeral: true,
        });
      }
    } else if (interaction.customId == "r4") {
      if (interaction.member.roles.cache.some((role) => role.id == r4)) {
        interaction.reply({
          content: `The role <@&${r4}> was removed from you!`,
          ephemeral: true,
        });
        interaction.member.roles.remove(r4);
      } else {
        interaction.member.roles.add(r4);
        await interaction.reply({
          content: `The role <@&${r4}> was added to you!`,
          ephemeral: true,
        });
      }
    } 
  }
})```
#

No error in logs, just this interaction failed

sudden geyser
# proven lantern ```js const x = [ { "name": "visibility", "type": 3, ...

I was thinking more like this:

function re(data) {
  // Implementation is probably broken
  data.options &&= Object.keys(data.options).forEach((k) => {
    data[k] = re(data[k]);
  });

  return data;
}

It doesn't extract the options like you originally wanted, but it does make working with options much simpler (data.options.server.options.matchmaking.options.visibility.value vs. using .find).

earnest phoenix
#

@solemn latch ^ You said to lyk if I needed anymore help :)

solemn latch
#

Try adding an interaction reply after the last ID if statement

earnest phoenix
#

What would it reply to?

solemn latch
#

Doesn't matter tbh, just checking if it's an if statement issue

earnest phoenix
#

So like

#
 } else {
        interaction.member.roles.add(r4);
        await interaction.reply({
          content: `The role <@&${r4}> was added to you!`,
          ephemeral: true,
        });
        interaction.reply({ content: `Testing123`, ephemeral: true, })

#

?

#

At the way end?

#

If so, it didn't send "testing123"

#

Just did the same thing. o-o

solemn latch
#

I think you need to go a few lines down with it

#

I cant tell, after the if statement not in it.

earnest phoenix
#

Moved it to after } else if (interaction.customId == "r4") { Like after the } one

#

Did not send the reply.

solemn latch
#

Ok yeah, something strange then that I don't know about.
Try console logging in that spot instead to see if the codes even getting that far

#

If not put the log near the top, maybe inside the isButton if

#

Anyway I need to sleep. Gl

earnest phoenix
#

I did that

 await interaction.reply({
          content: `The role <@&${r3}> was added to you!`,
          ephemeral: true,
        });
      }
            console.log(`Test`)

    } else if (interaction.customId == "r4") {
      if (interaction.member.roles.cache.some((role) => role.id == r4)) {
        interaction.reply({
          content: `The role <@&${r4}> was removed from you!`,
          ephemeral: true,```
#

Didn't log anything.

earnest phoenix
#

Its because my module exports {}'s

#

Were at the top

#

and not at the bottom...

#

So it cut off all of the bottom

#
  });
      }}
  })```
I must be missing a few things there
#

I've been getting that for like 10 minutes now

#

🤣

#

Then it goes to this

#

So its back and forth

#

GOT IT

#

oml

#

Nope

spark flint
#

why code when you can just cry

earnest phoenix
spark flint
earnest phoenix
#

Figured it out, nothing after cool.on("interactionCreate", async (interaction) => { works for some reason....

#

Still doesn't work after that Thinking

quartz kindle
earnest phoenix
#

Wym login?

#

Its a command file.

quartz kindle
#

you are creating a new client

earnest phoenix
#

Oh?

quartz kindle
earnest phoenix
#

Oh yeah, lemme just yoink that out of there

#

Now its just this:

#
DiscordAPIError: Unknown interaction```
#

Wait nvm

#

Got it

#

:)

#

I think

#

Nope, still "Unknown Interaction"

#

What exactly is going on?

boreal iron
#

Well your interaction has already been expired

#

You will have to defer it if your response takes more than 3s

#

Which is the lifetime of each interaction by default

snow urchin
ripe prairie
sudden geyser
#

Either <:NAME:ID> or <a:NAME:ID>

ripe prairie
#

check previous message author id, if equals to new message author id, delete message

#

or if you're somehow unable to check prev message data, store previous user ID in memory or db or something

#

then compare

#

that's how i'd do it but im not the best coder so

earnest phoenix
#

Okay so my server just got raided, all members are there. But I need to figure out how to make a command that can delete channels that has hail in it. How might I do that?

#

There are over 200 hail-sumthin channels

#

Proof:

ripe prairie
#

if channel name has text "heil" in it, delete channel

#

and make it iterative by grabbing all the channels in the guild

#

then running through all of them

earnest phoenix
#
channel.delete()
}```
?
ripe prairie
#

if it's js i can't really help with the code unfortunately

#

not very familiar with it

earnest phoenix
#

Oh lol

#

Yeah its js

ripe prairie
#

at least in python it'd go something like

for channels in guild:
if "heil" in channel.name:
delete channel

#

or since you know what the channel names are, you could even see if the channel name starts with "heil"

earnest phoenix
quartz kindle
#

who the fuck doesnt put spaces around &&

earnest phoenix
#

who the fuck uses single quote for strings

quartz kindle
#

well that too, but the && is much worse

#

criminal offense

earnest phoenix
#

agreed

#

link has a code formatter github action that changes my strings to single quote

quartz kindle
#

lmao

#

thats not better

#

thats luca

earnest phoenix
#

@marble juniper delete action or -3000000 social credit

earnest phoenix
#

it deletes all semicolons

marble juniper
#

which is why I have the action

#

so it all stays in the code style I want it to be

sudden geyser
marble juniper
#

master of the amount of js libs though

marble juniper
#

cuz semi colons are useless in javascript

#

and only add extra bytes

#

the only real use case I can think of for semicolons is

#
;(async () => {
		// stuff
})()
tired panther
#

Lol

lament rock
#

some for statements require ;

#

one line multi expressions requires use of ;

split hazel
#

how would for statements work without them?

#

there are also cases where the automatic insertion does a bad job and breaks the code

earnest phoenix
feral aspen
earnest phoenix
#

So does anyone know any bot that can show leaderboard ranks in real time

#

Like xp ranks

hybrid cargo
#

.catch()

#

well it shouldnt if u handle it properly

#

then the process should not end, unless your are catching at the wrong promise

#

U could just listen for unhandledRejection and uncaughtException from the process to eliminate all the possible causes for the process being stopped. But even with that its better to find where the errors are originating and actually handling them

tulip ledge
#

1 thing bots should never need the administrator role

#

if the message doesnt send nor the catch it prob means that your if statement is false

hybrid cargo
#

what is your error in the console?

tulip ledge
#

that's the catch block tho

hybrid cargo
#

well you are console logging the error so its showing you the error

peak island
#

how to thread message move to other channel or thread??

marble juniper
#

if ur an await spammer its pretty useful

feral aspen
earnest phoenix
#

by code example you mean spoonfeed you

#

just put another iife there ¯\_(ツ)_/¯

lyric mountain
#

in a db or in a table?

plucky sail
#

How can I print a webhook from the top.gg api on how many servers the bot is on | djs

lyric mountain
#

SELECT count(1) FROM table

lyric mountain
#

top.gg webhook is exclusively related to votes

#

you want to upload the server count?

plucky sail
lyric mountain
#

what language?

plucky sail
#

discord.js

lyric mountain
plucky sail
lyric mountain
#

you can't

#

webhooks are sent by top.gg (or any other service), not by you

earnest phoenix
#

or by discord

lyric mountain
#

discord doesn't send webhooks tho

#

although they do receive it

plucky sail
#

So how to write another bot on how many servers?

earnest phoenix
earnest phoenix
#

what will you need a second bot for

lyric mountain
plucky sail
earnest phoenix
lyric mountain
#

( ̄﹏ ̄;) it's not like I forgot about interactions or anything

earnest phoenix
#

( ´ ▽ ` ) for sure

bold lion
earnest phoenix
#

step 2: migrate to hikari

#

step 3: delete python

#

step 4: let things that depend on python break

#

this

quartz kindle
#

isnt there a third party library that adds buttons to discord.py?

earnest phoenix
#

There's like a ton: discord-buttons, buttons, discord-buttons-plugin, discord-components, discord-py-buttons

#

The first one seems to be outdated

lyric mountain
#

pagination-utils mmLol

spark flint
bold lion
spark flint
#

if you join their server, they have a slash command which returns a code snippit

mystic raven
#

Hello! My main scripting language is python. Which app do you recommend for python language. In replit i have to go back to website each 2 hours to re run bot since it goes offline. This is very annoying

bold lion
mystic raven
bold lion
bold lion
#

And click on the secrets icon

mystic raven
#

wait

#

like this?

#

a sec

#

still dont understand

#

;-;

bold lion
#

Add a secret under the lock icon named “DISCORD_BOT_SECRET” with its value being your bots token

#

Use flask and threading to create a basic app

#

create a route for the app

#

Like this:

#

@eternal girder.route(‘/‘)

#

And then run it through app.run

spark flint
#

@mystic raven add from flask import Flask to the top

#

then add app = Flask(__name__) underneath that

#

then ```py
@app.route("/")
def ping():
return "I'm alive!"

app.run("0.0.0.0")```

mystic raven
spark flint
#
write inside ```
mystic raven
#

ok

spark flint
#

yeah

earnest phoenix
#
DiscordAPIError: Invalid Form Body
embeds[0].description: This field is required
    at RequestHandler.execute (/home/runner/Hype-4/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/runner/Hype-4/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
    at async TextChannel.send (/home/runner/Hype-4/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:15)
    at async paginationxd (/home/runner/Hype-4/commands/Owner/servers-list.js:93:26) 
quartz kindle
#

show servers-list.js

wheat mesa
#

I’m assuming that you didn’t provide at least one of those

spark flint
#

alr i need help

#

i have the array "todos":[{"todoId":788,"title":"test","content":"big bun is testing this"}]

#

how to i get each todo item to be

<p><b>test</b></p>
<p>big bun is testing this</p><br>```
spark flint
#

python btw ^^

spark flint
#

its for an email

#

thats it so far

earnest phoenix
#

doesn't python have array map

#

ofc it doesn't

spark flint
#

idk how i'm gonna work this

earnest phoenix
#

for loop?

spark flint
#

i mean true

#

i managed to get it to grab the users email from the database and it gets the todos array

#
for todo in user["todos"]:```
earnest phoenix
#

put this in the non existent js to py convertor:

let msg = "";
for (const todo of todos) {
    msg += `${todoId} smth smth\n`;
}
spark flint
#
for todo in user["todos"]:
        todos = todos + f"<br><p><b>{todo['title']}</b> - {todo['content']}</p>"```
lyric mountain
#

baby shark baby shark todo todo todo todo

sick agate
#

how do i embed a raw c without making stuff like /// weird things

round cove
#

?

sick agate
#

just how do i make c treat some strings as raw string

boreal iron
#

c?

#

y?

#

k?

round cove
#
printf(R"My raw string");```
#

What are you using C for and not C++?

sick agate
#

C not C++

round cove
#

I know. I was asking why you were using C and not C++. What do you need raw string for?

#

Care to show?

sick agate
round cove
#

yeah not sure why you wouldn't use C++ for that. But show what you want to do with C I guess

plucky sail
#

How do I get the number of servers in the discord 0 perm invite link to the message?

plucky sail
#

What ?

lyric mountain
#

godzilla had a stroke

spark flint
#

yes

humble cliff
#

Is it unbearable?

plucky sail
#

No it has to be taken but I don't know how

wheat mesa
#

I’m so confused lmfao

spark flint
#

same

round cove
#

There's no reason to be rude about it.

lunar cove
#

votes on top.gg count double on weekends.
Is it true for servers too ?

lyric mountain
#

they don't double

#

it's just a convention bot owners use to incentive voting, so top.gg sends whether it's weekend or not

lunar cove
#

Ohh I saw this on @Mac#8888 's Pixxiebot docs. It might be the bot's feature

lyric mountain
#

like "vote on weekends to get double credits" or whatever

#

but the actual vote is always 1

lunar cove
#

thanks for info !!!!!

lyric mountain
#

yw

simple stump
#

Is it just me or does joining a voice channel on mobile register voiceStateUpdate multiple times?

#

Cause I added a logging feature to my bot (or something even though I added a return statement when an user leaves) it ends up crashing and throwing the error, “User isn’t connected to a voice.”

wheat jolt
#

there was a bug some time ago related to this

slender wagon
#

do we have any rule against webscraping?

wheat jolt
#

no?

slender wagon
#

https://bscscan.com/txs
i am starting out a project and it is required for me to scrape from this site with a few filters using nodejs,
any recommendations

wheat jolt
wheat jolt
slender wagon
#

ik

wheat jolt
#

then

slender wagon
wheat jolt
#

it also depends on the programming language ur using

#

well

slender wagon
#

js

#

i just don't know which tool to go with

#

not cheerio cuz it has that jquery shit

wheat jolt
#

you don't even have to scrape

#

they have an api

earnest phoenix
earnest phoenix
#

is it a feature in py?

woeful pike
proven lantern
#

why is this denied?

#

it should allow everything

#

aws permissions are so confusing

split hazel
#

it took me 20 minutes one time to get a cloud function working

round cove
solemn latch
round cove
#

yeah lol

solemn latch
#

lmao

round cove
wheat mesa
quartz kindle
#

@_@

solemn latch
#

Fastest math method

boreal iron
#

meth

quartz kindle
#

moth

boreal iron
sudden geyser
#

bath

quartz kindle
#

depends, what for? whats your target audience?
you can support both at once, its a bit of a hassle but everyone will be happy
es6 if you are looking forward to future standards and dont mind losing potential users
commonjs if you want simple, plug and play, easy to use

#

es6 users can use commonjs, with a few restrictions

#

commonjs users cannot use es6 directly, they must use async imports

lament rock
#

I just write everything in cjs

#

directly supporting esm is a hassle

quartz kindle
#

same

#

you can support both by adding an esm layer

#

just for getting named exports to work in es6

#

its just a file that imports everything, then exports it again the es6 way

lament rock
#

jank

quartz kindle
#

people are pushing es6 mostly because of browsers

#

for node its pretty irrelevant

lament rock
#

TypeScript preferring export default is really annoying even though it'll be transpiling down to cjs anyways

#

I don't understand the use case of export default anyways since it's just taking up another index signature which is useless

quartz kindle
#

its likely for backwards compatibility with cjs's module.exports = something

lament rock
#

but you can already define export =

#

Don't have to export const thing

quartz kindle
#

best of both worlds i guess?

lament rock
#

Still doesn't make sense to me because if they wanted to access a constructor or a function and also other members, they can assign static members to the function

quartz kindle
#

someone probably just went "what if i want to do (insert dumb practice here)? i could do it before, now i cant anymore?"
and they went "sigh... fine lets add this as well so you can keep doing it your way"

lament rock
#

I don't feel sympathy towards dumb practices

quartz kindle
#

i do because i did them a lot

#

and really, a LOT

#

did i already tell you about the good old times where i would eval(fs.readFileSync()) instead of require()?

#

:^)

lament rock
#

I mean. If you do that for memes, sure

quartz kindle
#

i did it seriously

sterile lantern
#

"I might be BASEd but I just don’t like ROTting bananas"

dWdnY2Y6Ly90bG5tYi5wYnovczYwOW5xMnBycm81N3M3c3I0NTY4NjFxcTY5NDBwczI (don't worry this isnt some random token, its something encoded)

is anyone good at decoding things, if so, can anyone decode the above string? there's a hint above "BASE" and "ROT" but i have no clue 💀

slim heart
#

isn’t that basically what require does

quartz kindle
#

in one of the first iterations of my bot

lament rock
#

Well. That is a thing that exists I guess. Not great and obviously shit code, but good meme

slim heart
#

atleast according to native toString() code iirc

lament rock
#

idk how Module._compile works

#

probably routes through similar methods

quartz kindle
sterile lantern
#

oh

#

it's base64

#

hmm i got this from it

#

uggcf://tlnmb.pbz/s609nq2prro57s7sr456861qq6940ps2

quartz kindle
#

now decode with rot13

#

and you get https://gyazo.com/f609ad2ceeb57f7fe456861dd6940cf2

sterile lantern
#

o

#

ty

ripe prairie
#

ye ol' tim

quartz kindle
#

ye im ol tim

#

as in old

lyric mountain
#

and tim as in timotei

elder jewel
#

guild.get_members()
Seems to be wrong? Any reason why

#

Ping me

ripe prairie
#

@elder jewel are you using d.py

lament rock
#

Invites and guild displays are approximates

#

The raw data from Discord event has approximate_*_count fields

ripe prairie
#

well rather they're whatever value got cached when the invite embed was created iirc

lament rock
#

That's why they're approximates

#

It's almost never correct if the target guild experiences a lot of joins and leaves

elder jewel
ripe prairie
#

yea the one the bot fetches is more accurate iirc

#

explanation right above

elder jewel
#

okay

proven lantern
#

why is this so small?

austere scaffold
sudden geyser
#

they're probably just wondering why it's so low

#

lot of app names out there longer than 20 characters

wheat mesa
#

Anybody know how to see how many lines a file has when it doesn't allow you to scroll because it's so big

sudden geyser
#

wc -l <filename>

wheat mesa
#

Is that for linux?

#

My windows doesn't recognize that

sudden geyser
#

yuh

wheat mesa
#

Any way to do it on windows that you know of

sudden geyser
#

How about find /c /v "" <filename>

#

I don't use Windows myself but most answers are one search away

wheat mesa
#

Doesn't seem to work

#

Maybe I should just calculate based on filesize

#

Anyone know how much space each character takes in a .py file?

woeful pike
#

depends on the implementation

wheat mesa
#

Got it

wheat mesa
#

Ok so this is the final result (had to stop the program since it was taking too long)

#

That goes on and on and on

#

Had to count the lines with powershell

#

188 million is nice

#

Rust is a sick language

lament rock
#

You can stream the file and count how many new line characters there are

wheat mesa
#

Sounds like a hassle considering the file is 7gb

#

Plus I already got the line count now so it’s good

lament rock
#

That's most likely whatever you're using does.

Streaming doesn't matter what size the file is. You would analyze each chunk of data and then evict the chunk from memory once you're done with it. Memory usage never gets too high unless you retain chunks in memory

wheat mesa
#

Fair

#

I just used whatever powershell command I found on google after struggling to open it for a while

#

Didn’t feel like writing code for it

#

“The lazy man’s solution”

royal pawn
#

How to make cooldown command as UTC time zone in discord.py? [Not user cooldown]

#

And the error as Hours, Minutes and Seconds

obtuse timber
#

someone know how to install packages in offline apps

somber glacier
somber glacier
obtuse timber
#

but how will ai do

somber glacier
#

Don’t have a clue about decoder

#

Dcoder

#

I know it’s an app.

#

But I haven’t used it before.

obtuse timber
#

ok just coz the console isn't doing any imports I will try on VS code

vestal gate
solemn jolt
#

why i'm always get this error when i wanna push a code in vc code to github

small tangle
#

i'd censcor your mail, but apart from that i mean it literally says "no secret key"

#

is this repo private?

solemn jolt
#

yes

small tangle
#

then you need to authenticate to interact with it

solemn jolt
#

how

small tangle
#

normally it was username and passwod but if iirc the turned off password authentication, so you need a secret key

solemn jolt
#

i have a secret key but i dont know how to do it

small tangle
#

@solemn jolt ping

earnest phoenix
#

hi

delicate zephyr
#

have you checked the discord developer docs?

#

cause uh

#

it's right there

gentle condor
#

hello,i've made a command and in that command i've added buttons through discord-components and when i click the button my bot is supposed to edit the last message but when i click on it the bot edits the message but i get this message "this interaction failed",can someone help?

#

ty so much

#

lmao

#

i tried not working

delicate zephyr
#

no, because it's part of the member object

#

What library are you using

#

@carmine topaz ^^

#

you know

#

there ya go

#

just check the after object and before object

#

@carmine topaz

#

np

spark flint
#

alr so

#

i have a file called click.js

#

which has the function in for the onclick event

#

how do i send an api request on click?

spark flint
#

ok i tried

#

it failed

earnest phoenix
#

nice

quartz kindle
#

xhr or fetch

earnest phoenix
#

jquery

errant flax
#
await schema.findOneAndUpdate({
                userId: msg.author.id
            },{
                $addToSet: {
                    (type2==="selling" ? "selling" : "buying"): text
                }
            })
#

am i not allowed to do some comparing stuff inside a ()?

sacred aurora
errant flax
#

doesnt that means ur creating an array weirdsip

sacred aurora
#

and a key iirc

#

in an object

errant flax
#

ill try?

#

ig

sacred aurora
#

sure

boreal iron
#

wtf is that syntax

errant flax
#

idk i havent been coding in js for a while now zoomeyes

boreal iron
#

Shorthand statements:
(condition) ? yes : no;
((condition) ? yes : no);

errant flax
#

so i just have to enclose the condition with () and that should fix the error weirdsip

sacred aurora
boreal iron
#

You’ve got another :text behind which doesn’t make any sense at all

errant flax
#

im declaring a key in an object so i can just use

{
"something": text
}
sacred aurora
errant flax
sacred aurora
#

you can use [] for dynamic key

boreal iron
#

I know what he’s doing but still shorthand statements doesn’t support an else if structure means your syntax is wrong

sacred aurora
errant flax
#

ye it works now thx

boreal iron
#

And yes if you define a dynamic key then wrap it in brackets

#

Still an horrible form but it’s your code

acoustic whale
#

am i correct in assuming bots need to be in over 100 servers to get this button and i cannot create by own buttons there?

wheat mesa
#

You can enable that button in your bot’s dashboard

acoustic whale
#

I'm thinking about placing a web panel link somewhere

pale vessel
#

under OAuth

#

make sure to use in app

#

it could boost your server count

acoustic whale
spark flint
#

no

#

only add to server

acoustic whale
#

ok

simple stump
#

I’m trying to attach a file to a message, but for some reason the file isn’t getting sent. All that IS sent is “log.txt”. The log.txt file is in the same directory as the index.js file.
Code:
https://sourceb.in/mNNguki3E5

high crown
#

U will find it in the dev portal

crystal wigeon
#

hi umm

#

const reactionCollector = marketList.createReactionCollector({ filter, time: 30_000, });

#

dos this not work at all now???

#

it used to work before. and i see no events being fired on collector.on("collect")

delicate zephyr
#

you know that ../ means one directory up and ./ means same dir

crystal wigeon
#
                    if (totalPages <= 1) marketList.react(bin);
                    else {
                        marketList.react(backward);
                        marketList.react(forward);
                        marketList.react(bin);
                    }
                    const reactionCollector = marketList.createReactionCollector(filter, { time: 30_000, });
                    reactionCollector.on("collect", async (reaction) => {```

Help. This worked before but the collector is no longer working
simple stump
earnest phoenix
#

and not 30_000 its 30000

crystal wigeon
earnest phoenix
#

https://throwbin.io/OyYHP2o
Help me with this Err_require_esm
Error and code is shared in throwbin

solemn jolt
small tangle
#

GGD_uwu ofc

quartz kindle
boreal iron
#

Just use version 2.5.x

#

Change the ^ into a ~ in your package.json for node-fetch to prevent updates to version 3

warm sinew
#

People who owns this business here?

slender thistle
#

No

surreal sage
#

i think you can see the issue here

#

there is scroll room while there isn't supposed to be

#

100vh counts without top bar

woeful pike
#

safari is eternally cursed with the 100vh height bug

surreal sage
#

this is chrime

#

Chrome

#

i was thinking about it scrolling to the middle of the page

#

and locks it in there

#

so its like this

woeful pike
#

is it not ios?

surreal sage
#

android

woeful pike
#

oh

surreal sage
#

lol

boreal iron
#

Make sure html, and body both have 100% height

#

No padding or margin

#

Or do you speak about the button?

earnest phoenix
#

Is it possible to make it so only a role can use a specific slash command? {v13 ofc}

sudden geyser
earnest phoenix
#

Okay.

#
if (interaction.user.roles.cache.has('914989881804062741')) {}

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

lyric mountain
#

user cant have roles

earnest phoenix
#

How do I fetch if they have a role?

sudden geyser
#

get them as a member (interaction.member?)

earnest phoenix
#

I had that, then I changed it whyGod

#
if (interaction.member.roles.has('914989881804062741')) {}

TypeError: interaction.member.roles.has is not a function

#

cache

#

one sec

sudden geyser
#

You changed it again!

#

From roles.cache.has to roles.has

boreal iron
#

Oh lol

#

didn’t see the scroll bar

earnest phoenix
sudden geyser
#

elephants are cool

boreal iron
#

I don’t get the question.
The benefits compared to what? Trees?

earnest phoenix
#

compared to just normal html

boreal iron
#

lol

#

I didn’t know HTML is a program language.

#

I’m about to learn something new every day in here

earnest phoenix
#

wait from what I was told php is basically just html is this wrong?

boreal iron
#

Try to do something dynamic in HTML freerealestate

earnest phoenix
#

So ima not ask that person questions about web dev again mmLol

boreal iron
#

Better not, yeah

#

It must be genius

earnest phoenix
#

so can you tell me what php is then. Since I was told entirely wrong

boreal iron
#

I can tell you pretty much the same thing written down if you search for what PHP is or you gonna google it yourself freerealestate

#

It’s mostly used for web programming including anything associated like backends etc.

#

That’s what I would add to the general description you can find in the ‘net

earnest phoenix
#

I see

#

so it essentially makes connecting the frontend to the backend easier?

#

that is my takeaway from reading online and what you wrote

boreal iron
#

Well that’s a very simply explanation but yeah

#

HTML is just a markup language as name says only being able to display static content

earnest phoenix
#

I see

#

while php can take stuff from the backend and display it easier right?

vague swallow
#

Hey guys, do you know if there's a way to download a log of when people joined the server?

sudden geyser
#

Discord gives your bot that information

#

But I doubt they'd like you doing that

wheat mesa
#

they don't like persistent data storage

boreal iron
#

It doesn’t display things "easier" it is the fundation to generate dynamic content

spark flint
#

Stackoverflow has let me down and none of that code works

sudden geyser
spark flint
#

Not a fork

#

I’m migrating soon I promise lol

spark flint
#

Tried tha

#

Didn’t work

sudden geyser
#

can you show what you tried

spark flint
#

In bed atm so can’t get my code

drifting wedge
#

how do i add ratelimits to quart/flask ping me pls

earnest phoenix
earnest phoenix
#

I want a code of discord.js that return the link of the first website in search result

Plz help me

solemn latch
#

In search on what?

raw nest
#

How can I access an image from localhost? I have an express server on my server and I just do res.sendFile(path). Now since I have my express app set to localhost only I can't access it anymore through http://localhost:3001/path/to/the/image. It worked with the IP instead of localhost but then the app is not on localhost only...

crystal wigeon
#
                    if (totalPages <= 1) marketList.react(bin);
                    else {
                        marketList.react(backward);
                        marketList.react(forward);
                        marketList.react(bin);
                    }
                    const reactionCollector = marketList.createReactionCollector({ filter, time: 30_000, });
                    reactionCollector.on("collect", async (reaction) => {```
The reaction collector isnt working at all. i tried putting logs in the filter as well but nothing happens
#

djs 13

earnest phoenix
gloomy glacier
#

Can anyone suggest a website design?

raw nest
earnest phoenix
crystal wigeon
#
            message.channel.send("fkin rat work pls work").then((msg) => {
                msg.react("👌");
                const collector = msg.createReactionCollector({ filter, time: 30_000 });
                collector.on("collect", r => console.log(`Collected ${r.emoji.name}`));
                collector.on("end", collected => console.log(`Collected ${collected.size} items`));
            });```

Im literally using the example they gave in the docs... still doesnt work wtf. i can see the message with the emoji in the channel but when i click on it nothing happens and after 30secs i can see the log in the "end" event
earnest phoenix
#

use a message button component

raw nest
earnest phoenix
#

link is available to everyone

#

try using fs to read the file

raw nest
#

via localhost it's not to everyone...

crystal wigeon
#

does this mean, collector doesnt work anymore?

earnest phoenix
#

that's exactly like updating discordjs

earnest phoenix
crystal wigeon
#

ik but this still exists no

#

why not?

#

just trying to figure out why the on collect eveny isnt being triggered

earnest phoenix
#

you can spam reactions

#

buttons can't be spammed

crystal wigeon
#

oof

#

thanks tho

#

appreciate it

earnest phoenix
#

and if you use something like detritus you can have a separate event handler for every button so you don't need to have a filter

crystal wigeon
#

got it

vague swallow
#

Anyone else know if there's a way to download a log of when people joined the server?

earnest phoenix
#

You can't really

spark flint
#

You can get when a user joined a server easily

slender thistle
#

Discord API provides that info in the member object iirc

vague swallow
spark flint
#

What language

loud ore
#

Anyone wants help in this project?

#

Discord api changes tracker

lyric mountain
#

hmm...but why?

#

like, there's already the changelog and discord blog

loud ore
#

When I need to ask someone about updates on server related to this future, easier is send one link then founding screenshots and trying describe this all times

#

Also discord provide data about it in many different places like: gh pr, ddevs q&a, stage-info channel, announcements on discord developers and discord townhall servers, blog posts

#

Many of futures also don't get all screenshots in descriptions and details how it works, but you can check this in canary client update

spark flint
vague swallow
spark flint
#

i mean coding language

vague swallow
#

Oh, I'm just a moderator on this server and I would like to reward the first 200 members that joined. But not sure how to get the log

lyric mountain
#

like, don't think making an app just for that is worth it

wheat mesa
earnest phoenix
wheat mesa
#

<Member>.joinedAt is a Date object, and <Member>.joinedAtTimestamp is a Unix timestamp

loud ore
#

ddevs events will be with transcriptions and summaries

lyric mountain
#

still

loud ore
#

This will be more user friendly when u send this for someone who don't use github that usually

lyric mountain
#

well, you do you

loud ore
jolly notch
#

MobX or Redux?
(Using react)

errant flax
jolly notch
woeful pike
#

doesn't really matter honestly use whatever you want

spark flint
#

how does colocation work

#

gonna be dumb here

delicate zephyr
# spark flint how does colocation work

basically it's renting space for your servers and other computing hardware at a third-party provider’s data center facility. Typically, colocation services include the building in which everything is housed, as well as networking, physical security, redundant power and redundant cooling components, which then support the servers and storage provided by the customer

spark flint
#

ah ok

#

i have a free year of colocation with github student

#

just wondered lol

delicate zephyr
#

lol

spark flint
#

its not the best plan ever

#

but its free and it works

boreal iron
#

disable your tracking oldEyes

delicate zephyr
spark flint
#

Basically yeah lol

boreal iron
#

the effort to colocate your hardware lol... just rent a cheap server, I guess that's better compared to what they offer you

boreal iron
#

compared to what they offer you

earnest phoenix
spark flint
#

True

#

But you can get it at any time

solemn jolt
#

hello i have a javascript website code and also i have a domain but i dont now how to run it

raw nest
#

I hope it's okay to post my problem with a stackoverflow link

simple stump
#

Would it be possible to register slash commands in the main file? I tried using a separate file to store the commands, but the commands don’t get registered/don’t exist.
Ex. Of what I mean:
https://sourceb.in/jN1p63plfp

boreal iron
#

404
Bin not found

earnest phoenix
#
const { SlashCommandBuilder } = require('@discordjs/builders');
const Discord = require('discord.js')
module.exports = {
    data: new SlashCommandBuilder()
        .setName('accepted')
        .setDescription('Send the Application for a User to apply for Staff!')    
    .addUserOption(option => option.setName('target').setDescription('Select a user')),
    async execute(interaction, message) {
if (interaction.member.roles.cache.has('914989881804062741')) {
            const user = interaction.options.getUser('target')

if(user) {
  const role = interaction.guild.roles.fetch('914989881804062741');
  user.roles.add(role);
const application = new Discord.MessageEmbed()
.setAuthor(interaction.guild.name + ` Welcome Aboard!`, interaction.guild.iconURL())
.setDescription(`:tada: Welcome to the **#Team Aspire** __Crew__, we are so excited to have you with us. With a concensus reached, we have decided to **__accept__** your application to be apart of our Staff Team! Welcome & Enjoy!`)
interaction.reply({ embeds: [application] })
}


   } else {
  const staff = new Discord.MessageEmbed()
.setAuthor(interaction.guild.name, interaction.guild.iconURL())
.setDescription(`You need to have the <@&914989881804062741> role. `)

  interaction.reply({ ephemeral: true, embeds: [staff] })
  }
}}```

> **`Error`** : TypeError: Cannot read properties of undefined (reading 'add')
lyric mountain
#

formatting said hello

#
const {SlashCommandBuilder} = require('@discordjs/builders');
const Discord = require('discord.js')
module.exports = {
    data: new SlashCommandBuilder()
        .setName('accepted')
        .setDescription('Send the Application for a User to apply for Staff!')
        .addUserOption(option => option.setName('target').setDescription('Select a user')),
    async execute(interaction, message) {
        if (interaction.member.roles.cache.has('914989881804062741')) {
            const user = interaction.options.getUser('target')

            if (user) {
                const role = interaction.guild.roles.fetch('914989881804062741');
                user.roles.add(role);
                const application = new Discord.MessageEmbed()
                    .setAuthor(interaction.guild.name + ` Welcome Aboard!`, interaction.guild.iconURL())
                    .setDescription(`:tada: Welcome to the **#Team Aspire** __Crew__, we are so excited to have you with us. With a concensus reached, we have decided to **__accept__** your application to be apart of our Staff Team! Welcome & Enjoy!`)
                interaction.reply({embeds: [application]})
            }
        } else {
            const staff = new Discord.MessageEmbed()
                .setAuthor(interaction.guild.name, interaction.guild.iconURL())
                .setDescription(`You need to have the <@&914989881804062741> role. `)

            interaction.reply({ephemeral: true, embeds: [staff]})
        }
    }
}
#

there, now it's readable

earnest phoenix
#

lmfao, ty. I actually just fixed my problem too^ So nvm 🤣

lyric mountain
#

ye, user cant have roles

earnest phoenix
#

they can

#

Which is why I defined it here ; const user = interaction.options.getUser('target')

#

It could be "goat" or "member" or "top_gg_says_users_can't_have_roles" but its jsut how you define it

lyric mountain
#

nope, users aren't bound to any guild, which mean they don't have any guild-related properties

#

what u want is const member = interaction.options.getMember('target');

lyric mountain
#

the one you have is getUser

#

unless u changed

earnest phoenix
#

Oh, I didn't even notice that just re-wrote it to getMember

lyric mountain
earnest phoenix
#

could you technically have a portable node environment

#

Say you load nodejs on a USB could it work?

lyric mountain
#

kinda

#

that'd basically be a rubberduck

earnest phoenix
#

hm

lyric mountain
#

🦆

proven lantern
#

Refactoring your bots slash commands into individual projects is a great idea.

earnest phoenix
#

Well yes you can it's just whether it's plausible to do so

#

At some point there could be issues most likely

#

You could probably setup your ide terminal to reference the node executable by just typing node

#

or maybe not idk

simple stump
#

Would it be possible to register slash commands in the main file? I tried using a separate file to store the commands, but the commands don’t get registered/don’t exist.
Ex. Of what I mean:
https://sourceb.in/uJqXkmox6r

earnest phoenix
#

The idea behind a portable node environment is you don't have access to change path variables I'd guess

earnest phoenix
#

I'd think of it as essentially making a modified command handler

#

where you register the necessary info, like the command name, options, etc and then on command call run the necessary code.

boreal iron
earnest phoenix
#

I suck at explaining but this is essentially how I did it

proven lantern
#

make your own handler directly against the api

boreal iron
#

Before doing that, fetch the already registered commands and make sure, NOT to register them over and over again on any restart

earnest phoenix
#

Yes good idea that can be troublesome

boreal iron
#

Unbelivable that trash they call a "guide"

proven lantern
#

look at how beautiful my command router is

earnest phoenix
#

It'd be better if it was java

lyric mountain
#

unless you plan on getting message intent, I advise not to use awaitMessage

lyric mountain
proven lantern
boreal iron
#

lol... Java and better in one sentence

proven lantern
#

better not

earnest phoenix
lyric mountain
boreal iron
earnest phoenix
#

fair point

boreal iron
#

comparing PHP to Java?

#

wtf is happening in that channel

lyric mountain
#

well, just check the message content

boreal iron
#

total escalation

earnest phoenix
#

I'm just messing with you fake

lyric mountain
#

like, only stop listening when you get a valid input

raw nest
#

Can someone help me with express and an image as response? I described my problem here:
https://stackoverflow.com/questions/70185935/err-connection-refused-on-express-running-on-localhost
I hope it's okay to post my Problem like that

earnest phoenix
#

I haven't used Express in ages oof

lyric mountain
#

connection_refused usually means the port isnt open

raw nest
#

maybe the problem isn't even with express....

proven lantern
#

http://xxx.xxx.xxx.xxx/image vs http://localhost:3001/image

#

one has a port

#

one doesn't

raw nest
#

oof... okay that's just wrong but both have a port..

lyric mountain
#

actually, the first one does have a port (80)

proven lantern
#

does 127.0.0.1 work?

raw nest
lyric mountain
#

use postman to see if u can ping that address

raw nest
#

I also tried other search engines and browsers.. it just works if I have it on ip

lyric mountain
#

actually

raw nest
lyric mountain
#

but did postman work?

raw nest
#

yes

lyric mountain
#

where are u trying to access it?

#

like, where is the code running?

boreal iron
#

You get the error when accessing the image in your browser?

raw nest
raw nest
lyric mountain
#

both the server and the code are on the vps?

proven lantern
#

are images served by react or express?

earnest phoenix
#

If it's on the vps then localhost won't work right?

lyric mountain
#

or you're trying to access localhost externally?

boreal iron
#

You're trying to access the webserver externally?

#

But wrote

#

My express is only listening to localhost for security reasons.

raw nest
lyric mountain
#

hm, did u check if nothing else is connected to the port?

raw nest
#

yes it isn't. Express would crash if it is tho

proven lantern
#

it might make sense to put the images onthe frontend

#

actually just use nextjs on vercel

raw nest
lyric mountain
#

don't bother abt image security

#

if the user can see he can grab it anytime he wants to

#

everything user can see can be grabbed

proven lantern
#

generate a uuid so the file names can't be guessed

raw nest
#

well yes it's not that big deal... all tho I need this to work for future things too.. I don't get it why it doesn't work. Maybe it's actually the path or so..

boreal iron
lyric mountain
#

that guy was funny

raw nest
lyric mountain
#

u cant hide anything clientside

raw nest
#

or something like that xD

boreal iron
#

client side, not server side

lyric mountain
#

since browser needs to access it to be able to render

raw nest
#

ye okay nvm xD

boreal iron
#

Anything which has been rendered in your browser IS visible

lyric mountain
#

so anything the browser has access the user has too

boreal iron
#

Like saying anything you see is visible, anything you can't see is, guess, invisible

raw nest
#

any solutions from you guys about the express problem? Maybe idk maybe you guys know how to get the ip of the own server, then I could build it diffrent and it would work

lyric mountain
#

it's hard to say what might be the problem

#

connection refused is a VERY broad error

raw nest
#

Yes it's even hard for me and I have the whole code and built the system xDD

lyric mountain
#

you could try to check ur webserver logs to see if there's anything useful there

proven lantern
#

you shouldn't be worrying about infrastructure stuff.

raw nest
raw nest
proven lantern
#

sunk cost fallacy

#

it's the same reason people like strict types /s

raw nest
#

so then other question.. how can I get the ip address? I mean not like the hostname I mean the actual ip adress so I could fix this problem I guess

proven lantern
#

can you login to the vps? is it linux or windows?

boreal iron
#

wtf... I shouldn't update certbot
Have you ever seen this error?
An unexpected error occurred: KeyError: '<domain_here>'

raw nest
#

yes sure I can xD I also know it but it's for the future use-case. It's about a software you can self-host so I need the ip address. Not my current one, because this one I know

lyric mountain
boreal iron
#

ahh nvm

#

got fixed already

proven lantern
#

it's more than not more then

#

that's a very big issue

proven lantern
earnest phoenix
#

Is it just me or am I understanding the situation wrong

#

Can you connect to something that is hosted on a vps with localhost?

#

Without having something like an ssh tunnel open

simple stump
earnest phoenix
#

But when you call the interactionCreate event you can call the code in that file to run

#

Typically how a normal command handler works

raw nest
earnest phoenix
proven lantern
#

the servers can send in their ip when calling the api

#

but i guess they need to know the ip to call before calling it

#

i made a p2p network in college using java

earnest phoenix
#

I'm not exactly sure how id do it since I've not yet made a proper one, but I'd think of it as making a modified command handler but instead of looking out for messages just look out for the interactionCreate event to be called and use the command name to run the proper code and make sure to pass the command the interaction so it can do it's stuff in the separate files

raw nest
proven lantern
#

are creating a p2p network?

raw nest
#

?

proven lantern
#

peer to peer

#

not centralized to a server

raw nest
#

I don't think so 🤭

proven lantern
#

i think you might be

boreal iron
#

Still didn't got his issue... enlighten me, please

raw nest
#

It's just going be a self-hosting software with 2 servers (Frontend & Backend) and they need to communicate with each other and also send files like images

proven lantern
#

i think he want to create a network of machines connected directly by ip address

#

hmm

#

only 2 machines?

boreal iron
raw nest
raw nest
earnest phoenix
#

Sucks my school laptop doesn't have java on it for some reason

boreal iron
#

P2P und tunnels are nonsense, just use a proper firewall setup to allow inbound connections only by your second server

#

can't be easier

earnest phoenix
#

yes yes

#

Idk what that means cause I'm dumb asf but yes I agree since fake said it

proven lantern
earnest phoenix
#

fake is like Tim but always online

boreal iron
earnest phoenix
#

Conspiracy theory

#

Fake = Tim

boreal iron
#

Tim = FakE ^ 3

earnest phoenix
#

Fake is Tim's alt

#

I'm exposing Tim rn

boreal iron
#

also fits to his age

raw nest
#

who's tim? xDD

earnest phoenix
#

Lol

earnest phoenix
boreal iron
#

Anyways... what's the OS of your webserver(s)?

earnest phoenix
#

He has the biggest brain

raw nest
proven lantern
#

Tim helped me with this code

boreal iron
#

Well then use iptables to add inbound rules for the firewall to allow connections from source IP (your second server) only on port XXXX

raw nest
#

oh man... my brain really hurts rn...

simple stump
#

Sorry internet cut out lol

boreal iron
#

Keep in mind to bind the webserver to your IP or just 0.0.0.0 not localhost anymore after setting up the firewall rule

slender wagon
#

Is there a way to make a replica like the activity bot made by discord?

proven lantern
boreal iron
#

That's why I said, I assume he has a default INPUT policy being ACCEPT

#

So we're just dropping incoming connection for that specific port if the source IP isn't the specified one