Skip to content

Commit

Permalink
Update TagCmd.java
Browse files Browse the repository at this point in the history
  • Loading branch information
ya64 committed Jun 10, 2020
1 parent 43cbf03 commit ed1e61f
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/main/java/com/jagrosh/vortex/commands/general/TagCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.jagrosh.jdautilities.command.Command;
import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.vortex.Vortex;
import com.jagrosh.vortex.commands.CommandTools;
import net.dv8tion.jda.core.Permission;
import net.dv8tion.jda.core.entities.Role;

public class TagCmd extends Command
{
Expand All @@ -20,19 +20,7 @@ public TagCmd(Vortex vortex) {
@Override
protected void execute(CommandEvent event)
{
Role rtcRole = vortex.getDatabase().settings.getSettings(event.getGuild()).getRtcRole(event.getGuild());
Role modRole = vortex.getDatabase().settings.getSettings(event.getGuild()).getModeratorRole(event.getGuild());

/* Checks if the user has permission to use tags. People may use tags if they meet any of the following criteria:
- Has the manage messages permission
- Has the predesignated moderator role
- Is an RTC
*/
if (
!event.getMember().hasPermission(event.getTextChannel(), Permission.MESSAGE_MANAGE) &&
!(modRole != null && event.getMember().getRoles().contains(modRole)) &&
!(rtcRole != null && event.getMember().getRoles().contains(rtcRole))
)
if (!CommandTools.hasGeneralCommandPerms(vortex, event, Permission.MESSAGE_MANAGE))
return;

String tagName = event.getArgs().trim().split(" ")[0];
Expand Down

0 comments on commit ed1e61f

Please sign in to comment.