mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge pull request #272 from Focusvity/pr/discord-msg
Prevent Discord from sending messages to the server
This commit is contained in:
commit
fc08761e70
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user