Don't send empty messages

This commit is contained in:
Nathan Curran 2020-08-18 15:52:19 +10:00
parent f4007a7c9d
commit 3f68677d99
No known key found for this signature in database
GPG Key ID: B3A964B30C2E56B8
2 changed files with 13 additions and 14 deletions

View File

@ -20,7 +20,6 @@ import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.dv8tion.jda.api.AccountType;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
@ -78,20 +77,20 @@ public class Discord extends FreedomService
}
try
{
bot = new JDABuilder(AccountType.BOT)
.setToken(ConfigEntry.DISCORD_TOKEN.getString())
.addEventListeners(new PrivateMessageListener())
.addEventListeners(new DiscordToMinecraftListener())
bot = JDABuilder.createDefault(ConfigEntry.DISCORD_TOKEN.getString())
.addEventListeners(new PrivateMessageListener(),
new DiscordToMinecraftListener(),
new ListenerAdapter()
{
@Override
public void onReady(ReadyEvent event)
{
new StartEvent(event.getJDA()).start();
}
})
.setAutoReconnect(true)
.setRateLimitPool(RATELIMIT_EXECUTOR)
.addEventListeners(new ListenerAdapter()
{
@Override
public void onReady(ReadyEvent event)
{
new StartEvent(event.getJDA()).start();
}
}).build();
.build();
FLog.info("Discord verification bot has successfully enabled!");
}
catch (LoginException e)

View File

@ -20,7 +20,7 @@ public class DiscordToMinecraftListener extends ListenerAdapter
String chat_channel_id = ConfigEntry.DISCORD_CHAT_CHANNEL_ID.getString();
if (event.getMember() != null && !chat_channel_id.isEmpty() && event.getChannel().getId().equals(chat_channel_id))
{
if (!event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()))
if (!event.getAuthor().getId().equals(Discord.bot.getSelfUser().getId()) && !event.getMessage().getContentDisplay().isEmpty())
{
Member member = event.getMember();
String tag = getDisplay(member);