diff --git a/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java b/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java index b5a0efc..ab63ebe 100755 --- a/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java +++ b/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java @@ -142,9 +142,13 @@ public class DiscordPlugin extends ButtonPlugin { private void handleReady(List event) { try { mainServer = mainServer().get().orElse(null); //Shouldn't change afterwards + getCommand2MC().registerCommand(new DiscordMCCommand()); //Register so that the reset command works if (mainServer == null) { if (event.size() == 0) { getLogger().severe("Main server not found! Invite the bot and do /discord reset"); + dc.getApplicationInfo().subscribe(info -> { + getLogger().severe("Click here: https://discordapp.com/oauth2/authorize?client_id=" + info.getId().asString() + "&scope=bot&permissions=268509264"); + }); saveConfig(); //Put default there return; //We should have all guilds by now, no need to retry } @@ -200,7 +204,6 @@ public class DiscordPlugin extends ButtonPlugin { CommonListeners.register(dc.getEventDispatcher()); TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this); - getCommand2MC().registerCommand(new DiscordMCCommand()); TBMCCoreAPI.RegisterUserClass(DiscordPlayer.class); ChromaGamerBase.addConverter(sender -> Optional.ofNullable(sender instanceof DiscordSenderBase ? ((DiscordSenderBase) sender).getChromaUser() : null)); diff --git a/src/main/java/buttondevteam/discordplugin/mcchat/ChannelconCommand.java b/src/main/java/buttondevteam/discordplugin/mcchat/ChannelconCommand.java index d51a4b0..be1d284 100644 --- a/src/main/java/buttondevteam/discordplugin/mcchat/ChannelconCommand.java +++ b/src/main/java/buttondevteam/discordplugin/mcchat/ChannelconCommand.java @@ -31,7 +31,7 @@ import java.util.stream.Collectors; "Use the ID (command) of the channel, for example `g` for the global chat.", // "To remove a connection use @ChromaBot channelcon remove in the channel.", // "Mentioning the bot is needed in this case because the / prefix only works in #bot.", // - "Invite link: " // + "Invite link: " // }) @RequiredArgsConstructor public class ChannelconCommand extends ICommand2DC { @@ -155,7 +155,7 @@ public class ChannelconCommand extends ICommand2DC { "Use the ID (command) of the channel, for example `g` for the global chat.", // "To remove a connection use @ChromaBot channelcon remove in the channel.", // "Mentioning the bot is needed in this case because the " + DiscordPlugin.getPrefix() + " prefix only works in " + DPUtils.botmention() + ".", // - "Invite link: " // TODO: Set correct client ID + "Invite link: " }; } } diff --git a/src/main/java/buttondevteam/discordplugin/mcchat/MinecraftChatModule.java b/src/main/java/buttondevteam/discordplugin/mcchat/MinecraftChatModule.java index a44986a..b4586e1 100644 --- a/src/main/java/buttondevteam/discordplugin/mcchat/MinecraftChatModule.java +++ b/src/main/java/buttondevteam/discordplugin/mcchat/MinecraftChatModule.java @@ -104,10 +104,13 @@ public class MinecraftChatModule extends Component { return getConfig().getData("allowPrivateChat", true); } + String clientID; + @Override protected void enable() { if (DPUtils.disableIfConfigErrorRes(this, chatChannel(), chatChannelMono())) return; + DiscordPlugin.dc.getApplicationInfo().subscribe(info -> clientID = info.getId().asString()); listener = new MCChatListener(this); TBMCCoreAPI.RegisterEventsForExceptions(listener, getPlugin()); TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(this), getPlugin());//These get undone if restarting/resetting - it will ignore events if disabled diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6507c5b..e045c2b 100755 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,8 +1,8 @@ -name: Thorpe-Discord +name: Chroma-Discord main: buttondevteam.discordplugin.DiscordPlugin version: 1.0 author: NorbiPeti -depend: [ThorpeCore] +depend: [ChromaCore] commands: discord: website: 'https://github.com/TBMCPlugins/DiscordPlugin'