#development

1 messages · Page 2041 of 1

boreal iron
#

How speedyos and mail doing? smirk

#

Still no php support?

split hazel
#

optimised too many things at once without testing them

#

havent worked on it recently

#

speedymail is going good

#

i have worked on it 2 hours ago

#

almost done

#

just need to set up mail transferring, incoming mail, some buttons and settings pages

#

it uses my database which is the best part

#

when i need to use something i just add it to my database on the go

lament rock
#

Infinity is a number

#

NaN is a number

split hazel
#

0 is a number

wheat mesa
#

we love void******************************************************************************************

split hazel
#

that's a lot of pointers

split hazel
#

probably just garbage memory

wheat mesa
#

pointer roulette

quartz kindle
#

imagine

#

bogo sort

wheat mesa
#

when will it reference Mozart 😉

quartz kindle
#

with pointer defererencing garbage

real phoenix
#

This event doesn't send the message on leave.

Event:

@client.event
async def on_member_remove(user):
  channel = client.get_channel(702285223634927626)
  await channel.send("Oh no! Eggman convinced" + user + " to quit! We'll make him pay!")

Error:

File "main.py", line 35, in on_member_remove
    await channel.send("Oh no! Eggman convinced" + user + " to quit! We'll make him pay!")
TypeError: can only concatenate str (not "Member") to str
#

Can someone explain how to fix it?

wheat mesa
#

user is a Member object, the error says you cannot concatenate a string and a Member object

proven lantern
#

Python doesn't know that people actually want to see [Object object]

real phoenix
#

so how would i fix this?

slender thistle
#

USE F-STRINGS PLEASE

real phoenix
#

ooh

#

im an idiot

#

ty

slender thistle
#

If you str() a User object, you get their username#discriminator representation

real phoenix
#

ok

turbid geyser
#

any database recomendations?

solemn latch
#

it depends on your goals.

turbid geyser
#

i use mongodb rn

#

just wanna use something different.

solemn latch
#

postgres is very different

#

and I like it

turbid geyser
#

ty

proven lantern
#

is there a library that has the fromNow function like moment.js has, but just that function?

craggy pine
#

I mean if that’s all you want is that specific function then why not copy pasta it and make a function of your own?

proven lantern
#

i just made that

#

now it's this

pale vessel
#

use number === 1 ? "" : "s" instead since 0 should be plural

proven lantern
#

0s

#

dang!

#

oof

pale vessel
#

wait 1 is truthy so your code doesn't even work as intended

#

nvm

#

was looking at seconds lul

proven lantern
#

this is what i have now

cinder patio
#

I'd do this cause it's cleaner

let time;
if ((time = diff / ...) > 1) {
   const ... = Math.floor(time);
}

for some reason eslint doesn't like variable assignment inside if statements

#

But that makes it a lot cleaner IMO

proven lantern
#

perhaps...

#

if assignments are weird though

lyric mountain
proven lantern
#

i'll get a java applet setup to do this

#

java applet run warnings aren't too bad

lyric mountain
#

Location: Removed

#

What?

proven lantern
#

the internet has no location

lyric mountain
#

Sometimes I wish someone made a react-like framework for groovy, it'd be a perfect language for making sites

#

Can benefit from java beefiness while being as dynamic as js (sometimes more)

proven lantern
#

someone has probably made something that transpiles to groovy to js at least

#

maybe someday

blazing umbra
#
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Response>".] {
  code: 'ERR_UNHANDLED_REJECTION'
}```
lyric mountain
#

Catch ur promises

#

Other than that, that error doesn't say much besides "you're not handling your requests"

sharp geyser
#

but what if I wanna catch u instead 😳

#

ok im outta here

lyric mountain
#

👉👈

craggy pine
#

Catch these hands

sharp geyser
#

ok as long as I can hold em after

craggy pine
spark flint
#
embed.add_field(name="OTHER INFO", value=f"Channel: {message.channel.name} (`{message.channel.id}`)\nInvite link: {inv}\nGuild owner: {message.guild.owner} (`{message.guild.owner.id}`) [[Avatar]({message.guild.owner.avatar_url})]\n\n[Jump to this report!]({message.jump_url})", inline=False)
AttributeError: 'NoneType' object has no attribute 'id'```
#

python moment

peak fox
#

I am stuck trying to firgure out what to add to me boy

#

my bot*

wheat mesa
#

Focus on one topic, too many general purpose bots exist already

peak fox
#

Ik, its used as a moderation bot, It has majority mod commands with report, and suggestion and welcome being an extra as well as a who is command. But I feel as it needs to be better but dont know what to add

quartz kindle
peak fox
#

I can send a photo of my help command one sec

peak fox
#

They dont errorbut they dont do anything

split hazel
#

💀

round cove
#

I doubt it and I haven't seen it before, but is it possibly for the bot to edit it's own description? Not status, description.

split hazel
#

I don't know how topgg changes the bots avatar automatically but my theory is that it's a self bot

round cove
#

Bot pfp is easy to change with just d.js but I have not seen desvription

split hazel
#

o

quartz kindle
#

desvription

slender thistle
spark flint
#

I DO

#

thats just the console log

slender thistle
#

NO YOU DON'T

#

Oh okay

#

Yeeheehee guild owner go swoosh

spark flint
#

yeah i got rid of that and it worked

slender thistle
#

Poggers

spark flint
#

i use djs now as i prefer it lots

#

so much faster

#

this is a bot i'm staff on and i'm the primary dev atm

#

because the other devs have exams (i mean so do i but i still dev)

slender thistle
#
f"{f'Guild owner: {message.guild.owner} (`({message.guild.owner.id})`)' if message.guild.owner else ''}"
#

Because fuck you

slender thistle
#

Smh procrastinator

spark flint
#

lmao

lament rock
#

does anyone know if there's a way to get the bitrate of an audio file without probing the metadata

#

ultimately using this data to approximate the track length and probing the metadata of the file can take a bit of chunks until it reaches the data I'm looking for

simple stump
#

I'm trying to download a base64 image using axios, but whenever I send a request it returns null. I'm hosting a web server using ExpressJS, and getting the image base64 is fine. However, sending a request to download the image from base64 results in an error. The error I get is getaddrinfo ENOTFOUND image, with the url starting with data:image/jpeg;base64 since the image I'm sending a request to is in base64.
EDIT:
Fixed:

let data = file.split(",")[1];
let buffer = Buffer.from(data, 'base64');
fs.writeFileSync(path, buffer);
return;
crystal wigeon
#

hey

#

how do i check if bot has permissions

#

to send/view message

sharp geyser
#

<Guild>.me.permissions.has iirc

crystal wigeon
#

message.guild.me.permissions?

sharp geyser
#

yep

crystal wigeon
#

alr thanks

#

how do i check if the bot has permissions to send message in a channel?

sharp geyser
#

There is a permissionIn method iirc look it up on the docs I don't remember how it's used

crystal wigeon
#

thanks

pallid zinc
#

can anyone suggest some alternatives to electron which dont use chromium ?

split hazel
#

uh

#

windows forms

crystal wigeon
#

someone help

#

my bot is being rate limited. i have a lot of users..

#

does djs provide some monitoring tool to see all the outgoing and incoming request response from discord?

#

429 responses are avoided by inspecting the rate limit headers documented above and by not making requests on exhausted buckets until after they have reset. 429 errors returned with X-RateLimit-Scope: shared are not counted against you.

#

also can someone explain what this means

pallid zinc
#

Thanks ✨

crystal wigeon
#

how do i check if i can send a dm to a user?

#

is there a method? similar to "editable" "deletable"

boreal iron
#

I don’t think so

#

You don’t know the user’s privacy settings before trying to send a message to him

#

So.. try/catch is your only option here

feral aspen
#

If I want to start learn web hosting, should I start with Apache or Nginx? (excluding difficulty)

crystal wigeon
#

i read that discord.py has this implemented within the library

boreal iron
#

djs should handle rate limitations itself

#

Once you’re getting rate limited requests should be cached and sent when the rate limit is over

solemn latch
#

Correct me if I'm wrong, but djs won't cover all scenarios for ratelimits.

On a sharded bot some things may slip through and a ratelimit may occur.

For example, fetching users on two seperate shards may result in hitting the ratelimit.

split hazel
#

,

quartz kindle
#

,

royal portal
#

,

crystal wigeon
#
    Global  : true
    Method  : patch
    Path    : /channels/938065409368784896/messages/977925891843850240
    Route   : /channels/938065409368784896/messages/:id
    Limit   : Infinity
    Timeout : 2000ms
    Sublimit: None
Hit a 429 while executing a request.
    Global  : true
    Method  : patch
    Path    : /channels/660050649324453889/messages/977925873107861534
    Route   : /channels/660050649324453889/messages/:id
    Limit   : Infinity
    Timeout : 2000ms
    Sublimit: None
Hit a 429 while executing a request.
    Global  : true
    Method  : patch
    Path    : /channels/761762086619447357/messages/977925870129930292
    Route   : /channels/761762086619447357/messages/:id
    Limit   : Infinity
    Timeout : 2000ms
    Sublimit: None```

Im seeing this message in the debug event. im not sure what do i do with this
#

this is not even dms. let sending messages to channels..

#

how do i handle thousands of users EMJ_jerrycri

solemn latch
#

oo, global ratelimits 👀

crystal wigeon
#

so.... whats going on? EMJ_jerrycri

#

im completely lost

#

is it because too many users are using the bot?

solemn latch
#

I dont think so, do you automatically do something per channel?
ie sending a message or something automatically every few seconds?

crystal wigeon
#

yeah

#

i edit a message after 1 sec

#

or 1.5 sec

#

its like, i show a game then edit the status every 1 - 1.2 sec

solemn latch
#

thats very likely what's giving you the rate limit.

crystal wigeon
#

multiple users can invoke this game

solemn latch
#

you can send 50 requests per second, if you are doing something every 1 second automatically then 50 users is a global ratelimit

crystal wigeon
#

what do you recommend i do in that case, increase the patch delay?

#

i see

#

well how do i regulate in that case

#

what do i do

#

is there a way i can get discord to increase this limit?

#

there are atleast 1k traffic coming in

solemn latch
dry imp
#

i mean 50 req at the same time is very unlikely

solemn latch
#

well, if you are doing 1 edit per second per game.
and you have 50 games, thats the ratelimit

crystal wigeon
#

well the debug logs are saying something else

#

yeah

crystal wigeon
#

but how do i solve this

earnest phoenix
#

hi

solemn latch
#

its hard to say, I dont know how the bot works.
editing a message every second is generally a bad idea, even for one off things.

crystal wigeon
solemn latch
#

1.5 seconds or 2 seconds will give you more room to prevent ratelimits, but it still will get ratelimited pretty fast.

#

1.5 seconds will give you 75 active games before ratelimiting.

#

2 seconds will give 100 games before ratelimiting.

crystal wigeon
#

How about I tweak them some bts 1.5 some 2

#

That way I can squeeze in 175games

#

That’s still too less

#

Cause daily I see at least 1k activity

#

More than 1k

#

How much does the rate limit reduce by? If I contact discord support.

solemn latch
#

its fine for a temporary fix, but I'd look at alternatives.

what kind of data is in the message you are editing?
if the data is the exact same between two edits, are you not editing(wasted api requests)?
If its a minor change in stats maybe wait to edit until its more major?

solemn latch
crystal wigeon
#

The description is updated every 1.2sec with the new status

solemn latch
#

lets say I'm playing the game, and no one interacts with the game for 7+ seconds. are you still editing every 1.2 seconds/

#

does it make sense to edit during that time?

crystal wigeon
solemn latch
#

What about a more dynamic system?

crystal wigeon
#

I’ll send a video hang on

solemn latch
#

update less when no players are interacting for a bit.

#

every 5-10 seconds of no interactions slow down the rate of edits

crystal wigeon
#

Well here’s an example of how it plays out

solemn latch
#

A lot of this honestly could just be replaced with dynamic gifs.

#

all of this could be done with zero edits

crystal wigeon
#

Elaborate?

#

you mean. I create gif. With everything played out?

solemn latch
#

yeah

crystal wigeon
#

But when the game ends the gif will still be playing no

solemn latch
#

gifs can have loops disabled

crystal wigeon
# solemn latch yeah

I had the same idea. It’s just that technical thing I have to over come now cause I’ve never worked with gifs before XD

#

I see

#

Can I put a canvas in a gif

#

Well the battle will mostly last for like 30seconds

#

Max

#

Hopefully

solemn latch
#

nodejs?

crystal wigeon
#

yep

#

Nodejs

solemn latch
crystal wigeon
#

Step 1

#

Thanks uwu

#

But

solemn latch
#

Just be aware, youll need to be very efficient with your canvases to do this at any kind of scale.

crystal wigeon
#

How do I create discord emotes inside gif

#

Yeah I’ve optimised my canvas so far

#

It loads 10x fast and consumes 100x cpu less now

solemn latch
#

all discord emotes can be fetched from discord and added to a canvas

crystal wigeon
#

Share links?

solemn latch
#

for what? emoji's?

crystal wigeon
#

Will the nitro thing not affect tho? If I can fetch all emotes from discord

#

Yeah

#

So I have like upload emotes to a private server

#

The used the “/“ to get its id

#

And rendering it in the embed

#

Adding it in description

#

And discord automatically resets the right emote

solemn latch
#

https://cdn.discordapp.com/emojis/969844935434059797.webp?size=48&quality=lossless
^ url for an emoji

crystal wigeon
#

Thanks

#

So what do I do as a temporary fix

solemn latch
#

just increasing the time between edits will solve the issue for awhile.

crystal wigeon
#

Aight thanks.

#

I need to figure out how to efficiently use canvas with text and image damn

#

Creating huge canvas is an issue

solemn latch
#

One of the most important things is making the base layer, and using that base layer as much as possible.

crystal wigeon
#

Understood.

#

Thanks a bunch. I’ll give it a try.

#

I was gonna move the entire battle system into website cause i already have the computational power

#

But hey atleast now I know what path to follow to fix the problem. Thanks a bunch. Cheers

#

I still wonder how the other bot does it tho AEMJ_roosterlaugh

#

They also edit every 1 - 1.5sec

solemn latch
#

maybe using webhooks?

crystal wigeon
#

how

#

possible, i've never explored webhooks on discord embeds

solemn latch
#

webhooks are functionally the same, but dont use your bots token.

crystal wigeon
#

will that not cause rate limit?

solemn latch
#

I'm not sure how editing ratelimits works though when editing through an application.

Webhooks generally speaking have their own ratelimits

crystal wigeon
#

so messages sent my webhooks can be edited

solemn latch
#

a webhook created by an application can be edited by that application

crystal wigeon
#

i see. also another thing. so when multiple users even initiate the game. there also more than 50+ requests are made no?

solemn latch
#

well, each webhook is on its own ratelimit bucket

crystal wigeon
#

not taling about webhook here

#

normal requests

#

there will be more than 50+ POST req in this case

solemn latch
#

if you're editing 50+ times there will be 50+ post/patch requests yeah

crystal wigeon
#

no no, just sending 1 embed. i wont edit at all

solemn latch
#

then its just one

crystal wigeon
#

even then i would be hit with rate limits, cause there are 1k users requesting for the game embed?

solemn latch
#

eventually no matter what youll hit the ratelimit when using prefix commands.

#

if you use interactions and only respond to that interaction youll never hit it

crystal wigeon
#

so if i do interaction.channel.sendmessage. i'll still the limit?

solemn latch
#

yeah, much further down the line than you are now though

#

Its one of those issues you wont face for a very long time

crystal wigeon
#

i'd still run into the same problem with interactions, cause then if im editing the embed sent via interactions. it would still be 1.2sec per patch. more users req for game more edits etc.

solemn latch
crystal wigeon
#

i mean, that's one part of the solution.

#

im just looking if there's another way to stall this until i fix the problem

#

if using slash commands will slow this down then its only 1 line away for me to enable them

solemn latch
crystal wigeon
#

but if the edits are still gonna hit rate limits. no point in doing this. rather i'd just send 1 embed with all battle status as temporary fix

solemn latch
#

the only ideas for temporary fixes I have is
1: increase the time between edits, increase the damage done in a single hit to make the games last the same length but dramatically decrease the number of requests.
2: show all info in one message.
3: queues, have a cap of 40 active games. if 40 games are active and someone runs the command put them at the end of the queue.

crystal wigeon
#

gotcha, thanks

#

really helpful discussion, thanks a lot Prayge my doubts are cleared

crystal wigeon
#

and the second thing is. im supposed to send a victory message after the gif reaches the last round or if the player loses

#

etc

solemn latch
#

The victory/loss message should be something you can include in the gif if you really wanted to.

crystal wigeon
#

well its more of a dependency

#

there are rewards etc if the player wins etc. i know i can handle this internally cause i already have th result

#

but what if the player abandons the battle

#

by deleting the embed

#

its a forfeit

#

need to propagate these as well

solemn latch
#

🤔 can bots detect deleting of embeds?
or do you mean the message itself

spark flint
#

yes they can

crystal wigeon
#

the message itself

#

hmm

crystal wigeon
solemn latch
#

if its deleted you should be able to send a message just like normal.

#

that part really shouldnt change

crystal wigeon
#

so back to the original question then. if i scroll down the gif stops

#

which means the battle would stop

#

the players will have to look at the gif for it to complete which isnt a good experience

#

lmao

solemn latch
#

so the concern is that users have to watch the fight?

crystal wigeon
#

also using queues wont work. imagine there are 40 battles on going and a lot of other players will have to wait. and the queu size might increase to a lot. and cause there lot of players. many players might not even get a chance to battle

solemn latch
#

^ better than it not functioning at all

crystal wigeon
solemn latch
#

zero people playing vs 40 people is better right?

crystal wigeon
#

not really cause that'll make others not play at all

#

you know

#

imagine im the 50th guy and i have to wait for 1 bt to end which is about 30 secs.

#

it creates a butterfly effect

#

from 50th guy to a guy who's queueing at 100th or 1000th

#

i know i'll add a cap to the queue

#

but just doesnt seem ideal

solemn latch
#

vs everyones game stop working randomly while using it

crystal wigeon
#

yep, i get that.

#

i'll probably show battle rounds temporarily

#

and move to my own website

#

no rate limits there

quartz kindle
#

do you need to show every frame of the battle? you could skip frames

crystal wigeon
#

it helps them identify a strategy

quartz kindle
#

for example instead of
move 1, move 2, move 3, move 4, move 5
you could do
move 1, move 2, move 3+4, move 5

#

when it rate limits

#

you skip sending one, and send two at once on the next frame

crystal wigeon
#

ah that. yeah sometimes i do move 4 + 5

solemn latch
#

That seems like itll become an issue though, dealing with a global ratelimit like that while sharding.

crystal wigeon
#

yep

#

i guess getting more requests will atleast help keep the rate limit to a minimal

#

cause the other bot that has similar functionailty works flawlessly

quartz kindle
#

its not a problem if you hit the global rate limit every once in a while

crystal wigeon
#

well they do have limitations like 1 battle per channel

quartz kindle
#

djs will stop sending requests when it hits it

#

you just need to handle the backpressure

crystal wigeon
#

yeah. well until djs starts dropping the connection after too many global rate limit hits

#

thats when i see "connection reset" to discord api in my error logs

quartz kindle
#

because of the backpressure

#

the delay that djs adds causes a build up of queued requests that is never cleared

#

so you need a mechanism to stop or merge requests when you hit a delay

crystal wigeon
#

hmm

#

how do i do that? right now im logging requests from the apiResponse and debug event

#

well debug event just returns the string

quartz kindle
#

one way is to monitor your outgoing promises

crystal wigeon
#

monitoring wil just say i hit rate limit of 2secs

quartz kindle
#

for example have a global queue of promises and do something if it gets too big

crystal wigeon
#

how do i handle is the question

#

hmm

quartz kindle
#

another way is to use the rate limit event to add a global pause thingy

crystal wigeon
#

how would i do that

solemn latch
#

thingy, the best technical term.

crystal wigeon
#

well its our language indeed

quartz kindle
#
let pause = false;
client.on("rateLimit", data => {
  if(data.global) {
    pause = true;
    setTimeout(() => pause = false, 2500);
  }
});

// command code
moves = [];
interval(() => {
  const move = calculateMove()
  moves.push(move)
  if(!pause) {
    data = createRequest(moves);
    moves = [];
    send(data)
  }
})
``` something like that for example (very pseudocode)
#

the rateLimit event controls a global pause switch

#

and depending on this swich, the battles will either immediately send the next state, or add the next state to a list and send them all at once later

crystal wigeon
#

ah well. this can cause the battles to skip rounds.

quartz kindle
#

no, the rounds are not skipped

crystal wigeon
#

ah its a event loop block

quartz kindle
#

what is skipped how the round is shown to the player

#

instead of the player seeing every move as a separate edit, they will sometimes see 2 or more moves in a single edit

crystal wigeon
#

well i can still do that by pushing 3 rounds and making the edit call

#

that way. they'll see round 1 + 2, 3 + 4 and so on

quartz kindle
#

yes

crystal wigeon
#

thinking from user experience it'll take away the element of surprise AEMJ_roosterlaugh

#

cause they already see whats gonna happen next round

quartz kindle
#

basically its a way to do that dynamically, ie when the bot is not active, you can afford to show all moves separately, but when you have a lot of activity, you cant afford that

solemn latch
#

I really dont think a perfect solution exists.

crystal wigeon
#

mostly

quartz kindle
#

its like a lag mitigation system

crystal wigeon
#

ig. i can play around with this

quartz kindle
#

for example imagine you have a game with a fixed frame rate of 1 frame per second

#

but then the game lags

crystal wigeon
#

so i track how many requests i have in a global variable

#

hope it doesnt cause overflows

quartz kindle
#

the player will see a 2-3 seconds pause, but the next frame will still contain all the previous updates

#

so the actual game wont lag, only the display will

crystal wigeon
#

mhm. yeah lets see .. thinking..

quartz kindle
#

essentially, discord is your screen, and it has a very bad frame rate

#

so your game still runs at full speed, but will have to chose to only show specific frames

#

it cant show all frames because the display is not fast enough to show them

crystal wigeon
#

whats the character limit on embed description

quartz kindle
#

2k i believe

solemn latch
#

2000

crystal wigeon
#

ah nice. ig i can play with this and see how it goes

#

thanks peeps

lament rock
#

6000 if you use multiple fields

ember zephyr
#

hey

#

I need help on smth

#

is there a way to get the module.name directly from the module itself?

#

I mean

#

example:

module.exports = {
  name: "hello",
  run: async(...) {
    const name = someHowGetModuleName;
    console.log(name);
  }
}
lament rock
#

using nodejs. Do any of you know how I can request from a specific ipv6 if I have an ipv6 block

#

nvm. Seems like I just need to supply the family: 6 and localAddress options to http

fathom sonnet
#

people, is it posible to get label content on the buttons in djs, this is code i currently have: ```js
const { SlashCommandBuilder } = require('@discordjs/builders')
const { MessageActionRow, MessageButton, Message } = require('discord.js')
const { quiz } = require('../json/quiz.json')
const { prefix } = require('../json/config.json')
module.exports = {
data: new SlashCommandBuilder()
.setName('quiz')
.setDescription('Displays general informations about the quiz.')
.addSubcommand(subcommand =>
subcommand
.setName('programming')
.setDescription('Start programming quiz')
)
.addSubcommand(subcommand =>
subcommand
.setName('math')
.setDescription('Start math quiz')
),

    async execute(interaction, client) {
        try {
            if(interaction.commandName === 'quiz') {
                if(interaction.options.getSubcommand() === 'programming') {
                    const row = new MessageActionRow()
                        .addComponents(
                            new MessageButton()
                                .setCustomId('secondary')
                                .setLabel('A')
                                .setStyle('SECONDARY'),
                                new MessageButton()
                                .setCustomId('secondary2')
                                .setLabel('B')
                                .setStyle('SECONDARY'),
                                new MessageButton()
                                .setCustomId('secondary3')
                                .setLabel('C')
                                .setStyle('SECONDARY'),
        )
                    interaction.reply({content: `
                    What will be output of the following code:

Code:
```js
let divSelector = document.querySelector('div')

divSelector.classList = 'myDiv'
divSelector.innerHTML = 'Hello World'
```

A) JS will add class name myDiv to the selected div and add 'Hello World' inside it.
B) JS will add class name myDiv and throw error
C) JS will Throw error
`, components: [row]})

                    const filter = i => i.customId === 'secondary';

                    const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 })
                    
                    collector.on('collect', async i => {
                        if (i.customId === 'secondary') {
                            await i.reply({ content: `Your choice was: **${i.label}**\nCorrect!`, components: [] })
                        }
                    })
                    
                    collector.on('end', collected => console.log(`Collected ${collected.size} items`))

                }
            }
        }
        catch(err) {
            console.log(err)
        }
    }

}

proven lantern
#

is there some way to conditionally define fields in an object literal without mutation?

lament rock
#

No

proven lantern
#

sad times

lament rock
#

a key can be anything weirdly enough

proven lantern
#

for WeakMap

lament rock
#

dunno why types say string | number | symbol

lament rock
#

pretty sure you can have class instances and such as keys in Objects

#

weird class

proven lantern
#

you can do this with it

cinder patio
#

Why are u using WeakMap

proven lantern
proven lantern
cinder patio
#

You can set the value to undefined instead of the key

#

it's still there but it's undefined so it shouldn't really bother you

proven lantern
woeful pike
#

but like don't do that lol

proven lantern
#

good idea

fathom sonnet
#

any1 have idea why this error occured?

sharp geyser
#

what nodejs version are you running

fathom sonnet
#

18.0

#

but thing is that i dont even use it

#

and it dropes error on place where it shouldnt

sharp geyser
#

sapphire uses it in their code

#

Honestly as a rule of thumb (at least for myself) I never use an unstable version of nodejs

vivid fulcrum
#

confirm that you're using 18.0

#

that feature has been available since node 15.0.0

sharp geyser
#

yea, unless they changed it in 18>

vivid fulcrum
#

they didn't

sharp geyser
#

I didn't think so

vivid fulcrum
#

languages never remove operators

sharp geyser
#

true

fathom sonnet
#

ahh thats ym friends error, I told him to try to update onode or downgrade to 16.15 if error continue... but i have diferent question. How can I send message to selected channel with using slash commands?

something like message.channel.send()this is what i have for now

earnest phoenix
fathom sonnet
#

ouu tnx man

#

yep, got this error...

earnest phoenix
#

channel not msgChannel, read the documentation.

fathom sonnet
#

yea, but i want to send msg to selected channel, with using channel u send message to current one

earnest phoenix
#

As you're getting the channel from the options, the msgChannel variable should already be a channel, so just call the send() method on it, such as msgChannel.send()

fathom sonnet
#

ah yea that worked, tnx a lot man

rustic nova
#

ello to the python devs

how do I create a dictionary that is static, but still being able to add values to it?

What my current plan is: Start a session for something, add specific values (such as an object) to that dictionary to then later access that dictionary again to find said object

#

yes I'm somewhat-ish new to python so I'm likely not aware of any other ways to do that that doesn't involve a database (remote or local) or a json file for that

spark flint
#

been a while since i've used by properly, but i believe its ```py

somedictionary = {}

#to add data
somedictionary["somekey"] = "something"

#to access
somedictionary["somekey"]```

#

i think i might be misunderstanding but yeah

slender thistle
#

You just create a dictionary somewhere and then use it

rustic nova
#

Yeah, though issue is:

The object I'm trying to store is both using the dictionary and has the actual class in it, so I'm basically just facing circular imports, unless I'm doing something wrong

#

So I'd basically have 2 files:

data.py: Includes the dictionary, imports class (the Verification.py) that is used for the object, dictionary will include said object/class
Verification.py: Has the class structure, has a method that accesses the dictionary within the data.py to add/modify/delete sessions

which then results in the circular imports

#

pfp me related

#

If I'd have the dictionary within the Verification.py, it would just reinitialize everything that was in the dictionary and essentially clear it

spark flint
#

you lost me at "So I'd basically have 2 files:"

#

i am shit at python so 1 file everything lmao

rustic nova
#

I'm 🤏 close to actually doing that

#

like, in Java I basically had "static", whats the equivalent of that in python?

#

in js its const right? or nah?

spark flint
#

yeah

#

i was never taught much about variable types for python in school lmao

rustic nova
#

actually slowly figuring out what I'm stupid at

initializing a new class object also initializes the variable i set, if I only reference the class, it should stay apparently?

slender thistle
#

Hold on

#

How do you work with a non-static dictionary from data.py

rustic nova
#

basically with just verification_list = [] to create an empty dictionary

#

assuming thats probably wrong since that would also reinitialize on each reference

#

omfg nevermind

#

Yup that did the trick iara_ded_lost am literally pfp

slender thistle
#

lol it's fine

quartz kindle
#

#relevant

rustic nova
#

istg yes

dry imp
#

cant relate, my code always works on first try

sharp geyser
#

@lyric mountain wanna see my bad java code?

#
            Message msg = ((MessageReceivedEvent) event).getMessage();
            String content = ((MessageReceivedEvent) event).getMessage().getContentDisplay();
            if(!content.startsWith("!")) return;
            String[] args = content.substring(1).split(" ");
            String commandName = args[0];
            HashMap<String, BaseCommand> commands = new HashMap<>();
            TestCommand testCommand = new TestCommand();
            commands.put(testCommand.getName(), testCommand);
            BaseCommand cmd = commands.get(commandName);
            if(cmd != null) cmd.run(msg, args);
#

This is how i handle executing commands

#

If you or anyone knows a better way please do tell I wanna learn

quartz kindle
#

so much hype around undici and i keep running into issues with it >.>

#

i should just stick with http then

sharp geyser
#

What issues have you ran into?

quartz kindle
#

randomly getting 'UND_ERR_SOCKET' now

#

had to add a retry loop

sharp geyser
#

I see

quartz kindle
#

yeah ive already read that

sharp geyser
#

ah ok

#

I haven't seen anything else about it

quartz kindle
#

in my case its happening randomly, the above issue is not random, its an https issue

sharp geyser
#

yea

sharp geyser
#

knew it

wheat mesa
#

DONT FUCKING USE JAVA WHEN U DONT KNOW dblMod dblMod dblMod dblMod dblMod

sharp geyser
#

I am trying to learn

wheat mesa
#

FOR A DISCORD BOT NO

sharp geyser
#

5head

wheat mesa
#

Do not learn Java with a discord bot

sharp geyser
#

I mean it only makes sense for me shrug

#

WELL WHAT AM I SUPPOSED TO DO

wheat mesa
#

DO SMALLER PROJECTS UNTIL YOU UNDERSTAND JAVA

sharp geyser
#

LIKE WHAT 5HEAD

#

I have no idea what to do so I can use the things java offers to accomplish my goal

#

a discord bot seemed obv to me as I can learn more about inheritence, interfaces and maps and shit

wheat mesa
#

JUST EARLIER U WERE TRYING TO MAKE ARRAYS AS Array<String>

#

NO

#

Well designed discord bots in Java use a lot of magic to work

#

A lot of reflection

#

Reflection is something to stay far away from until you actually understand Java

sharp geyser
#

Ok then instead of yelling at me give me something you've done to learn java

wheat mesa
#

Think of something, make a school, make a hotel, something simple until you understand the basics

sharp geyser
#

Ight ima go build a school brb

#

ok jokes aside

lyric mountain
wheat mesa
#

A discord bot in Java is quite complex

lyric mountain
#

It's almost black magic

sharp geyser
#

Like what we were going to do in asp

wheat mesa
#

Good idea

#

Don’t bother with a GUI yet though

sharp geyser
#

but instead it will be in the console

wheat mesa
#

Yes

sharp geyser
#

fuck that

#

GUI sounds pain

wheat mesa
#

GUI in Java is kinda pain, I can only speak from experience with swing though

lyric mountain
#

It got better when lambda became a thing, nowadays it ain't THAT bad anymore

sharp geyser
#

I assume when making a 'char' type i just use char right?

lyric mountain
#

Ye

#

You almost never gonna use it

#

Unless ur using charAt

sharp geyser
#

Even for 1 letter should I use string?

lyric mountain
#

No, but you rarely need a single letter

#

What jdk version btw?

sharp geyser
#

17

lyric mountain
#

Make sure to enable ZGC then

#

It's miles better than G1GC for most stuff

sharp geyser
#

How would you enable that

lyric mountain
sharp geyser
#

Thanks

wheat mesa
#

(Not gonna be too important for beginner projects though, dw)

sharp geyser
#

I went ahead and did it anyway

lyric mountain
#

Btw, ur using intellij right?

lament rock
#

what jvm ver is ZGC

#

I need to tune my mc server flags

wheat mesa
lyric mountain
#

He started right then

lyric mountain
#

It is the sucessor of ShenandoahGC

#

It does improve stuttering a LOT on mc, especially with many mods

#

Since zgc was created for environments where gc pauses are unacceptable

fiery stream
#

ayy yo

#

what language is the best for windows

#

best to design a app ig

#

C# forms seem way to complicated

#

is there anything like swiftui but for windows

lament rock
#

cs was made for windows and if you know TypeScript syntax, you can get really familiar with C#

fiery stream
lament rock
#

Aren't all languages until you get used to them

fiery stream
#

i mean ion like the drag n drop designing thingy i like to code my design html swift ui n stuff

lament rock
#

I managed to make a Unity game in a week with no prior experience with C#

fiery stream
#

damn was it a 2d game or 3d

wheat mesa
#

in fact it's highly recommended that you DONT use the designer

#

write the XAML by hand, it's basically HTML but better

fiery stream
#

after finding out alot of professional companies use electron

wheat mesa
#

C# is literally built for windows but choose what you're comfortable with

#

C# is made by microsoft for microsoft lol

fiery stream
#

ik but i gotta have to learn XAML n stuff

#

n do you need something like css for XAML

#

like is XAML just a structural lang or design too?

wheat mesa
#

both

#

resource dictionaries are essentially XAML's CSS

#

which are also made in XAML

#

just don't use winforms

#

outdated asf

fiery stream
#

i was using winform it looked ugly n then yuh

wheat mesa
#

use a framework like avalonia or xamarin forms or MAUI

#

I think those are the most modern choices

fiery stream
#

are the paid ?

wheat mesa
#

Even WPF is a good experience, but still a bit outdated

#

no lol

fiery stream
#

i heard sum C# framworks are paid

wheat mesa
#

I have never heard that anywhere

fiery stream
#

is it the first one

#

or should i do blank app

wheat mesa
#

please never ever use .NET framework

#

always use .NET Core

lament rock
#

is there a reason for that

fiery stream
#

uhh there no (.NET core)

wheat mesa
#

.NET Framework is old

fiery stream
#

in the entire list

wheat mesa
#

doesn't support higher versions of C#

#

usually only used by legacy projects or companies with stupid framework requirements

fiery stream
#

so its this one ?

wheat mesa
#

yes

#

you can use WPF

fiery stream
#

should i used latest or long term support

wheat mesa
#

uh

#

.NET 5 is definitely not current

#

install the most recent version of .NET

fiery stream
#

i just installed visual studio tho..?

wheat mesa
#

visual studio is not .NET

#

install .NET 6

#

use that

fiery stream
#

just sdk or do i need runtime too

wheat mesa
#

both probably

#

not 100% sure

#

sdk might include runtime

fiery stream
#

its included

wheat mesa
#

yes

#

do just the sdk then

fiery stream
#

it didnt show up :/ i think i might have to restart imma just use 5.0 its prolly gonna be supported for a year ig

fiery stream
#

ighhhh

#

@wheat mesa this is dope thanks for the help

wheat mesa
#

np

simple stump
#

I'm trying to remove certain scripts from HTML using Cheerio. However, when returning the processed HTML, certain scripts are still there.

let html = await this.getHTML(arr[0]);
        
let $ = cheerio.load(html);
const linkObjects = $('script');
const links = [];
linkObjects.each((index, element) => {
  if ($(element).html().includes("https://some_script/tag.min.js")) {
    $(element).remove();
  } else if ($(element).attr("src") != undefined && $(element).attr("src").includes("https://some_script/tag.min.js")) {
    $(element).remove();
  } else if ($(element).attr("src") != undefined && $(element).attr("src").includes("https://google_site.com/")) {
    $(element).remove();
  }
});
return $.html();

Ex.

<html>
  <body>
    <h1>My site</h1>
    <script src="https://google_site.com/">
    </script>
    <script>
      (document.createElement('script'), 'https://some_script/tag.min.js', 5093079, document.body || document.documentElement)
    </script>
  </body>
</html>

edit: fixed im dumb i messed up some basic stuff.

        $("script").each((index, e) => {
            if ($(e).html().includes("...")) {
                $(e).remove();
            } else if ($(e).attr("src") != undefined && $(e).attr("src").includes("...")) {
                $(e).remove();
            } else if ($(e).attr("src") != undefined && $(e).attr("src").includes("...")) {
                $(e).remove();
            }
        })
earnest phoenix
#

are NSFW commands are allowed ?

earnest phoenix
#

yeap

#

but if they are used in nsfw channel

dry imp
#

they are allowed, but dont mention them on your top.gg bot page

earnest phoenix
dry imp
#

yea its allowed but refer to the message above

earnest phoenix
#

then why serveral bots get denied when they have NSFW commands ?

dry imp
#

they either:

  1. dont lock them behind nsfw channel
  2. nsfw of minors, etc.
  3. mention nsfw cmds and stuff on their bot page
earnest phoenix
#

kk

#

means we can apply if the bot has NSFW commands ?

#

but we have to show in bot page

dry imp
#

you cannot show or mention any nsfw commands on your bot page

earnest phoenix
#

no as an alert that this bot has NSFW command

dry imp
#

cmiiw but iirc i dont think you can mention it aswell, just hide the nsfw commands on the normal channel and then unhide them if they are used on nsfw channels

earnest phoenix
#

hmm ok

#

thx for the help

crystal wigeon
#

Hey Tim, woo ping me when you guys are here please. So like I’m not sending the battles at all just showing the end result. But even then I’m hitting rate limits which cause the bot to not respond in some channels for a while not 1 hour rate limits. @quartz kindle @solemn latch sorry for pings EMJ_pray

#

Any solution for this

#

There’s no more edits per second. I’m hoping slash commands will resolve this?

celest gate
uneven geyser
#

how can add this?

sharp geyser
gray scarab
#

Ping me pls

sharp geyser
#

no

#

that is weird

dry imp
dry imp
sharp geyser
#

no

dry imp
#

that is weird

gray scarab
#

I need help I donated on wrong account

spark flint
#

I'm trying to regex match to detect domains

#

but its only returning the root domain, not any paths

#

returning discord.gg instead of discord(dot)gg/pizzas

#

(censoring as its a malicious guild)

sharp geyser
#

Simple solution ban any person who has sent pizzas in their messages mmLol

spark flint
#

i'm building an endpoint for my API to scan message

sharp geyser
#

Mmm I was going to say just censor all invites unless they have perms to post em but then you'd have the issue of discord.com/invite

spark flint
#

yeha

sharp geyser
#

and you say you can't get the full path so hm

spark flint
#

i'm specifically blocking malicious guilds

#

it works for scam domains

#

but because this is a path i'm looking for its harder

sharp geyser
#

without a regex

spark flint
#

i store known domains in a json

sharp geyser
#

Ah

#

I wish I could help tbh but I suck at regex

spark flint
#

oh same

sharp geyser
#

they have a lot of regex patterns

#

I found this one specifically

#

It might work for ya

spark flint
#

yeah i#m messing around on there

#

but then that won't work for urls in general

sharp geyser
#

Wdym?

#

Do you want it to work for all urls?

#

discord or not?

spark flint
#

yeah

#

as its detecting scam urls too

sharp geyser
#

Mmmm that is where my brain stops working

spark flint
#

lmao

sharp geyser
#

I have no idea how you'd even attempt to detect that

#

My only suggestion here is to block all links that match a simple link regex

spark flint
#

lmao that regex failed

sharp geyser
#

check for common tlds https/http, etc

spark flint
#

it matched pizzas join here

#

instead of discord.gg/pizzas

sharp geyser
spark flint
#

my regex works for detecting regular urls

sharp geyser
#

Is this project open source?

spark flint
#

will be soon

sharp geyser
#

Well do you realistically need the path?

spark flint
#

well yeah

sharp geyser
#

What for?

spark flint
#

theres a difference between dlscord(dot)gg and discord.gg

#

dlscord and discord

sharp geyser
#

sorry my brain is fried 2am moments

spark flint
#

i need the path becaues i'm blocking specific invites known for scamming

#

lmao

sharp geyser
#

I tried making a regex and failed so ye not sure ima be much help lest I mislead ya

spark flint
#

lol

#

i got it working

#

(thanks atRavy)

sharp geyser
#

Sweet

crude merlin
#

Hi,

client.user.setActivity({
    name: "🔴 Live Music",
    type: "LISTENING",
  });

this is my code for a bot. the bot doesn't display this status for some reason. I've never experienced an issue like this. someone help ty

spark flint
#

got it working properly now

sharp geyser
#

Sweet

earnest phoenix
#
client.on('message', async message => {
  if(!message.content.startsWith(prefix) || message.author.bot) return;
  const args = message.content.slice(prefix.length).trim().split(/ +/);
  const command = args.shift().toLowerCase();
   if(!message.member.hasPermissions(`MANAGE_ROLES`))return message.lineReply(`**You Don't Have \`manageroles\` Permission** :haahha:`);
 if(!message.guild.me.hasPermissions(`MANAGE_ROLES`))return message.lineReply(`**I Don't Have \`manageroles\` Permission** :haahha:`)
  if(command === 'mute') { 
  let mute = message.guild.roles.cache.find(role => role.name === 'Muted');
  let user = message.mentions.members.first() || message.guild.members.cache.get(args[0])
  let member = message.guild.member(user);

  if(!user) return await message.lineReply(new MessageEmbed().setColor('RED').setTitle(`Error:`).setThumbnail(client.user.avatarURL()).setTimestamp().setFooter(message.author.tag,message.author.avatarURL()).setDescription(`**Warning:** Pls Mention an user To Mute.`));
  if(!mute){
    await message.guild.roles.create({
    data: {
      name: "Muted",
      color: [],
      permissions:[]
    }
  })
    await message.lineReply(`**Making Muted Role ....**`).then(msg => {
      msg.edit(`**SuccesFully Created Muted Role Please retry** `, 1000)
    })
  }
 const embed = new MessageEmbed()
           .setColor("#28FC03")
          .setDescription(`** ${user} has been Muted from the guild ** :white_check_mark: `)
     const embed2 = new MessageEmbed()
           .setColor("RED")
          .setDescription(`**Failed To Mute ${user} :x:** `)
  try {
  await member.roles.add(mute)
  await message.lineReply(embed)
  }catch (err) {
    console.log(err)
  }
  }
});```
#

is there an error here ?

#

it says

#

(node:3404) UnhandledPromiseRejectionWarning: TypeError: message.member.hasPermissions is not a function

earnest phoenix
earnest phoenix
#

Then why don't you upgrade?

earnest phoenix
#

Discord.js v12 will stop working eventually, so I'd recommend updating

earnest phoenix
#

That's a bad practice to not prepare and update just when it stops working but okay, you do you

#

The method is called hasPermission() not hasPermissions()

earnest phoenix
#

oh alright it worked

#

ty @earnest phoenix

wheat mesa
lyric mountain
slender thistle
#

I sense another ADHD fella here

dry imp
crystal wigeon
#

nop

dry imp
#

weird

#

hmm

crystal wigeon
#

i mean there are lot of users

#

im thinking it doesnt work in some channels cause of this.

#

which is causing rate limit

#

how do i contact discord for this

#

i contacted discord support

pallid zinc
#

you can't bypass rate limite, discord rate limit are per server ig so u can limit the amount of battles in a server

crystal wigeon
#

this what they replied

#

i mean, im not even doing the battles anymore

#

im directly sending the end result

#

everything is post request now.

#

except for the buttons which have paginations

#

but those are slow anyway

pallid zinc
#

No edits?

crystal wigeon
#

when many peeps keep typing the commands its being rate limited ig.

#

yeah 1 edit per 1 second thing

#

i removed that

#

before i used edit something every second until it ended

#

thats not the case anymore

pallid zinc
#

U should try to limit the battles then, like 1 battle in a server at a time

crystal wigeon
#

dude the battle literaly ends in 1 sec

#

there is no more battles

#

for example. if i type prefix attack it doesnt show the battle. it sends the end result

#

so only 1 api call is made

pallid zinc
#

5 anything per 5 seconds per server

#

Is ratelimit

crystal wigeon
#

yea ik that

#

so im making sure everything has a delay

pallid zinc
#

Mostly people add cooldown thing in commands

#

And for premium no cooldown

#

Like u cant spam the same command in same server like that

crystal wigeon
#

ik

#

i've added 3 sec global cd

#

its just that the number of users are more

quartz kindle
crystal wigeon
#

ye

crystal wigeon
safe sigil
#

Hello i get a BITFIELD_INVALID Error. Does anyone has a fix for me?

const Discord = require('discord.js');
const client = new Discord.Client({ intents: ["GUILDS", "GUILDS_MESSAGES"] });
const auth = require('./auth.json');

client.on('ready', () => {
     console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
    if (msg.content === 'hello') {
        msg.reply('hi!');
    }
});
client.login(auth.token);
quartz kindle
safe sigil
spark flint
#

anyone in the team with admin can verify

#

oh

#

ah

quartz kindle
# crystal wigeon any suggestions

how big is your bot? how many commands do you get per second? add a way to measure the number of commands per second your bot executes

crystal wigeon
#

well there’s like 50 commands but the most company used are few like 5 or so.

#

And the bot is pretty big. 22k users but there like 17k active users

#

well I’m logging the api request and response and checked the time stamp. There’s quite a lot requests in a second

#

When there’s influx ofc

#

It varies

rustic nova
#

Has to be resubmitted, just editing the invite link is not allowed

dry imp
#

some of them could be a troll that purposely spams the api

earnest phoenix
crystal wigeon
#

Yeah

#

3 sec cool-down

lyric mountain
#

flutter forces usage of 2-space indent

#

I'm utterly disgusted and my day is ruined

quartz kindle
crystal wigeon
#

Per player

quartz kindle
#

you need to implement both per player and per channel cooldowns

crystal wigeon
#

Hmm

quartz kindle
#

are you still hitting globals?

#

even after you stopped updating?

crystal wigeon
#

No more globals no more 1 hour soft ban. Just hitting rate limit which locks the channel for fee seconds

quartz kindle
#

ah then its fine

crystal wigeon
#

Few*

quartz kindle
#

just implement a per-channel cooldown

crystal wigeon
#

no like it’s happening too often

#

Mmm

#

Ig I’ll try that

#

1 second should be enough tho right?

#

Per channel

quartz kindle
#

its 5 per 5 per channel

crystal wigeon
#

Yeah 5 request in 5 seconds

#

I send a req in 1 channel. Set a cool-down for 1 sec before sending the next command

wheat mesa
#

4 space indent forever!

quartz kindle
crystal wigeon
#

How would you do it

#

Accumulate number of commands and wait when it reaches max?

quartz kindle
#

on command, get channel id, check if cooldown exists for that channel id, if it doesnt create it and set it to auto delete after 5-6 seconds
increment the counter for that channel id, if it reaches 4/5 send an error message telling people to wait x seconds before trying again

crystal wigeon
#

Gotcha, thanks

spark flint
#

how can I make that image on top of the image blur

#
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://capy-cdn.xyz/tailwind.css"></link>

    <style>
        body {
            background-color: black;
            margin: 0;
            overflow: hidden;
        }
        .songImage{
            z-index: 5;
            opacity: 1;
            filter: blur(0px);
                    -webkit-filter: blur(0px);
                    -moz-filter: blur(0px);
                    -o-filter: blur(0px);
                    -ms-filter: blur(0px);
                margin: -5px -10px -10px -5px;
        }
        .bgBlur {
            background-image: url("https://picsum.photos/1920/1080");
            opacity: 0.5;
            filter: blur(8px);
                    -webkit-filter: blur(8px);
                    -moz-filter: blur(8px);
                    -o-filter: blur(8px);
                    -ms-filter: blur(8px);
                margin: -5px -10px -10px -5px;

            height: 100%;
            
            background-position: center;
            background-repeat: no-repeat;
            background-size: cover;
            z-index: 10;
        }
    </style>
</head>
<body>
    <div class="bgBlur">
        <div class="flex justify-center items-center h-screen text-center">
                <img src="https://evidence.blacklister.xyz/no-evidence.png" class="songImage">
        </div>
    </div>
</body>
</html>
#

ignore the random ass image url, its just a placeholder

celest gate
#
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: \\?\E:\Users\Bravish\Downloads\ReeF-V-Ultra\node_modules\canvas\build\Release\canvas.node is not a valid Win32 application.
\\?\E:\Users\Bravish\Downloads\ReeF-V-Ultra\node_modules\canvas\build\Release\canvas.node
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (E:\Users\Bravish\Downloads\ReeF-V-Ultra\node_modules\canvas\lib\bindings.js:3:18)
    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) {
  code: 'ERR_DLOPEN_FAILED'
}
celest gate
#

npm i canvas ?

compact pier
#

try npm rm canvas

#

npm i canvas

wheat mesa
celest gate
#

idk it's my friends error but

wheat mesa
#

Tell him to delete his node modules folder and run npm i

celest gate
#

package lock.json too right ?

wheat mesa
#

If all the packages he needs are in his package.json, then it should work

#

No don’t delete that I don’t think

#

Node modules folder should be enough

celest gate
#

ok

wheat mesa
#

Wouldn’t hurt I don’t think though

lyric mountain
#

gods of programming, please forgive me for I have sinned

wheat mesa
#

lmfao

lyric mountain
#

(it's either comma-ended lines or having everything in the same line)

#

stupid google formatting standard

wheat mesa
#

Staircase to hell

lyric mountain
#

ah that's cuz I'm doing front-end, this is the layout

#

what I meant is that now I started using comma to end lines

#

cuz google enforces a fixed flutter formatting

lyric mountain
#

with comma after each line I can force it to break line

#

else I get everything in an awful semi-inline format

lyric mountain
lyric mountain
#

holy fck making layouts is messy af

wheat mesa
#

Yeah

#

Frontend is kinda pain, especially when coming from backend

#

It seems like a lot of redundancies

split hazel
#

someone needs to make a framework which integrates the backend and front end PERFECTLY

#

every framework i've used feels like they're both detached from each other even when thats the frameworks aim

ancient nova
#

why doesn't the role check work?

sharp geyser
#

Why are you using a ternary operator in it

ancient nova
sharp geyser
#

you could just use ||

ancient nova
#

also how do I prevent, say an moderator muting the owner

#

I have to check for role hierarchy

sharp geyser
ancient nova
#

damn I forgot that existed

sharp geyser
ancient nova
#

say a mod should not be able to mute an admin

#

can u how do you check for the hierarchy? I know there is a way to because I remember doing that in discord.js v11

sharp geyser
#

Check role positions

ancient nova
#

how?

sharp geyser
#

compare the person's highest role's permission against the person being muted highest role postion

ancient nova
#

na I would compare the authors highest role to the person being muted

#

but how do I get the number in the first place?

sharp geyser
#

That is what I just said

#

smh

sharp geyser
ancient nova
#

can you just tell me what it is please

sharp geyser
#

If you know what you need to access the look it up in the docs, people really need to learn how to read documentation 😔

ancient nova
#

I use discord.js

sharp geyser
#

😔

ancient nova
#

I just found something

#

I can just do

#

member.manageable

#

does that work?

sharp geyser
#

I mean sure

#

but that won't work for the person using the command

#

that only checks if the bot has the ability

ancient nova
#

oh

#

I could add an && to check for both the person executing and the bot

sharp geyser
#

sure

#

do what ya will

ancient nova
#

let's hope that does the trick

sharp geyser
#

Just a tip, if you are using manageable and something related to the person using the command and returning an error message, it might be helpful to put you or the bot is lower

ancient nova
#

@sharp geyser the check if the person has the role still doesn't work

sharp geyser
#

what is the two variables you made

#

what are their values

ancient nova
#

the mute command itself works fine so not sure why it doesn't work

sharp geyser
#

I wanna know what those position vars are

#

not that

ancient nova
#

which position vars?

#

the position check works, the role check doesn't

#

it always returns true

#
        if (member.roles.cache.some(role => role.id === roleToMute || role.name === roleToMute)) {
            return message.channel.send("The member is already muted.");
        }
``` this line is what doesn't work
sharp geyser
#

Oh I misinterpreted my bad

ancient nova
#

so any idea why it might not work?

wheat mesa
#

I have never seen as much regex used in a discord bot as you’ve used

#

I do and always will complain about that :c

ancient nova
#

it's just so useful sometimes

#

but more importantly WHY DOES IT NOT WORK 😭

wheat mesa
#

Perhaps it would help if you tried logging things and giving more context than “it doesn’t work”

#

Hint: it’s hard to read regex all the time in every inch of your code, personally I don’t want to help debug constant regex use

ancient nova
#

that is why I comment almost every line of my code

#

I literally can not fix that

wheat mesa
#

Comments are your INTENDED effect, it might not be working like your comments say

#

Otherwise it would work perfectly

#

And you can fix it by thinking of actual solutions to problems and not just defaulting to some obscure regex for everything mmLol

ancient nova
#
        if (member.roles.cache.find(role => (role.id === roleToMute || role.name === roleToMute))) {
            return message.channel.send("The member is already muted.");
        } else {
            const authorHighestRole = message.member.roles.highest;
            const memberHighestRole = member.roles.highest;
        
            if (member.manageable && authorHighestRole > memberHighestRole) { 
                member.roles.add(roleToMute);
            } else {
                return message.channel.send("Could not mute the person, because you're lower in the hierarchy than the muter.");
            }
        }
``` this entire line doesn't work, there is no regex there
#

why does it not work

#

it doesn't check for the highest role properly, always allows muting, and doesn't check if the person is muted even though the code is already there

#

every variable I deliver there is working so no need to check any code that has regex in it

#

can you please tell me why this doesn't work now?

spark flint
#

tailwind html <div> <h1 class="text-white">00:00</h1> <div class="h-3 relative max-w-xl rounded-full overflow-hidden"> <div class="w-full h-full bg-gray-200 absolute"></div> <div class="h-full bg-green-500 absolute" style="width:10%"></div> </div> <h1 class="text-white">03:59</h1> </div>

ancient nova
#

using CSS @spark flint

#

style="left: 100%;"

#

or something along those lines

#

prolly better to do it with element align

#
document.getElementByClassName("text-white").style = "left: 100%;";
``` here is JS if you need
sharp geyser
spark flint
#

the two timestamps

sharp geyser
#

I haven't used much css but couldn't you use a flex and or grid system here?

spark flint
#

I'll try now

lament rock
#

This is for NodeJS. Does anyone know how to overwrite a specific line for a function and then have it compile inside of a scope outside of the current scope? Example would be monkey patching a function of a module I do not control

quartz kindle
lament rock
#

damn okay

quartz kindle
#

thats what i did with djs lol

solemn latch
#

for djs lite?

quartz kindle
#

ye

#

depending on the situation, you can override the function and then call the original function from inside your override

#

but in some cases you have to replace the entire thing

lament rock
#

Yeah nah. I'm replacing all of the http calls necessary to add ipv6 support and conform to my api

#

so I'll just override entire functions and not worry about calling base function

quartz kindle
#

ye

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

c# shrimp

austere surge
#

sharp shrimp

quartz kindle
dry imp
#

any good async mariadb python package?

quartz kindle
#

if you didnt receive a dm about it, you might have dms disabled, in which case you can search in #mod-logs for your mention or user id

pearl verge
#

hey

#

i wanna ask if i made a bot like milrato and modified it a lot and gave the real developer credits in the top.gg description , about me of bot , botinfo command, etc

#

will it work?

#

or will the bot get declined

quartz kindle
# pearl verge or will the bot get declined

it will be accepted if any copy you make is undetectable, ie if you copy code from another source, it has to be modified enough so that nobody can guess you used said source

pearl verge
#

but the credit is given to real developer

quartz kindle
#

like

#

you your bot cant be a blatant copy of another bot, in terms of features

#

you can have the same features, but the commands cant be exactly the same down to word by word

pearl verge
#

hmmm

#

oh u mean command name cant be same?

quartz kindle
#

the entire feature, command name plus response, plus credits, etc

pearl verge
#

hmmm

#

so i can remove credits ig?

quartz kindle
#

basically, there kinda is a list of well known open source bots that people commonly copy from

pearl verge
#

ik

quartz kindle
#

and the reviewers usually check if your bot looks like an exact copy of one of them