Search in sources :

Example 16 with GuildChannel

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();
}
Also used : GuildChannel(net.dv8tion.jda.api.entities.GuildChannel)

Aggregations

GuildChannel (net.dv8tion.jda.api.entities.GuildChannel)16 Guild (net.dv8tion.jda.api.entities.Guild)9 Member (net.dv8tion.jda.api.entities.Member)9 List (java.util.List)6 ArrayList (java.util.ArrayList)5 Permission (net.dv8tion.jda.api.Permission)5 GuildVoiceState (net.dv8tion.jda.api.entities.GuildVoiceState)4 Bean (at.xirado.bean.Bean)3 CommandFlag (at.xirado.bean.command.CommandFlag)3 GenericCommand (at.xirado.bean.command.GenericCommand)3 SlashCommand (at.xirado.bean.command.SlashCommand)3 SlashCommandContext (at.xirado.bean.command.SlashCommandContext)3 MessageContextCommand (at.xirado.bean.command.context.MessageContextCommand)3 UserContextCommand (at.xirado.bean.command.context.UserContextCommand)3 MockContextMenuCommand (at.xirado.bean.command.context.message.MockContextMenuCommand)3 SlapContextMenuCommand (at.xirado.bean.command.context.user.SlapContextMenuCommand)3 at.xirado.bean.command.slashcommands (at.xirado.bean.command.slashcommands)3 at.xirado.bean.command.slashcommands.leveling (at.xirado.bean.command.slashcommands.leveling)3 at.xirado.bean.command.slashcommands.moderation (at.xirado.bean.command.slashcommands.moderation)3 at.xirado.bean.command.slashcommands.music (at.xirado.bean.command.slashcommands.music)3