11package 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 ;
1110import org .mangorage .mangobotgithub .core .GHIssueStatus ;
1211import org .mangorage .mangobotgithub .core .GHPRStatus ;
1312import org .mangorage .mangobotgithub .core .GuildConfig ;
1413import org .mangorage .mangobotgithub .core .IssueScanCommand ;
1514import org .mangorage .mangobotgithub .core .PRScanCommand ;
1615import org .mangorage .mangobotgithub .core .PasteRequestModule ;
16+ import org .mangorage .mangobotplugin .entrypoint .MangoBot ;
1717
1818import 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}
0 commit comments