Skip to content

Commit 4c690d7

Browse files
committed
Enhanced the experience.
1 parent e5be72b commit 4c690d7

13 files changed

Lines changed: 132 additions & 387 deletions

build.gradle

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ buildscript {
2222
}
2323
}
2424

25+
plugins {
26+
id 'org.gradlex.extra-java-module-info' version '1.12'
27+
}
28+
2529
apply plugin: 'com.github.johnrengelman.shadow'
2630
apply plugin: 'java'
2731
apply plugin: 'MangoBotGradle'
@@ -32,6 +36,10 @@ version = GitVersion.getGitVersion().getVersionAsString()
3236

3337
println("Version: " + version)
3438

39+
extraJavaModuleInfo {
40+
setDeriveAutomaticModuleNamesFromFileNames(true)
41+
}
42+
3543
java {
3644
toolchain {
3745
languageVersion = JavaLanguageVersion.of(24)
@@ -66,14 +74,13 @@ dependencies {
6674
testImplementation 'org.junit.jupiter:junit-jupiter'
6775

6876
installer('org.mangorage:installer:4.0.5')
69-
bot('org.mangorage:mangobot:11.0.75')
77+
bot('org.mangorage:mangobot:12.0.10')
7078

71-
plugin('org.mangorage:mangobotplugin:11.1.35')
72-
plugin('org.mangorage:mangobotwebsite:1.0.27')
79+
plugin('org.mangorage:mangobotplugin:12.0.6')
80+
plugin('org.mangorage:mangobotwebsite:2.0.1')
7381

7482
library('org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5')
7583
library('org.kohsuke:github-api:1.321')
76-
7784
}
7885

7986
configurations.all {

src/main/java/module-info.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module org.mangorage.mangobotgithub {
2+
requires okhttp3;
3+
requires org.eclipse.egit.github.core;
4+
requires org.kohsuke.github.api;
5+
requires org.mangorage.mangobotwebsite;
6+
requires org.mangorage.mangobotplugin;
7+
requires org.mangorage.mangobotcore;
8+
requires net.dv8tion.jda;
9+
requires net.minecraftforge.eventbus;
10+
}

src/main/java/org/mangorage/mangobotgithub/AICommand.java

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/main/java/org/mangorage/mangobotgithub/ChatGPTBot.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main/java/org/mangorage/mangobotgithub/ChatGPTResponse.java

Lines changed: 0 additions & 103 deletions
This file was deleted.
Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
package org.mangorage.mangobotgithub;
22

3-
import org.mangorage.basicutils.config.Config;
4-
import org.mangorage.basicutils.config.ConfigSetting;
5-
import org.mangorage.basicutils.config.ISetting;
6-
import org.mangorage.mangobot.MangoBotPlugin;
7-
import org.mangorage.mangobotapi.core.events.StartupEvent;
8-
import org.mangorage.mangobotapi.core.plugin.AbstractPlugin;
9-
import org.mangorage.mangobotapi.core.plugin.PluginManager;
10-
import org.mangorage.mangobotapi.core.plugin.impl.Plugin;
3+
4+
import org.mangorage.commonutils.config.Config;
5+
import org.mangorage.commonutils.config.ConfigSetting;
6+
import org.mangorage.commonutils.config.ISetting;
7+
import org.mangorage.mangobotcore.plugin.api.MangoBotPlugin;
8+
import org.mangorage.mangobotcore.plugin.api.Plugin;
9+
import org.mangorage.mangobotcore.plugin.api.PluginManager;
1110
import org.mangorage.mangobotgithub.core.GHIssueStatus;
1211
import org.mangorage.mangobotgithub.core.GHPRStatus;
1312
import org.mangorage.mangobotgithub.core.GuildConfig;
1413
import org.mangorage.mangobotgithub.core.IssueScanCommand;
1514
import org.mangorage.mangobotgithub.core.PRScanCommand;
1615
import org.mangorage.mangobotgithub.core.PasteRequestModule;
16+
import org.mangorage.mangobotplugin.entrypoint.MangoBot;
1717

1818
import java.nio.file.Path;
1919

20-
@Plugin(id = MangoBotGithub.ID)
21-
public final class MangoBotGithub extends AbstractPlugin {
20+
@MangoBotPlugin(id = MangoBotGithub.ID)
21+
public final class MangoBotGithub implements Plugin {
2222
public static final String ID = "mangobotgithub";
2323

2424

@@ -27,37 +27,27 @@ public final class MangoBotGithub extends AbstractPlugin {
2727

2828
public static final ISetting<String> GITHUB_TOKEN = ConfigSetting.create(CONFIG, "PASTE_TOKEN", "empty");
2929
public static final ISetting<String> GITHUB_USERNAME = ConfigSetting.create(CONFIG, "GITHUB_USERNAME", "RealMangoRage");
30-
public static final ISetting<String> CHAT_AI_TOKEN = ConfigSetting.create(CONFIG, "AI_TOKEN", "empty");
31-
3230

33-
private final MangoBotPlugin parent;
3431

3532
public MangoBotGithub() {
36-
var pl = PluginManager.getPlugin("mangobot", MangoBotPlugin.class);
37-
this.parent = pl;
38-
PasteRequestModule.register(pl.getPluginBus());
39-
40-
41-
pl.getPluginBus().addListener(0, StartupEvent.class, this::onRegistration);
33+
PasteRequestModule.register();
4234
}
4335

44-
@Override
45-
protected void init() {
4636

37+
@Override
38+
public String getId() {
39+
return ID;
4740
}
4841

49-
public void onRegistration(StartupEvent event) {
50-
if (event.phase() == StartupEvent.Phase.REGISTRATION) {
51-
GuildConfig.loadServerConfigs();
52-
53-
54-
var cmdRegistry = parent.getCommandRegistry();
55-
cmdRegistry.addBasicCommand(new PRScanCommand(parent));
56-
cmdRegistry.addBasicCommand(new IssueScanCommand(parent));
57-
cmdRegistry.addBasicCommand(new AICommand());
58-
59-
new GHPRStatus(parent);
60-
new GHIssueStatus(parent);
61-
}
42+
@Override
43+
public void load() {
44+
GuildConfig.loadServerConfigs();
45+
46+
var parent = PluginManager.getInstance().getPlugin("mangobot").getInstance(MangoBot.class);
47+
var cmdRegistry = parent.getCommandManager();
48+
cmdRegistry.register(new PRScanCommand(parent));
49+
cmdRegistry.register(new IssueScanCommand(parent));
50+
new GHPRStatus(parent);
51+
new GHIssueStatus(parent);
6252
}
6353
}

src/main/java/org/mangorage/mangobotgithub/core/GHIssueStatus.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.mangorage.mangobotgithub.core;
22

3+
34
import org.kohsuke.github.GHIssue;
45
import org.kohsuke.github.GHIssueState;
56
import org.kohsuke.github.GHRepository;
67
import org.kohsuke.github.GitHub;
7-
import org.mangorage.mangobot.MangoBotPlugin;
8-
import org.mangorage.mangobotapi.core.plugin.extra.JDAPlugin;
98
import org.mangorage.mangobotgithub.MangoBotGithub;
9+
import org.mangorage.mangobotplugin.entrypoint.MangoBot;
1010

1111

1212
import java.io.BufferedReader;
@@ -66,10 +66,10 @@ public static int get(Path fileName) {
6666
return result;
6767
}
6868

69-
private final JDAPlugin pl;
69+
private final MangoBot pl;
7070

71-
public GHIssueStatus(JDAPlugin JDAPlugin) {
72-
this.pl = JDAPlugin;
71+
public GHIssueStatus(MangoBot pl) {
72+
this.pl = pl;
7373
new Timer().scheduleAtFixedRate(this, 15 * 1000, 60 * 60 * 1000); // 60 minutes/1hr
7474
}
7575

0 commit comments

Comments
 (0)