2020-11-21 01:43:09 +01:00
package uk.co.angrybee.joe.events ;
2020-10-29 01:08:22 +01:00
2024-01-18 17:02:46 +01:00
import net.dv8tion.jda.api.events.session.ShutdownEvent ;
2020-10-29 01:08:22 +01:00
import net.dv8tion.jda.api.hooks.ListenerAdapter ;
import net.dv8tion.jda.api.requests.CloseCode ;
import uk.co.angrybee.joe.DiscordWhitelister ;
public class ShutdownEvents extends ListenerAdapter
{
@Override
public void onShutdown ( ShutdownEvent shutdownEvent )
{
CheckIntents ( shutdownEvent . getCloseCode ( ) ) ;
}
2024-01-22 18:58:52 +01:00
// Check for the 'SERVER MEMBERS INTENT' & 'MESSAGE_CONTENT' and inform users if not enabled
2020-10-29 01:08:22 +01:00
private void CheckIntents ( CloseCode closeCode )
{
if ( closeCode = = null )
return ;
if ( closeCode = = CloseCode . DISALLOWED_INTENTS )
{
DiscordWhitelister . getPluginLogger ( ) . severe ( " \ u001B[31m " + " Cannot connect as this bot is not eligible to request the privileged intent 'GUILD_MEMBERS' " + " \ u001B[0m " ) ;
2024-01-22 18:58:52 +01:00
DiscordWhitelister . getPluginLogger ( ) . severe ( " \ u001B[31m " + " To fix this, please enable 'SERVER MEMBERS INTENT' & 'MESSAGE_CONTENT' located " +
2020-10-29 01:08:22 +01:00
" at https://discord.com/developers/applications -> the application you're using to run this bot -> the button called 'bot' on the left " + " \ u001B[0m " ) ;
}
}
}