parent
f266924a9a
commit
beab400873
6 changed files with 56 additions and 11 deletions
10
pom.xml
10
pom.xml
|
@ -149,6 +149,10 @@
|
||||||
<id>pex-repo</id>
|
<id>pex-repo</id>
|
||||||
<url>http://pex-repo.aoeu.xyz</url>
|
<url>http://pex-repo.aoeu.xyz</url>
|
||||||
</repository> -->
|
</repository> -->
|
||||||
|
<!-- <repository>
|
||||||
|
<id>Reactor-Tools</id>
|
||||||
|
<url>https://repo.spring.io/milestone</url>
|
||||||
|
</repository> -->
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -231,6 +235,12 @@
|
||||||
<artifactId>emoji-java</artifactId>
|
<artifactId>emoji-java</artifactId>
|
||||||
<version>4.0.0</version>
|
<version>4.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/io.projectreactor.tools/blockhound -->
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>io.projectreactor.tools</groupId>
|
||||||
|
<artifactId>blockhound</artifactId>
|
||||||
|
<version>1.0.0.M3</version>
|
||||||
|
</dependency> -->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
|
|
@ -74,7 +74,7 @@ public final class DPUtils {
|
||||||
public static ReadOnlyConfigData<Mono<Role>> roleData(IHaveConfig config, String key, String defName, Mono<Guild> guild) {
|
public static ReadOnlyConfigData<Mono<Role>> roleData(IHaveConfig config, String key, String defName, Mono<Guild> guild) {
|
||||||
return config.getReadOnlyDataPrimDef(key, defName, name -> {
|
return config.getReadOnlyDataPrimDef(key, defName, name -> {
|
||||||
if (!(name instanceof String)) return Mono.empty();
|
if (!(name instanceof String)) return Mono.empty();
|
||||||
return guild.flatMapMany(Guild::getRoles).filter(r -> r.getName().equals(name)).last();
|
return guild.flatMapMany(Guild::getRoles).filter(r -> r.getName().equals(name)).next();
|
||||||
}, r -> defName);
|
}, r -> defName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,18 +160,18 @@ public class DiscordPlugin extends ButtonPlugin {
|
||||||
getManager().registerCommand(new DebugCommand());
|
getManager().registerCommand(new DebugCommand());
|
||||||
getManager().registerCommand(new ConnectCommand());
|
getManager().registerCommand(new ConnectCommand());
|
||||||
if (DiscordMCCommand.resetting) //These will only execute if the chat is enabled
|
if (DiscordMCCommand.resetting) //These will only execute if the chat is enabled
|
||||||
ChromaBot.getInstance().sendMessageCustomAsWell(ch -> ch.createEmbed(ecs -> ecs.setColor(Color.CYAN)
|
ChromaBot.getInstance().sendMessageCustomAsWell(chan -> chan.flatMap(ch -> ch.createEmbed(ecs -> ecs.setColor(Color.CYAN)
|
||||||
.setTitle("Discord plugin restarted - chat connected.")), ChannelconBroadcast.RESTART); //Really important to note the chat, hmm
|
.setTitle("Discord plugin restarted - chat connected."))), ChannelconBroadcast.RESTART); //Really important to note the chat, hmm
|
||||||
else if (getConfig().getBoolean("serverup", false)) {
|
else if (getConfig().getBoolean("serverup", false)) {
|
||||||
ChromaBot.getInstance().sendMessageCustomAsWell(ch -> ch.createEmbed(ecs -> ecs.setColor(Color.YELLOW)
|
ChromaBot.getInstance().sendMessageCustomAsWell(chan -> chan.flatMap(ch -> ch.createEmbed(ecs -> ecs.setColor(Color.YELLOW)
|
||||||
.setTitle("Server recovered from a crash - chat connected.")), ChannelconBroadcast.RESTART);
|
.setTitle("Server recovered from a crash - chat connected."))), ChannelconBroadcast.RESTART);
|
||||||
val thr = new Throwable(
|
val thr = new Throwable(
|
||||||
"The server shut down unexpectedly. See the log of the previous run for more details.");
|
"The server shut down unexpectedly. See the log of the previous run for more details.");
|
||||||
thr.setStackTrace(new StackTraceElement[0]);
|
thr.setStackTrace(new StackTraceElement[0]);
|
||||||
TBMCCoreAPI.SendException("The server crashed!", thr);
|
TBMCCoreAPI.SendException("The server crashed!", thr);
|
||||||
} else
|
} else
|
||||||
ChromaBot.getInstance().sendMessageCustomAsWell(ch -> ch.createEmbed(ecs -> ecs.setColor(Color.GREEN)
|
ChromaBot.getInstance().sendMessageCustomAsWell(chan -> chan.flatMap(ch -> ch.createEmbed(ecs -> ecs.setColor(Color.GREEN)
|
||||||
.setTitle("Server started - chat connected.")), ChannelconBroadcast.RESTART);
|
.setTitle("Server started - chat connected."))), ChannelconBroadcast.RESTART);
|
||||||
|
|
||||||
DiscordMCCommand.resetting = false; //This is the last event handling this flag
|
DiscordMCCommand.resetting = false; //This is the last event handling this flag
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ public class DiscordPlugin extends ButtonPlugin {
|
||||||
TBMCCoreAPI.SendException(
|
TBMCCoreAPI.SendException(
|
||||||
"Won't load because we're in testing mode and not using a separate account.",
|
"Won't load because we're in testing mode and not using a separate account.",
|
||||||
new Exception(
|
new Exception(
|
||||||
"The plugin refuses to load until you change the token to a testing account. (The account needs to have \"test\" in it's name.)"));
|
"The plugin refuses to load until you change the token to a testing account. (The account needs to have \"test\" in its name.)"));
|
||||||
Bukkit.getPluginManager().disablePlugin(this);
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
}
|
}
|
||||||
TBMCCoreAPI.SendUnsentExceptions();
|
TBMCCoreAPI.SendUnsentExceptions();
|
||||||
|
@ -197,7 +197,7 @@ public class DiscordPlugin extends ButtonPlugin {
|
||||||
|
|
||||||
IHaveConfig.pregenConfig(this, null);
|
IHaveConfig.pregenConfig(this, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TBMCCoreAPI.SendException("An error occured while enabling DiscordPlugin!", e);
|
TBMCCoreAPI.SendException("An error occurred while enabling DiscordPlugin!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ public class DiscordPlugin extends ButtonPlugin {
|
||||||
public void pluginPreDisable() {
|
public void pluginPreDisable() {
|
||||||
if (ChromaBot.getInstance() == null) return; //Failed to load
|
if (ChromaBot.getInstance() == null) return; //Failed to load
|
||||||
System.out.println("Disable start");
|
System.out.println("Disable start");
|
||||||
MCChatUtils.forCustomAndAllMCChat(ch -> ch.createEmbed(ecs -> {
|
MCChatUtils.forCustomAndAllMCChat(chan -> chan.flatMap(ch -> ch.createEmbed(ecs -> {
|
||||||
System.out.println("Sending message to " + ch.getMention());
|
System.out.println("Sending message to " + ch.getMention());
|
||||||
if (DiscordMCCommand.resetting)
|
if (DiscordMCCommand.resetting)
|
||||||
ecs.setColor(Color.ORANGE).setTitle("Discord plugin restarting");
|
ecs.setColor(Color.ORANGE).setTitle("Discord plugin restarting");
|
||||||
|
@ -225,7 +225,7 @@ public class DiscordPlugin extends ButtonPlugin {
|
||||||
+ (Bukkit.getOnlinePlayers().size() == 1 ? " was " : " were ")
|
+ (Bukkit.getOnlinePlayers().size() == 1 ? " was " : " were ")
|
||||||
+ "kicked the hell out.") //TODO: Make configurable
|
+ "kicked the hell out.") //TODO: Make configurable
|
||||||
: ""); //If 'restart' is disabled then this isn't shown even if joinleave is enabled
|
: ""); //If 'restart' is disabled then this isn't shown even if joinleave is enabled
|
||||||
}).block(), ChannelconBroadcast.RESTART, false);
|
})).subscribe(), ChannelconBroadcast.RESTART, false);
|
||||||
System.out.println("Updating player list");
|
System.out.println("Updating player list");
|
||||||
ChromaBot.getInstance().updatePlayerList();
|
ChromaBot.getInstance().updatePlayerList();
|
||||||
System.out.println("Done");
|
System.out.println("Done");
|
||||||
|
|
|
@ -21,7 +21,9 @@ public class CommandListener {
|
||||||
public static boolean runCommand(Message message, boolean mentionedonly) {
|
public static boolean runCommand(Message message, boolean mentionedonly) {
|
||||||
if (!message.getContent().isPresent())
|
if (!message.getContent().isPresent())
|
||||||
return false; //Pin messages and such, let the mcchat listener deal with it
|
return false; //Pin messages and such, let the mcchat listener deal with it
|
||||||
|
System.out.println("1");
|
||||||
final MessageChannel channel = message.getChannel().block();
|
final MessageChannel channel = message.getChannel().block();
|
||||||
|
System.out.println("2");
|
||||||
val content = message.getContent().get();
|
val content = message.getContent().get();
|
||||||
if (channel == null) return false;
|
if (channel == null) return false;
|
||||||
if (!mentionedonly) { //mentionedonly conditions are in CommonListeners
|
if (!mentionedonly) { //mentionedonly conditions are in CommonListeners
|
||||||
|
@ -31,28 +33,36 @@ public class CommandListener {
|
||||||
return false;
|
return false;
|
||||||
channel.type().subscribe(); // Fun
|
channel.type().subscribe(); // Fun
|
||||||
}
|
}
|
||||||
|
System.out.println("3");
|
||||||
final StringBuilder cmdwithargs = new StringBuilder(content);
|
final StringBuilder cmdwithargs = new StringBuilder(content);
|
||||||
val self = DiscordPlugin.dc.getSelf().block();
|
val self = DiscordPlugin.dc.getSelf().block();
|
||||||
|
System.out.println("4");
|
||||||
if (self == null) return false;
|
if (self == null) return false;
|
||||||
val member = self.asMember(DiscordPlugin.mainServer.getId()).block();
|
val member = self.asMember(DiscordPlugin.mainServer.getId()).block();
|
||||||
|
System.out.println("5");
|
||||||
if (member == null) return false;
|
if (member == null) return false;
|
||||||
final String mention = self.getMention();
|
final String mention = self.getMention();
|
||||||
final String mentionNick = member.getNicknameMention();
|
final String mentionNick = member.getNicknameMention();
|
||||||
|
System.out.println("6");
|
||||||
boolean gotmention = checkanddeletemention(cmdwithargs, mention, message);
|
boolean gotmention = checkanddeletemention(cmdwithargs, mention, message);
|
||||||
gotmention = checkanddeletemention(cmdwithargs, mentionNick, message) || gotmention;
|
gotmention = checkanddeletemention(cmdwithargs, mentionNick, message) || gotmention;
|
||||||
|
System.out.println("7");
|
||||||
val mentions = message.getRoleMentions();
|
val mentions = message.getRoleMentions();
|
||||||
for (String mentionRole : member.getRoles().filter(r -> mentions.any(rr -> rr.getName().equals(r.getName())).blockOptional().orElse(false)).map(Role::getMention).toIterable())
|
for (String mentionRole : member.getRoles().filter(r -> mentions.any(rr -> rr.getName().equals(r.getName())).blockOptional().orElse(false)).map(Role::getMention).toIterable())
|
||||||
gotmention = checkanddeletemention(cmdwithargs, mentionRole, message) || gotmention; // Delete all mentions
|
gotmention = checkanddeletemention(cmdwithargs, mentionRole, message) || gotmention; // Delete all mentions
|
||||||
if (mentionedonly && !gotmention)
|
if (mentionedonly && !gotmention)
|
||||||
return false;
|
return false;
|
||||||
|
System.out.println("8");
|
||||||
channel.type().subscribe();
|
channel.type().subscribe();
|
||||||
String cmdwithargsString = cmdwithargs.toString();
|
String cmdwithargsString = cmdwithargs.toString();
|
||||||
|
System.out.println("9");
|
||||||
try {
|
try {
|
||||||
if (!DiscordPlugin.plugin.getManager().handleCommand(new Command2DCSender(message), cmdwithargsString))
|
if (!DiscordPlugin.plugin.getManager().handleCommand(new Command2DCSender(message), cmdwithargsString))
|
||||||
DPUtils.reply(message, channel, "Unknown command. Do " + DiscordPlugin.getPrefix() + "help for help.\n" + cmdwithargsString).subscribe();
|
DPUtils.reply(message, channel, "Unknown command. Do " + DiscordPlugin.getPrefix() + "help for help.\n" + cmdwithargsString).subscribe();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TBMCCoreAPI.SendException("Failed to process Discord command: " + cmdwithargsString, e);
|
TBMCCoreAPI.SendException("Failed to process Discord command: " + cmdwithargsString, e);
|
||||||
}
|
}
|
||||||
|
System.out.println("10");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,25 +35,36 @@ public class CommonListeners {
|
||||||
return;
|
return;
|
||||||
//System.out.println("Author: "+author.get());
|
//System.out.println("Author: "+author.get());
|
||||||
//System.out.println("Bot: "+author.get().isBot());
|
//System.out.println("Bot: "+author.get().isBot());
|
||||||
|
System.out.println("A");
|
||||||
if (FunModule.executeMemes(event.getMessage()))
|
if (FunModule.executeMemes(event.getMessage()))
|
||||||
return;
|
return;
|
||||||
|
System.out.println("B");
|
||||||
try {
|
try {
|
||||||
boolean handled = false;
|
boolean handled = false;
|
||||||
val commandChannel = DiscordPlugin.plugin.CommandChannel().get();
|
val commandChannel = DiscordPlugin.plugin.CommandChannel().get();
|
||||||
|
System.out.println("C");
|
||||||
if ((commandChannel != null && event.getMessage().getChannelId().asLong() == commandChannel.asLong()) //If mentioned, that's higher than chat
|
if ((commandChannel != null && event.getMessage().getChannelId().asLong() == commandChannel.asLong()) //If mentioned, that's higher than chat
|
||||||
|| event.getMessage().getContent().orElse("").contains("channelcon")) //Only 'channelcon' is allowed in other channels
|
|| event.getMessage().getContent().orElse("").contains("channelcon")) //Only 'channelcon' is allowed in other channels
|
||||||
handled = CommandListener.runCommand(event.getMessage(), true); //#bot is handled here
|
handled = CommandListener.runCommand(event.getMessage(), true); //#bot is handled here
|
||||||
|
System.out.println("D");
|
||||||
if (handled) return;
|
if (handled) return;
|
||||||
//System.out.println("Message handling");
|
//System.out.println("Message handling");
|
||||||
val mcchat = Component.getComponents().get(MinecraftChatModule.class);
|
val mcchat = Component.getComponents().get(MinecraftChatModule.class);
|
||||||
if (mcchat != null && mcchat.isEnabled()) //ComponentManager.isEnabled() searches the component again
|
if (mcchat != null && mcchat.isEnabled()) //ComponentManager.isEnabled() searches the component again
|
||||||
handled = ((MinecraftChatModule) mcchat).getListener().handleDiscord(event); //Also runs Discord commands in chat channels
|
handled = ((MinecraftChatModule) mcchat).getListener().handleDiscord(event); //Also runs Discord commands in chat channels
|
||||||
|
System.out.println("E");
|
||||||
if (!handled)
|
if (!handled)
|
||||||
handled = CommandListener.runCommand(event.getMessage(), false);
|
handled = CommandListener.runCommand(event.getMessage(), false);
|
||||||
|
System.out.println("F");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TBMCCoreAPI.SendException("An error occured while handling a message!", e);
|
TBMCCoreAPI.SendException("An error occured while handling a message!", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
/*dispatcher.on(MessageCreateEvent.class).doOnNext(x -> System.out.println("Got message"))
|
||||||
|
.flatMap(MessageCreateEvent::getGuild)
|
||||||
|
.flatMap(guild -> DiscordPlugin.dc.getSelf())
|
||||||
|
.flatMap(self -> self.asMember(DiscordPlugin.mainServer.getId()))
|
||||||
|
.flatMap(Member::getRoles).subscribe(roles -> System.out.println("Roles: " + roles));*/
|
||||||
dispatcher.on(PresenceUpdateEvent.class).subscribe(event -> {
|
dispatcher.on(PresenceUpdateEvent.class).subscribe(event -> {
|
||||||
if (DiscordPlugin.SafeMode)
|
if (DiscordPlugin.SafeMode)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -220,22 +220,28 @@ public class MCChatListener implements Listener {
|
||||||
public boolean handleDiscord(MessageCreateEvent ev) {
|
public boolean handleDiscord(MessageCreateEvent ev) {
|
||||||
if (!ComponentManager.isEnabled(MinecraftChatModule.class))
|
if (!ComponentManager.isEnabled(MinecraftChatModule.class))
|
||||||
return false;
|
return false;
|
||||||
|
System.out.println("Chat event");
|
||||||
val author = ev.getMessage().getAuthor();
|
val author = ev.getMessage().getAuthor();
|
||||||
final boolean hasCustomChat = MCChatCustom.hasCustomChat(ev.getMessage().getChannelId());
|
final boolean hasCustomChat = MCChatCustom.hasCustomChat(ev.getMessage().getChannelId());
|
||||||
|
System.out.println("C1");
|
||||||
val channel = ev.getMessage().getChannel().block();
|
val channel = ev.getMessage().getChannel().block();
|
||||||
|
System.out.println("C2");
|
||||||
if (ev.getMessage().getChannelId().asLong() != module.chatChannel().get().asLong()
|
if (ev.getMessage().getChannelId().asLong() != module.chatChannel().get().asLong()
|
||||||
&& !(channel instanceof PrivateChannel
|
&& !(channel instanceof PrivateChannel
|
||||||
&& author.map(u -> MCChatPrivate.isMinecraftChatEnabled(u.getId().asString())).orElse(false)
|
&& author.map(u -> MCChatPrivate.isMinecraftChatEnabled(u.getId().asString())).orElse(false)
|
||||||
&& !hasCustomChat))
|
&& !hasCustomChat))
|
||||||
return false; //Chat isn't enabled on this channel
|
return false; //Chat isn't enabled on this channel
|
||||||
|
System.out.println("C3");
|
||||||
if (channel instanceof PrivateChannel //Only in private chat
|
if (channel instanceof PrivateChannel //Only in private chat
|
||||||
&& ev.getMessage().getContent().isPresent()
|
&& ev.getMessage().getContent().isPresent()
|
||||||
&& ev.getMessage().getContent().get().length() < "/mcchat<>".length()
|
&& ev.getMessage().getContent().get().length() < "/mcchat<>".length()
|
||||||
&& ev.getMessage().getContent().get().replace("/", "")
|
&& ev.getMessage().getContent().get().replace("/", "")
|
||||||
.equalsIgnoreCase("mcchat")) //Either mcchat or /mcchat
|
.equalsIgnoreCase("mcchat")) //Either mcchat or /mcchat
|
||||||
return false; //Allow disabling the chat if needed
|
return false; //Allow disabling the chat if needed
|
||||||
|
System.out.println("C4");
|
||||||
if (CommandListener.runCommand(ev.getMessage(), true))
|
if (CommandListener.runCommand(ev.getMessage(), true))
|
||||||
return true; //Allow running commands in chat channels
|
return true; //Allow running commands in chat channels
|
||||||
|
System.out.println("C5");
|
||||||
MCChatUtils.resetLastMessage(channel);
|
MCChatUtils.resetLastMessage(channel);
|
||||||
//System.out.println("Message: "+ev.getMessage().getAuthor().toString());
|
//System.out.println("Message: "+ev.getMessage().getAuthor().toString());
|
||||||
recevents.add(ev);
|
recevents.add(ev);
|
||||||
|
@ -259,12 +265,14 @@ public class MCChatListener implements Listener {
|
||||||
rectask.cancel();
|
rectask.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
System.out.println("Processing...");
|
||||||
val sender = event.getMessage().getAuthor().orElse(null);
|
val sender = event.getMessage().getAuthor().orElse(null);
|
||||||
String dmessage = event.getMessage().getContent().orElse("");
|
String dmessage = event.getMessage().getContent().orElse("");
|
||||||
try {
|
try {
|
||||||
final DiscordSenderBase dsender = MCChatUtils.getSender(event.getMessage().getChannelId(), sender);
|
final DiscordSenderBase dsender = MCChatUtils.getSender(event.getMessage().getChannelId(), sender);
|
||||||
val user = dsender.getChromaUser();
|
val user = dsender.getChromaUser();
|
||||||
|
|
||||||
|
System.out.println("Mentions start");
|
||||||
for (User u : event.getMessage().getUserMentions().toIterable()) { //TODO: Role mentions
|
for (User u : event.getMessage().getUserMentions().toIterable()) { //TODO: Role mentions
|
||||||
dmessage = dmessage.replace(u.getMention(), "@" + u.getUsername()); // TODO: IG Formatting
|
dmessage = dmessage.replace(u.getMention(), "@" + u.getUsername()); // TODO: IG Formatting
|
||||||
val m = u.asMember(DiscordPlugin.mainServer.getId()).block();
|
val m = u.asMember(DiscordPlugin.mainServer.getId()).block();
|
||||||
|
@ -276,6 +284,7 @@ public class MCChatListener implements Listener {
|
||||||
for (GuildChannel ch : event.getGuild().flux().flatMap(Guild::getChannels).toIterable()) {
|
for (GuildChannel ch : event.getGuild().flux().flatMap(Guild::getChannels).toIterable()) {
|
||||||
dmessage = dmessage.replace(ch.getMention(), "#" + ch.getName()); // TODO: IG Formatting
|
dmessage = dmessage.replace(ch.getMention(), "#" + ch.getName()); // TODO: IG Formatting
|
||||||
}
|
}
|
||||||
|
System.out.println("Mentions end");
|
||||||
|
|
||||||
dmessage = EmojiParser.parseToAliases(dmessage, EmojiParser.FitzpatrickAction.PARSE); //Converts emoji to text- TODO: Add option to disable (resource pack?)
|
dmessage = EmojiParser.parseToAliases(dmessage, EmojiParser.FitzpatrickAction.PARSE); //Converts emoji to text- TODO: Add option to disable (resource pack?)
|
||||||
dmessage = dmessage.replaceAll(":(\\S+)\\|type_(?:(\\d)|(1)_2):", ":$1::skin-tone-$2:"); //Convert to Discord's format so it still shows up
|
dmessage = dmessage.replaceAll(":(\\S+)\\|type_(?:(\\d)|(1)_2):", ":$1::skin-tone-$2:"); //Convert to Discord's format so it still shows up
|
||||||
|
@ -289,7 +298,9 @@ public class MCChatListener implements Listener {
|
||||||
|
|
||||||
boolean react = false;
|
boolean react = false;
|
||||||
|
|
||||||
|
System.out.println("Getting channel...");
|
||||||
val sendChannel = event.getMessage().getChannel().block();
|
val sendChannel = event.getMessage().getChannel().block();
|
||||||
|
System.out.println("Got channel");
|
||||||
boolean isPrivate = sendChannel instanceof PrivateChannel;
|
boolean isPrivate = sendChannel instanceof PrivateChannel;
|
||||||
if (dmessage.startsWith("/")) { // Ingame command
|
if (dmessage.startsWith("/")) { // Ingame command
|
||||||
if (!isPrivate)
|
if (!isPrivate)
|
||||||
|
@ -365,6 +376,7 @@ public class MCChatListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {// Not a command
|
} else {// Not a command
|
||||||
|
System.out.println("Not a command");
|
||||||
if (dmessage.length() == 0 && event.getMessage().getAttachments().size() == 0
|
if (dmessage.length() == 0 && event.getMessage().getAttachments().size() == 0
|
||||||
&& !isPrivate && event.getMessage().getType() == Message.Type.CHANNEL_PINNED_MESSAGE) {
|
&& !isPrivate && event.getMessage().getType() == Message.Type.CHANNEL_PINNED_MESSAGE) {
|
||||||
val rtr = clmd != null ? clmd.mcchannel.getRTR(clmd.dcp)
|
val rtr = clmd != null ? clmd.mcchannel.getRTR(clmd.dcp)
|
||||||
|
@ -374,11 +386,13 @@ public class MCChatListener implements Listener {
|
||||||
: dsender.getName()) + " pinned a message on Discord.", TBMCSystemChatEvent.BroadcastTarget.ALL);
|
: dsender.getName()) + " pinned a message on Discord.", TBMCSystemChatEvent.BroadcastTarget.ALL);
|
||||||
} else {
|
} else {
|
||||||
val cmb = ChatMessage.builder(dsender, user, getChatMessage.apply(dmessage)).fromCommand(false);
|
val cmb = ChatMessage.builder(dsender, user, getChatMessage.apply(dmessage)).fromCommand(false);
|
||||||
|
System.out.println("Message created");
|
||||||
if (clmd != null)
|
if (clmd != null)
|
||||||
TBMCChatAPI.SendChatMessage(cmb.permCheck(clmd.dcp).build(), clmd.mcchannel);
|
TBMCChatAPI.SendChatMessage(cmb.permCheck(clmd.dcp).build(), clmd.mcchannel);
|
||||||
else
|
else
|
||||||
TBMCChatAPI.SendChatMessage(cmb.build());
|
TBMCChatAPI.SendChatMessage(cmb.build());
|
||||||
react = true;
|
react = true;
|
||||||
|
System.out.println("Message sent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (react) {
|
if (react) {
|
||||||
|
|
Loading…
Reference in a new issue