use of com.github.jonteohr.tejbz.PermissionHandler in project pgda by jonteohr.
the class ModHelp method sendModHelp.
public static void sendModHelp(SlashCommandInteractionEvent e, InteractionHook hook) {
PermissionHandler perms = new PermissionHandler();
if (!perms.isMod(e.getMember()))
return;
EmbedBuilder msg = new EmbedBuilder();
msg.setAuthor("PGDA", null, App.authorImage);
msg.setColor(App.color);
msg.setTitle("Mod/Admin commands");
msg.setDescription("Confirmation messages are sent out in PMs. If you don't get one, you don't have access!\n" + "I'd recommend using these commands in " + e.getGuild().getTextChannelById("489590000556441603").getAsMention() + " since nobody else needs to see this.");
msg.addField("Command", "" + "`!setschedule <imageURL>`\n" + "`!setvideo <videoURL>`\n" + "`!mute <@user>`\n" + "`!togglejoin`\n" + "`!queuelimit <number>`", true);
msg.addField("Description", "" + "Sets the new image of `!schedule`.\n" + "Sets the link as the most recent video.\n" + "Mutes/Unmutes a mentioned member\n" + "Toggles the queue system.\n" + "Sets the max limit of users in the Live lobby. If there's less people in channel than set amount and joining is enabled then the next person in queue will join.", true);
hook.sendMessageEmbeds(msg.build()).queue();
}
use of com.github.jonteohr.tejbz.PermissionHandler in project pgda by jonteohr.
the class Mute method onMessageReceived.
public void onMessageReceived(MessageReceivedEvent e) {
String[] args = e.getMessage().getContentRaw().split("\\s+");
if (!args[0].equalsIgnoreCase(App.prefix + "mute"))
return;
PermissionHandler perms = new PermissionHandler();
if (!perms.isMod(e.getMember()))
return;
if (e.getMessage().getMentionedMembers().size() < 1) {
e.getAuthor().openPrivateChannel().complete().sendMessage("No user specified.\nCorrect usage: `!mute <@user>`").queue();
return;
}
Member target = e.getMessage().getMentionedMembers().get(0);
Role role = e.getGuild().getRoleById("732558971000455198");
// User is already muted
if (target.getRoles().contains(role)) {
e.getGuild().removeRoleFromMember(target, role).complete();
Logging.sendModLog("User Un-muted", LogType.INFORMATION, target.getUser().getAsTag(), e.getAuthor().getAsTag());
return;
}
e.getGuild().addRoleToMember(target, role).complete();
Logging.sendModLog("User Muted", LogType.WARNING, target.getUser().getAsTag(), e.getAuthor().getAsTag());
return;
}
use of com.github.jonteohr.tejbz.PermissionHandler in project pgda by jonteohr.
the class SetSchedule method setSchedule.
public static void setSchedule(SlashCommandInteractionEvent e, InteractionHook hook) {
PermissionHandler perms = new PermissionHandler();
PropertyHandler props = new PropertyHandler();
if (!perms.isAdmin(e.getMember()))
return;
if (e.getOptions().size() < 1) {
hook.sendMessage("Incorrect usage.\nCorrect usage: `!setschedule <imageURL>`").queue();
return;
}
try {
URL url = new URL(e.getOption("image_url").getAsString());
if (props.setProperty("schedule_url", url.toString())) {
hook.sendMessage("Saved new schedule image!").queue();
WebLog.addToWeblog("DISCORD", e.getUser().getAsTag(), "Updated the schedule: <a href='" + url + "'>New Schedule</a>");
return;
}
hook.sendMessage("Error while saving. Try again later!").queue();
return;
} catch (MalformedURLException e1) {
hook.sendMessage("Argument was not a valid image URL!").queue();
System.out.println(e1);
return;
}
}
use of com.github.jonteohr.tejbz.PermissionHandler in project pgda by jonteohr.
the class SetVideo method setVideo.
public static void setVideo(SlashCommandInteractionEvent e, InteractionHook hook) {
PropertyHandler prop = new PropertyHandler();
PermissionHandler perm = new PermissionHandler();
if (!perm.isMod(e.getMember()))
return;
if (e.getOptions().size() < 1) {
hook.sendMessage("Invalid usage.\nCorrect usage: `!setvid <youtubeURL>`").queue();
return;
}
String url = e.getOption("video_url").getAsString();
if (prop.setProperty("recent_video", url)) {
hook.sendMessage("Successfully saved!").queue();
WebLog.addToWeblog("DISCORD", e.getUser().getAsTag(), "Updated the latest video: <a href='" + url + "'>New Video</a>");
} else {
hook.sendMessage("Failed to save...").queue();
}
}
use of com.github.jonteohr.tejbz.PermissionHandler in project pgda by jonteohr.
the class Join method onMessageReceived.
public void onMessageReceived(MessageReceivedEvent e) {
String[] args = e.getMessage().getContentRaw().split("\\s+");
if (!args[0].equalsIgnoreCase(App.prefix + "join"))
return;
PermissionHandler perms = new PermissionHandler();
if (!perms.isSub(e.getMember())) {
e.getChannel().sendMessage(e.getAuthor().getAsMention() + " You must be a subscriber to join!").queue();
return;
}
if (!App.enableJoin) {
e.getChannel().sendMessage(e.getAuthor().getAsMention() + " Joining is currently disabled.").queue();
return;
}
if (!e.getMember().getVoiceState().inAudioChannel() || !e.getMember().getVoiceState().getChannel().equals(lobby)) {
e.getChannel().sendMessage(e.getAuthor().getAsMention() + " You must be connected to the Lobby channel while performing this command.").queue();
return;
}
int ticket = queue.getMembers().size() + 1;
placement.add(queue.getMembers().size(), e.getAuthor().getId());
e.getGuild().moveVoiceMember(e.getMember(), queue).complete();
e.getAuthor().openPrivateChannel().complete().sendMessage("You've been placed in queue. Make sure you do not leave this lobby or else you will lose your spot!").queue();
e.getAuthor().openPrivateChannel().complete().sendMessage("Your ticket number is: " + ticket).queue();
}
Aggregations