#development

1 messages · Page 2045 of 1

forest drift
#

ello, curious if anyone can help me here.
I have an old pc thats decently powerful that I can keep on 24/7, im curious how I could make it so i could run my own hosting panel off of it. Like I can access the files, console, etc from an external website, but the actual thing is hosted off my pc. So for example; hosting something like heroku locally, meaning I can modify and update the bot from everywhere but its actually hosted on my pc. Like a personal host with panel etc thats hosted locally
Ive tried coding my own but its far from efficient, so Ive given in and am rather looking for something already made

fathom sonnet
#

there are open source panels out there that you can use, but before that you need to setup host maybe wizh xamp or wamp, opne required ports on your network, do port forwardin and allow those ports in firewall, then you can host panel on xamp or wamp depends on you

#

i think petrodactyl is open source, so you can use it

forest drift
#

kk thanks

#

also does anyone have the link to that one website that helps you transfer from discord.js v12 to v13? decided to finally suck it up and learn v13

sacred aurora
#

and uh you just leak your token?

forest drift
#

Im curious how many tokens have been accidentally leaked here through screenshots

fathom sonnet
sacred aurora
fathom sonnet
#

tnx man

forest drift
# fathom sonnet i think... a lot

yeah i moved my token to its own file after leaking the index twice and the config once, i mean at least it teaches you not to put it in a common file lol

radiant kraken
#

what the fuck GCC is on drugs

#

the "random address" thing might be caused because it's trying to format an IEEE 754 float binary into an ordinary int

fathom sonnet
forest drift
radiant kraken
#

just find a page that exists

forest drift
radiant kraken
#

(int)round(sqrt(9))

fathom sonnet
#

then just ```.env
TOKEN: YOUR_TOKEN_GOES_HERE

forest drift
#

ah ok

#

seems easy enough

fathom sonnet
#

yea

#

and u can add multiple "things"

fathom sonnet
#

no need for commas, quotes etc

#

lemme se

forest drift
fathom sonnet
#

seems cool

forest drift
#

i mean its windows where petrodactyl is linux...
hmm i mean linux is faster...

#

hmm imma probs bite the bullet and use petrodactyl

fathom sonnet
#

i mean use what is safer

devout salmon
#

hey guys, I would like to add a bot into my server - before developing totally new one, I want to ask if you know something similar or maybe some bot that is already doing what I need 😄

I want to create a bot which would add reaction emojis under my message - I want to create a specific text channel where only I can write and other people can only react with emojis

it should be a "Rank a player" kinda bot for football matches - I will write name of player "Ronaldo" and bot would add emojis from 0️⃣ to 🔟 (11 in summary) under the message

with at least 11 players in game up to possible 16, it will take huge amount of time adding those reactions... can anyone think about similar bot or maybe help me with creating new one?

thank you very much for your help!

split hazel
daring apex
#

How to make a bot 24/7 running free

earnest phoenix
#

Buy a vps

vivid fulcrum
#

Need to run your bot 24/7? Get a cheap VPS.

https://www.scaleway.com/ - Incredibly cheap but powerful VPSes, owned by https://online.net/, based in Europe.
https://www.hetzner.com/ - Germany-based VPSes, with prices starting from as low as €2.96
https://www.digitalocean.com/ - US-based cheap VPSes. The gold standard. Locations available world wide.
https://xenyth.net/ - A hosting solution made by Discord bot developers, aimed at a lower price range, starting from $2.49.
https://www.ovh.co.uk/ - Cheap VPSes, used by many people. France and Canadian locations available.
https://www.time4vps.eu/ - Cheap VPSes, seemingly based in Lithuania.
https://www.linode.com/ - More cheap VPSes!
https://www.vultr.com/ - US-based, DigitalOcean-like.

Self-hosting:
Any modern hardware should work 100% fine.

Free hosting:
No. There is no good free VPS hoster, outside of persuading somebody to host for you, which is incredibly unlikely.

daring apex
#

Is everyone blind here ?

#

I said I need a free one

vivid fulcrum
#

no, but you are

#

there is no full uptime free hosting

#

hosting has operation costs - electricity bills, internet bandwidth bills etc.

#

someone has to pay for that

#

ergo, there is no good free host

daring apex
#

My friend doesn't have a vps but his bot is 24/7

#

he even not used bot gost & autocode etc...

spark flint
#

i love bot gost

#

they might use replit and some shitty uptime robot thing to keep it alive

daring apex
#

That's the worst way

dry imp
#

laugh in 0.17 dollar us 24/7 hosting

spark flint
#

ayo

#

laughs in $6 a year 24/7 hosting

dry imp
#

laughs in $2 a year 24/7 hosting

spark flint
#

what host

lyric mountain
# daring apex My friend doesn't have a vps but his bot is 24/7

listen, there's a golden rule that applies to pretty much anything:

great quality: not free
free: low quality
great quality & free: limited time
free & unlimited time: you're the product (either ads or data selling)
great quality & free & unlimited time: you're being scammed

#

nobody would give a good vps for free without any catches, they need to pay for the electricity bills

split hazel
#

the only way really nowadays

daring apex
boreal iron
#

me selling servers FOR FREE - UNLIMITED TIME - you just have to sign a contract with your blood, but NO money is needed

solemn latch
#

I think fake is trolling ^_^

boreal iron
#

Fake would never troll

solemn latch
#

banned angeryBOYE

daring apex
boreal iron
#

Illegal lmao

hybrid cargo
#

Sounds more like sarcasm to me 👀

boreal iron
#

Sounds like someone too young for Discord is among us

daring apex
boreal iron
#

confirmed

solemn latch
#

are you actually selling a server fake?

boreal iron
#

Hmm not yet but if you need some, I need your blood KEKW

solemn latch
#

you're a goof

#

^_^

daring apex
boreal iron
#

Shhh I’m a business men Sir

daring apex
#

Of my server

boreal iron
#

Don’t need you here anymore

#

We figured out the obvious sarcasm was sarcasm

hybrid cargo
#

Im here for woo

#

you're a goof

boreal iron
#

Shhooo

#

lmao

#

Harassment everywhere pepowot

lyric mountain
boreal iron
#

Yes! I said it. The first time. Calm down!!!1!

#

DON'T SCREAM!!!1!

daring apex
#

@spare goblet ban him

daring apex
#

Hello

#

His afk

vivid fulcrum
#

uhoh

#

it's a child

cinder patio
boreal iron
#

still randomly pinging staff members

spark flint
junior karma
#

vote required i am doing command and log has this error

lyric mountain
winter pasture
#

Without seeing the rest of the code where you call and implement Client it is hard to say exactly where the issue is

junior karma
#

👍

winter pasture
spark flint
#

Lol

earnest phoenix
#

😬

simple stump
#

I'm attempting to get started with ReactJS even though I have no experience in the language. However, I already have a website finished (I can link what I have since it's mostly public), but it looks garbage. I found a similar website to what I have that uses Chakra-UI, but since I'm coding in pure HTML, CSS, and JavaScript, I'm not sure how I can transfer my code (if it's even possible) to Chakra/React. What is the best course of action? Should I learn React? How does Chakra-UI work in relation to web design/React?
https://www.npmjs.com/package/@chakra-ui/react

(It also might be worth noting that I'm using CommonJS, but I believe React doesn't require ES6 but I could be mistaken)

fossil bronze
#

Anyone know how to make newlines (for example \n) work on all platforms? (android, iOS, windows)

cinder patio
#

In what context? files?

lyric mountain
#

it's pretty much the standard (and all files that u upload to git will be converted to CRLF anyway)

fossil bronze
lyric mountain
#

send the text here```
like
this

#

so I can see the original text

#

in my bot I use just \n and never faced any issue regarding os

fossil bronze
#

\n works on windows and android
\r works on windows and iOS
\n\r works on iOS and android but results in double newline on windows
\r\n works on windows and android but not iOS just like \n

cinder patio
#

\n should always work in discord, no??

lyric mountain
#

pretty sure

fossil bronze
#

Sorry. It does not

lyric mountain
#

send the original text here

#

and the code snippet

#

or if the text is hardcoded, only the snippet

#

actually, send only the code

fossil bronze
#

I can't really because it's not just a block of text. It's added together by the bot. like

thistext = `❌ ${displayRarity} **${thisListCard.name}**  \n\r`
displayTextLines.push(thistext)
//later
clonedTemplate.setDescription(data.join(""))
lyric mountain
#

\n\r is invalid btw

fossil bronze
#

I'll make a test cmd if you want

lyric mountain
#

\r is carriage return, \n is linefeed

#

you return THEN break line

fossil bronze
#

Okay but that's what works on iOS so..

earnest phoenix
#

\n works in Discord on all platforms equally, you don't need a carriage return at all

lyric mountain
lyric mountain
#

I'm ALMOST sure join trims linefeeds before joining

#
thistext = `❌ ${displayRarity} **${thisListCard.name}**`
displayTextLines.push(thistext)
//later
clonedTemplate.setDescription(data.join("\n"))
fossil bronze
#

With \r\n on the lines

#

Its correct on iOS my assistant says

lyric mountain
cinder patio
#

just joins each one of them with the delimiter

lyric mountain
#

weird then

#

but still, better put linefeed on the delimiter instead of the individual lines

cinder patio
fossil bronze
#

Hmm I think you're right, as in, \r\ n is supposed to work on all clients

lyric mountain
#

why do you insist in using \r\n if we clearly saw that it doesn't work as expected

fossil bronze
#

\r\n is what you suggested...?

lyric mountain
#

before you showed in what ur using it

#

you didn't say it was for a string, in js, for discord

#

you simply asked "how to break line and stay compatible with all OS"

#

replace your text with this ```js
thistext = ❌ ${displayRarity} **${thisListCard.name}**

#

and join like this ```js
clonedTemplate.setDescription(data.join("\n"))

fossil bronze
#

Oh I see. I thought it was implied

#

Tried what you said, (Waiting for iOS user to come around)

#

Yeah right now idk. my old method of putting \n at the end of each string is working.

lyric mountain
#

by putting \n at the end of each line u also get an empty line at the end

#

.join("\n") will suffice for putting each line on a new line

fossil bronze
#

Aha looks like the error has been found

lyric mountain
#

which was...?

fossil bronze
#

Space before newline!

lyric mountain
#

that shouldn't really matter

#

but well, if it worked it worked

fossil bronze
#

Yep but it does.

#
thistext = `☑️ ${juyeonStar.repeat(3)} **${thisListCard.name}**  \n`
// No newline on iOS only
thistext = `☑️ ${juyeonStar.repeat(3)} **${thisListCard.name}\n**`
// Newline on all platforms
#

My placement of it inside the bold was just me being sloppy

lyric mountain
#

oh well, you ignored all my warnings and kept a newline at the end of each item

#

anyway, I give up on trying to solve your issue

fossil bronze
# lyric mountain oh well, you ignored all my warnings and kept a newline at the end of each item

Of course, because it did not affect the outcome. The problem is now solved: The issue was spaces before newline doesn't work on iOS. if you are in doubt, try this string:

'This is n \n This is n \n This is n \n This is r \rThis is r \rThis is r \r This is r-n \r\n This is r-n \r\n This is r-n \r\n This is r-n \r\n This is 3 spaces before n   \n This is 3 spaces before n   \n This is 3 spaces before n   \n'
lyric mountain
#

the issue "might" appear fixed, but it's just hidden under the mat

fossil bronze
#

It doesn't make any difference what I join by. The problem is spaces before newline.

#

As you can see from the string that is not joined by anything

lyric mountain
#

that's the apparent problem, but I'm certain the actual reason is another thing

#

\n is a line break regardless of what's behind or in front of it

split hazel
#

just ruined your career

fossil bronze
#

What is that? Escaped slash, so it's just a backslash n?

lyric mountain
#

I didn't say "in strings"

fossil bronze
#

btw I didnt ignore your idea, I tried it, it worked (because I removed spaces without thinking) then I tried the way I did it before again (just minus spaces) and it worked too

lyric mountain
#

with .join("\n")

Item 1
Item 2
Item 3
Item 4

with trailing \n

Item 1
Item 2
Item 3
Item 4
//empty line here
proven lantern
#

you might want to use trim() everywhere and not think about trailing \n

#

but join is better

solemn latch
#

kind of on topic, is this a bad idea? or does a better method exist?

      var str = "I have an cat, an dog, and a goat.";
      var mapObj = {
        cat:"Apple",
       dog:"Orange",
       goat:"Cherry"
     };
     str = str.replace(/cat|dog|goat/gi, function(matched){
      return mapObj[matched];
    });
    console.log(str) // I have an Apple, an Orange, and a Cherry.

source: https://tutorial.eyehunts.com/js/javascript-string-replace-multiple-example-code

its for replacing multiple strings in a string

#

(I may or may not be chaining .replace's dynamically in my code right now)

quartz kindle
#

for more performance you can use a loop with replace conditioned by an indexOf

solemn latch
#

looping replace's is more performant? 👀

quartz kindle
solemn latch
#

so I should really just do my own testing and figure it out then

quartz kindle
#

but having an indexOf condition will likely improve performance for strings that dont contain all keys to replace

solemn latch
#

oh I see

#

yeah thats pretty much my exact use case

quartz kindle
solemn latch
#

perfect, thanks tim

simple stump
#

How can I create a space large enough for the content to fill most of the screen? An example of this is https://anify.app/. The Explore button scrolls down to the content, but the main text fills most of the screen. I'm trying to use React, but I can't find anything related to this specific design. I figured that understanding the HTML/CSS might be easier since I'm new to React, but when inspecting the website I'm still quite stumped.

lyric mountain
#

It stands for viewport width/height

#

100 being the entire viewport, think of it like a percentage

simple stump
lyric mountain
#

Noice

sharp geyser
#

Are enums case sensitive when it comes to indexing them like Categories['dogs']

#

if I made dogs be all caps in the enum will it still be found?

#

This a ts related question for anyone wondering what lang

split hazel
#

they are case sensitive

sharp geyser
#

so I should use .toUpperCase then

split hazel
#

if its user input then yeah

#

though enums are supposed to be compile time only constants

#

but typescript is special

sharp geyser
#

So I am making an API and people are allowed to add images, but right now to keep track of who adds images I am making a user entry which holds their IP, (mainly to keep track of the images they add via the browser) discord ID, bot ID, and api key. I am still wondering though if using their IP to keep track of images they add via the browser is a good idea. As right now i see no way of actually adding their IP to the database if they are a first time user.

simple stump
#

I'm trying to use React Router DOM, but for some reason the page doesn't render anything. When I don't use routing, the page renders everything completely fine. However, when I literally just add BrowserRouter or anything after that, nothing works at all.

This works fine:
https://sourceb.in/qhBqAOLK53

But this unfortunately doesn't:
https://sourceb.in/ygPpVeOFed

I've tried a few variations of the latter, only using BrowserRouter, or moving things to different files, etc. Nothing seems to be working for me. All I get is a blank screen.

sharp geyser
#

1 you need <Routes></Routes> to wrap your Route in

#

2 Why are you using a div

#

Also unless you are using an older version of react router dom component is no longer a thing it is element

#

Also if this is an older version of react router then it is Switch or whatever instead of Routes

simple stump
# sharp geyser 1 you need ``<Routes></Routes>`` to wrap your `Route` in
  1. Ty, but that didn't seem to work unfortunately.
  2. I tried a lot of different variations lol. Many different tutorials and the latest one I used just happened to include <div>.

And regarding using an older version I'm not. Again related to the tutorial thing

This is what I'm using now:

root.render(
    <BrowserRouter>
        <Routes>
            <Route path="/" component={App}>
                <Route path="/home" component={Home}/>
            </Route>
        </Routes>
    </BrowserRouter>
);
sharp geyser
#

What version of react rotuer or react router dom are you using

#
            <Router>
                <BasePage/>
                <Routes>
                    <Route element={<Home/>} path={"/"}/>
                    <Route element={<About/>} path={"/about"}/>
                    <Route element={ <Submit /> } path={"/submit"}/>
                </Routes>
            </Router>

Works fine for me

#

Also might have something to do with you not treating them as "compoents" you likely have to do <App />

sharp geyser
#

I see

#

Try doing <App /> and <Home />

#

instead of just App and Home

simple stump
#

aight ill try that

simple stump
#

Also tried just:

    <BrowserRouter>
        <Router>
            <App />
        </Router>
    </BrowserRouter>

But neither seem to work

sharp geyser
#

If App is what you want to be globally loaded then sure

simple stump
#

Yeah I'm trying to load App. doesn't make much sense but thats what my code is atm

sharp geyser
#

BrowserRouter is already there

simple stump
sharp geyser
#

🤔

#

Do you have a github?

#

with this code on it

simple stump
#

yes. i dont have the code on it atm tho. would it just be easier to send the zip

sharp geyser
#

It'd be easier to just push the code to a repo tbh

#

I don't download files from discord

simple stump
#

okay

simple stump
sharp geyser
#

lmk when it is pushed I will take a personal look at it

simple stump
#

okay. whats ur git?

sharp geyser
#

I don't see why it isn't working tho

#

Mistyerious

simple stump
#

okay. just invited you. thanks for your help

sharp geyser
#

np

#

I will a pr when I fix it

simple stump
#

👍

sharp geyser
#

Wait what you are completely missing react router and react router dom from node modules

wheat mesa
#

What

#

Misty did you forget to take your meds

#

You don’t upload node modules

sharp geyser
wheat mesa
#

Check the package.json

sharp geyser
#

I did it was missing 5 head

#

Why do you think I said something

wheat mesa
#

:troll:

sharp geyser
#

npm is complaining about this guys project 😔

#

I am confused it says it has installed react-router v6 and react-router-dom v6 but it is using old stuff

#

@simple stump I have no idea what is going on anymore. I am getting errors unrelated to react-router and for framer-motion

sharp geyser
#

@simple stump How the hell did you make this react app?

#

There is so many issues with it that I don't even wanna bother try fixing

#

It looks like the packages you have installed are outdated causing a lot of errors to occur when I am running it and even then updating them seems to not even be fixing the issue entirely.

#

yea sorry I can't help ya eltik, this is too troublesome to try

earnest phoenix
#

Hello everyone

#

I’m Jeffrey and I’m new on the server

simple stump
earnest phoenix
lyric mountain
wheat mesa
#

lmao

wheat mesa
#

Just making sure you know, sometimes people get this confused with #general

lyric mountain
#

You spend 1 minute cloning the project, then 5 hours cloning the remaining 99% of its total size

wheat mesa
#

Spent 3 hours installing LLVM. That was a pain in the ass

#

By the time I finished installing it, I didn't have the motivation to use it for the rest of the night

lyric mountain
#

I just discovered github has a limit of 100 MB for project files, but no limit for release files

wheat mesa
lyric mountain
#

So u can basically create a new release every time u need to upload big files

wheat mesa
#

That took a LONG time to build

lyric mountain
#

55 GB

wheat mesa
#

Had to compile it myself too

#

So that was the majority of the time

lyric mountain
#

That's as big as fallout 4 no?

wheat mesa
#

Something like that

wheat mesa
#

Ridiculously big, definitely worth the size though

daring apex
#

Lots of tag here

wheat mesa
#

Insane technology

lyric mountain
#

VS icons ohno

sharp geyser
lyric mountain
#

2.5x bigger then

#

Btw misty, did ya continue with java projs or stopped?

sharp geyser
#

I'd continue if I had something to work on

#

I have no idea what I should make

lyric mountain
#

A bot?

sharp geyser
#

I was going to make a gui calculator but swing is so annoying

sharp geyser
lyric mountain
#

It's simpler than js

sharp geyser
#

At least enough to not do what I did earlier

wheat mesa
#

uhhhh... I wouldn't say that!

lyric mountain
#

I can only say for jda, you don't get all the fuzzle wuzzle d.js has

sharp geyser
#

I admit jda has a nice API much better than js

wheat mesa
#

reflection

sharp geyser
#

But I'm still not confident enough with java to make a bot

lyric mountain
#

You don't need to go into reflection at start

wheat mesa
#

ik but still

#

gonna want a command handler eventually mmLol

sharp geyser
#

I at least wanna learn the fundamentals of java

#

Right now all I know is basic inheritance and basic types

lyric mountain
#

How about making a calculator with stored functions?

wheat mesa
#

I think it helps to do a lot of java projects to just get used to thinking in a pure OOP manner

lyric mountain
#

That'd involve a database

#

So it's a good all-around project

wheat mesa
#

you'd barf if you saw the way I handled persistent data in my mc mod kuuhaku 😉

lyric mountain
#

I never really peeked at how is mc modding environment

wheat mesa
#

garbage

lyric mountain
#

All I know is that forge is a rage mess and fabric is supoosed to be the future

wheat mesa
#

forced to use java 8 :C

lyric mountain
#

Doesn't newer mc support jdk 16?

wheat mesa
#

forge is a clusterfuck with virtually 0 help for anything older than 1.16

wheat mesa
sharp geyser
#

Alot of forge users use older mc versions

#

A lot of mods are made for those versions

wheat mesa
#

most of the people who use 1.12+ forge is usually for actual mods like singleplayer shit

sharp geyser
#

Yea

wheat mesa
#

for anything server-related it's usually 1.8.9

lyric mountain
#

I can understand, one of my favorite mods is perma-stuck in 1.16 because the dev refuses to update their forge version

sharp geyser
#

Swing was annoying to try and use

wheat mesa
lyric mountain
sharp geyser
#

You'll have it

lyric mountain
#

Use graphics2d to make a snake-like game

wheat mesa
#

minesweeper is another easy one to make

lyric mountain
#

It'd involve swing, but only one image + 4 buttons

wheat mesa
#

(pro tip: separate UI logic and backend logic)

lyric mountain
#

And separate swing render thread from the logic thread

wheat mesa
#

^

lyric mountain
#

Unless you enjoy interface freezes

wheat mesa
#

we love freezing

#

C:

lyric mountain
#

Actually, a minesweeper would be quite easy for a starter project

#

Just a loop with xy counts and rng for bombs

wheat mesa
#

Recently saw a video on someone making minesweeper in Rust + WASM, the whole video was about an hour and a half

#

(Granted this person knew rust pretty well)

lyric mountain
#

The hardest part would be making the clues system

lyric mountain
#

Misty make a minesweeper

wheat mesa
#

I want to learn rust

#

but at the same time it seems very difficult just because of how different it is

#

rust enums confuse me

sharp geyser
#

Tho I really don't wanna mess with gui

lyric mountain
#

You'll just use 2 components

#

JFrame and JButton

#

Nothing else

wheat mesa
#

You can make a way to display it in console first, then port it over to swing

lyric mountain
#

Unless u want a label tracking score

#

Most of the work will be figuring out how to generate the grid and making the clues system work

#

Barely any UI work

#

Jframe even has a grid layout to make it easier

native vault
#

How do I make a loop command, like it'll send a meme every 15 seconds

wheat mesa
#

that sounds like that would get annoying

#

but you're gonna need some code for sure 😉

native vault
lyric mountain
#

Nice way to speedrun the ratelimit

native vault
#

I finished making the music bot

native vault
sharp geyser
#

Also what do you guys mean by logic and ui thread?

lyric mountain
dry imp
#

am i allowed to send 50 memes in 1 second?

lyric mountain
#

Because you're walking too close to the limits

lyric mountain
native vault
dry imp
#

ill invite your bot if you allow it

dry imp
lyric mountain
wheat mesa
#

It’s very simple to do

#

Have your UI class implement Runnable, and then in your main function do SwingUtils.runLater(new UIClassNameHere()) (the function is something like that, kuuhaku can correct me)

#

invokeLater()

#

I think is the name

lyric mountain
#
var exec = Executors.newSingleThreadExecutor();

exec.execute(new UIClassHere());
#

With executors u get better control over settings

#

U can also do the inverse - run ui in the main thread and use async methods to process logic

#

That has the advantage of leveraging java's ability to use actual threads

sharp geyser
lyric mountain
#

Well, up to you

#

Swing is "create once, update always" instead of react/flutter's "recreate always"

#

As a bonus, if ur using intellij, it has native support for ui builder

#

Just right click -> new file -> swing forms

#

Or something like that

#

It'll be at the bottom of tge context menu

#

It takes a bit of tutorial to get used to it, but it's quite handy to make interfaces

sharp geyser
#

Interesting

sharp geyser
#

Mmm how do I add that stuff to my frame tho

lyric mountain
#

What stuff?

sharp geyser
#

Like the components or whatever

lyric mountain
#

In the gui designer the components will be at the right-side menu

sharp geyser
#

Ah I see

lyric mountain
#

Here, better yet

sharp geyser
#

I am now starting to wonder what the hell should I use for the minesweeper area

lyric mountain
#

Just the base jframe

#

Set it to gridlayout

sharp geyser
#

Mmm, but wouldn't I need something to put the numbers and mines on

lyric mountain
#

Jbutton

sharp geyser
#

I'd essentially just be using a bunch of buttons

#

👀

lyric mountain
#

Pretty much lmao

sharp geyser
#

Yikes

#

That will be fun to code

lyric mountain
#

Use a for-loop so you don't need to write every single button individually

sharp geyser
#

Yea

#

I might try and include game settings later if I actually get a basic minesweeper going

#

which I will likely save the settings in a json file

lyric mountain
#

Go for it

#

While you're at that, you might need to learn how to use json in java

#

Since it doesn't natively support it

sharp geyser
#

Right I remember that being the case

#

😔

#

I am honestly not sure how ima do this but lets give it a shot

lyric mountain
#

I recommend moshi

#

It allows u to map json into classes

#

And the inverse too

sharp geyser
#

Wtf is this gui thing it ain't letting me resize components

#

😔

lyric mountain
#

Theres org.json but...well

#

It's not a good lib to get used to

#

It was created as a proof-of-concept, but people started using it in production which led to huge memory issues

lyric mountain
sharp geyser
#

I am but what he is doing I seem to not be able to do

wheat mesa
#

Is that the same thing

lyric mountain
#

Idk, just see if the lib group is org.json

wheat mesa
#

Not at pc rn I’ll check docs tho

#

Nope it’s not

#

made by something called cliftonlabs

lyric mountain
#

The one i mentioned isn't optimized for large scale usage since it loads the entire json at once

#

I used to have big issues with it on my bot's api due to payload sizes and frequency

#

Gotta go now, see ya tomorrow

wheat mesa
#

Cya

sharp geyser
#

I am already disliking this minesweeper idea mmLol

dry imp
#

why?

sharp geyser
#

Can't get the gui to actually show up

wheat mesa
#

Show code

#

Are you doing .setVisible(true) on the frame

sharp geyser
#

Yea I am using the GUI builder intellij has but it doesn't seem to actually use the design from the gui builder

#

so I am stuck making my own components

wheat mesa
#

Watch the tutorial video @sharp geyser

sharp geyser
#

No I give up fuck swing

wheat mesa
#

The designer is not incredibly intuitive at first

pine nova
#

💀

sharp geyser
#

I have piss poor motivation rn

wheat mesa
#

That was quick

sharp geyser
#

Swing already looks annoying

#

I will save it when I have more mental capacity

dry imp
#

swing really swings the mood huh

radiant kraken
#

i tried swing, but i think i'd rather stick to gtk

manic basin
tidal nymph
#

is 5 a maximum amount of components you can add to Modal?

carmine talon
#

Hi guys, im trying to develop my first discord bot and when i go into the permissions calculator website and i paste my bot application id into the Client ID field it shows me the link that redirect me to this :/

tidal nymph
#

ty

pine nova
earnest phoenix
#

TypeError: db.add is not a function

#

why this error happened ?

#

const db = require('quick.db')

pine nova
pine nova
#

??

earnest phoenix
#

does quick.db added a new version ?

pine nova
#

ig

forest drift
#

whats a good paid for host thats still on the cheaper side, up 24/7, has github integration and hopefully an overview etc

pine nova
#

idk if it has github integration but i heard contabo vps is cheap and good

forest drift
#

thanks ill check it out, currently using heroku which seems pretty good but theyve removed their github integration

pine nova
#

💀

forest drift
#

yeah so far after looking at prices imma probs just make a system to auto switch between 2 heroku hosts, one for 15 days at a time or smt idk

pine nova
#

yea heroku had idk like data leak something with github

#

so prolly removed

#

some kind of security issue

forest drift
#

yeah, you can still connect them if u set it up right so u just have to
git pull --force
git push heroku --force
and then just make it detect when the githubs updated and itd auto host from github ig... Then just add a thingy that crashes the bot on one of the 2 heroku hosts for 15 days then switches sides heroku accounts, so each is only hosting an active bot for 15 days or so?

#

then if ur using internal database just have it push that to github every few min and when the bot restarts pull it from github so u dont have to worry about heroku resetting or smt?

pine nova
#

u cant use an internal database with heroku tho

spark flint
#

Has a field in the panel to add GitHub

#

And it fetches latest version every time you restart

earnest phoenix
#

how can this be improved?

#

what about the styling

#

the layout

#

and the wording

#

etc etc etc

#

what can be changed

earnest phoenix
royal portal
#

scratch

winter pasture
# earnest phoenix how can this be improved?

Next button is a bit small maybe?
The coloring seems like it is a "warning", so made me look for another button to click, like a green one

Maybe try centering the button in the card, make it a bit wider to give the text more space to breath

#

The reason I would like it centered is that it makes more sense if the next step is the accordion below
Where the next button is now, it looks like it will take me to a new page

#

Also have the "configuration" have a mot more margin around it, and capitalize the "C"
It looks so crammed up into the navbar

#

Finally, maybe move the "need help" to the top, maybe even next to the "Configuration" header

#

Just my opinion tho 😄

earnest phoenix
#

Next button is a bit small maybe?
how much bigger?
The coloring seems like it is a "warning", so made me look for another button to click, like a green one
it's an accent colour (see the pic i sent)
Maybe try centering the button in the card
not entirely sure about that ngl
Where the next button is now, it looks like it will take me to a new page
fun fact, it was going to be like that until the logic behind it reached 1720 lines, oops...
Also have the "configuration" have a mot more margin around it
i don't think it's even in line with the front page but i'll check
update: it isn't!
and capitalize the "C"
It looks so crammed up into the navbar
consistency 👍
Finally, maybe move the "need help" to the top, maybe even next to the "Configuration" header
ngl was thinking of adding a link to every section in the config, then it would link to the relevant section on the wiki page

#

i would show you an update if windows terminal didn't lock up

earnest phoenix
#

where would the "Need help?" text go within each section though

winter pasture
#

Maybe under the inputs, to the left side of the card, same row as the next button?

earnest phoenix
#

Or like this or info icon on a card
Or underlined texr with popup

earnest phoenix
#

So i have a express server project and i have index.html in this html file i required script.js file is there any way to use node_modules in the script.js

cobalt marlin
#

Does anyone know any free/self-hosted image hosting services?

spark flint
#

For what

#

sharex?

cobalt marlin
#

Image hosting

spark flint
#

There’s a few

#

Imgur is the first that comes to mind

cobalt marlin
cobalt marlin
spark flint
#

You don’t need to have an account for Imgur

dry imp
#

^

cobalt marlin
spark flint
#

Go to upload the image

#

It works

#

That’s it

#

No signup

cobalt marlin
#

Okay!

#

Thanks

#

again

carmine talon
#

This is a command to clean chat, how can i make it only for some specific roles to use?

I have discord mod role that i want them to use this but i dont want @membersrole to use

#

solved :3

forest drift
solemn latch
#

its important to keep code clean

#

thankfully most code editors have a hotkey to auto format code

#

everything else is just spacing code

boreal iron
solemn latch
#

just be lazy 👀

boreal iron
#

Once you be there you won’t go back sir

solemn latch
#

I'm so lazy that I dont even press the hotkey, I added a button to my mouse for it

boreal iron
#

lol

carmine talon
split hazel
#

someone needs to make a reusable, lightweight validation framework that works on everything

#

don't like the current ones

#

might make my own

#

can't be too difficult can it

sharp geyser
#

React router was at the latest version

#

It was likely an issue with the cra template react used when generating a basic react app

earnest phoenix
forest drift
#

look id just started, command handlers and modules confused me

solemn latch
#

modules still confuse me, and I use them every day ^_^

forest drift
#

also me whom my first ever bot was a complete mess and over 1.7k lines in the index.js file and all it did was remind u to bump ur server XD

#

oh and even that bot was a flop

#

lol

#

geez its only been like 2 years since i started coding and im proud of how far ive come, still dont know how filters work but i meeeeeean

#

also still having to look up how to add roles to users because its simple af and I somehow always forget

solemn latch
#

forgetting isnt a big deal

#

knowing how to find that information quickly is a big deal

#

filters are not that hard, its just a function that returns a boolean, if the boolean is true keep that item in the array, if its false dont keep it in the array.

earnest phoenix
carmine talon
#

insted of embeding the message i create it?

vivid fulcrum
#

you're trying to send an empty message

#

what is your code

#

also read the warning, use the messageCreate event

carmine talon
#

yeah thats what im about to do

quartz kindle
#

this is incorrect, it should be messageEmbed.react(

#

this should be .send({embeds:[embed]}) (if you're using version 13)

carmine talon
#

Code your own Discord bot! Reaction roles can be one of the best systems you can add to your discord server. Reaction roles allow your members to select a role from simply reacting to it! The possibilities are endless with the number of roles and permissions you can provide to your members. You can make a game, economy and, about everything else...

▶ Play video
quartz kindle
#

the video shows it correctly

carmine talon
#

omg im so sry...

#

wasting ppl time in these...

#

im a lil bit tired i would say :/

spark flint
quartz kindle
#

other than that, it seems the video is about version 12, the current version is version 13, so there are things that wont be correct in the video

carmine talon
#

sry about that

spark flint
#

will try that now

forest drift
lean wedge
#

Hello! Im looking to submit my bot to the website but i wonder if the "Long Description" supports Markdown

forest drift
#

it should

#

cant remember but somewhere on the page it gave a link to a list of the supported markdowns or smt

spark flint
slender thistle
#

So py-cord, not dpy

spark flint
#

await client.change_presence(activity=discord.Activity(type=discord.ActivityType.playing, name=f"with ur mom"))

simple stump
# sharp geyser <@429659644634333195> I have no idea what is going on anymore. I am getting erro...

Sorry for the ping. Just thought you might want to know what happened, but I got it to work. The solution was to clone directly from the repository, but for some reason because everything was encased in the my-app folder, extracting everything and deleting the node_modules fixed the issue. I just reinstalled all the necessary packages (react, react-router-dom, and @chakra-ui/react) and it works fine now haha. Anyways, tysm for your help. I don't think I could've fixed everything without understanding that the issue was related to the packages

earnest phoenix
#

guys

#

does anyone have the ```js
process.on('unhandledRejection', error => {
console.error('Unhandled promise rejection:', error);
});

something like this
quartz kindle
#

its exactly like that

#

but dont use that, its a bad idea

earnest phoenix
ancient nova
quartz kindle
#

its not meant to replace actual error catching

#

and will usually give you really bad errors that will be very unhelpful at actually fixing the issue

boreal iron
#

Suppressing errors is the new way of fixing them, Tim

#

At least the code looks more operational without errors freerealestate

ancient nova
#

so you're saying it's better to have 30 try catch statements rather than to keep every error code in the unhandled rejection event?

cinder patio
quartz kindle
#

but if you need 30 try catch statements you're likely doing something wrong

#

code can easily be written in a way to handle errors better

ancient nova
#

what if there are errors that only happen sometimes and I have no way of predicting them or a way to catch or fix them without a catch statement

solemn latch
#

like?

ancient nova
#

there's a couple of examples I could show you in the code I recently wrote

#

give a sec

quartz kindle
#

but you can always structure them in a better way

ancient nova
# solemn latch like?
    try {
        member.ban().then((member) => {
            return message.channel.send(`:wave: ${member.user.tag} (${member.user.id}) was forcefully removed from the server by ${message.author.tag}`);
        });
    } catch (e) {
        return message.channel.send('I was not able to ban that specific person.');
    }
``` how would you avoid getting the error if the member isn't bannable?
ancient nova
quartz kindle
#

that try catch doesnt even work

#

lmao

solemn latch
#

you should be checking before the error anyway

ancient nova
quartz kindle
#

no it doesnt

#

try catch cannot catch promises that are not awaited

ancient nova
#

I've gotten the error message before

quartz kindle
#
const result = await member.ban().catch(() => null);
if(!result) {
    return message.channel.send('I was not able to ban that specific person.');
}
return message.channel.send(`:wave: ${member.user.tag} (${member.user.id}) was forcefully removed from the server by ${message.author.tag}`);
#

or

ember zephyr
#

so, I'm adding the set-language feature on my bot, so I've to translate it in some languages, and for example:

return message.reply({
  content: `${message.author.username}, hello!`
});

will maybe become something like:

import langs from "some-path"
import getLang from "some-path"

const lang = await getLang("ID");
const text = langs[lang].<CommandName>.<TextIdentifier>; // e.g. "AUTHOR_USERNAME$, hello!"
const replyTxt = text.replace(/$AUTHOR_USERNAME$/g, message.author.username)
return message.reply({
  content: replyTxt
)

Or should I do something like:

  • langs-file:
export default function (
message_author_username?: string
// ...
) {
  this.<LangCode> = {
    <CommandName>: {
      <TextIdentifier>: `${message_author_username}, hello!`
      // Other texts...
    }
    // Other commands...
  }
  // Other languages...
}
  • command-file:
import langs from "some-path"
import getLang from "some-path"

const lang = await getLang("ID");
const replyTxt = langs(
  message_author_username: message.author.username,
  // Other used parameters...
  )[lang].<CommandName>.<TextIdentifier>;
return message.reply({
  content: replyTxt
)
quartz kindle
#
try {
    await member.ban();
    return message.channel.send(`:wave: ${member.user.tag} (${member.user.id}) was forcefully removed from the server by ${message.author.tag}`);
} catch {
    return message.channel.send('I was not able to ban that specific person.');
}
quartz kindle
#

or

ancient nova
#

Tim you can stop now

#

I understand

boreal iron
#

Tim… don’t

solemn latch
quartz kindle
#
return member.ban().then(m => message.channel.send(`:wave: ${m.user.tag} (${m.user.id}) was forcefully removed from the server by ${message.author.tag}`)).catch(() => message.channel.send('I was not able to ban that specific person.'))
ancient nova
#

how about this? Voltrex came up with it

    try {
        if (mentionedRoleRegex.test(fetchedRole)) {
            // Fetch either by mention or ID.
            // If fetched by mention let's still replace it to get a clean ID.
            roleToMute = message.guild.roles.cache.get(fetchedRole.replace(/<@&(\d+)>/, "$1"));
        } else if ((roleToID = fetchedRole.match(mentionedRoleRegex)) !== null) {
            // Fetch by ID.
            roleToMute = message.guild.roles.cache.get(roleToID[1]);
        } else {
            // If regex failed try fetching by name instead.
            roleToMute = message.guild.roles.cache.find(_role => _role.name === fetchedRole);
        }
    } catch (e) {
        // In case both fetches failed, throw an error.
        console.log(e);
        return message.channel.send(`Could not find your role. Make sure the correct corresponding role is selected in your guilds settings. Please run \`${settings.prefix}set edit mutedRole \"@ROLE\"\``);
    }
#

it's slightly harder

quartz kindle
#

you literally dont need a try catch there?

ancient nova
quartz kindle
#

also, do you catch errors at the command handler?

#

otherwise you also need to catch the message.channel.send

ancient nova
#

also using a custom logger class and I use the unhandled rejection event there

quartz kindle
#

im not talking about the event

#

im talking about your command handler

ancient nova
#

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

                    if (message.member.roles.cache.has(finalCheck.id || message.member.roles.cache.find(role => role.name === finalCheck).id || finalCheck)) 
                        return true;
                    else 
                        return false;
#

how come this gives an error?

ancient nova
quartz kindle
#

message.member.roles.cache.find(role => role.name === finalCheck).id

#

use ?.id instead of .id

ancient nova
#

alright thanks

quartz kindle
ancient nova
#

it works most of the time

copper wasp
#

How do I assign autoroles for voting using @pliant gorge bot?

wheat mesa
#

Also doing return true; and return false is redundant

#

Just do return yourConditionHere

boreal iron
ancient nova
#

that's why I catch multiple promises that appear as if they would give similar or the same error message

boreal iron
#

await …catch(this has gone wrong);
await …catch(now this has gone wrong);

is more detailed and useful than

try{
await <promise>;
await <promise2>;
await <promise3>;
} catch {
something has gone wrong, figure out what yourself
}

ancient nova
wheat mesa
#

try catch doesn’t catch promise rejections

#

(Unless I’m wrong?)

quartz kindle
#

if the error is for you, the programmer, then the handler will give you the lines to look at, so it doesnt matter

#

if the error is to be displayed to the end user, then yes you need to place the catches in the right locations to provide the relevant messages

quartz kindle
wheat mesa
#

Ah okay

boreal iron
ancient nova
quartz kindle
#

the end user doesnt need this information?

ancient nova
quartz kindle
#

thats what i said basically

ancient nova
#

yeah, and the logging the exact errors is up to the developers

#

unless you're executing a command like eval

boreal iron
#

Yes it does, it’s not important for you to know if fetching an owner for example failed,
Those are promises which are supposed to fail sometimes
But the user needs a proper message your command handler can’t specify

ancient nova
#

or something else that needs the exact output

ancient nova
boreal iron
#

That’s a debug message for u not the user

#

Catching the promise of a member ban results in a message to the user, hey I can’t ban the member

Since this promise is supposed to fail due missing permissions the command handler will return a proper error log for you but your job is to catch the promise and return a proper message to the user why the ban didn’t work

ancient nova
boreal iron
#

There’s none in the code you shared regarding the ban

ancient nova
#

here's some

#

rest is in the command handler

boreal iron
#

try/catch on sending this message is nonsense again

#

That’s what your command handler should do

#

Or do you try to send another message to the channel if the DM failed?

ancient nova
#

logs

boreal iron
#

Well nonsense then since your command would catch that

ancient nova
#

😐

#

I know that you're right it's just an easier way to do it

quartz kindle
#

you can also do a very simple custom error message system

lyric mountain
#

global try-catch inside event handler + print to channel?

boreal iron
#

It’s a nested try/catch doing the same as the outermost one

ancient nova
#

like a log that tells the person who tried banning that the message failed to send

boreal iron
#

The command handler should log this error already?!

ancient nova
#

noono a moderation log

#

to a channel

boreal iron
#

Why else would you catch it there?

ancient nova
#

it's for the guild not me

quartz kindle
#
module.exports = class UserError extends Error;
try {
  await command.run(...)
} catch(e) {
  if(e instance of UserError) {
    message.channel.send(e.message).catch(() => {});
  } else {
    message.channel.send("An error occured, please try again shortly").catch(() => {});
    console.log(e);
  }
}
// any command
run: function(...) {
  const check = await doSomething().catch(e => null);
  // throw error with custom message
  if(!check) { throw new UserError("message"); }
  // any other error anywhere will be logged by the handler
}
ancient nova
#

but without having a class

#

that's a bit unnecessary

boreal iron
#

Well that’s how you extend the error class

cinder patio
#

you can throw any javascript value so you can do like

throw { error: true, message: "Some Message" }
wheat mesa
boreal iron
#

now it begins

ancient nova
wheat mesa
#

Lol what

#

The reason is because C is not a language that pretty much anyone would enjoy writing a discord bot in, the libraries would cover just as much as any js library covers

cinder patio
#

but hey your bot will be faster

ancient nova
#

🤷‍♂️

wheat mesa
#

No I really don’t

#

“The js library is way more advanced”

#

That… just isn’t true

ancient nova
#

it's better, easier to use and better covered endpoints

boreal iron
wheat mesa
#

You could make a library in C just as “advanced” as any js library

ancient nova
wheat mesa
#

Better is a subjective term, easier to use yes, and better covered endpoints is simply not true

ancient nova
#

how is that not true?

wheat mesa
#

Because there is a limited amount of endpoints. Any complete C library would “cover” just as many endpoints as a js library would

boreal iron
#

I feel like he means feature rich

ancient nova
#

by better covered I mean simpler, the containers for methods are simpler

lyric mountain
#

if you have 65k+ endpoints you really need to rethink your design choices

ancient nova
wheat mesa
#

My point is that just because you don’t NEED to use something, doesn’t mean you shouldn’t

boreal iron
#

Just because I don’t need alcohol I should drink it

#

_Texan logic _

wheat mesa
#

That’s not my point 🙄

lyric mountain
#

lmao js more advanced than C

#

just saw the context

#

also isn't js made in c?

cinder patio
#

The most popular JS engine is written in C++

lyric mountain
#

c++ is a superset of c no?

cinder patio
#

no

wheat mesa
#

I thought pretty much anything that compiles in C would compile in C++

cinder patio
#

no there are definitely differences. Some code yes but definitely not all

wheat mesa
#

Interesting

lyric mountain
#
You can say that C++ is superset of C. It will be most of the time correct.

However correct answer is C and C++ are two different languages.

Consider this code:

char *s = malloc(100);

This is correct C code, but in C++ this code is invalid. This is because malloc() return "void *". In C you can cast void * to any other pointer type. In C++ you can not. You should cast:

char *s = (char *) malloc(100);
#

so...a semiset?

#

actually, it's something like donkeys vs horses

#

both are the same but not exactly

wheat mesa
#

Idk if I would trust quora answers for these types of questions

lyric mountain
#

tf was this a real article?

cinder patio
#

A lot of people don't know

boreal iron
#

Back in 2015 html and http, it was all the same, known as the internet

spark flint
#

i code internet

cinder patio
#

I bet your grandma doesn't

lyric mountain
#

my grandma post memes in facebook

quartz kindle
#

what is the difference between css and cs

boreal iron
#

One s

#

Take that!

quartz kindle
#

:^)

steep ivy
#

What is a Github repository's file path? (i'm using os.chdir("FILE_PATH") to give a file access to a json file)

split hazel
#

pretty much all c code works with c++

#

there are differences but porting isn't that difficult

#

for example you cant really implicitly convert a number to a pointer in c++

#

(shame :()

#

about the assembly that comes out of both im not sure if the output is relatively the same but i think i saw an article that says c produces less bloated binary files

#

probably since the standard library for c is practically non existent

#

while c++ bundles the whole standard library which is.. pretty large

wheat mesa
#

Asm output also depends on compiler

split hazel
#

ys

#

apparently clang produces way slower code than gcc

wheat mesa
#

Clang uses LLVM

#

gcc uses their own optimization passes and such I believe

split hazel
#

maybe the way slower was exaggerated

wheat mesa
#

Idk if this is a forum post, but I’m unable to load it due to my cell towers being dead near me and power being out

split hazel
wheat mesa
#

Yeah

#

Most likely

split hazel
#

but from benchmarks it seems they're relatively similar

#

they each slightly beat each other in different aspects

wheat mesa
#

Except for nbody lol

quartz kindle
#

wanna see your compiler burn? make nested templates

split hazel
#

bro i get like no intellisense whenever i write a template

wheat mesa
#

Templates are amazing but they also suck

split hazel
#

i get some intellisense with clangd but with the c/c++ one provided by vsc you get none

#

apparently its intentional

quartz kindle
#

i once tried to make a c++ Map for js where you could specify the c++ data type from js

wheat mesa
#

I use CLion for most projects

quartz kindle
#

like new Map("string", "uint32")

wheat mesa
#

The auto fill is great

quartz kindle
#

and the cpp would create that using templates

split hazel
quartz kindle
#

turns out that generated hundreds of thousands of type combinations

split hazel
#

oh yeah true because the compiler only generates templates for all the possible value combinations

quartz kindle
#

so i gave up on that project

#

xD

wheat mesa
#

Lol

split hazel
#

dont have to use templates tho

#

for my db all my types are hard coded

#

i gave up with templates

quartz kindle
#

yeah but like

split hazel
#

they're the best and worse thing in c++

quartz kindle
#

if you want both the key and the value to be customizable

#

their types i mean

#

you're not gonna hardcode that

wheat mesa
#

I mean, all the types in js can be represented with string technically, no?

quartz kindle
#

yes the standard way is to convert js data to buffers before giving them to cpp

wheat mesa
#

So you could just have it in C++ represent key with string, and value as whatever type

#

But in the js end cast all the keys to string before feeding it to the C++ end

#

(I don’t know how bindings work though, I’m probably thinking about it wrong)

quartz kindle
#

yeah thats pretty much it, just using buffer instead of string

#

since raw string doesnt really exist in cpp

wheat mesa
#

At that point you would only need one template for the value type though right?

quartz kindle
#

yeah, which basically means no templates, just code it once

split hazel
quartz kindle
boreal iron
split hazel
#

fancy way to say array of characters 😠

quartz kindle
#

array of bytes

split hazel
#

i wonder if you can make node addons with rust

#

i wanna try

quartz kindle
#

sure

split hazel
#

sounds more intuitive than the c++ way

quartz kindle
#

there is a node api for rust

wheat mesa
#

Rust has bindings

split hazel
#

splendid

wheat mesa
#

Really fast too

rocky dagger
#

do u need a option if im doing a subcommand?

wheat mesa
#

I need to learn rust

split hazel
#

i'll make what you wanted to make

split hazel
wheat mesa
#

Rust is fucking amazing and looks so cool but I just haven’t had the time to learn it

split hazel
#

it can do very low level stuff but i find it trash and annoying for very low level stuff

wheat mesa
#

I was actually gonna start again today but the power has been out all day from a storm last night

#

Certified Texas moment

#

Unsafe rust is a clusterfuck from what I heard

split hazel
#

like in c++ you can easily do pointer arithmetic, write and read random memory locations - in rust you have to jump a few hoops before you can do that

wheat mesa
#

Rust slices still confuse me

#

And enums

split hazel
#

i hate how if statements dont have brackets

wheat mesa
#

But it looks like an amazing language with so much potential

split hazel
#

it triggers me

wheat mesa
#

Yeah same

#

The lack of parenthesis is something I can get used to for those though

#

Small sacrifice for an amazing language

split hazel
#

just dont write unsafe code and you should be fine with rust

wheat mesa
#

Yeah

boreal iron
wheat mesa
#

Speedy do you have any resources you recommend for learning rust

#

Or just trial and error like how I learn most langs

rocky dagger
# boreal iron Text input command options are optional

i just get an error saying DiscordAPIError: Invalid Form Body 45.options[0].type: This field is required 45.options[1].type: This field is required 45.options[2].type: This field is required 45.options[3].type: This field is required

split hazel
#

i also ask for help with topics im stuck on in the rust server

#

they're surprisingly patient

boreal iron
#

Well if you define an options array then set the proper type for the options

split hazel
#

i wouldnt code a database or os with rust though 💀

boreal iron
#

Make sure it’s the rights type

#

And not a sub command group for example

wheat mesa
split hazel
#

gamedev definitely

#

i feel like it could replace c# in unity

wheat mesa
#

Ehhh

split hazel
#

could

wheat mesa
#

I feel it’s still too low level to replace C# entirely

split hazel
#

doesnt have to

#

unreal engine then :/

wheat mesa
#

And people like the very easy to use OOP with C# and Unity

#

Unreal definitely

split hazel
#

actually thats a perfect match

#

you arent going to be doing extremely low level stuff with game dev anyways

wheat mesa
#

Especially since Unity basically relies on OOP itself

#

Rust wouldn’t have the same capability as C# in that aspect, but it would definitely be cool to see an engine that utilizes it to its full potential

split hazel
#

hate how unity is single threaded tho

#

you can only access and make use of the apis from the parent thread

#

cant lie i dont like the node api with rust integration

#

looks confusing

#

might just be the tutorial tho

wheat mesa
#

I need to learn rust enums

#

They look so cool but I just don’t understand them

#

Or when to use them

split hazel
#

not sure how i feel about this

#

i'll try setup a starter project

#

now that i look at it it doesnt look too bad

wheat mesa
#

Doesn’t look terrible

#

Doesn’t look terrible

#

Did I send that twice

split hazel
#

i think neon is just one integration module

wheat mesa
#

My data is freaking the fuck out rn

split hazel
#

i'll ask in the rust server if they know what the best one is

#

yeah you did

#

i think discord is lagging tho

#

mines shitting itself too

#

messages take 5 seconds to send

wheat mesa
#

My LTE is getting fucked because the cell towers near me are being repaired

split hazel
#

hot

wheat mesa
#

And my house has been without power all day

#

Thankfully it’s not very hot outside atm otherwise I’d be dying with no AC

split hazel
#

cant lie looks clean

#

i think they touched up the syntax a bit

wheat mesa
#

That’s really nice actually

split hazel
#

if you want static variables you have to make the function unsafe

#

borinnggg

lyric mountain
#

it's at least readable

#

although I have yet to see how you deal with windows api in rust

#

because THAT'S the real boss of the level

split hazel
#

spending 20 minutes figuring out how to make a static variable safe in rust

#

apparently you need a mutex of some kind to do so but it aint working 💀

wheat mesa
#

Winapi is a horrendous clusterfuck of terribly thought out design that goes completely against any conventions previously taught about C++ I stg

split hazel
#

windows api is very poorly designed

split hazel
#

they cant really fix it tho because backwards compatibility

split hazel
wheat mesa
#

Rust has that syntax too I thought

#

Am I mistaken

split hazel
#

tf that actually works

#

this feels illegal

#

why does it say to do .new instead of ::new

wheat mesa
#

The duality of rust

lyric mountain
#

let's play a wordle:
keybd_event(bVk, bScan, dwFlags, dwExtraInfo)

#

what is each param?

wheat mesa
#

“This ain’t c++”
“Wait wtf that works”

sharp geyser
#

Ik this is late response to the conversation at hand but mmLol

sharp geyser
#

ez

lyric mountain
#

I use regex to convert pdf into csv at my job

sharp geyser
#

where's my cookie

split hazel
#

i have no idea why you have to do ::new for static variables but .new for ones within a function

lyric mountain
split hazel
#

oh that doesnt work within functions either

sharp geyser
#

smh

split hazel
#

now they're saying you do .new when you have a value on the left

#

tf does that mean

lyric mountain
#
a_string=Something
other_string=Another thing
you_get_it=See?
#

then you make as many files as u need, one for each lang

#

all files should have the exact same keys (the value before = )

#

the rest is just getting the string by key from the right file

exotic meadow
#

i have a blank dictionary. next i make an https request, and then add some of the response into the dictionary. after that, i make two more https requests using a library and add the response to the dictionary. after i do all of this (asynchronously) i check all of the values in the dictionary to make sure i got all of the values. the issue is that the responses havent all come back yet and the code isn't yeilding. what can i do to fix it?

        request({ url: `https://api.rowifi.link/v1/users/${target.id}` }, async function (err, res, body) {
            if(err) return errorEmbed.addField("Error Code","API_ERROR 123"), interaction.editReply({embeds:[errorEmbed]}), errorEmbed.fields = [], console.log("ROWIFI API | Request Error (123): "+err)
            let rowifiData = await JSON.parse(body)

            if(rowifiData.roblox_id) {
                robloxData.id = rowifiData.roblox_id
            } else return errorEmbed.addField("Error Code","API_ERROR 130"), interaction.editReply({embeds:[errorEmbed]}), errorEmbed.fields = [], console.log("ROWIFI API | Request Error (130): "+err)
        }) 

        try {
            robloxData.username = await noblox.getUsernameFromId(await robloxData.id)
        } catch (err) {errorEmbed.addField("Error Code","API_ERROR 137"), interaction.editReply({embeds:[errorEmbed]}), errorEmbed.fields = [], console.log("NOBLOX API | Request Error (137): "+err)}

        try {
            robloxData.rank = await noblox.getRankInGroup(9436889, await robloxData.id)
        } catch (err) {errorEmbed.addField("Error Code","API_ERROR 141"), interaction.editReply({embeds:[errorEmbed]}), errorEmbed.fields = [], console.log("NOBLOX API | Request Error (141): "+err)}

        if(!await robloxData["id"] || !await robloxData["username"] || !await robloxData["rank"]) return
earnest phoenix
#

Oh god, don't tell me you're using https://npmjs.com/package/request

sonic lodge
#

otherwise you need to use ::

#

for example AtomicU32 defines

pub const fn new(v: u32) -> AtomicU32

and

pub fn get_mut(&mut self) -> &mut u32
exotic meadow
earnest phoenix
sonic lodge
#
let a = AtomicU32::new(0);
let b = a.get_mut();```
exotic meadow
#

alright

earnest phoenix
#
exotic meadow
#

i'll use axios rq sense i've used it before

#

oh ok lemme look

radiant kraken
split hazel
#

bro why is the rust community so nice

#

ive never seen someone say "i can help you with this if you're struggling" IN A SUPPORT SERVER

wheat mesa
#

(I don’t remember enough assembly)

#

Nvm looked it up it’s 4

split hazel
#

silly boy

#

cant lie forgot for a second too

lyric mountain
#

4 bytes is a lot

#

half an int

wheat mesa
#

When you think about how much data 8gb of ram can store, it’s fucking insane

#

And that’s just in memory