-
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.
+ SetGender command + setQuote command + userInfo command
- Loading branch information
1 parent
27cc381
commit d3aa5ba
Showing
16 changed files
with
862 additions
and
306 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
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,106 @@ | ||
package Commands.General; | ||
|
||
import Commands.Command; | ||
import Commands.CommandObject; | ||
import Main.Utility; | ||
import Objects.SplitFirstObject; | ||
import Objects.UserTypeObject; | ||
import sx.blah.discord.handle.obj.IUser; | ||
import sx.blah.discord.handle.obj.Permissions; | ||
|
||
/** | ||
* Created by Vaerys on 27/02/2017. | ||
*/ | ||
public class SetGender implements Command { | ||
@Override | ||
public String execute(String args, CommandObject command) { | ||
IUser user = command.author; | ||
SplitFirstObject userID = new SplitFirstObject(args); | ||
boolean adminEdit = false; | ||
if (Utility.testForPerms(dualPerms(), command.author, command.guild) || Utility.canBypass(command.author, command.guild)) { | ||
user = command.client.getUserByID(userID.getFirstWord()); | ||
if (user != null) { | ||
adminEdit = true; | ||
} | ||
} | ||
|
||
for (UserTypeObject u : command.guildUsers.getUsers()) { | ||
if (args.length() > 20) { | ||
return "> Your Gender's Length is too long...\n(Must be under 20 chars)"; | ||
} | ||
if (adminEdit) { | ||
if (u.getID().equals(user.getID())) { | ||
u.setGender(userID.getRest()); | ||
return "> User's Gender Edited"; | ||
} | ||
} else { | ||
if (u.getID().equals(command.authorID)) { | ||
u.setGender(args); | ||
return "> Gender Edited"; | ||
|
||
} | ||
} | ||
} | ||
return "> User Has not Spoken yet thus they have nothing to edit."; | ||
} | ||
|
||
@Override | ||
public String[] names() { | ||
return new String[]{"SetGender"}; | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Allows you to set your Gender on your User Card."; | ||
} | ||
|
||
@Override | ||
public String usage() { | ||
return "[Gender]"; | ||
} | ||
|
||
@Override | ||
public String type() { | ||
return TYPE_GENERAL; | ||
} | ||
|
||
@Override | ||
public String channel() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Permissions[] perms() { | ||
return new Permissions[0]; | ||
} | ||
|
||
@Override | ||
public boolean requiresArgs() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean doAdminLogging() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String dualDescription() { | ||
return "Allows you to set the Gender of a user."; | ||
} | ||
|
||
@Override | ||
public String dualUsage() { | ||
return "[UserID] [User Gender]"; | ||
} | ||
|
||
@Override | ||
public String dualType() { | ||
return TYPE_ADMIN; | ||
} | ||
|
||
@Override | ||
public Permissions[] dualPerms() { | ||
return new Permissions[]{Permissions.MANAGE_MESSAGES}; | ||
} | ||
} |
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,106 @@ | ||
package Commands.General; | ||
|
||
import Commands.Command; | ||
import Commands.CommandObject; | ||
import Main.Utility; | ||
import Objects.SplitFirstObject; | ||
import Objects.UserTypeObject; | ||
import sx.blah.discord.handle.obj.IUser; | ||
import sx.blah.discord.handle.obj.Permissions; | ||
|
||
/** | ||
* Created by Vaerys on 27/02/2017. | ||
*/ | ||
public class SetQuote implements Command { | ||
|
||
@Override | ||
public String execute(String args, CommandObject command) { | ||
IUser user = command.author; | ||
SplitFirstObject userID = new SplitFirstObject(args); | ||
boolean adminEdit = false; | ||
if (Utility.testForPerms(dualPerms(), command.author, command.guild) || Utility.canBypass(command.author,command.guild)) { | ||
user = command.client.getUserByID(userID.getFirstWord()); | ||
if (user != null) { | ||
adminEdit = true; | ||
} | ||
} | ||
|
||
for (UserTypeObject u : command.guildUsers.getUsers()) { | ||
if (args.length() > 140) { | ||
return "> Your Quote is too long...\n(must be under 140 chars)"; | ||
} | ||
if (adminEdit) { | ||
if (u.getID().equals(user.getID())) { | ||
u.setQuote(userID.getRest()); | ||
return "> User's Quote Edited."; | ||
} | ||
}else { | ||
if (u.getID().equals(command.authorID)) { | ||
u.setQuote(args); | ||
return "> Quote Edited."; | ||
} | ||
} | ||
} | ||
return "> User Has not Spoken yet thus they have nothing to edit."; | ||
} | ||
|
||
@Override | ||
public String[] names() { | ||
return new String[]{"SetQuote"}; | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Allows you to set your quote. Limit 140 chars."; | ||
} | ||
|
||
@Override | ||
public String usage() { | ||
return "[Quote...]"; | ||
} | ||
|
||
@Override | ||
public String type() { | ||
return TYPE_GENERAL; | ||
} | ||
|
||
@Override | ||
public String channel() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Permissions[] perms() { | ||
return new Permissions[0]; | ||
} | ||
|
||
@Override | ||
public boolean requiresArgs() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean doAdminLogging() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String dualDescription() { | ||
return "Allows you to set the quote of a user."; | ||
} | ||
|
||
@Override | ||
public String dualUsage() { | ||
return "[UserID] [User Quote]"; | ||
} | ||
|
||
@Override | ||
public String dualType() { | ||
return TYPE_ADMIN; | ||
} | ||
|
||
@Override | ||
public Permissions[] dualPerms() { | ||
return new Permissions[]{Permissions.MANAGE_MESSAGES}; | ||
} | ||
} |
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
Oops, something went wrong.