#We're making a wrapper over the Discord API using Java!!

1 messages · Page 3 of 1

light loom
#

i'll solo it; it's not hard to maintain a version of main to support another version

oak flare
#

not worth it

steep spruce
#

in rare senarios the only time 8 and 11 will be used in discord development is when linking like 1.8 servers or 1.12.2 servers that aren't even paper

oak flare
#

you are the reason why people still use old java versions

#

because you still support

#

instead of enforcing latest

light loom
#

we're not even using java 17+ features?

#

not that i've seen

#

it's compiled and developed in 21 right now but we're not using any weird syntax

steep spruce
#

records are java 16 features

light loom
#

17+

oak flare
#

what about virtual threads and stuff like that? wont we use that?

light loom
#

nope, no use for them

steep spruce
oak flare
steep spruce
#

what about variable instanceof SomeClass newVar expression

#

or pattern matching

light loom
#

java http and vert.x use their own threads, we just maintain 1 platform thread for event dispatching

oak flare
light loom
#

who's they?

steep spruce
#

well

#

they make their own virtual theeads

#

iirc

plain ledge
light loom
plain ledge
#

Exactly

oak flare
#

anyways all that is not a reason to have some branch with outdated version

plain ledge
#

It’s kinda bloated just for a ws

light loom
#

yeah but whatever library we switch to will handle mutli threading within itself

#

anything on maven supports LTS

plain ledge
#

Isn’t LTS 17?

light loom
#

yes

plain ledge
#

So why should we support below LTS

light loom
#

we shouldn';t - i thought 11 was LTS by mistake

oak flare
light loom
#

it's not anymore

oak flare
#

ah you mean anymore

#

just use latest

#

...

light loom
#

we're developing with latest

#

but there's no java 21 features used rn

#

just by chance, it compiles in java 17

#

and we're almost done so there's no need to enforce 21 if we're not using 21 internally anyway

plain ledge
#

Are you debating supporting 8 still?

steep spruce
light loom
plain ledge
#

We don’t use any 21 specific stuff do we

plain ledge
light loom
light loom
steep spruce
oak flare
#

string templates are preview though

steep spruce
oak flare
#

but yeah record patterns and pattern matching etc

plain ledge
#

¯_(ツ)_/¯

#

What are record patterns

light loom
oak flare
light loom
#

compiled in java 17

#

the thing is, we have no usecase right now for java 21 features

plain ledge
oak flare
light loom
#

take a look at the codebase and lemmie know if you find any potential areas to use it

#

our records are just data containers for the discord responses

#

we don't do any logic on them

#

i don't care if you use java 21 features if there's a real need for it - there's no point in doing it if it's gonna be for a single method

#

because we'd break 17 support for 5-lines of code, that isn't worth it

oak flare
#

there is also no point in supporting older versions instead of enforcing latest version

light loom
#

there is because people use java 17

oak flare
#

people that use java 17 use java 21 lmao

#

biggest problem are people stuck on java 8, but anyone that knows of java 17 also knows of java 21 and how to upgrade if not already using it

light loom
#

i need another expert to chime into this conversation

#

on whether it's a bad idea to support java 17 and just to enforce java 21 (even though we're not even using java 21 features pepekek )

#

maybe @sharp ferry

oak flare
#

(even though we're not even using java 21 features pepekek )
I wouldnt be surprised if any library like vert.x etc use virtual threads internally which got several benefits

light loom
#

you should never use virtual threads for threads that are long running

#

that's not what they exist for

oak flare
#

not everything needs long running threads though

light loom
#

but we have no requirement or need to multi thread

#

should we multi thread json parsing? for what benefit?

oak flare
#

I aint saying that

#

whatever

#

...

light loom
#

it makes no sense to multi thread an application that does not benefit from mutli threading

#

virtual threads isn't an argument beause the multi threading we are doing is handled by the libraries we are using, our application only needs 1 thread

oak flare
#

I was talking about the libraries

#

anyways

light loom
#

but using virtual threads will not improve performance

#

they're just lighter to spawn but we're not spawning any, neither are our dependencies

oak flare
#

ik

steep spruce
sharp ferry
steep spruce
#

JVM and byte code changes from version to version

light loom
sharp ferry
#

you can't say 11 is no longer lts but 17 is

light loom
#

oh wow the website i looked at said it wasn't

#

lmao

#

but oracle says it is

#

😦

#

my google sucks 😄

sharp ferry
# light loom https://www.oracle.com/uk/java/technologies/java-se-support-roadmap.html#:~:text...

The Java language has undergone several changes since JDK 1.0 as well as numerous additions of classes and packages to the standard library. Since J2SE 1.4, the evolution of the Java language has been governed by the Java Community Process (JCP), which uses Java Specification Requests (JSRs) to propose and specify additions and changes to the Ja...

light loom
#

at the least, our code compiles in java 17 at the current moment, so there's no advantage for anybody for us to compile in 21 and release that

sharp ferry
#

As a rule of thumbs, regular versions last until the next version, and LTS last until next LTS

#

so since 21 is a LTS

#

Supported versions are 21 and 22

light loom
#

it's 4 release versions

sharp ferry
light loom
#

yeah looking now

steep spruce
light loom
#

an end user can compile in any version that is java 17+

#

if they want to use 21 they can

#

but they can't use 17 if we compile in 21

#

but we don't use 21 anyway just out of pure luck - so why compile in 21 anyway ?

sharp ferry
#

So, old project won't probably pick your libs anyway, only new projects would

light loom
#

yeah

#

exactly

sharp ferry
sharp ferry
oak flare
#

I am saying enforce latest or latest lts, idc if people are stuck on java 17 ngl

light loom
#

if we don't use 21 there's no need to force an upgrade for endusers

#

once we use 21 we can then say "hey peeps, you need java 21 because we use xyz features"

#

such as virtual threads

oak flare
#

I know but whats against enforcing it, then people arent stuck on java 17 and you help everyone

light loom
#

it's just giving freedom of choice to the best of our ability

#

because how can we be competitive? if JDA supports java 11 for example and your system is using java 11, then you'll use JDA

oak flare
#

imagine using java 11

light loom
#

because you just wanna create a discord bot and you'll use whatever framework that runs on your system

plain ledge
#

Or most Minecraft servers run 17

#

(Excluding all the 8)

light loom
#

yeah at the least we support 17 😄

oak flare
#

I am just trolling at this point anyways

#

so dont take me serious pepekek

plain ledge
oak flare
#

I am just against people using old versions if you can literally use latest/latest LTS

steep spruce
#

a bit more

light loom
#

yeah i get that - i would always say use java 21 but this situation is different, we want to be usable by as many people as possible out of the box

plain ledge
#

1.20?

light loom
#

but if we have a real need for 21 (for example we actually use virtual threads) then so be it, we have a java 21 dependency

steep spruce
#

on paper docs

#

on 1.20.5 21 is required

plain ledge
#

I thought paper recommended 17?

steep spruce
plain ledge
#

Ah strange

steep spruce
#

for 1.17.1+ required is 17
for 1.20.5 it's 21

sharp ferry
#

Each version of minecraft require a different version of java

#

and the reason people use some version over others is either because of mods, or because of performences

plain ledge
#

Whenever I dev’d for mc sfuff I mostly did 8 and 17

light loom
#

but i gotta admit the framework we've built is kinda sexy peepo_comfy

steep spruce
#

im gonna study and in my free time I'll continue writing my Minecraft inventories library

unrelated here but I'm upgrading it to 3.0.0 hehe

steep spruce
#

@light loom
ever thought about this just being called GuildMetadata?

#

uhh I shat my pants

light loom
steep spruce
light loom
#

yes

steep spruce
#

without.. using events?

#

is there slash commands?

light loom
#

there technically is just not tested and it's too "raw" for end users

#

that's why we have a spike! 🙂

steep spruce
#

okay so I have an idea

light loom
#

feel free to pick up the spike ticket @steep spruce peepo_heart

#

or drop your suggestions, would be good to do it on github though so it's all documented

steep spruce
#

(I'll add this to GH when I have time dw)

light loom
#

yeah I was thinking we can mark a method with a SlashCommand object return type for example

#

that it uses that

steep spruce
#

yeah! exactly

light loom
#

e.g. java @SlashCommand public SlashCommand ping() { return new SlashCommand("ping").addOption(String, "something"); }

steep spruce
light loom
#

ooh yeah

#

using metadata in the annotation would be cool

steep spruce
#

if you want.. idk how to link it to discord but maybe if it hasn't been implemented I can create the annotation parser for it

#

I'd basically make the annotation parser in here, put commands in cache

you guys can just link those slash commands to discord

#

I've done it for minecraft

#

but that code was low-key trash lol I've improved

#

and if needed, I could literally make the registration parallelized and I don't think discord's rate limit would complain (we might need to fact check that tho lol)

#

since yk, it's a lot of reflection xd

light loom
#

sure, you can make a parser just don't do the reflection

light loom
#

If you want I can give you a walk through the codebase tomorrow? @steep spruce

#

It might be worth getting my PR merged in first too, since I completely made :annotations an independent module i.e. if a user doesn't add it to their build then they can't use annotation processing but instead have to manually register the listeners

steep spruce
steep spruce
steep spruce
light loom
#

i mean don't implement it yourself or do that part of the work just yet :p

#

you might find it easier to add/reference the existing stuff

#

my PR has only 1 thing left to do which is finish this damn GuildRequest class

#

but gosh it's do demotivating after have done all the rest and now being on the final but that is just a big one

#

ill no-life today and just get it done

#

because this final PR unblocks all the testing, additional features etc

#

let me do it now, fuck it - eta 2 hours

steep spruce
#

Orr you can make a really good built in library like my idea

light loom
#

wym?

steep spruce
# light loom wym?

for example
commands can either be something like this:

public class PingCommand implements GuildCommand {
    @Override
    public void execute(Member member, String[] args) { ... }
}

which enables extensibility to create your own command libraries

or better, since we are imagining an already fast implementation and really good in general:

@SlashCommand(...)
public class PingCommand {
    @SlashCommandExecution
    public void onPingCommand(Member member, ...) { ... }
}

which allows for easy commands, and also this approach can greatly reduce the amount of reflection (unless the API for internals is really good)

#

since yk, you can already do it in the loop that registers listeners

#

instead of redoing that reflection

light loom
#

we can do that second approach easily

#

and have the power of the first version

#

so adding a SlashCommand listener is no effort there (neither is validation/sending events to it)

#

we can already dynamically invoke the method and pass the correct arguments to it since

#

the only thing we really need to nail is making it nice, pretty and easy for the end user

#

the method name can be anything the end user wants

#

e.g. java @SlashCommand public T helloWorldHandler(...) { ... }

#

the beauty we've added is

#

all parameters are optional

#

if you don't need the Member parameter, no need to add it

#

and realistically, we don't need the class level annotation either, just annotate any method you want with @SlashCommand and it's good to go

#

so u could do something like

plain ledge
#

With named args and types

steep spruce
steep spruce
plain ledge
#

With support for suspend

steep spruce
plain ledge
#

There is a way to use kotlin reflections from java too

steep spruce
plain ledge
#

Nvm, I thought there was a way but idk

#

Yeah, I like the idea of that tree-style annotations

steep spruce
#

my finals start at may 8, and on may 14 I have loads and loads of free time

light loom
#

i don't wanna introduce kotlin pepe_sad

#

reason being, it's adding another tech stack, especially one i'm not familiar with and once we start adding multiple languages, it gets harder to maintain because not everyone will understand it

orchid portal
#

wazei must introduce kotlin

light loom
#

i don't see any performance issues with adding more annotations

#
@SlashCommand(...)
fun onPingCommand() {
    // ...
}
#

so this example would be correct

#

reflection isn't pretty (often confusing to understand) but gosh the end result is insanely sexy

steep spruce
plain ledge
#

A couple of us know kotlin here

#

I’ve done kotlin for 900 (ish) hours

#

Taz knows kotlin too

steep spruce
#

I've seen it execute nearly as fast as direct invocation

steep spruce
#

and it would be an extension not a rewrite

#

public lookups aka
it can use optimized lookups for a public method

with MethodHandles you can also use an optimized method that doesn't check for argument types (is good when you already have the arguments parsed and you know the types, from personal experience tho do not mix with an Object[], instead use a Generic[] but Generic can be anything extending an Object, so same thing but works with a parsed array)

the setup should look like this:
MethodHandles.publicLookup().unreflect(someMethod).invokeExact(Object, ...);

orchid portal
#

that should be enough experience

light loom
steep spruce
#

so I have experience in this kinda, more like experience in parsing String[]

#

but this should be fairly simple and the same

light loom
#

we most likely don't need to do a String[] - we can easily derrive that from the data we receive and the parameters set

light loom
#

for example on the event listeners an optional parameter is Guild and we dynamically construct that using some of the data we receive from the request + cached data

#

just make sure within :core there is a non-annotation version of whatever you do

#

so for the event listeners we have registerEventListener or something available in the Discord class

#

which is for any manual stuff when people opt out of annotations

light loom
#

@orchid portal #86 just GuildRequest needs finishing in :api

#

basically, only 15 methods left

#

those methods need builders as parameters

#

you can see the other ones as examples, it's all commented with TODO so you can see it easy

#

ty peepo_heart

#

method name is pretty much the same name as the discord request e.g.

#
    // TODO:
    public AsyncResponse<Guild> modifyGuild() {
        return responseParser.callAndParse(Guild.class, null);
    }
#

links to

#

ModifyGuildRequest

#

for the name of the builder just use the same name but instead of Request call it Builder

#

required params in the constructor, optionals all get a builder method

orchid portal
#

@light loom what to do with optional?

#

ohh make a builder

#

ugly

#

too draining

#

also y are these not in separate packages

plain ledge
#

Putting them in com.javadiscord.api.builders

#

Since they are user facing

oak flare
#

dm discussions arent helpful for us

#

please discuss here or on github

plain ledge
orchid portal
#

i think htg is too busy someone else should pick up docs

light loom
#

we should start documenting as we write unit tests as that will give the tester an idea of what's going on and can then provide valuable docs

plain ledge
light loom
#

he was doing java docs

plain ledge
#

Also @sand peak what’s going on with the unit test PR, are you writing more tests or is that ready for review?

light loom
#

he's working on it in vc 😄

plain ledge
#

Lmao

light loom
#

@spiral dawn

#

how's this going? 👀

spiral dawn
#

Oh my bad I forgot about it was really busy irl

light loom
#

no worries!

spiral dawn
#

I will be travelling this week I have a funeral to attend.

#

Unless you can wait a week

light loom
#

oh sorry to hear

spiral dawn
#

Upto you

light loom
#

i needed it yesterday

#

just kidding :p - sorry take as long as you need, hope everything is okay

#

@orchid portal just rebased on main - there's the new webhook stuff to do as well :S

#

ExecuteSlackCompatibleWebhookRequest , ExecuteGithubCompatibleWebhookRequest these look interesting af @restive void 😮

#

didn't realize it was supported out of the box by discord

orchid portal
#

dev is going to write tutorials?

#

or just the setup for docs website?

steep spruce
#

so I get to do the reflection then

#

btw the args can't be parsed into something like Member member, String item, Integer number but instead it's gonna be like T extends User memberOrUserDependingOnInterfaceImplementation, Arguments args

#

but I can make it in a way where it is 100% independent of a class, just a method/function if you want

plain ledge
light loom
steep spruce
light loom
#

they for sure can be 🙂

steep spruce
#

if I find a way to allow this then I'll tell you

but basically with annotations it's really easy to just parse into args

light loom
#

yeah

steep spruce
#

if we can do that, it basically defeats 80% of purpose of annotations

#

20% to just provide the name, description, etc etc

and also there should be an annotation for each arg if you want custom and overriden data for that arg

#
public void onPingCommand(Member member, @SlashOption(name = "target", desc = "Who should we ping?", ...) User pinged, ...) { ... }
#

this is kinda a rabbit hole

light loom
#

so that even a usecase to support?

steep spruce
light loom
#

User pinged doesn't seem right to me

#

so we should get the command invoker of course

steep spruce
#

you need to be able to do this somehow someway

light loom
#

but not dynamically find a random user

steep spruce
#

@SlashOption is kinda the best way for it

light loom
#

I would expect the method to be like:

#

@SlashCommand
public void changeNick(User user, Optional<String> nick) {
   nick.ifPresent(s -> user.nick(s));`
}```
#

in the real code you would give a reference to the Guild class

#

public void changeNick(User user, Optional<String> nick, Guild guild) {

#

then guild.member().update(user) or something

steep spruce
#

wdym dynamically find a user

#

like go through all users and find that user or smt?

light loom
#

yeah we don't want that

steep spruce
#

no way lol

#

the user would already provide a mention like
/nick @steep spruce Hello World

#

I'm assuming we are parsing an array of strings

Discord converts a mention like @steep spruce to @steep spruce

#

we can just get the ID easily and convert it to a discord user/member

#

I don't even know anything about discord API except for using a discord wrapper and I can semi-imagine this

light loom
#

ah you mean mentioned users?

steep spruce
#

what were you thinking? xdd

light loom
#

ah okay, if that's the case then sure, but we'd want it a a List<User> mentionedUsers kinda thing

#

i had no idea what you were talking about

#

but it seemed wrong without that context lol

steep spruce
steep spruce
#

users would already be able provide that

#

but most people would want just 1 user for most cases

steep spruce
light loom
#

be careful you don't fall into the trap of having too many parameters and overcomplicated the implementation

#

reason being, this is for end users, it needs to be as easy as possible

#

and with the annotation specifically, we're assuming the user will either

#
  • Figure it out on their own
  • Read the doc
  • Use the hard coded variant
steep spruce
light loom
#
public void onPingCommand(Member member, @SlashOption(name = "target", desc = "Who should we ping?", ...) User pinged, ...) { ... }
#

this?

steep spruce
#

that was an idea

light loom
#

it's similar to Spring/Jackson and whatever else uses annotation method parameters sure

#

I'm okay with this but there's a few things you'll lose too, there's no compile-time validation for example (we already sacrificed that with dynamic method invoking)

steep spruce
light loom
#

mm okay, it'll make more sense once the implementation starts

#

if I can see what you end up making then i should be able to get a better idea

steep spruce
light loom
#

the end user might not do it all at startup for example

#

somebody makes a bot that allows people to create their own slash commands

#

a user might upload the code and inject it like we are during runtime

steep spruce
light loom
#
public void onPingCommand(Member member, @SlashOption(name = "target", desc = "Who should we ping?", ...) User pinged, ...) { ... }
#

so see this

#
@SlashOption(name = "target", desc = "Who should we ping?", ...) User pinged
#

could be a useless parameter if the bootstrapping of the command didn't even specify this

#

i.e. the annotation is inconsistent with the @SlashCommand method parameter

#

so when we invoke it - we're actually invoking it against null and should be throwing an exception "unexpected parameter <name>"

#

and at runtime, you're running this in some headless linux server and might not even see the logs

#

the command will just not be working

#

for those who have no top-level exception handling, will crash their bots

#

that is more so in the case of injecting during runtime after we've done our initial bootstrapping

#

though in CI/CD, somebody commits the wrong code, stuff compiles, it gets deployed but their bot remained offline because we threw at runtime not compile time

#

that's something we have lost already with the :annotations module

steep spruce
light loom
#

but we shouldn't introduce too many areas that problem can occur in

#

yes

#

exactly!

#

which is a TODO that i want to add

steep spruce
#

this issue is also a huge problem with interpreted languages

light loom
#

yeah dynamic languages suck

steep spruce
#

because they are especially vulnerable

light loom
#

stuff like groovy has backward inheritence too

#

e.g. in groovy you get the normal child inherits from parent

#

but you can also

#

dynamically

steep spruce
#

dynamically

light loom
#

parent inherits from child

#

the concept seems cool but once you get an issue, gg can't debug

steep spruce
#

and work better

#

(this is sarcasm if you haven't noticed but I felt somewhere in my heart you haven't noticed)

light loom
#

annotation processing might be a little bit difficult, I haven't looked into it so not sure the javax.annotation.processing api has everything we need out of the box

steep spruce
#

it's our best shot at fixing this problem

light loom
#

it can deffo be done ofc

steep spruce
#

this also proves that annotations are the best way to handle commands

light loom
#

yess

#

the entire annotation system we got going on is so nice and clean and perfect lol

steep spruce
#

lel

#

after FlameWare my old annotation library which I abandoned I haven't worked much with annotation reflection

#

annotation reflection is super easy to me anyways

#

that code is dog shit tho

light loom
#

it's a fun topic anyway 🙂

steep spruce
#

well I can still get on everyday but for a max total of like 3h/d

light loom
#

yeah no rush, we have loads of other stuff in the TODO

steep spruce
#

max

light loom
#

17 issues at the moment + a few more that need to be added

#

and loads of lengthy tasks that need to be done

steep spruce
#

you can put my name

light loom
#

e.g. docs, unit testing etc

steep spruce
#

FlameyosSnowy

#

do you need my email?

light loom
#

can you comment on the issue?

steep spruce
light loom
#

that you'll pick it up or whatever - i just need your interaction in the issue so you'll show up in the list when i assign it

#

for some reason, i can't just type your username in

#

i described the process here anyway

steep spruce
light loom
#

yeah the code is primarily a wrapper over the discord api

#

when we receive events we just send it to the users handler method

#

the way the users create the handlers and call the "wrapper methods" is what we define as the framework

steep spruce
#

I never worked with direct discord API ever

butt I do have great experience in doing stuff like.. reflection and commands

light loom
#
  • the additional benefits we give such as caching and rate limit control
steep spruce
light loom
#

why?

#

the cache we have is just a Map<Long, List<Integer, Class>> (long is guild_id)

#

the List<Object> is just all the objects we've cached, channels, users, etc

light loom
#

you can throw anything into the List and look it up via an id or something

#

e.g. cache.get(1, Channel.class)

#

will give u the channel object that has ID 1

steep spruce
#

if we use low-memory cached values of parsed args it can significantly reduce the reflection needed for every command (because if the parsing is like 90% done we just need to cache it and then 90% of the reflection is done, all that's needed is to specialize it for the command)

light loom
#

okay

steep spruce
#

well not caching the arguments directly lol

#

but yeah

steep spruce
#

like a set of predefined actions for a command that can be done via 1 annotation

light loom
#

if you can't re-use the caching code we have, create your own 🙂

#

try make it as generic as possible so maybe it can be re-used in :cache

steep spruce
#
@SlashCommand
@GuildOnly
public void onPingCommand(...) {}
steep spruce
steep spruce
light loom
#

ideally we want User instead of Member

steep spruce
#

public @GuildOnly void onPingCommand(User user) {}

steep spruce
light loom
#

what does GuildOnly mean? can only be invoked inside a server and not DMs?

steep spruce
#

you can invoke slash commands in DMS yk lol

light loom
light loom
#

maybe we can do @Source ?

steep spruce
light loom
#

let me check

#
public record Member(
        @JsonProperty("guild_id") long guildId,
        @JsonProperty("user") User user,
        @JsonProperty("roles") List<String> roles,
        @JsonProperty("joined_at") String joinDate) {}
steep spruce
#

it just has stuff like Member#hasRole, Member#hasPermission, Member#add... etc etc

light loom
#

so it's just the roles that are extra

steep spruce
#

and adding then

#

connecting them to vcs

light loom
#

doesn't look it?

steep spruce
#

kicking them
banning them

light loom
#

that's done by user_id

steep spruce
#

muting

light loom
#

user_id inside member and user is the same

#

I think User makes more sense, maybe we can merge them somehow?

#

I think I can

#

we just add ```java
@JsonProperty("roles") List<String> roles,
@JsonProperty("joined_at") String joinDat

#

so none of this member.user() nonsense

steep spruce
light loom
#

List<Role will just be empty

steep spruce
#

what if someone does User#addRole in DMS? you want it to take a screenshot?

light loom
#

we internally cache and update objects

#

but you can't do User#addRole inside DM because there's no guild assosicated to it

#

so in your code

#

if @DMsOnly (for example)

#

they can't use the guild object

#

i think

#

dunno experiment 🙂

steep spruce
light loom
#

i'm only theorising i'm not sure, it's 11pm my mind is going dead lol

steep spruce
#

alright I can create commands and then tell you everything

light loom
#

good luck, looking forward to seeing what you make!

steep spruce
#

cya

light loom
#

night

steep spruce
#

like if there was a set of defined annotations for commands that could be used, and people could even make their own, if that's a good idea xD

#

also tab completer providers
we should get a basic annotation based lib working before we think of like goodies to have

#

also I'll try to build the best API I can

plain ledge
#

I suggested making a ksp, or wharver the java equivalent of that is for event listener annotations

#

@steep spruce would you be willing to make a GitHub issue or comment on the slash command issue with the proposed way a user would use the api and write a short summary there so it’s all in one place

restive void
#

Whens that oauth2 API issue on gh gonna be moved into the ready to pick up section?

plain ledge
#

(I don't think any of the models for this are implemented)

restive void
plain ledge
#

@restive void lmk if u wanna be assigned then, there is also guilds template which are just more of the normal stuff

orchid portal
#

widget image is not complete?

#

ohh just need to make the enum

#

@plain ledge in which packge we were making the enums?

#

i forgor

orchid portal
#

yes its models

orchid portal
light loom
#

The action was passing

orchid portal
light loom
#

ah well it's fine

orchid portal
#

ohh wait u changed the spotless config to the old oen

#

thats y everything felt off

#

@light loom intentional?

light loom
#

ah yeah it is - I reverted it

#

the reason I did this was because I got fed up of seeing the following:

#
public void something(int a, int b, int c) {}

public void something(int a, 
                      int b, 
                      int c) {}

public void something(int a, 
                      int b, int c) {}
#

all 3 formats passing spotless

#

(example)

#

there was just some stuff that wasn't being changed when i wanted it to be so we have to redo the original spotless implementation that you did to do everything and be strict

orchid portal
#

ohh ok makes sense

light loom
#

@orchid portal just checked the PR - looks good man! thanks! peepo_heart

#

Since I raised the PR - I cannot approve it but you can

#

Are you interested in some more child labour? there's the webhook api that needs a builder :3

orchid portal
light loom
#

no problem

#

i'm being slaved at work rn - i'm actually stuck and can't fix something lol

orchid portal
#

lol

light loom
#

nobody will answer it 😭

orchid portal
#

prove it

light loom
#

it's a specific issue with TypeScript, AWS Synthetics, Lambda and Credentials

oak flare
#

well ofc if you never ask

light loom
#

if i can't do it - the average jo can't either pepekek

oak flare
#

well there are experts here though

orchid portal
#

i dont doubt that

light loom
#

I'm gonna try my best to figure it out, I don't have the luxury of being able to wait around - my JOB DEPENDS ON IT

#

(not literally)

#

But I'm a senior

#

I spoke to one of the other seniors

#

I told them if i can't get it working i'm gonna rip all the typescript and write it all in Java

orchid portal
#

damn

light loom
#

i can convince the tech lead ezpz

steep spruce
orchid portal
#

Honestly bro

#

Idc

#

Lol jk

orchid portal
#

@light loom is channel requests still not finished?

orchid portal
#

did u fucking generate this all with ai

orchid portal
plain ledge
plain ledge
orchid portal
#

Arrays.stream(clazz.getConstructors()).filter(c -> c.getParameters() == 0).findAny()

orchid portal
#

from a class

#

only if reading was an option

plain ledge
plain ledge
#

I’m on my phone

light loom
orchid portal
#

its out of control now

light loom
#

i'm not gonna change it myself

#

the code is perfectly readable

#

you save nothing by condensing code like the example you provided

#

if anything, it makes it harder to refactor in the future if we did it

#

but there are some areas that can deffo do with the improvements

#

such as the areas with heavy indentations

plain ledge
#

Isn't stream more efficient?

orchid portal
#

yes

light loom
#

a "simple" for-loop is faster if we're talking about performance

steep spruce
#

a stream needs to warm up before being useful
does some extra stuff

#

making it slower than a for loop

light loom
#

and all the initialisation too, we already have a [] but by using a stream, under the hood it needs to wrap it first

steep spruce
#

I could make a good implementation of a stream that is basically the same performance as a normal for loop

light loom
#

the reason people like streams more is because it's more declarative and encourages immutability

#

and using lambdas with streams is awesome

#

but my problem here is Familiarity

steep spruce
light loom
#

you'll lose that with a complex stream vs a single for-loop doing a single if-statement

steep spruce
#

for small collections/arrays I'd encourage it

light loom
#

the problem I have with Taz's example is that the complexity is introduced by the Optional returned

#

not so much the stream itself

steep spruce
#

so that we could return Result<Value, Exception> for example, or use better optionals

light loom
#

no

steep spruce
#

I really like coding with results

#

ok

light loom
#
Arrays.stream(clazz.getConstructors())
      .filter(c -> c.getParameters() == 0)
      .findAny()
      .orElse(throw new RuntimeException(..));
#

would be best stream approach

steep spruce
#

.orElseThrow*

#

L

#

bozo

light loom
#

yeah that's what i meant

#

but another problem is..

#

spotless isn't gonna do that pretty formatting

#

you'll get shit like this:

steep spruce
#

you guys use formatters???

light loom
#
Arrays.stream(clazz.getConstructors())
        .filter(c 
            -> 
              c.getParameters() == 0)
      .findAny()
      .orElse(
            throw new RuntimeException(..));```
steep spruce
#

just use your brain to format better

light loom
steep spruce
#

what if someone uses formatter "shittier" on accident

light loom
#

we have it defined in gradle so they can't use a different formatter

#

gradle:spotlessApply

#

gradle build will fail if you don't run that

steep spruce
#

alright

light loom
#

and since our pre-commit does gradle build it won't let you merge if that fails

steep spruce
# light loom ```java Arrays.stream(clazz.getConstructors()) .filter(c -> c.getParameter...
for (Constructor<?> c : clazz.getConstructors()) {
    if (c.getParameters() == 0) return c;
}
throw new RuntimeException(..)

you sure this isn't better? a stream only looks good and is worth it tbh if you make nice code somewhat like this:

// notice how we use a lot of those cool looking lambdas using `::`
requests.stream()
    .filter(Request::isAsync)
    .map(Request::execute) // some result
    .forEach((result) -> ...);
#

my opinion

light loom
#

Yeah I'm sure, for a simple function it does not need that, we just want to return a value or throw an error to the user

orchid portal
light loom
steep spruce
#

it wasn't meant to use any code I know

#

oh wait

#

I forgot to really check the reply

#

💀

orchid portal
#

@light loom how would i know what response to parse it into?

#

thats what i was saying to include it int request

light loom
#

check docs 😦

orchid portal
#

@light loom do we at least have all the models?

light loom
#

i think so

#

however we haven't done a thorough check

restive void
#

I think theres some models missing

orchid portal
#

ys

#

@light loom so this doesn't return anything?

light loom
#

<Void>

steep spruce
#

gotcha

light loom
#

yeah i just copied how vert.x handles this situation for their async stuff

orchid portal
#

Models are missing but ig for response we have all the models

light loom
#

try adding the missing models

orchid portal
#

we gon add everything in this pr

light loom
#

Yeah we can

#

It wouldn't be the first mega PR pepe_sad

#

We'll just all review it together, the changes aren't tested anyway

#

I only manually tested like 2 of them

#

But we're not going live without unit and integration tests

#

I think that's the last bit of human labour peepo_christ

plain ledge
#

Ur

#

And writing docs

orchid portal
#

@light loom did u checked the reviews on the pr?

light loom
#

I will look properly later

light loom
#

Taz is the PR ready?

orchid portal
orchid portal
#
public class CreateMessageBuilder {
    private final long channelId;
    private Optional<String> content;
    private Optional<Integer> nonce;
#

@light loom wrong naming or is this intentional?

#

this is a multipart request

#

and we're finding it out now pepekek

light loom
#

The name is based on the ChannelMessageRequest

orchid portal
light loom
#

I've just been replacing Request with Builder

#

Bc this is user facing and the long name is kinda bad for them

#

They will never see the Request variant as it's part of the internals

orchid portal
light loom
#

Aah don't worry about it

#

We can sort out the inconsistencies later when we write tests

#

We'll have to touch majority of the files anyway so any bugs, inconsistency, todos, have to get fixed then

orchid portal
#

@light loom i resolved all the models todos

#

the file sending might need a rework

light loom
#

Good work!

#

just peaked the PR, that looks good

molten tusk
#

hello, can i contribute as well?

light loom
molten tusk
#

i commented on #81

#

this looks so easy to follow, you guys have done a very good job!

#

help me please i cannot create a branch: remote: Permission to javadiscord/java-discord-api.git denied to notyourhabibti

light loom
#

you need to fork the repository

#

hang on, i'll add you as a maintainer instead

#

try now

molten tusk
#

thank you ❤️

orchid portal
molten tusk
#

i don't use github

#

pushed changes! ❤️

light loom
#

basically, when logging we should have an ID attached to the log messages so we can see which log messages appear for what

#

e.g.

#

event received -> we log with an ID

#

any methods that get called that does a log

#

should have this ID attached to it

#

so we can see all the logs that appeared in relation to a specific event

molten tusk
#

how do you pass the "flow id" to all the log messages?

#

parameters?

light loom
#

custom appender ig

molten tusk
#

this is multi threaded though if you get an event and then another event at the same time the flow id will be changed and it will not link back up??

light loom
#

look into "mapped diagnostic context" (MDC) on google for log4j and run some experiments

#

you can set a few properties such as the guildId, userId etc to appear in the logs

#

start simple though with just a random number (or auto incrementing int)

molten tusk
#

i will do something else peepo_heart

orchid portal
molten tusk
#

hi @orchid portal

#

i added to your branch some of the TODO comments and missing objects, i think that was the best place to do it?

#

oh I did it in my branch

light loom
#

it's common to see that

#

also @molten tusk did you just do the TODOs?

molten tusk
#

to my branch

light loom
#

i can approve but let taz review

#

can you write some unit tests? ;o

molten tusk
#

sure

molten tusk
#

imposter is wrong and it does not match the docs

#
{
  "id": "",
  "type": 0,
  "content": "",
  "channel_id": "",
  "author": {
    "id": "",
    "username": "",
    "avatar": "",
    "discriminator": "",
    "public_flags": 0,
    "flags": 0,
    "bot": false,
    "system": false,
    "banner": "",
    "accent_color": 0,
    "global_name": ""
  },
  "pinned": false,
  "mention_everyone": false,
  "tts": false,
  "timestamp": "2024-05-05T18:33:48Z",
  "edited_timestamp": "2024-05-05T18:33:48Z",
  "flags": 0,
  "position": 0
}
#

but the docs say author is user

light loom
#

the openapi spec is returning author when it should be user?

molten tusk
#

yes

light loom
#

keep a note of it but see if you find any other occurrences of the spec not matching the docs

molten tusk
#

i think i am doing something wrong, the object does not match the request

plain ledge
light loom
#

I'm gonna try make a team on discord, this should also give you the "developer" badge on your profile

restive void
#

Discord lets u make teams for ur bots?

plain ledge
#

u create applications

#

and then create bots under it, u can also do like presence and shit

#

and u can create applications under "teams" I believe

restive void
#

Oh i see

orchid portal
#

@molten tusk u'll have to revert all those changes coz its already been done in the other pr

#

sry for ur time waste wazei should've told u that

light loom
#

@worthy flower

#

This is our project thread

worthy flower
#

oh noice

worthy flower
#

it seems there is important progress

orchid portal
#

@light loom do u wanna roll back to my config and we can edit it over time?

#

u can install eclipse and also edit it

light loom
#

Yeah I will do let me get setup first to be able to play with it

light loom
#

I'm handing out the "active developer" badge like candy

#

but i need u added

restive void
#

Add me @light loom

light loom
#

Sure

plain ledge
#

@light loom my school ends the end of may so I’ll be able to work on the project again since summer starts. Rn I’m busy with some other stuff and don’t have time on top of school

light loom
#

No problem nopox, focus on your own stuff and work on this project whenever you have time to kill peepo_heart

light loom
#

@orchid portal what's left i wanna merge

#

the pr has many changes i want in main

orchid portal
light loom
#

ah okay sweet

#

i really hope we've implemented everything properly 😄

orchid portal
#

im very sure we havent

light loom
#

yeah we deffo haven't pepekek

#

we've been blindly writing these APIs based on the docs

#

@orchid portal should I work on it?

oak flare
#

lmao

#

getting into this project going to be cancer

light loom
#

it's not - we just have unit tests left

orchid portal
light loom
#

which enum is it?

orchid portal
light loom
#

did ashi implement this in her pr?

#

can i copy from that?

orchid portal
#

i dont think it was component

#

lemme check

light loom
#

cool idk what component is

#

ill just go through all the models

orchid portal
#

no not component

#

i actually used Integer instead of making an enum

#

and after pushing i realized it should be an enum

#

also the build is failing rn

#

@light loom ok its the components in EditMessageRequest

light loom
#

cool ill fix

orchid portal
#

also check for components in other places

#

@light loom also fix builders names while ur at it

light loom
#

sure

steep spruce
#

I'm really busy on school rn

light loom
#

@molten tusk sorry can you remove your gpg keys? (edit: i removed it)

#

they're still on my system

#

so i keep commiting against your name - nvm it wasn't - it just didn't update on edit

orchid portal
#

i want to work on sm fun stuff as well

light loom
#

sure

#

wanna work on the @Source param?

orchid portal
light loom
#

so we have annotatons right

#

e.g. @MessageCreate

#

we want a new one called @Source so that an @EventListener only gets called when it's from that defined source

#

e.g. private message or guild or both

#

anyways I have done the changes @orchid portal

#

but it's not refined, you're welcome to refine and work on it 👀

#

or if you want a real challenge...

#

can we also choose a name for our framework !?

oak flare
light loom
#

javadiscord

#

java discord library

#

java discord interface

#

imadethisinjava

#

idk man

oak flare
#

trust me OpenJDA 💀

light loom
#

it would be cool if JDA wasn't open source

oak flare
#

yeah ofc

#

im trolling 😛

light loom
#

JDA PRO

oak flare
#

JDA++

#

XxJDAxX

light loom
#

lmaooo

#

should we take the first letter of every contributor

#

and make a word out of it

#

e.g.

#
taz
wazei
nopox
anax
squid
``` = wants framework
#
w = wazei
a = anax
n = nopox 
t taz
s = squid```
oak flare
#

people wont get it

light loom
#

they don't have to

#

RSA did it

oak flare
#

also unfair for other contributors

light loom
#

what other contributors

oak flare
#

future

light loom
#

i'll do it using all the v1 contributors

oak flare
#

well I am not a part of that lmao

#

anyways BetterJDA it is

light loom
#

u better commit a fix to the readme or something

#

thing is, people might think its a spin off on JDA and except the same coding style?

#

disbot?

oak flare
#

ofc I would avoid anything jda related lmao

light loom
#

let's post it here

#

tim suggested AccordAPI

oak flare
#

I dont get it though lmao

restive void
#

All the good names lowkey taken ngl

#

Javacord, Discord4J

#

I posted a possible name idea on the discussion

plain ledge
#

@light loom

#

speak english smh

light loom
#

Idk why it thought it was Spanish pepekek

plain ledge
#

sounds like discoboard or smth

#

like a actual bot or bot finding website

light loom
#

Yeah thought so

#

Lol somebody make a drag and drop editor

#

"drag an event listener", "create event", "send request"

#

Should be easy actually 👀

plain ledge
#

That'd be kinda cool

light loom
#

Yeah kinda similar

#

It could be fun for somebody, making a super basic version

steep spruce
light loom
#

Should we name it after a vegetable

#

The cauliflower framework pepekek

#

We really such at names - not even a short list pepe_sad

orchid portal
#

Disoak

#

Old java name

orchid portal
light loom
#

yeah sounds good but

#

cauliflower lel

steep spruce
#

because this framework will blow up

#

in no time

light loom
#

Ah the terrorist framework

plain ledge
#

Fr

steep spruce
#

so like

#

uranium gang

#

like rust has rustacians

#

uranium has uraniumians

#

or uranium gang

light loom
#

Uranium sounds like Uranus

#

Which sounds like Ur Anus

steep spruce
#

my anus?

#

how does uranium sound like my anus and ur anus

#

that makes no sense

light loom
#

It's the visuals pepe_sad

steep spruce
#

😏

#

uranusians

light loom
#

I deleted

steep spruce
#

before I say anything

light loom
#

I know you saw it

steep spruce
#

I just want to say I'm 14

tawdry pewter
#

damn

light loom
#

@tawdry pewter Where tf did you come from

#

Hi though peepo_heart

#

Snooping on top secret conversations!!

#

Hozeyn, any name ideas??

orchid portal
#

i saw it as well

#

(im lie)

tawdry pewter
orchid portal
#

but its very easy to guess what it was

light loom
#

What was it then taz

orchid portal
light loom
#

Of course you'd think about my anus 🥰

steep spruce
#

if you don't mind

light loom
#

WHAT

orchid portal
#

damn

#

now we talking

light loom
#

Should we name ourselves vencord

orchid portal
steep spruce
#

Vortecord

#

after my language

#

:D

orchid portal
#

choose something which is not existent in discord space already

plain ledge
sharp ferry
light loom
#

Maybe?

#

Yellow mario?

steep spruce
light loom
#

I saw a Luigi mario princess video ...

#

On TikTok

sharp ferry
#

The Discord Wario API or DWAPI

steep spruce
#

TikTok ew

light loom
steep spruce
#

wait

#

name your framework DjCord

#

or DJ

sharp ferry
#

Djinncord
D for discord, j for java
But Djinn is also an existing really cool word

light loom
#

Djinn is gonna put people off I think

#

With their superstition

sharp ferry
#

wait no, djinn is in french

#

huh

light loom
#

what's the meaning?

placid wharfBOT
#
TJ-Bot
What does djinn mean in french

In French, the word "djinn" refers to a type of supernatural being or spirit in Islamic mythology and theology. Djinn are often depicted as powerful entities that can be either benevolent or malevolent, and are believed to inhabit the unseen world alongside humans and angels. The concept of djinn has been present in Arabian folklore for centuries, with stories about these beings appearing in various works of literature and art. In French-speaking cultures, the word "djinn" is commonly used to refer to these mythical creatures or spirits.

light loom
#

Yeah that's what I thought

#

Peeps gonna say "this code comes shipped with a jin"

sharp ferry
#

Wait no

#

Djinn seems to also work

#

Here all the english words starting with Dj : [dj, djagatay, djagoong, djakarta, djalmaite, djasakid, djave, djebel, djebels, djehad, djelab, djelfa, djellab, djellaba, djellabah, djellabas, djerib, djersa, djibbah, djibouti, djin, djinn, djinni, djinny, djinns, djins, djuka]

#

so

light loom
#

Dijkstra'a Discord Framework pepekek

sharp ferry
#

Djinn is the best here

sharp ferry
sharp ferry
#

those are actual english words

tawdry pewter
#

all look arabic

sharp ferry
#

I just cloned a english words db

#

and did a jshell filter on them

light loom
#

Falafel framework

sharp ferry
#

what

placid wharfBOT
#
TJ-Bot
What is Falafel?

Falafel is a popular Middle Eastern dish made from ground chickpeas or fava beans mixed with herbs and spices. The mixture is formed into small balls or patties and then deep-fried until crispy on the outside and tender on the inside. Falafel is commonly served in pita bread with vegetables such as lettuce, tomatoes, and cucumbers, along with sauces like tahini or tzatziki.

Falafel is a versatile dish that can be enjoyed on its own as a snack or appetizer, or as part of a larger meal. It is often served with a side of hummus, tabbouleh, or pickled vegetables. Falafel is a popular street food in many countries and can be found at food stalls, markets, and restaurants around the world.

In addition to being delicious, falafel is also a nutritious option for vegetarians and vegans, as it is high in protein and fiber. It is also gluten-free, making it suitable for those with gluten sensitivities or allergies.

Overall, falafel is a flavorful and satisfying dish that has become beloved by people of all cultures for its tasty combination of ingredients and versatility in serving options.

light loom
#

Dunno i just said something random loldog

#

If you've never had falafel ala, you should try it

#

In a wrap

#

It's actually lovely

sharp ferry
#

so that's your framework ?

light loom
#

Yeah a pair of brown balls pepe_sad

#

I'm kidding

#

The wario idea was good tho

sharp ferry
#

hmm

#

what's the most important thing about your framework compared to jda ?

steep spruce
# placid wharf

okay, I'll answer this because I'm a Muslim

"jinn" is basically a term for a stronger variant of a ghost

plain ledge
#

You can’t use JDA without using the web socket

steep spruce
#

which, most jinns are enemies since Satan controls jinn

only few are good

plain ledge
#

There is more I just can’t think of it

#

I think the error handling

light loom
#

To name some:

steep spruce
#

I prefer koshari or shawarma

plain ledge