use of net.dv8tion.jda.api.entities.GuildChannel in project OrderlyDiscordBot by IceLeiYu.
the class ChannelChange method setName.
public void setName(SlashCommandInteractionEvent event) {
List<String> lang = Main.language.getGuildLang(event.getGuild().getId());
if (!permissionCheck(Permission.MANAGE_CHANNEL, event, true))
return;
GuildChannel channel;
String newName;
if (event.getOption("channel") != null)
channel = event.getOption("channel").getAsGuildChannel();
else
channel = event.getGuildChannel();
if ((newName = event.getOption("name").getAsString()).length() > 100) {
event.getHook().editOriginalEmbeds(createEmbed(lang.get(ChannelChange_TOO_LONG), 0xFF0000)).queue();
return;
}
channel.getManager().setName(newName).queue();
event.getHook().editOriginalEmbeds(createEmbed(lang.get(ChannelChange_CHANGE_SUCCESSFULLY), 0x00FFFF)).queue();
}
Aggregations