#development
1 messages · Page 265 of 1
It wasnt too hard to setup imo, but I am also a more "self-hosted" type of person then anything, if I need it, and there are means to host it I try to do so
tim doing development therapy
yes please, my mental health is in a horrible place rn
honestly i just used cloudflare bc this VPS Just runs stuff for my business that's it
Ive luckily never had certbot issues, theyve always given me 0 issues unless I was a cert for my ip address, but I have the ability to apply subdomains
True, I rent my vps, and then me and my brother have a 2nd one for our one main shared project. I mainly do tinkering and self hosting on my personal one, and use that knowledge for the production one
😦 I'm sorry man
I want to turn my 2nd pc into a homeserver eventually, I think it could be cool, and if my wifi ever goes down it can be a home media lab too
ah i just pay like $5 USD monthly for mine in reality all we use it for is our website i might get another VPS later on bc we need to get our own CDN to be able to hold all of our videos
used mongodb and Cloudinary to make my own kinda CDN but it was buggy
Tbh Ive never gotten what a cdn is, is it just to serve media?
It spreads content globally for you.
basically yes
So, your server could be in centeral US and someone in germany would get it faster than reaching your actual server.
i gotta use a CDN bc i have to be able to access everything on the server from my car so i can upload videos from on scene
Really important for websites, will help you show up on google with a higher ranking.
Hmmm, Ill need to look into it fr, does it require multiple servers or just a certain setup of tools?
If you use a company they do it for you.
Much much cheaper that way 😄
But you can for sure use multiple distinct server.
in reality my CDN will only be accessed by a server in my car and the website
You dont really need a cdn then, you can build a site that takes those files and uploads them to local storage and serves them from another endpoint
I use a bot to upload my images to my site which is built and served in node
👀 like a discord bot?
(reason i say On scene is bc im a Emergency Services and Incident Photographer + Videographer)
Nah, we use links to download from the direct link, but the concept is all the same. They can upload the video to say discord, and use discord cdn to download the video
yk whats gonna be hell setting up wifi in my car
Your alternator will hate you for it 😄
dw it will hate me
i gotta install Emergency Lighting in it
so flashing lights
im gonna get an Aux battery and 2nd alternator
Could you technically just use a portable hotspot from a cell provider?
Probably less work/hassle in the end
Only thing you would need to keep in the car is the charger, and then at that point you can take that wifi anywhere
I just use their css utility classes if thats what youre asking
Bridge a raspberry pi to it to ssh tunnel and bam, private site access
im basically making a police car its a 2020 Ford Explorer Ford Police Interceptor Utility but replaced with Amber and White lighting
-# Lighting costs $9,000 - $10,000 💀
Expensive for me, Im 23 w/o my license
im 16 💀
But once my next bot project (currently working on, in alpha) takes off I plan to get it done. I used to live in a state without mandatory classes bc you did them in HighSchool, but now where I live it costs extra just to take classes
👀 does that not violate your local laws?
what
My state they would get so pissed if you had red/blue lights. Impersonation laws 
As long as its distinguishable enough from an emergency vehicle should be fine
im not getting Red and blue im using Amber and White
They said white/amber
ah, probably okay.
i only need it bc i need to be seen by traffic
Work truck?
confirmed it with the chief of police
personal + work
Emergency Services Photographer and Incident Photographer + Videographer
aka News Company
yeah no this is just illegal lmao
its actually not ive cleared it
unless it's like work truck-looking
but afaik even attempting to look like a police car is a crime
you can buy retired FPIUs and do whatever u want with them
like, with lighting
Raspberry pi setup can still be a killer idea fr
Use a touch screen display for it to go with the pi, bind ssh tunnel to start, and connect to the hotspot, and then you can use electron to make a dedicated site gui for the pi,
Kinda a cool circle of items
like ive said 2 times now its not Red and blue lighting
its Amber and White
the car will be incapable of red and blue
that doesn't necessarily make it legal
different color lights != not a traffic hazard
like ive said again ive cleared it with the Ministry of Transportation and as well as my local PD
you can have Amber and White lights here but not on while your vehicle is moving
at what age are you legally allowed to drive there?
special treatment moment
16
def not legal but w/e
damn
emergency-looking lights is definitely illegal. If they are just static LEDs that do not flash or change color, then I could see the argument fo rit not being illegal
16 you need to drive with something with a Full G class License and 4 Years of Driving History and you cannot drive between 12 AM - 5 AM and a 0.00 BAC
but imo this point is fair tho (replying to waffle)
-# not the only person to have these in my region :}
also do remember im canadian
Work trucks can have lights. Theres likely guidelines per state.
oooooo
I believe work trucks need a special tag/permit for that
nope
Lights are prohibited or restricted based on their combination and/or the direction they are visible from. Flashing red lights, visible from any direction on a vehicle, are restricted to law enforcement vehicles only. This restriction does not include four way flashers or tapping the brake pedal to produce an on and off effect with the brake lights. In addition to this, red lights and red and blue combinations of lights to the front are also restricted to law enforcement vehicles. Flashing blue lights are restricted to police vehicles and snow removal vehicles, but only while they are actually engaged in the removal of snow (or de-icing, etc.). Flashing green lights are restricted to volunteer firefighters.
I know in my area tow trucks can have sirens even. But that does require a permit and you must be given permission on each use.
Used during critical crashes, such as a major highway being completely blocked.
Ontario's HTA (Highway Traffic Act) does not prohibit white and amber lights :}
soooo
HTA Applies to all roads not just Highways
what do you mean (2 days late)
is removing your avatar supposed to be a silent cry for help now
i was getting bored of the old one so i was looking through my download folder but couldn't find anything suitable 😦
Pain
i welcome suggestions as always
cats
Anyone know why my port forwarding for port 51820 wouldn't be working? I don't think it's my router, bc I forwarded on port 22 for SSH and it worked just fine. I am trying to set up Wireguard on my rpi, and for some reason it's not going through. Here's what my ufw status looks like:
To Action From
-- ------ ----
51820/udp ALLOW Anywhere
22 ALLOW 10.0.0.0/24
22/tcp ALLOW Anywhere
51820/udp (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
``` and here is my wireguard setup
Server: ```
[Interface]
Address = 10.0.0.1/24
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE
ListenPort = 51820
PrivateKey = <Server PrivKey>
[Peer]
PublicKey = <Client Pubkey>
AllowedIPs = 10.0.0.2/24
``` Client: ```
[Interface]
Address = 10.0.0.2/24
PrivateKey = <Client PrivKey>
DNS = 1.1.1.1
[Peer]
PublicKey = <Server PubKey>
Endpoint = <My Public IP>:51820
AllowedIPs = 10.0.0.0/24, 0.0.0.0/0
PersistentKeepalive = 25
@wheat mesa you only whitelisted the udp protocol whatever you're doing might be using tcp or a different one
wireguard only needs UDP
You could also check the firewall log
What's the command for that
It's a file somewhere in /var google it i guess
I also tried looking at the TCP packet dump and there was nothing, but I'm assuming nothing would come through if the firewall blocks it
got it working. my stupid router doesn't support NAT loopback so it was trying to connect through my public IP instead of my local since I was on the same network
Lol
For internal stuff anyway like db access you can use an ssh tunnel to proxy pc localhost <-> vps localhost by port
need some opnions rq do i make the boxes above the members transparent or no?
Looks pretty good although the card titles could be a little smaller compared to main title
How much smaller would you say?
The avatar images seem a bit too big
Ah ok
do you have a max width for your content
i'd say it's generally a good idea to have a max width of around ~1400px so it looks good on ultrawide screens as well
has anyone worked with payment integrations like paypal?
I wanted to know how i can send customers receipts and like a bill after completing the payment? like as proof. so people dont go to paypal and back charge after purchasing the item
there's an endpoint for receipt i believe
Weeeeeee
Well thats silly
@bitter granite hy, dont mean to ping, and not here to bug u, but ty.
You may have accidentally deleted all my already created cards data, but you helped me identify a single capitlilzation error in my startup flow 
Wdm?
Well, I created a custom loop to make my bot leabe servers I dont want it in. And somehow during that process, it managed to delete and crash my users card json, which is a really massive bug that I need to fix, so ty for finding it!
i have no clue but no problem ig

Anyone here use Amazon SES?
I am looking at it and it seems to just use already existing emails, and if thats the case why not just use office 365 smtp instead of aws ses. I dont really actually see how you can send 250,000 emails potentially through SES if you will end up hitting limits from the email provider.
am I tripping
ye I am, the second arg that map provides is index which provides a radix to parseInt
get trolled
office 365 is not designed for marketing or transactional emails
SES is
theres loads of providers that are just repackaged SES
I use https://useplunk.com personally, its amazing
i wish all marketing and newsletter email providers just go bankrupt or something
i cant remember a time where i have actually enjoyed receiving a marketing or newsletter email that i havent explicitly agreed to
Only done payment integrations with stripe
That wasnt my question. Im wondering how SES works if it requires already existing emails to function
wdym existing emails
Well it had me create an identity to send emails through and that identity is an already existing email provided by protonmail
Unless i can send emails through the domain identity it had me create

whoa i just realized this is a thing
yeah, rust also has that and it's really nice and helpful
Tuples
yeah it is, now i don't need to create classes for every multiple values i return
lots of languages have that lmao
alongside almost every language having some kind of variation of it
javascript even sort of
hii!
arrays can act like tuples
but imagine the disgusting overhead of constructing a new array on the heap every single time you want to make a tuple @quartz kindle
horrible
a dynamically sized array*
ok so uh i got a question, why does this status == "enabled" goes into my int typed parameter function? the console returns True, and i have "3 functions"
public async Task SetEffectSet(string effectName, string level) {}
public async Task SetEffectSet(string effectName, bool enabled) {}
public async Task SetEffectSet(string effectName, int value) {}
ok now i use this (...., enabled: result), thx
wth it's still not working found the issue
Array(n) is faster than [] btw
if you know the final size of the array behorehand
:^)
what was it?
you can also do tuples with named fields in C#
(int x, int y) ToTuple(int x, int y) => (x, y);
var coords = ToTuple(2, 3);
Console.WriteLine($"{coords.x}, {coords.y}");
the initialization or all accesses afterwards?
all accesses within that size
there is a small cost every time an array's size has to be increased
when you push to it, or add stuff to its indexes
but if you initialize an array using Array(n), all accesses inside that n will not have the cost of having to expand the array on the first access
makes sense, about how a vector works
are arrays in js an actual contiguous block of memory holding references to objects or does it do anything special such as becoming a partial linked list
but then index access would be very slow if it involved linked lists in any way
there are 6 types of arrays afaik, depending on the items being held
i believe when an array is declared either with Array(n) or with [a,b,c,d], it should be a contigious block
then if an item is pushed, the array is transformed into something else
i dont know the exact details but i imagine it can be several memory blocks linked like a linked list
yeah thats what i was thinking might be a possibility
if you make it a linked list of chunks of smaller contiguous arrays you can sort of get a balance between benefits of a linked list and benefits of a regular array
ye
chunk size would be very annoying to figure out though, it would totally depend on the number of elements
Passport issue:
Error: Failed to serialize user into session
at pass (/root/emgkwc-website/node_modules/passport/lib/authenticator.js:296:19)
at serialized (/root/emgkwc-website/node_modules/passport/lib/authenticator.js:301:7)
at /root/emgkwc-website/src/server.js:70:5
at pass (/root/emgkwc-website/node_modules/passport/lib/authenticator.js:309:9)
at Authenticator.serializeUser (/root/emgkwc-website/node_modules/passport/lib/authenticator.js:314:5)
at /root/emgkwc-website/node_modules/passport/lib/sessionmanager.js:33:10
at Immediate._onImmediate (/root/emgkwc-website/node_modules/express-session/session/store.js:54:5)
at process.processImmediate (node:internal/timers:476:21)
my code:
passport.serializeUser((user, done) => {
console.log('User in serializeUser:', user);
done(null, user._id);
});
passport.deserializeUser(async (id, done) => {
try {
const user = await userModel.findById(id);
done(null, user);
} catch (err) {
done(err);
}
});
DB Structure:
_id
Username
Password
__v
Fixed the issue.
I hope this hashes your passwords
it does everything goes through bcrypt
i salt and hash it
I'm building a "clan" system in my discord bot. The trouble I'm having is that discord username's change. If I'm persisting their name, how would I update it upon a name change? One option is to change it the next time the game is used by them?
why not use user id and fetch name from cache after
this
there's actually no issue with it. basically on each SetEffectSet, i execute another 3 SetEffectSet to disable other effects inside try catch like this (the function actually supposed to throw error in this function thus i catch it with try catch)
private void _resetEffect(string effectName)
{
try
{
SetEffectSetInt(effectName, 0);
}
catch
{
try
{
SetEffectSetBool(effectName, false);
}
catch
{
try
{
SetEffectSetStr(effectName, "off");
}
catch {}
}
}
}
i just forgot that rider still suspends the program when there's exception even if it's catched well
sorry for the confusion
whoa that's new to me too,, thanks!!!
this is the kind of code id expect to see written in c#

this is the stupidest twitter take ive seen
If I want to be a dentist, do I also have to know the entire human anatomy?
i want to see him design a cpu from scratch and if he cant do that, i guess he's not a real programmer 😕
everyone knows to be a real programmer you need the programmer socks
bruh, is there any problem with my .Count code??? im frustrated with this debugging mode 😭
i hate every i test the command, i need to manually resume the program
oke idk restarting the program works, but that's still weird
what in the ...
If a clan has 15 people in it, are you suggesting that I store the names of all 15 people in perpetuity? Then whenever I go to "list" all members in the clan, grab them all from cache?
no fetch the names from discord depending on what package you use some offer cache
what language is it?
Doesn't that API have rate limits?
i never hit the rate limit
How often do you hit it and at what scale?
my bot is in 662 servers as of now
Probably because of cache
probably
@long marsh what language and what package do you use
I'm coming at this from nearly a pure serverless environment where I don't store any cache except for player data. My application is write-heavy.
Here's my thinking:
- User initiates command to do main game action
- If the username is different than what is stored at the database level, update it
- If the user is in a clan, redundantly store their name there as well
So that whenever a clan is fetched, it has all the member's and their rankings available.
Not too hard, if you're going for 1955 technology.
Very very basic cpu design should be taught imo.
I only use types from discord-api-types since I'm HTTP interaction only. I also don't call back into discord ever either ... I respond within the 3 second threshold.
I'd have to hand-roll any caching mechanisms is what I'm saying.
what you can do then store user id and name that way just update it needs to and have your own cache
it's not more work than just keeping username
and add a queue system if you're so scared of ratelimit
If a player load's a clan and their members, I would prefer not to hit cache 15 times for all 15 players. Rather, I can store their names and ids redundantly on the clan record.
The downside is that I must keep the two spots of data synced. Fortunately, this isn't too bad since I can check to see if their user name in the database matches their current. If so, don't do anything. If not, update the data in two separate places and clear their cache record.
I also only store cached data for up to 5 minutes after update. So if a player continues playing, their 5 min TTL will keep increasing.
doing interactive games without memory persistence is very complicated
simply because you cant hold context for long
using the database to retrieve context is a way, but it'll be N queries every time you need to restore context
It’ll be two in my case, but yes I agree.
using the master class method which lets you retrieve the context using a function and it automatically caches and retrieves from db as needed as well as clearing out old contexts 😋
only bad part about it is you need to be careful not to have multiple cached contexts of the same thing floating around
So I'm having an issue which was my fault i forgot to apply for intents, i cant use my commands, discord wont verify my intents, i would update it but i cant, because my commands dont work. any help with this?
if you cant get the intents then discord doesn't deem them necessary for ur case
what intent are u trying to get? message?
nvm its fixed but the issue was there was an glitch when i turned one off it turned them all off and since it was already at 100 servers it wouldnt allow me to enable them
you can use commands with slash commands just fine without intents 
How do I add a hexadecimal color background to the bot's long description?
yes
Nekotina even has their website in the long description, I would like to know how they do that too
You can use html tags + css
Could you give me an example? I tried to do it but it didn't work
<style>
body {
background: #ff0000
}
</style>
I did it like this and it didn't work
nosql databases make me want to cry
Also is this audit logging but with a single object..? Sounds scary
All fun and games until you have to fetch a resource that gets updated a ton, then finding out you have to pull 5mb of data for one object
While postgres / traditional SQL databases are perfectly acceptable, I don't mind the challenge of a NoSQL database. I try to use DynamoDB in most of my use-cases. Which is even harsher than stuff like MongoDB
Most of the time, I find myself trusting the application logic > the database. Meaning, I'll do all the validation upfront / merging of data within my application. Database access is typically super dumb. 1-1 for typical CRUD actions.
I still really dislike it. It’s open to too much interpretation on what data is stored where. No rules leads to more bad practices (unintentionally)
ive been using it for years and never had any issues
DynamoDB is great. so much cheaper than anything else
If you understand single table design and know your access patterns ahead of time, then yeah – it's amazing.
I suspect I won't pay a dime until I'm hitting hundreds of active users every hour. Which, with my current scale / rollout, won't be for at least another year or two.
look how much they give for the free tier
Correct – that's the tradeoff. I'm okay taking putting the validation layer on the application to determine what the "use" of the data is.
Haha I'm very aware. It's awesome at scale.
I also use it professionally at my company ... and it currently serves thousands of requests per minute without any hiccup. Postgres could do that too, but at a burden of paying higher monthly costs / maintaining it.
same with lambda
Yep, we're purely serverless. AWS CDK + Lambda + DynamoDB. We do have some queuing for rate limit stuff, but other than it's that simple. The application has made my company $3 million so far ... with initial costs (dev work / sales / etc.) being below $250k in less than a year.
Ofc people costs were the highest portion of that. Actual infra maintenance ... legit tens of dollars per month.
why did you choose AWS CDK over AWS SAM?
I could ask you the same haha, but in reverse.
Last I used SAM, it had a ton of abstraction / opinionated flows for certain things. AWS CDK can be as low-level to CloudFormation as you want. To give you a clearer answer though, our organization has built L3 constructs with business-level opinions in them that all departmental teams consume.
So, the business forces our hand with AWS CDK. It's a delight over terraform though (if you're strictly AWS)
For example, when we spin up an API Gateway, it's automatically deployed with a lambda authorizer that hooks into our organization's authentication / authorization application. Or when an S3 bucket is deployed, it has restrictions imposed at the resource policy level that our org mandates.
that makes sense. using a programming language to create the resources instead of configs probably lets you do a lot more custom stuff
For sure does – just must more power and flexibility.
Is there really no way to get input through both text input or reaction/emoji input from the user? Cause I am thinking about it and they both require a separate def check thing and the one missing an input will get stuck at the other. I swear python is unnecessarily annoying.
You can not even use if/else statement because apparently try/except need to immediatelly follow a def function.
Does the discord username stay the same? Or can nitro folks change it?
For example, my username is thomas.gt.
everyone can change username
the user id tho never changes
saving stuff under username would be really unsecure
Why would it be "unsecure"?
Is it to prevent people from getting rogue friend requests and stuff?
this
Yeah I store everything via the discord id, but need to showcase a "name" for users in clans. I don't want to have to fetch up to 10+ users each time a clan page is loaded, so I'm redundantly storing the usernames; however, I then need to keep it up-to-date after the fact.
even if your app doesn't save sensitive info using username to save stuff under is always bad
just save name as well in same DB row
That's what I was going to do, but they can change after the fact.
just have it check from time to time
that’s fine, maybe like put expiry
this
like have an expiry of like 2 days or idk or when the user runs a command you can check at the same time
Hmm... maybe. Put like a "expiresAt" time for some distant future such as 2 days?
Or, I can additionally do some extra work to "queue up" name changes. Ie. every time a user clicks a command, queue up a name change if it's not the same one kinda thing
Yeah. Store the username on the player record, then just check each time if the name is changed. Update the name.
Then, at the caching layer, if it detects that I'm changing the name "queue" up a TTL that one of my workers will scan after the fact.
Side note: would it be better to use the discord username or global_name?
imo, global name, because what people see is the global name, not username. also lets take me as example, takiyo is already taken, so i put dot in front of it .takiyo . thats my opinion
store username, global_name and nick. then show nick first, global_name second
also make sure to save the user/member data that is resolved in slash commands
might save some api calls
Yeah, this is what I'm using. I'll likely only store the global_name
How do I add a website to the bot's long description on Topgg?
and how do I change the background too?
aws word vomit detected
why would discord limit polls to two weeks 🤨 i cant think of a technical limitation
that's not that bad, like why would you want polls' duration longer? i even forgot polls i participate a week ago if its not because discord notification sent me the result
i was thinking of like permanent demographics poll in a locked channel, so anyone who joins later while the server exists can respond to it without a new poll created
embed+reactions w/ a bot works for doing something like that, but thats where i was thinking like. why 2 weeks?
Haha are you not a fan?
Timeouts actually go to like 29/30 days if you create it through the api
it's really weird that the UI doesn't support it though
its 28d max
bizarre isnt it
average discord moment
I'm just waiting for the server level to have an impact on things like the length of timeouts
How easy is it to migrate to discord.js 14?
To change the background, do I have to inspect and see what the name of the class where the long description is located is?
How we get bot developer
You mean Bot Developer role?
Ok
const { SlashCommandBuilder } = require('@discordjs/builders');
const embed = {
color: 0x0099ff,
title: 'Lock Decline Reason',
author: {
name: 'Welper',
icon_url: 'linkholder',
url: 'https://top.gg/user/277771625074991104',
},
fields: [
{
name: '',
value: 'text',
},
{
name: '',
value: 'text',
inline: true,
},
],
image: {
url: 'https://bit.ly/lockcmd',
},
timestamp: new Date().toISOString(),
footer: {
text: 'Top.gg Bot Reviewer',
icon_url: 'kink',
}
};
const embed2 = {
color: 0x0099ff,
author: {
name: 'Welper',
icon_url: 'link',
url: 'link',
},
fields: [
{
name: 'text',
value: 'limk',
}
],
timestamp: new Date().toISOString(),
footer: {
text: 'Top.gg Bot Reviewer',
icon_url: 'link',
}
};
const embed3 = (command) => ({
color: 0x0099ff,
title: 'Lock Decline Reason',
author: {
name: 'Welper',
icon_url: 'link',
url: 'https://top.gg/user/277771625074991104',
},
fields: [
{
name: '',
value: `text ${command} text`,
},
{
name: '',
value: 'text',
inline: true,
},
],
image: {
url: 'https://bit.ly/lockcmd',
},
timestamp: new Date().toISOString(),
footer: {
text: 'Top.gg Bot Reviewer',
icon_url: 'link',
}
});
module.exports = {
data: new SlashCommandBuilder()
.setName('lock')
.setDescription('text')
.addStringOption(option =>
option.setName('commands')
.setDescription('text')
.setRequired(false)
),
async execute(interaction) {
const command = interaction.options.getString('commands');
if (command) {
await interaction.reply({ embeds: [embed3(command), embed] });
} else {
await interaction.reply({ embeds: [embed, embed2] });
}
}
};
here is the code that i broke @radiant kraken
wait i think i might know what to fix, brb
i haven't touched discord.js in like 5 years
goud the issue.....
found*
i am so dumb
quick question, can you put buttons and interact with it in ephemeral?
jap
yes
i prettysure yes
oke thanks
I am not even working on buttons today and they are still terrorizing me. They have messed up my visual studio code with yellow lines under most of the imports.
import discord <-
import aiohttp <-
from discord.ui <- import Button, View
from discord.ext <- import commands
from discord <- import app_commands
👀 what does it say when you hover over the yellow lines? couldnt import?
what the hell is that syntax?
I added arrows to show the problem, but used picture instead.
ah
god i hate pylance
I hate buttons. They are the reason why those yellow lines came up.
pip install discord
pip install aiohttp
else
pip show discord
and same w aiohttp
It mysteriously fixed itself!
That is what I did way earlier and now it mysteriously all work, but I did have to install akinator again to make it fully work again.
weird haha
also have that sometimes
for some odd reason my giveaways wont end 😂
atleast it works lol
I closed out the vscode and reopened it and they were still there. But I am glad it all working again.
yess nice
Now I can finally add anti cheat thing to one of the games I have since I don't want people cheating.
W
i forgot to add a simple thing so people could do /slots -1B and itll guve them 5b😂😂
sadly not😂
:/
do you think a crypto system would be cool?
I don’t know
please no more crypto
LOL
i respect the honesty
really niche thing but has anyone here ever written a terminal emulator?
i'm writing a crappy terminal emulator thing in typescript and svelte and i'm wondering how soft-wrapping works with ansi cursor manipulation commands
and yes i could write a program to test it myself but that's too simple
like as a web ui?
in general
the behaviour should be pretty much identical cause most terminal emulators emulate the VT100
Are you doing it for learning purposes?
pretty much
Anybody know how to add a timeout type thing to buttons so that once certain time say 20 seconds goes by, the buttons can be removed? And without using anything related to class.
i found a quest. so are these only for video games? not for bots?
If you have the budget, its possible
Why the limit on classes? The library you use is likely entirely classes.
It is way too advanced for me and I am certain nobody can explain it in simple basic English to me. This was the example code that helped me to finally make working buttons for my weather bot. If that can be translated into class, then I can probably figure it out.
@client.command()
async def hello(ctx):
button1 = Button(label="Click me!", style=discord.ButtonStyle.green)
#button2 = Button(label="Click me2!", style=discord.ButtonStyle.danger)
#button3 = Button(label="Click me3!", style=discord.ButtonStyle.blurple)
view = View()
view.add_item(button1)
#view.add_item(button2)
#view.add_item(button3)
await ctx.send("Hi!", view=view)
async def button1_callback(interaction):
await interaction.response.send_message("Hi!")
button1.callback = button1_callback
I am still in shock that the buttons worked after 2 or 3 years of attempts and it feels crazy.
Classes are no more complex or confusing than lists and dicts.
An afternoon to understand them at most.
It is only too advanced for you now just spend some time to improve your knowledge and skills
Frankly, youll not improve your language skills otherwise
But list and dict are super easy to figure out. I will say dict is the more complex one but even that is still easy. But class is very complex. Anything that explains what they mean always use very complicated vocabulary. Then again, so does all of coding from what I can tell.
I am done with all that stuff tonight.
I got the buttons to disappear after timeout.
@pearl trail is this too hacky
i'm thinking of making form on top of #inverse
but z-index isn't working
😭
fyi ```css
nav #search form {
z-index: 2;
}
nav #search #inverse {
position: absolute;
top: 0;
z-index: 1;
}
nav #search #inverse * {
pointer-events: none;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
}
i can't select nav #search form #box
cc @civic scroll too
wait nevermind solved it by making nav #search #inverse pointer-events: none; 😭
i'm so stupid
what are you trying to achieve? 
search box that goes from this to this on focus
as it focuses it should have an animation that goes from the state above to below like this
idk the idea just popped up in my head
maybe using two elements and two clip-paths is too hacky though

need to know sayuri's thoughts on this
what do you think?
smth like this?
also, use position relative
Got all of my account, profile and team stuff done just need to work on fancy server features now
YES 😭
how did u do that
i want that
oh my god i suck at css so much 
It's just a css animation for the input background when you hover or focus it 
it's not that simple builderb
It is 
Same thing hover/focus change text/icon color
It's basically like when you hover over a button and it changes the design

In cats case though it has an animation delay before it changes color so it dosen't look like it instantly changes and syncs with the background animation
nah it seems that it's all just mix-blend-mode
@pearl trail i got it working without the cyan!!!
trying to find a way for the other way around tho
congrats 🎉
you also don't need the background-clip btw
🇮🇩 🇮🇩 🇮🇩 🇮🇩 mentioned
i literally scoured around the internet for hours until i realized all i needed to do was filter: invert(1);

I am dealing with css combined with searching for DOM elements with jquery
and our html structure is so inconsistent
What is it?
L AD
If you think of a class as just a dict with functions inside they're really simple. You're combining dicts and functions.
A lot of online teachers make this a day 3-5 subject. I promise you they're not as complex as you think.
it's something like copilot, but from jetbrains. they got local AI completion that runs on your device (it's free) and that AI Cloud, which is just like copilot with few more features (paid, 7 days free trial)
it randomly appeared when i'm opening my ide lmao, even tho i already used it
i thought it's now free since there's no "Paid" in that window 
I still like using AI for some really basic stuff, bouncing ideas off it to find a better solution to a problem.
Or fixing type errors that I'm too lazy to think through.
Autocomplete is stinky though, and just using the code it outputs. yikes.
I'm still paying for github copilot 👀
I'm fine with using AI as long as I understand what it's generating
It's not amazing, but it def helps me out with frontend stuff since I'm not super well versed in standard practices for that
I usually use it to bounce ideas off of it as well
I think my big issue with AI is just newer developers using it.
It's like a more advanced rubber duck
Yeah
I'm still pretty new since I'm an intern, but damn some of my classmates cannot do ANYTHING without it
Also note to self: do not write your own keyboard navigation system for a jquery app
I thought it was gonna be a little 15-20h adventure and I wouldn't have to touch it again
Probably like 50-60h in on updating it to handle more and more things 😭
not in jquery, but I didnt like handling in site autocomplete. Not fun
The code I originally wrote for this system was actually pretty clean
Now it's just urban sprawl
I'm glad someone else wrote that part of this project
Its satisfying when it finally works, other than that no thanks not again.
Its not even compatible with screen readers, which makes it worse. I'll work on that eventually.
I added all the keyboard inputs just to help screenreaders too 👀 but never took the time to properly get a screenreader to work properly.
interesting
i've still never touched ai 
i always resort to classic googling
google is god
i did some testing and the behaviour was actually a lot simpler than I expected
basically soft wrapping just moves the cursor, period. there's no additional visual buffer required like i thought there'd be
control characters are also simple to implement that way
that reminds me of minecraft
first discord bot completed! ahhhhhhh
I look into it. I got school book for python. It's an ebook, so it takes longer to load.
Congrats!
thanks
How good do bots havr to be to be tested
Is 25 unique commands and fetures enough for first attempt
If majority wofk
Work
Or is 100% operational preffered
I have a multi functional game bot
we don't mind the number of commands at all. A bot can have 1 command and still be accepted
Wow ok
as long as you follow our bot guidelines you'll be fine
Thanks plety
i think im going to wait till its done tho
im too embarassed
i diddnt even really code it
chatgpt did
im just the ideasman
its like 20k lines of code now tho
my brain has broken learning this much
sneak peek
one of the cards it makes
looks good! :D
ty ❤️
its so hard
ive never coded before
its taken weeks of hourless sleep
ontop of work
yeah it's quite a journey to learn lol but it's fun!
insanely useful
nice!
ive literally done A-Z
cant wait to finish
im surprised it doesnt have to be complete to be trialed here
ill make it way less buggy tho
coz im sure complete products are always preffered :3
well it's hard to say a bot is ever completed
You can always expand your bot with more commands and such. All that is important is that it follows our guidelines
a good rule of thumb is quality over quantity tho. A bot with 5 really well made commands might do better than a bot with a lot of just decent commands
yeah
im going to convert this bot when im done
to a playstation bot
that accepts gpt created game files
and provides instructions on how to create them
then reads and generates games
will be my next project
just gotta get this bot reading this game properly haha
I thought this was a outline, but when I set it to none it still appears
border?
Why does it look like browser highlighting to me
Ive disabled just about everything i can think of
And no dice
I think it might be browser related
could be autocomplete highlight or a focus
This screams of some obscure -moz css rule
I wish there was some way to indicate that you want to disable default css for elements
omg i reset my database on my bot today
and just did a flawless pipeline test
i wanna squeal
so dope man
gpt is sick
im such a noob at coding
2 months for this ;-;
first project ever
One thing people tend to do (myself included sometimes) is just accept the answers without taking time to understand what it all means and sanity checking it. I used GPT to help me learn blender python a bit since concrete scripting examples for what I wanted to do were sparse from my searches. It was only after I decided afterwards to look at it did I realize there were quite a few flaws and some practices were outdated
So this isnt the effect I was going for, I want it to slide back in from the top, when they scroll up even if they aren't at the top of the page.
<script lang="ts">
import '../app.css';
let { children } = $props();
import {AppBar, Tooltip} from "@skeletonlabs/skeleton-svelte";
import {BookOpen, Home} from "lucide-svelte";
import { onMount } from 'svelte';
let openState = $state(false);
onMount(() => {
let lastScrollY = 0;
window.addEventListener('scroll', ()=> {
const header = document.getElementById('header');
const currentScrollY = window.scrollY;
if(currentScrollY > lastScrollY) {
// @ts-ignore
header.style.transform = 'translateY(-100%)';
} else {
// @ts-ignore
header.style.transform = 'translateY(0%)';
}
lastScrollY = currentScrollY;
})
})
</script>
<style>
#header {
transition: transform 0.3s ease;
}
</style>
<div id="header" class="flex flex-row justify-center p-4">
<AppBar classes="w-80 rounded-full shadow-xl fixed">
{#snippet lead()}
<a class="text-2xl" href="/">Aaron Dye</a>
{/snippet}
{#snippet trail()}
<Tooltip
bind:open={openState}
positioning={{placement: "bottom"}}
triggerBase="underline"
contentBase="card preset-filled p-2"
openDelay={200}
closeDelay={100}
>
{#snippet trigger()}<a class="btn-icon preset-filled" href="/blogs"><BookOpen /></a>{/snippet}
{#snippet content()}<p>Blogs</p>{/snippet}
</Tooltip>
{/snippet}
<!-- <input type="search" class="w-48 md:w-96 bg-transparent border-0 border-b-2 focus:outline-none" placeholder="Search for post..." />-->
</AppBar>
</div>
<div class="p-4 absolute">
{@render children()}
</div>
Ignore the movie in the background I didn’t realize until just now
So always scroll them to the top? or
I just am having a bit of trouble understanding what you mean is all
So when you scroll down, it like transitions up right, like "slides" up, and when you scroll back up it will slide back down.
can you make a variable? just compare is the current scroll is less than the prev
temp = 0;
up = false;
onscroll {
if current < temp && !up // then it's scrolling up, set up to true
else if current > temp // set up to false
temp = current;
}
oh wait, didnt see the code fully
So the scrolls, either direction are a transition scroll
Yes
can you like debug it with console logs? i usually do that if i find a problem
I want to the navbar to not always be there when they are scrolling through content
but they can bring it back by scrolling up
OHH
I thought you meant like this
Just to make sure i have this right
Navbar at top, scroll down the page as normal, but when i scroll up it should show the navbar but not bring me all the way back up the page
Correct
Since I dont want the navbar in the way 24/7
but I want it to look nice, not like it just poofs
So I figured a translate would work
something like that
Woah that wasnt exactly
but that looks cool too
I wanted it to transition up off screen

but you still need the logic 
import { useState, useEffect } from 'react';
export function useScroll(threshold = 100) {
const [scrollDirection, setScrollDirection] = useState("up");
const [scrollPosition, setScrollPosition] = useState(0);
const [prevOffset, setPrevOffset] = useState(0);
const updateScroll = () => {
const scrollY = window.pageYOffset;
setScrollPosition(scrollY);
if (scrollY > prevOffset) {
setScrollDirection("down");
} else if (scrollY < prevOffset) {
setScrollDirection("up");
}
setPrevOffset(scrollY);
};
useEffect(() => {
window.addEventListener("scroll", updateScroll);
return () => {
window.removeEventListener("scroll", updateScroll);
};
}, [prevOffset, threshold]);
return { scrollDirection, scrollPosition };
}
I just used this old hook
hmm but my code is basically the same as code that aaron sent
can you do smth like this? console.log([currentScrollY , lastScrollY ]);
and see the result
Can you check and make sure the styles are getting applied to your nav?
The styles are indeed applied
this is odd
Ah
ea
it works now but the problem is
Now its all the way to the left
No longer centered
use transform: translateX(-50%) and left 50%
https://discord.mx/i/s5bROIOAlI.png I hate discord
why did they think to add reaction notifications
or try switching where the styles are being applied
either pancake's answer or mine
it is a testid
which i'd assume is unique
but if not just try Takiyo's answer of applying those styles to the outer div
you cant combine fixed with flex
<div id="header" class="flex flex-row justify-center p-4 fixed">
applying flexed, will ruin the flexbox properties
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
centered and still has the scroll thing
the formatter automatically gets rid of them
💀
that broke my heart 💔
I agree
beat it up until it adds it back
What does this have to do with Discord applications?
“Hey help me fix this BF cell loop I need it for my app”
no where does it say it has to be discord related
This channel is related to anything development ^-^
how can i develop a fulfilling relationship
You can't
rip
is it time to start a bromance with tim?
kurwa
how to develop resistance to disappointment
and how to get this disappointment out of my fucking head
:^)
It's against ToS to be a programmer and be in a relationship 🤓☝️
Probably the same one who decided that if you play League of Legends you can't take a shower
so like once every 5 year?
I'm having trouble with the images not showing up on my top.gg page
I'm using markdown's
Is that correct? Or am I missing something here
it's correct
I think something is wrong with my image hosting then
just be sure the link is actually an image and not some page like imgur
I'll keep messing with it
That's probably my problem tbh
does google drive work? i assumed it would, but it isn't
Upload the photo to imgur and copy the direct link to the image
Google drive is able to store photos, but you are not able to place links to them on external sites in such a way that they will be displayed
I got it, I just routed the link through duck duck go instead and it works with google drive
Weird
yeah, i found a super niche and outdated reddit post about the same issue
I'd recommend imgbb instead
I've never used it
imgur sometimes delete less viewed images
Am I dumb or is the content not supposed to be below the header?
Dk if its the best method
but I added top padding to the body content
Though I do notice when scrolling the text shows over the nav
is this a z-index issue?
Yep
Seems to be
😎
i cant code
thats why i use gpt
but its doing well
i know what correct and incorrect code looks like
i just cannot create it off my own knowledge
Would probably be a good idea to ease into it and properly learn to code on your own
Even if you continue using gpt to help you write it'll be way easier to squash bugs that way
ive been improving ALOT
at identifying the specific issues
once i used all my gpt plus membership
like the cooldowns
i started a weebit of trying myself and it worked
ask any good programmer and they'll tell you they do alot of googling and shit
i kinda know what im supposed to see but if u asked me how to make it from scratch
Lol yeah good googling is half the job
yep
Not that it does not require skill as you need to nail down what precisely the issue is and figure out how to fix it with help from the info Google provided
yeah
this is a bad habit to have
I think that GPT is going to set back CS student/junior dev knowledge a ton
Nobody thinks about how to approach a problem anymore, they let gpt do it for them
I won’t lie I’ve started getting into this habit
I am starting to cut gpt off for backend development
I’ll still use it for front end
im not a cs student tho
this is a hobby
im a language interpreter and commercial cleaner
I’m just saying that if you want to actually learn how to code, don’t use gpt for anything except for bouncing ideas off of it
yeah
This was a hobby for me too and have improved tremendously from 4 years ago. Also Basil!
#UnexpectedOmori
I've fallen into this trap, the other day i used it for an implementation of quick sort
After I did that I realized how much it's infringed on programming for me, and I won't let myself use it
To be fair, quick sort is an algorithm that isn’t exactly intuitive to begin with. You don’t have to reinvent the wheel, but it is important to understand the ideas behind it
Well imo it is one of the easiest sorting algorithms besides bubble sort to read how it works and implement
I’d say that selection and insertion sorts are more intuitive
I agree with selection I forgot about that
These are the only sorting algorithms I know
because its fixed
Questions about discord.py.
1: Can you use slash command and then get text input from a user? Example: /slash -> user input 1 2 3 4 5 6
2: Can you use slash command and then get text input from a user multiple times? Example: /slash -> user input 1 2 3 4 5 6 -> user input 7 8 9 10 11 -> user input 12 13 14 15
3: Are you allowed to use while loop when using buttons? Example: Button gets pressed -> Cycles thorough while loop again and user gets next set of buttons
yes
yes
yes
Just to be clear, that user input can be text based? I thought of a way for buttons to have while loop and chatgpt kinda confirmed it for me. I mean yes yes yes tank you.
type: String?
Yea I forgot you need to mess with z index
How can I make it so that the height remains fixed, and the text doesn't move as its being typed out.
I tried setting a height
but the result remains the same
maybe the height just isn't enough
But the top text always moves up as the bottom is being typed out 
set minimum height
so its forced to be that height

You are a godsent
It works wonderfully know
I might get rid of the transition honestly
It looks weird with just my face STAYING there
😭
You should take a better picture bro 😭
Its filler
Better pic will def be up before I launch my portfolio
💀
Its also an old picture of me
so
and the only one I have
😭
Try to make the same fade in time with the picture it's so weird that someone stares at you before you get information about them
lmao
let index = 0;
let typedChar = "";
let typewriter: ReturnType<typeof setInterval>;
const typeChar = () => {
if(index < phrase.length) {
typedChar += phrase[index]
index += 1;
} else {
clearInterval(typewriter)
}
}
Love how simple a typewriter effect can be
What is the tld extension
Prokbun told me the same thing for my .gg domain
💀
like .com ? if yes, it's .us
yeah i dont know much about domains 😅
.us domains aren't typically protected by WHOIS protection by porkbun
whois protection is usually free
Is my main container not supposed to be the full height?
The green background stops short
I am visualizing where stuff goes and their bounds
check for margin, sometimes the body element has some defaults iirc
You can also visualize the layout by using dev tools instead of changing the background color
or use a css normalizer
what is that? 
Visualizing the bounds of divs
It resets css defaults to normalized levels
e.g setting it to 0 on margin and such
is it some kind like this? or we do it manually like usual? because what i caught from tim's message is it is a module or some kind
are you speaking of normalize.css?
actually just a file
yeap
there are other similar ones but yes
its mainly to correct diverging defaults accross different browsers
but also remove defaults that dont make sense
its basically a one-liner you can copy paste into your own css if you want
or you can include it as a separate css file
yea
i didn't know about normalize.css I'll also keep thay saved somewhere foe if i ever need it
will probably use it sooner than later when I'll make at least a home page and help page for my bot
https://chromewebstore.google.com/detail/cssviewer/ggfgijbpiheegefliciemofobhmofgce?hl=en i use this quite often
can be helpful
Thank you
I have a blinking cursor but it wont be centered properly. When I try it gets to the end and gets stuck there while the text continues (as shown in second video)
<p class="text-xl cursor flex items-center gap-2">{typedChar}</p>
.cursor::after {
content: "";
width: 2px;
height: 20px;
display: inline-block;
@apply bg-surface-400;
animation: cursor-blink 1.5s steps(2) infinite;
}
@keyframes cursor-blink {
0% {
opacity: 0;
}
}
this is the cursor class
i wouldnt use flex for this
use a flex container if you must, but keep the text itself inline
ie make both <p> and .cursor display:inline
assuming they are siblings
oh nvm, they are the same element lol
either try display:inline on the ::after, or try absolute positioning shenanigans
if it doesnt work, make them two separate inline elements
Ah yea I ended up using a lib
cause
I needed more features
and I wasnt going to spend time coding it myself
💀
lazy
@quartz kindle
💀
is it worth the effort and probably months of time to make a dashboard for my bot
Do you want to do it to make money or to learn?
i made it for the purpose of learning djs14 and i dont have the desire to add premium features
But its going to have a lot of commands
a configurations for commands like changing certain channels for certain features
I would say that if you’re doing it purely for the sake of your bot, it’s probably not worth it (unless it’s popular). If you’re doing it because you also want to learn in the process, go for it, you’ll learn a ton

hi chat
trying to setup gh workflow for building and releasing a version of a gh action
but struggling heavy rn
average gh actions moment
how many commits 
i actually managed to make a simple workflow in a single commit lmao
was surprised myself
heh...
think like
40 now
(trying to fix commits)
okay buddy
🗿 average github ci
oh wait this is my retardism oops


ive seen slash commands with form inputs, as in a pop up on your screen where every text input is presented and you write in the form instead of the slash command.
What is this called? i cant find any docs on it and im prolly searching for the wrong thing
Modals?
yeah thats it, thank you
Yw

i love google lol right when i published a website for my bot it got reported to google as phishing LOL at least it only took them a few hours to unflag it after i appealed it but bruh
no only after
I wonder if it wouldnt have flagged you if you did that first.
all it links to is discord
forgot i disabled cursor for screenshots but the cursor is on the Add to Discord
I recently took on the task of trying to make a queue and lock system across multiple processes for syncing rate limit buckets for Discord but god do I hate this
Enjoy your IPC!
NOOO
That sounds like fun, I have an idea!!!!!!!!! make a microservice for it lol
Maybe even redis
Redis was an actual thing I got as a response when I asked the project lead, but this is actually for a lib I maintain and a goal was to make it where people didn't have to use something proprietary so that they can mix and match and was easily extendable
I kinda have to at scale. We have a proxy service, but you can only make so many requests per IP
I would love to learn, and i arleady know pretty advanced react ts but my biggest problem is i am very much not visually creative
So the whole designing it would probably take years
is the goal to be horizontally scalable across machines?
if not, then i suggest lmdb
where i can find this
can u trll me bro
It's not something you can find, it's something you type yourself
go to your topgg bot page, edit, webhook
write anything you want in "authorization", and write exactly the same thing in TOPGG_WEBHOOK_AUTH
https://top.gg/bot/<your bot id>/webhooks
I mean thats just a random picture of a person
I dont see what its against the rules
Its AI checking an Image. And its being saved temp on my Servers.
Because of privacy I mean
As long as it has pp and tos about it, its fine
Long time no see stranger
dam
until someone complains that its racist anyways
where is that racist
I believe they're referring to the possibility of the bot misidentifying someones race
As AI won't always be 100% accurate
If someone squinted and the bot thought they were Asian, I can see a situation in which someone might feel offended 
One message removed from a suspended account.
I think it really depends on how you interpret the results. The AI isn't intentionally racist, it's just predicting a set of statistics based on its training data. Sometimes AIs are wrong.
One message removed from a suspended account.
well it can be because some of the data it's trained on is from racist people
so long as the data doesn't train the ai, if it does it's against Discord's own tos
It doesnt.
AI is already trained
doesnt need data
I could remove that field
But then the gender would be an Issue lol
Oh brother
because yk, some LGBTQ members are very pissed abt that
¯_(ツ)_/¯
I mean it's AI not you so they can be mad at AI
I already got alot of hate because the AI said that only male and female exists.
😭
You can get offended about anything. I'm sure there are improvements you can make, but even the most well funded AIs (ChatGPT) aren't perfect at preventing offensive content from getting through
AI is ruthless 
Well the AI knows the differnce lmao
I tested it
miss the old days where ML wasn't called AI
Yea its ML
or where crypto wasn't cryptocurrency
I’ll be completely honest I don’t know the difference, I just know there is one
But most people know more what I mean if I say AI
ML isn't supposed to mimic a human
I was under the impression that ML fell under the umbrella of AI, it’s just more specialized to completing specific tasks
yeah it does
though now people say AI for everything because it became the buzzword to use
e.g. self driving cars also use ML
but people just say AI because that's the only word people understand these days
yh
But yeah it doesnt say asia if the person in the Image squints
real
yeah but probably meant more people imitating asian eyes, not just squinting your eyes
1 min
can't find a good picture tbh
Exactly my problem
apparently called slanted eyes gesture
Yea found some Images
None of them got detected as asian
Maybe because its a bad Image
try a pic of a dog
I'm curious what it'll do
i was close





