#development

1 messages · Page 137 of 1

civic scroll
#

maybe you should not use an unnamed timeout call then

hushed robin
#

i need to know how i can make it not error

quartz kindle
hushed robin
civic scroll
hushed robin
#

it's unrelated

sullen crater
hushed robin
#

to that

#

😐

civic scroll
lyric mountain
#

then fix the cause?

hushed robin
civic scroll
#

broski

quartz kindle
#

.catch()

#

or what cassie said

proven lantern
#

nest it in 10+ try/catch statements

civic scroll
#

send the damn stack trace

hushed robin
#

i catch already

quartz kindle
civic scroll
#

JUST SEND THE STACK TRACE

sullen crater
#

you have to delete the error's message if it exists, for security

wheat mesa
#

@hushed robin start from the beginning. Explain your problem like a reasonable human would, and show what you’ve tried, provide your code, and show stacktraces

hushed robin
#

wait nvm i don't

quartz kindle
#

and show stack trace

hushed robin
#

let me see if that fixes

quartz kindle
hushed robin
#

how can i

#

stop code entirely in catch

civic scroll
#

man...

#

that's where debugger comes in

quartz kindle
#

make it return a null value or something

civic scroll
#

i suppose you know how to use the debugger already, no?

quartz kindle
#

then check if the return value is null, return out of the function

hushed robin
hushed robin
civic scroll
quartz kindle
hushed robin
proven lantern
hushed robin
#

why would i do all this

civic scroll
quartz kindle
#

lmao

hushed robin
#

no

#

...

sullen crater
civic scroll
#

how tf else can you stop besides using a debugger

hushed robin
civic scroll
#

this mf

hushed robin
#

this will exit process

#

i need to keep process

#

bruh

proven lantern
spark flint
#

hi cassie are you going insane from battleless yet

civic scroll
quartz kindle
wheat mesa
#

Man I’m not even trying to help and I still want to walk into oncoming traffic reading this

sullen crater
hushed robin
#

i will use tim's solution

#

and see if it works

quartz kindle
spark flint
#

trust me you'll go insane from him one day

civic scroll
queen needle
#

I love every time I come to this channel it's a fight with battleless

civic scroll
#

there, read it for once

quartz kindle
hushed robin
#

no one is fighting

civic scroll
proven lantern
#

debugging is always slower than logging. just add a bunch of logs

civic scroll
quartz kindle
civic scroll
#

nah i need stopping and stepping

#

used to rust / c++ way of deving, mb

quartz kindle
#

they go 59 layers deep

civic scroll
quartz kindle
#

:^)

civic scroll
#

there's also Step Over too i reckon

quartz kindle
#

ye, bug my problem was inside djs

#

so i had to go deep

#

xD

civic scroll
hushed robin
#

ok i am testing your solution now tim

wheat mesa
#

Idk why some people are so against using the debugger. Use logging for simple issues, use the debugger if you need to see what is actually going on

quartz kindle
hushed robin
#

nope

#

i catch and error still occurs

proven lantern
wheat mesa
#

Some people are “always use logging” and some are “always use debuggers”, just use both for appropriate situations

hushed robin
#

someone help

quartz kindle
#

show code

civic scroll
#

even voltrex did

quartz kindle
civic scroll
#

i'm going insane

hushed robin
#

i think it's because of this in my interactionCreate

quartz kindle
wheat mesa
hushed robin
#

how can i make my catch ignore that error

quartz kindle
wheat mesa
#

Valid

civic scroll
#

seriously, don't do unpredictable timeout operation

wheat mesa
#

Debugger saved my life

civic scroll
#

if this man do rust the compiler would bust the shit outta him

sullen crater
#

if you use a finally block, it'll run after the catch OR the not-catch (technical term for the first try closure)

wheat mesa
#

Would’ve spent 10 hours logging 30 different variables instead of being able to step through the methods every frame to see the exact iteration that something went wrong

hushed robin
#

😐

quartz kindle
civic scroll
#

so you did acknowledge the flaw did exist with that code

sullen crater
civic scroll
quartz kindle
hushed robin
#

no

#

they are not

#

but this is not my issue so i am not discussing it further

civic scroll
#

deleting a channel with a pending request to operate on said channel is error-prone

hushed robin
#

please help with current issue

civic scroll
#

except it relates to that issue i mentioned?

quartz kindle
#

show code

wheat mesa
#

guys it’s okay when he does something wrong it’s because he’s a beginner but he also tells the experts that they’re wrong

hushed robin
proven lantern
#

try{}catch(ex){console.log(ex.stack)}

civic scroll
#

exception

quartz kindle
hushed robin
#
Error [ChannelNotCached]: Could not find the channel where this message came from in the cache!
    at Message.edit (C:\Users\battleless\Desktop\andreya\node_modules\discord.js\src\structures\Message.js:723:46)
    at Object.run (C:\Users\battleless\Desktop\andreya\src\interactions\components\commission.js:82:53)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.run (C:\Users\battleless\Desktop\andreya\src\events\interactionCreate.js:31:17) {
  code: 'ChannelNotCached'
}
#

there

#

😐

civic scroll
#

two locations:
commission.js, line 82
interactionCreate.js, line 31

quartz kindle
#

i have a feeling he removed the lines that pointed to his code

civic scroll
#

send the block / function containing said lines

civic scroll
hushed robin
#

i just removed my full name from the stacktrace

civic scroll
#

go

hushed robin
#

ok

proven lantern
#

you need to fetch the channel instead of using the cache

hushed robin
#

that isn't the issue

proven lantern
#

oh

hushed robin
#

and first one is

civic scroll
# proven lantern oh

that was one i was thinking off too
unless the channel was already deleted by the time it gets to it'

civic scroll
#

i don't know what the fuck your try catch is

hushed robin
hushed robin
#

then catch error

civic scroll
#

rings a bell

hushed robin
civic scroll
#

i can't trust your words for it

hushed robin
#

...

#

ok

civic scroll
#

how the fuck are we supposed to help you if we don't know what the code is

neon leaf
#

if you want to ignore the error just add a try catch in the settimeout

hushed robin
#

GIVE ME A MINUTE

civic scroll
proven lantern
neon leaf
#

ah

civic scroll
#

told em to, just didn't do it

quartz kindle
#

fun fact, he can also store the channel reference

hushed robin
#

bro now my bot even start

quartz kindle
#

yes your bot even start

neon leaf
civic scroll
civic scroll
hushed robin
#
if (assets === null) return questionMessage.edit({
    embeds: [{
        description: Text.TimedOut,
        color: Colors.Misc
    }]
});

this is line 82

proven lantern
#

dont use null

#

code smell

civic scroll
#

tfw you could have just if (!assets)

hushed robin
#

because

#

i have one that returns null

#

and one that returns undefined

civic scroll
hushed robin
#

what

civic scroll
#

interactionCreate.js, line 31

proven lantern
hushed robin
civic scroll
#

you didn't tell me anything???

hushed robin
#

yes i did

civic scroll
#

point out then

neon leaf
hushed robin
#

bruh

civic scroll
#

i use null over undefined

wheat mesa
#

undefined is objectively more annoying than null

neon leaf
#

real

civic scroll
hushed robin
#

i think i find solution myself

neon leaf
#

thats why im asking

civic scroll
#

...

#

broski just wasted everyone's time

hushed robin
#

let me test my theory

hushed robin
civic scroll
#

theory: remove the code that has to do with the channel the message originates from

proven lantern
civic scroll
#

either you didn't fetch the channel, or you are possibly having a race condition

neon leaf
#

why would you ever do typeof with em?

hushed robin
#

let me see if my solution works

wheat mesa
#

I can see the concern with that but if you rely on typeof somewhere like that then you probably need to reconsider your decisions

civic scroll
proven lantern
civic scroll
neon leaf
civic scroll
neon leaf
#

you dont have to ever use it

proven lantern
#

javascript uses undefined in the language

#

it never uses null

civic scroll
#

null declares no value

proven lantern
#
x["asdf"]; // undefined, not null
civic scroll
#

while undefined means no reference

neon leaf
proven lantern
#

things can have meaning and not be useful

neon leaf
civic scroll
proven lantern
proven lantern
neon leaf
hushed robin
#

yup

neon leaf
hushed robin
#

issue has been resolved myself

#

thanks guys

proven lantern
#

only send values

wheat mesa
#

guys don’t fight ben on this, he’s far gone on the “code smell” pithole

neon leaf
#

I noticed

hushed robin
#

lets goooooo

#

i appreciate the help guys, it made me realize the mistake

#

i just had to check if the messages channel existed before editing it

#

and now i no longer get the error

civic scroll
#

hope it doesn't break again because that would be very annoying for both of us SkadiDaijoubu

hushed robin
#

it won't

#

my 300 lines of code is perfect

civic scroll
#

don't swallow your sentence if it breaks

neon leaf
#

my 220 lines of route matching are barely working 🔥

civic scroll
#

also if (!assets) > if (assets === null)

hushed robin
hushed robin
proven lantern
civic scroll
#

i told you

#

2014

hushed robin
#

it could return undefined or null

#

so i have to check for the specific one

civic scroll
hushed robin
#

because i made it

civic scroll
#

didn't you control that part yourself

hushed robin
#

yea

neon leaf
#

🤨

proven lantern
hushed robin
#

anyways, i no longer need that

civic scroll
hushed robin
#

so i can just do !assets now

civic scroll
#

bruh

hushed robin
#

yea

#

i was testing to see if that fixed my code

#

but it didn't

civic scroll
#

...

#

shut cho ahh up

hushed robin
#

bruh

neon leaf
#

🗿

civic scroll
#

you said you wouldn't do what i said just to do what i said and confirmed it

hushed robin
#

yeah i couldn't do it because before it could return null or undefined

#

but now it doesn't so i can

civic scroll
#

mfw you don't even know what your code does

hushed robin
#

...

#

i do

#

i wrote it all

civic scroll
#

then why you don't know whether it returns null or undefined????

#

your statements are clashing with each other

hushed robin
#

because i made it return one of them if something specific happens

#

so i need to check after

wheat mesa
#

oh boy

neon leaf
#

!?

wheat mesa
#

That’s fucking awful

civic scroll
#

do they mean anything

neon leaf
#

why not just return a string

#

describing what heppened

hushed robin
civic scroll
neon leaf
#

or even an enum

civic scroll
#

or just to mean "no assets"?

#

what does null stands for assets in this case that is different from that of undefined

wheat mesa
hushed robin
wheat mesa
#

Jesus

#

Throw a fucking error then

civic scroll
wheat mesa
#

Don’t return undefined

hushed robin
#

whats throw?

civic scroll
#

WHAT

#

man

wheat mesa
#

This the same guy telling Tim that he’s wrong

hushed robin
civic scroll
#

....

hushed robin
#

Tim is not an all knowing god

hushed robin
#

he can be wrong 😐

wheat mesa
civic scroll
rustic nova
#

😡

#

disgusting

hushed robin
#

🫠

hushed robin
#

I've been doing it for a few months now

civic scroll
#

and you don't know throw

#

yeah

#

sounds probable

wheat mesa
#

Few months and doesn’t know about throw

hushed robin
wheat mesa
#

This is what discord bots does to people

hushed robin
#

..

#

i know what a try catch is

proven lantern
hushed robin
civic scroll
hushed robin
#

they're telling me to throw

civic scroll
wheat mesa
#

@proven lantern he made a function that returns null to represent no response, and undefined for an error response

hushed robin
civic scroll
wheat mesa
#

Come on

proven lantern
#

return an object with the key error. then check for an error that way

wheat mesa
#

Or… throw it…

civic scroll
#

it's not rust that you can just return an Err

#

it's either a value, or an error being thrown here

hushed robin
hushed robin
#

i use try catch in my code

civic scroll
#

did you even try to read

hushed robin
#

no.

wheat mesa
#

Read the article my man

#

Fucking hell

hushed robin
#

i know what a try catch is

#

bruh

wheat mesa
#

Dude

#

If you read the article you would realize that’s not what it’s about

proven lantern
civic scroll
quartz kindle
#

why use undefined when you can just use void 0 :^)

neon leaf
quartz kindle
#

whats that idea?

civic scroll
#

man

proven lantern
#

and goto

quartz kindle
proven lantern
wheat mesa
# proven lantern

To me this is a terrible way to do things. Your data is not returned in a consistent format, I understand the reasoning behind just checking obj.error but then the user has to know what your return object looks like in both scenarios

proven lantern
#

oh it is a keyword

wheat mesa
#

When you could just return a consistent format or throw an error

proven lantern
#

that JSON guy got the goto keyword removed from JS

wheat mesa
#

I don’t see how that makes him a god

proven lantern
#

just history

wheat mesa
#

I think any reasonable person could suggest that using goto is a bad idea

hushed robin
#

why is goto bad

civic scroll
wheat mesa
#

Difficult to follow code

quartz kindle
#

goto seriously messes up the code flow

wheat mesa
#

Jumps around all over the place

hushed robin
#

what is goto

civic scroll
#

you can do pattern matching with it

hushed robin
#

go to specific code?

proven lantern
quartz kindle
hushed robin
proven lantern
wheat mesa
#

I agree that null is not a great language construct in hindsight but that doesn’t mean you shouldn’t use it ever if it’s in the language

neon leaf
#

I tried using goto for a loop when I started with js 🥸
I literally never touched anything else than batch before

hushed robin
quartz kindle
hushed robin
#

this would be useful

#

ngl

civic scroll
hushed robin
#

how do i use it?

civic scroll
hushed robin
#

goto [line]?

neon leaf
#

you dont

quartz kindle
#

it doesnt exist in js

wheat mesa
#

That is the antithesis of useful in modern languages

hushed robin
#

bru

civic scroll
#

no

wheat mesa
#

That’s what functions are for

neon leaf
#

^

hushed robin
#

with goto i could just go to thhe end of my code t o cancel it

wheat mesa
#

That’s what return is for

harsh nova
#

Or just use logic for that

civic scroll
#

that's what return is for

#

mfw bro failed control flow class

harsh nova
#

I think you'd enjoy the programming language Fortran. Might be hard making discord bots with it though

wheat mesa
#

Goto is absolutely fucking egregious

hushed robin
frosty gale
wheat mesa
neon leaf
#

use async/await then

frosty gale
#

lets you escape nested loops

wheat mesa
#

dear god

quartz kindle
frosty gale
#

without too much ugly code

harsh nova
hushed robin
wheat mesa
#

How did we get to the point of defending goto???

hushed robin
wheat mesa
#

Is this 1983?????

neon leaf
#

yes

hushed robin
#

i know how to handle promises

civic scroll
frosty gale
#

but i get nervous using goto because i dont know how the compiler handles it stack-wise

#

might result in ub

quartz kindle
harsh nova
civic scroll
quartz kindle
hushed robin
#

i can't return

neon leaf
proven lantern
civic scroll
quartz kindle
quartz kindle
neon leaf
quartz kindle
harsh nova
hushed robin
quartz kindle
#

lmao

harsh nova
#

cat ran over my keyboard

hushed robin
#

good

#

thats karma

civic scroll
quartz kindle
frosty gale
harsh nova
#

Me too she's nice

neon leaf
quartz kindle
# hushed robin yea

if you use await, you dont need to use .then() at all, which in turn you will never need to return inside a .then

civic scroll
wheat mesa
hushed robin
#

not it all

frosty gale
quartz kindle
wheat mesa
#

Why

civic scroll
#

and if it needs to go again, i can use recursion and functions

wheat mesa
#

In what language

civic scroll
#

please be c / asm

hushed robin
wheat mesa
#

I wouldn’t even think of it as acceptable in c

frosty gale
#

when im like 3 loops deep its inefficient to do variables outside of it to do stuff like if (broken) break;

#

c

civic scroll
#

think of why you get to 3 loops deep

quartz kindle
frosty gale
#

js has labels so you can do stuff like break label so thats cool tho

frosty gale
civic scroll
wheat mesa
#

Enjoy changing your goto every time you write code above it

frosty gale
#

i was kinda using 3 as an example

#

never really had to use 3

wheat mesa
#

3 loops deep is not unreasonable

quartz kindle
hushed robin
#

my code isn't a function

neon leaf
#

no

#

then make it one

hushed robin
#

i can't return like that

quartz kindle
hushed robin
#

if i return

#

it will end my code...

quartz kindle
#

then dont return

civic scroll
#

mfw node 16+ supports top-level await

hushed robin
#

exactly

#

so i use .then

#

then return the data i want

neon leaf
wheat mesa
#

bruh

quartz kindle
#

you said you cant return inside .then

hushed robin
#

no i didn't

neon leaf
#

but 69% of people still use cjs

quartz kindle
#

so dont use .then and you can return all you want

hushed robin
#

no

civic scroll
#

if you want, use an IIAFE

#

immediately-invoked async function expression

quartz kindle
#

you literally said if you use return inside a .then your code will continue, and you didnt want that

frosty gale
#

waiting for c to support async/await just to fit in with the times

wheat mesa
hushed robin
#

if i return outside of the .then it will end my code...

wheat mesa
#

POV: pathological liar

hushed robin
#

stop calling me a pathological liar

wheat mesa
#

We can’t read your damn mind dude

civic scroll
#
(async () => {
    const data = await operation();
    // do stuff
})();
hushed robin
#

i just wantr specific data

civic scroll
#

HUH

civic scroll
hushed robin
#

in my case i only want message content

#

not anythingelse

civic scroll
#

value extraction is up to implementation and is not related to what we are talking about

proven lantern
#

const {thing} = allThings

wheat mesa
#

const { content } = await somethingThatReturnsAMessage();

hushed robin
#

...

civic scroll
#

reminds me of the "CEO of javascript" guy

civic scroll
#

you wanted the specific stuff from return value

hushed robin
civic scroll
#

????

wheat mesa
#

Man just show us what you’re talking about

#

We can’t keep fucking guessing to read your mind when you can’t explain anything

civic scroll
#

the whole point of not returning in .then is by using await

#

and if you are not using it, when why even assign?

#

just ```js
await operation();

hushed robin
#
const description = await channel.awaitMessages({ filter: m =>  m.author.id === interaction.user.id, max: 1, time: 300000 })
    .then(async message => {
        await message.first()?.delete();

        return {
            content: message.first()?.content || null,
            files: message.first()?.attachments.map(attachment => attachment.url) || null
        };
    });

for example, i only want content and files

wheat mesa
#

wtf are you doing dude

hushed robin
#

...

#

😐

wheat mesa
#

.then AND await??

hushed robin
#

yea

civic scroll
#
const message = await channel.awaitMessages({ filter: { author: { id: authorId }} =>  authorId  === interaction.user.id, max: 1, time: 300000 });
let firstMessage = message.first();
await firstMessage?.delete();
return {
    content: firstMessage?.content || null,
    files: firstMessage?.attachments.map({ url } => url) || null
};
wheat mesa
#

Also I don’t see why you even need || null on either of these here

#

If there’s no files then you shouldn’t return null, you should return an empty array

hushed robin
civic scroll
wheat mesa
#

I wanna see battleless try to use a statically typed language

#

That would be fun

hushed robin
#

now i need an extra variable

#

😐

lyric mountain
civic scroll
wheat mesa
#

Eh that’s not really statically typed, it’s pretty easy to get around the ts compiler

hushed robin
#

firstMessage and description

civic scroll
civic scroll
#

best way to counter any reasonable argument: "ok and"

hushed robin
#

yea

#

because it doesn't affect my code

#

it runs fine

civic scroll
#

then what the hell is your problem

hushed robin
#

my issue has been resolved for a long time now

civic scroll
#

you just posted it and later on you told that "your problem" runs fine?

hushed robin
#

posted what?

civic scroll
# hushed robin my issue has been resolved for a long time now
  1. it's ugly to have nested promise callback in an async function
  2. more or not, variables are stack-based; they are dropped the moment the function exits, unless you are returning its references, then it's a game of passing references around; but even then those variables' won't live beyond said function's lifetimes
hushed robin
#

ok

#

more variables = harder to manage though

#

and i fixed 1. already

civic scroll
hushed robin
#

ok

civic scroll
#

i don't see what's harder to manage in readable code

hushed robin
#

pretend u have 1 employee vs having 10 employees

#

1 will be easier to manage then 10

civic scroll
hushed robin
#

brooooooooo i fixed that

civic scroll
#

and meanwhile my example all runs under the same closure, same function body, without nesting callbacks

#

=> easier to debug

lyric mountain
#

no matter how much u try, e0c will never listen

hushed robin
#

i'm battleless

#

also i listen all the time

civic scroll
#
const message = (await channel.awaitMessages({ filter: { author: { id: authorId }} =>  authorId  === interaction.user.id, max: 1, time: 300000 })).first();
await message?.delete();
const description = {
    content: message?.content || null,
    files: message?.attachments.map({ url } => url) || null
};
// `message` usage stopped beyond this line
lyric mountain
#

ok e0c

civic scroll
hushed robin
#

and my code works perfectly fine

#

so i don't see the issue

hushed robin
civic scroll
#

vs. harder to debug stack trace

hushed robin
#

goodbye guys

lyric mountain
hushed robin
#

if i encounter another issue i will return

#

thanks for the help

civic scroll
#

now bro just escape the argument

#

coward ahh move

hushed robin
#

yea

#

because i don't wanna argue with you

civic scroll
hushed robin
#

bye

civic scroll
quartz kindle
#

lmao

civic scroll
#

holy fucking hell

proven lantern
earnest phoenix
# frosty gale <@456226577798135808> you prob know a little about this lets say you are in a lo...

The compilers will keep track of the stack correctly unless you manually manipulate the stack yourself which you should almost always avoid

About undefined behavior (UB), goto statements can't really cause them, the code in the labels that the executor jumps to are the ones that might cause UB but that highly varies and not guaranteed to cause UB as they're... well, undefined

Though avoid using goto statements as much as possible, use general control flow statements

earnest phoenix
# wheat mesa .then AND await??

Actually that's a pretty valid usage and very widely used, it allows for a specific value to be resolved instead of the user needing to assign the main resolved value, and then use the value that they actually need

#

For example:

const data = await fetch(...)
  .then((res) => res.json());

instead of just assigning the Response instance to the data variable (which in this example we don't need), we can use .then() to only return the JSON value consumed from the body of the said response

#

But Battleless really made a circus out of here ngl

rustic nova
#

normal development behaviour

#

like I said, nobody here is forcing you to help others here

rustic nova
patent onyx
#

Hello, I am new to bot development and I am developing a discord.py bot

I have noticed that a lot of bots have "Invite bot to your server" on their profile and was wondering how I could add that to my discord bot

earnest phoenix
rustic nova
#

everyone whos generally around development

rustic nova
patent onyx
#

im assuming DOT_ID is Bot ID?

proven lantern
patent onyx
#

thank you guys so much

earnest phoenix
# rustic nova like I said, nobody here is forcing you to help others here

I don't think you can just say that when nobody said they are forced to do so, it's just people getting frustrated by someone not listening to the said people that are trying to help them

And when the said someone talks back like that in becomes a circus at this point, the frustration is completely valid IMO

Though I might be misunderstanding what you're exactly pointing at

rustic nova
#

Nah you're understanding it correct, I do entirely understand its frustrating yes

#

Am referring to how helping people here is entirely free to do, of course not saying everyone should ignore certain people they dont like helping, but getting frustrated to the point of possibly saying something they might regret in the end (which iirc we had before) isnt good either

earnest phoenix
#

Hmm I'm not sure if we actually had such a thing happen before but I do see your point, but I'm sure nobody said something they'd regret later on

rustic nova
#

but surely been verryyyy close to that KEKW

earnest phoenix
#

I suppose lul

hushed robin
#

does anyone know

#

i can't find

hushed robin
#

I think this will be enough

hushed robin
#

@deft wolf

#

hey

#

do you have an example of a modals JSON

deft wolf
#

Unfortunately not, I personally used the builder from discord.js

hushed robin
#

rip

#

i will look in the discord.js server

deft wolf
#

Good luck

solemn latch
#

(ie do you want the structure for receiving a modal submit, or what is included when you respond with a modal?)

patent onyx
#

I am a new discord bot developer and I have created a discord bot! Does anyone have any advice to grow my bot? I have my bot in 24 servers and I really want to get it to the 75 needed to verify it. So does anyone have any advice they can share to grow my discord bot!!!! 🙂 thank you!

lyric mountain
lyric mountain
#

which is bad if you're unlucky enough to get a lot of servers in a short timeframe

lyric mountain
#

it's advised to wait until you're near 75 to then add to top.gg

#

else you run the risk of getting flagged for unnatural growth by discord

lyric mountain
#

well, you can also be lucky enough to have a big gap between invites

#

if it does happen, you might need to start again as I didn't hear about anyone managing to get unflagged for it

#

the best tip I can give is create a healthy relationship with your users

patent onyx
#

so should I remove them from all but top.gg ???

lyric mountain
#

no no, leave it there

#

removing then adding it again later is not advised

patent onyx
#

ok I see

lyric mountain
#

thus spreading naturally

patent onyx
#

spreading it naturally

#

so what advice do you have just like sit back and let it grow (doesn't sound too good...)

lyric mountain
#

it's faster than you imagine

sharp geyser
#

As long as your bot is exceptional in the category it does word of mouth will be powerful

lyric mountain
#

like, find a good server to be a "ground zero", then act naturally until someone starts a topic about bots

lyric mountain
#

then you can mention you have a bot, if the conversation allows then u can even talk about it for a bit

#

once the bot is there (if they add it), do your best to create a good image about it

patent onyx
#

I've added things such as real time stock data and crypto currency data 😭 as well as other games

lyric mountain
#

once the foundation is solid enough, and the server has a considerable amount of users it'll start spreading very quickly

patent onyx
lyric mountain
#

just dont let ur bot fall into forgetfulness

patent onyx
#

ok wait... 😭 now im confused

lyric mountain
#

like 3-4k

patent onyx
patent onyx
#

😭 wait what so then just participate a lot and talk a lot

#

then slowly ease my bot into the conversation if it allows

lyric mountain
#

yes

patent onyx
#

and hopefully that server adds it and then the other members of the server add it to their own servers

#

and it grows in that server

lyric mountain
#

yes, that way both your bot and the server grow together

patent onyx
lyric mountain
#

around that yeah

#

your bot needs to be notable in what it does

#

like, if it's an economy bot make it so you can offer something to the server

#

like paid roles or minigames

patent onyx
lyric mountain
#

not in that sense of "offer"

#

I mean offer features to the server

#

be useful

patent onyx
#

ok I see

#

since its more of a economy bot should I aim for like a gaming server or one of those

lyric mountain
#

yep

#

keep asking yourself "there are many economy bots, what mine can offer to be notable?"

patent onyx
#

so I kept thinking of features to add

#

I added stuff like real time stock and crypto currency data and graphs and all that and then a couple other features

lyric mountain
#

also a thing that REALLY helps, but must be done at the start is i18n

#

which is having many languages for the bot

patent onyx
#

ah how do I impliment that

lyric mountain
#

but you can always rewrite it later on

lyric mountain
patent onyx
#

ah thats goiing to be a lot to impliment isnt it?

lyric mountain
#

you create files with a predictable name (like lang_en, lang_es, etc), then add a configuration to each guild for selecting which u want

patent onyx
#

ahhh thats smart multiple files and based on what the server sets their languange to call upon that file

lyric mountain
#

yes, then in those files u make a key-pair structure

#

can be json, yaml, init, whatever

#

just make sure they user the same keys

#

then u translate the value

patent onyx
#

yeah it might have to be JSON for me but yes I undestand how I might have to implimenmt that

lyric mountain
#

u dont need to do it now, but it's easier to do the earlier u are into a project

#

later on it becomes...awful to implement

patent onyx
#

instead of later one when i have like 50 commands and now have to change all of them

lyric mountain
#

yeah

#

I had to rewrite my bot because no way I'd be replacing 3k+ strings

patent onyx
# lyric mountain yeah

awesome I will do that then!!!! any other advice you have to grow it? I will remmeber to add the languange thing and join a discord server and grow along with it

patent onyx
lyric mountain
#

currently it's in 7.8k servers, it's a card collecting/moderation/levelling bot

patent onyx
#

card collection is amazing

#

like was it difficult?

lyric mountain
#

not exactly, but it involves a lot of optimization to keep everything snappy

patent onyx
#

ahh i can imagine... how long did it take to get to 7.8k servers????????

lyric mountain
#

the main feature tho, that one was complex

patent onyx
lyric mountain
patent onyx
#

ahhh I see

#

and did you use that method that you told me?

lyric mountain
lyric mountain
patent onyx
#

a whole like trading card game?

lyric mountain
#

yep

patent onyx
#

dang that must've took a while

lyric mountain
#

I think I made the MVP in 2 months or so back in 2021, then it was constantly updated until mid 2022

#

then I started rewriting the bot entirely

patent onyx
lyric mountain
#

as in, the "at least it's playable"

patent onyx
#

ohhh

#

yes I have heard of that

lyric mountain
#

but dont give up, once you get the momentum going you'll accumulate servers steadily

patent onyx
#

dang you are actually really helpful and good at this seriously I appreciate and thank you for helping me and giving some advice I am 150% going to use this to try and grow my discord bot!!!!

lyric mountain
#

then you start needing to worry about being able to supply all those servers

#

which is around 5k servers I think

patent onyx
#

any other advice than that or should I stick true to that and keep repeating it

lyric mountain
#

hm, try to crack your mind as much as you can

#

the struggle is what teaches you the best ways to do something

sharp geyser
#

Also with the i18n thing mentioned earlier idk if haku said but it’s really easy to implement yourself you don’t need a package

#

All it is just indexing json files based on what language the server is set at

patent onyx
sharp geyser
#

Yea json files is the best

lyric mountain
#

it's one option, I personally prefer properties

#

as I don't need to parse the whole thing

#

some_key=This is a text

sharp geyser
#

You can name the files lang_shorthand (lang_en) and just grab the json file based on the language set for the server

#

Then you can save that json file to a variable or map if you want and index that map for any keys you need

patent onyx
#

seriosuly you guys are both super helpful and im still in school and this is a hobby project so I am hoping to grow it but more importantly grow my own coding experience ... I also made this all by myself and im lowkey proud of it so thats mainly the thing to keep pushing myself to grow it

sharp geyser
#

I have an example of an i18n implementation in a different language but it’s rather easy to comprehend and could be ported over to python

#

If you want it lmk

patent onyx
sharp geyser
patent onyx
#

the bot has only been around since March 18th 2023

lyric mountain
#

once you get a considerable amount of texts I recommend using a non-parsed format

#

as you might start having issues with the size of the json

#

by big I mean like thousands of lines

patent onyx
#

right now... ummm lemme show you smtg

#

4801... lines of code

sharp geyser
patent onyx
#

then I use mongoDB for storage and then some things are stored in JSON files

sharp geyser
#

It’ll help you keep your code organized

patent onyx
#

yeah i need to teach myself that 😭

lyric mountain
sharp geyser
#

Also I hope you arent using json to store constantly accessed data

lyric mountain
#

but everyone starts like that

patent onyx
#

and mongoDB

sharp geyser
#

I don’t recommend using json for any data that is constantly read or written to

#

Especially if it’s important data

lyric mountain
#

rule of thumb is: db for read/write, json for read-only

patent onyx
#

ok so here is how I have my stuff let me know what you think

#

I use mongoDB for my more constantly used storage

#

and then like approvedGiveawayusers, premium_members, and shop.json, and gamblingStats.json are my only JSON files

sharp geyser
#

I mean technically json is fine to use if it’s not written to at a constant rate but still bad practice to use it for storage of important data

#

It can be corrupted

lyric mountain
#

[object Object]

patent onyx
sharp geyser
#

If you’re only reading the json file it’s fine

#

But once you start writing to it corruption can occur

patent onyx
patent onyx
#

imma have to then move them to mongoDB

sharp geyser
#

possibly but I wouldn’t risk it

patent onyx
lyric mountain
#

if u want a json-y storage u can also use redis

sharp geyser
#

^

#

One thing with redis is it’s not persistent by default

#

It’s more of a caching thing but it can be made to persist

patent onyx
#

redis?

lyric mountain
#

it's a key-value database that's mostly used for cache purposes

#

but can also be used in place of a frequently updated json file

patent onyx
#

ok imma see about that then

sharp geyser
#

You will need a Linux server for it though

#

Redis doesn’t run well on windows

patent onyx
#

😭

sharp geyser
#

Although I think you can use WSL

lyric mountain
#

btw, try to use linux for hosting the bot if possible

#

windows hogs so much resources to it

sharp geyser
#

If you need hosting lmk

patent onyx
sharp geyser
#

I have a vps I hardly use

lyric mountain
#

aws is linux no?

patent onyx
#

i think so

sharp geyser
#

AWS has multiple options iirc

sharp geyser
patent onyx
sharp geyser
#

I wont charge ya

patent onyx
sharp geyser
#

I have a vps I only use for my email server

patent onyx
#

but if I need to imma 100% message you

#

may I add you?

lyric mountain
#

you managed to get it working lmao

sharp geyser
#

Sure

sharp geyser
patent onyx
sharp geyser
#

It still interrupts other shit pointed to my VPs

lyric mountain
#

their email server

sharp geyser
#

That’s why my portfolio is broken

patent onyx
sharp geyser
#

It keeps trying to use the SSL cert for my email server

lyric mountain
#

setupping an email is insanely annoying because everyone everywhere questions your authenticity

#

the smallest slip and you get sent to the spam folder

sharp geyser
#

It’s for my personal use anyways so ye

lyric mountain
#

I prefix all lines with a category, not really necessary

sharp geyser
#

I wonder if people will find it useful for me to port my locale package to python

#

It’s shit anyone could do themselves but idk

lyric mountain
#

Worth a try

#

At worst it'll just be a leftover project, at best it'll help someone

sharp geyser
#

Fair enough

#

I’ll do it tonight

earnest phoenix
#

what's the correct way to host a discord bot if you want it to be scalable, I'm currently using screen to keep it running 24/7 on my ubuntu vps, is that the correct method or not?

sharp geyser
#

just use pm2

#

screen is a very crude way of doing it

#

@wheat mesa it would be better to screenshare what is happening

earnest phoenix
#

no container?

#

I've seen people use that, is there any difference in performance

wheat mesa
sharp geyser
#

I can take a vid then

wheat mesa
#

Sure

sharp geyser
wheat mesa
#

Send the code you’re currently using for that clip rq

sharp geyser
#
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    // Public Variables
    [SerializeField] public float movementSpeed = 10;
    public Rigidbody playerRigidBody;
    
    //Private Variables
    private InputManager inputManager;
    private Vector3 moveDirection;
    private Transform cameraTransform;
    
    private void Start()
    {
        inputManager = InputManager.Instance;
        cameraTransform = Camera.main.transform;
    }

    private void Update()
    {
        Vector2 movement = inputManager.GetPlayerMovement();
        Vector3 move = Time.deltaTime * movementSpeed * (new Vector3(movement.x, 0f, movement.y));
        move = cameraTransform.forward.normalized * move.z + cameraTransform.right.normalized * move.x;
        move.y = 0f;
        moveDirection = move;
    }

    private void FixedUpdate()
    {
        if (moveDirection.magnitude == 0)
        {
            playerRigidBody.velocity += Vector3.zero;
        }
        else
        {
            playerRigidBody.velocity += moveDirection;
        }
    }
}
wheat mesa
#

You’re doing += Vector3.zero

#

Set it to zero instead

sharp geyser
#

You can't do that

#

velocity expects a Vector3

#

Vector3.zero is just new Vector3(0,0,0)

wheat mesa
#

I know

sharp geyser
wheat mesa
#

playerRigidBody.velocity = Vector3.zero

sharp geyser
#

Ah

#

That works

#

For now

wheat mesa
#

👍

lyric mountain
#

Idk, allows me to have separate command histories, and keep everything separate

#

Also easy access to where I left it in

sharp geyser
#

to each their own

#

I find screens to be very crude

hushed robin
#

whats wrong with this embed

{
    author: {
        name: user.username,
        icon_url: user.displayAvatarURL()
    },
    description: vouch?.content,
    fields: {
        name: 'Attachments',
        value: vouch.files?.map(file => `[Link](${file})`).join(', ') || 'None'
    },
    footer: {
        text: `Want to commission? Make a ticket!`,
        icon_url: Images.SGAdvArrow
    },
    color: Colors.Review
}```
#

oh wait

#

nvm i think

sharp geyser
#

Well what is happening that you don't expect

hushed robin
#

i forgor

sharp geyser
#

yep

#

@wheat mesaidk if you will know this answer, but what do you think would be the best way to tell if the rigidbody is "grounded"

#

I was thinking of checking collisions but that doesn't necessarily mean they are on something solid and not running into something solid as well

hushed robin
sharp geyser
#

Actually I think the best method is to use a downward raycast

hushed robin
#

do you know how i can return nothing if there's no files

sharp geyser
#

you mean if vouch.files is null?

hushed robin
#

if there's no files it'll just set the fields value to None

#

how can i make it not add the field at all

sharp geyser
#

Yea what about it

#

Well

wheat mesa
#

use logic

#

if statements

hushed robin
#

i tried an if statement in there

#

it error

sharp geyser
#

you can use an if statement or possibly a ternary operator

wheat mesa
#

"but that means I need more variables 😢"

wheat mesa
hushed robin
#

so your saying i need to make an extra variable

wheat mesa
#

🤷‍♂️

sharp geyser
#

Do you think using a downward raycast to see if the player is touching terrain/floor is a proper method to see if they are grounded waffle?

hushed robin
#

how can i do it without

sharp geyser
#

💀

wheat mesa
#

same concept should apply though

sharp geyser
#

I see

hushed robin
sharp geyser
#

I don't think I will need to check for walls though will I?

#

As long as a wall has a collider it should make it so my character won't walk/run through it.

#

I don't see any functional reason to check for walls so I should be fine not doing so right?

wheat mesa
#

likely not

#

For me it was different because my engine didn't have checks like that

#

(I am lazy) ((I hate programming quadtrees in java))

sharp geyser
#

Lmao

#
    private bool IsPlayerGrounded()
    {
        return Physics.Raycast(playerRigidBody.position, Vector3.down);
    }

well this returns true

#

but

    public bool PlayerJumped()
    {
        return playerControls.Player.Jump.triggered;
    }

this doesn't

#

despite me pressing space

#

😔

#

Unity's new input system is confusing me

hushed robin
#

anyone know how i can do the above

#

getting approved is ez

#

just follow guidelines

#

is your bot Proje or Ro-Linker

#

why is that the applications name

#

js?

wheat mesa
sharp geyser
#

It should be ye

hushed robin
#

u can use the api

#

but you'll possibly run into ratelimit issues

#

i mean

#

the ratelimit is 60 requests / minute iirc

#

no api

#

webhooks don't have a ratelimit

#

which is why it's preferred

#

idk

#

well yeah, webhooks are the ideal option

#

👍

neon leaf
#

is there a react library that allows image cropping like this? (uptime kuma)

vivid fulcrum
#

customize it to your liking

neon leaf
#

I already tried that

#

it doesnt display 16:9 images as 1:1 like uptime kuma

rustic nova
#

oh pog

eternal osprey
#

hey guys is it possible to have a sort of module in my main file. which will run another bot automatically when the main bot starts?

#

like i want to have 2 index.js files which each wil contain a client.login but with different tokens ofc

#

i was thinking about using child_process and using its exec

vivid fulcrum
#

literally everything in that library is modifiable, including the aspect ratio

earnest phoenix
#

Oh hey Cry, long time no see

#

Where you been? 👀

neon leaf
vivid fulcrum
#

you're doing something wrong, by modifying the aspect ratio in their codesandbox i get the result you want

neon leaf
#

give me the link then

vivid fulcrum
#

it's in their readme

vivid fulcrum
neon leaf
#

I want it to display the entire image 1:1 like in uptime kuma

#

not the crop

vivid fulcrum
#

barely get on my pc anymore because the last thing i want to do after 8 hours of staring at a laptop is stare at another screen

#

but i at least get paid for my dev time now 🙃

#

how you been doing

vivid fulcrum
neon leaf
#

not like in uptime kuma though

vivid fulcrum
#

keep the cropping logic from the library, customize it using your own components and css styling

neon leaf
#

if I force it I cant drag

earnest phoenix
neon leaf
vivid fulcrum
#

if you're looking for something prebuilt, you won't find it. the lib helps you implement the logic you want

#

now, whether you know how to do it or not is on you 🤷‍♂️

frosty gale
#

i swear js changed completely since i last learnt it

#

since when were private class attributes and defining attributes outside of a constructor/method a thing??

#

js is evolving into the master language

#

soon we'll be programming large language models in js

#

... once js gets tensors and methods for manipulating large mathematical structures easily maybe even on the gpu????

#

who knows what the future holds for java holy script

deft wolf