#dev-general

1 messages ยท Page 151 of 1

dusky drum
#

its all good

#

my code is nice.

prisma wave
#

who needs . and {} anyway

dusky drum
#

me=

prisma wave
#

parens for everything

remote goblet
#

Brister

prisma wave
#

oui?

remote goblet
#

respect for you went down by 37%

dusky drum
#

{} looks better

prisma wave
#

wow

#

no

lunar cypress
#

And no you did not convert that correctly im afraid lol

prisma wave
#

๐Ÿ˜ฆ

dusky drum
#

HHAHAHAฤ‘ลพ

prisma wave
#

was I on the right lines?

dusky drum
#

my eng so gud

prisma wave
#

isActive could be a property

dusky drum
#

no

prisma wave
#
val isActive: Boolean
  get() = endsOn - System.currentTimeMillis() > 0
dusky drum
#

wtf

frigid badge
#

lmfao this man's eyes being opened

prisma wave
#

lol

dusky drum
#

whats get()?

hot hull
#

Is that a getter

frigid badge
#

a getter

prisma wave
#

yes

#

^

#

a getter

dusky drum
#

doesnt work

hot hull
#

disgusting

dusky drum
#

for me

remote goblet
hot hull
#

Lol

prisma wave
#

exaggeration

hot hull
#

Should be String.MAX_VALUE tho Ori

remote goblet
#

which is pure cancer

prisma wave
#

doesnt work
why not?

remote goblet
#

I know i lost the code for it

#

lemme fix this

dusky drum
#

getter doesnt work for me

prisma wave
#

?

dusky drum
#

its just red

prisma wave
#

did you paste what I put?

dusky drum
#

ye

prisma wave
#

show code

onyx loom
#

The syntax is interesting it might be fun to learn
@heady birch take that back. u know u dont mean it

hot hull
prisma wave
#

Niall is right

#

and clever

dusky drum
#

nvm works now i had to remove one part of my code

prisma wave
#

y'all are just too dumb to understand clojure

dusky drum
#

no

#

we use brains

#

but our brains dont exist

prisma wave
#
(defn -main [& _]
  (let [r (range 1 450)]
    (println (reduce * (first (filter (fn [triplet] (= (reduce + triplet) 1000))
                                      (for [a r b r c r
                                            :let [prod (+ (* a a) (* b b))]
                                            :when (= (* c c) prod)]
                                        [a b c])))))))``` don't tell me this isn't readable
onyx loom
#

(((((((((no)))))))))

dusky drum
#

just sec let me find old slimefun code

onyx loom
#

i cant tell if ur joking or not

prisma wave
#

bit of both

onyx loom
#

cus that is NOT readable at all

prisma wave
#

I'm aware that code sucks

#

but it's like the only clojure I've written

dusky drum
#

cant find it, it was 100 whiles in whiles

#

so while(while(while(while....

onyx loom
#

hopefully the last clojure u will ever write

prisma wave
#

nope

#

just wrote some more

#

:)

onyx loom
#

๐Ÿ˜”

remote goblet
lunar cypress
#

was I on the right lines?
@prisma wave well if you did write that thing in clojure you'd probably do a few things differently to begin with (such as the utils)

heady birch
#

Whens sxtann coming back

onyx loom
#

never

#

prob

prisma wave
#

oh yeah it's not idomatic ofc

#

but it was a direct equivalent

#

I think

lunar cypress
#

Do you want the entire thing as a direct equivalent?

prisma wave
#

sure

onyx loom
#

sx is gonna become like songoofda and get the word banned

remote goblet
#

Dear fucking god what have i done

heady birch
#

Lol

hot hull
#

Yes Ori

lunar cypress
#

ok, let's do this with pattern matching

remote goblet
#

this is allman at its finest

hot hull
#

Bruh

prisma wave
#

wow

dusky drum
#

you want it?=

heady birch
#

not all men are like that

prisma wave
#

lol

remote goblet
dusky drum
remote goblet
#

now put it in allman

ocean quartz
remote goblet
#

not sure honestly

onyx loom
#

๐Ÿ˜ฌ

remote goblet
#

intellij is literally like

#

nah

prisma wave
#
(defn -main [& _]
  (println (reduce * '(1 2 3 4))))```
clojure haters will say there are too many parens (there's 8) but in kotlin this code has 8 parens and 2 curly brackets AND a double colon
```kotlin
fun main()
{
    println(listOf(1, 2, 3, 4).reduce(Int::times))
}```
#

conclusion? clojure good kotlin bad

dusky drum
#

wtf

prisma wave
#
    println(listOf(1, 2, 3, 4).reduce { i, other -> i.times(other) })``` it can be worse
onyx loom
#

u missed out the square brackets in clojure

#

so clojure bad kotlin bad

dusky drum
#

i think i'll slowly change my bot to kotlin

heady birch
#

Dont you just love refctoring

dusky drum
#

i just need to figure it out how to

#

how to make value HashMap?

#

in data class

prisma wave
#

8 parens and 2 square brackets, compared to 8 parens, 2 curly brackets, 1 keyword, 1 ., and a function reference

obtuse gale
#

Clojure doesnt exist. Prove me wrong

prisma wave
remote goblet
dusky drum
#

eh

#

nvm found out

prisma wave
#

clojure has less syntax than kotlin therefore it's easier to learn therefore better

onyx loom
prisma wave
#

@dusky drum Liskov - don't use HashMap, use Map or MutableMap

remote goblet
#

Conjure is a conspiracy theory

obtuse gale
#

Clojure isnt real tho

dusky drum
#

why mutablemap?

steel heart
#

clojure is superior ๐Ÿ˜ฎ

prisma wave
#

Johnny has been typing for like 10 minutes I'm getting scared ๐Ÿ‘€

remote goblet
frigid badge
#

Liskov substitution principle

remote goblet
#

MutableMap you can edit, Map you cannot

prisma wave
#

why mutablemap?
Kotlin handles collection mutability in the type system - Map doesn't have put(), remove, etc, MutableMap does

ocean quartz
#

Solid advices

compact perchBOT
prisma wave
#

Unless you need the map mutable, just use Map

remote goblet
prisma wave
#

how do you know you didn't pass

remote goblet
#

Not done a math lesson since year 8 = failing maths

ocean quartz
remote goblet
#

johnny coming up with the lies on how they didnt eat the sugar

obtuse gale
#

johnnys writing like harry potter or smthn I think

steel heart
#

he's writing a new culture

heady birch
#

Whats cooler than yaml these days for configs

hot hull
#

JSON

onyx loom
#

i do this all the time, i have my mic mute button on 5 so if i mute my mic itll type "5" and ill forget to remove the letter

remote goblet
#

json gasm

ocean quartz
#

^

lunar cypress
#

I think I give up, this code is so terrible I would change it too much

prisma wave
#

lol

#

๐Ÿ˜ฆ

remote goblet
#

THATS

lunar cypress
#

it doesn't even work correctly

ocean quartz
#

Nooooo

remote goblet
#

all

#

yoU WROTE?

steel heart
#

lol

prisma wave
#

that was an underwhelming paragraph

#

ngl

onyx loom
#

nvm

remote goblet
#

wasnt even a paragraph

#

that was like

onyx loom
#

i thought he just left it afk

remote goblet
#

nothing

prisma wave
#

what a shame

prisma wave
#

oh well

prisma wave
#

the moral of the story is clojure good kotlin bad

lunar cypress
#

this is actually erroneous

remote goblet
#

Johnny

#

use words people understand

lunar cypress
#

it will throw an array index out of bounds exception

obtuse gale
#

just say wrong

prisma wave
remote goblet
obtuse gale
#

oh

remote goblet
prisma wave
#

light mode

#

bad

lunar cypress
#

lmfao

prisma wave
#

yet another problem that clojure doesn't have

remote goblet
ocean quartz
#

Kotlin good, Java good, Clojure good, all good for some people for some purposes

prisma wave
#

incorrect

#

Java is absolutely not good

#

I think we can all agree on that

remote goblet
#

without java there wouldn't be kotlin WeSmart

hot hull
#

Java bad

prisma wave
#

java bad

remote goblet
#

java is bad

#

however

ocean quartz
#

Java is good for some things yes

steel heart
#

clojure

prisma wave
#

clojure good

steel heart
#

objectively good

prisma wave
#

Java is good for some things yes
such as?????????????????????

remote goblet
#

creating god languages like Kotlin ASevil

prisma wave
#

true

#

tbf the JVM is good

#

it's just java bad

ocean quartz
#

When you can't use Kotlin fingerguns

remote goblet
#

if i ever worked for someone who was like

#

No kotlin

#

i would just

#

and use kotlin

steel heart
remote goblet
#

jesus christ

prisma wave
#

i would savagely beat them to death and hold their family hostage until they converted the entire 100,000 line codebase into kotlin

#

:)

heady birch
#

๐Ÿ‘€

remote goblet
prisma wave
#

wait

#

that wont work

heady birch
#

Must be more than 100k

prisma wave
#

they cant convert to kotlin if they're dead

#

hmm

steel heart
prisma wave
#

ew

heady birch
#

No

ocean quartz
#

AHH

#

My eyes

remote goblet
#

mom im scared

#

to be fair

prisma wave
#

fun fact

#

light mode doesn't exist in clojure

remote goblet
#

id rather use a light theme

#

over one of those ugly fucking red themes

prisma wave
#

true

#

ew

steel heart
#

yet there doesn't exist a gray-white theme

remote goblet
prisma wave
#

๐Ÿคฎ

steel heart
#

wth

remote goblet
prisma wave
#

that green is pretty gross

remote goblet
#

thats because of my taskbar i think

prisma wave
#

dark everything

steel heart
#

superior

prisma wave
#

notepad lookin

onyx loom
remote goblet
onyx loom
#

thats yuck ori

remote goblet
#

im aware

prisma wave
#

ew

onyx loom
#

altho it does match ur desktop background

remote goblet
#

yeah

#

thats why its green

onyx loom
#

but thats besides the point as u never see it

remote goblet
#

33c in london

#

the poor fuckers

steel heart
prisma wave
#

ouch

#

it's 25c here

dusky drum
#

am i doing stuff wrong:
never used maps in kotlin and i've never used kotlin before

fun addStringData(path: String, data: String){
        this.stringData[path] = data;
    }

i get unsupportedoperationexception

#

if i do stringdata.put i get some wierd message saying i should do stringdata[path]

lunar cypress
#

ok I don't wanna do y'all like this

remote goblet
lunar cypress
#
(defn -onCommand [sender cmd label args]
  (letfn [(send-format [name arg] 
            (.sendMessage sender (TextUtil/colorFormat (.. messagesData (getMessages) (getString name) (replace "{0}" arg)))))]
    (if (.hasPermission sender "simplecrops.command.clean")
      (if-let [player (or (and (= (alength args) 1) (Bukkit/getPlayer (aget 0))) nil)]
        (send-format 
         (if (.cleanPlayer dataManager (.. player (getUniqueId) (toString))) 
           "cleanCommand.successfully" 
           "cleanCommand.error") 
         (aget args 0))
        (send-format "noPlayer" ""))
      (send-format "noPermission" "simplecrops.command.reload"))))
```here you go
prisma wave
#

wow

onyx loom
#

omg

prisma wave
#

you did it

onyx loom
#

ima throw up

dusky drum
#

so noone can help me ๐Ÿ˜ฆ

remote goblet
#

No one wants to

prisma wave
#

avec quoi?

#

@lunar cypress 2 things

  1. I replied to your PR with a few suggestions
  2. what does .. do?
remote goblet
#

well i sure dont want to EmiCross songurda demon

hot hull
#

What's another word for specializing, but to sound less like you know the actual topic?

lunar cypress
#

.. is a macro for chaining java methods

prisma wave
#

i see

jovial warren
#

on a scale of 1-10 how bad is raw use of a parameterised class?

remote goblet
#

frosty

#

check status

#

:D

onyx loom
#

๐Ÿ˜„

hot hull
#

Fuck off

prisma wave
#

@jovial warren like 2-5 depending on the circumstances

onyx loom
#

good one ori

remote goblet
hot hull
#

What's another word for specializing, but to sound less like you know the actual topic?

prisma wave
#

example?

#

like "I specialize in blah"?

onyx loom
#

whats wrong with specializing

hot hull
#

ie.
I specialize in Java
but not professionaly

prisma wave
#

oh

#

You could still use specialize

onyx loom
#

i am enthuasistic about java

lunar cypress
#

focus, interest, enthusiast

prisma wave
#

yeah focus would work too

hot hull
#

Since to me "specialize" sounds like you actually know what you're doing fingerguns

heady birch
#

i like java

prisma wave
#

true lol

hot hull
#

Niall No

#

Java bad

#

doodoo

prisma wave
#

"I focus on Java"

remote goblet
#

Java as bad as frosty's pc

onyx loom
#

๐Ÿ˜ฌ

#

thats pretty bad

hot hull
#

bruh someone go to Ori's house and whoop their ass

#

Thanks.

heady birch
#

api design is fun

remote goblet
#

do it wonk

#

you dont know my kinks wonk wonk

#

jk

prisma wave
#

my kinks are clojure

#

i love parenthesies

remote goblet
#

my kinks are good pcs emojiplead

heady birch
prisma wave
#

when's kotlin.zip coming

#

๐Ÿ˜ฆ

heady birch
#

hm

remote goblet
#

is this malware?

prisma wave
#

yay

heady birch
#

no

remote goblet
#

its malware

heady birch
#

no

#

;

#

ransom ware

prisma wave
#

FINALLY

onyx loom
#

kotlin is malware because its so infectious wonk

remote goblet
#

ban niall for giving us malware

prisma wave
#

gradle got their shit together

#

PDM update coming soon

heady birch
#

nice

#

so wait

onyx loom
#

does this like

prisma wave
#

bruh it was 403ing me for like 3 days now

heady birch
#

can PDM do compile dependencies?

onyx loom
#

fix everything?

prisma wave
#

maybe

#

@heady birch wdym

heady birch
#

hard depends, not just soft depends?

prisma wave
#

oh

heady birch
#

like

prisma wave
#

yes

#

that's the point

heady birch
#

๐Ÿ˜ฎ

remote goblet
#

niall loves interfaces

#

goddamn

heady birch
#

its an api

remote goblet
#

im aware

#

but still

heady birch
#

application programming interface

remote goblet
frigid badge
#

I feel like Niall's mind is somewhere else at all times

remote goblet
#

using java

heady birch
#

oh

#

@frigid badge ?

#

Im close to 10,000 lines

#

Half must be java doc by now lol

hot hull
prisma wave
#

not bad

hot hull
#

Confused where it got the A+ from tho

#

Must be checking someone elses code

prisma wave
#

it seems to always give A+

hot hull
#

Sheesh, thought it was broken

prisma wave
#

idk

#

i've never seen any other rating

pastel imp
#

best language to make a good performance pc app?

heady birch
#

rust

#

C

pastel imp
#

which is what?

#

what's rust? bruh

heady birch
pastel imp
#

electron?

heady birch
#

no lol

pastel imp
#

isn't it good?

heady birch
#

probably not what you want for high performance

pastel imp
#

oof

#

I don't rlly want BEST performance

heady birch
#

electron will be fine most likely

pastel imp
#

I just want an easy, powered and kinda good performance

#

welp never used JS so that sucks

#

and don't wanna use java

#

cause.. ye

#

..

heady birch
#

..

pastel imp
#

ya know

heady birch
#

java + swing/fx

pastel imp
#

but isn't java a bit too heavy?

prisma wave
#

electron is not good performance

#

heavy?

pastel imp
#

ye

#

performance heavy

prisma wave
#

not really

pastel imp
#

uses ram like it's a juice

heady birch
#

no just on memory really

prisma wave
#

definitely faster than electron

heady birch
#

and it more reserves the memory than actually using it

pastel imp
#

hmmm

#

faster you mean loading?

frigid badge
#

it's just faster with everything

lunar cypress
#

^

hot hull
jovial warren
lavish notch
prisma wave
#

@jovial warren i would cast to Map<?, ?> just to avoid the warning

#

otherwise looks pretty much fine

jovial warren
#

okay

hot hull
#

@lavish notch Made by Piggy fingerguns

dusky drum
#

i must say i quite like the Kotlin, except its syntax is a bit wierd for me

hot hull
#

You'll get used to it

hallow folio
#

Is there anywhere that I can find a tutorial to write a custom bot? Just like the basics

#

Tag me please.

obtuse gale
#

like discord bot?

surreal quarry
analog crater
#

Also, check out Menu Docs jda4 and 3 tutorials if you already know java

hallow folio
#

Thanks James!

#

And will do.

dusky drum
#

yo so whats that software for auto java to kotlin code stuff?

errant geyser
#

IntelliJ

dusky drum
#

okay so how to use it?

errant geyser
#

ctrl + alt + shift + k

dusky drum
#

oke let me try

#

gonna make backup before XD

errant geyser
#

Hey @ocean quartz say someone was to rewrite MF in Kotlin and change it from being annotation based to like, variables and stuff, how would one go about doing that? I've already converted everything that isn't the annotations, but I have no idea how I'd create and hook up my own command classes

#

So instead of like

@command("a")
someClass() {
  
  @Default
  fun whatever(args) {}

}```
It'd be like 
```kotlin
val aCommand = Command("SomeName")
acommand.default(someArgs) {}```
prisma wave
#

what exactly is the problem?

#

just add functions to Command and things?

errant geyser
#

Idk how to hook up Command to Matts existing stuff tho, since using that'd save me from writing my own

ocean quartz
#

You can't, it's not ready to be used without annotations

dusky drum
#

uuu yes my bot is now kotlin howly. :3

errant geyser
#

F

dusky drum
#

wait

errant geyser
#

So what roughly needs to be altered?

dusky drum
#

some stuff isnt kotlin

ocean quartz
#

Basically the core of the command manager
It'd work on the JDA one since I made it different
I will rewrite it at some point to make it better and that'll be possible, but idk when

old wyvern
#

I swear these people convert every single soul

errant geyser
#

Indeed

old wyvern
#

When shall they learn

dusky drum
#

says name

errant geyser
#

Well, guess my dreams are shattered Matt

ocean quartz
#

I can do that a bit later
Gotta try understanding parser first, was talking with Sx and i am even more confused about this stuff xD

prisma wave
#

@dusky drum .class isn't a thing in Kotlin

#

It would be HashMap<*, *>::class.java

dusky drum
#

i seee

#

oke

#

got it working

#

my pc is so fast it takes ages to change from java to kotlin sometimes

remote goblet
#

gasper pc bad lol potentially ?

dusky drum
#

yeh

#

i still rock fx cpu

#

and what do i do here

prisma wave
#

what do the errors say?

#

also, !! bad

dusky drum
#

target label does not denote a function, those !! are added by intellij i just ran java to kotlin

#

i'll do most fixing later

prisma wave
#

oh

#

you don't need that label at all

dusky drum
#

intellij added iut

prisma wave
#

use return@Predicate

#

if you restructure the code you won't need that either

dusky drum
#

?

prisma wave
#

actually maybe you do

dusky drum
#

how would i change this, im pretty new to kotlin :3

remote goblet
prisma wave
#

for now just use return@Predicate

dusky drum
#

yeh no idea what that is

#

nvm

#

im stupid

prisma wave
#

oh

#

I mean

#

that's not what I said but that should work

#

although it's incredibly ugly with that formatting

dusky drum
#

well i googled up stuff and i found that

prisma wave
#

yeah

#

also the type specification is unnecessary

dusky drum
#

and now i have another issue

prisma wave
#

event ->

dusky drum
prisma wave
#

wait did you just convert everything at once?

dusky drum
#

no

prisma wave
#

oh

#

it's probably because it's an inner class

#

remove the inner and it should work

dusky drum
#

where is that inner?

prisma wave
#

in the definition of ChatConfirmEvent

dusky drum
prisma wave
#

?

chilly zenith
#

any C#'ers

prisma wave
#

Yugi knows C# I think

dusky drum
#

thats kotlin.

#

ow

#

i read it wrong

#

sry

#

xd

#

maybe cause its set to private?

chilly zenith
#

I just need some C# code optimized

prisma wave
#

@dusky drum ?

dusky drum
#

i still have no idea where that inner is

prisma wave
#

in the definition of ChatConfirmEvent

#

is that one of your classes?

#

or from a library

dusky drum
#

library

#

jda

#

wait

#

no

#

its mine

prisma wave
#

yeah

#

so it probably says inner in there

dusky drum
#

i see

hot hull
#

When you don't even know what class is yours :p

prisma wave
dusky drum
#

dont ask

#

im confused right now

#

still same stuff for some reason

prisma wave
#

did you remove the inner

hot hull
#

When people say they have thousands of Twitter or youtube followers/subs, but you got this fingerguns

prisma wave
#

damn

#

impressive

dusky drum
#

why da frik it says its still inner???=???

prisma wave
#

send the full code

dusky drum
#

the chat one or the one thats not working?

prisma wave
#

idk

#

both?

dusky drum
#

lol it says its java XDDD

#

in java it was

AbstractReactionUtil reactionUtil = new AbstractReactionUtil(user, chatInfo -> {
        }, message.getJDA(), "โœ”", message.getId());

        reactionUtil.setOnClose(() -> {
            ticketStorage.deleteTicket(info.getUserid(), info.getChannelID());
            deleteChannel(channel);
        });
#

frik

#

i sent wrong stuff

#

...

prisma wave
#

send AbstractReactionUtil

#

also, wut is this

#
    val reactionUtil = AbstractReactionUtil(user!!, AbstractReactionUtil.ChatConfirmEvent {
            _: AbstractReactionUtil.ChatConfirmEvent? ->

        }, message.jda, "โœ”", message.id)```
dusky drum
#

idk

#

dont ask me

#

thats what intellij did

hot hull
#

IJ conversion ain't perfect

prisma wave
#

i am pretty sure it could just be ```kotlin
val reactionUtil = AbstractReactionUtil(user!!, { }, message.jda, "โœ”", message.id)

#

which will probably fix your problem too

dusky drum
#

let me try

prisma wave
#

depends what ChatConfirmHandler is

hot hull
#

user!!
ew

prisma wave
#

indeed

dusky drum
#

okay so OnClose still doesnt work

prisma wave
#

can't fix it without seeing the code

dusky drum
#

i just hope intellij didnt break it

prisma wave
#

jesus

#

this class is a mess

#

but like

#

what's the problem?

#

specifically

dusky drum
#

it says OnClose doesnt have constructor

prisma wave
#

that's because it doesn't

#

it's an interface

dusky drum
#

well

prisma wave
#

where does it say that?

dusky drum
#
reactionUtil.setOnClose(AbstractReactionUtil.OnClose {
            ticketStorage.deleteTicket(info.userID, info.channelID)
            deleteChannel(channel)
        })
prisma wave
#

yeah kotlin doesn't let you do that

#

however

#

that entire interface is pointless

#

just use a first class function

dusky drum
#

?

prisma wave
#

functions are "first class" in kotlin, meaning you can interact with them just like any other value

#

so kotlin val someFunction = { println("Hello") } is possible

#

what that means is that you don't need Functional Interfaces like Java has

#

you could just take () -> Unit

#

which is the equivalent of Runnable

dusky drum
#

hm

#

so

#
reactionUtil.setOnClose {
            ticketStorage.deleteTicket(info.userID, info.channelID)
            deleteChannel(channel)
        }
#

ye it doesnt work anymore

#

it broke it ;8

#

sadly

prisma wave
#

that's pretty much how it would work

#

how have you implemented it?

dusky drum
#

so i create that class and then i listen in class for event when event is launched it launches onclose code.

prisma wave
#

yeah yeah

#

I just mean what did you change AbstractReactionUtil to?

dusky drum
#

?

prisma wave
#

I told you to change AbstractReactionUtil to not use OnClose

#

so what did you change it to?

dusky drum
#

well

#

i still use OnClose someway

prisma wave
#

you don't need OnClose at all

#

you can just use a first class function everywhere

dusky drum
#

How'???

prisma wave
#

just replace OnClose with () -> Unit everywhere

dusky drum
#

errors everywhere

prisma wave
#

private var onClose: () -> Unit = {} etc

#

i mean

#

not literally everywhere

dusky drum
#

i have function

#

fun setOnClose

#

its all read

prisma wave
#

but wherever you use the OnClose type, just use () -> Unit instead

#

yeah

dusky drum
#

its all red

prisma wave
#

you don't need setters in Kotlin anyway

#

you just expose the property

dusky drum
#

but how will i run it?

#

do i invoke it?

prisma wave
#
var onClose: () -> Unit = {}


class AnotherClass {
  blah.onClose = { 
    //hello
  }
}```
#

you can use invoke

#

or you can just use onClose()

#

they are the same

dusky drum
#

i cant do

#

reactionutil.onClose

prisma wave
#

why not?

dusky drum
#

ah it was private.

prisma wave
#

yeah

dusky drum
#

lets try if it works

prisma wave
#

I'd also recommend you don't have onClose be nullable, just make it no-op by default

dusky drum
#

uff man it works

prisma wave
#

:)

dusky drum
#

now i have to do same with chat one

#

chat one is a bit different

prisma wave
#

yeah

#

so you can use a first class function again

#

it would just be (ChatInfo) -> Unit

#

instead of () -> Unit

#

or whatever the class for chatInfo is

dusky drum
#

okay let me try

#

oh and how would i get rid of those !!?

prisma wave
#

typically you would null check (or just remove the nullability if you can)

dusky drum
#

okay

#

so i got the onClose stuff working

#

how about the main class?

prisma wave
#

send it?

dusky drum
prisma wave
#

that doesn't look like a main class but alright

#

what are you asking?

dusky drum
#

well

#

first i wait for user to send some input then i close stuff and again send stuff on onclose

#

so in main i wait for users stuff

#

onclose i run stuff

#

like before

prisma wave
#

ok?

#

but what's the problem lol

dusky drum
prisma wave
#

ah yes

#

well the signature of ChatConfirmHandler is that it takes a ChatConfirmEvent and returns nothing

#

so it would be (ChatConfirmEvent) -> Unit

#

Unit is kotlin's equivalent of void btw

dusky drum
#

okay

#

so where do i set that?

prisma wave
#

wherever you use ChatConfirmHandler

#

and then you can remove that too

dusky drum
#

hm

#

how

#

so do i make var or something?

prisma wave
#

no?

#

I don't think so anyway

#

just use (ChatConfirmEvent) -> Unit instead of ChatConfirmHandler

dusky drum
#

where in abstract class or where i call it?

prisma wave
#

wherever you use it

dusky drum
#

i create it in abstract class

#

i sent you entire code of it

prisma wave
#

yes

#

so

#

just use (ChatConfirmEvent) -> Unit instead of ChatConfirmHandler

dusky drum
#

where da fk=?

prisma wave
#

wherever you use it

dusky drum
#

ITS RED

prisma wave
#

private val handler: (ChatConfirmEvent) -> Unit for example

#

ITS RED
that doesn't tell me much

#

apart from that you've done it wrong

dusky drum
#

eh

#

i missed comma

#

thanks for all the help, i would probably giveup if you didnt help me.

#

oih great

prisma wave
#

np lol

dusky drum
#

now

#

i have new issue

#

oh

#

i can change

#

that handler.onchat to handler.invoke?

prisma wave
#

you could just use handler()

#

but yeah

dusky drum
#

so invoke is same as just ()?

prisma wave
#

you might want to change the name too, since it's not really a handler anymore lol

#

yes

#

they are exactly the same

dusky drum
#

okay

ocean quartz
#

Hmm what would be faster, a switch that'll handle each token on each iteration or loop through all tokens on each iteration?

prisma wave
#

example?

dusky drum
#

so is it ok if i just use like content!! or is it better to do it with null check?

ocean quartz
#
for (character) {
  switch(character) {
    case TokenType.ASTERISK.getChar():
      // handles mached here
      break;
    // etc
    default:
  }
}

// or
for (character) {
  for (final TokenType tokenType : tokenTypes) {
     if (currentChar != tokenType.getChar()) continue;
     // handles matched here
  }
}
prisma wave
#

null check is always better @dusky drum

dusky drum
#

ok

#

so just simple if statement

prisma wave
#

possibly

#

there are lots of ways to null check in kotlin

#

you could use a default value with the elvis operator, or use the safe call operator

ocean quartz
#

You'll love ?:

prisma wave
#

or just normally

#

^

#

@ocean quartz it probably won't make a difference; wouldn't your best option be a hashmap?

#

O(1) lookup time

ocean quartz
#

Yeah that might be better, so something like: <'*', TokenType.ASTERISK>

prisma wave
#

yeah

ocean quartz
#

Also changing how i handle escaping, instead of doing lookbehind i'll do look ahead, seems easier to handle

prisma wave
#

alrighty

dusky drum
#

is like safe call ok?

prisma wave
#

yes

#

safe call is a just a null check

#

with a bit of syntactical sugar

dusky drum
#

so better than !!?

prisma wave
#

absolutely

#

!! just throws an NPE

dusky drum
#

ow

#

wtf

prisma wave
#

which is not what you should be doing

dusky drum
#

yep

#

so ? is like if(something != null)?

prisma wave
#

pretty much

dusky drum
#

great

#

less code

prisma wave
#

a?.b() = if(a != null) a.b()

dusky drum
#

oh great

#

now i have issues

#

from code that i found public... for lavaplayer

prisma wave
#

๐Ÿค”

dusky drum
prisma wave
#

looks like you need to make a TrackOperation?

dusky drum
#

fixed that

prisma wave
#

compile time null safety

#

it could be null, so you have to check it properly

#

bear in mind that the value could change before

#

the easiest fix is just a temporary variable

#
val song = songsl[i]
if(song != null) {
  blah
}```
dusky drum
#

aha

ocean quartz
#

I miss Kotlin

prisma wave
#

๐Ÿ˜ฆ

dusky drum
#

lel

prisma wave
#

nice lol

dusky drum
#

thats lavaplayer isnt it great

#

it doesnt shit that stuff out in java idk why it does it here tho

#

i mean it works

#

and my bot is now fully kotlin,ลพ

prisma wave
#

yay

dusky drum
#

hehe

#

and it works

#

thanks to your help

#

i just cant wait to get 100 warnings

#

in git commit

#

oh its just 20

onyx loom
#

matt ๐Ÿ˜ญ

ocean quartz
#

Yeah?

prisma wave
#

Clean

errant geyser
#

Its untested obv

ocean quartz
#

Don't think the resolvers will work unless you're on RC

errant geyser
#

RC?

ocean quartz
#

1.4-RC

errant geyser
#

Yeah I am

ocean quartz
#

Why convert it though?

errant geyser
#

Because I wanted to use your system but instead of annotations be able to do what I was on about earlier, so I converted it

ocean quartz
#

Ah okay, that's fair xD

ocean quartz
prisma wave
#

pretty sick

ocean quartz
#

Just found a bug on discord lol
and yeah, now is the parser again, more headache but hey i gotta learn this somehow

hot hull
#

What's not pretty sick is that .java

#

Smh

ocean quartz
#

Make MD put Kotlin in Spigot then

obtuse gale
#

Hey

#

I need help with the DeluxeMenus plugin

#

Is there a variable to display enchanted items in a menu?

analog crater
#

#general-plugins or their might be a deluxe menus specifc channel if you link your spigot acc

ocean quartz
#

@prisma wave Does ANTLR create source code of parser/lexer or is it just runtime?

prisma wave
#

it makes source code

ocean quartz
#

Oooh that's cool i might try it out then, i just need to see an example of a parser, this stuff confuse me so much

prisma wave
#

yeah parsers are tricky

south parrot
#

there is a good wiki for learn about MongoDB? (Java Class, Commands) for add it in a plugin please

analog crater
#

Mongodbs official blog is a good way to start

south parrot
#

thanks alot

split talon
#

Or you could not use Mongodb

#

PostgreSQL for the win

south parrot
#

i only want get more customers

#

๐Ÿ‘€

#

i can try postgreSQL after mongo one

chilly zenith
#

Anyone here actually good at making .bats

#

like all I need is something slight

quiet depot
#

@chilly zenith u of all people should know to just ask what you want

obtuse gale
#

smh

chilly zenith
#

I just need a program where I can input a name, select reason(s) and it copies to my clip board

distant sun
#

@prisma wave is PDM ready for production? :0

prisma wave
#

Possibly

#

It's definitely close

hot hull
#

So this is what I'm currently using for mob stacking, but it's unreliable, and honestly disgusting af, anyone got any suggestions as to what other approach I should take?
https://paste.helpch.at/sovapokuto.java

distant sun
#

Thats a big filter

hot hull
#

Yea not proud of it at all

obtuse gale
#

not kotlin

analog crater
#

ghost ping -_-

empty flint
#

I have a question for the Kotlin Crusaders here, maybe you can help me out

heady birch
#

Best database system for storing billions of live GPS tracks?

dusky drum
#

wat ta frik why billions?

obtuse gale
#

yml obviously

dusky drum
#

.,.

empty flint
#

Is it possible to invent new operators for Kotlin? I know you can overload existing ones and you can define infix functions that act as operators. But can those be any symbol as well? For example if I wanted arr1 ~ arr2 to mean arr1.append(arr2) or something of the sorts.

heady birch
#

Hmm I dont think so

#

You would have to use the name as far as im aware

dusky drum
#

i forgot how was it called i used to know

#

it was insanly fast

#

like 1mil writes per 10ms

empty flint
#

wat ta frik why billions?
@dusky drum Probs. got hired by the NSA to spy on the world.

@Niall Excel will crash on save after about 600k rows in my experience. Don't use any System that can be abbreviated by 2 letters...

dusky drum
#

XD

errant geyser
#

Niall some kind of SQL database?

empty flint
#

You would have to use the name as far as im aware
@heady birch I was afraid so. Ty...

errant geyser
#

Isn't that like, their purpose

heady birch
#

Lol

empty flint
#

Best database system for storing billions of live GPS tracks?
@heady birch I really like OracleSQL for big databases.

dusky drum
#

postgresql is good.

heady birch
#

Hmm yeah

dusky drum
#

but its kinda pain in ass to setup on vps or dedi machines.

hot hull
#

So this is what I'm currently using for mob stacking, but it's unreliable, and honestly disgusting af, anyone got any suggestions as to what other approach I should take?
https://paste.helpch.at/sovapokuto.java
fingerguns

dusky drum
#

ho java, so no kotlin?

errant geyser
empty flint
#

@empty flint might be interesting https://stackoverflow.com/a/37630881
@errant geyser I just found that as well, thanks. Dunno why it didn't come up the first 3 times I googled "kotlin custom operator" but whatever...

#

I don't like that approach however

errant geyser
#

I Googled "How to make new operator functions in Kotlin"

empty flint
#

'^' looks fugly. I wonder why they don't add that functionality, it would seem like they only need to allow infix functions to contain names containing any character.

errant geyser
#

ยฏ_(ใƒ„)_/ยฏ

#

There aren't any open issues for allowing custom ones in the issue tracker, at least none that I could find

#

You might wanna try opening one

prisma wave
#

Yeah you can't make new operators

#

It would add a huge level of complexity to the parser

errant geyser
#

inb4 you go and add it to the Elara roadmap

empty flint
#

It would add a huge level of complexity to the parser
@prisma wave Would it, though?

#

inb4 you go and add it to the Elara roadmap
@errant geyser Que? ๐Ÿ™ƒ
What is that?

#

There aren't any open issues for allowing custom ones in the issue tracker, at least none that I could find
@errant geyser There is this issue for example:
https://youtrack.jetbrains.com/issue/KT-1440

It's not the same but if they won't add these operators I don't think they will consider adding custom ones.

prisma wave
#

@prisma wave Would it, though?
@empty flint

Well, yes. The idea of lexing and parsing is that all of the potential inputs are essentially hardcoded. Adding a level of dynamicness to that would be much harder to parse

empty flint
#

@empty flint

Well, yes. The idea of lexing and parsing is that all of the potential inputs are essentially hardcoded. Adding a level of dynamicness to that would be much harder to parse
@prisma wave Scala does it with no problem. The difference between parsing an arbitrary function name like 'dumbFunc' compared to '^' is minimal. The difference is that in the parser, a function name is probably defined as any alphanumeric chain of characters, optionally containing - or _ and starting with a letter. All they would have to do would be to allow infix function names to be any character at all except for numbers (and whatever else is reserved for hardcoded stuff, like you can't name a function 'func' I don't think, but that's already implemented)

prisma wave
#

Good point

#

I'm sure it's possible, it's just probably not high on their priority list

empty flint
#

I'm sure it's possible, it's just probably not high on their priority list
@prisma wave That is the more likely issue, yes

#

I mean I would be happy with just adding binary operators and allowing all operators to be overloaded. That would include most operators anybody would need.

obtuse gale
#
fun test(){
    println("AHHh")
}
class HelloKt {

    fun a(){
        print("AHHH")
    }
}``` what would this compile to lol
#

would the test method just go in that class?

#

Im just messing around lol

prisma wave
#

Try it and see?

#

It will probably be HelloKt1 or something

#

Adding it to the existing class could break stuff

obtuse gale
#

it like....

#
public final class HelloKt {
   public static final void test() {
      String var0 = "AHHh";
      boolean var1 = false;
      System.out.println(var0);
   }
}
``` completely got rid of the a method
#

unless the IJ convertor doesnt do the top level things

#

also whats var1 for lol

prisma wave
#

My guess is nullability

heady birch
#
struct HelloKt {
}

impl HelloKt {
  fn test() {
    let var0 = "AHHH";
    let var1 = false;
    println!("{}", var0);
  }
}
prisma wave
#

You sure it's not in a different class?

obtuse gale
#

Its probably that the IJ convertor doesnt work like that?

#

I just hit decompile in ij

#

ill try and build a project in a sec

prisma wave
#

Build the project

#

And check the compiled classes

#

It will probably be in a separate class

hot hull
#

Legit noone got any suggestions for my issue?

obtuse gale
#

er

#

it just like

#

didnt compile

#
e: Z:\AHHH\src\main\kotlin\org\aj3douglas\ahhh\utils\Hello.kt: (1, 1): Duplicate JVM class name 'org/aj3douglas/ahhh/utils/HelloKt' generated from: package-fragment org.aj3douglas.ahhh.utils, HelloKt````
errant geyser
#

inb4 you go and add it to the Elara roadmap
@errant geyser Que? ๐Ÿ™ƒ
What is that?
@empty flint

The language me, BM, and Yugi are going to be making. It was a joke, ofc.

prisma wave
#

Oh lol

#

You'll probably need @file:JvmName then

versed ridge
#

compiled for me

obtuse gale
#

my file was named Hello

#

but the class was called HelloKt

versed ridge
#

ah

#

yeah doesn't compile

#

compiled with the @file:JvmName

obtuse gale
#

CompletableFuture<T> vs callback?

heady birch
#

rust experts tag me please

hot hull
#

@heady birch You seek wisdom?

heady birch
#

Yes

dusky drum
#

hmmm

#

java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics

#

do i need to shade entire kotlin into plugin:?

errant geyser
#

yup

dusky drum
#

omg

errant geyser
#

just relocate kotlin to your.example.thingy.Whateverthefucknobodygivesashit

dusky drum
#

thats gonna be like 1mb size

errant geyser
#

Oh well

#

Who gives one

dusky drum
#

?

errant geyser
#

Who gives a shit about the file size

dusky drum
#

is it even worth making entire plugin kotlin=?

prisma wave
#

Yes

errant geyser
#

I mean, depends what you define worth as

#

But generally yeah

prisma wave
#

Ever heard of PDM?

dusky drum
#

no

errant geyser
#

This is essentially an MLM scheme now huh

#

Anyway

#

PDM will solve your file size problem

prisma wave
#

This is essentially an MLM scheme now huh
Precisely

dusky drum
#

so

#

how do i use that

prisma wave
#

I'm so glad you asked

#

Basically what PDM does is it downloads dependencies at runtime

dusky drum
#

interesting

prisma wave
#

It isn't perfect but it's worked fine for kotlin in my testing

dusky drum
#

is it save?

#

safe*

#

to use all the time

prisma wave
#

Hm

#

I can't reliably answer that

errant geyser
#

But us MLM minions can

prisma wave
#

it seems to be mostly bug free but I've not tested it in production yet

hot hull
#

Im gonna go mad one day, this shit keeps starting off with gradle 4.4.1

#

Like damn

errant geyser
#

Its perfectly untesed but defo works, you have our one microsecond guarantee

prisma wave
#

wow someone unstarred

dusky drum
#

okay, for now i'll stick with just shading it into pl

prisma wave
#

It had 9 stars and now only 8

errant geyser
#

What idiots

prisma wave
#

Aight

#

Lol

errant geyser
#

I realised that word in other cultures than British slang is offensive

#

Whoops

dusky drum
#

:?

prisma wave
#

Yeah lol

#

Hasn't aged well

errant geyser
#

yeeeeah

#

When you're out of Tesco or whatever, might wanna reply to Yugi

prisma wave
#

Oh yeah I'm eating breakfast rn

errant geyser
#

You confuse me

prisma wave
#

Pourquoi ?

errant geyser
#

How are you having breakfast at 1:02pm

prisma wave
#

Oh

#

Idk

#

I was hungry

errant geyser
#

Surely that should be classed as lunch/whatever its called now rather than breakfast though?

#

I mean I never have breakfast anyway soooo

prisma wave
#

ยฏ\_(ใƒ„)_/ยฏ

#

Depends if you class toast as lunch

errant geyser
#

Why not

#

Its edible

prisma wave
#

true

dusky drum
#

im so god.

hot hull
#

Webhooks do not require a Discord account and thus do not have to be used with a running JDA instance.
Yet in order to get a webhook you need a jda instance, or am I just dumb?

#

Someone who's familiar with JDA please let me know if I'm dumb or if there's another way fingerguns

obtuse gale
#

I dont think you do

hot hull
#

Only method I've been able to find for it is through the jda instance

obtuse gale
hot hull
#

I'll take a look

obtuse gale
#

I mean its a webhook, wouldnt you just have to send something to the url?

hot hull
#

Yea but you need a webhook instance (atleast that's what it says on the GH tut), but I've only been able to get it through the jda

obtuse gale
#

webhook instance?

steel heart
#

alex now I also starred pdm

obtuse gale
#

I just manually sent a webhook with postman frcsty

prisma wave
#

@steel heart ty

obtuse gale
hot hull
obtuse gale
#

its probably possible with jda

#

but I mean

#
{
  "username": "Frosty",
  "avatar_url": "https://cdn.discordapp.com/avatars/307160296714403851/a08c9d65cc210cdc078d1baa1a5fa9a0.webp?size=128",
  "content": "Test webhook"
    }
``` You just gotta send the post webhook thingy, idk how to do it in java tho
hot hull
#

Yea imma use temmi shit

obtuse gale
#

that uses this

#
    public void sendMessage(DiscordMessage dm) {
        Runnable r = new Runnable() {
            public void run() {
                String strResponse = HttpRequest.post(url)
                        .acceptJson()
                        .contentType("application/json")
                        .header("User-Agent", "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11") // Why? Because discordapp.com blocks the default User Agent
                        .send(gson.toJson(dm))
                        .body();``` and just does that
regal gale
hot hull
#

Who

regal gale
#

The same guy who contributed to JDA

quiet depot
#

unfortunately?

dusky drum
#

yey i found problem

regal gale
#

I mean, I was stating my different opinion to what Aj suggested above

dusky drum
#

fixed my issue

#

how could i close mutablemap in kotlin since atm i get issues (java.util.ConcurrentModificationException: null) ?

#

copy*

prisma wave
#

how are you doing it atm?

dusky drum
#

well

prisma wave
#

it's probably a 1 liner