#dev-general

1 messages ยท Page 112 of 1

prisma wave
#

Idk probably

#

for getting SQL drivers and things I guess

rotund egret
#

GD uses sha1 to download too :(

prisma wave
#

To verify the downloads?

quiet depot
#

afaik as long as it runs offline after initial startup it's fine
@prisma wave itโ€™s ok so long you provide a place to manually download dependencies

prisma wave
#

Ah yeah that makes sense

#

Well it does so

#

ez spigot rules compliance

onyx loom
#

๐Ÿ™‚

rotund egret
#

Yes

obtuse gale
#

Would anyone be able to help me - My server keeps crashing and I have no idea why

#

logs

#

where is it

#

ok found it

#

=paste

compact perchBOT
#
HelpChat Paste

Please use a paste service to share configs, errors, code and long logs.
โ€ข HelpChat Paste

obtuse gale
obsidian dragon
#

can I hire a good na dev to help me with some skyblock bugs

#

you must know what your doing (dont waste my time) I will pay you based off how much work you do

hallow crane
obsidian dragon
#

thankyou

light venture
#

so glare

#

whens the waffle update

signal tinsel
#
SELECT id FROM punishments WHERE active=true AND expirationDate>NOW() AND type=0 AND target=`069a79f4-44e9-4726-a5be-fca90e38aaf5` LIMIT 54;```
#

LOL how is this not valid

#

Unknown column '069a79f4-44e9-4726-a5be-fca90e38aaf5' in 'where clause'

#

Wait

#

Do I need to select all the things like active, expirationDate and target?

old wyvern
#

no

#

That query is valid

signal tinsel
#

Ok

#

Fixed it

jovial warren
#

why you even executing raw queries @signal tinsel

signal tinsel
#

?

#

Im not

#

Wait i am

jovial warren
#

yes you are smh

signal tinsel
#

Cuz you can't input direct strings

jovial warren
#

use ORM software

signal tinsel
#

Only uuid int and bool

jovial warren
#

it handles the queries for you

#

for Java I recommend ORMLite

#

for Kotlin I recommend Exposed

signal tinsel
#

Meh

#

This works

#

And i like this

jovial warren
#

raw queries are bad practice imo because of how easy they are to fuck up

signal tinsel
#

Thats learning

jovial warren
#

and how annoying it is when you have to change them

signal tinsel
#

Mistakes happen and you learn from them

#

Im not scared of bad queries

jovial warren
#

yeah but for someone like me who doesn't always learn from his mistakes, I prefer to not make the mistake in the first place

#

but I suppose I'm just generally more used to using ORM anyway

#

you should still give ORM a try some time though

#

whether you plan on using it or not, you should always try out all of your options before you make a decision

heady birch
#

ORM's are amazing

#

especially hibernate with spring

jovial warren
#

and Spring has built-in ORM don't tell me

#

yep

#

knew it

heady birch
#

lol

jovial warren
#

I should give it a go some time

#

Spring ORM

#

does it have MariaDB support?

heady birch
#

think so yeah

jovial warren
#

it's got a MySQL driver and Spring Data JDBC

#

JPA vs JDBC though?

signal tinsel
#

I wanna learn spring

#

But i need a project

jovial warren
#

so do I

signal tinsel
#

Something to make while learning

jovial warren
#

I'm rewriting my bot in Spring

#

try writing something like a bans plugin in Spring

#

with a built-in web interface

#

which means you cover Spring, Spring Data, and Spring Web

signal tinsel
#

Nice

#

What does spring by itself do

frigid badge
#

it's a web framework

#

huge ass framework

#

with a load of magic

quiet depot
#

but rpf > spring

#

in approximately 1200 days

onyx loom
#

1200 days?????????

#

papi 3 ๐Ÿ™

heady birch
#

Snagging some odin keywords

onyx loom
#

๐Ÿ˜ฎ

hot hull
#

White theme

#

No allman

#

Ew

heady birch
#

This

quiet depot
#

is called bad code

heady birch
#

thinking about making KiteBoard.get(Class<T>)

quiet depot
#

how about you completely remove that shit from your main class, because it doesn't belong there

heady birch
#

what

#

where would it go

quiet depot
#

in a dependency injection system called guice :3

heady birch
#

๐Ÿ˜ฆ

quiet depot
#

or in your case, spring autowired

heady birch
#

Actually

#

Guice- how large is it again?

#
  1. something mbb?
quiet depot
#

like 600mb if you properly exclude spigot deps

heady birch
#

kb?

#

you mean

quiet depot
#

oh yeah kb sorry

heady birch
#

...

#

I guess I could

#

I quite liked it

quiet depot
#

it's pretty nice

heady birch
#

As they say

#

more injectors the better

#

uh LOL

#

Wait- how does this affect my api?

#

What are the consequences for third party applications?

#

How will this impact the reputation of our company?

onyx loom
#

niall inc.

quiet depot
#

you forgot when and why

#

and where

heady birch
#

monsters university inc

quiet depot
#

how 1) move your manager getters into a separate api singleton, or ya know, don't let 3rd parties use your internal components
what) they'll all break till they move to the above
how 2) your company will gain positive rep for inherently being made better, simply by having guice

onyx loom
#

mike wazOWzki

heady birch
#

I already expose interfaces for the internals

quiet depot
#

then just move the shit to another class

#

if you want backwards compatibility, deprecate the stinky code

heady birch
#

They want an api they said

#

They need an api they said

#

I dont think 1 person who wanted it has used it

#

Class CriteriaRegistryImpl is uninstantiable, and thus can not be bound

#

Why is it telling me that

#

Oh nevermind

#

Havnt updated constructor ๐Ÿ˜„

signal tinsel
#

I hate managers lmao

quiet depot
#

why

signal tinsel
#

Idk

#

It never makes my code more organized when i do it

#

Only messier

heady birch
#

837kb

quiet depot
#

you've excluded the deps wrong

#

I just checked my binary

heady birch
#

No thats the base size for guice

quiet depot
#

guice is 729kb

heady birch
#

I havnt compiled yet

quiet depot
#

compressed

#

ah ok

#

are you using gradle?

heady birch
#

I assume its standard to bind Server and Logger?

#

maven

prisma wave
#

Imagine shading

quiet depot
#

logger is already binded

heady birch
#

the plugin logger?

quiet depot
#

no, just a java logger

prisma wave
#

Couldn't be me

quiet depot
#

if you're using paper, you may want to manually bind the slf4j logger

heady birch
#

bukkit kinda guy

quiet depot
#

and yeah, server is a common binding

#

fyi, I wouldn't advise to add guice to an existing project

#

generally a project should be designed around guice

heady birch
#

Ok thanks for telling me now ๐Ÿ™‚

quiet depot
#

it's not something you can just add

#

lol

heady birch
#

Nah its fun I'm continuing

quiet depot
#

I only just thought of it

#

aight, gl

heady birch
#

Api is only a month old so no problem if changing it

quiet depot
#

just imagine implementing spring onto an already existing project

#

would be pretty difficult to do right, without recreating the project entirely?

#

these libraries generally want you to code in a specific way, and you can't code in that way without the libraries

signal tinsel
#

Ye

heady birch
#

I totally see what you mean yeah

#

Looks like i will be injecting KiteBoardPlugin the most which doesnt feel right

quiet depot
#

is that your application's entry point?

heady birch
#

only because of classes scheduling tasks

quiet depot
#

or whatever extends javaplugin

heady birch
#

yes

#

wait

#

yes

quiet depot
#

abstract scheduling then

heady birch
#

exactly

quiet depot
#

you shouldn't ever need to inject your main into lower components, it's super bad practice

heady birch
#

I was going to make KiteScheduler or something

#

Yeah

#

I have used guice before in the past

quiet depot
#

luckily guice helps cover up bukkit's design mistakes

heady birch
#

also fixes my design mistakes

#

Any way I can build a provider

#

So- at startup I need to determine the NmsAdapter

quiet depot
#

provider for what?

heady birch
#

I know its poor practice to do that within the Module

#

and I really wouldnt want to do that anyway

quiet depot
#

module shouldn't have any logic in it

heady birch
#

Yeah

#

I could always just inject NmsManager that determines it at startup

quiet depot
#

not a fan of that

heady birch
#

me neither

#

any way look like I can use a provider <T>

quiet depot
#

I'd just have some sort of nms determination logic, in a class, which provides the module with the correct implementation to bind

jovial warren
#

yeah I'm recreating my project in Spring lol

heady birch
#

NmsManager has gone ๐Ÿ™‚

jovial warren
#

I'm hoping Spring won't weigh it down though

quiet depot
#

define weigh it down

jovial warren
#

make it not able to run on my 1 GB EC2 free tier any more without performance issues

#

though I'll probably need to get a new VPS anyway at some point

#

wish I could use Hetzner, if only Discord hadn't banned them

quiet depot
#

can always have a home server

#

how's your internet?

jovial warren
#

I do have a home server, but it's a dell optiplex and the internet here is terrible anyway

#

I get a maximum of 60-70 Mbps down and like 15-20 Mbps up

quiet depot
#

ah

#

i've got 2 nucs

#

my little cluster

jovial warren
#

and my dell optiplex running CentOS 8 doesn't like my WiFi dongle

#

even though the driver is built-in to the damn kernel

#

I wanna get either a dedi or a decent VPS from like OVH or SYS but they're like 16+ and 18+

#

so I'd have to get my parents to send in a copy of one of their passports or driving licenses to get it

quiet depot
#

did you take a look at oneprovider?

jovial warren
#

oneprovider?

quiet depot
#

I linked it to you yesterday .-.

jovial warren
#

oh yeah that

#

lemme take another look

#

4GB DDR3 with 128 GB SSD and 1 Gpbs ain't too bad I suppose

#

but an Intel Atom is questionable

quiet depot
#

lol what does that cost

#

a cent a month

#

what's your min specs

jovial warren
#

also, that costs $7.14

#

min specs? I just want something that'll perform well so I can basically do anything with it

quiet depot
#

aight what's your budget then

jovial warren
#

up to ยฃ40/month

#

that's my absolute maximum

quiet depot
#

my friend has a ~30 eur dedi from oneprovider, 32gb ram, can't remember the other stuff, but it was a steal

jovial warren
#

preferrably somewhere up to ยฃ30/month

#

~30 euro?

quiet depot
#

around that

jovial warren
#

no bull shit like verification?

quiet depot
#

idk

jovial warren
#

or am I gonna have to ask my parents to scan one of their passports in

quiet depot
#

it's a decent dedi btw, not some piece of shit with like 32gb ddr2 or something

#

and I honestly don't know

#
A: The verification system was implemented in order to avoid fraudulent actions or illegal transactions. New customers paying with a credit card not supporting 3D secure, or an unverified PayPal account will be required to provide identification. Verified PayPal account will not be required to do this verification. Please note that verification may be required again if you decide to change your payment method.```
#

is your paypal verified?

jovial warren
#

verified?

#

no idea

#

I'm 15 years old so probably not

quiet depot
#

is your paypal linked to a card or a bank account?

jovial warren
#

it's linked to my card which is a prepaid

quiet depot
#

link it to a bank account

jovial warren
#

and it was linked to my mothers and grandmothers debit cards

#

but my nana's card expires this month, and my mum's card shouldn't have even been on there in the first place so I took them off

#

also, hook it to a bank account?

quiet depot
#

yes

jovial warren
#

who's? because I don't have one

quiet depot
#

get one

#

you're 15, you shouldn't even need your parents to register for one

jovial warren
#

yeah I suppose I could ask my parents to sign me up for Barclays remote banking thingy

quiet depot
#

just go to your local bank, and sign up

jovial warren
#

I'd have to get my parents

#

since it'd have to be a young person's account

regal gale
#

Freakin' parents restriction thonking

jovial warren
#

you can't get a proper account until your 18 over in the UK

quiet depot
#

rip

regal gale
#

I'm near to 18 btw

quiet depot
#

don't think there's a minimum age in aus

heady birch
#

isnt it 19

#

i cant remember

jovial warren
#

I could ask my parents to sign me up though

regal gale
#

18 is the perfect age, cannot ask more

quiet depot
#

I've got 2 bank accounts rn, don't think you even need a parent to sign up for u

jovial warren
#

I can get a teen's current account

#

actually that's 16+

obtuse gale
#

oof

regal gale
#

" teen's current account"

#

That's new

jovial warren
#

I know there is one for 11-15 year olds

regal gale
#

Hold on a sec

quiet depot
#

right anyway

#

get one

#

link it to paypal

regal gale
#

Can the age 13+ get a credit card already?

jovial warren
#

I can't get a proper current account until I'm 16 piggy

hot hull
#

Y'all hella young

obtuse gale
#

I can get a debit card not a credit card thien, it might be different in other places

regal gale
#

@hot hull shush boomer

quiet depot
#

so long you have the bsb & bank number you'll be fine

jovial warren
#

that's not how it works

prisma wave
#

I've had a debit card since I was 11 ๐Ÿค”

regal gale
#

Aw man

obtuse gale
#

gotta be 13 here to get a debit card

jovial warren
#

yeah I have a goHenry prepaid

heady birch
#

What existing lugins use Guice?

obtuse gale
#

who tf henry

quiet depot
#

it's 16 in wa aj

regal gale
#

I mean, I could've had one, but the freaking parent's restriction

#

Bruh

jovial warren
quiet depot
#

debit that is

#

you can get an eftpos card younger

#

credit card is 18+

obtuse gale
#

bruh

jovial warren
#

credit card is always 18+

obtuse gale
#

what the fuck dyno

regal gale
#

I can get a debit card if I wanted to

jovial warren
#

wait Dyno's in here?

regal gale
#

I love debit card more than

obtuse gale
#

Its kinda like how next year I have to register for a NSW lisence so i can get it one year earlier

#

so i can grab a friends adress and use that for my license

#

then I can get my actual one a year earlier

jovial warren
#

how do I know if my PayPal is verified anyway?

quiet depot
#

if you have a bank account or card linked, it's verified

#

I recommend you link the bank account just incase

jovial warren
#

I have a card linked

#

I can't link a bank account because I don't have one

quiet depot
#

that's why I said get one

jovial warren
#

I can't

#

like, cannot

#

full stop

quiet depot
#

k then hope the card is good enough

obtuse gale
#

how do you have a card but not a bank account?

jovial warren
#

there is no possible way for anyone under 16 to obtain a bank account in the UK

obtuse gale
#

Whats the card linked to?

regal gale
#

Debit card doesn't need one

jovial warren
#

how do you have a card but not a bank account?
I have an account but not a proper one like one with a number and sort code

obtuse gale
#

well where does the money come from

#

oh

jovial warren
#

I'm surprised PayPal even accepted this one anyway

quiet depot
jovial warren
#

since this bank is specifically for people under 16

#

idc about SSD

quiet depot
#

k then one of those is good (go with the second)

jovial warren
#

you know what

quiet depot
#

bardy i'm reviewing your bardybot atm

#

and i'm gonna be honest

jovial warren
#

I'm just gonna go on SYS and ask my parents to verify for me screw it

quiet depot
#

I don't know kotlin

jovial warren
#

but it's shit I know

#

I'm rewriting it

quiet depot
#

yeah it's not great

jovial warren
#

it's getting rewritten using Spring

quiet depot
#

if you're rewriting it, ima hold off on the review

#

send another when you're ready

jovial warren
#

yeah I will

#

oh that one

#

lol

quiet depot
#

?

jovial warren
#

I didn't know you meant my role request lol

quiet depot
#

o

#

what did you think I meant?

#

we don't have any other sort of official review system in here

jovial warren
#

I kinda forgot about the role request tbh

prisma wave
#

there is no possible way for anyone under 16 to obtain a bank account in the UK
??? Lots of banks do kids accounts

jovial warren
#

yeah but not with acc numbers and sort codes like a proper bank afaik

#

also I'm gonna need a hand with this rewrite

quiet depot
#

that's what we're here for

jovial warren
#

as I said, structuring projects is not my forte

quiet depot
#

go with the flow

#

that's what I do

jovial warren
#

I don't have any fucking flow

quiet depot
#

usually works out spectacularly

jovial warren
#

if I "go with the flow" it'll end up like last time

quiet depot
#

well

#

get pencil and paper, and write it down

#

then post your planning, and we'll tell you why it's shit

prisma wave
#

Mine is a completely normal bank account

jovial warren
#

if I knew how to use Spring then yeah I'd be writing right now

prisma wave
#

online banking and everything

jovial warren
#

I've made this JDAService thing

quiet depot
#

spring is huge, might take a while before you can write clean code in it

obtuse gale
#

mines a normal bank account but they made me set my parents as an admin

#

But from what I can see I can turn that off whenever I want online lol

onyx loom
#

ive a bank account

#

sort code account number

#

im on nationwide

prisma wave
#

santander >

hot hull
#

Kali, how old i u

onyx loom
#

16

#

ive had my bank since i was like 13/14

quiet depot
#

I got my full bank account when I was 12 iirc

#

student & saving, student linked to a card

jovial warren
#

how do Spring @Services work by the way?

quiet depot
#

are you asking for the bts explanation, or their use?

jovial warren
#

I want everything

#

but I learn best by seeing how something works in context and then reverse engineering that

quiet depot
#

the bts explanation is probably incredibly complicated, and I don't know their use, I've never used spring

#

look it up on baeldung

#

they write big fat spring courses

#

and lot's of other java related stuff, they're mainly known for spring through afaik

jovial warren
#

yeah as I said though, I learn best by first knowing how something is supposed to work, then seeing it working and reverse engineering that to figure out what it's doing

#

it's my way of avoiding things that require some element of creative thought, by copying others

#

okay so services are for things that do things

#

like a maths service that adds and subtracts

#

it's a thing that does things

#

also, is there any way to avoid IntelliJ complaining at me for naming a constant that isn't const (because it's a list) in full capital snake case?

#

or is it telling me that because that's not the convention for those types of things

#

it's what I came up with for the JDAService

prisma wave
#

any constants (eg private static final) should be upper snake case

jovial warren
#

they are aren't they?

prisma wave
#

I would make a bean for JDA

hot hull
#

I made it lowercase at first, but then I remembered your preachings KM

jovial warren
#

isn't upper snake case UPPER_SNAKE_CASE?

hot hull
#

Yes

jovial warren
#

yeah my constants are upper snake case then

prisma wave
#

ok

#

good

jovial warren
#

also you said JDA should be a bean?

#

tf is a bean?

#

when you say bean it reminds me of a magic bean from Once Upon A Time lol

#

what kind of bean you on about?

#

In computing based on the Java Platform, JavaBeans are classes that encapsulate many objects into a single object (the bean). They are serializable, have a zero-argument constructor, and allow access to properties using getter and setter methods. The name "Bean" was given to e...

hot hull
#

It's a bean

prisma wave
#

i'm not sure what the actual definition is

#

but in spring a bean is something that can be injected

jovial warren
#

a class that encapsulates many objects in to a single object is what the definition of that is

prisma wave
#
@Bean
fun jda(): JDA = ourJDAInstance
``` then you can autowire `JDA` anywhere you need it
jovial warren
#

did you even look at the bin link I sent by the way? just curious

prisma wave
#

yep

#

that's what prompted me to suggest the bean lol

jovial warren
#

ah okay

#

so where does the bean go?

prisma wave
#

in the service class

jovial warren
#

can't I just annotate createJDA with @Bean then

#

or is this bean supposed to so something different

prisma wave
#

that might work

#

not sure how well it would autowire a String though

jovial warren
#

no beans of type String yeah

prisma wave
#

you probably want to use spring-config or something to have a config wrapper class

frail glade
#

We're live!

jovial warren
#

config wrapper class?

#

wdym we're live glare?

#

you probably want to use spring-config or something to have a config wrapper class
wdym? for what?

prisma wave
#

to configure the token

#

that way it can be autowired automatically

jovial warren
#

but what do I put in this new class?

#

that ain't rhetorical

prisma wave
#
@Configuration
@ConfigurationProperties(prefix = "bot")
class DiscordConfig {
    lateinit var token: String
    lateinit var defaultGuildIcon: String
    lateinit var welcomeMessage: String

    val icon: Image by lazy {
        Image.ofUrl(defaultGuildIcon).block()
    }

}``` this is an example of something I used a while ago
#

spring will automatically generate an instance from application.properties / application.yml

jovial warren
#

also what does it mean by "must be in canonical form"?

prisma wave
#

where?

jovial warren
#

@ConfigurationProperties

prisma wave
#

oh idk

jovial warren
#

Prefix must be in canonical form

prisma wave
#

i've never done that much spring stuff

#

it might want it to start with a capital letter or smth

jovial warren
#

okay I'm guessing that prefix isn't the bot's prefix lol

#

since having it as "bot" worked

#

also what does lateinit do?

prisma wave
#

marks the property as late initialized

#

ie it will be initialized, but not initially

jovial warren
#

ah okay

prisma wave
#

it's a nicer way of dealing with nullable stuff

#

it throws an exception if accessed before intialization, but can't be null

jovial warren
#

then how do I link this class to an actual config file?

#

and in what format do I store the config file?

prisma wave
#

afaik it reads application.properties|yml by default

jovial warren
#

so these values gotta be in application.properties then

prisma wave
#

yeah

#

you can configure a different file iirc

#

but no clue how lol

#

probably an annotation

jovial warren
#

also it says it has to be defined

#

which then it creates some additional configuration file in the META-INF folder

prisma wave
#

what has to be defined

jovial warren
#

if I put bot: in application.properties

prisma wave
#

that's not how property syntax works

#

it would be bot.token="blah"

jovial warren
#

then it's gotta be defined?

#

in the additional-spring-configuration-metadata.json file

#

then in that file it has a red bar telling me "Spring Boot Configuration Annotation Processor not configured"

#

so have I gotta depend on that then

prisma wave
#

i believe so

jovial warren
#

okay now I've depended on it and refreshed it still says it's not configured ๐Ÿค”

#

this is a weird framework

#

oh I'm supposed to use annotationProcessor

#

also, apparently kotlin.String isn't a class

#

according to this properties thingy

#

okay nvm about that

#

now how do I use this wrapper

prisma wave
#

inject it and get the property value

jovial warren
#

so just replace the token parameter with config: DiscordConfig and use config.token?

prisma wave
#

yep

jovial warren
#

okay

#

now what do I do about the init method I have

#

initialise()

prisma wave
#

I'd add prefix to the config too

jovial warren
#

it calls createJDA directly

prisma wave
#

yeah don't do that

#

have an instance of JDA autowired

jovial warren
#

as lateinit?

ocean quartz
#

anyone up for some small ๐Ÿ‘๐Ÿป code review ๐Ÿ‘๐Ÿป?

jovial warren
#

for the prefix

prisma wave
#
    @Bean
    fun commandManager(config: BotConfig, jda: JDA): CommandManager {
        return CommandManager(jda, config.prefix)
    }
jovial warren
#

shouldn't these be constructor params also?

prisma wave
#

the config should be

#

JDA, no

jovial warren
#

the config values should be constructor params right?

#

like the token and prefix

prisma wave
#

i don't think they can be because of how spring config works

jovial warren
#

ah okay

prisma wave
#

it needs a no-args constructor iirc

distant sun
#

Does anybody know how viabackwards handle the new hex colors?

jovial warren
#
@Bean
fun commandManager(config: DiscordConfig, jda: JDA) = CommandManager(jda, config.prefix)

that should do right?

distant sun
#

I'm kinda curious xd

jovial warren
#

Does anybody know how viabackwards handle the new hex colors?
no clue lol

distant sun
#

is there even any 1.16 spigot?

frail glade
#

No

distant sun
#

welp

#

I guess we have to wait xd

#

o/

jovial warren
#

they've gotta redo the entire colour system from scratch on Spigot

#

anyway, where were we KM

#

that function I sent should do right?

prisma wave
#

yes

jovial warren
#

okay what now?

prisma wave
#

Idk

#

Whatever you want to implement next

jovial warren
#

well I might wanna make this bot actually work first lol

#

so I'm guessing I go to the application class for that

#

now how do I call these bean methods I just made?

prisma wave
#

you don't

jovial warren
#

Spring does

prisma wave
#

you autowire the required types and spring does that for you

#

mhm

jovial warren
#

okay how do I do what you just said then

prisma wave
#

autowire an instance of JDA to wherever you need it

jovial warren
#

autowire an instance of JDA?

prisma wave
#
class SomeClass 
  @Autowired constructor(val jda: JDA)
#

or whatever you need

#

yes

jovial warren
#

but I don't really need it anywhere

#

except for giving it to the command manager

prisma wave
#

ok?

#

it was an example lol

#

my point is that you autowire things to where you need them

jovial warren
#

okay

prisma wave
#

to do whatever it is that you want to do

jovial warren
#

all I need to do is have Spring call that createJDA() method in the main function and it'll connect

prisma wave
#

which you can do by having a JDA instance autowired to somewhere

jovial warren
#

but to where?

prisma wave
#

your main class possibly

#

maybe wherever you use a CommandManager

#

idk

jovial warren
#

I use command manager in the main function to declare commands

#

well, I don't yet, but I did in my old project

prisma wave
#

that should probably be in another class

#

but if you were to autowire a CommandManager to that class, the JDA would be created

jovial warren
#

autowire a CommandManager to my main class BardyBotApplication?

#

the one annotated with @SpringBootApplication

prisma wave
#

It should probably be elsewhere

#

in a @Component class CommandComponent for example

#

as should the registration of the CommandManager imo

jovial warren
#

what exactly am I gonna put in that component class?

prisma wave
#

registration of the commands

#

and anything else related

jovial warren
#

you know there is no "imo" because I'm just gonna end up following what you say right

prisma wave
#

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

jovial warren
#

because I 1. Don't know Spring and 2. Cannot structure projects

prisma wave
#

i'm not an expert so take everything I say with a reasonable amount of salt

jovial warren
#

so if I'm registering commands in this component class, am I gonna want to create methods to register commands?

onyx loom
#

bm isnt an expert? ๐Ÿ˜ฎ

prisma wave
#

probably yes

#

i'm not a spring expert

#

i usually just make it up as I go along lol

jovial warren
#

and also, how do I get Spring to call this method then?

#

or does it just call all methods in a component class anyway

prisma wave
#

nah it won't

#

at this point I imagine you'd autowire the CommandComponent into your main class and call the methods

jovial warren
#

this is the most fucking confusing shit I've ever seen in my life jesus christ

prisma wave
#

you get used to it

#

it makes following the SRP much easier

jovial warren
#

at this point I imagine you'd autowire the CommandComponent into your main class and call the methods
how does one do exactly that then?

#

it makes following the SRP much easier
yeah by being a pain in the ass

prisma wave
#
@SpringBootApplication
class MainClass {
  @Autowired lateinit var commandComponent: CommandComponent
}``` should work
jovial warren
#

okay now that links to the commandManager() method in JDAService

#

now wtf do I do with that

prisma wave
#

call the methods?

jovial warren
#

the methods in CommandComponent or what?

#

or the CommandManager methods

prisma wave
#

wait my bad

#

changed the example ^

jovial warren
#

and how exactly do I call these methods? in another method or in init?

#

yeah will do

prisma wave
#

init probably works fine

#

this is where my limited spring knowedge is starting to run out ๐Ÿ˜ณ

jovial warren
#

IJ warns me about accessing a non-final property in a constructor

prisma wave
#

actually init is probably a bad idea

signal tinsel
#

Whats guice for

prisma wave
#

DI

ocean quartz
#

Orange guice is nice

obtuse gale
#

So, when a user does a command, I want my bot to ask them some questions (like 5-7). for example What is your IGN I then want all the answers to be sent in an embed to a special channel

#

Whats the best way to go about this?

#

And I want to have an ID or something linked to said embed

#

So a staff member can click a reaction on it to reply to the user

signal tinsel
#

Java guice

#

Whats that for

jovial warren
#

have them ask a question, then have them enter their answer for text, or react with their answer for multiple choice aj3

prisma wave
#

DI

#

@signal tinsel

jovial warren
#

actually init is probably a bad idea
what's a better way?

obtuse gale
#

well yeah but whats the best way to handle it code wise?

signal tinsel
#

Di?

jovial warren
#

dependency injection

obtuse gale
#

Like should I have some form of data class that holds their answers or is that overkill

ocean quartz
#

Dependency Injection

signal tinsel
#

Oh

#

Explain more

jovial warren
#

GIYF xD

prisma wave
#

it's automatic dependency injection

ocean quartz
#

It's a lib for dependency injection

prisma wave
#

simple as

signal tinsel
#

..

#

What does that do

prisma wave
#

passes instances around

ocean quartz
#

It.. injects.. dependencies

prisma wave
#

lol

jovial warren
#

if you wanna know about dependency injection, giyf

signal tinsel
#

Aaaa

prisma wave
#

it's DI without all the manual constructor calling basically

jovial warren
#

anyway, where should I call these methods KM?

prisma wave
#

good question

#

using a CommandLineRunner would work but idk how good a practice that is

#

@heady birch

#

your expertise is required

obtuse gale
#

for example is it worth having something like this?

data class Request(
    val answerOne:String = "",
    val answerTwo:String = ""
)```
ocean quartz
#

we have summoned the spring god

jovial warren
#

lol

heady birch
#

I have been summoned

#

Give me your questions

jovial warren
#

how does one do things

#

lol

heady birch
#

what do you want to do

jovial warren
#

I'm terrible at explaining as I have no idea

#

@prisma wave you do the explaining ๐Ÿ™‚

rotund egret
#

Step 1: Open Notepad
Step 2: type shutdown /s
Step 3: save as a batch file
Step 4: run file

ez

prisma wave
#

idfk how to explain it lmao

jovial warren
#

one can join a voice channel and share his screen if it may help

#

which is what one is currently doing

#

okay lemme try and explain this

#

so I've got one of these service classes with bean methods in them, and I've got this component class, and I wanna know what to do with these methods

#

okay that's terrible

#

@heady birch it'd be much easier if you saw it for yourself

heady birch
#

Hmmm

#

For like to call methods on startup?

jovial warren
#

basically that createJDA method has to be called to get a JDA instance to give to Matt's CommandManager so then you can register commands

heady birch
#

I'd make your createJDA bean just jda

#

then

obtuse gale
#

How do state machines work?

jovial warren
#

done

heady birch
#
@Service
public class CommandService {

  @Autowired
  public CommandService(final JDA jda) {
     CommandManager....
  }
}```
#

then the JDA gets auto wired

jovial warren
#

Java ew lol

obtuse gale
#

Someone is suggesting I use them but I dont really understand it lol, Im tryna get my bot to ask the user a series of questions, then post the answers to the question in a channel at the end

#

So I get that each question would be a state (i think lol)

#

But I dont get how I would actually deal with that

jovial warren
#

in Kotlin that would have to be something like:

@Service
class CommandService @Autowired constructor(val jda: JDA) {

    init {
        TODO("Do something")
    }
}

I think

#

then what do I do there?

#

just register commands?

heady birch
#

yeah

#

I think so

jovial warren
#

@ocean quartz you really need to implement a method in to your framework that takes a list of commands and registers them all at once lol

#

how do I get an instance of commandManager?

#

@Autowired lateinit var commandManager: CommandManager?

prisma wave
#

Autowire it

#

Do it through the constructor

heady birch
#

but make sure you make a @Bean for it

jovial warren
#

so @Autowired constructor(val jda: JDA, val commandManager: CommandManager)

#

I did in the JDAService

#

also, IJ is still warning me about accessing a non-final property in the constructor

#

also also I've got nothing to call in that init yet since I don't have any commands so I'll just leave that for now

#

how do I get this code called in the main function?

#

The bean 'jda', defined in class path resource [dev/bombardy/bardybot/JDAService.class], could not be registered. A bean with that name has already been defined in file [/home/bombardygamer/IdeaProjects/BardyBot/build/classes/kotlin/main/dev/bombardy/bardybot/JDAService.class] and overriding is disabled. okay what the actual fuck

#

that's so dumb it's insane

ocean quartz
#

I can yeah, the lib isn't finished yet
Though you can always:

listOf(
  Command(),
  Command2()
).forEach(commandManager::register)
jovial warren
#

true

#

@heady birch wtf does that message I sent mean

#

it tells me that the bean can't be made because it already exists in the compiled version????????/

heady birch
#

Hm thats odd

#

Ive never seen that

#

maybe mvn clean or the gradle alternative to that

jovial warren
#

I just deleted the build folder

#

and it regenerated

#

still same issue

#

maybe I'm supposed to run bootRun

#

though that fails

#

Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1

#

running BardyBotApplication (the Spring Boot app) has that error I mentioned earlier

#

anyone got any ideas whatsoever?

hot hull
#

Any suggestions as to how I should handle permission checks if the user has the * permission? Cause right now it just fucks the entire system

ocean quartz
#

If they have * player.hasPermission will always be true
What fucks your system? ;o

hot hull
#

Let's say I have the test.test permission, having the wildcard perm somehow messes up all the priorities, (was tested without the wildcard perm and it worked perfectly)

hot hull
#

I have found a way to counter that

jovial warren
#

hey @ocean quartz what's @Requirement for and where is it used in your JDA framework?

#

and also, what's @Delete for

obtuse gale
#
        commandManager.registerRequirement("#admin") {
            val admin = jda.getRoleById(config[Setting.ADMIN]) ?: return@registerRequirement false
            return@registerRequirement it.roles.any{ role -> role.position >= admin.position}
        }```
`    @Requirement("#admin")`
ocean quartz
#

So not everyone can use the command, only those that meet the requirement, it's used on the functions
And delete is for auto deleting the message once the command is sent

jovial warren
#

ah okay

#

so what's the value() in that then?

#

the permission?

#

@ocean quartz

ocean quartz
#

Same thing as others, it's named value because java and annotations
Basically it requires a boolean

jovial warren
#

boolean of what? if it's a requirement or not?

ocean quartz
#

If it meets the requirement or not

#

Aj showed you an example

jovial warren
#

ah okay

#

also, it's not for me

#

though you'll figure out what that means later

obtuse gale
#

I just made a request free that would benefit alot of people :D

jovial warren
#

you wanna make an IDE?

boreal needle
#

for free?

obtuse gale
#

no, i want someone else to make a IDE site..

jovial warren
#

for free?

obtuse gale
#

yes

boreal needle
#

yeah nobody has the time or motivation for that

wary lichen
#

especially motivation

obtuse gale
#

well yeah but it dosent benefit me as much as others

boreal needle
#

why can't you just use vscode

obtuse gale
#

I can.

boreal needle
#

then do that

obtuse gale
#

But my pc is bad. and laggy.

boreal needle
#

a different custom-written program won't fix that

obtuse gale
#

a website**

boreal needle
#

a website also won't fix that

obtuse gale
#

well yes but the site wouldnt lag as much as VS

boreal needle
#

not true

hot hull
#

It would

boreal needle
#

vscode is web based anyway

hot hull
#

If your pc is trash, browser will shit itself anyways

obtuse gale
#

yea

#

i use Brave

hot hull
#

And?

boreal needle
#

it wont make a blind bit of difference which browser you use

obtuse gale
#

it not lag much

#

But.. my point is it wont help me as much as like probably anyone

boreal needle
#

there is nothing wrong with code

#

and it can in fact run in a browser

heady birch
#

Desktop applications beform better than websites

obtuse gale
#

Kid vscode online didnt work for me

heady birch
#

Websites are a bunch of interpreted javascript

obtuse gale
#

you guys know where i can report people

hot hull
#

DM @compact perch

#

And he'll give you instructions

heady birch
#

Desktop applications are compiled or JIT

obtuse gale
#

If in request paid you do something
Then that guy bails

#

Does it count

hot hull
#

Counts as scamming yes

obtuse gale
#

Oh cool someone already wants to do it :D

heady birch
#

Nice

#

Although I think some web based IDE's already exist

hot hull
#

Anyhow kinda meh idea since

Desktop applications beform better than websites

boreal needle
#

to be fair

#

vscode runs on electron

#

which is just chromium without the frontend

#

so in theory the difference will be very little if not none

obtuse gale
#

how do i use it

#

[Report] (message)

#

or just message

hot hull
#

first one

obtuse gale
#

ok

hot hull
#

And make sure to provide sufficient evidence

obtuse gale
#

some desktop apps do perform worse than websites

hot hull
#

Most

obtuse gale
#

desktop apps perform better in better hardware

boreal needle
#

the same goes for browsers

obtuse gale
#

when websites perform pretty much the same always

boreal needle
#

a browser is a desktop app too

obtuse gale
#

yeah ik

boreal needle
#

and this is not true

when websites perform pretty much the same always

obtuse gale
#

but Websites perform better

boreal needle
#

because they're generally not intensive

obtuse gale
#

If your computer is from like 1995 then ofc websites will suck

boreal needle
#

anyway

#

the point still stands

obtuse gale
#

Desktop apps are also laggier on worse hardware

boreal needle
#

moving an app that already runs on chromium into a browser will do pretty much fuck all

obtuse gale
#

VSC dosent run on chromium

boreal needle
#

yes it does

#

it runs electron

#

which uses chromium V8

obtuse gale
#

electron is a shitty coded version of a browser

boreal needle
#

electron is based on chromium

#

always has been

obtuse gale
#

Bruh moment

#

VSC dosent run on electron and even if it did they implemented it poorly then

boreal needle
#

right there on the front page

#

you appear to have gone silent

obtuse gale
#

i went to the bathroom

#

well it till lags alot and acts slowly

hot hull
#

Update your PC ๐Ÿ˜Ž

prisma wave
#

I find the vsc performance fine

obtuse gale
#

to windows10 2004 like i already have?

#

I use 4gb of ram which would explain alot

prisma wave
#

Why not use n++ or sublime if it's really that bad

obtuse gale
#

sublime bad and i do use n++

#

i actually used Notepad ++ on my datapack

topaz bay
#

vsc is definitely not slow

obtuse gale
#

@topaz bay not for you but for me

topaz bay
#

Your fault

obtuse gale
#

My fault that vsc isn't optimised on performance for my computer hardware?

topaz bay
#

????

#

vsc is electron

#

Just like... discord..

hot hull
heady birch
#

2,99 usable?

#

what happened to the other gigabyte?

topaz bay
#

graphics

#

probably

obtuse gale
#

@hot hull My i5 is 1.7 ghz

#

also 4gb ram

#

64 bit os though

hot hull
#

Sx nah, cpu limits it to 3gb

heady birch
#

Could always try overcloking

#

I don't know how successful that would be

old wyvern
#

cpu limits to 3?

obtuse gale
#

I cant overglock

hot hull
#

32bit Yugi

onyx loom
#

overclocking a 2nd gen i5 OMEGALUL

hot hull
#

Still sus about it, but oh well

topaz bay
#

that cpu is limited to 32 gigs

onyx loom
#

32bit

hot hull
#

Sx, check which version of it you're looking at

heady birch
#

Most likely the OS

old wyvern
#

32 bit allows 4gb

obtuse gale
#

i have had bad experiences with electron

prisma wave
#

Discord?

topaz bay
#

Theres only 1 on intel's website

hot hull
#

I know

prisma wave
#

Bootleg cpu?

onyx loom
#

hes got some dodgy cpu that limits it

obtuse gale
#

including discord

hot hull
#

Which is sus, but 64bit OS doesn't work at all

heady birch
#

What is "sus"

hot hull
#

suss

topaz bay
#

There is no way in hell you have a core series processor that limits to 3 gigs

#

That other gig has to be being used my the IGPU

onyx loom
#

ok but point is he still got 32bit

heady birch
#

Poor guy cant use doubles ๐Ÿ˜ฆ

topaz bay
#

32 bit memory limit is 4 gigs

#

not 3

jovial warren
#

@ocean quartz accept my merge request ๐Ÿ™‚

topaz bay
#

And that is not a 32 bit cpu

onyx loom
#

ive been trying to say this sx ๐Ÿ˜ฆ

#

ive given up, and came to the conclusion that hes got a bootleg cpu

jovial warren
#

lol

topaz bay
#

Or... he fucked up when installing windows

#

Seems more likely...

jovial warren
#

wait did I just see someone say they're running a 64-bit OS with 4GB RAM maximum?

heady birch
#

How?

hot hull
#

How would I fuck up when an IT guy tried to install 64bit and wasn't able to?

topaz bay
#

IT guy

#

LOL

jovial warren
#

HAHAHAHA

onyx loom
#

well it guys can be pretty stupid

#

have u tried turning it off and on again

jovial warren
#

you mean these "desktop support" idiots you find at your average school or university who haven't got even the slightest clue about pretty much anything beyond the solution of turn it off and turn it back on again?

onyx loom
hot hull
#

ngl can't respond to that cause gonna get beaned

jovial warren
#

no wonder you have a 4:3

hot hull
#

But you can think what you want ๐Ÿ˜‰

jovial warren
#

but is it one of those people?

#

or is it someone who actually has a clue about what they're doing

obtuse gale
#

what happened here?

jovial warren
#

if it's one of those people I'm not surprised that they fucked it up

#

idk

versed ridge
#

pretty good

jovial warren
#

anything else you think I should include or anything you think I should change?

#

anyway, back to work on BardyBot

#

still gotta figure out what:

The bean 'jda', defined in class path resource [dev/bombardy/bardybot/JDAService.class], could not be registered. A bean with that name has already been defined in file [/home/bombardygamer/IdeaProjects/BardyBot/build/classes/kotlin/main/dev/bombardy/bardybot/JDAService.class] and overriding is disabled.

means

#

or should I say, why tf it's occuring

#

@topaz bay is something like that at all your fortรฉ?

errant geyser
#

You bean

jovial warren
#

lol

#

no one seems to be able to figure out why tf it's occuring

#

I've tried clean building it as well

versed ridge
#

You have something called application.yml?

jovial warren
#

if I try to run gradle bootRun it says: Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1

#

You have something called application.yml?
I have application.properties yes

versed ridge
#

Try adding spring.main.allow-bean-definition-overriding: true to it

jovial warren
#

tf does that mean

versed ridge
#

That happened after adding that?

jovial warren
#

yep

frail glade
#

Hey BM, is PDM ready for beta? (Feel free to tag me when you respond)

versed ridge
#

Try changing it to spring.main.allow-bean-definition-overriding = true

jovial warren
#

that's what it is since IJ said that was the proper way to do it

#

spring.main.allow-bean-definition-overriding= true

versed ridge
#

ah

jovial warren
#

I think I'm supposed to run gradle bootRun though

prisma wave
#

@frail glade I think so. The plugin hasn't been approved into the gradle repo yet so you'd need to use your local repo, but from my testing everything seems to be working fine

jovial warren
#

which actually comes back with that error funnily enough

prisma wave
#

The code is a mess though lol

frail glade
#

Alrighty. Let me know when it gets approved.

jovial warren
#

nvm yeah it comes back with the same error @versed ridge

#

all the same errors

topaz bay
#

@prisma wave How exactly are you using files from the bukkit plugin in the gradle plugin?

prisma wave
#

Because it's not a bukkit plugin

#

It's very loosely coupled with bukkit but 99% of the code is platform agnostic

jovial warren
topaz bay
#

But those files are on the same module as the bukkit plugin

#

@prisma wave

jovial warren
#

ah okay think I figured out my issue

#

I had @Service("jda") and then a jda() method

#

I don't think that's allowed

#

oh now I've got the token is invalid issue

#

might help if I give it my bot token

topaz bay
#

@jovial warren dont touch me

jovial warren
#

what?

topaz bay
#

lol

jovial warren
#

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jda' defined in class path resource [dev/bombardy/bardybot/JDAService.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.dv8tion.jda.api.JDA]: Factory method 'jda' threw exception; nested exception is javax.security.auth.login.LoginException: The provided token is invalid! hmm...

#

oh yeah that lol

heady birch
#

Dont name the service

#

Can just use @Service

jovial warren
#

yeah I am now

#

apparently the token I've provided is invalid

#

even though I've given it my token in application.properties

#

bot.token="CENSORED"

heady birch
#

try printing it

jovial warren
#

okay

#

where?

heady birch
#

where you set jda up

#

just to see if its null or something

jovial warren
#

okay

#

I tried converting the bean method to a body block and printing before the return but nothing came back

#

that's definitely not where I was supposed to do it is it

#

let's try doing it in CommandService

#

nope

#

didn't get there

#

where can I put this println() @heady birch?

#

or should I say, where should I put it?

#
@Service
class JDAService {

    private val GATEWAY_INTENTS = listOf(
            GatewayIntent.GUILD_MESSAGES,
            GatewayIntent.GUILD_VOICE_STATES)

    private val DISABLED_FLAGS = listOf(
            CacheFlag.ACTIVITY,
            CacheFlag.CLIENT_STATUS,
            CacheFlag.EMOTE)

    @Bean
    fun jda(config: DiscordConfig) = JDABuilder.create(config.token, GATEWAY_INTENTS)
                .setActivity(Activity.playing("prevarinite.com"))
                .disableCache(DISABLED_FLAGS)
                .build()

    @Bean
    fun commandManager(jda: JDA) = CommandManager(jda)
}

that's what I got in JDAService

prisma wave
#

@topaz bay there is no bukkit plugin

#

it's just a library that you shade

#
  • a gradle plugin
#

The only standalone bukkit plugin is the example module

topaz bay
#

You have references to the bukkit api in that module

#

And you depend on that module from the gradle plugin

jovial warren
#

what's this?

remote goblet
#

bean

prisma wave
#

The only reference is to make a nicer constructor for PluginDependencyManager

#

Which is why it's 99% decoupled

remote goblet
prisma wave
#

and that constructor doesn't have to be used

topaz bay
#

You also reference the bukkit class in spigotrepository...

jovial warren
#

send us a link please

topaz bay
#

idk, just really seems like the gradle plugin should have absolutely no idea about spigot

prisma wave
#

Oh yeah good point

#

I could've made a common module, but since neither of those classes are used in the gradle plugin it should be fine

topaz bay
#

theyre compiled into it though...

#

They have no reason to be

#

Nor should like... 90% of this tbh?

#

Doesn't it just like... read dependencies, and put them into a json file

#

It doesnt make sense for the gradle plugin to have any of this

prisma wave
#

It does some http requests too

#

To find out which repository contains a dependency

topaz bay
#

Why.... exactly?

#

It costs nothing to check and fallback

prisma wave
#

From my testing, if you don't specify a repository it has to query them all at runtime, which adds quite a bit to startup time

#

I might make it an option

#

But from what I've found it's worth it

#

Yeah I'll make it an option in the gradle plugin

topaz bay
#

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

jovial warren
#

@quiet depot wtf lol

#

you had this guy set up his dedi using git bash?????

errant geyser
#

Let Piggy do Piggy things

prisma wave
#

i mean bash is bash

#

spigot bash coming 2021?

jovial warren
#

but git bash though

#

Bitvise >

prisma wave
#

nah spigot bash is where it's at

#

/curl https://google.com > hello.txt

errant geyser
#

Bardy I still can't get access to my CE using puTTy or BitVise, this is actually driving me nuts

prisma wave
#

what's the error

errant geyser
#

Differs

#

Sometimes, key rejected, sometimes some other thing about no authentication method

ocean quartz
prisma wave
#

that's pretty cool

frail glade
#

Hmm? Oh, the change of the icons from the side to top and bottom?

ocean quartz
#

Scrolling through items ;p

heady birch
#

@ocean quartz Wonder if you could use slot change event?

#

Mouse wheel e.g?

frail glade
#

How is that different than the pagination?

heady birch
#

Me?

#

I mean listening on slot change would allow you to scroll using the mouse wheel

ocean quartz
#

Idk Niall I can try
Basically Glare, pagination goes 1 page size at a time, the scrolling will be row per row change

frail glade
#

Niall, I was plugging your project yesterday to a bunch of people. I expect to be compensated when you get all these new buyers.

#

That's pretty cool, Matt.

heady birch
#

Cool!

ocean quartz
#

Yeah, Lewizzz suggested it so thought i'd give it a try

frail glade
#

Good work.

heady birch
#

Where did you tell them about it Glare?