#development

1 messages Ā· Page 61 of 1

charred nest
#

LOL

quartz kindle
#

i hate doing rewrites

charred nest
#

it wasnt hard but it was just so much

quartz kindle
#

its been 3 years since i started my api rewrite and its still not done

rose warren
#

I wanted to cry before I started and then I started and enjoyed it darkAYA

quartz kindle
#

and its constantly eating me in the back of my mind

rose warren
#

Implementing slash commands, djs lib update, switching to postgres and cleaning up the code + adding extra features.

#

It was actually fun

charred nest
#

i had to move to pooling

#

and

lyric mountain
#

I like doing rewrites, allows me to apply newer techniques which could never be used on the old codebase

charred nest
#

slash cmds

#

and ez premium claim

lyric mountain
#

I just wish I had someone else to help me migrating the cards

#

1000+ cards, each done manually

#

one day I'll finish

charred nest
rose warren
#

Oof

#

What do you have to do with them?

lyric mountain
#

me?

rose warren
#

Yeah

lyric mountain
#

well, it's a tcg, so attributes and effects

#

like "When summoned, destroy the card ahead"

quartz kindle
#

i summon exodia de forbidden one

#

exodia obliterate kuuhaku

fathom venture
#

Hello šŸ‘‹ hope everything is going well with you all today

boreal iron
sharp briar
#

how long does it typically take for a new bot to be approved? patiently waiting and keep updating the description every day as i add more features lol

rustic nova
#

-upto

shell echoBOT
#

The average up-to-date approval times are stated [here](#support message).

This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.

There is no exact time for how long bot approval will take.

There is a queue and you're not first, nor are you last.

Read more about our reviewal process here

sharp briar
#

sweet thanks

earnest phoenix
#

can anyone tell me the variable of tagging channel?

#

<#channelID>

earnest phoenix
hybrid cargo
tame linden
#

Hello everyone, i have a question. My bot can help someone leave a message to another person. So, what happen if someone use this feature to sending a scam link, does my bot going to be banned by Discord?

deft rock
#

not sure why it would

#

Id suggest a strong TOS or something so your not reliable when something like that happens

rustic nova
#

not banned

#

but at least you're held responsible for that

deft rock
#

Even if he makes a TOS and cant control it?

tame linden
rustic nova
#

a TOS would partially solve that

#

though the best solution is also to only allow sending these messages to people who specifically opted in

lyric mountain
#

attempting to censor any kind of text is a lost battle, they will find ways to bypass your filter

deft rock
#

true

wheat mesa
#

A filter that is too sensitive is annoying, a filter that isn’t is useless

#

There’s usually not a great middle ground tbh

lyric mountain
#

not even limiting text options work

#

as the old man says, "try finger, but hole"

tame linden
#

I have add a warning message below the main message, hope it's work

deft rock
#

Don't Jixi yourself

stiff dust
#

since I update my bot to djs v14 I have this err I don't know the err is because of canvas or djs any idea?

lyric mountain
#

are u checking for type of image?

#

the error is pretty clear: you're trying to open an unsupported image

spark flint
#

new EmbedBuilder.from(message.embeds[0].toJSON()) returns TypeError: (intermediate value).from is not a function

#

Discord.js 14.6.0 sag

#

can't remember where i saw .from but it was deffo in the docs

lyric mountain
#

you can't do new Embedbuilder.<anything>

spark flint
#

ah

stiff dust
stiff dust
spark flint
#

i fixed it

#

new EmbedBuilder(message.embeds[0].toJSON())

lyric mountain
#

lmao u just literally contradicted urself (itz)

stiff dust
lyric mountain
#

lul

stiff dust
stiff dust
spark flint
#

meh this works so im sticking with it

stiff dust
#
const background = await Canvas.loadImage(backgrounds[style]);
lyric mountain
#

canvas doesn't support all image types, u need to check that beforehand

stiff dust
#

all of them are just png files

lyric mountain
#

are u sure those images are all valid?

stiff dust
#

but in the event...

lyric mountain
#

show how ur doing in the event

stiff dust
#

do u want to see full code?

lyric mountain
#

are u getting a random item from the list?

#

or getting a specific one?

wooden ember
#

when did discord lower the emoji limit on servers?

lyric mountain
#

they did?

wooden ember
#

used to be 50 normal 100 with lvl1 boost but not its only 25 normal

#

my discord is nor broken

#

woop wring image

stiff dust
lyric mountain
#

for my emote repos it's the same limit

wooden ember
lyric mountain
#

perhaps u lost a tier

wooden ember
#

welp its broken on my server

#

i mean i think its still under 50

stiff dust
lyric mountain
wooden ember
earnest phoenix
#

had the same on my server

#

took like a year and a half to realize it had no boosting level anymore

#

though level 1 boost is still 100 emojis and 50 for non boosted server

wooden ember
#

bruh guess im gonna have to delete some

stiff dust
#

DJS or Eris why?

solemn latch
#

Eris is no longer being maintained properly.

stiff dust
#

So for now djs is the best lib on js?

deft rock
#

I mean...

solemn latch
#

Its a good option, but I wont say its the best.
The best option will depend on you, and your goals.

deft rock
#

In all reality its all user based. In my opinion it is but for say woo could say its not

solemn latch
#

I mean, I'm writing a bot using DJS right now.

deft rock
#

I was using you as an example šŸ˜›

solemn latch
#

I wonder if Tim's lib is done.
Its a bit more advanced, and seems like an interesting way to go.

deft rock
#

djs or?

solemn latch
#

He was writing a library for larger bot devs, or even other lib devs iirc.

It was supposed to be a lightweight and fast library that simplified the discord API, but didnt hold your hand and gave complete freedom unlike DJS.

#

*IIRC, its been a long time since I last saw him talk about it.

deft rock
#

ah

lyric mountain
#

im back

#

@stiff dust

#

there are no dynamic pngs (well, there are, but discord doesn't support it), and I'm not sure canvas supports gif

lament rock
#

it's tiny-discord

lyric mountain
#

that's another one then

lament rock
#

nah. That's the lib he was working on from scratch. djs-light is just a cursed djs addon

solemn latch
#

djs-light is dead i think.

#

šŸ‘€

#

those benchmarks though

lament rock
#

Tim gave me some code that just works so exceptionally well since I make my own discord libs

lyric mountain
#

wait, detritus is slower than djs?

solemn latch
#

Its heavier isnt it?

#

It has more features, like the built in command handler and other stuff.

cinder patio
#

what does that benchmark?

solemn latch
lyric mountain
stiff dust
lyric mountain
#

it doesn't matter what u put there if ur expecting an animated avatar

stiff dust
#

I dont except animated avatar

#

belive me this isn't the problem PepoThink

lyric mountain
#

can u reproduce that error consistently?

quartz kindle
#

i mean, if multiple people ask for it i will, but so far nobody really asked for it lol, there is an open issue on my github about it

quartz kindle
#

theres still some minor internal things i want to rework a bit but it shouldnt really change much

stiff dust
solemn latch
#

I really have no projects that can use it.

Someone like Mac would probably like tiny-discord though.

quartz kindle
# lyric mountain wait, detritus is slower than djs?

the detritus authors said that the culprit is likely how they organize their classes, it seems having lots of "class extends class" is still a bit slow in js, but also the fact they use asynchronous zlib makes everything slower if you use compression

lyric mountain
stiff dust
lyric mountain
#

can u run that code locally?

uneven tartan
#

who was the guy who was making the rich presence app?

#

i cant remember

lyric mountain
#

try running with the debugger attached to that event

astral path
#

thoughts on astro?

lyric mountain
#

astrobot?

sudden geyser
#

astro what

earnest phoenix
#

yajsf

quartz kindle
#

lmfao

earnest phoenix
quartz kindle
#

oh i finally broke the 10k barrier

#

it was at 9.9k yesterday

#

huehueheuhe

lyric mountain
boreal iron
#

ping

whole quail
#

brothers does anyone know whats wrong here

neon leaf
#

is fs the same thing as node:fs?

charred nest
#

does anyone know if you can create options within subcommands uwu

deft rock
boreal iron
#

So yes command options are possible as it is a normal command

lyric mountain
boreal iron
#

I am wondering as mine was categorized as ā€œGamingā€ ā€œUtilitiesā€

#

In the preview

lyric mountain
#

machine learningā„¢ļø

boreal iron
#

Well at least for me the categories match my case

#

Just don’t know if the preview represents the final app site

#

Thing is I can’t just use app discovery as like anything is the checklist is red

hasty mulch
#

Why is Pylance saying that this def can't be accessed?

        @commands.command(name="beta-help", description="Shows help about a command or the bot (Beta version)", aliases=["help-beta"], hidden=True)
        @commands.is_owner()
        async def help_beta(self, ctx, *, command: str = None):
#

@lyric mountain Any ideas?

rustic nova
#

I'd boldly say the indentation is wrong

#

make sure it's under the command annotation

hasty mulch
hasty mulch
rustic nova
#
@commands.command(name="beta-help", description="Shows help about a command or the bot (Beta version)", aliases=["help-beta"], hidden=True)
@commands.is_owner()
async def help_beta(self, ctx, *, command: str = None):
#

fuck

hasty mulch
#

Lol

rustic nova
#

fuck

hasty mulch
#

New line

rustic nova
#

but you get what I mean

hasty mulch
#

Unexpected indentation

rustic nova
#

i give up, am on mobile

hasty mulch
#

Lol, I'll wait

rustic nova
#

as far as I understand annotations, these should be in the same indentation as the actual def

#


@commands.command(name="beta-help", description="Shows help about a command or the bot (Beta version)", aliases=["help-beta"], hidden=True)
@commands.is_owner()
async def help_beta(self, ctx, *, command: str = None):
#

there

#

or whatever you call the @ stuff lmao, can't remember what's it called rn

hasty mulch
#

Oh, I see it...

#

@rustic nova

rustic nova
#

damn we back with the scams

rustic nova
#

beta_help is within the scope of the normal help

#

make sure these are indented into the correct scope, aka beta_help should be in the scope of the class, aka on the same indent as the class constructor

#

python would try to access the beta_help through the class itself, even though if the indentation would technically cause it to be help().beta_help()

hasty mulch
#

I indented one too far, lol

rustic nova
#

probably something like

arrays_array = []
count = 0
temp_array = []
for item in base_array:
 if temp_array length at least smaller than 10 (aka 0-10)
add to temp_array
else
add array to arrays_array, clear temp_array for another 10 iterations 
#

pros being, you could make as many arrays as possible by this, as long as it's dividable by 10 if the arrays need to all be the equal size

#

also this is just some pseudo code

lyric mountain
rustic nova
#

sounds like a skill issue, become one ez

boreal iron
sharp geyser
#

pfft

lament rock
#

I'd only get into python for ml

#

Currently occupied by C++ and HLSL

sharp geyser
#

I wanna do ML but didn't know you need a nvidia gpu to do any cool shit

#

šŸ˜”

lament rock
#

any gpu would realistically suffice, just more is developed for nv

#

the basic concept is just the supremely parallelism GPUs offer

dry imp
cedar moth
#

I'm looking for a free host for my bot

#

can any one recommend me some hosting? 24/7?

stiff dust
#

@lyric mountain Hi, well still I have that problem with canvas... do u have any idea? Panic

fervent moss
#
const page_number = interaction.fields.getTextInputValue('page')
const high = myregex[3]
const low = 0
let zerotest = page_number.startsWith('0')
let number_test = +page_number
if (page_number > low && page_number < high && zerotest === true && number_test === NaN) {
console.log('No');
} else {
console.log('Yes');
}

Why do this give me 'yes' everytime

#

What I'm doing is getting a page_number value from modal and then checking it that it shouldn't have 0 as first number (from left) , it's a actuall number and not a text , it's number between two values (numbers)

rustic nova
#

your whole condition gets screwed up by zerotest, since you're checking if the page numbers starts as a string based 0, not the integer 0

#

Can you give an example of values provided by these variables

#

aswell as their type (using typeof)

fervent moss
fervent moss
rustic nova
#

all the relevant variables on your if condition

#

so page_number, low, high, zerotest, number_test

#

aka their values right before the condition is checked

rustic nova
#

well if page_number is a string, aswell as high being a string (likely same applies to low) then theres your issue

#

lose typing

#

make sure to convert the numbers to actual integers, as it would cause something like that

fervent moss
#

Hmmm.....

rustic nova
#

oh nevermind thats correct on the last one, that returns the numeric version of the string, would be NaN if thats not a number

#

still ensure the variables are actual integers if you're using them in logical operators

fervent moss
#

Should i convert all numbers to integer?

rustic nova
#

yes, since you're using these all in the if condition

fervent moss
#

Oki

#

How do i make string a integer? parseInt?

rustic nova
#

at least page_number and high

#
  • does the job actually, like you have done on number_test
#

so +high for example would give you the numeric version of it, if it is a valid number

fervent moss
#

Oh

rustic nova
fervent moss
# rustic nova

I converted everything into int now it give .startwith isn't w function

rustic nova
#

correct, as page_number isn't a string anymore

#

what is the purpose of zerotest? checking if the number is zero essentially?

quartz kindle
#

numbers cant "start with 0", for example "052" when converted to a number becomes 52

#

a number can be 0 or not be 0

#

if you're using that zero as some kind of marker or flag then you have to use strings and not numbers

fervent moss
#
let page_number = interaction.fields.getTextInputValue('page')
page_number = +page_number
let high = myregex[3]
high = +high
const low = 0
//let zerotest = page_number.startsWith(0)
let number_test = +page_number
console.log('page_number =' + typeof page_number)
console.log('low =' + typeof low)
console.log('high =' + typeof high)
//console.log('zerotest =' + typeof zerotest)
console.log('number_test =' + typeof number_test)

if (page_number > low && page_number < high && number_test === NaN) {
console.log('No');
} else {
console.log('Yes');
}

Is it because of let

#

@rustic nova

rustic nova
#

print the values of everything before the condition

cinder patio
#

name checks out

spark flint
#

can we all agree that djs is the worst at breaking changes

#

😭

#

they moved everything to pascal case

lyric mountain
#

attach a debugger, step over until you find the line that errors

quartz kindle
#

NaN is never equal to another NaN

#

instead you can use Number.isNaN(number_test), but actually you dont even need that, because NaN cannot ever give true for < > operators

#

you dont even need half of your code tbh

#
// i prefer using Number() than stuff like +number because its easier to understand
const page_number = Number(interaction.fields.getTextInputValue('page'));
const high = Number(myregex[3]);
const low = 0;

// you can remove these afterwards as well
console.log(`page_number = ${typeof page_number}`)
console.log(`low = ${typeof low}`)
console.log(`high = ${typeof high}`)

// you dont need to test for NaN because NaN will always return false when used with < or >
if (page_number > low && page_number < high) {
  console.log('number is between low and high');
} else {
  console.log('number is not between low and high');
}
lyric mountain
#

I'd argue that > should be >= tbh

quartz kindle
#

if they want inclusive yes

spark flint
#
const client = new Client({
    shards: Cluster.data.SHARD_LIST,
    shardCount: Cluster.data.TOTAL_SHARDS,
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages],
    partials: [Partials.Message, Partials.Reaction],
    allowedMentions: { parse: ["users"] }
});``` Bot isn't replying to messages
#

d.js v14.6.0

#

nvm im just absolutely stupid, please ignore that

lament rock
next storm
#

I just applied my another bot for topgg verification, can any moderator pls check it out :-{

lyric mountain
#

they will check when it's time comes

next storm
#

🫠okiz

oak cliff
#

Anyone have a good guide on how to set up a public repository on github / how licenses work / basically just how to make things look profreshionalā„¢ļø

quartz kindle
#

licenses depend on how much freedom you want to give people

#

most stuff today is either MIT, BSD or GPL

#

or apache

oak cliff
#

what should I be putting in my readme?

deft rock
#

Anything you want honestly

oak cliff
#

Normally for private projects i use it as a todo list

deft rock
#

Just keep in mind that readme will show up for others

#

idk what its for but maybe say what it will do?

#

maybe some common bugs or planned feature update?

#

Maybe how to use whatever this is?

oak cliff
#

sounds like a good place to start

quartz kindle
#

then a presentation of the repo's core features and advantages

#

then a practical introduction , code examples, docs

#

thats usually the kind of things i do, and also what most repos do

oak cliff
#

pog_thumbsup thanks!

lyric mountain
quartz kindle
quartz kindle
radiant kraken
quartz kindle
#

also i just found this, looks pretty awesome

quartz kindle
radiant kraken
oak cliff
quartz kindle
#

yeah most my stuff is MIT except for one thing that is LGPL

quartz kindle
radiant kraken
oak cliff
#

lmao

radiant kraken
#

banned for suggestive message

quartz kindle
#

there was a joke license called giant penis tho, but i think only one or two repos actually use it and its main website is offline

radiant kraken
#

WTFPL based license ngl

lyric mountain
#

there's also dbdpl

solemn latch
#

Do webhooks in a thread work when the thread is closed?

quartz kindle
lyric mountain
radiant kraken
lyric mountain
#

I guess so

radiant kraken
#

relicensing all of my libraries under dbad rn

lyric mountain
#

lul

quartz kindle
#

lmao there is a license that forbids all use until after death

lyric mountain
quartz kindle
#

This software may not be used directly by any living being. ANY use of this
software (even perfectly legitimate and non-commercial uses) until after death
is explicitly restricted. Any living being using (or attempting to use) this software
will be punished to the fullest extent of the law.

lyric mountain
#

this license basically forbids copypasting code without citation

lyric mountain
quartz kindle
#

Protestant Public License: modifications must be published by nailing the complete source code to the door of a church, without permission

lyric mountain
#

lmao

quartz kindle
#

there are some really good ones lmao

deft rock
#

seems like a bunch of made up licenses

solemn latch
#

All licenses are made up.

#

Its not something that you need to have a lawyer to write one for you(although recommended).

radiant kraken
#

technically true

#

anyone can make their own license

deft rock
#

I more meant like ones that are not meant to be taken serious

radiant kraken
#

that's their point

deft rock
#

its dumb lol

solemn latch
#

the dont be a dick license is a good one

radiant kraken
#

they're supposed to be funny and humorous

#

not to be taken seriously

radiant kraken
solemn latch
#

lmao

radiant kraken
#

adding it to my python projects

solemn latch
#

šŸ‘€

radiant kraken
#

adding that to all of my projects

#

thank you

solemn latch
wheat mesa
#

WTFPL best license

radiant kraken
quartz kindle
#

WTFWYEDTHSPL

solemn latch
radiant kraken
#

exactly

#

that's what i said earlier

neon leaf
#

how can I make canvas (s: canvacord) use all my threads to draw the image? (nodejs)

quartz kindle
#

you cant

spark flint
#

Does anyone know what the replacement for interaction.component.setLabel() is in djs v14?

#

it seems to be removed sadge

quartz kindle
spark flint
#

ah ok

#

ty

quartz kindle
#

to use an existing button as a template you can do new ButtonBuilder(interaction.component)

spark flint
#

and how would I replace the clicked button with this new one?

boreal iron
#

By editing the interaction response

#

Just provide your new components

#

If you don’t pass embeds or content as option then both will not change

spark flint
#

yeah but its not that

#

the buttons aren't always the same

quartz kindle
#

all types of edits require replacing the entire message

#

so you have to edit the message with a new message that contains a different set of buttons

sage bobcat
boreal iron
#

At least not with djs

#

Which is what he’s using regarding the methods and classes I saw above

#

Passing just the content as option when editing your response, only the content will be changed

#

Not so additional embeds, components, etc.

#

Maybe djs internally fetches the message once you edit it but it’s not required to edit the entire message

lyric mountain
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lyric mountain
#

ye ik

#

it'd be funny if they asked "oh, so what if I switch to python?"

quartz kindle
# boreal iron No?!

well yes, some fields are ignored if not passed, but for example to change one button you have to basically send a whole new components array

lament rock
#

so a nodejs app can make use of every logical processor a cpu can offer

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

node canvas is a native module so it can technically make use of threading in C/C++

#

but i dont know if it does, likely not

radiant kraken
quartz kindle
#

it doesnt die lol, unless you're doing weird shit

radiant kraken
#

it does for me, the only way for it to work for me is to use libuv which utilizes node's event loop iirc

quartz kindle
#

afaik it should be done like this: js calls cpp main, cpp uses threads to do something, return something to cpp main, return callback to js

radiant kraken
#

if only it was that easy

quartz kindle
#

even if you use worker_threads in js, cpp should always return to js from the main cpp thread

#

ie js worker threads still call to cpp main

#

js workers cannot use cpp threads directly

radiant kraken
#

my brain died

quartz kindle
#

at least thats what i read somewhere

#

threading is indeed difficult

#

JavaScript functions can normally only be called from a native addon's main thread. If an addon creates additional threads, then node-addon-api functions that require a Napi::Env, Napi::Value, or Napi::Reference must not be called from those threads.

When an addon has additional threads and JavaScript functions need to be invoked based on the processing completed by those threads, those threads must communicate with the addon's main thread so that the main thread can invoke the JavaScript function on their behalf.

lament rock
#

just press the f29 key

quartz kindle
#

why f29

#

f32 is superior

deft rock
#

No, f69 is superior.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lament rock
#

JS is a safe language even with threading (for the most part) where segfaults are really hard to pull off as memory spaces are separate

#

but the option is still there

quartz kindle
#

yeah but js threading is like running stuff on containers, they can only communicate via messaging

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

while other langs have more access

quartz kindle
#

^or that

#

which was disabled for some time due to some exploits some time ago

#

lmao

lament rock
#

lmao

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

OwO

sage bobcat
#

One message removed from a suspended account.

lament rock
#

my buffer now

quartz kindle
#

anyway ig2gcya

sage bobcat
#

One message removed from a suspended account.

radiant kraken
#

it makes most of the pain to disappear

boreal iron
split tiger
#

When I make a slash command require the admin permission within discord's new apps interface, it totally locks every non admin from using it (without a server admin changing the permissions ofc), right?

#

I want to make sure I don't give everyone config access, as that would be... awkward

boreal iron
#

You’re speaking about the default_member_permissions field, right?

#

This will unfortunately lock the command to members with the exact same permissions, yes

deft rock
#

anyone have a document or know how I can give a role to someone via buttons? discord.js V14.6

boreal iron
#

The button triggers an interaction event which holds the guild member object (if used in guild) you can use to access roles and do whatever has to be done

#

interaction.member.roles.add(…);

deft rock
#

ok, so would it be interaction.member.roles.add("roleid");

boreal iron
#

Make sure to check if it is a guild interaction

deft rock
#

How would I go about that?

#

also would I use cache?

boreal iron
#

if(interaction.inGuild()) …

deft rock
#

ok ill give it a shot and let you know

boreal iron
#

I’m close to be sleeping but sure, I will respond later

deft rock
#

ok

deft rock
#
const fs = require("node:fs");
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");

module.exports = (client) => {
  client.commands = async () => {
    const commandFolders = fs.readdirSync("./src/commands");
    for (const folder of commandFolders) {
      const commandFiles = fs
        .readdirSync(`./src/commands/${folder}`)
        .filter((file) => file.endsWith(".js"));

      const { commands, commandArray } = client;
      for (const file of commandFiles) {
        const command = require(`../../commands/${folder}/${file}`);
        commands.set(command.data.name, command);
        commandArray.push(command.data.toJSON());
        console.log(`Command: ${command.data.name} loaded!`);
      }
    }
    const clientId = "1004251517957701652";
    const guildId = "1026670787152842802"; //Razer Hangout
    const rest = new REST({ version: "9" }).setToken(process.env.token);
    try {
      console.log("Started refreshing application (/) commands.");
      await rest.put(Routes.applicationGuildCommands(clientId, guildId), {
        body: commandArry,
      });
      console.log("Successfully reloaded application (/) commands.");
    } catch (error) {
      console.error(error);
    }
  };
};
#

Any ideas?

lyric mountain
#

U can't get commands from client because it doesn't exist yet

lament rock
#

I'm shitting my pants. My bot's VPS is unreachable, but another VM in the same datacenter is. Ping just shows request time out via both DNS and direct IP

earnest phoenix
outer crater
#

BDSCRIPT is underated?

neon leaf
#

bdscript is actual hell

outer crater
#

...

#

I like ur user name

#

:)

boreal iron
#

What are you worried about?

#

Don’t u have proper backups? KEKW

radiant kraken
boreal iron
#

commandHarry

neon leaf
#

how do I create a new column after another in postgresql? In mariadb I used this but it doesnt work anymore, alter table userinfo add column uvars int default 0 after email

long lagoon
#

Can anyone help me with modal box in d.py2.0 cogs ?

rustic nova
#

help with what exactly

lyric mountain
#

simply access the server throught it and undo whatever u did that locked u out

#

probably bad firewall configuration

lyric mountain
#

the rest is normal standard sql

neon leaf
#

how can I still do something like that though?

lyric mountain
#

you don't

#

you simply add the columns

long lagoon
# rustic nova help with what exactly

I'm not able to do it. It throws me error

File "/usr/local/lib/python3.10/tkinter/init.py", line 37, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

lyric mountain
#

it didn't find libtk file

long lagoon
#

But I don't know what tk is and can't seem to find the lib

lyric mountain
#

well u installed tkinter apparently

long lagoon
#

hmmm... It seems like a dependence from something i installed

#

I'm just trying to achieve pop-up box with Modal

lyric mountain
#

check tkinter install guide to see if u missed any step

long lagoon
#

Thanks for the help

lyric mountain
#

yw

long lagoon
#

'InteractionResponse' object has no attribute 'edit'

#

How to do this ?

long lagoon
#

Thank you! Let me check

astral path
#

does anyone know how to generate a rsa and/or gpg key in c#, from a set seed?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

astral path
#

That doesnt appear to support seeded key generation

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

astral path
#

the only create function that takes in any options other than the generation method, takes in RSAParameters, which does not include any option for seeding

#

looking rn to see if maybe one of the generation methods includes it

sage bobcat
#

One message removed from a suspended account.

astral path
#

that's fine, thank you

sage bobcat
#

One message removed from a suspended account.

astral path
#

I think i'm probably just going to use esdca keys instead

lyric mountain
#

why are u doing that btw?

lament rock
lyric mountain
#

then contact support

#

because u literally cant fuck up recovery partition

#

since it's recreated on demand

rustic nova
#

what's this topic about recovery partitions?

#

on a VPS for example?

#

if it isn't available, you might need to mount it manually

#

this was often the case on my previous dedicated server, as the recovery partition was actually a physical partition that didn't get mounted itself

lyric mountain
#

for some unknow reasons, they cant ping nor access it in any way

rustic nova
#

nah they need to manually mount it, doubt they'd just lock partitions

#

can't remember what the command is, but they should check the available drives

#

lsblk or smth

lyric mountain
#

they cant access the server at all

#

usually there's a button or smth to create a new recovery partition

lyric mountain
lament rock
#

it got fixed after 2h

#

just trying to get any response from it failed. No ssh, no pings, nothing. Even with recovery partition

lyric mountain
#

yes, that's what happens if u sever connections to the outside

rustic nova
#

then the network access is dead, though recovery modes often have different credentials provided after changing the mode

#

including the IP as I have experienced

#

though think that's only something on virtual servers

lament rock
#

yeah nothing like that through the interfaces they gave me

#

same ip, default port 22, password of my choice

#

support replied after 3h after it alr fixed itself and they said everything was fine essentially

quartz kindle
#

we investigated ourselves and found nothing wrong

boreal iron
knotty quartz
#

Hi!

next storm
#

I applied my bot 2 days ago, but till yet I got no reply

rustic nova
#

-upto

shell echoBOT
#

The average up-to-date approval times are stated [here](#support message).

This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.

There is no exact time for how long bot approval will take.

There is a queue and you're not first, nor are you last.

Read more about our reviewal process here

rustic nova
#

@next storm

next storm
#

.ok

tulip ledge
#

Hi so I am making a website for a school project and we need to add a "webshop" basically a way to show the products on the website but you don't have to implement a payment system just a way to show the items in stock found in a database but ofcourse with the database credentials being safe and not being able to be found in the source when inspecting element how do I do that?

rustic nova
#

by having a backend API that the website reaches out to

#

that backend API then talking directly to the database, having the credentials only internally

#

you could also directly go with template-based Webservers such as ejs or on python, flask

#

or even php

#

if your goal is really to only dynamically display the inventory on load and not live

thorny field
#

My bot just got verified :)))

#

I don’t know entirely what that means but it’s cool

rain moss
#

@thorny field discord or top.gg

thorny field
#

Discord

#

I got the check mark

digital swan
#

Means it can be in more than 100 servers

thorny field
#

I knew that but I thought there would be more

digital swan
#

Nah I don’t think so

thorny field
#

Dang well the check mark is cool

quartz kindle
#

verification is basically a way for discord to get your personal information

#

so they can hold you accountable for your bot

#

its basically like registering a business, you get permission to operate and sell, but they know everything about you and can hold you responsible for what your business does

indigo cobalt
lyric mountain
#

Nope

#

The only things u get are being able to go above 100 servers and be listed in app discovery

indigo cobalt
#

Idk why I thought I heard something about rate limits

#

ĀÆ_(惄)_/ĀÆ

#

Maybe a old feature.

lyric mountain
#

What u heard is special ratelimits for very big bots

solemn latch
#

Ratelimits can increase if you ask for that.
But you need a valid use case and to be quite large of a bot.

#

(Or application)

indigo cobalt
#

When I had a almost verified bot I checked and it said that ratelimits eould be less strict, perhaps I read it wrongly.

solemn latch
#

They are already pretty relaxed.

indigo cobalt
#

But that was my problem to be honest.

solemn latch
#

Most bots in hundreds of thousands of servers don't go near the ratelimits.

quartz kindle
#

caching users is easier than catching them

#

:^)

indigo cobalt
solemn latch
#

Cache limit? šŸ¤”

quartz kindle
#

there is no cache limit lol, the limit is how much ram you have

sharp saddle
#

hey guys, i'm with a error:

quartz kindle
#

skill issue

indigo cobalt
sharp saddle
#

lol

indigo cobalt
#

It's was pretty weird.

indigo cobalt
#

I just see 40 errors.

#

Not any specific error.

sharp saddle
#

wait i'll send it

#

Error: Login sessions require session support. Did you forget to use `express-session` middleware?

#

smh

indigo cobalt
#

Check this issue comment

#

Maybe it will help

sharp saddle
#

ok

lyric mountain
#

some cache less, some more, some dont have a cache at all

quartz kindle
# indigo cobalt Weird then

also depends on configuration, for example members and presences intents influence how many members you receive when you login

#

and to get all members you still need to manually fetch them with the members intent enabled

#

otherwise you will only have online members

wooden ember
#

when i do if (!list) return i just get list is not defined instead of it just returning

#

why does that happen

#

i know list is not defined that why im trying to filter it out

radiant kraken
#

list is not a variable

wooden ember
#

yeah cuz its not defined

#

how would i return when list wasnt defined

#

cuz thats what i though you had to do

radiant kraken
#

yes you haven't assign any value to list like let list;

wooden ember
#

i know

#

so why doent it return

#

thats the point of the if statment

#

cuz list may or may not exist

radiant kraken
#

then add let list; first before the if statement

wooden ember
#

but i dotn want it to exits though

radiant kraken
#

why

boreal iron
#

You need to understand the difference between undefined and non-existing

sterile lantern
#

then why are you adding the conditional then lol

#

yeah if(!list) would only work if the value is like null or undefined or false

radiant kraken
#

^

sterile lantern
#

if it doesnt exist at all then it gives u an error

quartz kindle
#

typeof will work

#

but yeah its a useless thing to even check for

wooden ember
#

so ive got to reformat arguments so i can pass them through to child prosses which results in list but if there are no arguments list wont exist but i need it to run the command with no list

quartz kindle
#

because if you dont write the variable in the first place, it will never exist, the code wont write it for you

#

unless you're using weird eval shenanigans

wooden ember
#

bruh

#

this is what im doing

boreal iron
#

ā€œshenanigansā€ freerealestate

wooden ember
#

probably cursed

quartz kindle
#

ah

wooden ember
#

but it should work

quartz kindle
#

that has nothing to do with it

#

youre declaring let inside a block scope

wooden ember
#

i know

quartz kindle
#

it wont exist outside that block

radiant kraken
#

use var

sterile lantern
#

declare it outside the if statement

#

thats the easiest fix

wooden ember
#

ok so if i just do let list; out of the block if(!list) will fire?

#

nice

sterile lantern
#

yes

quartz kindle
#

it still looks like you're doing redundant stuff

#

you could just do const list = something || args.map(...).join(",")

radiant kraken
#

there's no need for map

#

just join it

quartz kindle
#

he seems to be adding single quotes to each item

radiant kraken
#

why though

wooden ember
#

so if i ran the command im trying to run in the command line of my server would look like this beep -l 375 -f 392 -n -l 750 -f 523 -n -l 463

quartz kindle
#

idk, formatting?

wooden ember
#

but child prosses needs it to look like "beep", ["-l 375" "-f 392", "-n", "-l"]

#

or something like that

quartz kindle
#

there are lots of parsers that do that for you

wooden ember
#

i have no idea how that works

radiant kraken
quartz kindle
#

yeah

wooden ember
#

the reason im doing this and not just making the useres manually add the formatting is some of the arguments can have alot of elements

radiant kraken
#

or use @earnest phoenix's parserā„¢ļø

wooden ember
#

mmm

#

ima see if my thing works first

#

havent tryed it yet

lyric mountain
#

I find it funny when bot devs cannot make console applications

#

when bots are basically console applications but remote

quartz kindle
#

i find it funny when

earnest phoenix
#

It also considers single-dash flags as options when there is content after them, and that it collects everything after an option instead of something with no spaces, it should collect the whole expression when a string is present

#

I'm gonna make a standard one just for fun I guess

wooden ember
#

i just suck at coding

#

i have the beep package installed on my server means i can been the bios buzzer
got that to run fine however you can controll the length duration frequency and amount off beeps with a long list of arguments

#

there are scripts on the internet that you can just past into a cli and it will make the server play a little tune on the bios buzzer

#

want to beable to just past it into discord thats all but i need to get it all formatted to work with child prosses

wooden ember
#

bruh still cant get this crap to work

#

the code works fine i mean its just i cant make it output the right formatting

#

Command.spawn("beep",["-n","-n","-n"]) works

#

however Command.spawn("beep",[args]) where args = ['-n','-n','-n'] does not work

lyric mountain
#

how will the beep even work?

wooden ember
#

huh?

lyric mountain
#

didn't u say it's a command to make bios beeps?

wooden ember
#

yee

lyric mountain
#

except the code will be ran nowhere close for anyone to hear

wooden ember
#

my server is under my computer desk

#

its just a gimmic that im putting too much effort into

#

but its bugging me now

#

the only thing that works is if i do only one argument

lyric mountain
#

why dont u just use node built in argument parser?

wooden ember
#

but any more than that and i just get beep: invalid option -- ' '

#

whats that

lyric mountain
#

show what ur writing

wooden ember
#

what as the bot command?

lyric mountain
#

yes

wooden ember
#

-beep is the command and i just write the arguments like they would be in the cli
resulting in something that looks like
-beep -n -n -n
which makes the thing beep 4 times

#

or should do

#

-beep -n works

lyric mountain
#

I wanna see what ur writing, exactly

wooden ember
#

it beeps 2 times

lyric mountain
#

also -n -n cannot work

#

because arguments are treated like a map - no duplicates

wooden ember
wooden ember
#

using child prosses to do this
Command.spawn("beep",["-n","-n","-n"])
runs perfect

lyric mountain
wooden ember
#

what does that do?

lyric mountain
#

split by space

#

cmon, u have a bot, use the same command handling

wooden ember
#

i know im tyred

#

i have that in and that works now

#

however i still need each "arg" to be indevidual things to input into child prosses though

lyric mountain
#

think as if u were making a bot

#

all bots are CLIs

wooden ember
#

i know but child prosses needs all the commands in an array or some crap unlike in a cli where i can just type it as a string

#

i can split it again and iterate it into an aray like the way i filter the args for commands

lyric mountain
#

then pass it in an array

wooden ember
#

true however the data from the msg args is already in an aray and that doesnt work

lyric mountain
#

are u using a pre-made command handler?

#

because there HAS to be a way to message.content

wooden ember
#

i have that

#

in the handler to get the args i have this
const args = message.content.slice(prefix.length).trim().split(/ +/g);

#

that makes it an array

#

and in the commands files i have message though its named msg

lyric mountain
#

what's the issue again?

radiant kraken
wooden ember
#

ok so child prosses need to have stuff in an array or something like this
Command.spawn("beep",["-n","-n","-n"])
that works fine
now i need a way to get arguments from a command and translate it into that

#

however nothing works and idk why

#

it works fine with just one argument leading me to believe that its treating everything as one argument instead of multiple

earnest phoenix
lyric mountain
#

-beep -n -n -n -n -> .split(/\s+/g) -> ["-beep", "-n", "-n", "-n"] -> .shift() -> ["-n", "-n", "-n"]

radiant kraken
earnest phoenix
radiant kraken
#

Can't because it doesn't comply with my standard

wheat mesa
#

my comp sci class actually went over expressions and parsing them

#

I was surprised

#

evaluating and converting between infix, postfix, and prefix expressions

earnest phoenix
radiant kraken
#

my standard:

  1. don't modify this standard
  2. read no. 1
earnest phoenix
#

I'll sudo rewrite it, mmm mmLol

radiant kraken
#

modifying is modifying

#

which does not comply

earnest phoenix
#

It doesn't matter! It must comply with my orders

lyric mountain
#

because you're getting the value of shift

#

you're supposed to simply discard what shift returns

wooden ember
#

bruh

#

its 2am

#

sry

#

ok so it is now a proper array but i get an error from beep saying
beep: invalid option -- ','
meaning it is still being sent as one big argument

earnest phoenix
#

Show code

wooden ember
#

since , should never be seen by the beep program

#

one sec

#
let conditions = msg.content.split(/\s+/g)
conditions.shift()
console.log(conditions)
let errs = Command.spawn("beep",[conditions])
#

the errs stuff is just to i can log the stderr from beep

earnest phoenix
#

You're passing an array inside an array

#

conditions is already an array

radiant kraken
#

arrayception

wooden ember
#

bruh lemmy remove the [] and see if that helps

radiant kraken
#

it will

wooden ember
#

i hope

#

bruh it works now

#

nice

radiant kraken
#

see

wooden ember
#

thx people

radiant kraken
#

@earnest phoenix replace Opteric with the Node.js builtin version when

wooden ember
#

the reason it was an array in an array is cuz i was doing it a difernet way originally

#

but it works now

#

theoretically i can just use the args from the commands handler instead of remaking it

earnest phoenix
#

The parseArgs() method is in the node:util built-in module if you're interested

radiant kraken
wooden ember
#

bruh i hate the fact that basically 2 hours of my life went to making somthing that finally works with less than a line of code

#

Command.spawn("beep",args) is all i needed

#

reeeeeeee

#

"code stuff for fun i thought"
"it will be fun i thought"
the internal screaming intensifies

earnest phoenix
#

You said you're tired, you're better off resting instead of writing code because you mostly won't be able to focus, so you'll just keep running into more issues than you initially did

radiant kraken
#

pov: you're trying to debug a segmentation fault in c++

wooden ember
#

true but if it bugs me im motivated and if i go to sleep it becomes a "tomorrow problem" and tomorrow as we all know never comes

#

unless it does but then my crappy bot is the least of my worries at that point

wheat mesa
#

don't write code sleep deprived

#

you'll struggle to pick up where you left off, because you won't remember your thought process

#

get a good night's sleep and return in the morning or whenever you have more time

wooden ember
#

true however i cant remember my thought prosses at the best of times

#

but atleast i can now play a segment of the mario theme song over a crappy buzzer from discord

solemn latch
#

You really should be documenting the goals first anyway.

radiant kraken
#

You don't really need to document it, you just need to have the goals and how the code would work in mind

radiant kraken
solemn latch
#

Documenting all this stuff can be really essential when working with groups of developers.

It's good practice.

radiant kraken
#

But he's working alone

solemn latch
#

Hopefully not forever ^_^

radiant kraken
#

._.

solemn latch
#

It's also nice for working on projects you haven't touched in months.

I try to keep a Readme file for every project.

More detailed than I need though.

radiant kraken
#

Every project literally has a readme lmao

wooden tapir
#

is there a good guide to using slash commands in discord.py? I wrote a bot before this feature existed and I'm a bit confused on how the new system works

#

am I going against the grain trying to subclass Bot instead of instantiating it and defining commands there? that whole paradigm seems weird to me

earnest phoenix
#

Hello, so I’m making a website for a server and wanted to make the background of the website a gif. I googled for some cool gif’s and chose one. The issue I’m facing is when loading the gif, the gif always duplicates into these small little boxes. I’ll send my code in less than 24 hours (due to school.) but for the time being, it’ll be highly appreciated if someone is able to provide me with the proper code

lyric mountain
#

Idk how old you are, but around 2005-ish we had an era where the internet was flooded with gifs

#

Needless to say it wasn't only awfully slow, but also extremely polluted

#

Gifs are heavy, like, really heavy, use them sparsely and definitely not as a background image

#

If you, however, really needs to have an animated background then re-encode the gif as webp, it is way more optimized for web usage, as the name suggests

boreal iron
#

Not really much of an issue in 2022 anymore as caching nowadays reduces the request load quite a lot

#

And waiting for loading a website the first time ain’t that much of a big deal

#

The real issue is to bring the gif into a responsive state to have a nice animated on any resolution

#

Which requires you to use media queries for example and multiple gif files in diffrrrnt sizes to prevent stretching or generally confusing pictures

#

Nowadays might make more sense to work with a gradient background animated via css

#

If necessary needed wtfBacon

earnest phoenix
#

Alright thanks for letting me know

earnest phoenix
green kestrel
#

what are the requirements for an api lib for top.gg?

#

is there a minimum level of supported functions required?

pale vessel
#

you should DM a team member like Mac

earnest phoenix
#

Hello, I have a very big question, so I'll start.
I would like to use sharding in my disocrd bot, but there are some things that I don't know how to solve.
At present, for the first time in my life, I want to deal with sharding and I don't know how to approach it.
which I am asking someone to give me directions for, since I couldn't find a precise guide/description on the internet

so there is a webdashboard that establishes a continuous connection between the user on the dashboard and the bot, which runs rather smaller data, such as whether he has a right or when he wants to create a statistical channel, the dashboard uploads it to the database and I tell the bot to update it via socket the statistical rooms will then be downloaded from the database to the specified server, but only those that have the create type and will be created

the second floor is the data base, the bot is 99% exposed almost everywhere and I don't know how I can easily use it in shardin, because of course there are as many connections to the db as there are shards, which is not advantageous even with a socket, but the port is already reserved, isn't it?

so how would that be possible

postscript: my English is very bad

rustic nova
#

I would probably suggest a central internal API for that, having your shards request to that central API to get and update data, then having that API make the changes on the database

your webdashboard could then use that database too

depending on load, would also suggest to deploy some caching between your dashboard and the API calls

#

dont have your shards touch the database directly imo, as that could first, cause the " because of course there are as many connections to the db as there are shards" aswell as be slow

radiant kraken
earnest phoenix
rustic nova
#

was thinking about sketching that yeah

radiant kraken
flat copper
#

hello,
i have deployed my website on firebase but the javascript is not working

radiant kraken
#

pog

#

good luck maintaining it

green kestrel
#

i'll make something this weekend that depends on dpp as its lib

earnest phoenix
# rustic nova was thinking about sketching that yeah

thank you very much and I would be very grateful for it because then my current biggest problem would be solved, which is that my bot can work in sharding and I can continue working on the things that my bot will need

radiant kraken
#

why dpp specifically

#

why not just C++ in general

green kestrel
#

because its the biggest lib and it makes posting to http a very simple thing

#

as opposed to having to pull in some dep like curl or cpphttplib

#

when the majority of cpp bot devs are already using dpp, would be like a js lib depending on discord.js

radiant kraken
#

fair

rustic nova
lyric mountain
#

good thing most browsers started preventing audio autoplay

rustic nova
#
  • Shards being able to talk to the Internal API
  • The Internal API making necessary changes and/or obtaining relevant data for any shard from the database
  • The dashboard obtaining data relevant to the users using the dashboard
earnest phoenix
rustic nova
#

that would avoid each shard to connect to the database, aswell as allow you to expand regarding load-balancing on the Dashboard

earnest phoenix
radiant kraken
#

is pointer dereferencing big-endian or little-endian?

#

please don't tell me it's inconsistent across systems

green kestrel
#

instead i ended up just scaling up the db instance, and having all shards connect to the same database

green kestrel
#

its architecture dependent, this is why we have ntohs() and ntohl() etc

#

to convert them to a consistent network byte order that isnt different from system to system

#

however, every system you see in the real world outside of big iron is the same endienness now, arm and intel are all little-endian

radiant kraken
#

iara_why_sob WHY

#

why can't the world be consistent

green kestrel
#

because in the bad old days nobody could decide on architecture standards

#

you can safely assume little endian so long as you dont support anything strange

#

hp-ux, ibm z-series mainframes or sparc are big endian

#

everything else in the "real world" is little endian including arm, intel, amd, mips

earnest phoenix
#

yo i got a question

#

this is the context

#

ie a server selection page for a dashboard

#

what would be the

#

visually

#

best way to denote a guild that the bot is in vs not

earnest phoenix
earnest phoenix
#

and when you hover over a greyed out guild you can "Invite"

lyric mountain
earnest phoenix
lyric mountain
#

and I answered it

#

for realtime communication between the api and the bot you use websockets

earnest phoenix
#

ok but how in sharding
there, how can I talk to the bot in realtime?

tribal crow
#

how would i get all the info about a user by their id?

earnest phoenix
#

because I can send a send request in vain, but how can I receive it?

tribal crow
#

long time since ive coded

lyric mountain
#

you apparently don't know what a websocket is

earnest phoenix
earnest phoenix
fervent moss
#

You can't then

lyric mountain
#

socket io is...a different case

earnest phoenix
earnest phoenix
lyric mountain
#

while it does use websockets (most of the time it uses polling) it's probably not what you'd use if ur looking for optimization

tribal crow
lyric mountain
#

socket.io is pretty heavy compared to a crude websocket

earnest phoenix
lyric mountain
lyric mountain
earnest phoenix
lyric mountain
#

the setup is a little more difficult than socket.io tho

earnest phoenix
#

it will be funny because I don't even know how to start

tribal crow
lyric mountain
earnest phoenix
earnest phoenix
lyric mountain
#

?

#

you'll make a single websocket server and have your clients (shards) connect to it

earnest phoenix
#

oh oh to have ws out of bot

lyric mountain
#

yes, you need ws on both sides

#

then u just need to store the connections in a map so you can target a specific shard from the server

#

if u need to broadcast simply send the message to all connections

earnest phoenix
lyric mountain
#

dashboard <--> server <--> bot

#

dashboard would just a client in the ws server

#

you just need to send a header so you can differentiate between the dash and the bot shards

earnest phoenix
lyric mountain
#

yes

earnest phoenix
lyric mountain
#

just a little detail, make you you make a periodic check to reconnect websockets

#

they by default don't attempt to automatically

earnest phoenix
#

I think there is something for it to automatically reconnect, but I will try several methods and see which one is the easiest and best according to my own knowledge and can be easily developed
since a lot of data will flow through this ws because the site and the bot monitor a lot of things to ensure that everything is in order from a security point of view

#

that's pretty much the idea

tribal crow
#

Hey! My "application wont respond" to a certain command. Why is this?

earnest phoenix
#

a. Offline
b. Error in code, read console

tribal crow
#

Online, nothing in console

earnest phoenix
#

Then you have something eating your errors

#

And making them not show up

tribal crow
#

the error has to be here

#

i know that

lyric mountain
#

how do u know it?

tribal crow
#

because its the only "thinking" part of the command

#

the others is just getting something simple from my db and creating an embed

lyric mountain
#

programming doesn't allow suppositions to be made

tribal crow
#

explain in english

lyric mountain
#

you cannot "guess" that's the part that's erroring

tribal crow
#

im not guessing

#

like

#

ive console logged every other part

lyric mountain
#

you are definitely guessing unless the error message points there

tribal crow
#

there is no message

boreal iron
#

Stop fetch the entire member list but fetch the member using his ID instead

#

My gosh

tribal crow
#

so await userGuild.members.fetch(user.userID);?

boreal iron
#

If user is your user object, then user.id

tribal crow
#

its not

boreal iron
#

A property userID doesn’t exist

tribal crow
#

its sum from my db

boreal iron
#

Well then… whatever, as long as it’s the user ID

tribal crow
#

alr

boreal iron
#

Which makes your line getting the member from the cache obsolete

tribal crow
#

alr ty

#

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

#

let userFtchd = await userGuild.members.fetch(user.userID);

boreal iron
#

Make sure userGuild exists

tribal crow
#

let userGuild = await interaction.client.guilds.cache.get(user.guildID);

boreal iron
#

The user in your database could be in a guild your bot isn’t part of anymore

tribal crow
#

thats true

#

didnt think of that

boreal iron
#

if(!userGuild) return; or break; in your case

#

Same goes for fetching the member

#

The member could have left the guild already

tribal crow
#

does it just skip that member then in the for loop or does it stop the whole loop?

boreal iron
#

You need to catch the fetch call as it will error with a unknown member if he isn’t part of the guild anymore

boreal iron
#

Also it would be more efficient to push the member IDs into an array, then fetch em outside the loop passing the array of IDs

tribal crow
boreal iron
#

Instead of creating at least 10 requests

boreal iron
#

I assume you haven’t updated your embed field line

spark flint
#
function getCooldownByRole(member) {
    let staffRoles = [
        "971739561707311194", //admin perms
        "709613582186315868", //admin role
        "885716138753916998", //senior mod role
        "870785251868295168", //game mod role
        "709613208704647171", //server mod role
        "894395598529237013", //trial game mod role
        "832061911600070686" // trial server mod role
    ] // No cooldown
    let highLevels = ["894416612466237471", "894416560192630805", "894416479393574993", "894416418081222737"] // 1 hour cooldown
    let mediumLevels = ["894416251106001017", "894416191022571540", "894416089524633650", "894416023061684265"] // 2 hour cooldown
    let lowLevels = ["894415882275680366", "894415413738340372", "894415132782903296", "894413922445164575"] // 3 hour cooldown
    if (member._roles.some(role => staffRoles.includes(role.id))) return 0;
    else if (member._roles.some(role => highLevels.includes(role.id))) return 3600000;
    else if (member._roles.some(role => mediumLevels.includes(role.id))) return 7200000;
    else if (member._roles.some(role => lowLevels.includes(role.id))) return 10800000;
    else return 21600000;
}

getCooldownByRole(message.member)``` I'm going crazy here, why isn't this working?
#

I tested by returning member._roles, it returned roles which ARE in staffRoles and highLevels

#

response of member._roles

#

discord.js v13

lyric mountain
#

gambiarra at it's finest

earnest phoenix
#

ooo shards ??
how to work??

client.shard
      .fetchClientValues('guilds.cache.map')
      .then((guild) => console.log(guild));

res
[null]
how to using?

boreal iron
tribal crow
#

hmmm

boreal iron
#

Your array doesn’t hold an object with a property id