Add invite command and Resolve admin on private message
This commit is contained in:
parent
285b87876c
commit
c06bdcd21a
33
src/main/java/net/Broken/Commands/Invite.java
Normal file
33
src/main/java/net/Broken/Commands/Invite.java
Normal file
@ -0,0 +1,33 @@
|
||||
package net.Broken.Commands;
|
||||
|
||||
import net.Broken.Commande;
|
||||
import net.Broken.Tools.PrivateMessage;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
public class Invite implements Commande{
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event) {
|
||||
if(event.getChannelType().isGuild()){
|
||||
event.getTextChannel().sendMessage("You can invite me whit this link:\nhttps://discordapp.com/oauth2/authorize?client_id=" + event.getJDA().getSelfUser().getId() + "&scope=bot&permissions=8").complete();
|
||||
}
|
||||
else {
|
||||
PrivateMessage.send(event.getAuthor(),"You can invite me whit this link:\nhttps://discordapp.com/oauth2/authorize?client_id=" + event.getJDA().getSelfUser().getId() + "&scope=bot&permissions=8",LogManager.getLogger());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrivateUsable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdminCmd() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNSFW() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -112,7 +112,7 @@ public class MainBot {
|
||||
Commande cmdObj = commandes.get(cmd.commande);
|
||||
boolean isAdmin;
|
||||
if(cmd.event.isFromType(ChannelType.PRIVATE)){
|
||||
isAdmin = cmd.event.getGuild().getMember(cmd.event.getAuthor()).hasPermission(Permission.ADMINISTRATOR);
|
||||
isAdmin = false;
|
||||
}
|
||||
else
|
||||
isAdmin = cmd.event.getMember().hasPermission(Permission.ADMINISTRATOR);
|
||||
|
Loading…
Reference in New Issue
Block a user