#development

1 messages · Page 266 of 1

pine willow
#

1 min

green kestrel
pine willow
#

It gets confused with zombies lmao

solemn latch
#

zombies confuse me too

#

Not the fault of the bot

pine willow
deft wolf
#

The next thing that comes to mind is the face of a ghost, but I remember this one meme about face recognition

deft wolf
cursive hare
#

When I get developer betch

pine willow
cursive hare
pine willow
#

It doesnt anymore

pine willow
#

You get it once your bot is approved

deft wolf
#

Emotion: fear is crazy

pine willow
deft wolf
#

I think the bot may have trouble distinguishing between fear and surprise (I have a problem with this myself) kappalul

pine willow
#

The command is in Beta

#

I need to fix some stuff

#

And it thinks that kids are 30+ 💀

vocal knot
pine willow
#

currently working on it that it detects dogs too lmfao

#

Videos work

lament rock
#

yep

#

The plan is to have either proxies or just a mesh of clients that are able to do requests sequentially

#

The proxies are backed by the same lib

mystic matrix
pearl trail
#

did you respond with 200?

vocal knot
# mystic matrix

also if you make it do alot of stuff before sending the response it times out fast so it retries

past rampart
cursive hare
#

How are you @past rampart

bitter granite
cursive hare
#

@bitter granite please help he was talking screenshot and send to others server's

bitter granite
cursive hare
#

But he send all screenshots my personal question also

bitter granite
#

Also this is a public server

cursive hare
frosty gale
#

for some reason when I import my self signed certificate as a trusted certificate, chromium browsers still treat it as untrusted when accessing my dev site using that certificate, any ideas?

#

i thought chromium browsers relied on the OS certificate store to determine if a certificate authority is valid or not

solemn latch
#

I think thats normal right?

#

self signed are for dev sites, CA is for production

frosty gale
#

but then importing and being able to use a self signed certificate in a browser is a common use case, especially in enterprises

#

besides i dont mind the untrusted error, but i cant use webauthn with an untrusted certificate error

#

maybe i need to make a self signed certificate authority first then sign a certificate and import the CA root certificate

#

ok got it working, apparently for browsers to trust the certificate you need to make an additional config file which specifies some algorithms & dns names when generating with openssl

hidden gorge
#

Just a little question i'm working redoing my website

V1 uses Var and is a normal file
but V2 uses Imports and is a module type

Is import a better idea?

wheat mesa
#

It’s just two different styles of importing modules. The latter is considered more modern, and works with ESM modules. The former is used with CJS modules, and is considered more outdated. Also, please don’t use var

wheat mesa
#

Prefer let over var

#

And if you don’t reassign to the variable, use const

sharp geyser
#
SecurityTokenSignatureKeyNotFoundException: IDX10503: Signature validation failed. The token's kid is: '303223259816525826', but did not match any keys in TokenValidationParameters or Configuration. Keys tried: 'Microsoft.IdentityModel.Tokens.RsaSecurityKey, KeyId: '303110851060039682', InternalId: '0rYMURguPhZTOdUrzXjLG-OiFz7LQmqkg0JHaM5Ov4w'. , KeyId: 303110851060039682 '. Number of keys in TokenValidationParameters: '0'. Number of keys in Configuration: '1'. Exceptions caught: '[PII of type 'System.String' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]'. token: '[PII of type 'Microsoft.IdentityModel.JsonWebTokens.JsonWebToken' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]'. See https://aka.ms/IDX10503 for details.

What in the absolute fuck does this mean

#

💀

prime cliff
sharp geyser
#

Not at all

#

Not using docker

#

Im using dotnet watch

#

maybe that Thonk

#

Yea

#

I just had to restart dotnet

#

weird

prime cliff
#

User home folder DataProtection-Keys

sharp geyser
#

I fixed it

#

Seems it was a dotnet watch issue

#

Ive had a lot of problems with dotnet watch

prime cliff
#

Check your nuget package manager and see if any of these have a different version to each other if you have them installed.

Microsoft.IdentityModel.Tokens Microsoft.IdentityModel.JsonWebTokens Microsoft.IdentityModel.Protocols.OpenIdConnect.
Or all the identity model packages

sharp geyser
#

It seems to just be an issue with dotnet watch

#

I can't reproduce it other than when using dotnet watch

#

I seem to run into a predicament

#

I have a service that requires another service

#

Should I inject that service into this service, or make a new service that uses the both of em?

eternal osprey
#

hey guys genuine question here.

How does my structure look?
So the way i went to work, is i created several categories for several functionalities/features.

#

Idk never worked with something this categorized myself

#

not only that but i also mplemented each file as a class that i can create objects of. For some reason this just looked easier to manage, especially cuz now each request will generate a new object.

wheat mesa
small tangle
#

I have my database related stuff in a separate project

#

And especially with DI i have an Abstractions project which contains all the interface types, so i can just reference this project when i need the types rather than a project with the implementations

proven lantern
#

how does my project structure look?

wheat mesa
sharp geyser
#

or I would of

#

still rather new to C# and DI

proven lantern
#

are you talking about dependency injection?

sharp geyser
#

yea

proven lantern
#

that's a great pattern

#

i'm doing that all over in my project

sharp geyser
#

JS and DI dont sound right

proven lantern
#

it's very nice

sharp geyser
#

I dont see any dependency injection there

proven lantern
#

load Commands does it

pearl trail
proven lantern
#

im moving from commonjs to esm so i put this into a function for now. i'll eventually use await import directly

peak rune
small tangle
#

thats how i structured it

small tangle
# sharp geyser I didnt know how to set this upo

You simply add a "Class library" project with your DbContext and all db related stuff and reference this project in your blazor project (looking at your structure)
Then you can simply add your DbContext to your DI like this:

builder.Services.AddDbContextFactory<ApplicationDbContext>(options =>
    options.UseNpgsql(
        builder.Configuration.GetConnectionString("ApplicationContext")
    )
);
#

ApplicationDbContext resides in the Data project in my case

pearl trail
#

interesting, i can still able to access the files like normal if i separate my folders into different projects right?

small tangle
#

Wdym by "access the files like normal"?

pearl trail
#

is it like a whole separated project like different project in js? for example, i have bot and server project. can i have bot able to access classes and values in server, or not?

small tangle
#

ofc you can, you simply add a project reference and can access the types of the other project (ofc if the visibility modifier allows this)

#

In Rider you can right-click on the project name "Add" "Reference..." and just tick the project you want to reference

pearl trail
#

i see, thanks for the information!!

small tangle
#

Sure nodCatP

#

i recently added Aspire to my project which is really nice bc you have this dashboard where you can access all your services (With the logs and traces) at one place

pearl trail
#

is that similar to portainer?

small tangle
#

i'd say its similar to portainer and docker desktop in that sense that you have a dashboard of your running containers. but on top of that you have also support for logs, traces and metrics builtin (at least with docker desktop im not aware of such feature)

pearl trail
#

oooo

pearl trail
#

lmao i was thinking "no way 16vcore with just $45", and i was right KEK

bitter granite
#

rich

pearl trail
#

😭

sharp geyser
#

Didnt know you can do that

#

This will make things so much more organized on our end

#

I can split stuff up into projects

small tangle
merry patio
#

hello

#

2 questions

#

1st, the blue line - how can I make just a thin black line here? & 2nd how do I even out the divs?

#

if no reply, ping. thanks

#

blue line is where section ends btw

#
      <section class="footer">
         <div>
            <h4>Contact Us</h4>
            <p>Tele: 01566 775543</p>
         </div>
         <div>
            <h4>Find Us</h4>
            <p>Location</p>
         </div>
         <div class="newsletter">
            <h4>Subscribe to our newsletter</h4>
            <p>For exclusive deals, upcoming events, tips & tricks & more</p>
            <input />
         </div>
      </section>```
sharp geyser
#

causing Ambiguous invocation errors

#

While I have an auth project, it seems to put the same code in the main project that references it

small tangle
#

huh PauseChamp why is there a MercatusWeb.Authentication folder inside the MercatusWeb project?

sharp geyser
#

No idea

#

it happened when I made a reference to it

small tangle
#

It appeared when you added the project reference of MercatusWeb.Authentication to the MercatusWeb project?

sharp geyser
#

yea

small tangle
#

that is really weird, shouldnt happen

sharp geyser
#

I clicked this on the MercatusWeb proj

small tangle
#

yea

sharp geyser
#

and then checked the box next to MercatusWeb.Authentication

#

and then the folder appeared

small tangle
#

you should delete the folder inside the MercatusWeb project

sharp geyser
#

if I do that

#

then the Authentication and Database projects dont load

small tangle
#

Are the namespaces of the files inside the MercatusWeb.Authentication correct? maybe thats causing issues

#

you can right-click the MercatusWeb.Authentication project -> refactor this -> Adjust namespaces in case

sharp geyser
#

No idea

#

All looks correct

small tangle
#

Rider should be able to figure the references out if they are missing

sharp geyser
#

Let me try this again

small tangle
#

When you look at the .csproj, is there the project reference?

sharp geyser
#

So I right click the solution, Add Project, then choose Class Library right?

small tangle
#

Yes, New Project, Class Library

sharp geyser
#

Soon as I create the project it gets added to the main one

#

💀

small tangle
#

What do you input here when adding a new project?

sharp geyser
#

MercatusWeb.Auth and the directory is the root dir for the project

#

C:/Users/dyeaa/Dev/MercatusWeb

small tangle
#

yea this seems correct

sharp geyser
#

maybe im just not cut out for having a clean workspace

#

World is out to get me

small tangle
#

Wait

#

Is your solution in the same directory as the MercatusWeb project?

sharp geyser
#

Yup

#

I always do that

small tangle
#

oh haha

sharp geyser
#

Dont tell me thats the problem

small tangle
#

the .sln should be one hierachy above

sharp geyser
#

Anyway I can fix this without making a new solution

small tangle
#

It should be like this

small tangle
sharp geyser
#

alright

#

time to

#

figure this shit out

#

The problem is

#

messy ass folder

pearl trail
#

based

sharp geyser
#

Do I keep the docker stuff in the same path as the sln

#

idk

#

fuck me

small tangle
#

just yoink the MercatusWeb file and move it one hierachy up

#

that should be all you need

pearl trail
#

does rider use sln?

#

or just vs

small tangle
#

rider also uses it, you can see the type of MercatusWeb is SLN File

#

I think its just the way C# works, root .sln file and project .csproj files

pearl trail
#

yeah i figured it out, just wondering about sln file

small tangle
#

Sln lists all the sub-projects

#

With the path to their respective .csproj files which itself contains project-specific information like nuget or project dependencies

#

you can look at the contents of the sln file, if you click the dropdown next to solution and select file system, then you will see the .sln file

small tangle
# sharp geyser Do I keep the docker stuff in the same path as the sln

whats the content of the docker stuff, if its like a docker compose to start the whole project with additional services, id move it to the root folder next to the .sln. if it just builds one sub-project as an image (e.g. the blazor project) id keep it inside the web project folder

sharp geyser
# small tangle whats the content of the docker stuff, if its like a docker compose to start the...
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["MercatusWeb.csproj", "./"]
RUN dotnet restore "MercatusWeb.csproj"
COPY . .
WORKDIR "/src/"
RUN dotnet build "MercatusWeb.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "MercatusWeb.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MercatusWeb.dll"]
#

Seems like it starts the blazor app

small tangle
#

yea

#

i think id keep that in the blazor project FoxyThinking

sharp geyser
#

Yea

small tangle
#

did it work with the projects?

sharp geyser
#

no idea yet

#

I am starting over fresh

#

💀

small tangle
#

oh :/ didnt it work by just copying the .sln one fielder hierachy up?

sharp geyser
#

Not really

#

It caused a lot of reference errors

#

I didnt feel like dealing with

#

💀

small tangle
#

oh okay

prime cliff
#

Ah you're using docker itself to build and publish hu interesting

#

Usually you just publish straight from vs/rider

sharp geyser
#

Well

#

I decided to split up our ui components into its own project as well

#

seems like thats not a good idea if idk how blazor works fully

#

Scoped css files don't seem to get used

#

I have a navbar in my Shared project that I use in my Web project

#

The navbar font is not correct because the Navbar.razor.css file's styles aren't being applied

#

Omg

#

I fixed it

#

I needed to add <link rel="stylesheet" href="@Assets["Mercatus.Web.styles.css"]"> to my App.Razor

shadow trellis
#

Greetings devs, i'v been having some troubles to get the Privileged Intents approval, so I tried giving, screenshots, videos, and explaining my app functions and why the app needs the Server Members Intent and got denied 2 times, is there any tip I could get, I'm already at 80 servers and probably next week getting 100.

lament rock
#

If you've been denied twice then it's likely that they determined that your app either doesn't actually need the server members intent or the feature that requires it isn't a good enough reason to grant the privilege and you should reconsider your feature set

shadow trellis
#

I mean without it the function will become just garbage, and as for now I don't see any workaround on how to change the code to not use that privilege.

#

And it is a main function.

vocal knot
#

what intent is it and why do you need it

#

like for what functionality

compact condor
#

Heyo, idk if I may ask/post for this around here if not then say it and I remove it. But I just wanted to ask for opinions on my design for a dashboard of my bot and what I should add/change to it since this place is more for bots.

shadow trellis
# vocal knot like for what functionality

Administrative Logs: Logs include detailed mentions (e.g., @username) for actions like forcing a logout, adjusting user time, or resetting categories. Without the intent, we’d only have user IDs, making logs harder for admins to read and use.

Role Verification: The bot checks user roles (even offline) to ensure only authorized users can execute specific commands. Without the intent, offline users’ roles can’t be verified, risking permission inconsistencies.

Forcing User Logout: Allows admins to log out users from a category while providing mentions in the confirmation/logs. Without the intent, only IDs can be logged, requiring manual lookups.

Active User Lists: Displays who is currently checked into a category. The intent allows fetching both online and offline users with mentions. Without it, the bot can only show IDs or online users.

Adjusting User Time: Admins can add or remove time for users in categories. With the intent, mentions are used for clarity; without it, only IDs can be shown.

Category Reset: Mentions all users affected by the reset in the logs. Without the intent, we’re stuck with IDs, reducing the clarity of the reset's impact.

Xlsx files data: When exporting the data as xlsx files no usernames will be shown and only IDs, this being inefficient and confusing for the bot purpose.

Without this intent, the bot would lose a lot of its usability, forcing admins to rely on IDs instead of mentions, which is inefficient and confusing. Many actions depend on offline user data (roles, names), and this functionality would be incomplete without the intent.

wheat mesa
compact condor
compact condor
shadow trellis
compact condor
wheat mesa
sharp geyser
#

Guys, ima die if I cant figure out how to remove this annoying white outline around my already set outline

#

😠

compact condor
wheat mesa
#

Or bootstrap logo whatever it is

compact condor
#

Its a placeholder, I had the picture randomly in my download folder

wheat mesa
#

Ah

compact condor
compact condor
#

maybe try this

prime cliff
wheat mesa
#

Could just be browser accessibility shenanigans

sharp geyser
#

Probably tbh

#

but thats annoying

wheat mesa
#

Or maybe you have an extension that doesn’t play nicely with your CSS like dark reader or something

sharp geyser
#

dark reader is disabled

#

Does it even on edge

#

So unless they both enforce the same thing then its a me issue

wheat mesa
#

ME is garbage (I know it’s better now but I hate it from the early days) just use a diff browser to check

prime cliff
#

Could just be a box-shadow that always gets ya

sharp geyser
#

I checked

#

and no its not a border, outline or a box shadow

prime cliff
#

In the browser inspect tab to the right there is a sub tabbed list one of them is computed css try find what it is

sharp geyser
#

I cant see what it is

#

Idk what to search for

prime cliff
#

Just focus the textbox then scroll through the list and see what light color is showing up

#

It's a good way to see what the active css of a component is especially font, compared to the standard entire list of css applied to it

sharp geyser
#

Its applying a white border

prime cliff
#

Yup there it is border color?

sharp geyser
#

but the issue is, im telling it not to

prime cliff
#

Just set it to none

sharp geyser
#

so wtf

prime cliff
#

Try border-bottom-color: none !important; or transparent or border-bottom: none !important;

sharp geyser
#

nope

prime cliff
#

Not even with !important?

sharp geyser
#

yup

prime cliff
#

How are you applying the css and is there a bottom css file overriding it or something

#

Maybe try search the project files for the rgb color?

vocal knot
sharp geyser
#

but even doing it myself nothing

prime cliff
#

Your custom css needs to be loaded after tailwind for it to override those styles

sharp geyser
#

its not custom css

#

I am using tailwind

#

to apply these styles

prime cliff
#

Maybe try explicitly doing a <input style="border: none !important;" />

vocal knot
prime cliff
#

There's something very wrong with your project then if you can't seem to find or override what is doing that

sharp geyser
#

I give up at this point

#

Its stuck this way, no longer my problem 💀

vocal knot
#

try
all: initial;

prime cliff
#

Ok in the same computed tab click the arrow dropdown it should say what is apply the style

vocal knot
#

all: initial; resets the css for that element to initial

#

element/css selector

sharp geyser
#

See, I can do

input[type="search"]:focus {
    outline: none;
    box-shadow: none;
}
#

but then I cant apply a custom outline color

#

💀

vocal knot
sharp geyser
#

Wouldn't that not solve the issue if it resets it to the defaults?

#

The defaults is that the white border is there

vocal knot
#

you put it as first in there then set the other css

#

so example

input[type="search"]:focus {
    all: initial;
    outline: whatever you want here;
}
sharp geyser
#

Yea no, i'd have to style all its original defaults

#

Not worth the effort

#

That resets it to a basic text field with some search attributes

#

Im not going to restyle everything

vocal knot
#

there's unset or inherit

#

as values for all:

sharp geyser
#

Im just going to leave it for now

#

its not super important

sharp geyser
vocal knot
#

you could set
outline: none;
box-shadow: none;

to the values you want and use !important

prime cliff
#

They already tried that Wolf

#

Apparently none of that is working even if you explicitly override it which is weird

sharp geyser
#

Idk wtf is going on with it

#

but idrc rn

#

Its the least priority

#

I was just wondering if I could fix it right then and there

vocal knot
#

have you tried normalize.css maybe?

#

@sharp geyser

queen needle
surreal sage
#

ignore ping
was seeing messages from 3h ago

pearl trail
lyric mountain
#

it hit GC a lot processing it

#

what's the memory on the DO server?

pearl trail
#

16gb

#

tho it's idling at 10gb, maybe that's the reason(?)

lyric mountain
#

what are u doing that's filling 10gb??

#

but well, that's probably the cause of the large difference

pearl trail
#

p much sure it's cassandra too

pearl trail
lyric mountain
#

right side spent 1.6 seconds doing garbage, so without hitting it'd take 18ms

#

oh java, did you try using zgc?

pearl trail
#

is that another java runtime ?

lyric mountain
#

gc

#

-XX:+UseZGC

pearl trail
#

oh, havent tried that

lyric mountain
#

it's a zero-latency gc, doesn't clean as much garbage as G1 but takes virtually no time to run

#

basically u use it when you want to trade cpu for speed, and G1 when you can afford higher latency to spare cpu

pearl trail
#

that's interesting, but it takes cpu quite a lot too

lyric mountain
#

I find it the best for APIs, where most of the time you'll be idle

#

the cpu impact is very small if your Xmx is lower

pearl trail
#

oh i see i see

ionic minnow
#

hi

#

With topgg API can get data for other bots? (i.e the same data which I get for my bot I want it for other bots)

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lyric mountain
#

https://docs.top.gg/docs/API/bot

{
  "defAvatar": "6debd47ed13483642cf09e832ed0bc1b",
  "invite": "",
  "website": "https://discordbots.org",
  "support": "KYZsaFb",
  "github": "https://github.com/DiscordBotList/Luca",
  "longdesc": "Luca only works in the **Discord Bot List** server.    \r\nPrepend commands with the prefix `-` or `@Luca#1375`.    \r\n**Please refrain from using these commands in non testing channels.**\r\n- `botinfo @bot` Shows bot info, title redirects to site listing.\r\n- `bots @user`* Shows all bots of that user, includes bots in the queue.\r\n- `owner / -owners @bot`* Shows all owners of that bot.\r\n- `prefix @bot`* Shows the prefix of that bot.\r\n* Mobile friendly version exists. Just add `noembed` to the end of the command.\r\n",
  "shortdesc": "Luca is a bot for managing and informing members of the server",
  "prefix": "- or @Luca#1375",
  "clientid": "264811613708746752",
  "avatar": "7edcc4c6fbb0b23762455ca139f0e1c9",
  "id": "264811613708746752",
  "discriminator": "1375",
  "username": "Luca",
  "date": "2017-04-26T18:08:17.125Z",
  "server_count": 2,
  "shard_count": 1,
  "guilds": ["417723229721853963", "264445053596991498"],
  "shards": [],
  "monthlyPoints": 19,
  "points": 397,
  "certifiedBot": false,
  "owners": ["129908908096487424"],
  "tags": ["Moderation", "Role Management", "Logging"],
  "donatebotguildid": ""
}

API resource for a bots or apps on a platform like Discord

#

all the data you can get from a request

ionic minnow
#

For not my bot i.e the bots which I haven't posted I want data of websites,server count,server member and so on
So can I get it all?Or I can get it only for my bot

lyric mountain
#

see the list above

ionic minnow
#

I saw this but I can't understand this that I can get only for my bot?

lyric mountain
#

it's for any (topgg) bot as long as u have the id

#

you can also get up to last 1000 voters and check whether someone voted

#

do note tho that rewarding people for voting on other bots is against topgg ToS

ionic minnow
#

So can you give me an code which get this data?
I'v tried a lot but it not gives me anything

#

and where I can find api ?

lyric mountain
#

I sent the link above

wheat mesa
#

If you can’t find the API, I’d imagine your claim of “trying a lot” of things isn’t true :p

ionic minnow
#

So can I do this with webhook token?

lyric mountain
#

...you dont need a token for any of those requests

ionic minnow
#

So for example can I get this all data for your bot?

lyric mountain
#

all that's listed there

sharp geyser
#
using Microsoft.JSInterop;

namespace Testing;

// This class provides an example of how JavaScript functionality can be wrapped
// in a .NET class for easy consumption. The associated JavaScript module is
// loaded on demand when first needed.
//
// This class can be registered as scoped DI service and then injected into Blazor
// components for use.

public class ExampleJsInterop : IAsyncDisposable
{
    private readonly Lazy<Task<IJSObjectReference>> moduleTask;

    public ExampleJsInterop(IJSRuntime jsRuntime)
    {
        moduleTask = new(() => jsRuntime.InvokeAsync<IJSObjectReference>(
            "import", "./_content/Testing/exampleJsInterop.js").AsTask());
    }

    public async ValueTask<string> Prompt(string message)
    {
        var module = await moduleTask.Value;
        return await module.InvokeAsync<string>("showPrompt", message);
    }

    public async ValueTask DisposeAsync()
    {
        if (moduleTask.IsValueCreated)
        {
            var module = await moduleTask.Value;
            await module.DisposeAsync();
        }
    }
}

So I saw this example code for wrapping IJSRuntime in a class, but I am wondering the practicality. I know in the top it says its for "easier" consumption and can be injected into the page with DI, but I am wondering why you'd need a class for this. Unless its to group up common interop methods together.

sage bobcat
#

One message removed from a suspended account.

lyric mountain
#

if u prefer a table

lyric mountain
ionic minnow
#

So with api can I find all bots for example in music category?

compact condor
lyric mountain
#

what are you even trying to do?

pearl trail
#

maybe veld will fix it on the new topgg later?

small tangle
#

new topgg? PauseChamp

#

bottomgg???

bitter granite
small tangle
#

lmao

#

topgg should be rotated like this if you select australian english nodCatP

harsh aspen
#

Cloud Server in New York $5.72 USD

Shared Intel Xeon CPU vCores: 4
RAM DDR4 ECC Registered (GB): 12
Primary High Availability SSD Storage (GB): 96
Guaranteed Internet Traffic: 20 TB
IP Addresses: 1

is that good chat?

solemn latch
#

What xeon? could be a 15 year old cpu. could be a brand new cpu.

quartz kindle
#

Pentium II Xeon 400

spark flint
#

12gb ram for $5 a month ??

lament rock
#

Honestly not a huge loss if it does suck. Just $5

#

Can always write a review somewhere

#

Contabo support sucks. Their uptime is subpar, but their machines are pretty good

#

Good for not uptime sensitive apps

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vocal knot
#

if you want a real cheap VPS

{
      "url": "https://clients.desivps.com/cart.php?a=add&pid=127",
      "title": "Unmetered 4GB Christmas Sale",
      "specs": "4 CPU Cores\n4096 MB DDR3 RAM\n80 GB SSD Storage\nUnmetered Bandwidth\n1000Mbps Port\n1 Dedicated IPv4 Address\nVirtualizor Control Panel\nKVM Virtualization\nLinux OS Choices\n10Gbps DDoS Protection Now Included Free\nGFW Protection Up to 1 IP Change Per Month!",
      "price": "Annually:\n$39.99 USD"
    }

i've been using it for over 2 years now not the best but pretty cheap

wheat mesa
merry patio
#

hello, any idea how js if ( (adults.textContent == 0 && children.textContent == 0) || (!adults.textContent && !children.textContent) ) { console.log('adults' + adults + ' children ' + children.textContent); formTitle.textContent = 'Double check your details are correct'; formSubTitle.textContent = 'Table for 0?'; } doesn't pick up the if there are any children/adults booked

#

when I console.log(adults)

lyric mountain
#

or length, I dont remember every lang uses a different word

#

better yet, do if (adults.textContent.size() + children.textContent.size() == 0)

merry patio
#

i dont think thats it

#

because its not even picking anything up

#

it should log as

#

i will send a codepen

pearl trail
#

cpu steal more than 1 /j mmLul

pearl trail
#

wth, next ui is now rebranding to hero ui 💀

#

i thought i entered a troll domain/wrong library

harsh aspen
harsh aspen
lyric mountain
#

4 cores with 1 t/c at 2.10 GHz is quite bad

covert gale
#

that is from Q3'17

#

really old

pearl trail
#

check cpu steal by running top, see the "st" value

#

i wonder how much is it

harsh aspen
pearl trail
#

dang that’s good

sharp geyser
#
                <Dropdown ActivatorText="World">
                    <DropdownItem>Hello</DropdownItem>
                </Dropdown>

I made a custom component in my blazor app

@inject IJSRuntime JsRuntime;

<div class="dropdown">
    @if(!string.IsNullOrEmpty(ActivatorText))
    {
        <button class="dropdown-button select-none" type="button" @onclick="ToggleDropdown">@ActivatorText</button>
    }
    
    @if (_hasDropdownItems)
    {
        <div class="dropdown-content">
            <CascadingValue Value="@this">
                @ChildContent
            </CascadingValue>
        </div>
    }
</div>

@code {
    [Parameter] public string? ActivatorText { get; set; }
    [Parameter] public required RenderFragment ChildContent { get; set; }

    private bool _hasDropdownItems;

    private async Task ToggleDropdown()
    {
        Console.WriteLine("I Work");
        await JsRuntime.InvokeVoidAsync("showMenu");
    }

    public void RegisterDropdownItem()
    {
        Console.WriteLine("DropdownItem added");
        _hasDropdownItems = true;
        StateHasChanged();
    }
}
<div class="dropdown-link">
    @ChildContent
</div>

@code {
    [CascadingParameter] public Dropdown? Parent { get; set; }
    [Parameter] public required RenderFragment ChildContent { get; set; }

    protected override void OnInitialized()
    {
        Parent?.RegisterDropdownItem();
    }

}

Seems like DropdownItem is never rendered, as RegisterDropdownItem is never called.

#

I have never made a component that takes in child components, so I am new to this

#

not to mention im using IJSRuntime for the first time, which also doesn't appear to be working

prime cliff
#

Nice yea creating your own blaxor components is a whole other experience

queen needle
#

oh wowzers

proven lantern
#

should i move my entire codebase into an npm module?

earnest phoenix
#

if you question it, probably not

lament rock
long marsh
#

How do bot developers do "local" / server-based leaderboards?

#

For context, I have many users who want server-level leaderboards so that they can compete amongst themselves.

I don't track guild information at all in my schema. The only options I see:

  1. List all members in a server + get them all from the database (ouch, seems impractical / resource heavy / bad use of rates)
  2. Create a "click now" leaderboard thing where players can initiate their own blank leaderboard and ask people in their server to "click" it to add their score (seems weird, most wouldn't like having to do this)
  3. Use the Application Authorized webhook, but it doesn't send events when the bot is removed ... and somehow track it then?
  4. The first player that looks at a server leaderboard is the official one to "initiate" it ... then, after some time, the leaderboard backfills as people continuously play? This seems like the quickest solution, but would put major operational burden on my application.
#

I'm using DynamoDB (NoSQL) + Redis for leaderboards / cache

pearl trail
#

save user's progress on each guild, then get top x user by guild for local, and get top x user by summing each user's progress using group in sql then order it. that'd be my way

long marsh
#

Is there something I'm missing here?

long marsh
#

For performance, you'd likely have to create an index ... but yeah that checks out

digital swan
#

I personally just get a list of all users in the guild then do a query where userid is in that array

My bots not used by any huge servers so idk if there will be problems eventually

neon leaf
#

cursed

pearl trail
long marsh
pearl trail
#

ohhh

#

what are you using?

long marsh
#

DynamoDB

#

The database no one uses bloblul

pearl trail
#

blobsweat i see

long marsh
#

It doesn't have this capability though – I'd have to scheme (pun intended) around it

#

It's super cheap at scale – it can handle millions of concurrent read/writes still at < $10.00 if your schema is solid.

pearl trail
#

whoa, that's cheap

long marsh
#

Only if you're schema is good though / you use it appropriately

#

But I guess the same can be said for SQL

#
  • 0 overhead
  • 0 infra maintenance
  • Point in time recovery enabled as an option
  • Can "stream" updates to be processed
  • Will likely remain free for the first 12 month I use it
  • No need to worry about read replicas / performance in that sense

But it comes at a cost:

  • You need to know your access patterns ahead of time
  • Your data looks like damn machine code
  • You'll have to duplicate data a ton for certain paradigms

I use Redis as my leaderboard to reduce hot partitions for example.

#

But for use-cases like this, I may just simply opt-out because I won't have the technical ability to do so without substantial rewriting.

solemn latch
#

Wouldn't this be its own dataset?

#

IE, this should be separate table in your database anyway

#

Its not ideal, but when you already have a product and youre adding a feature like this its common to make this its own dataset.

long marsh
#

I'd likely have to spin up a separate database just for this if I'm being honest.

#

A smallish SQL one

lyric mountain
#

was going to suggest mat views, but ur nosql

#

they're pretty decent for stuff like leaderboards where you can afford to update only a few times per day

long marsh
#

I could do a hybrid 🤷‍♂️. I can stream events from my DynamoDB table to populate data somewhere else. I can pass along the guild information ... but would be meh to handle

lyric mountain
#

I mean, if it serves anything postgres supports http requests

#

it also has cron

#

actually, couldn't u just store in a file?

#

dump the dynamo resultset into a file and only ever read from it

#

update said file once in a few hours

long marsh
lyric mountain
#

query the data from the db -> format and order it as you wish -> dump that to a file using csv or smth -> read from that file whenever you'd show the data

#

basically a cache

long marsh
#

My problem is the first: I don't have an access pattern to query by guild from the data

#

I only store a couple of things:

  • players
  • groups
  • group invites
  • group members

haha

#

It's whatever at this point ... I may create a "compare" feature where people can see their rank amount up to 5 other people selected or something

quartz kindle
long marsh
#

Seems like a lot of memory to take on too, haha

quartz kindle
#

do you have the GUILD_MEMBERS intent enabled?

quartz kindle
long marsh
quartz kindle
#

if you use interactions, you can use the autocomplete feature to display a list of members as they type

long marsh
#

Yep, pure interactions for me

quartz kindle
long marsh
#

Was helpful then – I saw it got added to discordjs. Well done.

quartz kindle
#

they changed way too many things in djs14 so i stopped updating it

#

going libless is so much better anyway

long marsh
lyric mountain
long marsh
#

My application does everything within the 3 seconds, so I don't even need to callback into discord for anything. It's pretty nice.

#

HTTP -> API -> return JSON

quartz kindle
#

sometimes the interactions arrives after the 3 seconds already passed and you cant to anything about it

#

sometimes they refuse the callback until after the 3 seconds pass

#

it happens to me randomly lol

shadow trellis
#

How long should take for intent apply to get reviewed by discord?

humble gyro
#

Monthly write cost (Monthly): $1,642,500.00
Monthly read cost (Monthly): $164,250.00

if you actually want to run the db for a month with a million concurrent read and writes 😭

lyric mountain
#

damn, 1.6m

humble gyro
#

serverless is scary man

#

1 ddos and ur wallet is inverted

wheat mesa
#

I wonder how many times these serverless providers get a huge tax break from writing things off as a “loss” bc the customer didn’t pay

lyric mountain
#

wait, if it's 1.6m for 1m writes, doesn't that make it $1.64 per row?

humble gyro
#

its 1m concurrent requests for a month

#

so you would actually do like

#

a gazillion requests over the span of a month

lyric mountain
#

ah, right

#

30m reqs

humble gyro
#

no actual gazillion

#

1m concurrent means they all run at the same time, not per day MONKA

#

tbf it's still a cheap service with that pricing

long marsh
#

Ah shit - I didn’t mean concurrent … and I still got the calc wrong anyways lol

humble gyro
#

1m req is less than 10$ yea

long marsh
#

I meant millions per day

humble gyro
#

ahh kk

long marsh
#

Not concurrently running

#

My fault there lmao

humble gyro
#

fair enough then

long marsh
#

To support millions of requests per day on a SQL workload (obviously a lot of details are needed), but what would likely be the minimum compute for basic transactions?

#

Or is that just so broad of a question that it’s unanswerable?

spark flint
#

i got billed $50 this week because my db suddenly got loads of new data in

#

now i selfhost sqllite DB and ported the worker code into standard js

#

plus i do hourly backups of the db so it doesn't matter if anything happens

humble gyro
#

i hate

#

web dev

spark flint
#

real

#

im making a full website for my school project (even tho i don't actually need anything more than a prototype)

long marsh
#

Using DynamoDB with 12 concurrent reads / writes every second with data less than 1 kb - that’s over 1,000,000 writes / 1,000,000 reads per day

spark flint
#

and its a lot

#

oh i was doing 2800x the reads lol

long marsh
#

We’re talking $10/total monthly

humble gyro
spark flint
#

i'd still selfhost your own sql tbh

#

much cheaper

#

by far

#

and if you scale, theyre your limitation

humble gyro
#

depends

long marsh
#

You sure it’s worth the maintenance costs?

humble gyro
#

sounds like he solved scale

neon leaf
spark flint
neon leaf
#

selfhosted ftw

humble gyro
#

until it goes down

long marsh
#

Idk about all that - it comes at a cost lol

neon leaf
#

got postgres on 4 vps in 3 locations

#

need the speed

long marsh
#

DynamoDB surely will never go down

#

My wallet will go down first lmao

humble gyro
#

and u spend 4 hours re-creating your sql server vm lol

long marsh
#

Yep

lyric mountain
neon leaf
lyric mountain
#

nice

spark flint
#

smide found it

humble gyro
#

redundency mode over different datacenters is insane

neon leaf
#

even if the master goes down, the 2nd db in eu can be repromoted to master

spark flint
#

i have the essential worker nodes running on 4 different servers in different datacenters with different providers KEKW

humble gyro
#

that's some real overengineering

spark flint
#

well if its receiving millions of requests a day

long marsh
#

At a minimum, I’d want a managed RDS solution - which would already cost me $15/mon upfront .. for the lowest tier

neon leaf
#

nah Ive gotten sick of cloudflare d1, and all other cloud sql solutions sucked

spark flint
#

one node used to crash on me and i'd have to wake up at stupid oclock to fix it, now it auto does it

neon leaf
#

so I just decided on this setup

humble gyro
#

keep ur db centralized

spark flint
#

it uses a hosted db

#

so replication isn't needed

humble gyro
#

can u post that in one message so i can star it

spark flint
#

😭

#

its worked well for 2 years

humble gyro
#

its ok

#

backups are replication too

spark flint
#

and a lot of the cost is offset by cloud providers liking me becauae of what the project is

#

i dont pay for cf load balancing with 4 nodes

#

i dont pay for 3/4 machines

neon leaf
#

I pay for all 4 vps but its very reasonable

#

~45€ for the entire project

lyric mountain
#

the server: on fire
the mirrors: inexistent
the backup: on the server
the mood: in shambles

spark flint
#

if i was to pay it would only be $15/month

long marsh
#

$12/mon for 100 reads/writes per second for dynamo db

long marsh
#

That’s like 8m requests per day read / write … for $12

neon leaf
#

thats the most important part

#

need to test the infra yknow

long marsh
#

I do sacrifice queryability though

quartz kindle
#

meanwhile me with 3 months of unpushed changes

spark flint
#

lol

neon leaf
#

yeah idk if dynamo would survive my cursed queries

#

that are longer than actual code

long marsh
#

lol

quartz kindle
neon leaf
quartz kindle
#

totally not cursed

neon leaf
#

thats on you for having tabs that are 8 spaces wide

#

:P

quartz kindle
#

thats still 18 fucking tabs in one line

humble gyro
neon leaf
quartz kindle
#

in order to remember what i was doing

#

thats why its still unreleased after 5 years

neon leaf
#

everytime theres an issue with my query I sink 5k€ deeper into therapy costs

long marsh
#

Just release it.. screw it. Get initial feedback and improve from there

quartz kindle
#

i just started doing therapy 2 weeks ago lmao

#

but for other reasons, not coding reasons

shadow trellis
#

Greeting devs, does some know if past two days without a response from discord for my Intent application is it normal to take that time?

quartz kindle
#

no idea, but back in my time applications used to take up to 4 weeks lol

#

but afaik recently they are much more automated

#

i dont know what is the average waiting time, but consireding intents require human review, im guessing around a week or two

shadow trellis
#

I've send for now three intent applications, two got denied and it was like 15 minutes to get a response and now on the third time its getting two days?

quartz kindle
#

no idea

#

maybe they put you on timeout for too many attempts?

shadow trellis
#

Maybe could be that

neon leaf
#

may my code be cursed for all eternity

shadow trellis
#

I'll wait then

quartz kindle
#

noob dev: uh cool code
pro dev: what the fuck

neon leaf
#

best part is this works amazingly

deft wolf
quartz kindle
#

wait discord added zstd back again?

#

didnt they remove it years ago

neon leaf
quartz kindle
#

i just read the first two lines and wanted to puke

neon leaf
#

good

#

took me ~6h to write

quartz kindle
neon leaf
#

same

#

I have the advantage of being bored in school tho

quartz kindle
#

i have the disadvantage of being bored in life

#

so i do nothing but procrastinate

#

but im doing therapy now and my therapist is kicking my ass and making me do things

lament rock
#

I have the disadvantage

long marsh
#

I have the opposite problem: I'm so busy that all I crave is being able to be bored.

rugged dawn
#

this

prime cliff
#

vibecat Much better

quartz kindle
#

lmao wtf

solemn latch
#

You made development ^-^

quartz kindle
#

thats my first time seeing that convo

#

lmao

pine willow
#

Approved

proven lantern
#

are we allowed to talk about ideas for monetizing our bots here?

solemn latch
#

I dont see why not.

proven lantern
# solemn latch I dont see why not.

my bot has an entitlement sku thingy and i'd want to go over the current offering and see if too many features are free or too many locked behind the paywall. but that might be advertising

solemn latch
#

tbh, if anyone on the mod team gives you a warning for that... I'll take the warning too ^-^

proven lantern
#

i dont get warnings

#

maybe because i dont have my DMs open

tacit estuary
#

What is the best way to deal with time in python/discord.py? I use datetime but I'm trying to do a check that would prevent a user from accessing certain data they created until 1 hour goes by.

Was hoping there was like a unit thing that was in seconds that can be used subtract the values from each other and then when time is displayed, it can be converted to normal time with date and all that.

proven lantern
tacit estuary
#

I can work with that... maybe. I'll do some tests.

#

Okay, I'm stuck again. The dates spit out looking like this

2025-01-23 21:34:23.214854
2025-01-23 22:34:23.214854

and like how would you go about doing a check to make sure one hour or whatever has went by? You can't subtract those two default dates from each other.

proven lantern
tacit estuary
#
@client.command()
async def time(ctx):
    date_string = "2025-01-23 21:34:23.214854"
    date_obj = datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f')
    current = datetime.now()
    difference = current - date_obj
    print(type(difference))
    await ctx.send(difference)
    houred = "01:00:00.0"
    date_obj2 = datetime.strptime(houred, '%H:%M:%S.%f')
    if difference >= date_obj2:
        print("TrueA")
    else:
        print("FalseA")

This what I been experimenting with. Not even tested this out yet.

#

TypeError: '>=' not supported between instances of 'datetime.timedelta' and 'datetime.datetime'

#

I got it!

#
@client.command()
async def time(ctx):
    date_string = "2025-01-23 21:34:23.214854"
    date_obj = datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f')
    date_obj2 = date_obj + timedelta(hours=1)
    current = datetime.now()
    if current >= date_obj2:
        print("TrueA")
    else:
        print("FalseA")
#

I had to think about it differently.

radiant kraken
#

what are you trying to achieve with the time command

tacit estuary
#

It serves no purpose. I kept it there to show me how to turn a date and time into a date type object instead of a str type object.

#

1: The users date and time is recorded plus other data.

2: User can not see their data until one hour goes by. <-- Basically trying to get this to happen.

radiant kraken
#

you could use a more object-free version by using the time module:```py
import time

current_timestamp = time.time()
next_hour = current_timestamp + 3600

if time.time() >= next_hour:
print('true')
else:
print('false')

#

saves a lot of overhead

tacit estuary
#

But can that be converted and shown as a date and time?

radiant kraken
#

yes

tacit estuary
#

Well, I will definitely look into that. Definitely looks simplified.

radiant kraken
tacit estuary
#

Did you just shortened that long mess into only 2 letters?

radiant kraken
#

i recommend you using datetime only if you want to format your timestamp to a readable string

proven lantern
#

from datetime import timedelta
timedelta is a neat package too

radiant kraken
#

you would rarely want to use timedelta imo

#

i love using numbers more

lyric mountain
#

epoch timestamps have much more flexibility than objects yeah

lament rock
#

every time I have to edit my blender 3D python scripts, I'm reminded how much I dislike py syntax

radiant kraken
#

python syntax is peak

wheat mesa
radiant kraken
#

hot take but python syntax is simplistic yet beautiful

#

i love their use of indentation

#

you should have no problem with indentation unless you code in like notepad

bitter granite
#

Common null win

wheat mesa
#

I absolutely despise the lack of brackets and parentheses

#

Whitespace controlling scope is a terrifying idea

bitter granite
#

few semester ago... my teamate code is a hot mess
some function are one liner

wheat mesa
#

Set up a linter

lyric mountain
radiant kraken
#

i hate ```
}
}
}
}
}
}

lyric mountain
#

(for python) ```





pearl trail
#

🤢

wheat mesa
radiant kraken
craggy pine
quartz kindle
#

byethon

carmine root
#

hello how to put your site here on our bot's page?

lyric mountain
#

iframe

#

<iframe src="your site url"></iframe>

carmine root
#

thx

tacit estuary
tacit estuary
solemn latch
#

join join join

queen needle
#

In a programming language, where is something like string templating done? Right now I have my lexer done and am working on finishing my parser, and I just got strings done, and was wondering does it happen here, or does it happen in the interpreter? I assume interpreter to make sure the variable used is valid but I am unsure

#

and to add onto that, is the interpreter also where duplicate variable errors are thrown

#

or object key errors and such

lament rock
wheat mesa
#

Duplicate variable errors are generally thrown in the semantic analysis phase, which is done after parsing. It’s “optional”, but highly recommended to detect semantic errors before running any code

queen needle
#

ohh so it's the interpreter or am i missing a step

#

I thought it went

source -> lexer -> parser -> interpreter

wheat mesa
#

Interpreter

queen needle
wheat mesa
#

There is usually more steps between parsing and interpreting

queen needle
#

I've been trying to read about top descent recursive parsers(or whatever the name is) all day, but am still slightly confused on a lot of what the articles i've read mean

wheat mesa
#

Yes, there is usually a semantic analysis phase where you look at the AST for typechecking, making sure variable names exist, checking scope, etc.

#

Recursive descent parsers?

queen needle
#

Yes

#

i keep thinking top down because there are top down and bottom up parsers

wheat mesa
#

Recursive descent is a top down parser

#

There are bottom up parsers but those are usually more complex to roll by hand

queen needle
#

I had already dealt with top down in the past that's why I was going to stick with it

wheat mesa
#

There’s a whole bunch of theory behind it, but basically you have sets of “terminals” and “nonterminals”

#

Terminals being literals that are the simplest form of a syntactic structure

#

Nonterminals being collections of other nonterminals and/or terminals

queen needle
#

Can you give an example?

wheat mesa
#

Sure

queen needle
#

In a video I watched that was mentioned but I could have sworn I saw him say ( for both terminal and non terminal

wheat mesa
#

<Expression> ::= <Term> "+" <Expression> | <Term>
<Term> ::= <Factor> "*" <Term> | <Factor>
<Factor> ::= "(" <Expression> ")" | "number"
#

Expression, term, and factor are “nonterminals”

#

The symbols you see in quotes are terminals, e.g. literal symbols

queen needle
#

ohh

wheat mesa
#

But this is how you would formally define language grammars

queen needle
#

Okay, so if I am not following that I don't technically have a Recursive descent parser

wheat mesa
#

And it’s very useful to have this definition for recursive descent

#

That’s not necessarily true

queen needle
#
parse(): Program {
    const program: Program = {
      kind: "Program",
      start: 0,
      end: this.column,
      body: [],
    };

    while (this.not_eof()) {
      program.body.push(this.parse_stmt());
    }

    return program;
  }

  private parse_stmt(): Stmt {
    switch (this.at().type) {
      case TokenType.DEF:
        return this.parse_define();
      default:
        throw new Error(`Unexpected token type: ${this.at().type}`);
    }
  }
``` this is the "main" logic behind my parser rn(don't say anything about this being in typescript, i want to write it in a language i know well first)
wheat mesa
#

The main issue with recursive descent is that it is incapable of parsing Left Recursive grammars, hence why many grammars avoid left recursion for this reason

wheat mesa
#

It is also important to note the distinction between expressions and statements

#

Expressions return a value of some sort, statements are standalone units that “do” something (usually)

queen needle
#

so a statements are variables, numbers, strings, expressions are functions?

wheat mesa
queen needle
#

ohh

#

booleans are expressions too then

#

but functions and variables aren't

wheat mesa
#

Yes

#

Exactly

#

Think about it like this, if you can assign it to a variable, it’s an expression. If you can’t, it’s probably a statement

queen needle
#
private parse_statement(): Statement {
    switch (this.at().type) {
      case TokenType.DEF:
        return this.parse_define();
      default:
        throw new Error(`Unexpected token type: ${this.at().type}`);
    }
  }```

```ts
private parse_define(): Statement {
    this.eat();
    const identifier = this.expect(
      TokenType.IDENTIFIER,
      'Variable name expected following "define" statement.'
    ).value;

    const value = this.parse_expression();
  
    const declaration = {
      kind: "DefineDeclaration",
      value,
      identifier,
    } as DefineDeclaration;
    return declaration;
  }```

```ts
private parse_expression(): Expr {
    switch (this.at().type) {
      case TokenType.INTEGER:
      case TokenType.FLOAT:
        return this.parse_number();
      case TokenType.STRING:
        return this.parse_string();
      default:
        throw new Error(
          `Unexpected token type in expression: ${this.at().type}`
        );
    }
  }```
#

so then this logic goes with that

#

(i removed the error checking from the define just for the sake of sending in discord)

wheat mesa
#

Seems about right

#

If you’d like to look at a language that handles ASTs very elegantly, I’d look into making your language in Rust. They have very powerful enums

queen needle
#

Now i am just struggling about like booleans, because js let x = true; has a boolean value, but so does js let x = (y && z); I know that there are the left right and operator but I am not quite sure about how that should work, in relation to my current format

wheat mesa
#

Yes, true is an expression and so is (y && z)

queen needle
wheat mesa
#

True is a Literal, y && x is a BinaryExpr with a left value of a VariableGet an operator of AND and a right value of VariableGet

wheat mesa
#

It’s free and online

queen needle
wheat mesa
#

I wouldn’t look at an existing language, since it might be a bit overwhelming

queen needle
#

This is fair

wheat mesa
#

Understand the fundamentals first by following along with crafting interpreters or another resource of your choice. Language grammar is a very theory heavy subject and there is a lot to learn

#

Start with something simple like a math expression parser

queen needle
wheat mesa
#

Try to get precedence working then maybe add more things like boolean logic expressions, etc

wheat mesa
queen needle
wheat mesa
#

I’d recommend just reading the original book. It shows every line of code and explains things very nicely

#

Yes

#

That one

queen needle
#

Awesome

#

Thank you

#

Just thinking about it though, for those boolean expressions, and for variables in general, do I just peek at what the character is, i.e [ I know it's an array and I handle the accordingly, or { I know it's an object and handle that accordingly, or " string but then parenthesis ( I handle because it could be boolean expression or math expression?

wheat mesa
#

A well planned grammar usually only needs one token of lookahead, though there may be cases where you need 2+

queen needle
#

everytime I try and think about the parser my brain just melts, the lexer was easy, because it's like, i have variable parsing working def x = 5; parses but if i type just 5; or 5 it errors, now i know that's because I don't handle those yet but still

wheat mesa
#

Your lexer should not care about if something is semantically correct. It should only care about parsing keywords and literals and identifiers etc into tokens

#

Lexing is entirely separate from parsing

#

5; should not error in your lexer

queen needle
#

I meant from my parser

wheat mesa
#

It should produce
[NUMBER(5), SEMI]

queen needle
#

my lexer works great (for a little while it couldn't handle mutiline inputs, i was being stupid)

#
[
  Token {
    value: '5',
    type: 0,
    position: Position { line: 1, column: 1 }
  },
  Token {
    value: ';',
    type: 21,
    position: Position { line: 1, column: 2 }
  },
  Token {
    value: '',
    type: 48,
    position: Position { line: 1, column: 2 }
  }
]```
#

for that of 5;

wheat mesa
#

That’s something that should error in the semantic analysis phase (or maybe not, depending on whether or not you want to allow that)

queen needle
#
private parse_statement(): Statement {
    switch (this.at().type) {
      case TokenType.DEF:
        return this.parse_define();
      default:
        throw new Error(`Unexpected token type: ${this.at().type}`);
    }
  }```
#

it errors because I only check variable creation rn

wheat mesa
#

Parsing is transforming any valid grammar into a tree. Grammar does not necessarily mean that the actual meaning of the tree is valid, but rather that it abides by the defined grammar of the language

queen needle
#

I remember you had one in C#

wheat mesa
#

Hopefully it’s not too difficult to understand even if you don’t know rust

#

I do as well, I’ll send that

queen needle
#

I've looked at the C# one before, when I made a math parser in the past

wheat mesa
#

I highly recommend defining a formal grammar for your language before attempting to make the parser for it. It’s very difficult without it

queen needle
#

as in like, how I want it all to look in use?

#

I know how I want it all to be used

wheat mesa
#

No, the regular expression grammar for it

queen needle
#

Similar to what you showed earlier?

wheat mesa
#

Crafting Interpreters shows you how to define one

#

Yeah like that one from earlier

queen needle
#

ohh so for your math parser(rust) you assume there is always a operator and right term?

wheat mesa
queen needle
#

how so?

vital mirage
#

Why is the capital version of my bots username unavailable wtf, it says add . or _, but lowercase is just fine

wheat mesa
#

The “return” value of 5 is 5

queen needle
#

Then i must be a bit lost in the logic

wheat mesa
# queen needle Then i must be a bit lost in the logic

It helps to understand when you’ve defined the formal logic. An expression can be in many forms. A literal is an expression, a BinaryExpr is an expression that takes a left hand side Expression, an operator, and a right hand side Expression. A UnaryExpr is an expression, etc.

queen needle
#

Well i see it parsing terms but i only see it parsing additive terms

#

orfactor terms

#

i don't see where it returns just a number

wheat mesa
queen needle
#

yes

wheat mesa
queen needle
#

Oh so you calllogic binary, which calls term, which calls factor, which calls power, which callsunary, which is where primary is called which has that

wheat mesa
#

Yup

queen needle
#

how does that work? like why do you call them in that order?

wheat mesa
#

Precedence

queen needle
#

how does that precedence translate to a normal language?

wheat mesa
#

Primary has highest precedence (since obv you want to parse a literal before parsing the expression its a part of)

#

Unary next (e.g. 3 + -5 should return -2 and not an error)

#

Power next (3^2 + -5 should return 4)

#

Etc.

queen needle
#

hmm

#

there's this language code im looking it ts switch (this.at().type) { case TokenType.Let: case TokenType.Const: return this.parse_var_declaration(); case TokenType.Fn: return this.parse_function_declaration(); case TokenType.If: return this.parse_if_statement(); case TokenType.For: return this.parse_for_statement(); case TokenType.NewLine: this.at(); return this.parse_stmt(); default: return this.parse_expr(); }

#

And now it makes way more sense

wheat mesa
#

Yeah. You can have a stmt containing an expression

#

That's why rust enums are so nice for this, they can have inner values

#

Tagged unions are beautiful

queen needle
#
private parse_expr(): Expr {
    const data = this.parse_assignment_expr();

    if (this.at().type == TokenType.Ternary) {
      if (data.kind != "BinaryExpr" && data.kind != "Identifier") {
        throw new Error(
          "Expected BinaryExpr or Identifier following ternary expression."
        );
      }
      this.eat();

      const expr = this.parse_expr();

      if (expr.kind != "BinaryExpr" || (expr as BinaryExpr).operator != "|") {
        throw new Error(
          'Bar ("|") expected following left side of ternary operator ("->").'
        );
      }

      const ifStmt = {
        kind: "IfStatement",
        test: data,
        body: [(expr as BinaryExpr).left],
        alternate: [(expr as BinaryExpr).right],
      } as IfStatement;
      return {
        kind: "CallExpr",
        args: [],
        caller: {
          kind: "FunctionDeclaration",
          parameters: [],
          name: "<anonymous>",
          body: [ifStmt],
        } as FunctionDeclaration,
      } as CallExpr;
    }

    return data;
  }```
#

from that same code, that also explans this

#

and why it does it like that

wheat mesa
#

Yes

#

This looks questionable in terms of quality though

#

Telling kind based on a string instead of enum

#

Kinda ugly

queen needle
#

I am using that code as a refrence but am not using it exactly

#

I don't do that

wheat mesa
#

In rust you can do beautiful things like so

enum Expr {
    Literal(LiteralValue)
    BinaryExpr(Box<Expr>, BinOp, Box<Expr>)
    UnaryExpr(UnaryOp, Box<Expr>)
    // etc...
}

enum LiteralValue {
    String(String)
    Integer(i32)
    Float(f32)
    // etc...
}

enum BinOp {
    Plus,
    Minus,
    Star,
    Slash
}

enum UnaryOp {
    Bang,
    Negate
}
queen needle
#

oh that is nice

wheat mesa
#

Recursive enum definition makes ASTs super easy to type out

queen needle
#
export enum TokenType {
    INTEGER,
    FLOAT,
    STRING,
    BOOLEAN,
    IDENTIFIER,
  
    DEF,
    FN,
    FOR,
    WHILE,
    IF,
    ELSE,
    ELSE_IF,
    IMPORT,
    GLOBAL,
  
    LPAREN,
    RPAREN,
    LBRACKET,
    RBRACKET,
    LBRACE,
    RBRACE,
    COLON,
    SEMICOLON,
    COMMA,

  
    ADD,
    SUBTRACT,
    MULTIPLY,
    DIVIDE,
    POWER,
    MODULO,
    EQUALS,
    PLUS_EQUALS,
    MINUS_EQUALS,
    MULTIPLY_EQUALS,
    DIVIDE_EQUALS,
  
    GREATER,
    LESS,
    GREATER_EQUALS,
    LESS_EQUALS,
    AND,
    OR,
    DOT,
    RANGE,
    ARROW,
  
    RETURN,
  
    COMPARE_EQUALS,
    NOT_EQUALS,
  
    UNKNOWN,
    NEWLINE,
  
    EOF,
  }```
#

I have this lmao

wheat mesa
#

And you can do things like so: ```rs
match someExpression {
BinaryExpr(lhs, op, rhs) => interpret_binary(lhs, op, rhs)
// ...
}

queen needle
#

that's nice

covert gale
pearl trail
#

huh, am i trippin' or what

#

i am indeed

pearl trail
#

heck yeah thanks rider for not letting me know that "Apply Changes" button i pressed didn't actually hot reload the program, so what i did for the past 15 minutes has no effect at all

tulip ledge
#

ehh I guess you still have to match inside

#

nvm I guess

tulip ledge
queen needle
#

I would love thet

frosty gale
#

i have yet to make my first trait in rust

tulip ledge
#

traits are amazing

scenic kelp
#

i see lang dev talk up there 😈

scenic kelp
#

if you know typescript you can achieve much the same

frosty gale
#

ive come from c/c++ so i usually write my code around the cool new features languages have lol

#

also prefer as little runtime supported features as possible

tulip ledge
scenic kelp
#

you can write a lot of code without ever needing to use traits

#

just like you can write a lot of code without ever needing inheritance

wheat mesa
#

I try to avoid writing traits most of the time. I find that writing code with traits leads me down a questionable path of trying to implement polymorphism in rust, which is not something rust excels at

frosty gale
#

the only traits i really use are derived ones from libraries or whatever like debug, serde, etc

#

this just looks like templating in c++

#

another feature i dont use often, only for things like implementing hashmaps from scratch though where you want to be able to take in strings, ints, complex types etc without copy and pasting for each different type

vocal knot
quartz kindle
#

wat

deft wolf
#

It's a normal thing, people often bypass bot limits per server this way

zinc aspen
#

@shell echo prefix

bitter granite
pine willow
#

I would instantly kick the bot and never use it again lmao

deft wolf
#

Probably limits related to a free API or something

pine willow
bitter granite
#

it was a normal kick/ban/mute

pine willow
#

💀

bitter granite
#

wants u to pay premium

deft wolf
pine willow
bitter granite
bitter granite
pine willow
#

lmfao

#

All my bots are free2use unless some Premium features (High detailed AI Image generation etc)

pine willow
#

Free users have no limits on free features, but they are limited in that they cannot access the best AI image generation models.

vocal knot
#

my bot only limits to now 6 different blusky account per server why would someone need 48 bluesky account LOL

bitter granite
#

like for example csgo server

#

and they want to get notif from alot of streammer/profile

#

or maybe each country has each accounta like valorant

vocal knot
#

maybe

vocal knot
#

also why create 8 servers to add the bot to instead of asking bot owner if there's a way LOL

sharp geyser
#
PS C:\Users\dyeaa\Dev\Mercatus> npx tailwindcss
npm error could not determine executable to run

wtf does this mean

#

Does npx not install it if it doesn't exist

vocal knot
sharp geyser
#

I only use npm for tailwind

#

so I somehow doubt that unless they pushed a bad update

vocal knot
#

or the package name could wrong idk never got that error

#

I'd check but cat is laying on me lol

sharp geyser
#

I see

#

so v4 is different now apparently

#

No longer do you use a tailwindcss.config.js file

#

Which sucks for me

vocal knot
#

tailwind doc updated very recently

sharp geyser
#
.btn {
    @apply border-solid border-2 border-gray-200;
}

Seems like the resulting css is empty

#

Is this not how you apply tailwind attributes to a css class?

pearl trail
#

just to make sure, you indeed imported the tailwind right?

@tailwind base; 
@tailwind components; 
@tailwind utilities; 
``` because that apply should work
sharp geyser
#

I guess because I wasn't using it in the file that used the tailwind directives it wont

small tangle
#

Are the css utilities shipped with mudblazor insufficient or why do you use tailwind for the styling? pikathink

uncut nexus
#

Promocode

real rose
frosty gale
#
.btn {
  border: solid; border-width: 2; border-color: gray;
}
pearl trail
#

lmao

frosty gale
#

or even better

.btn {
  border: 2px solid gray;
}

although id argue first is more readable

sharp geyser
lyric mountain
#

eventually tailwind will go a full circle and become css again

pearl trail
#

hello there

#

@oak cliff

#

womp

oak cliff
#

idk how it got through here but got blocked in all the other channels HMM

pearl trail
deft wolf
#

This channel lives its own life. The whole world has forgotten about its existence kappalul

quartz kindle
#

welcome to where the magic happens

small tangle
quartz kindle
small tangle
deft wolf
quartz kindle
#

currently at 111 uncommited files changed

#

i run my code in my mind

wheat mesa
solemn latch
#

👀 I have 89 right now. and I feel bad about it.

#

Thankfully its just my own project.

neon leaf
#

I always end up with 1 commit per feature

#

so its sometimes 200+ files

wheat mesa
neon leaf
#

nah

limpid onyx
#

What if there's a problem and you lose everything because you didn't commit?

neon leaf
#

then I would be concerned since everything is backed up 5 times

wheat mesa
neon leaf
#

too much creativity needed for commit names

wheat mesa
#

if it's a personal project just go with "idk whatever idc"

neon leaf
#

sadly its not personal

wheat mesa
#

Helps to rollback commits too or git bisect

neon leaf
#

my usual other reason is to not leave the project in a broken state after a commit

#

since I rollback based on git hashes so its faster to undeploy

#

and being able to choose any commit and it works is nice

wheat mesa
#

Hence the point of squashing

#

If you squash your merge into one commit, assuming that your feature works, it will be a working state

#

But whilst you're developing it, it's useful to commit partially through so you can rollback after you have one part working, another, etc