mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Don't send empty messages
This commit is contained in:
parent
f4007a7c9d
commit
3f68677d99
@ -20,7 +20,6 @@ import me.totalfreedom.totalfreedommod.rank.Rank;
|
|||||||
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.dv8tion.jda.api.AccountType;
|
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.JDABuilder;
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
@ -78,20 +77,20 @@ public class Discord extends FreedomService
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bot = new JDABuilder(AccountType.BOT)
|
bot = JDABuilder.createDefault(ConfigEntry.DISCORD_TOKEN.getString())
|
||||||
.setToken(ConfigEntry.DISCORD_TOKEN.getString())
|
.addEventListeners(new PrivateMessageListener(),
|
||||||
.addEventListeners(new PrivateMessageListener())
|
new DiscordToMinecraftListener(),
|
||||||
.addEventListeners(new DiscordToMinecraftListener())
|
new ListenerAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onReady(ReadyEvent event)
|
||||||
|
{
|
||||||
|
new StartEvent(event.getJDA()).start();
|
||||||
|
}
|
||||||
|
})
|
||||||
.setAutoReconnect(true)
|
.setAutoReconnect(true)
|
||||||
.setRateLimitPool(RATELIMIT_EXECUTOR)
|
.setRateLimitPool(RATELIMIT_EXECUTOR)
|
||||||
.addEventListeners(new ListenerAdapter()
|
.build();
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onReady(ReadyEvent event)
|
|
||||||
{
|
|
||||||
new StartEvent(event.getJDA()).start();
|
|
||||||
}
|
|
||||||
}).build();
|
|
||||||
FLog.info("Discord verification bot has successfully enabled!");
|
FLog.info("Discord verification bot has successfully enabled!");
|
||||||
}
|
}
|
||||||
catch (LoginException e)
|
catch (LoginException e)
|
||||||
|
@ -20,7 +20,7 @@ public class DiscordToMinecraftListener extends ListenerAdapter
|
|||||||
String chat_channel_id = ConfigEntry.DISCORD_CHAT_CHANNEL_ID.getString();
|
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.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();
|
Member member = event.getMember();
|
||||||
String tag = getDisplay(member);
|
String tag = getDisplay(member);
|
||||||
|
Loading…
Reference in New Issue
Block a user