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
#development
1 messages · Page 2045 of 1
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
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
and uh you just leak your token?
Im curious how many tokens have been accidentally leaked here through screenshots
f*k it it is easy to rset it
i think... a lot
yeah i know just to let you know
tnx man
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
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
well i keep it in .env file but...
yeah i used to do that but .env confuses me
just find a page that exists
btw anyone know if https://www.gameserverapp.com/ is any good? Advertises as an alternative for petrodactyl and one of its pointers if for discord bots
Manage players, setup your own Discord bot, automate whitelisting, monetise your community and more. Used by 493K+ players worldwide.
(int)round(sqrt(9))
its easy, u need to download dotenv and then make .env file
then just ```.env
TOKEN: YOUR_TOKEN_GOES_HERE
do you know of this panel?
oh ok yeah im totally using .env then
seems cool
i mean its windows where petrodactyl is linux...
hmm i mean linux is faster...
hmm imma probs bite the bullet and use petrodactyl
i mean use what is safer
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!
I didn't want to know but you wanted to know 💀
How to make a bot 24/7 running free
Buy a vps
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.
Tell me a free way
Is everyone blind here ?
I said I need a free one
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
I will se that later
My friend doesn't have a vps but his bot is 24/7
he even not used bot gost & autocode etc...
i love bot gost
they might use replit and some shitty uptime robot thing to keep it alive
laugh in 0.17 dollar us 24/7 hosting
laughs in $2 a year 24/7 hosting
what host
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
Code ?
me selling servers FOR FREE - UNLIMITED TIME - you just have to sign a contract with your blood, but NO money is needed
@hybrid cargo @solemn latch
I think fake is trolling ^_^
banned 
But that's illegal
Sounds more like sarcasm to me 👀
Sounds like someone too young for Discord is among us
Advertisement is illegal
confirmed
are you actually selling a server fake?
Hmm not yet but if you need some, I need your blood 
I can sell a template for free
Shhh I’m a business men Sir
Of my server
Go sleeping now!
Don’t need you here anymore
We figured out the obvious sarcasm was sarcasm
a-a-amongus??!?
Your are not banned ?
@spare goblet ban him
He is the imposter
Hello
His afk
Hey bro I can give your free vps but I need to know your age first
true, as I already mentioned before
still randomly pinging staff members
stop pinging random staff members 
vote required i am doing command and log has this error
you cannot drink water before you fill the cup
It is a reference error. You are accessing client before it have been initialized
Have a read of https://bobbyhadz.com/blog/javascript-referenceerror-cannot-access-before-initialization as an example
Without seeing the rest of the code where you call and implement Client it is hard to say exactly where the issue is
👍
@split hazel Please do not spam chat with Gifs, #memes-and-media is a more appropriate place
Lol
😬
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)
Anyone know how to make newlines (for example \n) work on all platforms? (android, iOS, windows)
In what context? files?
u can just use CRLF (\r\n) since the os will ignore the one that's unsupported
it's pretty much the standard (and all files that u upload to git will be converted to CRLF anyway)
This was also unsuccessful. Screenshot is iOS
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
\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
\n should always work in discord, no??
pretty sure
Sorry. It does not
send the original text here
and the code snippet
or if the text is hardcoded, only the snippet
actually, send only the code
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(""))
\n\r is invalid btw
I'll make a test cmd if you want
Okay but that's what works on iOS so..
\n works in Discord on all platforms equally, you don't need a carriage return at all
that's what I said, but better check the code anyway
join by \n
I'm ALMOST sure join trims linefeeds before joining
thistext = `❌ ${displayRarity} **${thisListCard.name}**`
displayTextLines.push(thistext)
//later
clonedTemplate.setDescription(data.join("\n"))
This results in double newlines in windows
With \r\n on the lines
Its correct on iOS my assistant says
did you change the code exactly as I wrote here?
join doesn't do anything to the contents of the array
just joins each one of them with the delimiter
weird then
but still, better put linefeed on the delimiter instead of the individual lines
You most likely have two newlines, just show your code
Hmm I think you're right, as in, \r\ n is supposed to work on all clients

why do you insist in using \r\n if we clearly saw that it doesn't work as expected
\r\n is what you suggested...?
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"))
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.
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
Aha looks like the error has been found
which was...?
Space before newline!
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
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
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'
this is what we often call a "hack job" (or "gambiarra" in brazil)
the issue "might" appear fixed, but it's just hidden under the mat
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
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
\\n
just ruined your career
What is that? Escaped slash, so it's just a backslash n?
that's just an escaped \n 
I didn't say "in strings"
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
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
you might want to use trim() everywhere and not think about trailing \n
but join is better
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)
for more simplicity you can build a RegExp instance from the mapObj
for more performance you can use a loop with replace conditioned by an indexOf
looping replace's is more performant? 👀
likely depends on string size and number of keys in mapObj
so I should really just do my own testing and figure it out then
but having an indexOf condition will likely improve performance for strings that dont contain all keys to replace
perfect, thanks tim
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.
Use vw/vh units
It stands for viewport width/height
100 being the entire viewport, think of it like a percentage
Ty! Yeah just figured it out haha.
https://sourceb.in/8cX8Mj4VRW
Noice
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
they are case sensitive
so I should use .toUpperCase then
if its user input then yeah
though enums are supposed to be compile time only constants
but typescript is special
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.
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.
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
- Ty, but that didn't seem to work unfortunately.
- 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>
);
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 />
6.3.0
aight ill try that
wait sorry so smth like:
<BrowserRouter>
<Router>
<App />
<Routes>
<Route element={<Home/>} path={"/"}/>
</Routes>
</Router>
</BrowserRouter>
Also tried just:
<BrowserRouter>
<Router>
<App />
</Router>
</BrowserRouter>
But neither seem to work
If App is what you want to be globally loaded then sure
Yeah I'm trying to load App. doesn't make much sense but thats what my code is atm
You don't need <Router>
BrowserRouter is already there
yeah i just tried <App /> as well.
<BrowserRouter>
<App />
</BrowserRouter>
yes. i dont have the code on it atm tho. would it just be easier to send the zip
It'd be easier to just push the code to a repo tbh
I don't download files from discord
okay
yea understandable
lmk when it is pushed I will take a personal look at it
okay. whats ur git?
okay. just invited you. thanks for your help
👍
Wait what you are completely missing react router and react router dom from node modules
I meant that when I installed the packages react router and react-router-dom is missing
Check the package.json
:troll:
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
@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
Oh rip. mb I was out for a bit. sorry this is my first time using React lol. Thank you for helping me regardless 👍 I’ll see if I can fix the package issues and see if that helps
Would you mind sharing some ideas with me?
Git structure
Filename Size
index.js 24 KB
assets/ 102 MB
src/ 7 MB
package.json 31 KB
node_modules 3.1 GB
lmao
This is a development channel just so you know 😅
Just making sure you know, sometimes people get this confused with #general
You spend 1 minute cloning the project, then 5 hours cloning the remaining 99% of its total size
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
Lol 😆
I just discovered github has a limit of 100 MB for project files, but no limit for release files
So u can basically create a new release every time u need to upload big files
That took a LONG time to build
55 GB
That's as big as fallout 4 no?
Something like that
I got a lot of file
Ridiculously big, definitely worth the size though
Lots of tag here
VS icons ohno
Fallout 4 is only 20gb iirc
A bot?
I was going to make a gui calculator but swing is so annoying
It's simpler than js
At least enough to not do what I did earlier
uhhhh... I wouldn't say that!
I can only say for jda, you don't get all the fuzzle wuzzle d.js has
I admit jda has a nice API much better than js
reflection
But I'm still not confident enough with java to make a bot
You don't need to go into reflection at start
I at least wanna learn the fundamentals of java
Right now all I know is basic inheritance and basic types
How about making a calculator with stored functions?
I think it helps to do a lot of java projects to just get used to thinking in a pure OOP manner
you'd barf if you saw the way I handled persistent data in my mc mod kuuhaku 😉
I never really peeked at how is mc modding environment
garbage
All I know is that forge is a rage mess and fabric is supoosed to be the future
forced to use java 8 :C
Doesn't newer mc support jdk 16?
forge is a clusterfuck with virtually 0 help for anything older than 1.16
probably, but the majority of the audience I'm targeting uses 1.8.9
Alot of forge users use older mc versions
A lot of mods are made for those versions
most of the people who use 1.12+ forge is usually for actual mods like singleplayer shit
Yea
for anything server-related it's usually 1.8.9
I can understand, one of my favorite mods is perma-stuck in 1.16 because the dev refuses to update their forge version
I don't wanna fuck with swing
Swing was annoying to try and use
make https://github.com/Jwaffled/MathExpressionParsing but in java 😉
Think oop and swing becomes more bearable
Sure give me a few years
You'll have it
Use graphics2d to make a snake-like game
minesweeper is another easy one to make
It'd involve swing, but only one image + 4 buttons
(pro tip: separate UI logic and backend logic)
And separate swing render thread from the logic thread
^
Unless you enjoy interface freezes
Actually, a minesweeper would be quite easy for a starter project
Just a loop with xy counts and rng for bombs
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)
The hardest part would be making the clues system
https://www.youtube.com/watch?v=0ywizYLPV00 here it is
This is a new series where we code together!
Playlist: https://www.youtube.com/playlist?list=PLtTT8p-gjGEdGzZ0ET2bwNnA6iP_mmmrv
Source Code: https://github.com/yishn/lets-code/tree/main/minesweeper
VS Code Theme: https://marketplace.visualstudio.com/items?itemName=csantiago132.intellij-ish-darcula-theme
Font: https://www.jetbrains.com/lp/mono...
Misty make a minesweeper
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
If I ever get around to it maybe
Tho I really don't wanna mess with gui
You can make a way to display it in console first, then port it over to swing
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
How do I make a loop command, like it'll send a meme every 15 seconds
Nono, I'll make a command so ppl can change time like 5 seconds to 1 min
Nice way to speedrun the ratelimit
I finished making the music bot
Wdym?
Also what do you guys mean by logic and ui thread?
If 2 people activate such system, you'll get ratelimited
am i allowed to send 50 memes in 1 second?
Because you're walking too close to the limits
There's a /s right? Right?
Only admins can use that and the command will have a cooldown for 12 hours
ill invite your bot if you allow it
yes s for serious
When u run a java program it's mono thread by default, you need to assign the threads yourself
The UI is rendered on a different thread than your logical processing so your UI stays responsive during events that take time to process
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
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
Should I just put all my like JFrames and Buttons in my run method on the main UI Class?
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
Interesting
Mmm how do I add that stuff to my frame tho
What stuff?
Like the components or whatever
In the gui designer the components will be at the right-side menu
Ah I see
Here, better yet
How to use the interface designer of IntelliJ Idea 2021
How to create a Java Frame using Window Builder of IntelliJ Idea 2021
How to Create Java Frame using GUI Designer in IntelliJ Idea 2021
IntelliJ IDEA 2021, Swing Designer, Swing Builder, GUI Designer, GUI Builder, Frame Designer, Frame Builder, Window Designer, Window Builder, Interface De...
I am now starting to wonder what the hell should I use for the minesweeper area
Mmm, but wouldn't I need something to put the numbers and mines on
Jbutton
Pretty much lmao
Use a for-loop so you don't need to write every single button individually
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
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
Right I remember that being the case
😔
I am honestly not sure how ima do this but lets give it a shot
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
The gui designer is a bit wonky, watch some videos on how to work with it
I am but what he is doing I seem to not be able to do
json-simple is good in my experience
Is that the same thing
Idk, just see if the lib group is org.json
Not at pc rn I’ll check docs tho
Nope it’s not
made by something called cliftonlabs
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
Cya
I am already disliking this minesweeper idea 
why?
Can't get the gui to actually show up
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
Watch the tutorial video @sharp geyser
No I give up fuck swing
The designer is not incredibly intuitive at first
💀
I have piss poor motivation rn
That was quick
swing really swings the mood huh
i tried swing, but i think i'd rather stick to gtk
maybe run npm install to update the packages. if not, just reinstall react router
is 5 a maximum amount of components you can add to Modal?
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 :/
ty
TypeError: db.add is not a function
why this error happened ?
const db = require('quick.db')
[solved]
const { QuickDB } = require("quick.db");
const db = new QuickDB();
check the docs bro https://quickdb.js.org/
discord.js v13
??
does quick.db added a new version ?
ig
whats a good paid for host thats still on the cheaper side, up 24/7, has github integration and hopefully an overview etc
idk if it has github integration but i heard contabo vps is cheap and good
thanks ill check it out, currently using heroku which seems pretty good but theyve removed their github integration
💀
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
yea heroku had idk like data leak something with github
so prolly removed
some kind of security issue
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?
u cant use an internal database with heroku tho
Has a field in the panel to add GitHub
And it fetches latest version every time you restart
how can this be improved?
what about the styling
the layout
and the wording
etc etc etc
what can be changed
Yes quick.db package have new version
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 😄
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
Maybe under the inputs, to the left side of the card, same row as the next button?
Or like this or info icon on a card
Or underlined texr with popup
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
Does anyone know any free/self-hosted image hosting services?
Image hosting
Thanks
Is there any alternatives to imgur? (I have to register with a phone number, I kinda don't want to do that.. xD)
You don’t need to have an account for Imgur
^
How?
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
I love how neat ur code is lol, wish I could be that tidy
its important to keep code clean
thankfully most code editors have a hotkey to auto format code
everything else is just spacing code
Thankfully I’m using npp and I’m not that lazy to auto format code

just be lazy 👀
Once you be there you won’t go back sir
lol
its the only way i can code 🤣
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
Issue wasn't with react router it was something else
React router was at the latest version
It was likely an issue with the cra template react used when generating a basic react app
hmm
me whom used to code everything in the index file 
look id just started, command handlers and modules confused me
modules still confuse me, and I use them every day ^_^
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
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.
LOL i'm rewriting a file that was 1720 lines and it's only one file of a rather big project
Hi, can someone tell me why is this happening?
im new to discord bots and js 😛
insted of embeding the message i create it?
you're trying to send an empty message
what is your code
also read the warning, use the messageCreate event
this is incorrect, it should be messageEmbed.react(
this should be .send({embeds:[embed]}) (if you're using version 13)
i was following this vid https://www.youtube.com/watch?v=wXjsCiUjUqo&ab_channel=CodeLyon
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...
https://cdn.myprojects.lol/🧰🧧🛁🦋⚗️.png can't install canvas
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
sry about that
did you do this
will try that now
thats the only thing ive gotten good at XD, stackedoverflow for life
Hello! Im looking to submit my bot to the website but i wonder if the "Long Description" supports Markdown
it should
cant remember but somewhere on the page it gave a link to a list of the supported markdowns or smt
So py-cord, not dpy
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.playing, name=f"with ur mom"))
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
guys
does anyone have the ```js
process.on('unhandledRejection', error => {
console.error('Unhandled promise rejection:', error);
});
something like this
k
how is it a bad idea? that's how you make error handlers
that event is a safety net to catch errors that should have been caught by your code in the first place, its basically a way to warn you that "hey, your code is not catching this error, fix it pls"
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
Suppressing errors is the new way of fixing them, Tim
At least the code looks more operational without errors 
no way you said that Tim
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?
damn right
absolutely yes
of course it's better to have 30 try catch
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
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
like?
there's a couple of examples I could show you in the code I recently wrote
give a sec
thats literally what catches are for
but you can always structure them in a better way
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?
have a go at this ^
you should be checking before the error anyway
it does
I've gotten the error message before
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
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
)
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.');
}
😐
or
Tim… don’t
I mean, you realistically should be checking https://discord.js.org/#/docs/discord.js/stable/class/GuildMember?scrollTo=bannable
before banning anyway, catching the error should be extremely rare
I am
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.'))
😐
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
you literally dont need a try catch there?
I know
also, do you catch errors at the command handler?
otherwise you also need to catch the message.channel.send
I am
also using a custom logger class and I use the unhandled rejection event there
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?
yeah I am, and if there is an error I'm using the logger class to log it
message.member.roles.cache.find(role => role.name === finalCheck).id
use ?.id instead of .id
alright thanks
then it should be even easier to catch errors
yeah I'm just putting the try catch statements in places I want a customized error message
it works most of the time
How do I assign autoroles for voting using @pliant gorge bot?
Also doing return true; and return false is redundant
Just do return yourConditionHere
Properly awaiting and catching each promise let’s you define a more detailed error message instead of a try/catch block awaiting and catching multiple promises and just have one error message, saying something has gone wrong
I'm not sure which one I should catch sometimes as I'm not that good at discord.js especially after the V13 update
that's why I catch multiple promises that appear as if they would give similar or the same error message
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
}
I get where you're coming from but that's the job of the error handler to figure out what's wrong
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
it does if they are awaited
Ah okay
Well I was about to say the same
the end user doesn't need to know which error occured, why would he need that information?
the end user doesnt need this information?
it does need this, but not the exact error message I mean
thats what i said basically
yeah, and the logging the exact errors is up to the developers
unless you're executing a command like eval
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
or something else that needs the exact output
in my handler I got a switch case statement with most error messages and it outputs the appropriate response
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
that's what the statement is for
There’s none in the code you shared regarding the ban
here's some
rest is in the command handler
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?
logs
Well nonsense then since your command would catch that
you can also do a very simple custom error message system
global try-catch inside event handler + print to channel?
It’s not, if the command handler logs the error already if member.send() fails why would you wrap in into an extra try/catch to do the exact same as the command handler?

It’s a nested try/catch doing the same as the outermost one
for logging 😭
like a log that tells the person who tried banning that the message failed to send
The command handler should log this error already?!
Why else would you catch it there?
it's for the guild not me
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
}
that's how I did it
but without having a class
that's a bit unnecessary
Well that’s how you extend the error class
you can throw any javascript value so you can do like
throw { error: true, message: "Some Message" }

now it begins
I would, but the JS library for the discord api is way more advanced
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
but hey your bot will be faster
you know what I meant
🤷♂️
it's better, easier to use and better covered endpoints
Without coding crap when will you notice that difference? Maybe when being in a few 100k servers or more?!
You could make a library in C just as “advanced” as any js library
I don't see many people writing bots in C so I doubt that will happen anytime soon
Better is a subjective term, easier to use yes, and better covered endpoints is simply not true
how is that not true?
Because there is a limited amount of endpoints. Any complete C library would “cover” just as many endpoints as a js library would
I feel like he means feature rich
by better covered I mean simpler, the containers for methods are simpler
if you have 65k+ endpoints you really need to rethink your design choices
yeah that's a better word
My point is that just because you don’t NEED to use something, doesn’t mean you shouldn’t

That’s not my point 🙄
The most popular JS engine is written in C++
c++ is a superset of c no?
no
I thought pretty much anything that compiles in C would compile in C++
no there are definitely differences. Some code yes but definitely not all
Interesting
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
Idk if I would trust quora answers for these types of questions
https://www.geeksforgeeks.org/difference-between-c-and-c/
geeksforgeeks?
tf was this a real article?
A lot of people don't know
Back in 2015 html and http, it was all the same, known as the internet
i code internet
I bet your grandma doesn't
my grandma post memes in facebook
what is the difference between css and cs
:^)
What is a Github repository's file path? (i'm using os.chdir("FILE_PATH") to give a file access to a json file)
i would say it is
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
Asm output also depends on compiler
maybe the way slower was exaggerated
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
i think thats just referring to the compilation process
but from benchmarks it seems they're relatively similar
they each slightly beat each other in different aspects
Except for nbody lol
wanna see your compiler burn? make nested templates
bro i get like no intellisense whenever i write a template
Templates are amazing but they also suck
i get some intellisense with clangd but with the c/c++ one provided by vsc you get none
apparently its intentional
i once tried to make a c++ Map for js where you could specify the c++ data type from js
I use CLion for most projects
like new Map("string", "uint32")
The auto fill is great
and the cpp would create that using templates
of course
turns out that generated hundreds of thousands of type combinations
oh yeah true because the compiler only generates templates for all the possible value combinations
Lol
dont have to use templates tho
for my db all my types are hard coded
i gave up with templates
yeah but like
they're the best and worse thing in c++
if you want both the key and the value to be customizable
their types i mean
you're not gonna hardcode that
I mean, all the types in js can be represented with string technically, no?
yes the standard way is to convert js data to buffers before giving them to cpp
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)
yeah thats pretty much it, just using buffer instead of string
since raw string doesnt really exist in cpp
At that point you would only need one template for the value type though right?
yeah, which basically means no templates, just code it once
is char* a joke to you
which is basically a buffer
fancy way to say array of characters 😠
array of bytes
sure
sounds more intuitive than the c++ way
there is a node api for rust
Rust has bindings
splendid
Really fast too
do u need a option if im doing a subcommand?
I need to learn rust
i'll make what you wanted to make
yeah rust is cool
Rust is fucking amazing and looks so cool but I just haven’t had the time to learn it
it can do very low level stuff but i find it trash and annoying for very low level stuff
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
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
?
i hate how if statements dont have brackets
But it looks like an amazing language with so much potential
it triggers me
Yeah same
The lack of parenthesis is something I can get used to for those though
Small sacrifice for an amazing language
just dont write unsafe code and you should be fine with rust
Yeah
Text input command options are optional
Speedy do you have any resources you recommend for learning rust
Or just trial and error like how I learn most langs
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
that how im doing it
i also ask for help with topics im stuck on in the rust server
they're surprisingly patient
Well if you define an options array then set the proper type for the options
i wouldnt code a database or os with rust though 💀
I feel like it’s a language that would be good for gamedev when the ecosystem expands a little more
Ehhh
could
I feel it’s still too low level to replace C# entirely
actually thats a perfect match
you arent going to be doing extremely low level stuff with game dev anyways
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
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
I need to learn rust enums
They look so cool but I just don’t understand them
Or when to use them
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
i think neon is just one integration module
My data is freaking the fuck out rn
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
My LTE is getting fucked because the cell towers near me are being repaired
hot
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
That’s really nice actually
I'll be honest, I don't like rust, but I like even less c++ so the lesser evil wins
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
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 💀
Winapi is a horrendous clusterfuck of terribly thought out design that goes completely against any conventions previously taught about C++ I stg
windows api is very poorly designed
AtomicU32::new();?
they cant really fix it tho because backwards compatibility
this aint c++ bro
tf that actually works
this feels illegal
why does it say to do .new instead of ::new
The duality of rust
let's play a wordle:
keybd_event(bVk, bScan, dwFlags, dwExtraInfo)
what is each param?
“This ain’t c++”
“Wait wtf that works”
Tim this is coming from a guy who uses regex for everything
Ik this is late response to the conversation at hand but 
Don't Worry Flags, Don't Worry Extra Info
ez
I use regex to convert pdf into csv at my job
where's my cookie
i have no idea why you have to do ::new for static variables but .new for ones within a function
sorry you didn't click "I accept" on the banner so you don't get any cookies
oh that doesnt work within functions either
smh
?
use a locale file + placeholders
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
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
Oh god, don't tell me you're using https://npmjs.com/package/request
basically if the function header has &self or &mut self, it's a method and you can call it with .
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
i've been using it forever i just never started using axios or any other libraries
You shouldn't use it, request is deprecated
let a = AtomicU32::new(0);
let b = a.get_mut();```
alright
dword aka unsigned int 
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
dword… isn’t that 2 bytes though!
(I don’t remember enough assembly)
Nvm looked it up it’s 4


