vince
Explore posts from serversKPCKevin Powell - Community
•Created by vince on 2/18/2025 in #os-and-tools
Advice on setting up a monorepo

3 replies
KPCKevin Powell - Community
•Created by vince on 2/11/2025 in #back-end
Quick question about date and string types
I have a date property (e.g:
createdAt
) from the backend. I'm sending it to the frontend as JSON data. Since JSON only works with strings, what's a good way to handle this as my TypeScript definitions are Date
s. Should I rewrite my types to take Date | string
or should I make some type of parsing function?
I feel like if I make it a Date | string
, it'll be a bit ambiguous. I have multiple functions in the frontend that handle the createdAt
as a Date
, no parsing method needed. But when I get the createdAt from the backend, I'll need to know it's from the backend and parse it as a date in the frontend. Does that make sense? I'm trying to word it but I guess what I'm trying to get at is it might not be 'standardized' when working with it in the frontend. Typing that out, I realize what I could potentially do is rework my frontend methods that use createdAt to get the data from the backend, now that I actually have it setup, that way it'll be in a standardized format53 replies
KPCKevin Powell - Community
•Created by vince on 2/10/2025 in #os-and-tools
Testing iOS simulation in React Native?
I read about iOS simulation for building apps in React Native and it seems impossible to simulate iOS apps without macOS? Surely can't be the case right? Does anyone know of some workarounds so I can develop and test on Windows?
69 replies
KPCKevin Powell - Community
•Created by vince on 2/1/2025 in #front-end
TypeScript type error
Hi guys! I have a type error where I'm at a loss on how to proceed.
I'm writing a discord bot that fetches messages in a channel, filters them, and then transforms the data for my backend models.
Please see an example of the filter function:
I'm filtering for 3 things:
1) if the message is a text message,
2) if the message is written by a user,
3) if the message contains a specific reaction
Here is the
getMessageReaction()
method:
As you can see, I'm checking to see if the message contains a specific reaction via filter
and returning null if not.
The issue is when I go to mutate my data.12 replies
DIAdiscord.js - Imagine an app
•Created by vince on 1/29/2025 in #djs-questions
Fetch all messages in a text channel
Hey there! I'm trying to fetch all messages in a channel for my
/initialize
command. I'm looking at the faq example:
I think I need to modify the while conditional. The amount of messages in the channel is dynamic, so I can't base it off that. I don't want to manually copy the id of the oldest message either. I was thinking about approaching it by timestamp or by checking if there's a previous message before running it again. Are there any examples of this / suggestions? Thanks!25 replies
KPCKevin Powell - Community
•Created by vince on 11/1/2024 in #front-end
Sass Mixin vs Extends
I had a quick question I wanted to ask regarding this.
I have some files in a shared directory that I want to namespace.
I want
_forms.scss
to have reusable styling that I can use in other classes around the codebase. I don't need any argument features that mixin supports - I really just need it to work like extends. The problem is, I can't namespace extends. So if I try to do:
This doesn't work. I can however do this with mixins:
The problem is, this is leading to single line mixins:
My question is, is this a totally valid use case, or am I in the complete wrong direction and I should quit as a webdev? 😂110 replies
KPCKevin Powell - Community
•Created by vince on 10/31/2024 in #os-and-tools
How to use Webpack as a way to compile Sass -> Css?
This is probably a stupid question, but I have been trying this for the past 2 hours and can't figure it out. I just need a way to compile my regular .scss files (in every directory) into 1 .css file. I'm aware I can just use
sass --watch
, but I'd like to have some other features webpack leverages (like minifying, and again I know sass ootb can do this).
We use Laravel Mix, which is just a library on top of Webpack that can do this using mix.sass('entry.scss', 'output.scss')
, but I can't get it to work on default Webpack. The reason why I want to go from Mix -> Webpack is because I need to watch all files in my project and output it as 1 css file and Mix can't do this16 replies
KPCKevin Powell - Community
•Created by vince on 10/30/2024 in #front-end
Variable font-weight shenanigans

2 replies
KPCKevin Powell - Community
•Created by vince on 10/29/2024 in #os-and-tools
How do I install npm & composer on cPanel?
Having trouble finding a clear tutorial on how to do this, and whether this should be installed globally as the root or per cPanel user. Running Linux and I have access to the Yum package manager, so should I just install per-user using yum?
50 replies
DIAdiscord.js - Imagine an app
•Created by vince on 10/26/2024 in #djs-questions
Quick question on managers
I just wanted to ask a quick question on managers (specifically a
GuildMessageManager
): how do I use this? Is it a class I need to instantiate or what?7 replies
KPCKevin Powell - Community
•Created by vince on 10/24/2024 in #front-end
Should I future-proof this component or leave as designer intended?

8 replies
KPCKevin Powell - Community
•Created by vince on 10/21/2024 in #back-end
How to build this db model
Working on a NoSQL implementation of this discord bot me and my friend are setting up. What it'll do is iterate through all messages and get the amount of emojis each user has across all their messages.
I was wondering what a good model for this would be? Should we build a model for each User, and then iterate through all their emojis? I have this so far:
This way, we can just do something like:
17 replies
KPCKevin Powell - Community
•Created by vince on 10/9/2024 in #front-end
Does it make sense to use the title attribute for this?

10 replies
KPCKevin Powell - Community
•Created by vince on 10/7/2024 in #back-end
[Twig] Is there a way to clean up this dynamic string?
I'm trying to build a dynamic class string:
This works, but it's kind of messy. I'd also like to eventually be able to have 'alignment' be something like
alignment-<alignment>
rather than the value. So for example, if alignment = left
, right now it just adds left
to the class list because it's easiest. But I'd like it to add alignment-left
to the class list instead.
I know how I can do this but not without making it messy. And even this current iteration, it's not perfect because if alignment
is null, then it'll add 2 spaces instead of just one.15 replies
KPCKevin Powell - Community
•Created by vince on 10/3/2024 in #front-end
Does `aria-labelledby` work if the id is on a parent element?

5 replies
KPCKevin Powell - Community
•Created by vince on 9/25/2024 in #front-end
`@font-face` variable font issue
Quick question, my font-face declaration with a variable font file isn't changing the font weight when I change it via css:
When I go in dev tools and change the font-weight, it doesn't actually change it. It's not a styling conflict. This is a variable font downloaded from Google Fonts
53 replies
KPCKevin Powell - Community
•Created by vince on 9/11/2024 in #back-end
Is there a quick way in vanilla PHP to log things?
I have only the basic PHP extensions available in the default PHP installation. Just wondering if there was a quick and easy way to log data in the backend? I'm using
error_log
but that's stopping the application it seems when I use it so need something that won't stop the app and log the data to a file72 replies
KPCKevin Powell - Community
•Created by vince on 7/17/2024 in #os-and-tools
ELI5 Gradle and Docker
Hey guys, I think I just have a fundamental misunderstanding of gradle and docker.
I have this codebase at work that builds with gradle and sets up a docker container locally.
I was having trouble with the gradle build and it was failing the build. I reached out to another developer and they mentioned that I need to build the project with Java 11 (I had Java 22). I was able to build successfully then by doing
./gradlew -D org.gradle.java.home='<path-to-jdk-11>'
I'm confused though because shouldn't docker be handling the dependencies (separate from a package manager, I know) and help build the project regardless of what version certain dependencies like Java are on my system? I tried explaining my question to them and they basically said that gradle is separate from docker which I kind of understand but it just doesn't make sense to me why I have to have specific depencency versions on my machine when it builds a docker container?
Hopefully that makes sense18 replies
KPCKevin Powell - Community
•Created by vince on 6/25/2024 in #back-end
Does this make sense to be a subclass?
I'm trying to create a subclass to implement some custom functionality to a parent class. I'm making a discord bot that has a class
Discord
. This Discord
class has a constructor that takes a token.
I've created a subclass Bot
that has a constructor that calls the parent function. I've done this so I can implement environment variables.
Everything runs fine but for some reason, this just looks really off to me. I'm not sure if I'm overcomplicating it or creating an antipattern.65 replies
KPCKevin Powell - Community
•Created by vince on 6/24/2024 in #back-end
How should I architecture an api?
Hey guys, bit of an abstract question. I'm writing a discord bot in php so I can better understand php. This will be a terminal application. I'll also have a portion of the app in python to do sentiment analysis.
I was wondering what the heck are the logistics behind writing a way to communicate between the php (bot) portion of the app and the python (sentiment analysis) portion of the app? I'm assuming I can write an api between the 2, but then my question is how do I even host that? I know how apis work but I've never actually set one up myself. I'd be using a digital ocean droplet with cpanel installed, and cpanel comes with apache ootb so I'm assuming i'd need to configure it in apache
30 replies