#development

1 messages · Page 26 of 1

boreal iron
#

Mr. Bae 2

eternal osprey
#

I would love to change myname

#

but i don't remember my password lol

#

ask the mods to change my nickname i guess

solemn latch
#

mods lazy

boreal iron
#

True

celest gate
#

how can i add only discord server can use the command

elder oxide
#

what

lyric mountain
#

if (serverid !== "some id") return

earnest phoenix
#

Tried everything what do I do?

#

I even tried the written thing but comes back an eroor

#

*error

#

Anyone?

stiff dust
#

Which VPS is better for ram usage Windows or Linux ?

#

Node js

boreal iron
#

I doubt there’s much of a difference as the environment is optimized for both OS

lyric mountain
boreal iron
#

lol 11 message event listeners created

lyric mountain
#

windows takes considerably more ram for itself

boreal iron
#

Oops where did my reply go

boreal iron
stiff dust
#

??

earnest phoenix
#

I mean `` this signs

boreal iron
#

wut

earnest phoenix
#

Type the fuol cmds for node.js and python

#

*full

#

Please

#

._.

#

I am dum

lyric mountain
boreal iron
#

Kahuhuwajabunku, I need somebody translating this above

earnest phoenix
#

._.

lyric mountain
#

they want u to spoonfeed the correct code

earnest phoenix
#

Use google

boreal iron
earnest phoenix
#

LoL

lyric mountain
#

inb4: no

earnest phoenix
#

._.

sudden geyser
#

only corporate bosses who've never entered a terminal would pick windows as a host

boreal iron
#

How about providing us your code

#

So we can punish you for what you did

boreal iron
#

*essential

lyric mountain
#

fake uses windows for host confirmed

boreal iron
#

Indeed… a few VMs are Windows

#

Must are running Ubuntu

#

the evil bloated OS

earnest phoenix
#

@boreal iron BRO I DID IT

#

It came online

#

SUII

#

No ty as I did it myself

But still ty you tried

#

:)

boreal iron
#

Did you remove all your message event listeners?

#

You just need one

#

Not 20

lyric mountain
#

pov: the issue apparently solved itself so you ignore the obvious error

boreal iron
#

Until the next event is emitted

#

And the pain begins

lyric mountain
#

people underestimate technical debt

boreal iron
eternal osprey
#

hey guys in djs v14, how woudl i check if a bot (of which i have the clientId and normal id of), is in a vc?

boreal iron
#

PC has just 40 cm in depth

#

Does the channel has a members property? Lemme check

earnest phoenix
#

Probably something sus or malfunction according to you my dear sir

boreal iron
#

Just search your known ID

boreal iron
eternal osprey
#

Got it

boreal iron
#

You didn’t specify you don’t know the channel

#

Fetch the guild member instead and check his voice status

near ether
#

with the new slash commands, how can i check that my bot has permissions to speak in a channel?
im trying to .fetch them but it doesnt have permission

earnest phoenix
boreal iron
#

Without providing the code you won’t get help here

near ether
#

are you talking to me?

boreal iron
#

Nope

near ether
#

ah

boreal iron
earnest phoenix
boreal iron
#

For your guild channel

earnest phoenix
#

._.

earnest phoenix
#

@boreal iron dming you my replit project

boreal iron
#

I don’t need it

#

Can’t open it on mobile anyways

earnest phoenix
#

Ahh wat do I do then to get help ._.

boreal iron
earnest phoenix
boreal iron
#

That will return the permissions bitfield

near ether
#

thats in my code already and it hits me with a "missing perms" api error deadInside

earnest phoenix
#

*chrome

boreal iron
#

For your bot in that channel

boreal iron
boreal iron
near ether
#

yea lmao

#

here lemme remove everything else and try again

earnest phoenix
#

This is where it's making the problems

#

It says to increase the limit of listeners

#

Sometimes

#

But now somehow ok as I made it leave 2 servers

#

:/

#

@boreal iron my ss

#

:)

pine nova
#

30000 💀

near ether
#

@boreal iron this is all of my code and the resulting error

earnest phoenix
eternal osprey
#
if(!bot1.voice.channelId){
 const axios = require('axios')
                    async function postData () {
                        let data = JSON.stringify(
                            interaction,
                            (_, value) => typeof value === 'bigint'
                              ? value.toString()
                              : value
                          )
                      console.log(data)
                    return  }
    if (!bot2.voice.channelId) {
                    const axios = require('axios')
                    async function postData () {
                        let data = JSON.stringify(
                            interaction,
                            (_, value) => typeof value === 'bigint'
                              ? value.toString()
                              : value
                          )
                      console.log(data)
                    return  
                }
                if (!bot3.voice.channelId) {
                    const axios = require('axios')
                    async function postData () {
                        let data = JSON.stringify(
                            interaction,
                            (_, value) => typeof value === 'bigint'
                              ? value.toString()
                              : value
                          )
                      console.log(data)
                    return
                }
}```Would these return statements even work?
earnest phoenix
#

Oh lord

lyric mountain
boreal iron
# near ether like this?

Also if the channel is the CURRENT one as I see, there’s a property called appPermissions showing you the exact permissions your app currently has in this channel

lyric mountain
#

show where you start the bot

eternal osprey
earnest phoenix
#

@lyric mountain you mean the console rn?

#

._.

boreal iron
earnest phoenix
#

._.

#

Help me when?

#

._.

boreal iron
#

Dude calm

earnest phoenix
#

._.

#

Ok like phone got heated up so got afraid

boreal iron
#

Can only deal with one at the time especially on mobile

earnest phoenix
#

But kept it on a fridge so it's ok now

earnest phoenix
#

I can understand

#

While paying out in my server

#

;(

boreal iron
#

Are you using djsv14 neelio?

earnest phoenix
near ether
earnest phoenix
#

Just sending

near ether
earnest phoenix
boreal iron
#

Then check the property app permissions
interaction.appPermissions

earnest phoenix
#

Just giving notes don't worry

boreal iron
#

It does return the permission but field incl. overwrites of the current channel the slash command has been executed in

near ether
boreal iron
eternal osprey
#

How do i check if a bot is in a vc

earnest phoenix
earnest phoenix
#

Right?

#

._.

#

I tested it that way

boreal iron
eternal osprey
boreal iron
#

Or could it be a missing intent and you’re missing the entire guild channel object

#

Hmm

near ether
#

but thats because im testing what my bot would respond under mismatched perms that other users might set

boreal iron
#

Means you have catch the promise

near ether
#

wait so that means a user could just spam slash commands and throw unavoidable api errors at my bot?

boreal iron
#

And recognize- ok I’m missing the permissions in that guild

near ether
#

ahhh

boreal iron
#

Of course bots still require permissions to perform actions

#

But webhook responses don’t require a send message permission

#

To respond to your interaction

boreal iron
#

But like I said you don’t need to fetch the channel and/or permissions

#

That’s what API now provides

solemn latch
#

Oh that's cool

boreal iron
#

That’s already some “days” old

boreal iron
near ether
#

how can i use the bitfield tho?

earnest phoenix
#

@boreal iron is this wat you are looking for (for me)

#

._. I am confused as I am new to coding

#

._.

boreal iron
earnest phoenix
#

Anyways I need to sleep so bye sorry to disturb man I appreciate your help I will come back tmrw

boreal iron
#

The resolvable however can be a lot of things but the easiest one might be the permission flags

#

You can import the PermissionsBitFlags enum from djs

#

Then using PascalCase as permission names as property

#

Like PermissionsBitFlags.ManageGuild

#

This can be passed as argument to the has() method

#

Also as an array

near ether
#

Ooooooo okay

boreal iron
#

Of resolvables

near ether
#

Sounds good! Thanks for the help man much appreciated 🙏

boreal iron
#

👍

earnest phoenix
#

@boreal iron now me?

#

._.

#

._.

#

..____..

boreal iron
earnest phoenix
#

I don't get it where are they

#

I am new to these stiff

boreal iron
#

Where’s your message event listener?

earnest phoenix
#

*stuff

earnest phoenix
#

._.

boreal iron
#

client.on(message => …

#

That’s the one I’m looking for

eternal osprey
#

how do i get guild by id?

#

in v14

earnest phoenix
#

I do have seen it

boreal iron
earnest phoenix
#

Probably no3

boreal iron
#

client.guilds.resolve(Id)

earnest phoenix
#

You telling to him or me

#

._.

#

visible confusion while learning how to code

boreal iron
#

Already see two message event listeners

#

3 now

earnest phoenix
#

This one (no19)?

boreal iron
#

Line 10, 19, 30

earnest phoenix
#

Ok lemme send

boreal iron
#

3 message event listeners

earnest phoenix
#

Oh wait

earnest phoenix
boreal iron
#

That’s not how it works

#

You only create one event listener then putting your code into it

#

You don’t create an event listener for each command

eternal osprey
#

Would i have to resolve members the same way?

#

So: js let member = client.members.resolve(req.body.data.member)

boreal iron
#

No

#

Those being fetched

eternal osprey
#

So client.members.fetch?

#

Bro where are the djs v14 docs lol

boreal iron
#

I might misunderstood you here

#

Do you only speak about resolving or fetching the member at all?

eternal osprey
#

Do you remember the little webserver we created? Well, it returns a member id. I want to fetch the member so i can let the bot join the vc

boreal iron
#

Ahh resolving the ID should be okay tho

#

Wait

#

Actually that’s a different client instance

#

But once the member has joined the channel it should be known

#

If you have the right intents enabled

#

So… resolveId(member id) should work, yeah

#

It should return a djs member object

eternal osprey
eternal osprey
#

client.members.resolve or client.members.resolveId

lyric mountain
#

holy fuck what was that code

eternal osprey
lyric mountain
#

the prints sent earlier

#

not even bae makes that many typos

eternal osprey
#

As i said i just made a wuick snippet and had to remove so many things in order to be sent lol

boreal iron
#

The new scale

eternal osprey
lyric mountain
eternal osprey
#

it's client.members.fetch(id) or am i wrong

boreal iron
#

I thought you’re speaking about a guild member?

#

A channel member

#

Wtf

eternal osprey
#

so we could use either one of those

boreal iron
#

Can’t you specify at least ONCE what you’re talking about exactly

eternal osprey
boreal iron
#

Client has no member property

#

What you want is to resolve a guild member

eternal osprey
#

interaction.guild.members.fetch would work then right

boreal iron
#

So <guild>.members.resolve()

#

In this case

#

You can also fetch the member yeah

#

Which searches the cache first

eternal osprey
#

i see

boreal iron
#

Oh wait I’m wrong here

#

You said you only have the member ID you pass to your second bot, right?

eternal osprey
#
  let member = interaction.guild.members.fetch('1008731369435840653')
      
    if(interaction.member.voice.channelId === member.voice.channelId){```So this would be right then? It would check if the member is in the same vc as the bot
eternal osprey
#

it's just the interaction object

boreal iron
#

Ah okay you need fetch then, yes

#

resolve would resolve an user resolveable or member object to a djs member object

eternal osprey
#

i see, awesome!

boreal iron
#

But fetch returns a promise

#

Don’t always forget about that

boreal iron
#

If it is the bot ID then use fetchMe()

#

You don’t have to provide the bot member ID then

boreal iron
#

No shit mmLol

crystal wigeon
#

anyone know how to use posix on postgres

#

?

#

im trying to pattern match starts with and ends with

#

~ ^(name1|name2) something like this, this only matches the "starts with"

#

is there a way i can match both? starts and ends?

lyric mountain
#

posix?

#

u mean regex?

sharp geyser
#

According to the docs they mention something like POSIX-Like-Regex

#

No idea what that means but I'm sure it's essentially just regex

boreal iron
#

Sounds like an ugly and limited brother of regex

#

Wtf you wanna do in a SQL table with regex what LIKE and a few % placeholders can’t do?

sharp geyser
#

Lmao

stuck dawn
#

has anyone worked with react-dnd?

sharp geyser
#

Nope

boreal iron
crystal wigeon
#

I don’t wanna use ilike

#

Cause I need to use comma separated

#

Values

boreal iron
crystal wigeon
#

Multiple values

#

“Similar to” operator

boreal iron
#

There’s no regex equivalent in SQL

#

Like you said

#

And isn’t needed

#

If you wanna dynamically set your WHERE clause then store it as string in a var and concat more conditions to it

#

For example in a loop

#

Or an user input

#

Try to formulate this question again

#

Hmm

#

I don’t ask

#

Your question is like what is car in steering wheel or what is planet in ocean

#

But I see you wanted to know if nodejs is available on rplit

#

We must be speaking two different languages I guess

#

Well idk

#

Never used that platform

oblique sky
#

just search on google
when you are asking for others, give them more details, they are not search engine and they cannot always remember everything or understand your question

lyric mountain
boreal iron
#

Just assumed you’re too lazy to type

#

Like most people in here

oblique sky
#

and yes, never ask "what is xxx" if you can easily found the result on internet

boreal iron
#

SIMILAR TO is similar to LIKE operator, except […]

#

I like it

#

Hmm I see just a thing in postgres

lyric mountain
#

it is basically an extension of LIKE that allows both LIKE placeholders and regex operators

boreal iron
#

Yeah already looked at it, seems to be a nice feature but not really needed

oblique sky
#

I am thinking about mongodb or postgresql, which one is more suitable for discord bot database

#

nosql sounds cool but i had never tried before

boreal iron
#

Depends on what and how you wanna store the data and which one you’re more familiar with

#

Known good SQL databases are usually highly scalable

oblique sky
#

Ok great, i guess i can start learning to use nosql such as mongodb, maybe it can be used at future

boreal iron
#

Might be pain to switch later if you haven’t really got into it

spark flint
#

@oak cliff

wheat mesa
sharp geyser
#

Or be like me and just never do that at all

#

And regret it at some point when you make a change to your tables or remove said tables

#

😎

winter tapir
#
import type { Awaitable, ClientEvents, RestEvents } from 'discord.js';
import { client } from '../bot';

type Events = {
  [Name in keyof ClientEvents | keyof RestEvents]: Name extends keyof ClientEvents
    ? ClientEvents[Name]
    : Name extends keyof RestEvents
    ? RestEvents[Name]
    : unknown;
};

abstract class BaseEvent<Name extends keyof ClientEvents | keyof RestEvents> {
  protected readonly client: typeof client;
  public readonly name: Name;
  public readonly description: string;
  public readonly once?: boolean | undefined;
  public readonly rest?: boolean | undefined;
  public constructor(
    name: Name,
    description: string,
    once?: boolean | undefined,
    rest?: boolean | undefined
  ) {
    this.client = client;
    this.name = name;
    this.description = description;
    this.once = once;
    this.rest = rest;
  }
  public abstract run(...args: Events[Name]): Awaitable<void>;
}

export class DebugEvent extends BaseEvent<'debug'> {
  public constructor() {
    super('debug', 'lol');
  }

  run(info: BaseEvent<'debug'>['run'] extends (arg: infer U) => any ? U : never) {
    console.log(info, this.client.ws.ping);
  }
}

export default BaseEvent;

Hello I am trying to automatically infer my event parameter types within the Event classes. My goal is that I don't need to add any types annotations to my DebugEvent's run function. Right now this thing works assuming I use the annotation BaseEvent<'debug'>['run'] extends (arg: infer U) => any ? U : never, which I want to remove, but if I do that, I get an implicit any error. How can I make my DebugEvent's run function infer the the type based on my event input name?

wheat mesa
#

Now that is some typescript fuckery if I’ve ever seen it

#

If you explicitly declare something as any, that “implicitly any” error goes away and leaves you alone

#

Though I’m only half awake so I’m not sure what you’re doing here

maiden urchin
#

I'm trying to update bot count but I've never used Python and theres no Lua examples on the Topgg API

#

What is the "bot" var in the python example for top.gg stats update example?

wheat mesa
#

The instance of your bot

maiden urchin
wheat mesa
#

What? I thought you were using Lua

maiden urchin
#

I am but to update bot count I was going to use PY. Top.gg doesn't have any lua libs

wheat mesa
#

You can’t just intermix two languages that easily

maiden urchin
#

And I have no clue how to interact with api directly

wheat mesa
#

But assuming you’re going to rewrite your bot entirely in python, just follow their docs

#

Otherwise you’re going to need to interact with the raw api with Lua (it’s not that hard)

winter tapir
#

So the parameter types would be Client<true> if my event name is called ready

#

and my parameter would be a type of string if my event name is debug etc

lyric mountain
#

from lua to python 💀

wheat mesa
#

upgrades people, upgrades!

willow aspen
#

So where does that put me who uses C#

#

Bottom of the barrel I presume?

sudden geyser
#

the damn floor

willow aspen
#

I'll live with the worms

boreal iron
#

Now I know what “down under” means

near ether
#

is there a way to respond to a slash command interaction without actually sending something?

#

instead of interaction.reply maybe interaction.acknowledge?

boreal iron
#

Unfortunately not, interactions meant to have a response

near ether
#

ah damn

tribal harness
#

You could reply and instantly delete the reply but that’s about it

boreal iron
#

You can technically respond with a defer but

#

The interaction will be shown as failed after 15 mins then

near ether
#

oof

boreal iron
#

Also the initial response will be the “bot is thinking” message

#

So… no you can’t

near ether
#

i used to have some admin cmds that would just react with ✅ when completed but now with slash commands i have to send a whole message deadInside

boreal iron
#

Well just reply with that emoji as message content

near ether
#

thats true

#

although imo the reaction is less clutter

boreal iron
#

Yeah

#

For personal responses, ephemeral messages are nice to use, too

near ether
#

yea i use those and i love em

boreal iron
#

They disappear anyways once the client closes its discord client

near ether
#

ephemerals are awesome

boreal iron
#

Aye

#

Anyways sleeping now

near ether
#

peace

#

gn

boreal iron
dense drift
#

Does anyone have any idea why discord won't give me the content of any messages? I believe I have the right intents enabled, and I have message intent enabled in the dashboard.

elder oxide
dense drift
#

Discord JS 14

#

This is on message deletion event

elder oxide
#

have you add GatewayIntentBits.MessageContent?

dense drift
#

I'm using IntentsBitField, is gatewayintentbits via js as well?

elder oxide
#

IntentsBitField is the same as GatewayIntensBits

dense drift
#

Gotcha, do you know where a list of these intents are?

elder oxide
dense drift
#

All I can find is the direct Discord one

elder oxide
#
export declare enum GatewayIntentBits {
    Guilds = 1,
    GuildMembers = 2,
    GuildBans = 4,
    GuildEmojisAndStickers = 8,
    GuildIntegrations = 16,
    GuildWebhooks = 32,
    GuildInvites = 64,
    GuildVoiceStates = 128,
    GuildPresences = 256,
    GuildMessages = 512,
    GuildMessageReactions = 1024,
    GuildMessageTyping = 2048,
    DirectMessages = 4096,
    DirectMessageReactions = 8192,
    DirectMessageTyping = 16384,
    MessageContent = 32768,
    GuildScheduledEvents = 65536
}
dense drift
#

but DJS uses camelCase

elder oxide
#

maybe "GuildMessages"?

dense drift
#

I'll give them a shot

#

MessageContent did it, thank you!

#

I wish there was an easy list to access in their guild 😦

#

Updating to 14 is a doozy

dense drift
#

thanks

elder oxide
#

that's what i did to make it partially work with djs 14

delicate shore
#

11|v6API | src/handlers/subHandlers/getJoke.ts(4,19): error TS2732: Cannot find module '../../localDatabase/jokes.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.

#

But I am already doing this??

elder oxide
#

show me tsconfig

delicate shore
#
  "compilerOptions": {
      "forceConsistentCasingInFileNames": true,
      "module": "commonjs",
      "resolveJsonModule": true,
      "esModuleInterop": true,
      "outDir": "./build",
      "rootDir": "./src",
      "target": "es6",
      "skipLibCheck": true,
      "strict": true
  }```
#

Problem is, this works with nodemon, like it runs perfectly, but the moment I try to run it through pm2 I face the above error

sharp geyser
#

you can't natively import json files

elder oxide
#

what

sharp geyser
#

TS doesn't support importing json files like that natively

#

Though the option he enabled should allow him

#

so that is weird

delicate shore
#

Yea

#

and it works if I run it with nodemon, but pm2 causes the error for some reason

sharp geyser
#

What exactly are you running with pm2

#

like what is pm2 being told to run

delicate shore
#

the server.ts file

sharp geyser
#

Why are you telling pm2 to run a uncompiled file

#

you could save yourself the trouble and compile it and have pm2 run the compiled script

delicate shore
#

I tried but compiling just gives me error on running as well

#

so I decided to save me some time

sharp geyser
#

What error?

delicate shore
#

wait I'll show

sharp geyser
#

If you can't even run the compiled version

#

thats an issue

delicate shore
#

There's some issues with dotenv

sharp geyser
#

dotenv isn't recommended to use in production anyway

delicate shore
#

Like process.env won't provide the keys

#

wait then what do I use? I have been using that for quite a while now

sharp geyser
#

dotenv is just a way to force your env file to load globally (iirc)

delicate shore
#

Well

sharp geyser
#

Me personally

#

I just use a normal ts file

#

and export my variables

delicate shore
#

oh

#

I mean I can try that

sharp geyser
#

e.g

export const token = ""
delicate shore
#

alright

sharp geyser
#

That's just me personally though you can use many other methods

#

hell I've used yaml files in the past :^)

delicate shore
#

damn

earnest phoenix
#

How do I give a better help cmd in my bot?

delicate shore
#

using a .ts file now it works

earnest phoenix
#

._.

sharp geyser
#

On a serious note, you can use buttons and or select menus

#

even the traditional reaction menu would work

earnest phoenix
#

Ok @sharp geyser tysm

crystal wigeon
#

i tried this, but i want the operator to match the first word or the middle word or the last word in the name

#

for ex: yusuke joker kamado if i search "joker" or "yusuke" or "kamado" this should match

eternal osprey
#

Hey guys

civic scroll
eternal osprey
#

Does anyone know any electron and js docs app in the AppStore?

civic scroll
#

google

eternal osprey
#

I would like to have a document to go in some sort of app, but ain’t to be found anywhere

civic scroll
#

not sure they actually write it to a pdf tho

rustic nova
#

just save the whole docs as a webpage

#

you can also just use a browser, we're in 2022

elder oxide
rustic nova
#

oh shit we at djs v12?

elder oxide
#

yes

#

actually

#

v-6

rustic nova
#

integer underflow

#

v1483979374389042809523

elder oxide
#

@rustic nova help i think my unix time is -1

rustic nova
#

skill issue much

radiant kraken
#

imagine still stuck in December 31, 1969

uneven heath
#

Is there any niftier way for me to do this permission checking in Discord JS v14?

#

They removed Guild#me so now I am left with this option

elder oxide
#

giiimme a moment

#

if (!guild.members.me?.permissions.has(PermissionFlagsBits.ViewAuditLog)) return;

uneven heath
#

That doesn't make it any better 😂

elder oxide
#

oh

uneven heath
#

God that is so long just to fetch the bot permission

elder oxide
#

just use

#

.me

uneven heath
#

Which is exactly what Guild#members does

#

Before v14 you can just do Guild#me

elder oxide
#

yeah unfortunealy

#

they removed it, that's the only way

uneven heath
#

o_-

#

I can understand the sentiment behind that but god damn the code readability T_T

elder oxide
#

damn, they nerfed the .me

uneven heath
#

Yeah

#

Precisely 😂

lyric mountain
#

regex is too expensive to waste it at that

grim aspen
low moat
#
        throw new Error(unrecoverableErrorCodeMap[error.code]);
              ^

Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
    at WebSocketManager.createShards (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:250:15)
    at async Client.login (C:\Users\Finn\mbot1\node_modules\discord.js\src\client\Client.js:232:7) {
  code: 'DisallowedIntents'
}

Node.js v18.7.0```

Im having a bit of a mare right now I just got finished fixing a bunch of errors then I got stuck on this error for a good hour now. I really hope it isnt asking me to apply for privileged intent and if it is I will uninstall discord and cry in the corner
grim aspen
lyric mountain
low moat
quartz kindle
#

lmao

#

what intent do you need?

solemn latch
#

does anyone know the max height of an embed image?

I found the width(400px max)

compact pier
#

I'm new to c++, I don't really know what the problem here

#include <iostream>
using namespace std;

class Player {
  public:
    bool type;
    string places = "";
    int wins = 0;
    int currentTurn = 0;
};

Player initPlayer(int type) {
  Player player;
  player.type = type;
  return player;
};

int main() {
  Player player1 = initPlayer(0);
  cout << player1.wins << endl;
  return 0;
};
low moat
ancient nova
lament rock
#

plus images I suppose since those add height

solemn latch
#

so there is no actual limit, its just capped to the embed max height?

lament rock
#

oh embed image. mb

#

never bothered to test

#

id imagine none because of aspect ratios

solemn latch
#

I might just send an embed with a very very tall image with a width of 400 and see what it caps at.

lament rock
#

would be a good idea

#

something like 8K or 16K

rigid maple
#

Thank you very much for this nice idea. I did it and everything works

lyric mountain
#

Nice

rigid maple
#

🧡

solemn latch
bright thorn
#

Umm any idea how we can choose lavalink server as per region in different different Servers

winged linden
#

need some help asap if possible

i store data of users in mongodb, if lots of users use the commands it does this

i also store total data for each user which updates total stats on each command

winged linden
quartz kindle
#

is that a mongodb response or a discord api response?

#

eitherway there is not much you can do, except reduce the amount of requests you make

winged linden
winged linden
solemn latch
#

you should be batching requests then

#

(sending requests as one group over a short period of time)

eternal osprey
#

Hey guys

#

how would i set an image as watermark background in electron>?

wheat mesa
#

Why

#

You don’t need a massive lib for that

#

Just have a counter and update it every x amount of time

eternal osprey
#

How do i check if a loop ended?

#
for(const key in splitted){```
#

so how do i check if the splitted is done

wheat mesa
#

It’ll continue on to the next thing after the loop

eternal osprey
#

I know.

lyric mountain
#

the loop will end when it ends

eternal osprey
#

But how do i know if the whole loop is done

wheat mesa
#

Because… it ends…

eternal osprey
#

Imagine there are 50000 items.

#

When do i know that it reached 50k items

lyric mountain
#

it'll end after 50k items

eternal osprey
#

I know

wheat mesa
#

It’ll end

#

My man

#

Lol

eternal osprey
#

I KNOW IT WILL END

lyric mountain
#

it starts with one...

eternal osprey
#

but is there any way to trigger some type of event

#

to notify me it's done looping

lyric mountain
#

yes

wheat mesa
#

It will continue on to the statements after the loop body

#

So just emit an event after the loop body

lyric mountain
#

simply put it outside of the loop

eternal osprey
lyric mountain
#

loops are all* blocking, which means the code will only continue after it's done

#
  • non-promise ones
eternal osprey
#

i thought that the code would run the rest before the loop would have ended

eternal osprey
lyric mountain
#

yes

#

in js it'll hang the entire runtime until it ends

#

in multithreaded langs it'll only stop the current thread

#

code is always synchronous unless you specify otherwise

eternal osprey
lyric mountain
#

js being js is monothreaded

eternal osprey
#

alrighty, thanks!

sudden geyser
#

monothreaded
🤨

#

never heard anyone say that, it's always single-threaded

earnest phoenix
#

Hey how can I set background colour for a website in replit?

sudden geyser
#

via the background-color property?

quartz kindle
lyric mountain
#

mono means "single" so...

pale vessel
#

You're mono

sudden geyser
old cliff
#

Tf is wrong?

#

Assembly btw

quartz kindle
#

Tello World

winged linden
#

Bruv i am not saving that kind of data.

lyric mountain
#

how do u know which commands are most used then?

civic scroll
#

so you are saying that you are using javascript with javascript

celest gate
civic scroll
# celest gate

the slash at the end indicates that you were trying to scan a directory, rather than a file

#

check if it's a directory before proceeding ```js
lstat(path).isDirectory

#

i forgot if it's callable or not

lyric mountain
#

she forgor 💀

civic scroll
#

please 😭

surreal sage
#

I'm trying to use a random port (2615) for a http server (nodejs/http)
It works fine with ips (ip:2615) but not with a url such as (example.com:2615)

I'm running this on Ubuntu 18

#

Nevermind

#

Seems something with Cloudflare

#

Routed doesn't work

ancient nova
surreal sage
near ether
#

when deploying global slash commands, do you need to do it every time you launch your bot? or just once (until you modify them)?

#

ahhh okay ty!

knotty quartz
#

I'm new to making buttons on Discord.Js language. I have this code so far, but when I click the button interaction fails.


module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping2')
        .setDescription('Replies with Pong2!'),
    async execute(interaction) {
        const row = new ActionRowBuilder()
            .addComponents(
                new ButtonBuilder()
                    .setCustomId('primary')
                    .setLabel('Primary')
                    .setStyle(ButtonStyle.Primary),
            );

        await interaction.reply({ content: 'Pong!', components: [row] });
    },
};```
earnest phoenix
ancient nova
surreal sage
#

And I have it like that

ancient nova
#

how do you get roundtrip ping again?

#

you send and edit the message then compare times right?

ancient nova
ancient nova
#

ok... is there any errors?

surreal sage
#

Nah

ancient nova
surreal sage
#

It's with Cloudflare I believe

ancient nova
#

hold on how are you connecting ur domain?

tawny sedge
#

anyone intrested in starting a collaborative bot project as I am eager to learn further on how to make one

#

also intrested in being involved in current projects

#

at any capacity

wheat mesa
#

I like the ambition but if you’re really interested in learning then just go ahead and jump right into it yourself, otherwise you might lose motivation without starting 🙂

elfin tulip
#

Hello,
How can I fetch last message from user DM's? I tried this, but it doesn't work:

const channel = client.channels.cache.get('471724955365801984') // DMS channel

const message2 = channel.messages.fetch({ limit: 1 }).then(messages => {
    var lastMessage = messages.first();
    console.log(lastMessage)
});
quartz kindle
#

define "didnt work"

earnest phoenix
wheat mesa
#

That code has nothing to do with your error lol

earnest phoenix
#

what should I do

wheat mesa
#

Add either a title, description, or fields to whatever embed you don’t have it on

#

Ah wait it’s to do with fields specifically

#

For fields you have to have a title and then a value for it, I don’t believe either can be empty

boreal iron
#

There we go… localizations has been rolled out

ancient nova
#

hello guys

ancient nova
#

I wanna add more modules to my bot, any ideas?

lyric mountain
#

what about stop adding more stuff and improve the already existing?

#

also, are u logging command usage?

#

to know what's used and what's not

ancient nova
ancient nova
#

my most used commands are snipe, editsnipe and whois

lyric mountain
#

wasn't snipe deemed a privacy concern by discord?

ancient nova
#

yeah but I made it so u can opt out if u want

#

that was deemed ok by discord when i talked about them when I verified the bot

lyric mountain
#

do you tell the user they can opt out?

#

like, inside the snipe msg

ancient nova
#

not inside the command, but inside the commands description

lament rock
#

I'd rather opt in than opt out

#

The out of box experience is important to end users

ancient nova
#

it would be hell for people to even use it

lyric mountain
#

but well, if you are tracking command usage, give it time to gather some metrics

#

then see what's most used

ancient nova
#

besides the snipe commands aren't malicious, meant to be fun

ancient nova
#

but I've got no ides how to improve snipe, and whois is already really improved

lyric mountain
#

how big is your sample?

ancient nova
#

let me show you

ancient nova
lyric mountain
ancient nova
#

I tracked ever since I created the bot so around 2-3 months

ancient nova
#

would have to check

lyric mountain
#

well, with that data you can check what's the most used an what's the least

ancient nova
#

those 3 are used at least a couple houndred per day

#

rest are.. in 10ths literally not a lot

#

and there is only 3 servers using the modules/plugins (and one of them is mine...) lol

#

@lyric mountain lmfao what...

#

how come discord allows u to have such large avatars but not embed them? wth

lament rock
#

Nitro user file restrictions are much larger

#

bots are limited to 5MB

quartz kindle
#

isnt it 8mb?

lament rock
#

is it

ancient nova
lyric mountain
#

bots are limited to 8mb yes

ancient nova
lyric mountain
#

but no user should have avatars higher than that

ancient nova
#

then home come this error popped up?

lyric mountain
#

are u doing some kind of resizing?

ancient nova
#

most likely... let me double check

#

I wrote this command at the very beginning when i made the bot, haven't edited it since

#

all I'm doing literally appears to be this:

avatarEmbed.setImage(member.user.displayAvatarURL({ dynamic: true, size: 1024 }));
lyric mountain
#

there's your answer

#

also, max size is 512

ancient nova
#

what should I set it to then?

lyric mountain
#

well, try smaller sizes?

ancient nova
#

@lyric mountain can you hack avatars as well?

#

is there an avatar property when u fetch users details directly?

#

I've seen some bots do that

silent field
#

Bruh

ancient nova
#

it would be quite a cool feature to have, no idea what you're laughing about

winged linden
#

question

#

whats the style for a decimal number modal

silent field
#

Looks like I third weekend here😀

winged linden
#

this but i want it to accept just a number

silent field
#

Weeled**

winged linden
boreal iron
#

Modals don’t support other field types (yet)

#

You have to validate the value yourself

#

And eventually open the modal again when a wrong value has been entered

ancient nova
lyric mountain
#

no and never will

ancient nova
#

okay I can at least use a button tho

#

right...?

lyric mountain
#

yes

boreal iron
#

Haven’t tested yet if you can respond with a modal to a modal interaction

solemn latch
#

I would hope so, but I've been told you cant

boreal iron
#

Damn… no trolling allowed

#

Sadness

elder oxide
#

Are there any symbolic math solver library in npm?

solemn latch
#

eval 👀

#

If you use math.js properly it works well.
but you need to spend time learning it, it does contain several crashes

wheat mesa
#

Just make your own

#

😉

solemn latch
#

imo math.js is the way to go.
super powerful

elder oxide
#

yeah, math.js work for one purpose

#

but another purpose is to find a variable from formula

#

so, for example.

#

V = IR

#

if I and R is defined, it will be fine

#

HOW EVER, if V and I is defined, then it will died

#

Currently, i am using nerdamer + mathjs

lyric mountain
#

Is there anyone who would use such functionality?

wheat mesa
#

Well if you’re having trouble figuring out your basic physics homework then maybe…

elder oxide
#

i mean i can use wolfram but that thing is scary

#

it was meant for more difficult formula anyways

lament rock
#

doesnt wolfram require a paid license

elder oxide
#

probably

civic scroll
#

just code your own

winged linden
boreal iron
#

That’s as user friendly as possible

#

Until other field types are available

boreal iron
#

Which will most likely never happen anyways

winged linden
#

Currently on mobile but thats how i did it

#

I wont respond with the modal again, they can just press withdraw again

boreal iron
#

Yeah makes sense in your case since the button is still available

sharp geyser
#

How should I go about doing a slide in-left animation for my side nav

#

I was thinking of initially setting it as hidden, but then I am stuck wondering how to make it appear from the left as if it is sliding in

dry imp
#

what are u making misty

sharp geyser
#

So I am really just practicing at this point

dry imp
#

oh

sharp geyser
#

@boreal iron do you know any css?

boreal iron
#

So what’s up?

sharp geyser
#

just having issues trying to figure out this side nav animation thing

#

There are so many ways to do it, and I can't think of a single one 😔

boreal iron
#

What do you wanna do?

sharp geyser
#

So essentially I wanna have it start out hidden, and be openable on click of a hamburger "icon"

earnest phoenix
#

._.

#

Like how to animate the counting or like fill up the info box

#

The letters are too small

#

:/

elder oxide
#

fix off center button

earnest phoenix
#

Ye I want to make them karger

earnest phoenix
sharp geyser
#

That box around the "Join our community now" just looks bad

#

It doesn't blend well with the background

boreal iron
sharp geyser
#

it just is there

earnest phoenix
#

It's glitched in I was coding the other boxes and it came out of nowhere

sharp geyser
#

But I can't seem to get it to even open normally without animations

boreal iron
#

Oh that’s easy

sharp geyser
#

Yea it would be

#

if it fucking worked

boreal iron
#

When clicking your icon you simply change the CSS display property to block

sharp geyser
#

simply

#

mhm

#

as if I haven't tried that already

#

😔

boreal iron
#

If you don’t wanna use animations

sharp geyser
#

It is not that I don't wanna use animations

#

I just simply can't even get it to reappear

#

so why would it work if I added animations

boreal iron
#

It really is simple, assign your hidden menu element an ID, get the element by its ID when clicking the icon and change its CSS property

sharp geyser
#

Okay but Fake

#

are you reading what I am saying?

boreal iron
#

Clicking it then again changes the property back to hidden

sharp geyser
#

I have ALREADY tried that

boreal iron
#

Ok if that doesn’t work you did something wrong okeh

#

I mean you can figure out what’s going on using the browser inspect tools

sharp geyser
#

Yea also looked at that

#

and its adding it

#

but doing nothing

boreal iron
#

What’s actually not working for you exactly? Changing the CSS property?

sharp geyser
#

I don't even know whats happening at this point. It changes the value of display, but still does nothing

#

It's like it isn't registering the change

boreal iron
#

It is assigned when using the inspect tools?

sharp geyser
#

From when I looked at it yes

boreal iron
#

Can you show how it “looks like” in your inspect tools?

sharp geyser
#

Yea I just gotta readd the code real quick

#

I tried smth different

boreal iron
#

Also when editing the CSS property directly without the click event, does it show up then?

sharp geyser
#

Okay so found the issue

#

😎

#

I was treating getElementById like querySelector where if you are searching for a class you need to use the respective prefix e.g .

#

so removing # from the id in the getElementById worked

boreal iron
#

Ah lol

sharp geyser
#

Also

#

Any idea on how I can hide the nav once I click outside of it's area of influence

#

I can probably use a event listener on a class that holds the main content of the page

#

and if its clicked and the display of the nav is not none I will hide it

boreal iron
#

Yeah you actually create an event listener for the DOM comparing on a click if you clicked anything in the container or not

#

the event itself contains the element you clicked as part of its properties

#

Also consider to use a var in your code saving the current opening status

sharp geyser
#

Actually that makes sense

#
import {Component, Inject, OnInit} from '@angular/core';
import {DOCUMENT} from "@angular/common";

@Component({
  selector: 'app-navbar',
  templateUrl: './navbar.component.html',
  styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent implements OnInit {

  constructor(@Inject(DOCUMENT) private document: Document) { }

  onClick() {
    const nav = this.document.getElementById('nav-container')!
    const hamburger = this.document.getElementById('nav-hamburger')!
    nav.style.display = 'inline-block'
    hamburger.style.display = 'none'
  }

  ngOnInit(): void {
  }

}

this is how I am currently doing it

#

I am treating this as if I am using vanilla js

#

😔

#

I could do this better

boreal iron
#

Make sure to also check if the clicked element (for example one inside your container) is a child of the container

#

To not falsely closing the container when clicking one of its children

#

Sadly can’t show you how I’m doing it atm from mobile but we can get back to this later this evening if you remind me

#

While I’m also working with native JS I’m also using jQuery especially for manipulating element’s CSS properties and for simple but neat animations

feral aspen
#
private void drawDialogueScreen () {
    int newLines = 0;
    if (currentDialogue.split("\n").length == 2) {
        newLines = 1;
    } else if (currentDialogue.split("\n").length == 3) {
        newLines = 2;
    } else if (currentDialogue.split("\n").length == 4) {
        newLines = 3;
    };
    int dialogueX = gamePanel.tileSize * 2;
    int dialogueY = gamePanel.tileSize / 2;
    int dialogueWidth = gamePanel.screenWidth - (gamePanel.tileSize * 4);
    int dialogueHeight = gamePanel.tileSize * (newLines + 2);

    drawSubWindow(dialogueX, dialogueY, dialogueWidth, dialogueHeight);
    graphics2D.setFont(graphics2D.getFont().deriveFont(Font.PLAIN, 21F));

    int textX = dialogueX + gamePanel.tileSize;
    int textY = dialogueY + gamePanel.tileSize;

    for (String line : currentDialogue.split("\n")) {
        graphics2D.drawString(line, textX, textY);
        textY += 40;
    };
};
#

Is there a better way to handle newLines?

pale vessel
#

The; first; step {
would; be; to; stop; putting; semicolons; everywhere;
};

feral aspen
#

I mean, I like semicolons. ;-;

pale vessel
#

Don't put them after brackets pls notlikethis

feral aspen
#

Alright, how about newLines?

#

I don't like how it's like == 2 then = x and etc.

pale vessel
#

Maybe ```java
int length = currentDialogue.split("\n").length;
int newLines = length == 2 ? 1 : length == 3 ? 2 : length == 4 ? 3 : 0;

feral aspen
#

I guess.

sharp geyser
#

😔

civic scroll
#

wait

#

is the element you are selecting

#

an angular component

sharp geyser
#

Wym

civic scroll
#

onClick

sharp geyser
#

I am simply selecting a span tag essentially

civic scroll
#

you can just do as state

sharp geyser
#
<div>
  <span id="nav-hamburger" (click)="onClick()" class="nav-hamburger">|||</span>
  <nav id="nav-container" class="nav-container">
    <ul>
      <li>
        Hello, World
      </li>
    </ul>
  </nav>
</div>

trying to figure out this stuff

#

so

civic scroll
#

and reflect it in the template

sharp geyser
#

bad html

sharp geyser
civic scroll
#

okay

#

so

#

on click this opens a menu right

sharp geyser
#

essentially yes

#

it makes nav-container not display: none

civic scroll
#
import {Component, OnInit} from '@angular/core';

@Component({
  selector: 'app-navbar',
  templateUrl: './navbar.component.html',
  styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent implements OnInit {

  constructor() { }
  isMenuOpen = false;
  onClick() {
     this.isMenuOpen = !this.isMenuOpen;
  }

  ngOnInit(): void {
  }

}

and in html template

<div>
  <span [style.display]="isMenuOpen ? 'none' : 'block'" (click)="onClick()">|||</span>
  <nav [style.display]="isMenuOpen ? 'inline-block' : 'none'">
    <ul>
      <li>
        Hello, World
      </li>
    </ul>
  </nav>
</div>
#

it's a shame that you still use document for manual element manipulation

#

smh

sharp geyser
#

listen here buckaroo

#

I am still new to angular

civic scroll
#

also

#

your code may result in render mismatch error

#

alright try it

#

by the way

#

there's even a cleaner way

#

nvm it's there

#

i forgot that the element must be there and not conditionally appears

sharp geyser
#

Omg

#

that works so much better

#

😔

civic scroll
#

if you want the element to only appear in the dom when matches certain conditions

#

you can use ngIf directive

sharp geyser
#

Does it matter where it appears and when

civic scroll
#

that depends on placement and layout

sharp geyser
#

Mmm

#

I was planning on having a container right next to where the navbar would be and have the navbar overlap the other content when it appears

civic scroll
#

say

<main>
    <login-form *ngIf="userIsNotLoggedIn"></login-form>
    <user-profile *ngElse></user-profile>
<main>
#

like this

sharp geyser
#

Yea that makes sense

civic scroll
#

you can use

#

the good old

#

absolute positioned box over relative navbar

sharp geyser
#

Mmm

civic scroll
#

or if it has heights

#

use gridbox

sharp geyser
#

Well the navbar covers the entire hight of the screen but only 20% of the width

civic scroll
#

ah that

#

i mean if the width of the box does not overflow viewport then it's fine

sharp geyser
#

I gotta find a way to animate the navbar coming out from the side tho

civic scroll
#

time to learn about angular animations

sharp geyser
#

I haven't used animations much

sharp geyser
civic scroll
#

yeah

sharp geyser
#

sounds like fun

civic scroll
#

it's boilerplate

#

💀

#

essentially you wanna define transitions

#

form void => * and * => void

#

void means the component is destroyed

#

make sure the parent is relative

sharp geyser
#

😔

#

this hurt my brain

#

time to put this off for tmrw

#

it is late

civic scroll
civic scroll
eternal osprey
#

How do i remove the whitespace between these 2

#

input an bnutton

stuck dawn
#

@civic scrolldo you pay for webstorm??

civic scroll
civic scroll
eternal osprey
# stuck dawn css?

body {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background-color: rgb(28, 31, 36)
}
h1{
    color: rgb(0, 136, 18);  
}
input {
    margin: 20px;
    width: 300px;
    height: 40px;
    border: none;
    border-radius: 7px;
    background-color: rgba(0,0,0,0.7);
    color: white;
    font-size: 18px;
   
}

button {
    margin: 20px;
    width: 300px;
    height: 40px;
    border: none;
    border-radius: 7px;
    background-color: #000000;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

eternal osprey
stuck dawn
#

its the button & input margin

civic scroll
#
input {
    margin-top: 20px;
    margin-inline: 20px; /* if you wanna retain horizontal margin */
}
stuck dawn
#

yeah

eternal osprey
#

thank you guys!

stuck dawn
#

or other code editor

#

I know it's an IDE but I want to know..

#

if you noticed a big change

civic scroll
#

like code completion and types

#

plus tools are like

#

native

#

they feel fast

#

while vscode relies on plugins

stuck dawn
#

hmm

pine nova
earnest phoenix
pine nova
#

oh

#

i see

#

thank u

elder oxide
#

i love how it's called "nullish"

earnest phoenix
earnest phoenix
# civic scroll what do you mean

I mean like the number 12.

I want it in the form of like one of those fancy big msg with some blocks so that I can fill that box in my web up

earnest phoenix
#

Oki

#

I was confused about that

#

Thanks

finite tartan
#

Is this here only js?

civic scroll
#

related to developement

finite tartan
#

ah okay ty

civic scroll
feral aspen
sudden geyser
#

Means something was null when it shouldn't have been

lyric mountain
#

IJ is quite smart regarding warnings, don't ignore them

wheat mesa
low moat
#
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');

module.exports = {
    name: 'console',
    description: 'Developer Mode!',
    voiceChannel: false,
    options: [
    {
        name: 'Code',
        description: 'A line of code you wish to execute',
        type: ApplicationCommandOptionType.String,
        required: true,
    }
    ],

async execute({ inter }) {
    const LineOfCode = ms(inter.options.getString('Code'));

    if ((inter.options) == 'test') {
    const embed = new EmbedBuilder()
    .setColor('#5679EF')
    .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
    .setTitle("💻 Console")
    .setDescription(`the test worked`)
    }

    else {
    const failembed = new EmbedBuilder()
     .setColor('#5679EF')
     .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 1024, dynamic: true }) })
     .setTitle("💻 Console")
     .setDescription(`the test failed`)
    }
},
};```

So, this is my code, I am very new to slash commands and v14 as a whole so all of this is extremely experimental and a guess to be totally honest. I tried using some of my knowledge of python to help me achieve this but it failed horribly.

I basically want it to work in a way where if you enter a certain string, it returns a certain message and when I ran the bot it basically crashed and sent a really long error message (which i cant paste here since it is so long)
lament rock
#

paste it in a txt file and upload that

low moat
sharp geyser
civic scroll
#
<element [@AnimationName]></element>
sharp geyser
#

Mmm ok

lament rock
#

Sorry that was a bit harsh

#

you already gave the code, so I don't need it twice

neon leaf
#

Does someone know how to get Username from a UserID in discord.js v14? example 745619551865012274 turns into 0x4096#7678

quartz kindle
#

fetch the user

eternal osprey
#

hey guys

#

I have a download button made in html

#

how do i make people download the folder inside the code's directory?

#

When clicking on that download button

#

isn't there a method to link href to ./folder?