Search in sources :

Example 6 with ChannelSetting

use of com.github.vaerys.enums.ChannelSetting in project DiscordSailv2 by Vaerys-Dawn.

the class ChannelHere method execute.

@Override
public String execute(String args, CommandObject command) {
    String desc = "";
    if (!args.isEmpty()) {
        for (ChannelSetting s : command.guild.channelSettings) {
            if (args.equalsIgnoreCase(s.toString())) {
                return s.toggleSetting(command.guild, command.channel.longID);
            }
        }
        desc = "> Could not find channel type \"" + args + "\"\n";
    }
    XEmbedBuilder embedBuilder = new XEmbedBuilder(command);
    String title = "> Here are all of the channel Types and Settings:";
    List<ChannelSetting> channelSettings = command.guild.channelSettings;
    List<String> types = channelSettings.stream().filter(channelSetting -> !channelSetting.isSetting()).map(ChannelSetting::toString).collect(Collectors.toList());
    List<String> settings = channelSettings.stream().filter(channelSetting -> channelSetting.isSetting()).map(ChannelSetting::toString).collect(Collectors.toList());
    Collections.sort(types);
    desc += "**Types**\n```\n" + spacer + Utility.listFormatter(types, true) + "```\n" + spacer + "**Settings**\n```\n" + Utility.listFormatter(settings, true) + "```\n";
    desc += "The Command **" + get(HelpChannel.class).getUsage(command) + "** Can give you extra information about each of the above.\n\n";
    desc += missingArgs(command);
    embedBuilder.withDesc(desc);
    embedBuilder.withTitle(title);
    RequestHandler.sendEmbedMessage("", embedBuilder, command.channel.get());
    return null;
}
Also used : XEmbedBuilder(com.github.vaerys.objects.XEmbedBuilder) ChannelSetting(com.github.vaerys.enums.ChannelSetting)

Aggregations

ChannelSetting (com.github.vaerys.enums.ChannelSetting)6 XEmbedBuilder (com.github.vaerys.objects.XEmbedBuilder)4 ArrayList (java.util.ArrayList)3 SAILType (com.github.vaerys.enums.SAILType)2 IChannel (sx.blah.discord.handle.obj.IChannel)2 CommandObject (com.github.vaerys.commands.CommandObject)1 ModuleRoles (com.github.vaerys.guildtoggles.modules.ModuleRoles)1 Globals (com.github.vaerys.main.Globals)1 Utility (com.github.vaerys.main.Utility)1 GuildObject (com.github.vaerys.masterobjects.GuildObject)1 UserObject (com.github.vaerys.masterobjects.UserObject)1 ChannelSettingObject (com.github.vaerys.objects.ChannelSettingObject)1 PatchObject (com.github.vaerys.objects.PatchObject)1 GuildConfig (com.github.vaerys.pogos.GuildConfig)1 GuildToggle (com.github.vaerys.templates.GuildToggle)1 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1