use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.
the class ProxyCommand method compose.
@Override
public void compose(SlashCommandInteractionEvent event) {
checkContext(event.getMember(), event.getTextChannel());
Tama.INSTANCE.getGuildManager().findGuild(Objects.requireNonNull(event.getGuild()).getId()).thenAccept(guild -> {
if (guild == null)
handleException(event, new CommandException("Can't fetch guild"));
OptionMapping optionMapping = event.getOption("channel");
if (optionMapping != null) {
TextChannel textChannel = optionMapping.getAsTextChannel();
if (!guild.getWhitelistedProxyChannels().contains(textChannel.getId())) {
guild.getWhitelistedProxyChannels().remove(textChannel.getId());
event.replyEmbeds(EmbedHelper.success(String.format("Proxy on %s is now %s", textChannel.getAsMention(), "enabled"))).queue();
} else {
guild.getWhitelistedProxyChannels().add(textChannel.getId());
event.replyEmbeds(EmbedHelper.success(String.format("Proxy on %s is now %s", textChannel.getAsMention(), "disabled"))).queue();
}
} else {
guild.setProxy(!guild.isProxy());
event.replyEmbeds(EmbedHelper.success("Proxy on this server was: " + (guild.isProxy() ? "enabled" : "disabled"))).queue();
}
});
}
use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.
the class RewardCommand method compose.
@Override
public void compose(SlashCommandInteractionEvent event) {
checkContext(event.getMember(), event.getTextChannel());
Tama.INSTANCE.getGuildManager().findGuild(Objects.requireNonNull(event.getGuild()).getId()).thenAccept(guild -> {
if (guild == null)
handleException(event, new CommandException("Can't fetch guild"));
int level = Objects.requireNonNull(event.getOption("level")).getAsInt();
Role role = Objects.requireNonNull(event.getOption("role")).getAsRole();
guild.getLevelRewards().put(level, role.getId());
event.getTextChannel().sendMessageEmbeds(EmbedHelper.success(String.format("Role reward for level %s is now %s", level, role.getAsMention()))).queue();
});
}
use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.
the class RewardCommand method compose.
/*
TODO: Make better handling for this type of commands
*/
@Override
public void compose(MessageReceivedEvent event, String... args) {
checkContext(event.getMember(), event.getTextChannel());
Tama.INSTANCE.getGuildManager().findGuild(Objects.requireNonNull(event.getGuild()).getId()).thenAccept(guild -> {
if (guild == null)
handleException(event, new CommandException("Can't fetch guild"));
try {
if (event.getMessage().getMentionedRoles().isEmpty())
return;
int level = Integer.parseInt(args[0]);
Role role = event.getMessage().getMentionedRoles().get(0);
guild.getLevelRewards().put(level, Objects.requireNonNull(role).getId());
event.getTextChannel().sendMessageEmbeds(EmbedHelper.success(String.format("Role reward for level %s is now %s", level, role.getAsMention()))).queue();
} catch (Exception e) {
e.printStackTrace();
}
});
}
use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.
the class LickNipplesCommand method compose.
@Override
public void compose(SlashCommandInteractionEvent event) {
checkContext(event.getMember(), event.getTextChannel());
OptionMapping optionMapping = event.getOption("user");
if (optionMapping == null)
throw new CommandException(getUsage());
event.replyEmbeds(execute(String.format("%s licked %s nipples", event.getUser().getAsMention(), optionMapping.getAsUser().getAsMention()))).queue();
}
use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.
the class MindBreakCommand method compose.
@Override
public void compose(SlashCommandInteractionEvent event) {
checkContext(event.getMember(), event.getTextChannel());
OptionMapping optionMapping = event.getOption("user");
if (optionMapping == null)
throw new CommandException(getUsage());
event.replyEmbeds(execute(String.format("%s damaged %s mentality", event.getUser().getAsMention(), optionMapping.getAsUser().getAsMention()))).queue();
}
Aggregations