#development

1 messages · Page 224 of 1

sharp geyser
#

Well all the more power to ya

#

I remmeber before your only way was to rely on audit logs

#

and that was unreliable

warm imp
#

Do you know how to set it up?

sharp geyser
#

Ima be real Blissy

#

It's probably best you read the docs more often

#

We can't hand hold you every step of the way

warm imp
digital swan
sharp geyser
#

The docs give you the building blocks for what you need to do

#

Its your job to piece them together

quartz kindle
#

i mean the person who joined with said invite

sharp geyser
#

I remember being able to

#

Oh well I guess not

#

Maybe im remembering wrong

digital swan
#

yeah it doesnt look like that exists

sharp geyser
#

its strange they give you who made the invite

#

which is useless on its own

digital swan
#

they have the data too bc its visible on the members tab

quartz kindle
#

when someone joins, you need to refetch all invites and check which one had its use count increased by 1

#

its dumb

sharp geyser
#

yea

#

uhm

#

time to submit a request!

#

I mean

#

It can't be that hard for them to add it right?

#

Its literally just passing the invite used to the gateway event

digital swan
#

theyre too busy charging 30%

sharp geyser
#

its not 30% anymore

digital swan
#

oh it got changed

sharp geyser
#

Somewhat

#

Its still 30%

#

just for the first 1m earned

#

they only take 15%

digital swan
#

still insane

sharp geyser
#

After 1m they start taking 30% again

sharp geyser
#

Not necessarily

#

Could they survive taking a lower rate? Sure

#

But for what they offer its still hell of a deal

#

They basically do all the integration for you

#

Saving you hours of labour

#

All they do is take a cut off the transaction for that labour

#

All you need to do is a simple
if user doesn't have this pack deny them this access

#

and boom

digital swan
#

it still seems extortionate

sharp geyser
#

You wouldn't pay someone building your house only 30% of what you owe them

#

Don't get me wrong, I still think 15% and even 30% is a high rate to take

#

But for what they give you in return its not the worst thing in the world.

#

Not to mention there is nothing in their monetization TOS that says you can't use outside sources to gather income

digital swan
#

yeah i agree that they can take a fee but 30% even after 1m is a lot

sharp geyser
#

Yea I still think its not

#

Its a high fee yes

digital swan
sharp geyser
#

Its what most companies do

sharp geyser
#

The best they can do is say (what they are doing now) use our platform as a source of income

warm imp
#

Thats how it searches for it

digital swan
warm imp
sharp geyser
#

but thats only as a single source of income

#

you can still use other sources

#

like paypal, stripe, ko-fi

digital swan
#

wdym

warm imp
digital swan
#

like you have to have it available on discord?

sharp geyser
#

yes

digital swan
#

ohhhh

sharp geyser
#

Discord is going to require you have your premium plans on their platform as well

digital swan
#

but you could still like nudge people into paying elsewhere

sharp geyser
#

yea certainly

#

The key thing is

digital swan
#

thats not too bad then

sharp geyser
#

The prices on discord have to match everywhere else

#

but the other key thing is,those other places aren't charging 30%

#

So even if on discord you sell it for 10$, and on paypal you sell it for 10$ you are making more on paypal anyway

digital swan
#

is there not the loophole of you cant sell anything on discord if your bot has fake gambling

sharp geyser
#

That's where it becomes a legal issue

#

In the US online gambling is prohibited

#

and since discord is a US company they are restricted by those laws.

#

So even though the currency on your bot isn't real. If you sell that in-game currency for a monetary price it's still considered taking money for gambling

#

Not to mention the users won't get anything in return

#

💀

quartz kindle
#

basically discord became corporate garbage

digital swan
#

they get the adrenaline of fake gambling ofc

quartz kindle
#

like everything that gets big

sharp geyser
#

its a sad truth

#

but at a certain point you have to make changes

quartz kindle
#

still

#

discord cant control everyone

#

nothing stops you from getting your bot verified and later on accept donations

sharp geyser
#

you won't survive in corporate america if you don't conform to its twisted desires

sharp geyser
#

They can't from my understanding

#

Just if you sell any premium plans, they want it to be done through discord as well

#

So that way in the off chance people do purchase through discord they get a cut

digital swan
#

did they not just add one time purchases too

sharp geyser
#

Their new announcement that contained all this information had a lot of future updates in the work

quartz kindle
#

"premium" via donation has always been a legal loophole

#

churches and non profits use it

sharp geyser
#

They plan on having One Time Purchases (already released ), Multi-Subscriptions, Expiring Skus etc etc

digital swan
quartz kindle
sharp geyser
#

but maybe giving them a reward

#

like extra in game currency

#

or a free trial

#

shrug idk what discord has planned so that was just speculation

#

but according to the terms any premium features must be sold through discord as well

#

a donation can be any amount of money

#

which is why I think discord wont see kindly to that

pine willow
#

Bruh i wrote a Ticket to move my bot to an team

#

No respond

#

Bullshit

#

Idfk why i can't move it on my own

warm imp
real rose
#

or do you mean Discord

#

not topgg

digital swan
# warm imp Do you know how to do it?

I’ll give you the general plan but I’m not gonna teach you how to do it

You need a database to make a record of all the invites (I’d recommend sqlite and prisma assuming you’re very new to this)

Every time a member joins you need to fetch all the invites in the server and compare them to the ones you have stored, one invite will have a higher number of joins.

And tada you’ve just found which invite the user used to join

But if you’re new to coding and this is your first sort of thing you want to work on I’d recommend something smaller first

sharp geyser
pine willow
#

Somehow i can't move my verified bot to an team

sharp geyser
#

What error does it show

real rose
#

about anything to do

#

with verified bots

#

the fact you cant change the name

#

is diabolical

pine willow
sharp geyser
#

oh yea

#

GL

pine willow
#

Idfk what that is

sharp geyser
#

They don't allow you to move a verified bot to a team

#

or do much with it

pine willow
#

But i have to otherwise i can't monetize it

sharp geyser
#

didnt you say you never planned on it

pine willow
#

That sucks

#

I changed my mind.

sharp geyser
#

I did tell you to move it to a team before verification

pine willow
#

Yes

sharp geyser
#

"Nah man, I dont plan on monetizing it"

pine willow
#

I know

sharp geyser
#

Well just in case do it anyway

#

"Nah its okay"

pine willow
#

I know

#

How am I supposed to know that you can't do all this if the bot is verified

#

Bullshit

sharp geyser
#

well because you aren't supposed to be changing anything about the verified bot tbh

real rose
sharp geyser
#

At that point they'd have to reverify you and what not

sharp geyser
#

Probably internal records bullshit or smth

pine willow
#

Hm

sharp geyser
#

Once a bot is verified its supposed to remain in its current state.

#

Name and whatnot

pine willow
sharp geyser
#

:)

pine willow
#

I just have to keep using Patreon shrug3d

sharp geyser
#

Well

#

Good luck

pine willow
#

Hm

sharp geyser
#

October 7th you will be forced to use monetization on discord's platform

pine willow
#

BRO

sharp geyser
#

Gives you plenty of time

#

but still

#

keep that in mind

pine willow
#

Yes, thank you

sharp geyser
#

Make as much money as you can outside of discord before it becomes another payment method

#

People will likely prefer the simplicity since their card details are already entered on discord

#

and its no sweat off their back

pine willow
#

I got a few Donations Already

sharp geyser
#

Nice

#

how much?

#

Might need to tax you /j

pine willow
#

Its a nice start

quartz kindle
#

pay me now with gift card or go to jail

pine willow
sharp geyser
#

ong

#

discord fixing to come in

quartz kindle
#

DO NOT REDEEEm

sharp geyser
#

Found this gem

pine willow
#

WHY DID YOU REDEEM IT

#

WHY- DID YOU!! REDEEM IT

sharp geyser
pine willow
#

Next gen Toilet

sharp geyser
#

yknow sometimes I forget this isn't general chat

#

with how much tim and I talk here about nonsense

#

💀

pine willow
#

You are just here too often

sharp geyser
#

that's fair

#

I probably have a combined like 40-50k messages amongst my 3 accounts that have been in top.gg

pine willow
#

Damn

sharp geyser
#

in this channel alone

#

at least

pine willow
#

On my phone it says 1000+ for me

#

In all Channels

sharp geyser
#

Which in hindsight isn't a lot but I didn't actually start talking in this server until like a few months after joining this server back in 2018

#

Also, I think its sad that 77% of tims messages are from this channel

#

💀

quartz kindle
#

cries

sharp geyser
#

111,589 messages

pine willow
sharp geyser
#

I have 27k messages on this account

#

I had roughly the same if not more on my last one

pine willow
#

Idk how much i have

sharp geyser
#

and the one before that only had like 2k messages

#

1 account got banned from top.gg then I deleted it because I was being harassed by women 😏

#

the last one I got termed for joking I was 12

#

Had no id at the time couldnt prove I was actually 18

pine willow
#

I had that a few times

sharp geyser
#

this is my last account

#

if this one goes bye bye i am making a chat app of my own

#

fuck it

pine willow
#

I'm your first user

#

Where is Beta?

#

Lmao

sharp geyser
#

uhm

#

I haven't been banned yet

#

so

#

who knows

pine willow
#

Say you are 12

sharp geyser
#

no ty

pine willow
#

I dare you

sharp geyser
#

I made sure this account got verified

#

💀

sharp geyser
#

@quartz kindle btw tim

#

how hard would it be to make a reverse image search service

#

do you know what would be required?

pine willow
#

Uh

#

Sounds complicated

sharp geyser
#

maybe

pine willow
sharp geyser
#

but I gotta find the sauce of some stuff

#

and i'd like to make it a user install app for myself

pine willow
#

Maybe you need ai for it?

sharp geyser
#

so I dont have to visit tin eye, yandex or google

pine willow
#

Idk

pine willow
#

Why do you Ping?

earnest phoenix
pine willow
#

Report the Reviews

sharp geyser
#

Report the reviews

#

Dont ghost ping

#

:)

earnest phoenix
quartz kindle
sharp geyser
#

you are supposed to know everything

pine willow
earnest phoenix
pine willow
sharp geyser
#

its a multi purpose bot

earnest phoenix
earnest phoenix
sharp geyser
#

it wouldn't be a multi purpose bot if it didn't have at least that many

#

Because as you know

#

people need 350 commands they hardly will ever use

#

:)

sharp geyser
#

Right I should be more specific in my searches

#

guess I thought the python library would show up

#

💀

earnest phoenix
sharp geyser
#

brave

sharp geyser
#

I was looking for the watchdog library

#

💀

digital swan
sharp geyser
#

@quartz kindle
curl: (26) Failed to open/read local data from file/application Dont you love getting this error when using curl

#

Funny thing is

#

if I call the sh script that uses curl directly no problems

#

but im calling the script inside of a python file

#

so for some reason it's having issues

quartz kindle
#

why would you use curl from inside python?

#

just use some python http lib or whatever

sharp geyser
#

well because im too lazy

quartz kindle
#

huehuehue

sharp geyser
#

script was already there

#

thought I could use it

quartz kindle
#

well idk why it wouldnt work

sharp geyser
#

My first thought was permission issues

#

but then I ran it with sudo

timid spear
#

Do you know if when you answer a review, the answer is not displayed?

sharp geyser
#

Known issue

#

No ETA for fix

quartz kindle
sharp geyser
timid spear
#

but the answer can be seen by the other user

quartz kindle
#

maybe needs some escaping in your python command

sharp geyser
#
curl -H "authorization: adasd" https://files.aarondye.dev/api/upload -F file=@"$1" -H "Content-Type: multipart/form-data" -H "Format: random" | jq -r '.files[0]' | tr -d '\n' | pbcopy;
#

this is the script

#

it works fine when I call it normally ./script filepath

#

but for some reason when python calls on it then it breaks

quartz kindle
#

how do you call it in python?

sharp geyser
#
from watchdog.events import FileSystemEvent, FileSystemEventHandler
import subprocess

class EventHandler(FileSystemEventHandler):
    def on_created(self, event: FileSystemEvent) -> None:
        if not event.is_directory and event.src_path.endswith('.png'):
            # print(event.src_path)
            subprocess.run(['./zipline.sh', event.src_path], capture_output=False, check=True)
#

using subprocess

#

there is also like a 5-10s delay before on_created is called

#

no idea why

quartz kindle
sharp geyser
#

huh

#

oh sorry

quartz kindle
#

subprocess.run(['./zipline.sh', event.src_path], capture_output=False, check=True, cwd='/root/somefolder')

#

also try adding sh or bash to the beginning of the array

#

some people say it only works with bash, others say it only works with sh, others say it only works without them lol

sharp geyser
#

curl: (26) read function returned funny value

#

well thats something new

quartz kindle
sharp geyser
#

wonder what it means

quartz kindle
#

that happens when the curl file parameter cant find the file

sharp geyser
#

but it exists

quartz kindle
#

log event.src_path

#

to see what kind of path it is, if its absolute, relative or some other

sharp geyser
#

its absolute

#

maybe its the spaces?

#

But that doesn't make sense because its enclosed in ""

quartz kindle
#

what if you run it with sudo?

sharp geyser
#

same thing

quartz kindle
#

from what im looking on stackoverflow and shit

#

the entire file=sutff should be enclosed no?

sharp geyser
#

I dont think so

quartz kindle
#

-F "file=@..."

sharp geyser
#

I can trye

#

yea that makes no difference

quartz kindle
#

does it show anything else if you add -v to the curl command?

sharp geyser
#

I can try

#

where should i add that

#

anywhere?

quartz kindle
#

somewhere after curl and before |

#

lel

sharp geyser
quartz kindle
#

nothing useful lel

sharp geyser
#

yea

#

I really dont know what else to do

#

this is to upload screenshots to my file host

quartz kindle
#

i mean

#

you can just

sharp geyser
#

make it in python fully

#

ik

#

but lazy

quartz kindle
#

subprocess.run(["curl", "...", "...", "...", "...", "...", "...",])

sharp geyser
#

granted ive spent more ...

#

wtf is that

#

😭

#

I could yea

quartz kindle
#

remake the entire curl command in subprocess

sharp geyser
#

ima just make it using aiohttp

#

my problem rn is

#

for some reason there is like a 10s delay

quartz kindle
#

or use os.system instead of subprocess

sharp geyser
#

It takes like 10s for the on_created function to be called

#

which is kind of weird since the event system is supposed to be fast asf

quartz kindle
#

what calls it?

sharp geyser
#

watchdog

#
import time
from event_handler import EventHandler
from watchdog.observers import Observer
if __name__ == "__main__":
    event_handler = EventHandler()
    observer = Observer()
    observer.schedule(event_handler, path='/Users/aarondyejr/Pictures/', recursive=False)
    observer.start()

    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()

#

this is how I was told to do it

#

kind of weird if you ask me

quartz kindle
#

i have no idea

sharp geyser
#

I mean its not a big deal tbh

#

but I feel like it could be faster

#

unless macos is explicitly slowing it down

quartz kindle
#

what is that while true doing?

sharp geyser
#

supposedly keeping the thread active

#

or so my research told me

quartz kindle
#

the observer doesnt do that by itself?

sharp geyser
#

because I myself also thought that was weird

#

apparently not

quartz kindle
#

thats even more weird

sharp geyser
#

ima just rewrite it using aiohttp

sharp geyser
proven lantern
#

anyone know how to run a rust lambda locally on windows?
use lambda_http::{run, service_fn, Body, Error, Request, Response};

sharp geyser
#

wdym

#

its not like rust changes depending on the env you are on

#

it tells you the error

#

whatever you are trying to connect to refused the connection

proven lantern
sharp geyser
#

well it obviously is if its using hyper

#

hyper is an http library

#

something you are using is using it

#

or you forgot you are using it

proven lantern
#

this is the only reference in my codebase and it's in the target folder

sharp geyser
#

yea

#

something is using it

#

its a dependency

proven lantern
#

aws lambda must do something weird

#

i just want to test it locally

sharp geyser
#

well

proven lantern
#

maybe i can remove the lambda stuff and just test the function

#

for local testing

sharp geyser
#

sure

#

might work

proven lantern
#

i need to learn rust

sharp geyser
#

any of those http libs possibly use hyper

proven lantern
#

probably the first step

sharp geyser
#

aws-sdk-lambda definitely uses http

#

Im not searching through its deps tho

sharp geyser
#

Depends on how well you know statically typed languages

proven lantern
#

i kinda know it

#

but it's hard

sharp geyser
#

I mean, I started using rust in a large project and just learned it along the way

proven lantern
#

too much typing

sharp geyser
sharp geyser
#

its one of the resources I used to learn what I know

proven lantern
#

i wish rust had a way to make properties in a json! optional

let res = if ephemeral_commands.contains_key(command_name) {
    json!({
        "type": InteractionCallbackType::DeferredChannelMessageWithSource as i64,
        "data": {
            "flags": 64,
        },
    })
} else {
    json!({
        "type": InteractionCallbackType::DeferredChannelMessageWithSource as i64,
    })
};
sharp geyser
#

why would you do that

#

just use the normal serializer/deserializer

sharp geyser
proven lantern
proven lantern
#

why do i need to use #[tokio::main] to make my function async?

sharp geyser
#

you need an async runtime

#

the keywords exist

#

but without something like tokio, good luck

eternal osprey
#

Yo I am finally done with my exams

#

I survived

sharp geyser
#

nice!

silver jackal
#

good morning chat

eternal osprey
#

Is there any way to stop a js script and run node . again somehow?

#

While the script is running

#

so:
Script catches a certain command, script restarts itself

harsh nova
#

That's easy with pm2

#

I guess you could also run a parent script that runs whatever script you want as a child process which will allow you to kill and start it like you want

harsh nova
#

Yeah just process.exit whenever that command is ran and it'll work how you want it to work if you use those tools

proven lantern
#

just strict type things

eternal osprey
#

Ah I see

#

Thanks!

quartz kindle
#

launch a detached shell script that restarts the node script

digital swan
#

with a composite primary key on postgres does it create an index for both columns or a single index for each column

lyric mountain
#

it'll create an index for the primary key

#

so 1 index with both columns

#

you can check this on your dbm

digital swan
#

awesome ty

eternal osprey
#

is there someone who can explain me the discord time formatting

#

to get like a cooldown ya know

#

well i got it:

const time = Date.now()
= 1718724829722
when i now use

<t:1718724829722:f> 

it displays me, 24 march 55545??

is the date.now wrong or sum

deft wolf
#

Shouldn't you divide it by 1000 or something like that?

#

Because Date.now() returns the number of milliseconds and Discord probably takes seconds when it comes to timestamp PepoThink

lyric mountain
#

so yes, divide by 1000

digital swan
#

and dont forget to math.floor

lyric mountain
#

(Date.now() / 100) >> 0 is faster mmLol

eternal osprey
#

owh damn

eternal osprey
lyric mountain
#

parseint is string -> int

eternal osprey
#

it also takes numbers tho

lyric mountain
#

dont think so

eternal osprey
lyric mountain
#

if u pass a number to it, it'll first call toString() before passing as param

eternal osprey
#
const time = parseInt(Date.now() / 1000)
console.log(time)```
#

it does

lyric mountain
#

it doesn't

#

remember, js doesnt error

eternal osprey
#

it returns me the output though?

eternal osprey
#

Huh but why

lyric mountain
#

because js doesn't error

eternal osprey
#

how can it error and return the right answer?

lyric mountain
#

it's extremely lenient and will try to convert here and there to make it fit

#

it doesn't error

#

ffs

#

parseInt takes a string

#

it'll convert the double to string

#

then parse it

eternal osprey
#

Aha okay should have said that then

#

thank you

lyric mountain
#

i did

eternal osprey
#

nahh

lyric mountain
#

on the first message

lyric mountain
#

js will always try to fiddle with things as much as possible before resorting to erroring

#

cuz "we cant break web"

#

it's also part of why I dislike js

eternal osprey
#

i see, sounds cool

#

That's why i love java though. Java goes straight to the point and tells you to fuck yourself

lyric mountain
#

(number >> 0) is faster btw because it'll truncate the value, no conversions happening nor any calculations

#

just raw trunc

queen needle
#

How does the speed of it compare to ~~(number) ?

lyric mountain
#

that's 2 ops

eternal osprey
lyric mountain
#

yep

#

but since floating point cant bitwise, it simply discards the decimals

eternal osprey
#

Ahh omg i see

#

I swear i had such a problem when creating my own cpu on logicgate

#

Or it had to do with some of my registers not responding.. ion know

#

but thanks

pine willow
#

Don't ping Staff without a reason

eternal osprey
#

yo guys can i send my code to someone (like 100 lines). I am using puppeteer but paranoid that the browser is not being closed, leading to my ram getting fucked.

#

idk i went through the whole flow and each time i conclude that it's closing properly but i might be dumb though

sharp geyser
#

sure

eternal osprey
#

i think he gotta give me permissions first lol 😭

sharp geyser
#

lol

quartz kindle
#

lmao sure

#

i never used pupeteer tho

spark flint
#

puppeteer is good

#

but

#

its resource intensive

#

used 8gb ram in about 10 minutes

quartz kindle
#

ew

neon leaf
spark flint
#

nah i closed all of mine

#

tried multiple methods, including new browsers, new tabs, closing them always and it uses all ram

neon leaf
#

I mean im using chromium and its using max 2gb

#

over days of it running

eternal osprey
#

yo yall are scaring me

#

can i send someone my code to inspect whether i am closing everything properly?

#

I once had a huge fucking memory leak as i didn't close all pages.

eternal osprey
#

thank you mate!

sharp geyser
deft wolf
#

Dr. Tim gigachad

sharp geyser
#

This code has bugs

#

but idk why

#

:c

quartz kindle
#

its incurable

#

diagnosis completed

sharp geyser
sharp geyser
#

😏

quartz kindle
#

its working as intended

#

:^)

sharp geyser
#

no

#

there is issues

quartz kindle
proven lantern
#

i updated my rust code

#

i am now the best rust dev ever

neon leaf
sharp geyser
#

Sorry

#

IRS cant be sued

#

its in the policy

neon leaf
#

I didn't file my taxes

sharp geyser
#

Uhm

#

Well

#

Thanks for that info

#

:)

neon leaf
#

No problem

sharp geyser
neon leaf
#

Just a bit of CPU usage

proven lantern
lyric mountain
#

Possess an be ready to deploy a firearm
so...any average american?

proven lantern
proven lantern
#

lol

#

look at my beautiful rust code update

#

this syntax is so crazy

        let is_premium = entitlements.iter().any(|entitlement| {
            entitlement["sku_id"].as_str().unwrap() == "1019475255913222144"
        });```
sharp geyser
#

unless you know it exists and wont error out

proven lantern
sharp geyser
#

then don't unwrap it

quartz kindle
#

what does unwrap even do?

sharp geyser
#

It will throw the error and exit the process

quartz kindle
#

united nation world rap

sharp geyser
proven lantern
#

so i should double wrap it?

sharp geyser
#

Result has two return types
Ok and Err

proven lantern
#

double the saftey

quartz kindle
sharp geyser
#

no

#

Its not specific to async at all

#

It's just rust's way of handling errors

#

You can return a value, or you can return an error

quartz kindle
#

so they use error objects in a similar way that js uses promises?

sharp geyser
#

the point of unwrap is if you know 100% certainty that the Result won't return an Err or that the Option wont return None then you can use it

#

Otherwise handle it accordingly

sharp geyser
quartz kindle
#

so wrap/unwrap is like, wrapped inside an error handler, or removed from the error handler?

sharp geyser
#

wrap?

#

wrap isn't a thing

#

you can only unwrap something

quartz kindle
#

then why is unwrap a thing if there is no wrap

#

lmao

sharp geyser
#

well, ok so wrap isn't a function

quartz kindle
#

un-something implies the existence of a something

#

:^)

sharp geyser
#

but you can wrap a value in an Err/Ok

#

sorry

#

I thought you meant wrap as in a fn called wrap

quartz kindle
#

ah, no i meant the concept

sharp geyser
#

let me write up an example

#

or I can get cahtgpt to do it cuz im too lazy

#

one sec

quartz kindle
#

lel

#

but i think i get it now, its similar to how promises work in js

#

you have a sort of container object that has a state

#

and depending on the state, you can get the value from it or not

sharp geyser
#
enum Result<T, E> {
    Ok(T),
    Err(E),
}

This is what result is at its core

proven lantern
#

ok, i've double wrapped everything

sharp geyser
#
fn divide(a: f64, b: f64) -> Result<f64, String> {
    if b == 0.0 {
        Err(String::from("Division by zero"))
    } else {
        Ok(a / b)
    }
}

Now surprisingly chatgpt gave a good example.

Suppose you have a divide function that takes in 2 floats. The return type will be a Result that has an ok value of type f64 and a error value of type String Well you can't divide by 0 so if it encounters that then it will throw an error (note it doesn't check a ik but idrc it still demonstrates it to some degree). Else it will return Ok with the value being the division of a /b

#
fn main() {
  let res = divide(5,10).unwrap(); // This is safe to do as we know we aren't dividing by 0. Unwrap will return the `Ok` value.
  println!("Result is: {res}");
}

fn main() {
  let res = divide(5,0).unwrap(); // this will cause a panic because now we are dividing by 0.
  println!("Result is: {res}");
}
proven lantern
#

so now i need to cast my string as an optional string? good ol strict typing

sharp geyser
#

One of the safest ways to handle a Result or Option if you are uncertain of the return type is to use match

sharp geyser
#

Just do Some("string")

proven lantern
#

that's not casting?

sharp geyser
#

It converts it into an Option with the str being the value

quartz kindle
proven lantern
#

it's still typing

quartz kindle
#

i mean of course not

sharp geyser
quartz kindle
#

lmao

#

but i guess its similar to promises

#

Ok and Err = resolve and reject

sharp geyser
#

.ok() is on Option and it converts Option<U> -> Result<T, E>

quartz kindle
#

then you acccess with unwrap and then/await

sharp geyser
#

as some people try to do

#

it will error out

proven lantern
#

of couse it will

sharp geyser
#

not many know that

#

just spreading the word

#

Idk how experienced you are with rust as you said you are learning it

proven lantern
#

thanks

sharp geyser
#

no need to be snappy

proven lantern
#

rust is being mean, not you

sharp geyser
#

Well it makes sense tbh

#

casting a primitive to a non-primitive is unsafe at least with rust's type & memory management philosophy

proven lantern
#

is this the right way to parse json?

let body_parsed: HashMap<String, serde_json::Value> = serde_json::from_str(&body_string)?;
sharp geyser
#

cool thing is tho Result and Option aren't limited to async rust

#

so its very beneficial to those not using it as well

#

:)

past field
#

i have an extremely stupid question

#

can bots have discord nitro

#

lol

sharp geyser
#

no

#

they do have some of the features that discord nitro has though

past field
#

damn

proven lantern
sharp geyser
#

Some() should of worked

#

if .as_str() is a option

#

wait a second

#

why the fuck is it an Option wawa_huh_confused

sharp geyser
#

bc as_str normally returns an string slice on its own

#

or wait no, it might be ebcause of .any

#

shrug either way whatever works

proven lantern
#

the serde_json library does it

sharp geyser
#

interesting

#

I wonder why

#

oh wait

#

what thats dumb 😭

#

I guess the type of it is unknown when using ["key"] but still Sadge

#

sad thats how it is

sharp geyser
# proven lantern

Anyway
you shouldn't need to do Option::from() you should freely be able to do Some("id") at least if it truly is an Option<&str> and serde isn't fucking with shit again

#

Some("asdas") converts it to an option with the value being "asdas"

proven lantern
#

oh yeah, that works too

sharp geyser
#

👍

#

just making sure im not insane

#

😭

#

I've been using rust for 3-4 months now

proven lantern
#
        let is_premium = entitlements.iter().any(|entitlement| {
            entitlement["sku_id"].as_str() == Some("1019475255913222144")
        });
sharp geyser
#

👍

proven lantern
#

this closure syntax is so weird

#

the last line cant have a semicolon

sharp geyser
#

yes

proven lantern
#

but other lines must have a semicolon

sharp geyser
#

because the last line is a return

#

rust doesn't require the use of return

proven lantern
#

but other returns can have a semicolon

sharp geyser
#

yes if you use return you have to use a semi

proven lantern
#

gotcha

sharp geyser
#

but you don't always have to

proven lantern
#

it's syntax sugar

sharp geyser
#

9 times out of 10 you can just put it without the return and semi

#

it treats the last line of any scope as a return

#

if it does't have a semi

#

ALSO

#

note if you don't return anything either via return or something (no semi) it's return type is ()

#

which depending on what you are doing will throw errors

#

for example

let a: Result<i64, String> = match something {
  Ok(val) => val,
  Err(err) => {
    Err("Soemthing: {}", err.to_string());
  }
};

iirc this will error

#

oh wait ofc it will

#

I mixed up Result & Option

#

😭

proven lantern
#

why () and not None

#

oh, None is for Options

#

i did the same thing

sharp geyser
#

() is the default return type if no return type is specified

#
fn main() { // return type is ()

}
#

which means you can simply return println!() or anything else that returns () or nothing

#

its kind of like a void

proven lantern
#

is None not a part of the language?

sharp geyser
#

None is

#

its for Option tho

#

You can't have a return type be None

devout spade
#

Official designs of the Kittens of Four cast (Yes I made Lizzy wear goggles)

[-THE CAST-]

Kitty
Shelly
Lizzy
Buddy
Duge
Me. Fuzzles
Chezzy
Grudge
Ratter

sharp geyser
#

you have to make it Option<T>

sharp geyser
devout spade
#

Ah

#

Ok

sharp saddle
#

guys guys

#

bots can set voice channel topic?

sharp geyser
#

Only on Text, Announcement, Forums and Media channels

sharp saddle
#

aw

#

oh wait

#

i mean voice channel status

sharp geyser
sharp saddle
#

ok

#

thanks

sharp saddle
sharp geyser
#

I saw nothing about it in the docs

#

unless its undocumented

spark flint
#

it’s new

#

open network tab, set topic and see if a bot can recreate that request

sharp geyser
#

I see

#

so its undocumted as of rn

#

no wonder

sharp saddle
#
function setVoiceStatus(channelId, status) {
    return new Promise(async (resolve, reject) => {
        await fetch(`https://discord.com/api/v9/channels/${channelId}/voice-status`, {
            "headers": {
                "accept": "*/*",
                "authorization": `Bot token`,
                "content-type": "application/json"
            },
            "body": JSON.stringify({ "status": status }),
            "method": "PUT"
        })
            .then(e => e.text())
            .then(e => resolve(e))
            .catch(e => reject(e))
    })
}
#

put this one

spark flint
#

if bots can’t do it it will return “Bots cannot use this endpoint”

sharp geyser
#

It is it's own endpoint

#

wtf

spark flint
#

yes

sharp geyser
#

thats dumb

sharp saddle
#

lmao

sharp geyser
#

just make it with the modify channel endpoint

#

💀

spark flint
#

i should try break it

sharp geyser
#

please do

#

and send me the results so I can report it

#

:)

#

I need money

spark flint
#

lol

sharp saddle
#

lol

sharp geyser
#

I am playing games on my phone

#

and its making me money

sharp saddle
#

i'm coding on my phone

sharp geyser
#

but its like 1$ every 30m

#

😭

sharp saddle
sharp geyser
#

Thats how down bad I am rn

#

I've also been doing surveys

lyric mountain
#

Come make cards with me

sharp geyser
#

unless you paying me

lyric mountain
#

Ah, that kind of down bad

sharp geyser
#

yea

#

Im down bad for money

#

I been playing games all day and they make me like 1$ every 30m KEKW

pearl trail
#

nice

sharp geyser
#

not nice

#

its worthless

#

waste of my damn time, but thats how badly I need some money

quartz kindle
# spark flint i should try break it

discord releases new endpoint, doesnt tell anyone
5min later, discord devs: "why is this brand new endpoint getting hit with dogs, cats, emojis and invalid characters?"

sharp geyser
#

I wish I was smart enough to do what bun does

#

bug bounty seems worth while KEKW

lyric mountain
#

Did u try freelancing?

sharp geyser
#

I mean I thought about it

#

but my biggest concern is I dont think im good enough

sharp geyser
quartz kindle
#

i mean

#

i've seen people literally get paid 50 USD to setup a discord server

#

like permissions and stuff

#

and thats it

sharp geyser
#

I mean I used to work for 70$ a discord bot back in the day

#

Made some bank

#

but that was to idiots

#

I basically used the same code just modified it to their liking

#

lol

pearl trail
# sharp geyser not nice

is it only avail on specific country? if no, then it's worth it in my country KEK $0.7 you can get full meal with drink

sharp geyser
#

pretty sure its available anywhere there is the app store

pearl trail
#

ic

sharp geyser
#

you'll have to convert the USD to your currency if need be unless you can use paypal in your area

lyric mountain
#

Also the bar ain't very high, some are stupid simple like discord server.

sharp geyser
#

Eh I personally think I wouldn't be able to professionally sell my skills

#

Im not at that level yet

pearl trail
sharp geyser
#

also trying to freelance on fiverr is going to be impossible

#

New sellers hardly get sales

lyric mountain
sharp geyser
#

I guess I just have a very low self esteem

#

and my standards for myself are too high that I dont meet em

quartz kindle
#

come to brazil

#

"professional" means nothing here

sharp geyser
#

I've seen videos of brazil

#

no offence but a machete is not my choice of death

quartz kindle
#

you literally go to "professional" places like car repair shops only to find out you would do a better job yourself

#

if you dont get straight up scammed

sharp geyser
#

idk id like to sell my skills but I really dont think they are that valuable

#

I mean there is still so much I dont know

lyric mountain
#

Professional just means "as cheap as we could find"

sharp geyser
#

I mean i'd likely end up in here

#

"Guys how do I do this, its for a client"

quartz kindle
#

except its worse, they ask chatgpt instead of us

#

:^)

sharp geyser
#

yea ig

#

but asking for help on something you're supposed to be getting paid for

#

😭

#

makes me feel dumb

quartz kindle
#

you get paid for the effort, not the knowledge

lyric mountain
#

Also most posts on stackoverflow are from people trying to solve stuff at work

sharp geyser
#

fair enough ig

#

What would I even sell

#

I can make discord bots kind of but anything complex I feel no one would actually pay for

quartz kindle
#

a dude once wanted to pay me 200 bucks to make him a bot with 600 commands

#

he started sending me pics of other bot's command lists and saying "i want these, and these, and these"

sharp geyser
#

💀

#

lmk if he is still looking

lyric mountain
#

A dude was willing to pay anyone to find him the image dimensions not so long ago

sharp geyser
#

/j

sharp geyser
#

😭

#

Need me some money

quartz kindle
#

i got 35 bucks from patreon last month, i can give you half

sharp geyser
#

no dont do that

#

if that was a serious offer ty

#

but I have to decline

#

I may need money, but im not going to take it from others like that

quartz kindle
#

make me a website for my api then, it has to use svelte and be good

sharp geyser
#

you lost me at website

quartz kindle
#

lmao

sharp geyser
#

Ima be real my webdev is worse than my math skills

quartz kindle
#

frontend is so annoying

sharp geyser
#

indeed

#

I never bothered learning it

#

I regret it now

#

I know html

#

I know css

quartz kindle
#

i mean, its easy, but its annoying and time consuming

sharp geyser
#

how to use the two to make something good pfft beats me

lyric mountain
#

Try flutter

sharp geyser
#

the dart thing?

lyric mountain
#

Yes

sharp geyser
#

idk dart and is it even worth it?

lyric mountain
#

Well, it's a bit like react, but typed

sharp geyser
#

tbh I wish I had the motivation to work on my company

lyric mountain
#

And yeah, I use it at my job for making app

sharp geyser
#

but I saw no growth for 2-3 months

#

and got super depressed

lyric mountain
#

Try improving your sql + some frontend framework, this almost guarantees a position somewhere

sharp geyser
#

yea

#

problem is

#

I can use frontend frameworks no problem

#

I know how to use react + nextjs

#

its just css

#

I can't make things that look visually appealing

lyric mountain
#

Try flutter, seriously

sharp geyser
#

how would using flutter help?

lyric mountain
#

I'm bad at design too, yet the app always ends up appealing

sharp geyser
#

Doesn't it require some sort of styling language

lyric mountain
#

Cuz flutter uses material design for its components

#

You can make your own components too tho, but everything is at hand already

lyric mountain
#

The lang is self-contained

sharp geyser
#

I'd have to learn another programming language as well weary_AE

lyric mountain
#

It took me about 3 days to go from 0 to working

sharp geyser
#

I will definitely look into it tho

#

I want to use flutter for our mobile app at CC

proven lantern
lyric mountain
#

Dart isn't too far from js

sharp geyser
proven lantern
sharp geyser
#

tailwind is not a fix all solution tho

proven lantern
#

so you dont even need to use css

#

fixed

sharp geyser
#

yes you do

#

tailwind is a helping hand

#

it can't solve all your problems

proven lantern
#

that's true

sharp geyser
#

its for the stuff that I can't use tailwind for that fucks me

sharp geyser
#

I see

#

I will look into it

#

tbh I dont remember much js stuff

lyric mountain
#

Whatever c-like lang u remember

sharp geyser
#

c++?

#

C#

lyric mountain
#

C# is closer I think

sharp geyser
#

Honestly the only reason I want money

#

is to try and hire people to help me with CC

#

cuz me and null aren't going to cut it

#

sad truth

lyric mountain
#

CC?

sharp geyser
#

but I don't want to wait 7 years to release a product

sharp geyser
lyric mountain
#

Ah

#

Well, another reason to learn flutter

sharp geyser
#

me and null for the last 3 months have been trucking along by ourselves

#

and quite honestly its gotten to the point I was seeing no progress

#

that I got tired and wore out

sharp geyser
#

I wanted to use it for our mobile app

#

since react-native is kinda meh imo

#

to get it working on most devices you need to do heavy configuration

lyric mountain
#

It's miles better than native tbh

#

I'm porting out old native app

sharp geyser
#

I'll take a look at flutter

#

maybe I can do freelance work with it once I get confident enough

lyric mountain
#

Fucking hell 700 moving menus to edit the msg

queen needle
#

You can also have flutter run for web too

lyric mountain
#

I've used flutter for web, maybe it's just me but I prefer raw html for it

#

Unless ur doing highly dynamic pages

sharp geyser
#

Do you guys think an age verification bot is a good idea?

lyric mountain
#

Risky niche

proven lantern
lyric mountain
#

Also you're legally required to remove all data after 3 months

#

Due to tos

#

And the new tos bans trying to identify users or their relationships

sharp geyser
#

I wouldn't store data

lyric mountain
#

A thing that people used to request a lot on my bot, is voice chat tracker

#

Basically give roles based on total channel usage

#

With ranking

#

I dropped off this niche after rewrite as it's not really the focus of my bot, but there was demand

sharp geyser
#

hm

#

Some big bots already do that tho

#

Would it be worth making it a dedicated bot?

sharp geyser
#

Because I feel like as it stands rn

#

the structure I went with is TERRIBLE

#

im used to making simple rest apis

#

but anything complex like what a e-commerece/marketplace platform needs is beyond me

lyric mountain
#

Eh, don't raise your bar too much, ecommerce ain't too complex either

sharp geyser
#

fair enough

#

I just feel like how the endpoints are now are too restrictive

lyric mountain
#

It's mostly CRUD with oauth2 authentication

lyric mountain
#

Or graphql

#

But implementing it is hell

sharp geyser
lyric mountain
#

You don't need to be too flexible tho, just allow searching for products by name fragment or date or stuff like this

sharp geyser
#

I unironically kind of want to start from scratch again on the backend

lyric mountain
#

The service we use only allows searching for either all products or a specific id

#

And it's a big commercial service

wheat mesa
#

Or you doing something else

sharp geyser
#

I've just not been happy about its current state

#

and its putting me in a sour mood

wheat mesa
#

Bc tbh I feel like you might be overthinking it. There is a lot of things that go into a “good design” from a software perspective, but that is usually done by larger teams. You can have a million redesigns and never launch a product