Correct null pointer close #25

This commit is contained in:
BrokenFire 2018-02-27 16:52:23 +01:00
parent 5f5fc3ab16
commit 4bf0585fca
2 changed files with 10 additions and 1 deletions

View File

@ -26,7 +26,9 @@ public class DayTrigger implements Commande{
@Override
public void action(String[] args, MessageReceivedEvent event) {
if(!event.isFromType(ChannelType.PRIVATE))
event.getMessage().delete().queue();
DayListener.getInstance().trigger();
}

View File

@ -101,7 +101,14 @@ public class MainBot {
if (commandes.containsKey(cmd.commande))
{
Commande cmdObj = commandes.get(cmd.commande);
if(!cmdObj.isAdminCmd() || cmd.event.getMember().hasPermission(Permission.ADMINISTRATOR)){
boolean isAdmin;
if(cmd.event.isFromType(ChannelType.PRIVATE)){
isAdmin = jda.getGuilds().get(0).getMember(cmd.event.getAuthor()).hasPermission(Permission.ADMINISTRATOR);
}
else
isAdmin = cmd.event.getMember().hasPermission(Permission.ADMINISTRATOR);
if(!cmdObj.isAdminCmd() || isAdmin){
if(cmd.event.isFromType(ChannelType.PRIVATE) && commandes.get(cmd.commande).isPrivateUsable())
{