Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Some owner stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
greg6775 committed Nov 23, 2019
1 parent 5a849df commit ef1b1e1
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class BanCommand implements Command {

@Override
public void executed(String[] args, CommandEvent event) {
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.BAN_MEMBERS) || event.getGuild().getOwner().getId().equals(event.getAuthor().getId())) {
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.BAN_MEMBERS) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
if (event.getMessage().getMentionedMembers().size() == 1) {
Member victim = event.getMessage().getMentionedMembers().get(0);
if (!event.getAuthor().getId().equals(victim.getId())) {
Expand All @@ -37,8 +37,6 @@ public void executed(String[] args, CommandEvent event) {
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING, builder).setTitle("Not possible").setDescription("You can't ban yourself.").build()).queue();
}
} else if (event.getMessage().getMentionedMembers().size() == 0) {
EmbedBuilder builder = new EmbedBuilder();
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.WARNING, builder).setDescription("You have to mention at least one user!").build()).queue();
event.getHelpCommand().sendHelp(this, event.getRethink(), event.getAuthor(), event.getTextChannel());
} else if (event.getMessage().getMentionedMembers().size() > 1) {
for (int i = 0; i < event.getMessage().getMentionedMembers().size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ClearCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (args.length > 0) {
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.MESSAGE_MANAGE) || event.getGuild().getOwnerId().equals(event.getAuthor().getId())) {
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.MESSAGE_MANAGE) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
if (event.getGuild().getMemberById(event.getJDA().getSelfUser().getId()).hasPermission(Permission.MESSAGE_MANAGE)) {
try {
int nbToDelete = Integer.parseInt(args[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class GuildPrefixCommand implements Command {

@Override
public void executed(String[] args, CommandEvent event) {
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.MANAGE_SERVER) || event.getGuild().getOwnerId().equals(event.getAuthor().getId())) {
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
if (args.length == 1) {
if (!args[0].contains("\"")) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class KickCommand implements Command {

@Override
public void executed(String[] args, CommandEvent event) {
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.KICK_MEMBERS) || event.getGuild().getOwnerId().equals(event.getAuthor().getId())) {
if (event.getGuild().getMemberById(event.getAuthor().getId()).hasPermission(Permission.KICK_MEMBERS) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
if (event.getMessage().getMentionedMembers().size() == 1) {
Member victim = event.getMessage().getMentionedMembers().get(0);
if (!event.getAuthor().getId().equals(victim.getId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class NickCommand implements Command {

@Override
public void executed(String[] args, CommandEvent event) {
if (event.getMember().hasPermission(Permission.NICKNAME_MANAGE) || event.getGuild().getOwnerId().equals(event.getMember().getId())) {
if (event.getMember().hasPermission(Permission.NICKNAME_MANAGE) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
if (event.getGuild().getSelfMember().hasPermission(Permission.NICKNAME_MANAGE)) {
if (event.getMessage().getMentionedMembers().size() == 1) {
if (!event.getMessage().getMentionedMembers().get(0).getId().equals(event.getGuild().getSelfMember().getId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RoleCommand implements Command {
public void executed(String[] args, CommandEvent event) {
if (args.length > 0) {
if (event.getMember().hasPermission(Permission.MANAGE_ROLES)) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
switch (args[0].toLowerCase()) {
case "add":
if (event.getMessage().getMentionedMembers().size() > 0 && event.getMessage().getMentionedRoles().size() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class RulesCommand implements Command {

@Override
public void executed(String[] args, CommandEvent event) {
if (event.getMember().hasPermission(Permission.MANAGE_SERVER)) {
if (event.getMember().hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO, new EmbedBuilder()
.setTitle("Set up rules")
Expand Down

0 comments on commit ef1b1e1

Please sign in to comment.