-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Seperated the Module and Toggle commands + added Module RoleSelect + added Module CC + added Module UserInfo
- Loading branch information
1 parent
d3aa5ba
commit a7c8da4
Showing
22 changed files
with
616 additions
and
619 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package Commands.Admin; | ||
|
||
import Commands.Command; | ||
import Commands.CommandObject; | ||
import GuildToggles.GuildToggle; | ||
import Main.Utility; | ||
import sx.blah.discord.handle.obj.Permissions; | ||
import sx.blah.discord.util.EmbedBuilder; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Created by Vaerys on 31/01/2017. | ||
*/ | ||
public class Module implements Command { | ||
@Override | ||
public String execute(String args, CommandObject command) { | ||
StringBuilder builder = new StringBuilder(); | ||
if (!args.isEmpty()) { | ||
for (GuildToggle t : command.guildToggles) { | ||
if (t.isModule()) { | ||
if (args.equalsIgnoreCase(t.name())) { | ||
t.toggle(command.guildConfig); | ||
return "> **" + t.name() + " is now " + t.get(command.guildConfig) + "**."; | ||
} | ||
} | ||
} | ||
builder.append("> Could not find Module \"" + args + "\".\n"); | ||
} | ||
EmbedBuilder embedBuilder = new EmbedBuilder(); | ||
String title = "> Here is a list of available Guild Modules:\n"; | ||
ArrayList<String> types = command.guildToggles.stream().filter(t -> t.isModule()).map(GuildToggle::name).collect(Collectors.toCollection(ArrayList::new)); | ||
Collections.sort(types); | ||
embedBuilder.withDesc(builder.toString()); | ||
Utility.listFormatterEmbed(title, embedBuilder, types, true); | ||
embedBuilder.appendField(spacer, Utility.getCommandInfo(this, command), false); | ||
embedBuilder.withColor(Utility.getUsersColour(command.client.getOurUser(), command.guild)); | ||
Utility.sendEmbededMessage("", embedBuilder.build(), command.channel); | ||
return null; | ||
} | ||
|
||
@Override | ||
public String[] names() { | ||
return new String[]{"Module"}; | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Allows for the toggle of certain commands."; | ||
} | ||
|
||
@Override | ||
public String usage() { | ||
return "(Module Type)"; | ||
} | ||
|
||
@Override | ||
public String type() { | ||
return TYPE_ADMIN; | ||
} | ||
|
||
@Override | ||
public String channel() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Permissions[] perms() { | ||
return new Permissions[]{Permissions.MANAGE_SERVER}; | ||
} | ||
|
||
@Override | ||
public boolean requiresArgs() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean doAdminLogging() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String dualDescription() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String dualUsage() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String dualType() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Permissions[] dualPerms() { | ||
return new Permissions[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package GuildToggles.Modules; | ||
|
||
import Commands.Command; | ||
import Commands.CommandObject; | ||
import GuildToggles.GuildToggle; | ||
import GuildToggles.Toggles.ShitpostFiltering; | ||
import POGOs.GuildConfig; | ||
|
||
/** | ||
* Created by Vaerys on 02/03/2017. | ||
*/ | ||
public class ModuleCC implements GuildToggle { | ||
|
||
@Override | ||
public String name() { | ||
return "CC"; | ||
} | ||
|
||
@Override | ||
public boolean toggle(GuildConfig config) { | ||
return config.moduleCC = !config.moduleCC; | ||
} | ||
|
||
@Override | ||
public boolean get(GuildConfig config) { | ||
return config.moduleCC; | ||
} | ||
|
||
@Override | ||
public void execute(CommandObject command) { | ||
if (command.guildConfig.moduleCC) { | ||
return; | ||
} else { | ||
command.removeCommandsByType(Command.TYPE_CC); | ||
command.removeChannel(Command.CHANNEL_SHITPOST); | ||
command.removeToggle(new ShitpostFiltering().name()); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isModule() { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package GuildToggles.Modules; | ||
|
||
import Commands.Command; | ||
import Commands.CommandObject; | ||
import Commands.General.SetGender; | ||
import Commands.General.SetQuote; | ||
import Commands.General.UserInfo; | ||
import GuildToggles.GuildToggle; | ||
import POGOs.GuildConfig; | ||
|
||
/** | ||
* Created by Vaerys on 02/03/2017. | ||
*/ | ||
public class ModuleMe implements GuildToggle{ | ||
|
||
@Override | ||
public String name() { | ||
return "UserInfo"; | ||
} | ||
|
||
@Override | ||
public boolean toggle(GuildConfig config) { | ||
return config.moduleMe = !config.moduleMe; | ||
} | ||
|
||
@Override | ||
public boolean get(GuildConfig config) { | ||
return config.moduleMe; | ||
} | ||
|
||
@Override | ||
public void execute(CommandObject command) { | ||
if (command.guildConfig.moduleMe) { | ||
return; | ||
} else { | ||
command.removeCommand(new UserInfo().names()); | ||
command.removeCommand(new SetGender().names()); | ||
command.removeCommand(new SetQuote().names()); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isModule() { | ||
return true; | ||
} | ||
} |
Oops, something went wrong.