#development
1 messages · Page 1953 of 1
yes
ohk then?
once its created, you will have a replit.nix file
yes
change that file to this
{ pkgs }: {
deps = [
pkgs.nodejs-16_x
];
}
and your .replit file must have this
run = "node index.js"
then you can copy your other files from your other project
yes
ok lemme check
thats an issue with your code
hmm
actually it isnt
you havent enabled the proper intents on your bot dev page
can u tell?
how to enable it
show your index.js
ok
what intents are you using?
you are using GUILD_MEMBERS
hmm
to use that, you need to enable it in your discord bot's page
in the discord developers website
now try again
👍
heh
Plz accept my friend request
no sorry
tim accept mine
why 😦
@solemn latch you're smart, should i go for block or object storage
i store image data in a database
as long as i can assign the image to an ID in the database i'm happy
and as long as its fast
Object is probably better for what you are doing.
alrighty
Is it set to private?
no
so, https://i.imgur.com/05JNKVW.png
and https://i.imgur.com/QHYOC4N.png
say public?
op i blured where it says private, meant to rectangle kek
I've only had that show when they are set to private.
https://i.imgur.com/aZsoMVH.png
if i set it to public it loads the image
yep
cleared cache ™️ and it worked
https://clear-cache.xyz moment
@solemn latch is it possible to cname
with Backblaze
not sure tbh, never tried.
it was explained quite well in the conversation that followed that message
what didnt you understand?
can you run the same bot from 2 servers with different functions
yes
huh
no no
not guilds
servers
like actual servers
aka host services
yes
ik
what i am trying to do is to handle some functions directly from the site and some others from another server
You could shard and have X shards on one server
Is there something wrong with this bit of code? The bot chats with you in the DMs when you DM it
const fetch = require('node-fetch')
let b = await db.fetch(`chatbot_${message.guild?.id}`);
if(b !== undefined){
let channelName = message.guild?.channels.cache.get(b);
let mChannel = message.channel as any
if (mChannel?.name == channelName?.name) {
if (message.author.bot) return;
message.channel?.sendTyping();
if (!message.content) return message.channel.send("Please say something.").catch((err) => console.log(err));
fetch(`https://api.affiliateplus.xyz/api/chatbot?message=${encodeURIComponent(message.content)}&botname=${client.user?.username}&ownername=Angel`)
.then((res: any) => res.json())
.then((data: any) => {
message.reply({ content: `${data.message}`, allowedMentions: { repliedUser: false }}).catch((err) => console.log(err));
});
message.channel?.sendTyping();
}
}
and what's happening
You implied something was wrong with it, so that's wrong with it?
ayo guys how can i run 2 nodejs projects at the same time
depends on your work flow
If you're using VSCode, many people like to have separate windows for each project
Or use some built-in functionality to run projects at the same time
If you're using Sublime Text it's a bit more difficult given the only good option is to run an external process
e.g. from a terminal
For you guys building REST APIs, how do you like to handle error messages? I've been structuring them based on the incoming request, so, for example, a request to create a user with a blank string may return this:
// 400 Bad Request
{
"body": {
"name": ["must not be blank"]
}
}
It's an array of reasons, but it's not very machine consumable. I've considered representing errors as bits, but don't know if it's a good idea given there could be a lot of reasons.
Mmm I might do it a bit weirdly but I just
{
success: false,
message: 'Name must not be blank'
}
Hmm
I don't think success fields are that useful given the response code often indicates that (200 <= x <= 299)
Mmm, at that time i was using success as a way to tell if the request failed easier.
if(success){do something}
or smth
Yeah, it is a bit easier, especially with chaining like with node-fetch
yea
but status codes can usually tell more than a boolean
yea, I was just getting into making rest apis so I didn't really know the best way to handle error messages
I still use success fields sometimes though.
I sometimes see it in the wild
like Hypixel's API
which ironically sometimes says true but still doesn't have a useful body

but their api is a mess in general
there are like 13 ways to determine a user's rank (you have to use all of them to get accurate)
and it's just a mongodb document dump
go isn't bad
I still dont fully understand it but its actually rather easy to understand some concepts
I'm sure it's not "bad"
but I just haven't felt like putting in the effort to learn it
i just use js lul
there is a friend of mine who always likes to talk about it
but my last experience with a lang in its domain is rust
and I didn't really like that
didn't have a use for it even though you can use it at a high level
I dont really like rust that much either
If I had to use a low-level language though I'd consider C over Rust
V walks in
kekw
why would you create a new project in C in 2022 honestly
go has nothing to do with c lmao
I use typescript sometimes
but I don't doubt it wouldn't be painful
pople do be dum
plenty of reasons lel
coding in C is like trying to grow crops on a minefield ngl
I couldn't learn C it seems too annoying
I mean if youre not making something embedded
living dangerously is what the cool kids do
have you heard of shellshock, stagefreight and friends
which shellshock
super critical vulnerabilities introduced by some of the most experienced C developers in codebases audited by industry veterans
Yeah I know C is much more vulnerable than a language like Rust
But it's something I'd consider learning regardless
If I were building a long-term project sure I'd pick Rust
if you think you're more experienced than the entirety of the Android security team combined go ahead and make that new C project

C is the most vulnerable lang because its also the most present lang everywhere
nah I don't agree with that, C just gives you way too much freedom
you can do absolutely anything you want including things you definitely do not want to do
well, yeah, but its also been around for decades, and a large amount of vulnerabilities are due to old outdated code and outdated libraries
that's definitely a factor too
but we also keep finding critical vulnerabilities in C codebases not related to dependencies that've been audited by countless experts so it's not just a matter of numbers
Thats just because People who use C dont believe in dependancies

i use js and i dont believe in dependencies
yeah but thats because deep down your a C nerd
i suck at C tho
i just know the basics
but in js yeah, most my libs are 0-dep
lmao
lmao
i guess that means that i know C but am very slow at coding it
because i constantly need to check docs and SO
thats everyone dw
how could i get a messages content and then replace every space with a -
.content and .replace(...), but depends on your language
.replace(/\s/g, "-'')?
node
If you want to get rid of all kinds of whitespace, sure.
ok
dont forget to also replace yellowspace and redspace
what about purplespace
how?
it just really doesn't like spaces
how could i use this:
octokit.request(`GET /repos/username/test-repo`, {})
to do actions if the repo was found and do other actions if it dose not exist
what happens if it does not exist?
404 error
then you can catch it
but how do i know if something has been found
it will not error?
so all i have to do is...
```octokit.request(GET /repos/username/test-repo, {}).catch(error => console.log("Not Found"))
console.log("Found")
not exactly, but close
if you use .catch(), that will not stop the next lines from running, meaning if it was not found, both not found and found would be logged
so if you want to use the .then().catch() way, you need to do it like this:
octokit.request(...).then(result => {
// code if found
}).catch(error => {
// code if not found
});
// no code here
or if you want to do it the async/await way, its easier:
const result = await octokit.request(...).catch(() => null); // give null if error
if(result) {
// code if found
} else {
// code if not found
}
// code after found or not found
there is also another way
async/await with try/catch
try {
const result = await octokit.request(...)
// code if found
} catch(error) {
// code if not found
}
// code after found or not found
uh i hope this channel fits for this, but how tf do i increase the size of the terminal scrollbar in vs code its so SMALL i can't click on it bcs it thinks i'm trying resize vscode...
you could use your mouse to scrol
its instant not as smooth as moving the scrollbar and it confused me makes it harder to focus
or if I can detach the terminal on a separate window like unity has with its game window/scene window and such
it'd be great
help I am using discord.js v13.5 and i get error "Error [BAN_RESOLVE_ID]: Couldn't resolve the user id to unban." when i do interaction.guild.members.unban(<id>)
I hope you aren't actually doing .unban(<id>)
cause <id> is a placeholder for an id
yes
no
Make sure it is a valid user id
hey, how would i create a function where 2 discord users can keep on writing numbers until someone writes pass?
wym pass?
interaction.guild.user.unban(<id>)?
I would like 2 people to write down bets using !bet
it would eventually all stack up basically.
So !bet (50) will add 50 to the pot, and in which the other user HAS to use !bet. However, he can also use !pass which would stop the function
You could do !bet @eternal osprey 100$ <- example
I just don't quite know how to implement it
And then use a collector to find the command pass when being used.
And stop the cmd.
Idk much abt collectors.
May be wrong with that
But that's my idea.
Or do that and use a collector.
yes, but if he doesn't use !pass, but bets, the turn will go to the other user again
I always use a class for games that progress endlessly, call its own function until it ends
it will be a long betting phase until someone passes
Well that works too.
Yeah i wanted to implement a function too, but i am just a bit stuck on how to actually implement the actual function.
So u don't know how to use class, is basically what your saying.
basically yes
Instead of classes (which actually scares me just by looking at it), i would actually want to use functions if that's possible
It would do this:
Classes are just functions and properties wrapped into an object
Will make your life a lot easier
@user1 Please bet:
// user 1 bets
@user2 Please bet:
//user 2 bets
@user1 Please bet:
// user uses !pass
Function stops```
shit its py
js
oh
class GameClass {
constructor(user1, user2) {
this.user1 = user1;
this.user2 = user2;
this.currentPlayer = 0;
this.startup();
}
startup(){
//start everything, create a collector for !pass that lasts until the end of the game
}
nextPlayer(){
// create a collector for listening for !bet on the next player
}
endGame(){
// end game
}
yeah my : is confusing lmao
^^
Basic classes aren’t too hard to implement
You’ll get used to it
They look scary at first but I promise you they’re not that bad, and it’ll save you writing a lot of code in most circumstances
Alrighty, will have a look at classes then!
it really is just a set of functions, with all the data for the players contained inside itself
Whenever you do module.exports = { blah blah } it’s similar to a class as well
aha! Yeah it seems less scarier than i thought. Thanks Nala and Waffle!
Ngl this looks pretty sick https://dioxuslabs.com/blog/introducing-dioxus/#
it is
that says its not
so

Actually
Are you sure the user is even banned
That could probably be another source to the error
the startup() belongs to user1 right?
And the nextPlayer() for user2
that is the only other way I can see it giving you that error unless the user id is invalid
TypeError: Cannot read properties of undefined (reading 'unban')
Well that explains it
User objects can’t be banned
Member objects can be banned
If I’m understanding that correctly
Why would you even need .user anyways
You need member object to unban
if the member is uncached, you need the guildmembermanager then iirc
interaction.guild.bans.create() seems like it would work as well
And interaction.guild.bans.remove()
I’m not entirely sure if that works but from looking at the docs it should
how do you use it?
like is a method of?
nope, its a method of the class itself
Seems like you need a user object as well. Probably easier to go with one of the other methods suggested by others
Never mind you don’t need the object
Something like that
still "Error [BAN_RESOLVE_ID]: Couldn't resolve the user id to unban."
well now it's: interaction.guild.bans.remove(interaction.options.getString('target').id,interaction.user.tag+': '+interaction.options.getString('reason'))
oh
i see
.id
owh.
I have tried this, but it most definitely is wrong.
🤦♂️
I am wandering through the docs, but this is a bit too hard for me tbh
class GameClass {
constructor(user1, user2) {
this.user1 = user1;
this.user2 = user2;
this.currentPlayer = 0;
this.startup();
this.message = message.content;
}
startup(){
if(message.content.startsWith('!stack') && message.author == this.currentPlayer){
const test1 = message.content.split("\n")
.map((x) => x.split(/ +/));
gamedatabase[rarko.id].betamount = Number(test1[0][1])
console.log('Next player')
}
}
nextPlayer(){
// create a collector for listening for !bet on the next player
}
endGame(){
// end game
}
}
}```
Wait you can create a ban?
Your class doesn’t know what message is
You have to either pass that in as a parameter or pass that in the constructor as a property
well nvm i fixed it
According to the docs yeah
So it's not different from using .ban
Not that I’m aware of
Alright, but as i have everything in the startup(), i suppose i can remove the nextplayer() function right
I just still don't get how this will tell the bot to switch from users
It’s up to you how to design it, so you can remove that function if you really want (though I don’t recommend it, since it’s less organized)
It might help to take a look at an OOP guide for js
So according to this snippet, if i used !stack 5, it would recognize it and move on to the other?
Wow didn't know that
I am currently wandering around on the mozilla developer site, but it's pretty hard to combine and integrate the actual classes with discord itself
I get that
Basically what you’re trying to do is create an infinite loop until someone passes
Right?
yeah!
You can do that a few ways
The first way is to have a while(true) loop and break on certain conditions that you specify
I’d recommend a message collector though since you probably want it to expire after a certain amount of time
Not really. Just till someone passes.
Oh
They could be betting for hours (if their balance isn't lower than the actual bet amount)
Won't a while loop effect performance in the long run (asking cause performance is something I'm always confused about how to calculate)
Probably not but it’s definitely not the cleanest solution for this
Icic
I think a message collector is going to be your best friend here
My brain is kinda foggy atm so I can’t really think of a seamless solution, but using a message collector is probably the right way to go with this
Thank you 🙂
@quartz kindle
on use of a slash command with an optional argument, if nothing is specified for that specific option, does it return null?
no idea
I think (?) you can specify a default value for a slash command optional argument
Unless that’s just a detritus thing
there is nothing about default value in the discord docs
and it says value is nullable
so the option should either have no value, or have null value
you see this is why I use detritus
nvm
the small things add up
That English didn’t make sense at all
we speak dragons here
Well if Discord even sends the empty option with the event then it’s null or probably undefined - doesn’t actually matter
Or non existing at all - shouldn’t be hard to find out registering a guild command real quick
just sounds like unnecessary bloat lol
adding extra stuff that the api doesnt have because people are lazy to do it themselves
Nah he was speaking about letting an optional option empty when sending the command
sounds like discord structures
"oh no dot doesn't work in my ide anymore! I can't stand using functions!"
just looked apparently there's no default option
I remember something about default values to something though
I think I remember something about it in the past
autocomplete is sexy tho
Only for option types like Boolean
ah this is what I was thinking of (message commands) ```ts
export default class BanCommand extends BaseCommand {
constructor(client: CommandClient) {
super(client, {
name: COMMAND_NAME,
permissionsClient: [Permissions.EMBED_LINKS, Permissions.BAN_MEMBERS],
permissions: [Permissions.BAN_MEMBERS],
disableDm: true,
args: [{ name: 'clean', default: 1, type: Number }],
metadata: {
description: 'Bans a specified user',
examples: [${COMMAND_NAME} @Waffle#9125],
type: 'moderation',
usage: '[Member: Mention, ID] <reason> (-clean: Number)',
},
type: Parameters.banPayload(),
label: 'context',
});
}
}
Damn and I still had no time yet to test it or even an use case for it
I need to get into rust gui tooling with that new library because that looks sick
which one
there's like a new gui framework every week on r/rust
this one looks promising
You better learn PHP, best GUI builder on the market
no >:C
I knew it… Java
No!
just slap reactive and immutable on your library and stars will really start paying your rent
masochist
I can not trust you anymore
I just like OOP
That sounded like you like Java and tried to recommend it
no
I was making a joke about swing 
intellij is written entirely in swing
the pain those devs must've felt
so that's why it looks awful
so many settings
spent hours trying to configure stuff
then realized I forgot how to revert some changes
I think IntelliJ has too much to be productive but that's just me
and a good ui is a good experience
I like sublime right now since it's minimal
I like their ides for C++, Rust, Java, and that's about it
Visual Studio Community is a much better experience for C#, and Visual Studio Code is a much better experience for web dev/js/ts
I wouldn't lay a finger on python but if I did then I'd probably use PyCharm
Oh no that discussion again 
But I'm not sure since I haven't used it
Notepad++ still for all hardcore coders
more than half of my bot will use it lmao, i have an enormous amount use cases for it
I noticed for my 1server test bot that slash commands work fast. However, on my larger bot (1500 servers) when trying to handle interactions, discord.js claims that the interaction is unknown most of the time if I try running commands within a few seconds of each other. I did not have this issue with my test bot. Any reason?
If the first command sent fails, sending it again it works.
but as you know it, im still procrastinating on my api :^)
do you reply or defer?
I reply, deferring doesn't affect it because when deferring and still trying to post it claims the interaction just doesn't exist.
Maybe I should just try to defer everything but still.
Yeah I remember that when we first talked about that feature and you explained what it does
It’s actually made for your use cases
speaking of intents
are you supposed to pong after each interaction
I've just been responding
well, you have 3 seconds to either reply or defer, so if your replies are slow, deferring everything will fix it, BUT, if your events are being slow or delayed for some reason, then you are also receiving interactions late, so your 3 second window can actually be less than 2 seconds, or even negative
you only need to pong if you're running interactions via webhook, not websocket
I see.
ah
I'd suggest letting it fail
It's jsut odd for it to fail every other time it does it.
Like it doesn't make fun exp
You also sometimes receive the event and respond immediately but it’s already expired
instantly deferring it gives you more time to reply as you wish
follow up responses after deferring have 15 minute time window instead of 3 seconds
Not only a related issue to the latency at least what I could figure out yet
yes, thats what i meant when i said the 3 second window can even be negative lul
discord dicksword measures 3 seconds from the time they send it, but until you receive it, all sorts of delays can happen
Yeah
Assuming more registered slash commands and API requests will exist in the future, that issue might happen more often, than rarely as it is right now
the sad part?
in my time reviewing its not uncommon for bots to have 3+ seconds response time
if they want to use slash commands they actually cannot.
I want to note that I instantly get a broken "unknown" interaction within miliseconds.
@wheat mesa I just looked into Dioxus. It looks interesting given it's React inspired, but a bit scary since it's heavily macro-driven and makes use of categories that aren't relevant to Rust, like immutability. Is there a thing Dioxus is really good at that stands out?
Yeah who knows what Discords backend measures as timestamp for successfully sending the event to you and the actual timestamp you receive it, as Tim already said above
I'm not good at rust, I just thought it looked like a very cool GUI library given I haven't seen that many unique GUI libs for rust quite yet
Does anyone know if there are more option types planned for slash commands like picking dates etc.?
I don’t actually follow the development
There are attachments
But nothing else for types
The list is at https://github.com/discord/discord-api-docs/discussions/3581
Hmm I can imagine picking a time/date would be useful
Yeah it would
A string option and converting it to a timestamp might fail due user stupidity providing any valid date format
But it works fine for my test bot, of course it would.
How is my fucking 1500 bot getting such late events. Doesn't make sense?
Hmm too many events it can process in time?
One event?
it would be extremely useful to me as well
especially when right now i use day/month/year strings to do it, and half of my users want to use month/day/year instead
lmao
fucking muricans
I absolutely know what you’re speaking about
Only 2 seconds but still?
My community control web panels always had yyyy-mm-dd and people from US to RU used it and there was one continent always having trouble with it 
a single websocket is fully queued and sequential, they cannot send you an interaction event until every single other event is successfully received by your bot, so if you get a LOT of events, it could delay the entire socket
that would be one explanation
Idk 1000s other events, guild events, presence events etc?!
any network fluctuation could also cause congestion to specific parts of the socket
if, as you said, it doesnt happen on smaller sockets, with only a few guilds
one thing you could try is having more sockets with less guilds each
Sharding?
imagine having the problem so many users use your bot that you have this issue. couldnt be me!(not /s)
Or completely using a different endpoint dealing with slash command events other than your actual bot
People do that too I guess
i have never tested it in production, but im fairly certain webhook interactions are much more reliable than websocket interactions
at least in theory they should be
Hmm, an example?
you will need an interaction server that complies with discord's security demands
meaning, you need a domain name with ssl
and need to verify each request's signature
and respond to random ping requests
Well I've got the domain at least via AWS.
Oh that’s already a thing?
Ah that’s the response option I saw in the table then
I was wondering what ping actually meant
Well it’s literally just a webserver responding to incoming requests like from topgg also acknowledging them and responding to random requests
(pings)
Oh custom headers
That's what I'd expect.
Guess I need to study the docs
yeah, all messages are signed by ed25519
you have to return 401 on missing or invalid signature
and they do test that by randomly sending you invalid requests
Ah I see ping acknowledging requires to answer with the type omg
ye
Not much complicated at all
the only hard part was getting the signature to work
because discord gives you a raw key, and node.js doesnt support raw keys
so the typical solution is to just use libsodium
but i wanted to be 0 dep, so figured out how to convert the raw key to whateevr node.js wants
Haven’t even heard ed255… ever before
which is just this, simple af, but was hard to figure out lmao
this._key = crypto.createPublicKey({
key: Buffer.concat([Buffer.from("MCowBQYDK2VwAyEA", "base64"), Buffer.from(this.key, "hex")]),
format: "der",
type: "spki"
});
I need to figure that out, too if I wanna step away from sockets
the easy way is to just use libsodium or tweetnacl
Do the pings actually influence your app online status?
Well I guess I'll try sharding and pray.
didnt test, but possibly
i mean, when i was testing this, there wasnt even an online status for non-bot apps
Well I meant for php
Oh yeah that might be the case
I thought they stated the app can be listed as being online (not only responding via websockets) without a client being shown in the member list
Huh wtf is that English
Just ignore what I wrote lol
xD
Even if that’s very helpful I doubt I can find that messages again when searching for them as there’s no option to save/favorite messages
That would actually be an useful feature
god have no idea how I'm going to handle sharding now lmao. Time to be smart and make a shard manager???
No no Tim is currently writing my php code as I can’t on mobile 
lmao
im making my bot try to fetch 43k users to check if they are deleted accounts
Wont you get hardcore rate limited, or are you going to wait a couple hours?
im relying on djs rate limiter
current speed is 10 per second
Nice
so its gonna take about an hour and 20 min
I'm praying whatever the fuck I write for this sharding thing works as I've never done this
You got taht one? 
xD
alright I'm betting tim gets banned
lmfao
What’s even the purpose of finding out if they’re deleted or active?
probably clear his db
ye
Oh oh… Tim may owns data from deleted accounts without their consent?
I’m calling the police now, I swear
lmao
That privacy breach tho
how am i supposed to know when they delete their accounts
theres no event for that xd
Xd
That’s not question!
Yes, yes my English is on point today

Oh actually I see something I haven’t thought about yet
Need to pass my utils, app and sql class to my eval cmd, too
Never thought about that before
Tim attached anything to the client 
i dont have any fancy dashboard or database control panel, this eval is literally the only way to interact with the db, except something like an sqlite file editor
Well I mean most likely you don’t even that
dashboards are overrated anyway
ill need to make a dashboard eventually
my premium stuff is way too complicated to set up
people have to paypal or patreon me, then i have to send them a json and they have to edit the values and send it back to me, then i add the json configuration to their accounts
Bruh lmao
yeah
because its colors and graphics stuff
cant really use commands for that
i mean i could, but it would be complicated
a dashboard would be much better
with color pickers for example
Why don’t you use the PayPal flow?
Did write one flow in the past already
You provide additional informations to the request to PayPal, like a Discord user ID after a login, and will get it back from PayPal within its requests and the info about the payment status
Storing the payment in a database and if it’s successful you promote the Discord user ID with whatever you want
yeah
but my issue is that my premium features are not easily activatable
i currently have to manually define the features the person wants after they explain to me what they want
Oh man this is already not fun.
the amount of possible customization doesnt fit in 2000 chars
Built and used that flow a few years ago for a gaming community requiring the Steam login then pushing the Steam ID through the process and storing it together with the payment info in the database
To grant VIP access to server shit
i know people get frustrated after they donate because they expect something that i just turn on and they have access to a bunch of new features and commands
but my stuff is too complicated for that
I would solve that by defining items to “purchase” and store them together with the payment infos and use that saved items of your database as features
well, these "items" have a huge ass json of customization
my premium feature is basically customizing the colors in the chart
Yo test bot worked
Omg
Let’s say item “red_bars” in your database represents whatever JSON customization in your code
“[red_bars,yellow_x,blue_y]”
And whatever
As items they purchase via PayPal being listed when buying that stuff
Item “red_bars” with description XYZ
For 1$

OKAY you’re not compatible to my suggestions
lmao
Dunno how many items you can sell but yeah
im thinking of making a dashboard with interctive color pickers and shit
and have it be a subscription feature
One last idea is to use a generator on your site, generating BITFLAGS (I hate) for the unique customization you save in your database
Yeah I see
Same idea
Might require to restrict to the colors
i have an even worse customization hell idea planned, but not for this bot, for a webapp im planning
but its essentially the same thing, but not limited to colors
Tbh I don’t actually see a big issue
I explain how
You website > generator (color picker etc.) > if done, customization saved in database > redirection to payment flow with unique payment ID (saved in database as well associated with the customization) > if payment success proceed > if fail delete customization from database
Actually damn easy
And for donations without that a big hint “you wanna donate without customization etc”
hmm its a good idea
but im still not sure if im gonna go that way
im thinking subscription might be easier, but will probably make much less money
i can try implementing both sub and theme purchase
Yee but generally storing the customization in a database or cookie/session together with a unique payment ID seems like an easy way
Also in terms of auto removing this if a payment never happens or fails
for the theme purchase idea i had thought in another way
give them 24 hours of access to the dashboard, where they can tweak and test in discord as well
and once the 24 hours are done, whatever they did gets permanently saved in their account
but your idea might be better
The association with an unique ID and the user ID in your database allows the donator to edit his customization at any time
yeah but i was planning on only allowing that for subs
for single purchases, further edits should not be accessible
otherwise they would never need to pay again
they would just edit it every time they want a new theme
Yes absolutely what I did too for reoccurring payments, the payment info in the database also contains the payment type
I dealt with different payment types too
Single and subs
To grant specific access to specific things for the Steam ID associated with the payment in my database
what do people prefer?
i have a feeling most people are against subbing
they just want to pay once and never again
or maybe thats my bias because i am like that too lmao
Reoccurring payments in our case as that grants special access to game server items and virtual shit, single payments just could access to other stuff like quick connect even if the slots are full etc.
Can’t remember 100% but I still have the payment code and database structure and screenshots somewhere
a button chart navigator
Tim that actually doesn’t matter that’s up to you how you promote it
idk i suck at making money
i feel much more at ease and relaxed when theres no money involved and everything is free
thats why i like working with open source
but thats also why im poor lmao
You just use the payment type as your point to access features or not for the associated user IDs or add a few more columns to the database for example, is_sub etc. to categorize your users and their features

That shit is actually scalable and extendable with features (as items if needed) you store in a database you deal with in the payment
You send anything you want to PayPal in your payment flow, they will list it for the customer when checking out and that’s it
i have a lot of freedom in my db so thats not an issue
And this all works for donations
its just deciding what costs what and in what payment format
As we weren’t selling stuff too
how much does your sub cost?
If I’m back to my PC tomorrow I show you how the usual payment infos look like
You can basically provide anything to the PayPal flow which will be processed and/or stored if a payment succeeds or not
They charged 9,99$ for VIP access to their game servers, skins and other bullshit nobody actually needs 
Per month
And the community had more than 400 active subscribers 
dayum
starts sharding
mongo claims things have already been executed
Bro I'm going to lose it
time to convert all my mongo shit to postgres
Yeah until the owner has ruined the project because he used all the cashed for private usage, didn’t pay the game servers, his developers and pissed anybody off
That way the sad end of more than 2000 invested hours
Work for an huge community panel, Framework, backend tech, automation systems, payment systems etc etc etc
Yeah it was a really frustrating ending

40k more to go
Ya ya… you’re spying on 40k accounts
tim what the heck are you doing
checking for deleted discord accounts so i can remove them from my db
Gently send everyone a DM to ask if you’re allowed to store their data 
and I heard you have 40k?
yeah
their id is literally the only thing i store that is not their bot settings lmao
Why the fuck do you need to clear your database then?
how else would i make per user settings? lmao
Is it already 932GB large?
oh I thought you literally only stored their id
smh
So I spent 4-5h trying to figure out why sapphire's new slash command implementation wasn't working
I’m close to my disk limits of 1TB but still don’t think about cleaning the database, so shut up Tim with your 20 MB database
turns out ts-node was the issue
i have user ids, and user ids create charts, so i need to check how many of those charts are dead/inactive/owned by dead people
damn people dying?
Oh fuck the time… my gosh
damn, the time must be sexy
Ok need to sleep, need to fucking finish building my roof today before the next snow is coming
o
Not for my house lol
Looks like wood
Genius 

And steel
Is sheet metal steel?
No but the steel is steel
looks nice
I have bad memories with sheet metal
Cut my eye open 3 times in roughly the same place on sheet metal
house without a roof not a roof without a house angery
At least looks solid enough to carry tons of snow
inb4 it falls apart
Shut up it doesn’t

inb4 15 feet of snow
if you are somewhere with 15 feet of snow
every mountain ever
you literally shouldn't be living there
and with one single mongoose error I'm changing to a rdms
Zoom in and take a look at the steel/beton walls
Wait where is ur mod status
That thing is more solid than Trumps fucking wall
Resigned.
nah
Respect the homies.
they are smelly
They work hard.
gg
He isn’t mod anymore, you don’t to be friendly to him anymore

lmfao
nah dylan the homie
I helped him solve one of his problems
yo you trying to seduce me
You can now be the deadass we know you are
now help me solve this one 😏
https://www.npmjs.com/package/postgres
This seems like a poggin npm package for postgres, if it's not and there's a better one let me know. 😄
if there is postgres, why isnt there pregres?
because we can't devolve further
progres
we haven't made progress
congres
do you want to get the freedom treatment
regres
that actually sounds nice
smh
gres.
gross
Found this looking up postgress UUID
I use pg + typeorm
lmao
Oh should I check out typeorm?
Do you use the postgres package I shared above of does typeorm help witht hat?
Are there big differences besides how the data is retrieved and how queries are done?
I'm not sure it matters which it uses typeorm just suggests this one
An Orm is basically like how discord.js is a lib for the discord api
It gives you methods and such to make tables and query data easier
You don't have to use an Orm but it's honestly really nice
Also typeorm is a really nice typescript Orm that works with more than just postgres
okay this is exactly what I want
Kekw
So you essentially only use typeorm and don't interface with pg at all right?
Typeorm uses it in the background
No problem
If you need an example of how to setup typeorm I can make one
Also any entities you create I suggest extending BaseEntity
I was thinking of just having a directory for all my entity's and then maybe some "service" class that handles all the entities and I can do basic calls through that?
What does Baseentity add?
Essentially you don't have to use the insert methods and such
Ah
You can just do
const user = new User()
user.id = blah
await user.save()
On phone so it's not in code blocks sorry
Also makes it nice cause you don't have to use getRepository
Oooh that is nice.
Yea
You can just call the table and use find one on it
I will make a typeorm example
Basically just how I implement it
man i hate that
id?: string
"strictPropertyInitialization": false is also a solution
But I don't wanna do that just for typeorm
Damn
Its not a big deal
It is basically just like "Yes this can never be null"
It makes it nice cause if you are missing that from your creation it will yell at you
say id is required and you do
const user = new User()
user.name = balh
it will yell
Right but I'd rather the TS interpreter to catch that because it becomes a runtime issue.
Cause I can do ! anywhere and make TS shutup.
But yeah until they come out with a better solution I guess I gotta do that
Mmm, but it markes it as a required field
You could always do a partial of a entity ig
but using Partial is not always good
Or add (required) as a param for the decorators 😉
Anyway using ! marks it as a required field so
Imo I rather it be how it is now
It is a lot easier to type
Hmm
😔
Added
ty
https://github.com/MistyyBoi/typeorm-example It is a rather shitty example tbh but I wrote it up quickly
Hopefully it helps at all until I can make a better example
Thanks, lemmie check it out.
I basically just covered how to connect to a database, how to make entites and how to make a table realtion (Many-To-One/One-To-Many) and how to query one and save one
Ooh the one to many helps.
Ah also
Also the unique decorator, ty ty
I forgot something
👀
When creating the connection use syncronize: true in dev
when you push to production remove it
Honestly, why have a _id and id
Which is great !
I was modeling it around a discord bot
ye
No problem
Also table relations are rather useful
One example is an inventory system.
Which is basically what I was modeling after in the example 
I know I could google this, but is there a way to limit length of arrays?
It is nice because once you make a table relation especially a Many-To-One table relation you don't really need to touch the table that has the Many-To-One decorator unless you are creating an instance of it
Besides hard coding checks.
I think you can use length prop on the Column decorator
though don't quote me on it
I'll google, thanks again 🙂
take a look at TableForeignKey
might be what you need
Not entirely sure though
Also I think RelationId decorator might be close to what you need as well (not entirely sure tho eek)
Yeah trying to read up on it before I start putting random stuff down ;p
@cedar plover check the pins for help on how to make a bot and ask for help here. Good luck! 
If you figure it out let me know as well :p
Seen a couple of people suggest using this pattern.
Guide.
yea
Might be all I need then?
Mmm, I would assume so it seems ot be what you'd want
Assuming you wanna make a One-To-One relation
You don't need JoinColumn for a ManyToOne relation
Oh?
Yea
Hmm
You just use OneToMany on the cattegory
or wait
I think I might have it mixed up one sec
In this case, the category doesn't need to contain reactroles
But the reactrole can be apart of a category.
Pog
a OneToMany relation can't exist without ManyToOne but the other way around is not necessary
I'm sure I'll have plenty of testing to do
I hope you enjoy typeorm
I will :)))
?

Lmfao
typeorm so far is supreme out of every orm i've tested
Also Dylan if you wanna contribute to the typeorm-example with your experience with it later on feel free too
discord.js wise
I plan on leaving it there for others
I was going to make a example using typeorm for the longest time I just never got around to it
not it is helping others




