mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Fix Minor Discrepancy
This commit is contained in:
parent
3a6e7921cc
commit
f9ecebd5c9
@ -241,16 +241,6 @@ public class Bot
|
||||
return false;
|
||||
}
|
||||
|
||||
TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID)
|
||||
.ofType(TextChannel.class)
|
||||
.block();
|
||||
|
||||
if (channel == null)
|
||||
{
|
||||
FLog.severe("The report channel ID specified in the config is invalid.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import discord4j.core.object.Embed;
|
||||
import discord4j.core.object.entity.Member;
|
||||
import discord4j.core.object.entity.Message;
|
||||
import discord4j.core.object.entity.channel.Channel;
|
||||
import discord4j.core.object.entity.channel.TextChannel;
|
||||
import discord4j.discordjson.json.MessageCreateRequest;
|
||||
import me.totalfreedom.discord.TFD4J;
|
||||
import me.totalfreedom.discord.util.SnowflakeEntry;
|
||||
@ -44,13 +45,12 @@ public class ReactionListener
|
||||
|
||||
public void reactionWork(ReactionAddEvent event)
|
||||
{
|
||||
final Channel archiveChannel = tfd4j.getBot().getClient().getChannelById(SnowflakeEntry.archiveChannelID).block();
|
||||
|
||||
if (archiveChannel == null)
|
||||
{
|
||||
FLog.warning("Report archive channel is defined in the config, yet doesn't actually exist!");
|
||||
return;
|
||||
}
|
||||
final TextChannel archiveChannel = tfd4j.getBot()
|
||||
.getClient()
|
||||
.getChannelById(SnowflakeEntry.archiveChannelID)
|
||||
.ofType(TextChannel.class)
|
||||
.blockOptional()
|
||||
.orElseThrow();
|
||||
|
||||
final Message message = event.getMessage().blockOptional().orElseThrow();
|
||||
final Member completer = event.getMember().orElseThrow();
|
||||
|
@ -14,6 +14,7 @@ import me.totalfreedom.discord.TFD4J;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import reactor.core.publisher.Flux;
|
||||
@ -136,9 +137,10 @@ public class Utilities
|
||||
|
||||
if (server == null) return false;
|
||||
|
||||
final Channel channel = server.getChannelById(SnowflakeEntry.reportChannelID).block();
|
||||
|
||||
if (!(channel instanceof TextChannel tch)) return false;
|
||||
final TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID)
|
||||
.ofType(TextChannel.class)
|
||||
.blockOptional()
|
||||
.orElseThrow();
|
||||
|
||||
final EmbedCreateSpec.Builder builder = EmbedCreateSpec.builder()
|
||||
.title("Report for " + reported.getName() + " (offline)")
|
||||
@ -157,7 +159,7 @@ public class Utilities
|
||||
}
|
||||
}
|
||||
EmbedCreateSpec embed = builder.build();
|
||||
Message message = tch.createMessage(embed).block();
|
||||
Message message = channel.createMessage(embed).block();
|
||||
|
||||
if (message != null && !ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID.getString().isEmpty())
|
||||
{
|
||||
@ -187,13 +189,9 @@ public class Utilities
|
||||
|
||||
final TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID)
|
||||
.ofType(TextChannel.class)
|
||||
.block();
|
||||
.blockOptional()
|
||||
.orElseThrow();
|
||||
|
||||
if (channel == null)
|
||||
{
|
||||
FLog.severe("The report channel ID specified in the config is invalid.");
|
||||
return false;
|
||||
}
|
||||
String location = "World: " + Objects.requireNonNull(reported.getLocation().getWorld()).getName() + ", X: " + reported.getLocation().getBlockX() + ", Y: " + reported.getLocation().getBlockY() + ", Z: " + reported.getLocation().getBlockZ();
|
||||
|
||||
final EmbedCreateSpec spec = EmbedCreateSpec.builder()
|
||||
|
Loading…
Reference in New Issue
Block a user