#development

1 messages · Page 24 of 1

boreal iron
#

Usually the api returns an invalid form body error

#

In that case

eternal osprey
#

discord_js_1.IntentsBitField is not a constructor

#

what the fuck is this

wheat mesa
#

IntentsBitField is probably an enum, and not a class

#

Ah nevermind it seems like it is a class

#

Can you show your code?

boreal iron
#

Keep in mind he’s on 13.3

wheat mesa
#

Ah okay

#

Yeah that does not seem to exist in 13.3

boreal iron
#

Yeah I was wondering

#

The enum name changes supposed to happen in v14

wheat mesa
#

It’s not even an enum, it’s a straight up class in v14

boreal iron
#

Since nobody likes camelCase anymore

#

v15 next breaking change

#

Then using ZeBrAcAsE

boreal iron
#

Same goes for permission bit fields

#

I saw a PermissionBitFlags static existing too

earnest phoenix
#

How do I know if the inviter is null
return invited by <owner>

#

in the welcome system

#
 TypeError: Cannot read property 'inviter' of null
solemn latch
#

the error is you are using .inviter on null, not that inviter itself is null.

ie null.inviter

earnest phoenix
boreal iron
#

Just show your related code

wheat mesa
#

I don’t think you understand what he’s saying, he’s saying that inviter is not null, but your object preceding that property is null

earnest phoenix
# boreal iron Just show your related code
  await member.guild.fetchInvites().then(async guildInvites => {
    const ei = await invites[member.guild.id];
    invites[member.guild.id] = guildInvites;
    const invite = await guildInvites.find(i => ei.get(i.code).uses < i.uses);
    const inviter1 = await invite.inviter;
    const inviter =
      (await client.users.get(invite.inviter.id)) ||
      client.users.get(member.guild.owner.user.id);
    const logChannel = member.guild.channels.find(
      channel => channel.name === `${welcome[member.guild.id].channel}`
    );
    if (!logChannel) return console.log("I can't find welcomeChannel");
    let gg1 = await welcome[member.guild.id].msg.replace(
      "[member]",
      `<@!${member.id}>`
    );
    if (!inviter || !inviter1.id ) {
      gg2 = await gg1.replace("[inviter]", `<@${member.guild.ownerID}>`);
         
    } else {
      gg2 = await gg1.replace("[inviter]", `<@${inviter1.id}>`);
    }
    setTimeout(() => {
      logChannel.send(`${gg2}`);
    }, 2000);

error from here

wheat mesa
#

Boy I have a lot of questions

boreal iron
#

First of all you don’t need to await non-promises

wheat mesa
#

Like why are you putting await before literally everything

boreal iron
#

Also you don’t validate any of your inviter vars

#

Any can be null

#

You can’t go on then

wheat mesa
#

Is client.users.get even a thing?

boreal iron
#

Getting a member from cache can also result in no result at all

boreal iron
wheat mesa
#

Well then there’s one of your problems

boreal iron
#

Dunno about pre 13 versions tbh

earnest phoenix
boreal iron
#

You begin to fix what we mentioned above first

earnest phoenix
boreal iron
#

your first 3 declared constants make no sense at all

#

getting an user requires you tk access the cache

#

client.users.cache.get()

#

Not all users are cached at any time anyways

#

Find() and get() both don’t return a promise

#

No need to await them

#

As well as using await on you declarations

#

Tf is inviter1 = await inviter.inviter; supposed to do?

#

Not to say that the var is redundant anyways

earnest phoenix
wheat mesa
#

This is going to be difficult with the language barrier mmLol

#

@boreal iron I’ll leave you to this one

boreal iron
#

I’m driving

#

Gonna let you do it

wheat mesa
#

I’m driving

#

Gonna let you do it

boreal iron
boreal iron
#

But I can’t explain it in whatever language you’re speaking

boreal iron
#

dead channel

boreal iron
dry imp
#

double reply

boreal iron
#

lol

boreal iron
#

He nailed it

dry imp
#

no, thats a lie

#

fake is just trolling 🙄

boreal iron
#

lmao

#

Go back drawing pixels

#

Smh

dry imp
#

no

boreal iron
#

I’m never trolling

dry imp
#

surely

boreal iron
# dry imp no

You had the chance to make a summer event banner but you failed

#

Shame on you

dry imp
#

i wont participate in top.gg events 🙄

#

unless its amogus event

boreal iron
#

Oh man…

#

And this is the next generation

dry imp
#

okay better than drunk driver tbh

boreal iron
civic scroll
#

you slapped raw response object

#

into htmp

#

LMAO

#

ping me when you wake up

earnest phoenix
#

Can i know why my bot is down even i run again in replit, added express host it using uptimerobot, freshping, no error, all thing run normal ,just bot cant online

sick agate
#

idk

earnest phoenix
#

Can i know why my bot is down even i run again in replit, added express host it using uptimerobot, freshping, no error, all thing run normal ,just bot cant online, some log no load

native relic
#

Hey I need topgg token for my discord bot, where can I get it from?

#

Error: Top.gg token is missing
at AutoPoster (C:\Users\nanda\OneDrive\Desktop\Movie-Night-Discord-Bot-master\Discord Bot\node_modules\topgg-autoposter\dist\index.js:20:15)
at Object.<anonymous> (C:\Users\nanda\OneDrive\Desktop\Movie-Night-Discord-Bot-master\Discord Bot\bot.js:98:2)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

Node.js v18.7.0

#

I am getting this error when I run the bot

#

Where can I get the Top.gg token??

somber ridge
#

Go to your top.gg bot page -> edit -> webhooks
You’ll see info on generating an api key

native relic
#

Cuz I took source code of a bot and added a few stuff that I wanted

somber ridge
#

You send it as an authorisation header

native relic
somber ridge
#

If you’re bot is approved, it’s only then you can access the top.gg api and it’s api routes

somber ridge
#

No problem

somber ridge
native relic
dry imp
#

yes

eternal osprey
#

hey guys in my index file i've made: js client.player = new Player(client, { leaveOnEnd: true, leaveOnStop: true, leaveOnEmpty: true, leaveOnEmptyCooldown: 60000, autoSelfDeaf: true, initialVolume: 100 });. How would i be able to export this client.player class and use it in my commands in the /commands folder?

#
module.exports = {
    
    data: new SlashCommandBuilder()
    .setName('back')
    .setDescription('Go to the previous song of Music bot #1.'),
                        
    async execute(client.player, interaction) {```each of my commands look like this, so i tried to pass it inside the async execute as you can see, but that doesn.t really work.
errant dagger
#

{
success: true,
message: "Attack is successful."
}

#

{
success: false,
message: "Concurrent limit exceeded."
}

lavish python
#

Hi satori

civic scroll
#

not considered my alias but hi

civic scroll
#

okay so you are trying to access the player inside the execute function body

#

just pass the bot object in instead and access the props from there

//...
async exec(client, interaction) {
    client.player.doWhatever(...args);
    //...
}

or if you only plan to use the player field, use object destructuring instead ```ts
//...
async exec({ player }, interaction) {
player.doWhatever(...args);
//...
}

#

tips: defining exec(client.player) will result in syntax error

#

@eternal osprey

eternal osprey
#

i see

#

Sayuri you are such a cutie

#

thanjks

eternal osprey
#

due to that client i am passing

civic scroll
#

what

#

you should pass two arguments to it

#

AH SHIT SYNTAX ERROR

civic scroll
#

and you should be good

#

i'm sorry

#

i updated the syntax, also that syntax can only be used inside object declaration

eternal osprey
#

I see

#

I would sooo kiss you rn

#

if you give me consent ofc

#

@civic scroll js async execute({Player1}, interaction) { console.log(interaction)

#

returns: undefined

#

due to that player1

civic scroll
#

it must be called with 2 arguments

eternal osprey
#
async execute({client}, interaction) {
   console.log(interaction)
    const string = await interaction.options.getString('song');

    const guildQueue = client.player.getQueue(interaction.guild.id);

    const channel = interaction.member?.voice?.channel;

    if (!channel){
      return interaction.reply({ephemeral:true, content: ":x: **You have to join a voice channel to play music!**"});}

    if (guildQueue) {
      if (channel.id !== interaction.guild.me?.voice?.channelId)
    return;
    } 

    let result = await client.player.search(string, { requestedBy: interaction.user }).catch(() => {});
    if (!result || !result.tracks.length)
      return interaction.reply({ephemeral :true, content: `:x: **No result was found for** \`${string}\`.`});

    let queue;
    if (guildQueue) {
      queue = guildQueue;
      queue.metadata = interaction;
    } else {
      queue = await client.player.createQueue(interaction.guild, {
        metadata: interaction
      });
    }

    try {
      if (!queue.connection)
        await queue.connect(channel);

    } catch (error) {
      client.player.deleteQueue(interaction.guild.id);
      return interaction.reply({ephemeral :true, content: `:x: **Could not join your voice channel!**\n\`${error}\``});
    }

    result.playlist ? queue.addTracks(result.tracks) : queue.addTrack(result.tracks[0]);

    if (!queue.playing) await queue.play();
  }```
civic scroll
#

nooo not function definition

#

i mean where it was called

#

use console.trace(interaction)

#

then send me console output

eternal osprey
#

owh damn i didn';t even know that was a thing

civic scroll
eternal osprey
#
Trace: undefined
    at Object.execute (e:\coding templates\Achievement - Copy\commands\play.js:18:24)
    at Client.<anonymous> (e:\coding templates\Achievement - Copy\index.js:158:19)```
#

bruh

civic scroll
#

okay

#

show me the code of index.js from line 150 to line 165

eternal osprey
#
client.on("interactionCreate", async (interaction) => {
  const command = client.commands.get(interaction.commandName);
  if (interaction.isCommand()) {
    await command.execute(interaction);
  }
})```it might be this
civic scroll
#

there you go

eternal osprey
#

it's excecuting the interaction, but not the client

civic scroll
#

see that command.execute(interaction) ?

#

Expected 2 arguments, but got 1.

pale vessel
#

await command.execute(interaction, interaction);

#

Easy

civic scroll
civic scroll
#

so accessing custom fields won't work

#

in this case man has client.Player1

pale vessel
#

Wut

#

Yeah it's a reference to the client that instantiated it

civic scroll
#

why did i get Client instead of custom class

#

but also it makes that harder to read

pale vessel
#

Maybe they did client.X = ... instead of extending it

civic scroll
#

that's the same shit i do

#

💀

#

so yeah just use the context variable instead

#

i tried for classes too

#

if i log the result client returned by api it's just lib Client class and not the class that inherited it

eternal osprey
#
Error: Cannot find module 'node:events'```
#

bro

#

i swear i've got v16.6.2

#

v16.6.2

#

after running node -v

civic scroll
#

and what for

eternal osprey
#

i fixed it after moving it into my coding directory

#

maybe i just set the path to there

#

but....

#

TypeError: Object.hasOwn is not a function

#

what da fuck is this

#

bro why is my code completely fucked

civic scroll
#

update node to latest version of v16

eternal osprey
#

it already is

eternal osprey
#

😭

civic scroll
civic scroll
eternal osprey
#

fucking hell

civic scroll
#

Object.hasOwn is only available in node version 16.9 and later

#

you have node v16.6

#

💀

eternal osprey
#

Would it give issues if i later on try to run other projects?

#

one npm rebuild would do the job right

civic scroll
#

just update it to latest version 16

#

then run

eternal osprey
#

i see, but all my other v13 projects won't be in harm by updating the node version i hope

eternal osprey
#

love you

civic scroll
#

i really don't know how to response to this

#

thanks

eternal osprey
#

Sorry

#

i catch feelings too fast

#
GatewayIntentBits.SEND_MESSAGES,```what;s the valid bitfield intent?
quartz kindle
#

on v14 everything was converted to pascal case

#

SendMessages

eternal osprey
#
    ^

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined.```
#

GatewayIntentBits.SendMessages,

quartz kindle
#

i mean

#

thats not a gateway intent

#

send messages is a permission

#

gateway intent would be guild messages

#

and dm messages

eternal osprey
#
    this.requiredTextPermissions = [
            "VIEW_CHANNEL",
            "SEND_MESSAGES",
            "READ_MESSAGE_HISTORY",
            "ADD_REACTIONS",
            "EMBED_LINKS"
        ];```yeah this is in my code
#

so everything should be ViewChannel

#

SendMessages etc?

quartz kindle
#

in v14 yes

civic scroll
#

i would be so.
mad

boreal iron
#

Maybe something entirely different

#

Then using ZeBrAcAsE

quartz kindle
#

anyway not my problem, i dont use djs anymore huehuehue

civic scroll
#

time huehuehuehuing scared_TFD

boreal iron
quartz kindle
#

yes, very "stable" and "consistent" :^)

boreal iron
prisma nebula
#

Gusy anyone have the official discord server dev link,

#

?

prisma nebula
#

Ty

#

Guys iam not 16 + and i need the verification form tk be sent for my friend

#

How can i do this. By creating team?

elder gyro
#

Also does anyone know how alert systems work, like the one in Dank Memer?

proven escarp
#

There is an option for that

boreal iron
#

You mean this “alert”?

#

Easy… store your alerts in a map/collection/object etc. with the recipient (user ID) as key

Once a command is being executed, check if your alert storage has the author of the executed command or the recipient of the response
Then attach your alert message as content

#

And instead of repeating that part of code for every response you simply create your own function which sends a response but also checks the alert storage to add an alert or not to the message

dense drift
#

I got a development question, I know it's possible, but I haven't used it in so long I've forgotten...

If I have

data: {
   id: 'channel',
   content: '234234234234'
}```

How do I map it like this
```js
{
   data.id: data.content
}```
rustic nova
#

dunno how dictionaries work on js, but in python it would be something like:

dictionary = {}
dictionary[data['id']] = data['content']
#

so essentially setting the key of the entry to the id, then the value to the content

#
data_dictionary[data.id] = data.content
quartz kindle
#

pretty much same thing in js

rustic nova
#

good good

quartz kindle
#
const object = {};
object[data.id] = data.content;

or

const object = {
  [data.id]: data.content
}
rustic nova
#

though the second one would override the object dictionary, no?

#

lets say you're iterating through a list

quartz kindle
#

yes

rustic nova
#

then the first option if you're iterating through a dataset

quartz kindle
#

yup

rustic nova
celest gate
pale vessel
#

Did someone make a typo for quick.db

quartz kindle
#

lmao

civic scroll
#

you can use a map

#

too

#

in js

dense drift
#

Basically making a cleaner return object in a common file, needed a way to adapt to many different data sets

sick agate
#

how do i place text the proper way

lyric mountain
#

what is "the proper way"?

sick agate
sick agate
#

if there is a way to of course

#

i guess its filling it

lyric mountain
#

like text-align?

sick agate
#

from top aswell but yea

dense drift
#

You'll want to center the parent container, aka, align-content or justify-content

#

Depending on your project, this may or may not be the answer, but if it's not if could also be a poor parent container

sick agate
#

i will attempt to use it thanks

dense drift
#

I always give my container a background color until I'm finished

#

like background-color: blue/purple/green/yellow

sick agate
#

yeah that makes sense i guess

dense drift
#

until you're done centering

sick agate
#

¯_(ツ)_/¯

dense drift
#

Makes seeing the different containers 1000x easier

sick agate
#

yeah that certainly makes sense

dense drift
#

Otherwise you'll bash your head wondering why something won't center, when it's actually a parent 4 levels up breaking

sick agate
dense drift
#

Trust me, it happens ALL the time

sick agate
#

thanks

boreal iron
#
  • { border: 1pm solid; }
eternal osprey
#

does anyone know a way to mute a user and remove all his roles, but as soon as he gets unmuted readd them?

#

Should i integrate its roles in a database prior to muting him

#

and later on readding it?

wheat mesa
#

Sounds like you’re going to need a database for that

#

And please please please not json

#

😭

quartz kindle
#

use jasondb

eternal osprey
#

Whahahha na just kidding

#

guys i upgraded to mongodb

quartz kindle
#

jacksondb

eternal osprey
earnest phoenix
# eternal osprey guys i upgraded to mongodb

MongoDB is pretty good but if you're looking for scalibility of the database, you should look into PostgreSQL, usually MongoDB is bad at handling a ton of requests and scaling the documents and stuff

eternal osprey
#

I am mainly using mongodb for small projects

#

and basically small data that needs to be stored

earnest phoenix
#

That's completely understandable

wheat mesa
#

How do you know my name Tim

boreal iron
#

Tf I thought your name is Charlette

wheat mesa
#

I’m going to hope that was a joke KEKW

sudden geyser
#

I thought it was John.

sharp geyser
#

I thought it was Jeffrey

feral aspen
#

In Java, if I would want to make enums, supposedly like this in JS:

export declare enum ButtonStyle {
    Primary = 1,
    Secondary = 2,
    Success = 3,
    Danger = 4,
    Link = 5
}
#

Is it like ```java
enum ButtonStyle {
Primary = 1,
Secondary = 2,
Success = 3,
Danger = 4,
Link = 5
}

sudden geyser
#

No

feral aspen
#

Oh, then without the = x?

sudden geyser
#

It would be like

public enum ButtonStyle {
  PRIMARY, SECONDARY, SUCCESS, DANGER, LINK;
}
feral aspen
#

Fair enough.

sudden geyser
#

What do the numbers represent for your case

feral aspen
#

Not sure however why though.

sudden geyser
#

Ah, they're probably "codes"/enum values when sent to Discord

#

You can add values to enums

#

Just add parentheses to each one as if you're calling them like a method with arguments

public enum ButtonStyle {
  PRIMARY(1),
  SECONDARY(2),
  SUCCESS(3),
  DANGER(4),
  LINK(5);

  public ButtonStyle(int value) {
    this.value = value;
  }
}
feral aspen
#

Is it possible to add IDs to each enum or is your method it?

#

Like this.

sudden geyser
#

Primary, secondary, success, etc. are just human names. Discord only accepts numbers representing each one.

#

So 1, 2, 3, etc. each correspond with a style

feral aspen
sudden geyser
#

My method is how it's done

#

though not the only way

feral aspen
#
public enum HttpStatus {
  OK(200),
  CREATED(201),
  BAD_REQUEST(400),
  NOT_FOUND(404)

  public HttpStatus (int value) {
    this.value = value;
  }
}
#

Like this?

sudden geyser
#

I believe so

feral aspen
sudden geyser
#

Create a class with static final fields each representing a value

wheat mesa
#

^

feral aspen
#

Example?

wheat mesa
#

though this is definitely a good use case for enums in java

feral aspen
wheat mesa
#
public class HttpStatus {
  public static final int OK = 200;
}
#

that's for the static final fields example

wheat mesa
feral aspen
#

Like this?

sudden geyser
#
public class Platforms {
  public static final int macos = 1; // ok
  public static final int windows = 2; // bad
  public static final int linux = 3; // worse
}
wheat mesa
#

tbh I don't use enums in java very often

#

I should though

feral aspen
#

Honestly, I just wanna recreate to understand, that's all.

wheat mesa
feral aspen
#

Or is it actually called that.

feral aspen
sudden geyser
#

what did you do

lyric mountain
#

that wont work at all

#

u need to declare a final field to hold the value

lyric mountain
feral aspen
lyric mountain
feral aspen
#

Ah.

#

How are enums really used, then?

lyric mountain
#

when u need to...well...enumerate

#

like, imagine you have a Gender field (which is an enum)

#

MALE, FEMALE, OTHER

#

(or if u want to list all of them, whatever)

feral aspen
#
enum Gender { MALE, FEMALE, OTHER };
#

Should they be capital?

lyric mountain
#

u have absolute values, that are guaranteed to be immutable at all moments

#

yes

#

enums (like constants) are always CAPITAL_SNAKE_CASE

feral aspen
#

Ahh.

#

How are they useful, then?

#

Example, I see the Color class.

#

Color.WHITE.

lyric mountain
#

color doesn't have enums, those are public static final values

#

enums are independent of anything else

feral aspen
#

Oh, then when should I be using enums and when should I use the other?

lyric mountain
#

they're like fixed values to be used somewhere

feral aspen
#

(like PI) 👍

lyric mountain
#

pi isn't an enum also

feral aspen
#

No, that's a public static final value.

lyric mountain
#

those are the so-called "magic constant"

#

most IDEs detect them when passing as a parameter

#

example of usages:

feral aspen
#

No useful case other than that.

lyric mountain
#

and example for magic constant:

#

with that annotation, I tell the compiler that the value is supposed to be one of those fixed values

#

those aren't enums, just constants

sudden geyser
#

Enums look useful as a closed yet optimized set of values.

feral aspen
#

Which is like the discord.js one in enums.

#

No?

lyric mountain
#

enum use-case:

#

a card can only have 4 types: NONE, KAWAIPON, EVOGEAR or FIELD nothing else

feral aspen
#

Alrightttt, I see now.

lyric mountain
#

with constants, u could pass any value as a parameter in my first example

#

with enums u cant

#

it HAS to be one of those 4

#

or null

feral aspen
#

Why numbers, though?

#

Example, discord channel types is type 0 or type 1 or etc.

#

Why numbers?

lyric mountain
#

that's for js

feral aspen
#

Why not call it DM or GUILD_CHANNEL, and etc.

#

Instead of 0, 1, and 2.

lyric mountain
#

because strings are costly

feral aspen
#

Meaning?

lyric mountain
#

that you waste a shitton of resources just to hold those values

feral aspen
lyric mountain
#

no

#

in my case, I might have other, undocumented status codes

#

those who ARE known are listed as constants

#

the compiler can optimize that as much as if I used enums instead

#

but it allows more values other than the declared ones

feral aspen
#

Fair, last question...

feral aspen
feral aspen
#

Instead of "Success", "Initialization Error", etc.

lyric mountain
#

because I can't use enums for status codes

lyric mountain
#

like, VERY costly

feral aspen
#

Alright, alright. 👍

lyric mountain
#

in my example, I'm using byte, which is only 8 bits

feral aspen
#

Isn't the size of byte 1 byte?

lyric mountain
#

yes

#

8 bits

feral aspen
#
byte    1 byte    Stores whole numbers from -128 to 127
short    2 bytes    Stores whole numbers from -32,768 to 32,767
int    4 bytes    Stores whole numbers from -2,147,483,648 to 2,147,483,647
long    8 bytes    Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float    4 bytes    Stores fractional numbers. Sufficient for storing 6 to 7 decimal digits
double    8 bytes    Stores fractional numbers. Sufficient for storing 15 decimal digits
boolean    1 bit    Stores true or false values
char    2 bytes    Stores a single character/letter or ASCII values
lyric mountain
#

a string, however, is at minimum 2 bytes for a single character, not considering the header

#

\u0000 to \uFFFF for each char

feral aspen
#

Oh, that's a lot.

lyric mountain
#

if we consider only that, "SUCCESS" would cost 8 bits * 7 chars, which is 56 bits (or 7 bytes)

feral aspen
#

Oh, that's a lot of space, true.

#

0 is 8 bits, on the other hand.

lyric mountain
#

most of the time it doesn't matter, but sometimes you REALLY want to squeeze all the available space u can use

wheat mesa
#

(Keep in mind most of these number data types will be 4 bytes anyways due to arch optimizations)

#

Not including the ones bigger than 4 bytes

sudden geyser
#

begone arch user

lyric mountain
#

even booleans

wheat mesa
#

It's the smallest amount of memory the CPU can address at once

lyric mountain
#

BUT you can do a pro gamer move and use integers as boolean arrays

#

being able to store up to 8 booleans in a single byte

wheat mesa
#

Yeah, bitsets are good for memory if you're using a lot of them

#

4 bytes for 32 booleans

lyric mountain
#

which is why discord use that for permissions

#

else...just imagine the response json

wheat mesa
#

lmao

feral aspen
#

Anyways, I think I had enough Java learning today. I got to understand the basics, everything about methods, attributes, constructors, modifiers, classes, and etc.

#

I got to understand everything about enums as well, thanks a lot. yay

sudden geyser
#

tomorrow will be harder

eternal osprey
#

hey

#

how can i actually only make a button clickable if someone clicked the select menu

lyric mountain
#

update the message

eternal osprey
#
  interaction.reply({embeds: [{ footer: `Music Bot #1`,description: `**Skipping 15 seconds **`, color: `#FF0000`}]})```only dictionaries may be used in ModelType?
lyric mountain
#

isn't that color supposed to be inside a string?

eternal osprey
#

it is

#

but its coming from the footer

lyric mountain
#

footer with a color?

eternal osprey
#

it's the embed color, footer and description

#

this is how i define my embeds

lyric mountain
#

a

eternal osprey
#

however, the error is coming from the footer.

sudden geyser
#

Footers to my knowledge take objects

eternal osprey
#

owhhh wait

#

the {text:}

sudden geyser
#

ye

#

also color is supposed to be an integer

eternal osprey
#

can't it be hex anymore?

sudden geyser
#

never accepted hex

#

I'm assuming your library is sending it to Discord as-is.

eternal osprey
#

I remember in djs v13, #FF0000 and even color names such as "RED" were accepted by it

sudden geyser
#

You were probably using an embed builder

#

Which converted it for you

eternal osprey
#

i used the djs MessageEmbed method

sudden geyser
#

yes

eternal osprey
#
data.embeds[0].footer[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType```
#

still the same

#
 interaction.reply({embeds: [{ footer: {text: `Music Bot #1`}, description: `**test**`, color: 0x44b868 }]})```
#

Might just use EmbedBuilder then lol

wheat mesa
#

Just not in string form

eternal osprey
#

I see

#

but why's the above error occuring then?

#

I will just use EmbedBuilder for the ease

wheat mesa
#

That's a very odd error

#

The only thing I see out there on that is some sort of json dependency fucking with it, which wouldn't make sense since js supports json format natively

#

What version are you using?

#

If you're using anything under 13.9, I suggest updating to 13.9 if you don't want to update to v14

eternal osprey
#

I am using the latest version

wheat mesa
#

I've never seen that error before

#

ah wait

#

I know

#

you're missing a curly bracket

#

wait I thin I'm stupid

#

hold on

#

brain dying

#

yeah I have no idea

#

If the builder works and not that, then the DAPI is just bugging the fuck out or something

civic scroll
raw nest
#

What's the newest backend framework for nodejs? (industry standard)

pine nova
#

ig

raw nest
#

What about Fastify?

#

@pine nova

pine nova
#

idk about that

celest gate
#
C:\Users\creative infotech\Desktop\Test\node_modules\discord-player\dist\Player.js:46
        if (this.client?.options?.intents && !new discord_js_1.IntentsBitField(this.client?.options?.intents).has(discord_js_1.IntentsBitField.Flags.GuildVoiceStates)) {
                                              ^

TypeError: discord_js_1.IntentsBitField is not a constructor
    at new Player (C:\Users\creative infotech\Desktop\Test\node_modules\discord-player\dist\Player.js:46:47)
    at Object.<anonymous> (C:\Users\creative infotech\Desktop\Test\index.js:36:16)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
civic scroll
#

type BitField is not callable

#

for this use consider using IntentBitField.any(<FLAGS>)

#

oh wait

#

the constructor signature is valid

pale vessel
civic scroll
#

Exudead forgot

pine nova
marsh sapphire
#

How do you get the server count on top.gg?

boreal iron
#

You gonna send a request to the topgg API

#

You simply add the bot ID you wanna find to the request uri

#

And get the bot data or null if it wasn’t found back as response

raw nest
#

Would you recommend using Fastify with / without TS?

lament rock
#

I honestly wouldn't even bother with a framework unless it was pug and you cached static render results

lament rock
#

Frameworks are super annoying to deal with and have heavy sacrifices just for developer convenience. Pug is a framework and pages have to be compiled to html, but you can always cache the compilation results for static webpages

raw nest
#

what does that have to do with TypeScript yes or no with Fastify?

lament rock
#

Do whatever you want. It's your project

raw nest
#

well yeah ofc.. I just asked for recommendations

lament rock
#

And I gave you one that I had used in the past. And I'm not sure if you know my reputation here is to be optimized. It's fine if you don't, not trying to flex or anything, just I don't bother with frameworks for a reason. Then again, https://amanda.moe is written in pure html and css

feral aspen
#

Is it better to use extends or make a new object, example:

package main;

public class Game extends GameWindow {
    // private GameWindow gameWindow;
    public Game() {
        // gameWindow = new GameWindow();
    };
};
lament rock
# feral aspen Is it better to use `extends` or make a new object, example: ```js package main;...

extends allows a class to inherit the prototype of this' super. This is only useful for if all methods and properties of super can be applicable to this
Some projects have complex class trees, some classes of which are abstract (cannot be initialized, only extended) to make sure all of their class extensions only include desired methods/properties.
Some go a step further and assign from one prototype to another to cherry pick methods/properties.

feral aspen
#

Fair enough.

boreal iron
lament rock
#

Just giving examples

boreal iron
civic scroll
civic scroll
#

plus is not really that annoying

#

take an instance with nextjs

elder oxide
#

Is it just me or DJS 14 is very annoying.

#

is it possible to make all properties mutable in DJS 14?

civic scroll
elder oxide
#

Properties of the object, for example, button.

#

It used to be simple .setDisabled(false) now it's ButtonBuilder.from(button).setDisabled(false)

civic scroll
#

you can update the components of the message instead

civic scroll
#

since well, to update the message buttons you need to make an api call

#

so at this point just call the func

elder oxide
#

Oh my god i am dumb, sorry man.

#

Now i see why it's better to make it immutable.

civic scroll
#

i get you

#

it can be mutable but again, it's only on our side but not the end user

#

plus their fields are readonly so you can't modify them in ts

elder oxide
#

until i did a oopsie and (button as any)

civic scroll
#

mmm yes, unsafe

elder oxide
#

mmmm... i can smell the TS blindly doing stuff...

civic scroll
#

for //@ts-nocheck

elder oxide
#

//@ts-expect-error

civic scroll
elder oxide
civic scroll
elder oxide
#

@civic scroll delete abuse.

civic scroll
elder oxide
#

That gonna delete the key that we need too.

civic scroll
elder oxide
#

too lazy to make a for loop

civic scroll
elder oxide
#

co pilot.

civic scroll
#

write a loop now

elder oxide
#

nu.

civic scroll
#

i will give you 5 across the ass

elder oxide
#

nu.

civic scroll
uneven tartan
#

sayuri when doing repitive tasks without loops

elder oxide
#

make a class in haskell. tro

feral aspen
#

I don't even understand this error?

elder oxide
#

Maybe a line before that?

civic scroll
#
Font.PLAIN.32F
           ^ Problem started here
= hint: check the key 
wheat mesa
#

I would assume you don't need anything other than Font.PLAIN

proven escarp
#

indeed

wheat mesa
#

Man java could use some good error pretty printing like rust

sudden geyser
#

Rust error messages are something else in this universe.

#

Nothing comes close.

spark flint
#

does anyone know what causes this?

sudden geyser
celest gate
#

@muted current

#

I am making a timediff cmd like so how to get a timestamp thorough a provided message ID not the message id of the bot

wheat mesa
#

I’ve seen people in the rust community server writing pretty printers with errors and suggestions just like rust single-handedly for their language

sudden geyser
#

I have yet to see any language come close to it.

wheat mesa
#

Here’s this guy for example

#

In the case that screenshot is too small, here’s the original one he posted

earnest phoenix
#

What api error

let msgEmbed = await message.guild.channels.cache.get(channel).send(embed)
    
await msgEmbed.react(':arrow_up:')
await msgEmbed.react(':arrow_down: ')
sudden geyser
#

You have to use the literal emoji, i.e. \⬆️ and \⬇️

earnest phoenix
#

cannot use id?

sudden geyser
#

Only if you're dealing with custom emojis

wheat mesa
#

The Unicode representation of it, or you can use the full emoji ID if it’s custom

earnest phoenix
#

ohh ok thx

fervent moss
#

Someone knows how to encode base64 links?

wintry tendon
#

Anyone knows what is the meaning of this Warning ?

wheat mesa
#

it means you're sending too many requests

magic monolith
boreal iron
#

Like most languages I know have native functions for encoding/decoding base64

civic scroll
wintry tendon
#

also nothing is wrong when i launch it on my computer, it only happens on cloud server

rigid maple
#

when i get y value in this position it gives me 0 but this y value of this box. In order to reach the real y value of the text, I need to subtract the space between the text and the box from the y value, but how do I find that space?
sorry for my bed england 😃

boreal iron
#

It’s not like we can guess which one you mean…

fervent moss
civic scroll
#

<HTMLElement>.clientHeight

rigid maple
#

That's my goal anyway, but I can't get it anyway

#

I'm using KonvaJS

civic scroll
boreal iron
#

Sayuri too quick for me

#

Back to jail with u

civic scroll
lament rock
rigid maple
#

I can get the element like this: stage.find(".username")[0]

civic scroll
#

i mean

#

what's the type of the element

#

does it extend Konva.Shape

rigid maple
civic scroll
#

it has height field

#

try logging the value of stage.find(".username")[0].height

rigid maple
#

it gives the fontSize so it is fixed 30

fervent moss
civic scroll
lyric mountain
#

like, compare the boundaries between t and T, subtract the height and you'll have the gap size

rigid maple
#

Why would comparing t to T give me the space between text and box?

boreal iron
lyric mountain
#

in yellow is the gap I mean (the one u probably want), in blue is the ascend

#

unless I got it wrong

rigid maple
#

the space I want is the part I marked with red

civic scroll
#

oh that

#

ah this is hard

#

as js doesn't have the api for this

lyric mountain
#

in java u could just the the shape of T and get its boundaries

fervent moss
lyric mountain
#

it'd return the actual height

civic scroll
lyric mountain
#

like, without any gap

#

idk if u can do the same in js

rigid maple
#

Since the vertex of G is higher than T, actually I want to take the vertex of G as the vertex of the text.

#

but that's not happening

lyric mountain
#

G and T have the same height tho

rigid maple
#

from the apex of the box i have to subtract the apex of the text

rigid maple
lyric mountain
#

they do

#

uppercase characters all have the same bounding box

civic scroll
rigid maple
#

maybe it's because of the font i'm not sure but they don't have the same size

civic scroll
lyric mountain
#

G appears to be higher because it's curved

#

but if u put that in an image editor you can count the pixels

#

anyway, I believe the real question here is WHY you want that gap

#

like, what are u trying to do?

rigid maple
#

i am trying to get x y values ​​of selected element like photoshop but this value cannot be the value of the box because I need to draw it with canvas

civic scroll
#

if it's fixed size perhaps we can only calculate them by hand

rigid maple
#

that is, if the text gives a value like -5 to y at the top of the canvas, I cannot draw it correctly on the canvas. so if the y-coordinate of the text gives a value like -5 I can't draw this right on canvas

rigid maple
lyric mountain
#

just the the size of the box

civic scroll
#

calculate the ratio between font size and that gap

rigid maple
#

The font size does not change no matter how much I enlarge the text.

wintry tendon
lyric mountain
#

like, it shouldn't

rigid maple
#

yes

rigid maple
civic scroll
#

yeah

lyric mountain
#

are you trying to make a PS plugin?

civic scroll
#

your best bet is the bounding box

rigid maple
lyric mountain
#

disallow manually changing the box size

#

make it fixed to the font size

rigid maple
#

users can set their own level card from the website

lyric mountain
#

still

#

there's no need to have a dynamic boundary box, just have a font-size selection option

rigid maple
#

oh that makes so much sense

lyric mountain
#

if u still want to, there are 2 ways u could do this:

A - iterate over all the pixels vertically, store the first and last non-transparent pixel and compare the distance between them

B - if the text is centered, get the central coordinate and subtract fontSize / 2, your text will be from boundingBox / 2 - fontSize / 2 to boundingBox / 2 + fontSize / 2

#

both are more complex and, in the case o A, terrible performance-wise

rigid maple
#

A 💀

fervent moss
civic scroll
#

it's not random bytes

lyric mountain
#

images are just masked numbers

civic scroll
#

those bytes are what construct your image

fervent moss
#

So can I convert them to image?

lyric mountain
#

yep, each of those numbers is a pixel

rigid maple
#

i will try something thank you for your help

civic scroll
#

okay

fervent moss
lyric mountain
fervent moss
civic scroll
#

don't even need the mime type

fervent moss
#

What should I do now?

lyric mountain
#

the buffer is your image

#

simply use it

civic scroll
#

assume your data is as is

#

you can do

#
URL.createObjectURL(new Blob([data]))
#

pass the result of this expression to the src attribute of img element

fervent moss
lyric mountain
#

what people read: "blob, a binary long object"

what I read:

boreal iron
fervent moss
wheat mesa
civic scroll
fervent moss
#

I'm dumb af

civic scroll
#

data being whatever parsed from Buffer.from call you did earlier

fervent moss
#

Demn i removed that line lol

civic scroll
fervent moss
civic scroll
#

WHAT

#

URL.createObjectURL

lyric mountain
#

ps: she doesn't mean "theurl".createObjectURL

fervent moss
#

Yeah now it worked now it gives we something
blob:nodedata:some numbers now i have to do something?

fervent moss
#

Yeah i told I'm not creating website i just need a damn image link to put it in embed

#

*discord bot

lyric mountain
#

the buffer is what u pass to the embed

fervent moss
#

Oh that too works?

lyric mountain
#

it's not "too", it's the only way to have non-hosted images in embeds

#

send the image as a file and use attachments://name.ext for the url

fervent moss
#

Hmm....thanks @civic scroll kuuhaku and FAKE

fervent moss
lyric mountain
#

yes

#

the name is supposed to be the sent file name, not...whatever that is

fervent moss
lyric mountain
#

no

#

when u add a file to the message, you need to pass a buffer and a name right?

#

THAT name is what u pass to the attachments url

fervent moss
lyric mountain
#

yes

civic scroll
#

ayaaaaaa

pale vessel
#

Haiyaaaa

fervent moss
# lyric mountain yes
let skins = skin.data.properties[0].value;
  let data = Buffer.from(skins, "base64");
let final = URL.createObjectURL(new Blob([data]));
message.channel.send({embed: [ new EmbedBuilder()
.setImage(`${final}`)
  
                     ]})
  };

Okay here what to change I'm super confused

pale vessel
#

Wtf

lyric mountain
#

*sigh*

pale vessel
#

Pls use buffers and provide image name

lyric mountain
fervent moss
#

Ah cool

civic scroll
#

wait

#

if you embed

fervent moss
#

The image name / source will be final?

civic scroll
#

that wouldn't work

#

kuu

lyric mountain
#

?

#

it definitely works

civic scroll
#

we gotta embed the image as base64

lyric mountain
#

nope, u can send the buffer as a file

civic scroll
#

oh

lyric mountain
#

then assign the file to the embed image

civic scroll
#

but

#

that's clonky

pale vessel
#

That's the only way

lyric mountain
pale vessel
#

Or upload it somewhere and use URL

fervent moss
lyric mountain
#

did u read the text?

#

or did u just copy the code?

civic scroll
#

i want to die

lyric mountain
#

I don't allow u to

civic scroll
#

i wanna go there and manually type the code for him

wheat mesa
#

fuuuuuuuuuuuuuuuuuuuuuuuck

#

time to debug parser

#

...the 1100+ line parser

civic scroll
wheat mesa
#

no

#

parser is nearly finished

#

this is basically the last thing I have left

#

surely

fervent moss
#
const attachment = new AttachmentBuilder(await final.encode('png'), { name: 'skin.png' });

    interaction.reply({ files: [attachment] });

Is this what i need to do?

ancient nova
#

that's the api latency

#

not my bots

wheat mesa
#

looks like you've done something wrong

ancient nova
#

what tho???

wheat mesa
#

because if the API were taking 37 seconds to respond, your lib would timeout the request first

ancient nova
#

defo not wrong ping being displayed since command take 1-5 seconds to execute

lyric mountain
wheat mesa
earnest phoenix
#

It's probably an issue from the Discord API side, if not then it's your bot host's internet connection

lyric mountain
#

like, there's a text right above that code

lyric mountain
#

37s ping lmao

wheat mesa
#

not possible

#

any reasonable request would timeout long before that

#

is that happening more than once? Could just be a really odd bug

lyric mountain
#

probably some inefficiency on the code is making it move like a stone

wheat mesa
#

Well, I feel like that's not anything to do with it

earnest phoenix
wheat mesa
#

Ping should be based on the DAPI response time, not his command response time

solemn latch
#

is it actually taking 30 seconds to receive the message?

depending on how you calculate ping it can be wrong

ancient nova
lyric mountain
solemn latch
#

op

#

-ping

pliant gorgeBOT
#

Pong!

gilded plankBOT
ancient nova
#

you guys can even come and try yourselves

wheat mesa
#

My rest is 185ms, gateway is 80ms

ancient nova
fervent moss
solemn latch
#

well discord doesnt have 30 seconds ping

#

^_^

wheat mesa
#

If your bot is slow, probably a you issue

earnest phoenix
#

It's probably your bot host's internet connection

lyric mountain
#

west us

wheat mesa
#

Considering the code I saw you writing I wouldn't be quick to dismiss that possibility

lyric mountain
#

no ping issues

wheat mesa
#

But yeah, that severe of an issue is probably host

#

Might be a good idea to restart your bot's session

lyric mountain
wheat mesa
#

I've had issues where my bot had a consistent 3000 ping because there was some sort of weird bug with the session

#

Just restarted the shard and it was fine

lyric mountain
#

given it's bae...I'd bet on code issues

wheat mesa
#

oh boy I didn't consider the fact that I'm going to have to write documentation on how to use BreakfastLang

#

Not like it's very difficult, but still

fervent moss
# lyric mountain what u have is a BufferResolvable

Then this should work?
If I'm not getting it wrong

const { AttachmentBuilder } = require('discord.js');

const file = new AttachmentBuilder(final);
//final is the link what i get

const exampleEmbed = {
    title: 'Some title',
    image: {
        url: 'attachment://${final}',
    },
};

channel.send({ embeds: [exampleEmbed], files: [file] });
#

If something is wrong then say me directly pandasad

fervent moss
earnest phoenix
fervent moss
#

And how am I supposed to know file name?

#

Should I just name it randomly

earnest phoenix
#

You can provide the file name as the second parameter of the AttachmentBuilder class

lyric mountain
earnest phoenix
#

For example:

const attachment = new AttachmentBuilder(final, 'foo.png');

const embed = new EmbedBuilder()
  .setImage(`attachment://${attachment.name}`);

await channel.send({
  attachments: [attachment],
  embeds: [embed]
});
#

attachment.name would be the name of the attachment, so you wouldn't have to re-type it in the setImage() method

#

Although you don't have to provide a custom file name, a default file name is already set so you can know what it is by the name property

civic scroll
#

just throw the computer away and have a sip of tea

fervent moss
#

Ah yes I am mad but idk everytime when i try to do something a f new error comes now what is this?

wheat mesa
#

oh no replit

#

you need to give an id to the attachment, whatever that means

lyric mountain
#

the name I believe

wheat mesa
#

figured

fervent moss
lyric mountain
#

show current code

fervent moss
# lyric mountain show current code

const attachment = new AttachmentBuilder(final, 'test.png');

const embed = {
  image: {
    
    
url: `attachment://${final}`,


    },
};

await message.channel.send({
  attachments: [attachment],
  embeds: [embed]
});    
lyric mountain
#

...

#

you definitely didn't do as Voltrex said

fervent moss
#

It should be attachment://test.png?

lyric mountain
#

yes

fervent moss
lyric mountain
fervent moss
#

attachments => files ?

lyric mountain
#

yes

fervent moss
#

I told it's not local

lyric mountain
#

show what final is

fervent moss
#
axios.get(`https://sessionserver.mojang.com/session/minecraft/profile/${user_id}`)
 let skins = skin.data.properties[0].value;
  let data = Buffer.from(skins, "base64");
let final = URL.createObjectURL(new Blob([data]));
lyric mountain
#

remove final, use data

fervent moss
lyric mountain
#

you're gonna upload the file in the same message as the embed

#

also if it's called "file.jpg" why are u using "file.png"?

#

you need to use the EXACT same extension as the source file

#

else you'll get that, an unreadable image that shows as a file

fervent moss
#

Oh

lyric mountain
#

changing the extension wont magically convert the file

fervent moss
#

Yeah what to do and also embed isn't loading for some reasons

lyric mountain
#

does it show the poo image?

#

try sending the image without the embed, if it shows the preview you're doing it right

#

it if doesn't, there's an issue somewhere in ur code

marsh sapphire
#

Does anyone know if it take time for the server count to show on top.gg?

lyric mountain
#

press ctrl + F5 to refresh the cache

#

but it might take up to 1 hour

marsh sapphire
#

Its there name, thanks

boreal iron
#

tf... anyone ever seen that graphical glitch?

sudden geyser
#

I don't want to know what IDE you're using.

boreal iron
#

that's not an issue of the editor

#

it's everywhere in Windows

sudden geyser
#

windows user

boreal iron
#

but why tf is the text visible

wheat mesa
#

we do a little bit of gpu damaging

boreal iron
#

nah, i don't think so

lyric mountain
#

ngl, as a dwarf fortress players that's all I see lmao

boreal iron
#

dunno what the hell is going on

lyric mountain
#

press ctrl + shift + windows + B to restart graphics driver

#

or simply restart the ide

boreal iron
#

hmm once i update the background color the issue is gone

#

to something non black

#

weird

lyric mountain
#

racist ide

boreal iron
#

aye... now using light blue background

#

what can go wrong

lyric mountain
#

your eyes

boreal iron
#

don't know what u mean

#

idk why my walls are blue now, too

proven lantern
#

watching a tutorial video and see this

boreal iron
#
count = 1;
quantity = quantity + count;
#

ok lmao

#

now fullscreen

proven lantern
boreal iron
#

you got it

proven lantern
boreal iron
#

and be scared, like me

proven lantern
boreal iron
#

Aye, black screen now

#

fixed

lyric mountain
#

your fortress is flooded

boreal iron
#

Tf

#

I’ve got no clue what ur talking about

rustic nova
rustic nova
lyric mountain
boreal iron
#

Ok one question

#

Do you guys all have the same drug dealer?

#

That would explain a lot oldEyes

boreal iron
#

If so… give me his number

#

I wanna fly too

lyric mountain
quartz kindle
#

never played dwarf fortress but always heard its a super complex and super crazy game only for hardcore people

brisk nexus
#

Guys

#

I can't enter the site. Can you enter?

quartz kindle
#

this?

brisk nexus
#

I cant.

#

You are being rate limited

#

This eror

quartz kindle
#

idk

boreal iron
quartz kindle
# boreal iron My gosh…

dwarf fortress, the legendary game that if your boss sees you playing at work he gives you a promotion thinking you're an expert programmer/genius

sharp geyser
sudden geyser
#

java

sharp geyser
#

Java allows the function keyword in classes?

#

Also fake hates java

#

He doesn't even wanna look at it

sudden geyser
#

oh what

#

Looks like php

sharp geyser
#

I was going to assume php

#

But I don't know much about it

wheat mesa
#

Yeah that’s php

sudden geyser
#

filthy php user

wheat mesa
#

Definitely not Java

sharp geyser
#

Yes fake wouldn't go near java even with a 10ft pole

boreal iron
#

True

boreal iron
ancient nova
#

def a GPU rendering issue

boreal iron
#

Has nothing to do with the GPU

#

But with windows

#

Whenever RDP is opened up this shit happens sometimes

ancient nova
#

tho GPU usually causes this, can be due to overheating, broken drivers, malfuncioning parts etc.

boreal iron
#

Those sort of graphical issues you mean would have an effect on the entire screen not just parts of some rendered app windows

#

Especially not just on areas without text being displayed or I hover my mouse at

ancient nova
#

for example icons can go entirely black, taskbar won't render text would get messed up etc.

#

I had that literally happen to me