mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Improve error message when primary channel is improperly defined (#4586)
* Improve message verboseness when primary channel is improperly defined * Clarify primary channel behavior
This commit is contained in:
parent
90e4845627
commit
58b0fb089f
@ -256,6 +256,8 @@ discordErrorLoggerNoPerms=Discord console logger has been disabled due to insuff
|
||||
discordErrorNoGuild=Invalid or missing server ID! Please follow the tutorial in the config in order to setup the plugin.
|
||||
discordErrorNoGuildSize=Your bot is not in any servers! Please follow the tutorial in the config in order to setup the plugin.
|
||||
discordErrorNoPerms=Your bot cannot see or talk in any channel! Please make sure your bot has read and write permissions in all channels you wish to use.
|
||||
discordErrorNoPrimary=You did not define a primary channel or your defined primary channel is invalid. Falling back to the default channel: #{0}.
|
||||
discordErrorNoPrimaryPerms=Your bot cannot speak in your primary channel, #{0}. Please make sure your bot has read and write permissions in all channels you wish to use.
|
||||
discordErrorNoToken=No token provided! Please follow the tutorial in the config in order to setup the plugin.
|
||||
discordErrorWebhook=An error occurred while sending messages to your console channel\! This was likely caused by accidentally deleting your console webhook. This can usually by fixed by ensuring your bot has the "Manage Webhooks" permission and running "/ess reload".
|
||||
discordLoggingIn=Attempting to login to Discord...
|
||||
|
@ -179,6 +179,8 @@ and `staff`. If you only completed the initial setup, the `staff` channel defini
|
||||
most situations however, as the message system will always fallback to the `primary` channel if a channel ID is
|
||||
invalid.
|
||||
|
||||
**Note:** If you do not define a `primary` channel, the default channel of your server will be used.
|
||||
|
||||
Now on to the types of messages you can receive themselves (which is where you're going to use these channel
|
||||
definitions). In the `message-types` section of the config, you can see a list of message types (join/leave/chat/etc.)
|
||||
on the left (as the key), and on the right there is a channel definition.
|
||||
|
@ -278,9 +278,14 @@ public class JDADiscordService implements DiscordService, IEssentialsModule {
|
||||
TextChannel channel = guild.getTextChannelById(plugin.getSettings().getPrimaryChannelId());
|
||||
if (channel == null) {
|
||||
channel = guild.getDefaultChannel();
|
||||
if (channel == null || !channel.canTalk()) {
|
||||
if (channel == null) {
|
||||
throw new RuntimeException(tl("discordErrorNoPerms"));
|
||||
}
|
||||
logger.warning(tl("discordErrorNoPrimary", channel.getName()));
|
||||
}
|
||||
|
||||
if (!channel.canTalk()) {
|
||||
throw new RuntimeException(tl("discordErrorNoPrimaryPerms", channel.getName()));
|
||||
}
|
||||
primaryChannel = channel;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user