use of com.ice.main.util.SlashCommandOption.USER_TAG in project OrderlyDiscordBot by IceLeiYu.
the class Ban method onCommand.
public void onCommand(SlashCommandInteractionEvent event) {
if (!permissionCheck(BAN_MEMBERS, event, true))
return;
List<String> lang = Main.language.getGuildLang(event.getGuild().getId());
User user = event.getOption(USER_TAG).getAsUser();
// Member member = event.getGuild().retrieveMemberById(user.getId()).complete();
Member selfMember = event.getGuild().getSelfMember();
if (!selfMember.hasPermission(BAN_MEMBERS)) {
event.getHook().editOriginalEmbeds(createEmbed(lang.get(BAN_NO_PERMISSION), 0xFF0000)).queue();
return;
}
if (botOwnerID.contains(user.getId())) {
event.getHook().editOriginalEmbeds(createEmbed(lang.get(BAN_DEVELOPER), 0xFF0000)).queue();
return;
}
// if (event.getGuild().retrieveBanList().complete().contains(user)) {
int delDays = 0;
OptionMapping option = event.getOption(DAYS);
if (option != null)
delDays = (int) Math.max(0, Math.min(7, option.getAsLong()));
event.getGuild().ban(user, delDays).flatMap(v -> event.getHook().editOriginalEmbeds(createEmbed(lang.get(BAN_SUCCESS) + ' ' + user.getAsTag(), 0xffb1b3))).queue();
}
Aggregations