Merge branch 'develop'
This commit is contained in:
+7
-1
@@ -1,7 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="lib" path="lib/commons-codec-1.11.jar"/>
|
<classpathentry kind="lib" path="lib/commons-codec-1.11.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
|
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/gson-2.6.2.jar"/>
|
<classpathentry kind="lib" path="lib/gson-2.6.2.jar"/>
|
||||||
@@ -20,5 +24,7 @@
|
|||||||
<classpathentry kind="lib" path="lib/commons-collections4-4.3.jar"/>
|
<classpathentry kind="lib" path="lib/commons-collections4-4.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-lang3-3.9.jar"/>
|
<classpathentry kind="lib" path="lib/commons-lang3-3.9.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-text-1.6.jar"/>
|
<classpathentry kind="lib" path="lib/commons-text-1.6.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/google-api-services-youtube-v3-rev212-1.25.0.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/lavaplayer-1.3.19.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
+24
-32
@@ -9,10 +9,6 @@
|
|||||||
"Localized Commands","c++, g++, cplus, cpp",""
|
"Localized Commands","c++, g++, cplus, cpp",""
|
||||||
"Localized Commands","catch",""
|
"Localized Commands","catch",""
|
||||||
"Localized Commands","character",""
|
"Localized Commands","character",""
|
||||||
"Localized Commands","charactercreate",""
|
|
||||||
"Localized Commands","charactereditbio",""
|
|
||||||
"Localized Commands","charactereditname",""
|
|
||||||
"Localized Commands","charactereditURL",""
|
|
||||||
"Localized Commands","choose",""
|
"Localized Commands","choose",""
|
||||||
"Localized Commands","color, colour",""
|
"Localized Commands","color, colour",""
|
||||||
"Localized Commands","crouton",""
|
"Localized Commands","crouton",""
|
||||||
@@ -24,11 +20,6 @@
|
|||||||
"Localized Commands","eightball, 8ball",""
|
"Localized Commands","eightball, 8ball",""
|
||||||
"Localized Commands","fetch",""
|
"Localized Commands","fetch",""
|
||||||
"Localized Commands","givebeans",""
|
"Localized Commands","givebeans",""
|
||||||
"Localized Commands","guildroleadd",""
|
|
||||||
"Localized Commands","guildroleallowed",""
|
|
||||||
"Localized Commands","guildrolelist",""
|
|
||||||
"Localized Commands","guildrolenotallowed","guildrolenotallowed, rolelistremove"
|
|
||||||
"Localized Commands","guildroleremove",""
|
|
||||||
"Localized Commands","help",""
|
"Localized Commands","help",""
|
||||||
"Localized Commands","indicator",""
|
"Localized Commands","indicator",""
|
||||||
"Localized Commands","info, about",""
|
"Localized Commands","info, about",""
|
||||||
@@ -37,14 +28,12 @@
|
|||||||
"Localized Commands","kittyrole",""
|
"Localized Commands","kittyrole",""
|
||||||
"Localized Commands","leaderboard",""
|
"Localized Commands","leaderboard",""
|
||||||
"Localized Commands","map",""
|
"Localized Commands","map",""
|
||||||
|
"Localized Commands","mod",""
|
||||||
|
"Localized Commands","music",""
|
||||||
"Localized Commands","perish, thenperish",""
|
"Localized Commands","perish, thenperish",""
|
||||||
"Localized Commands","ping",""
|
"Localized Commands","ping",""
|
||||||
"Localized Commands","poll",""
|
"Localized Commands","poll",""
|
||||||
"Localized Commands","raffle",""
|
"Localized Commands","raffle",""
|
||||||
"Localized Commands","raffleend",""
|
|
||||||
"Localized Commands","rafflejoin",""
|
|
||||||
"Localized Commands","rafflespin",""
|
|
||||||
"Localized Commands","rafflestart",""
|
|
||||||
"Localized Commands","rating",""
|
"Localized Commands","rating",""
|
||||||
"Localized Commands","remind",""
|
"Localized Commands","remind",""
|
||||||
"Localized Commands","results",""
|
"Localized Commands","results",""
|
||||||
@@ -53,8 +42,6 @@
|
|||||||
"Localized Commands","rpend",""
|
"Localized Commands","rpend",""
|
||||||
"Localized Commands","rpg",""
|
"Localized Commands","rpg",""
|
||||||
"Localized Commands","rpstart",""
|
"Localized Commands","rpstart",""
|
||||||
"Localized Commands","searchcharacter",""
|
|
||||||
"Localized Commands","showpoll",""
|
|
||||||
"Localized Commands","shutdown",""
|
"Localized Commands","shutdown",""
|
||||||
"Localized Commands","stats",""
|
"Localized Commands","stats",""
|
||||||
"Localized Commands","teey",""
|
"Localized Commands","teey",""
|
||||||
@@ -87,10 +74,10 @@
|
|||||||
"Localized Strings","ChangeIndicatorChanged","Indicator changed to `%s`"
|
"Localized Strings","ChangeIndicatorChanged","Indicator changed to `%s`"
|
||||||
"Localized Strings","ChangeIndicatorError","Please specify a letter or symbol to use!"
|
"Localized Strings","ChangeIndicatorError","Please specify a letter or symbol to use!"
|
||||||
"Localized Strings","ChangeIndicatorInfo","Changes the command indicator to any single character. By default, it's '!'. If more than one character is provided, the first one is used!"
|
"Localized Strings","ChangeIndicatorInfo","Changes the command indicator to any single character. By default, it's '!'. If more than one character is provided, the first one is used!"
|
||||||
"Localized Strings","CharacterCreateDuplicate",""
|
"Localized Strings","CharacterCreateDuplicate","You can't create a character with the same name!"
|
||||||
"Localized Strings","CharacterCreateInfo",""
|
"Localized Strings","CharacterCreateInfo",""
|
||||||
"Localized Strings","CharacterCreateNullInfo",""
|
"Localized Strings","CharacterCreateNullInfo","You have to put info in!"
|
||||||
"Localized Strings","CharacterCreateSuccess",""
|
"Localized Strings","CharacterCreateSuccess","I'll store that character for you!"
|
||||||
"Localized Strings","CharacterEditBioInfo","Change the short bio for your character! "
|
"Localized Strings","CharacterEditBioInfo","Change the short bio for your character! "
|
||||||
"Localized Strings","CharacterEditBioNotAuth","You're not authorized to change that character! "
|
"Localized Strings","CharacterEditBioNotAuth","You're not authorized to change that character! "
|
||||||
"Localized Strings","CharacterEditBioNotValid",""
|
"Localized Strings","CharacterEditBioNotValid",""
|
||||||
@@ -103,12 +90,12 @@
|
|||||||
"Localized Strings","CharacterEditURLNotAuth","You're not authorized to change that character! "
|
"Localized Strings","CharacterEditURLNotAuth","You're not authorized to change that character! "
|
||||||
"Localized Strings","CharacterEditURLNotValid","That's not a valid url! "
|
"Localized Strings","CharacterEditURLNotValid","That's not a valid url! "
|
||||||
"Localized Strings","CharacterEditURLSuccess","Successfully changed your reference! "
|
"Localized Strings","CharacterEditURLSuccess","Successfully changed your reference! "
|
||||||
"Localized Strings","CharacterInfo",""
|
"Localized Strings","CharacterInfo","Character is a super command!\n\t`character create \""name\"", \""bio\"", \""ref url\""` will create a new character with those details!\n\t`character editbio \""uniqueID\"", \""new bio\""` will make a new bio for your character!\n\t`character editname \""uniqueID\"", \""new name\""` will make a new name for your character!\n\t`character editbio \""uniqueID\"", \""new refurl\""` will make a new url for your character!\n\t`character search \""name\"" OR \""uniqueID\""` will search for that character!"
|
||||||
"Localized Strings","CharacterSearchInfo","Find a character with their name or Unique ID! `charactersearch name` or `charactersearch UniqueID`"
|
"Localized Strings","CharacterSearchInfo","Find a character with their name or Unique ID! `charactersearch name` or `charactersearch UniqueID`"
|
||||||
"Localized Strings","CharacterSearchMultipleCharacter","%s is owned by %s. Unique ID is `%s`"
|
"Localized Strings","CharacterSearchMultipleCharacter","%s is owned by %s. Unique ID is `%s`"
|
||||||
"Localized Strings","CharacterSearchMultipleCharacterHeader","I found a couple characters with that name, use `charactersearch UniqueID` with their Unique ID to find them!"
|
"Localized Strings","CharacterSearchMultipleCharacterHeader","I found a couple characters with that name, use `charactersearch UniqueID` with their Unique ID to find them!"
|
||||||
"Localized Strings","CharacterSearchNoCharacterFound","Couldn't find a character with that name or ID!"
|
"Localized Strings","CharacterSearchNoCharacterFound","Couldn't find a character with that name or ID!"
|
||||||
"Localized Strings","CharacterSearchOneCharacter","I found one character with that name! n Owner: %s | Name: %s | Bio: %s | Ref: <%s> | Unique ID: `%s`"
|
"Localized Strings","CharacterSearchOneCharacter","I found one character with that name! \n Owner: %s | Name: %s | Bio: %s | Ref: <%s> | Unique ID: `%s`"
|
||||||
"Localized Strings","ChooseChoice","I chooooooose %s!"
|
"Localized Strings","ChooseChoice","I chooooooose %s!"
|
||||||
"Localized Strings","ChooseInfo","With an input of x,y,z where x y and z are all choices, kitty will choose one"
|
"Localized Strings","ChooseInfo","With an input of x,y,z where x y and z are all choices, kitty will choose one"
|
||||||
"Localized Strings","ChooseOne","I can't choose from *one* thing!"
|
"Localized Strings","ChooseOne","I can't choose from *one* thing!"
|
||||||
@@ -156,15 +143,15 @@
|
|||||||
"Localized Strings","GiveBeansInvalid","That's not a valid number!"
|
"Localized Strings","GiveBeansInvalid","That's not a valid number!"
|
||||||
"Localized Strings","GiveBeansNoneMentioned","You didn't mention anyone!"
|
"Localized Strings","GiveBeansNoneMentioned","You didn't mention anyone!"
|
||||||
"Localized Strings","GiveBeansSuccess","Gave %s %s beans!"
|
"Localized Strings","GiveBeansSuccess","Gave %s %s beans!"
|
||||||
"Localized Strings","GuildRoleAddFailure",""
|
"Localized Strings","GuildRoleAddFailure","I can't add %s to %s."
|
||||||
"Localized Strings","GuildRoleAddInfo","Add a role to yourself!"
|
"Localized Strings","GuildRoleAddInfo","Add a role to yourself!"
|
||||||
"Localized Strings","GuildRoleAddNotAllowed","You are not allowed to add %s!"
|
"Localized Strings","GuildRoleAddNotAllowed","You are not allowed to add %s!"
|
||||||
"Localized Strings","GuildRoleAddSuccess","Added %s to %s"
|
"Localized Strings","GuildRoleAddSuccess","Added %s to you!"
|
||||||
"Localized Strings","GuildRoleAllowedDuplicate","Can't add the same role twice!"
|
"Localized Strings","GuildRoleAllowedDuplicate","Can't add the same role twice!"
|
||||||
"Localized Strings","GuildRoleAllowedInfo","Adds role to the list of roles users are allowed to add to themselves."
|
"Localized Strings","GuildRoleAllowedInfo","Adds role to the list of roles users are allowed to add to themselves."
|
||||||
"Localized Strings","GuildRoleAllowedSuccess","Added %s to the allowed roles!"
|
"Localized Strings","GuildRoleAllowedSuccess","Added %s to the allowed roles!"
|
||||||
"Localized Strings","GuildRoleInfo",""
|
"Localized Strings","GuildRoleInfo","Role is a super command!\n\t`role add \""role\""` will add a role to you!\n\t`role remove \""role\""` will remove a role!\n\t`role list` will list all the roles you're allowed to add to yourself!\n`ADMIN COMMANDS`\n\t`role allowed \""role\""` will add a role to the list of roles users are allowed to add\n\t`role unallowed \""role\""` will remove a role from the list of roles that users are allowed to add"
|
||||||
"Localized Strings","GuildRoleListEmpty",""
|
"Localized Strings","GuildRoleListEmpty","There are no roles you can add to yourself."
|
||||||
"Localized Strings","GuildRoleListOutput","You can add these roles! %s"
|
"Localized Strings","GuildRoleListOutput","You can add these roles! %s"
|
||||||
"Localized Strings","GuildRoleNotAllowedFailure","Unable to remove %s from the list!"
|
"Localized Strings","GuildRoleNotAllowedFailure","Unable to remove %s from the list!"
|
||||||
"Localized Strings","GuildRoleNotAllowedInfo","Removes a role from the list that users are allowed to add to themselves."
|
"Localized Strings","GuildRoleNotAllowedInfo","Removes a role from the list that users are allowed to add to themselves."
|
||||||
@@ -190,6 +177,8 @@
|
|||||||
"Localized Strings","MapSeed","Seed"
|
"Localized Strings","MapSeed","Seed"
|
||||||
"Localized Strings","MapVersion","Using mapgen v0.1"
|
"Localized Strings","MapVersion","Using mapgen v0.1"
|
||||||
"Localized Strings","MapWidth",""
|
"Localized Strings","MapWidth",""
|
||||||
|
"Localized Strings","ModInfo","Mod is a super command for admin or mod use only!\n\t`mod ban @user` will ban a user from the server\n\t`mod kick @user` will kick the user from the server"
|
||||||
|
"Localized Strings","MusicInfo",""
|
||||||
"Localized Strings","PerishInfo","Adds a red, 'a n g e r y' overlay to your icon or the icon of a friend you mentioned"
|
"Localized Strings","PerishInfo","Adds a red, 'a n g e r y' overlay to your icon or the icon of a friend you mentioned"
|
||||||
"Localized Strings","PingInfo","Will respond with Pong!"
|
"Localized Strings","PingInfo","Will respond with Pong!"
|
||||||
"Localized Strings","PingResponse","Pong!"
|
"Localized Strings","PingResponse","Pong!"
|
||||||
@@ -208,24 +197,25 @@
|
|||||||
"Localized Strings","PollVoteSuccess","You successfully voted for"
|
"Localized Strings","PollVoteSuccess","You successfully voted for"
|
||||||
"Localized Strings","RaffleEndFailure","I don't think there's one going!"
|
"Localized Strings","RaffleEndFailure","I don't think there's one going!"
|
||||||
"Localized Strings","RaffleEndInfo",""
|
"Localized Strings","RaffleEndInfo",""
|
||||||
"Localized Strings","RaffleEndSuccess",""
|
"Localized Strings","RaffleEndSuccess","You ended the raffle!"
|
||||||
"Localized Strings","RaffleJoinFailure",""
|
"Localized Strings","RaffleInfo","Raffle is a super command!\n\t`raffle start \"# of beans\"` will start a raffle with an entrance fee of the number of beans! Defaults to 100.\n\t`raffle end` will stop the raffle!\n\t`raffle spin` will choose a winner, you can only win once!\n\t`raffle join` will add you to the raffle!"
|
||||||
|
"Localized Strings","RaffleJoinFailure","You can't join again!"
|
||||||
"Localized Strings","RaffleJoinInfo",""
|
"Localized Strings","RaffleJoinInfo",""
|
||||||
"Localized Strings","RaffleJoinSuccess",""
|
"Localized Strings","RaffleJoinSuccess","You joined the raffle! Good luck!"
|
||||||
"Localized Strings","RaffleSpinFailure","I can't choose a winner D:"
|
"Localized Strings","RaffleSpinFailure","I can't choose a winner D:"
|
||||||
"Localized Strings","RaffleSpinInfo",""
|
"Localized Strings","RaffleSpinInfo",""
|
||||||
"Localized Strings","RaffleSpinSuccess","The winner issssssss %s!"
|
"Localized Strings","RaffleSpinSuccess","The winner issssssss %s!"
|
||||||
"Localized Strings","RaffleStartFailure",""
|
"Localized Strings","RaffleStartFailure","I can't start another raffle, try ending the first!"
|
||||||
"Localized Strings","RaffleStartInfo",""
|
"Localized Strings","RaffleStartInfo",""
|
||||||
"Localized Strings","RaffleStartSuccess",""
|
"Localized Strings","RaffleStartSuccess","Started a raffle with %s as the cost!"
|
||||||
"Localized Strings","RatingChanged","Kittybot content set to %s"
|
"Localized Strings","RatingChanged","Kittybot content set to %s"
|
||||||
"Localized Strings","RatingInfo","'0' is fully sfw (Derpi and e621 searches are disabled), '1' is filtered (kitty auto appends a sfw tag on any searches), '2' is nsfw (any search will go through). Some other words are supported for setting filter as well."
|
"Localized Strings","RatingInfo","'0' is fully sfw (Derpi and e621 searches are disabled)\n'1' is filtered (kitty auto appends a sfw tag on any searches)\n'2' is nsfw (any search will go through). Some other words are supported for setting filter as well."
|
||||||
"Localized Strings","RatingInvalid","Invalid content rating"
|
"Localized Strings","RatingInvalid","Invalid content rating"
|
||||||
"Localized Strings","RatingWarning","Warning: NSFW may slip through, images are only based on tags on their respective sites!"
|
"Localized Strings","RatingWarning","Warning: NSFW may slip through, images are only based on tags on their respective sites!"
|
||||||
"Localized Strings","RemindInfo",""
|
"Localized Strings","RemindInfo","`remind \"# of mins\" \"reminder\"` I'll remind you to do something!"
|
||||||
"Localized Strings","RoleChanged","Changed %s to role `%s`!"
|
"Localized Strings","RoleChanged","Changed %s to role `%s`!"
|
||||||
"Localized Strings","RoleError","You aren't allowed to do that! You must have the KittyRole '%' or higher!"
|
"Localized Strings","RoleError","You aren't allowed to do that! You must have the KittyRole '%' or higher!"
|
||||||
"Localized Strings","RoleInfo","Will show the current role you have, Admins can change others roles with input of 'role x @y' with x being blacklist, general, mod, or admin. Blacklist will not allow the user to interact with kitty anymore, general mod and admin will give the user access to those commands."
|
"Localized Strings","RoleInfo","Will show the current role you have, Admins can change others roles with input of 'role x @y' with x being blacklist, general, mod, or admin.\nBlacklist will not allow the user to interact with kitty anymore, general mod and admin will give the user access to those commands."
|
||||||
"Localized Strings","RoleNeededRole","Please enter `general`, `mod`, or `admin`!"
|
"Localized Strings","RoleNeededRole","Please enter `general`, `mod`, or `admin`!"
|
||||||
"Localized Strings","RoleStandardResponse","Your role is %s"
|
"Localized Strings","RoleStandardResponse","Your role is %s"
|
||||||
"Localized Strings","RollError","Didn't work ;3;"
|
"Localized Strings","RollError","Didn't work ;3;"
|
||||||
@@ -294,6 +284,8 @@
|
|||||||
"Command Enabler","kittyrole","1"
|
"Command Enabler","kittyrole","1"
|
||||||
"Command Enabler","leaderboard","1"
|
"Command Enabler","leaderboard","1"
|
||||||
"Command Enabler","map","1"
|
"Command Enabler","map","1"
|
||||||
|
"Command Enabler","mod","1"
|
||||||
|
"Command Enabler","music","1"
|
||||||
"Command Enabler","perish, thenperish","1"
|
"Command Enabler","perish, thenperish","1"
|
||||||
"Command Enabler","ping","1"
|
"Command Enabler","ping","1"
|
||||||
"Command Enabler","poll","1"
|
"Command Enabler","poll","1"
|
||||||
|
|||||||
|
Can't render this file because it contains an unexpected character in line 201 and column 80.
|
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,5 @@
|
|||||||
package commands.characters;
|
package commands.characters;
|
||||||
|
|
||||||
import commands.guildrole.*;
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
import core.SubCommandFramework;
|
import core.SubCommandFramework;
|
||||||
@@ -12,7 +11,7 @@ public class CommandCharacterMain extends Command
|
|||||||
public CommandCharacterMain(KittyRole level, KittyRating rating)
|
public CommandCharacterMain(KittyRole level, KittyRating rating)
|
||||||
{
|
{
|
||||||
super(level, rating);
|
super(level, rating);
|
||||||
framework.addCommand("add", new SubCommandAdd(KittyRole.General, KittyRating.Safe));
|
framework.addCommand("create", new SubCommandCreate(KittyRole.General, KittyRating.Safe));
|
||||||
framework.addCommand("editbio", new SubCommandEditBio(KittyRole.General, KittyRating.Safe));
|
framework.addCommand("editbio", new SubCommandEditBio(KittyRole.General, KittyRating.Safe));
|
||||||
framework.addCommand("editname", new SubCommandEditName(KittyRole.General, KittyRating.Safe));
|
framework.addCommand("editname", new SubCommandEditName(KittyRole.General, KittyRating.Safe));
|
||||||
framework.addCommand("editurl", new SubCommandEditURL(KittyRole.General, KittyRating.Safe));
|
framework.addCommand("editurl", new SubCommandEditURL(KittyRole.General, KittyRating.Safe));
|
||||||
@@ -25,6 +24,6 @@ public class CommandCharacterMain extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
framework.run(guild, channel, user, input.args).Call(res);
|
framework.run(guild, channel, user, input).Call(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,20 +4,26 @@ import core.CharacterManager;
|
|||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
import core.SubCommand;
|
import core.SubCommand;
|
||||||
import core.SubCommandFormattable;
|
import core.SubCommandFormattable;
|
||||||
import dataStructures.*;
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandCreate extends SubCommand
|
public class SubCommandCreate extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandCreate(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandCreate(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
String [] info = input.split(",");
|
String [] info = input.args.split(",");
|
||||||
if(info.length < 3)
|
if(info.length < 3)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterCreateNullInfo"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterCreateNullInfo"));
|
||||||
}
|
}
|
||||||
|
//user name bio url
|
||||||
if(CharacterManager.instance.addCharacter(user, info[0], info[1], info[2]))
|
if(CharacterManager.instance.addCharacter(user, info[0], info[1], info[2]))
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterCreateSuccess"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterCreateSuccess"));
|
||||||
|
|||||||
@@ -10,26 +10,27 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandEditBio extends SubCommand
|
public class SubCommandEditBio extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandEditBio(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandEditBio(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Long.parseLong(input.split(" ")[0]);
|
Long.parseLong(input.args.split(" ")[0]);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterEditBioNotValid"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterEditBioNotValid"));
|
||||||
}
|
}
|
||||||
KittyCharacter character = CharacterManager.instance.searchCharacter(input.split(" ")[0]).get(0);
|
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
||||||
if(character.getOwner().equals(user))
|
if(character.getOwner().equals(user))
|
||||||
{
|
{
|
||||||
CharacterManager.instance.editBio(character, input.substring(input.indexOf(' ')));
|
CharacterManager.instance.editBio(character, input.args.substring(input.args.indexOf(' ')));
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterEditBioSuccess"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterEditBioSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -10,26 +10,27 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandEditName extends SubCommand
|
public class SubCommandEditName extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandEditName(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandEditName(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Long.parseLong(input.split(" ")[0]);
|
Long.parseLong(input.args.split(" ")[0]);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterEditNameNotValid"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterEditNameNotValid"));
|
||||||
}
|
}
|
||||||
KittyCharacter character = CharacterManager.instance.searchCharacter(input.split(" ")[0]).get(0);
|
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
||||||
if(character.getOwner().equals(user))
|
if(character.getOwner().equals(user))
|
||||||
{
|
{
|
||||||
CharacterManager.instance.editName(character, input.substring(input.indexOf(' ')));
|
CharacterManager.instance.editName(character, input.args.substring(input.args.indexOf(' ')));
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterEditNameSuccess"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterEditNameSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -10,26 +10,27 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandEditURL extends SubCommand
|
public class SubCommandEditURL extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandEditURL(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandEditURL(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Long.parseLong(input.split(" ")[0]);
|
Long.parseLong(input.args.split(" ")[0]);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterEditURLNotValid"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterEditURLNotValid"));
|
||||||
}
|
}
|
||||||
KittyCharacter character = CharacterManager.instance.searchCharacter(input.split(" ")[0]).get(0);
|
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
|
||||||
if(character.getOwner().equals(user))
|
if(character.getOwner().equals(user))
|
||||||
{
|
{
|
||||||
CharacterManager.instance.editRefImage(character, input.substring(input.indexOf(' ')));
|
CharacterManager.instance.editRefImage(character, input.args.substring(input.args.indexOf(' ')));
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterEditURLSuccess"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterEditURLSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -12,15 +12,16 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandSearch extends SubCommand
|
public class SubCommandSearch extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandSearch(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandSearch(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
ArrayList <KittyCharacter> characters = CharacterManager.instance.searchCharacter(input);
|
ArrayList <KittyCharacter> characters = CharacterManager.instance.searchCharacter(input.args);
|
||||||
if(characters.size() < 1)
|
if(characters.size() < 1)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (LocStrings.stub("CharacterSearchNoCharacterFound"));
|
return new SubCommandFormattable (LocStrings.stub("CharacterSearchNoCharacterFound"));
|
||||||
|
|||||||
@@ -20,11 +20,8 @@ public class CommandBlurry extends Command
|
|||||||
public String getHelpText() { return LocStrings.stub("BlurryInfo"); };
|
public String getHelpText() { return LocStrings.stub("BlurryInfo"); };
|
||||||
|
|
||||||
private static Long num = 0l;
|
private static Long num = 0l;
|
||||||
private static double [][] blur = {{0.0030, 0.0133, 0.0219, 0.0133, 0.0030},
|
private static float [] weights = {.00390625f, .0156625f, .0234475f, .0156625f, .00390625f};
|
||||||
{0.0133, 0.0596, 0.0983, 0.0596, 0.0133},
|
|
||||||
{0.0219, 0.0983, 0.1621, 0.0983, 0.0219},
|
|
||||||
{0.0133, 0.0596, 0.0983, 0.0596, 0.0133},
|
|
||||||
{0.0030, 0.0133, 0.0219, 0.0133, 0.0030}};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
@@ -58,7 +55,7 @@ public class CommandBlurry extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
preProcessed = new File(filename);
|
preProcessed = new File(filename);
|
||||||
applySnap(ImageIO.read(preProcessed), name);
|
applyBlur(ImageIO.read(preProcessed), name);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
@@ -72,51 +69,77 @@ public class CommandBlurry extends Command
|
|||||||
ImageUtils.blockingFileDelete(postProcessed);
|
ImageUtils.blockingFileDelete(postProcessed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applySnap(BufferedImage image, String name) throws IOException
|
private static void applyBlur(BufferedImage image, String name) throws IOException
|
||||||
{
|
{
|
||||||
BufferedImage blurred = ImageUtils.copyImage(image);
|
BufferedImage blurred = ImageUtils.copyImage(image);
|
||||||
// Iterate over each column left to right and touch up each pixel
|
// Iterate over each column left to right and touch up each pixel
|
||||||
for(int i = 0; i < 50; ++i)
|
for(int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
for(int x = 1; x < image.getWidth() - 1; ++x)
|
for(int x = 0; x < image.getWidth(); ++x)
|
||||||
{
|
{
|
||||||
for(int y = 1; y < image.getHeight() - 1; ++y)
|
for(int y = 0; y < image.getHeight(); ++y)
|
||||||
{
|
{
|
||||||
blurred.setRGB(x, y, getColorAvg(image, x, y).getRGB());
|
blurred.setRGB(x, y, getColorAvg(image, x, y).getRGB());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
image = ImageUtils.copyImage(blurred);
|
image = blurred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
File outputfile = new File(name);
|
File outputfile = new File(name);
|
||||||
ImageIO.write(blurred, "png", outputfile);
|
ImageIO.write(blurred, "png", outputfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Color getColorAvg(BufferedImage image, int x, int y)
|
private static Color getColorAvg(BufferedImage image, int x, int y)
|
||||||
{
|
{
|
||||||
Color center = new Color(image.getRGB(x, y), true);
|
Color current;
|
||||||
Color one = new Color(image.getRGB(x - 1, y), true);
|
float r = 0;
|
||||||
Color two = new Color(image.getRGB(x - 1, y - 1), true);
|
float g = 0;
|
||||||
Color three = new Color(image.getRGB(x, y - 1), true);
|
float b = 0;
|
||||||
Color four = new Color(image.getRGB(x + 1, y - 1), true);
|
|
||||||
Color five = new Color(image.getRGB(x + 1, y), true);
|
|
||||||
Color six = new Color(image.getRGB(x + 1, y + 1), true);
|
|
||||||
Color seven = new Color(image.getRGB(x, y + 1), true);
|
|
||||||
Color eight = new Color(image.getRGB(x -1, y + 1), true);
|
|
||||||
|
|
||||||
int blue = center.getBlue() + one.getBlue() + two.getBlue() + three.getBlue() + four.getBlue() + five.getBlue() + six.getBlue() + seven.getBlue() + eight.getBlue();
|
for(int xCor = -2; xCor <= 2; xCor++)
|
||||||
int red = center.getRed() + one.getRed() + two.getRed() + three.getRed() + four.getRed() + five.getRed() + six.getRed() + seven.getRed() + eight.getRed();
|
{
|
||||||
int green = center.getGreen() + one.getGreen() + two.getGreen() + three.getGreen() + four.getGreen() + five.getGreen() + six.getGreen() + seven.getGreen() + eight.getGreen();
|
for(int yCor = -2; yCor <= 2; yCor++)
|
||||||
int alpha = center.getAlpha() + one.getAlpha() + two.getAlpha() + three.getAlpha() + four.getAlpha() + five.getAlpha() + six.getAlpha() + seven.getAlpha() + eight.getAlpha();
|
{
|
||||||
|
int curX = clamp(x + xCor, 0, image.getWidth() - 1);
|
||||||
|
int curY = clamp(y + yCor, 0, image.getHeight() - 1);
|
||||||
|
|
||||||
|
|
||||||
|
current = new Color(image.getRGB(curX, curY));
|
||||||
|
|
||||||
|
r += getGaus(current.getRed(), xCor, yCor);
|
||||||
|
g += getGaus(current.getGreen(), xCor, yCor);
|
||||||
|
b += getGaus(current.getBlue(), xCor, yCor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int red = (int)r;
|
||||||
|
int green = (int)g;
|
||||||
|
int blue = (int)b;
|
||||||
|
return new Color(red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int clamp(int num, int min, int max)
|
||||||
|
{
|
||||||
|
if(num >= max)
|
||||||
|
return max;
|
||||||
|
if(num < min)
|
||||||
|
return min;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float getGaus(int col, int x, int y)
|
||||||
|
{
|
||||||
|
x += 2;
|
||||||
|
y+= 2;
|
||||||
|
float result = weights[x];
|
||||||
|
if(y == 2 || y == 4)
|
||||||
|
result *= 4;
|
||||||
|
if(y==3)
|
||||||
|
result *= 6;
|
||||||
|
|
||||||
blue /= 9;
|
result *= col;
|
||||||
red /= 9;
|
|
||||||
green /= 9;
|
|
||||||
alpha /= 9;
|
|
||||||
|
|
||||||
Color blur = new Color(red, green, blue, alpha);
|
return result;
|
||||||
|
}
|
||||||
return blur;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -83,13 +83,17 @@ public class CommandLeaderboard extends Command
|
|||||||
embed.title = LocStrings.stub("LeaderboardTitle");
|
embed.title = LocStrings.stub("LeaderboardTitle");
|
||||||
embed.descriptionText = "";
|
embed.descriptionText = "";
|
||||||
|
|
||||||
for(int i = 0; i < listSize && i < users.size(); ++i)
|
int indexToDisplay = 1;
|
||||||
|
for(int i = 0; indexToDisplay <= listSize && i < users.size(); ++i)
|
||||||
{
|
{
|
||||||
// Only now that we've sorted do we do the full construction and caching of users
|
// Only now that we've sorted do we do the full construction and caching of users
|
||||||
Pair<Long, String> userPair = users.get(i);
|
Pair<Long, String> userPair = users.get(i);
|
||||||
KittyUser cachedUser = ObjectBuilderFactory.getKittyUser(guildID, userPair.Second);
|
KittyUser cachedUser = ObjectBuilderFactory.getKittyUser(guildID, userPair.Second);
|
||||||
|
|
||||||
embed.descriptionText += "**" + (i + 1) + ":** " + userPair.First + " - " + cachedUser.name;
|
if(cachedUser == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
embed.descriptionText += "**" + (indexToDisplay++) + ":** " + userPair.First + " - " + cachedUser.name;
|
||||||
embed.descriptionText += "\n";
|
embed.descriptionText += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ public class CommandRoll extends Command
|
|||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
rolls = roll(first, second);
|
rolls = roll(first, second);
|
||||||
System.out.println(first);
|
|
||||||
for(int i= 0; i < first; i++)
|
for(int i= 0; i < first; i++)
|
||||||
{
|
{
|
||||||
value += rolls[i];
|
value += rolls[i];
|
||||||
@@ -177,7 +176,7 @@ public class CommandRoll extends Command
|
|||||||
int [] rolls = new int [sides];
|
int [] rolls = new int [sides];
|
||||||
|
|
||||||
if(dice < 1)
|
if(dice < 1)
|
||||||
return new int[0];
|
return new int[0];
|
||||||
for(int i = 0; dice > i; i ++)
|
for(int i = 0; dice > i; i ++)
|
||||||
{
|
{
|
||||||
roll = (int)(Math.random() * sides) + 1;
|
roll = (int)(Math.random() * sides) + 1;
|
||||||
|
|||||||
@@ -27,12 +27,9 @@ public class CommandGuildRoleMain extends Command
|
|||||||
@Override
|
@Override
|
||||||
public String getHelpText() { return LocStrings.stub("GuildRoleInfo"); }
|
public String getHelpText() { return LocStrings.stub("GuildRoleInfo"); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
framework.run(guild, channel, user, input.args).Call(res);
|
framework.run(guild, channel, user, input).Call(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package commands.guildrole;
|
package commands.guildrole;
|
||||||
|
|
||||||
|
import core.LocStrings;
|
||||||
import core.SubCommand;
|
import core.SubCommand;
|
||||||
import core.SubCommandFormattable;
|
import core.SubCommandFormattable;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
@@ -7,30 +8,38 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandAdd extends SubCommand
|
public class SubCommandAdd extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandAdd(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandAdd(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
String role = input.split(" ")[0];
|
String [] roles = input.args.split(",");
|
||||||
if(guild.roleList.contains(role))
|
String role;
|
||||||
|
String formatted = "";
|
||||||
|
for(int i = 0; i < roles.length; i++)
|
||||||
{
|
{
|
||||||
if(guild.control.addRole(user.discordID, role))
|
role = roles[i].trim();
|
||||||
|
if(guild.roleList.contains(role))
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable("ADDED RIN YOU NEED TO FIX THIS");
|
if(guild.control.addRole(user.discordID, role))
|
||||||
|
{
|
||||||
|
formatted += String.format(LocStrings.stub("GuildRoleAddSuccess"), role, user.name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
formatted += String.format(LocStrings.stub("GuildRoleAddFailure"), role, user.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable("FAILED RIN YOU NEED TO FIX THIS TOO");
|
formatted += String.format(LocStrings.stub("GuildRoleAddNotAllowed"), role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
return new SubCommandFormattable(formatted);
|
||||||
{
|
|
||||||
return new SubCommandFormattable("NOT ALLOWED FIX THIS ONE TOO SNEP FACE");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,15 +8,16 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandAllowed extends SubCommand
|
public class SubCommandAllowed extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
String [] roles = input.split(",");
|
String [] roles = input.args.split(",");
|
||||||
String role;
|
String role;
|
||||||
String formatted = "";
|
String formatted = "";
|
||||||
for(int i = 0; i < roles.length; i++)
|
for(int i = 0; i < roles.length; i++)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandList extends SubCommand
|
public class SubCommandList extends SubCommand
|
||||||
{
|
{
|
||||||
@@ -15,10 +16,10 @@ public class SubCommandList extends SubCommand
|
|||||||
public SubCommandList(KittyRole level, KittyRating rating) { super(level, rating);}
|
public SubCommandList(KittyRole level, KittyRating rating) { super(level, rating);}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
String roles = "";
|
String roles = "";
|
||||||
if(guild.roleList.isEmpty())
|
if(guild.roleList.size() < 2)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable(String.format(LocStrings.stub("GuildRoleListEmpty")));
|
return new SubCommandFormattable(String.format(LocStrings.stub("GuildRoleListEmpty")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,28 +8,36 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandNotAllowed extends SubCommand
|
public class SubCommandNotAllowed extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandNotAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandNotAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
input = input.toLowerCase();
|
String lowerInput = input.args.toLowerCase();
|
||||||
String [] roles = input.split(",");
|
String [] roles = lowerInput.split(",");
|
||||||
|
String formatted = "";
|
||||||
|
|
||||||
|
if(roles.length < 1)
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable(String.format(LocStrings.stub("GuildRoleNotAllowedNoArgs")));
|
||||||
|
}
|
||||||
|
|
||||||
for(String role:roles)
|
for(String role:roles)
|
||||||
{
|
{
|
||||||
if(guild.roleList.contains(role.trim()))
|
if(guild.roleList.contains(role.trim()))
|
||||||
{
|
{
|
||||||
guild.roleList.remove(role);
|
guild.roleList.remove(role);
|
||||||
return new SubCommandFormattable(LocStrings.stub("GuildRoleNotAllowedSuccess"));
|
formatted += String.format(LocStrings.stub("GuildRoleNotAllowedSuccess"), role);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable(String.format(LocStrings.stub("GuildRoleNotAllowedFailure"), role));
|
formatted += String.format(LocStrings.stub("GuildRoleNotAllowedFailure"), role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new SubCommandFormattable(String.format(LocStrings.stub("GuildRoleNotAllowedNoArgs")));
|
return new SubCommandFormattable(formatted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,9 +10,9 @@ public class SubCommandRemove extends SubCommand
|
|||||||
public SubCommandRemove(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandRemove(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
String role = input.split(" ")[0];
|
String role = input.args.split(" ")[0];
|
||||||
String formatted = "";
|
String formatted = "";
|
||||||
if(guild.roleList.contains(role))
|
if(guild.roleList.contains(role))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package commands.mod;
|
||||||
|
|
||||||
|
import core.Command;
|
||||||
|
import core.LocStrings;
|
||||||
|
import core.SubCommandFramework;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.Response;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class CommandModMain extends Command
|
||||||
|
{
|
||||||
|
SubCommandFramework framework = new SubCommandFramework();
|
||||||
|
public CommandModMain(KittyRole level, KittyRating rating)
|
||||||
|
{
|
||||||
|
super(level, rating);
|
||||||
|
framework.addCommand("kick", new SubCommandKick(KittyRole.Admin, KittyRating.Safe));
|
||||||
|
framework.addCommand("mute", new SubCommandMute(KittyRole.Admin, KittyRating.Safe));
|
||||||
|
framework.addCommand("ban", new SubCommandBan(KittyRole.Admin, KittyRating.Safe));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHelpText() { return LocStrings.stub("ModInfo"); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
|
{
|
||||||
|
framework.run(guild, channel, user, input).Call(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package commands.mod;
|
||||||
|
|
||||||
|
import core.SubCommand;
|
||||||
|
import core.SubCommandFormattable;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class SubCommandBan extends SubCommand
|
||||||
|
{
|
||||||
|
public SubCommandBan(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable(guild.control.banMember(input.mentions[0].discordID) + " ");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package commands.mod;
|
||||||
|
|
||||||
|
import core.SubCommand;
|
||||||
|
import core.SubCommandFormattable;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class SubCommandKick extends SubCommand
|
||||||
|
{
|
||||||
|
public SubCommandKick(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
|
{
|
||||||
|
if(guild.control.kickMember(input.mentions[0].discordID))
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable("Success");
|
||||||
|
}
|
||||||
|
return new SubCommandFormattable("Fail");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package commands.mod;
|
||||||
|
|
||||||
|
import core.SubCommand;
|
||||||
|
import core.SubCommandFormattable;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class SubCommandMute extends SubCommand
|
||||||
|
{
|
||||||
|
public SubCommandMute(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable("" + guild.control.muteMember(input.mentions[0].avatarID));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package commands.music;
|
||||||
|
|
||||||
|
import core.Command;
|
||||||
|
import core.LocStrings;
|
||||||
|
import core.SubCommandFramework;
|
||||||
|
import dataStructures.*;
|
||||||
|
|
||||||
|
public class CommandMusicMain extends Command
|
||||||
|
{
|
||||||
|
SubCommandFramework framework = new SubCommandFramework();
|
||||||
|
public CommandMusicMain(KittyRole level, KittyRating rating)
|
||||||
|
{
|
||||||
|
super(level, rating);
|
||||||
|
framework.addCommand("join", new SubCommandJoin(KittyRole.General, KittyRating.Safe));
|
||||||
|
framework.addCommand("leave", new SubCommandLeave(KittyRole.General, KittyRating.Safe));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHelpText() { return LocStrings.stub("MusicInfo"); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
|
{
|
||||||
|
framework.run(guild, channel, user, input).Call(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package commands.music;
|
||||||
|
|
||||||
|
import com.google.api.services.youtube.YouTube;
|
||||||
|
|
||||||
|
import core.SubCommand;
|
||||||
|
import core.SubCommandFormattable;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class SubCommandAddTrack extends SubCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
public SubCommandAddTrack(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
|
{
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package commands.music;
|
||||||
|
|
||||||
|
import core.SubCommand;
|
||||||
|
import core.SubCommandFormattable;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class SubCommandJoin extends SubCommand
|
||||||
|
{
|
||||||
|
public SubCommandJoin(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable("" + guild.audio.joinChannel(input.args));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package commands.music;
|
||||||
|
|
||||||
|
import core.SubCommand;
|
||||||
|
import core.SubCommandFormattable;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class SubCommandLeave extends SubCommand
|
||||||
|
{
|
||||||
|
public SubCommandLeave(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable("" + guild.audio.leaveChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,6 @@ public class CommandPollMain extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
framework.run(guild, channel, user, input.args).Call(res);
|
framework.run(guild, channel, user, input).Call(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,17 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandAddOption extends SubCommand
|
public class SubCommandAddOption extends SubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
public SubCommandAddOption(KittyRole roleLevel, KittyRating contentRating) {super(roleLevel, contentRating); }
|
public SubCommandAddOption(KittyRole roleLevel, KittyRating contentRating) {super(roleLevel, contentRating);}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (guild.addChoiceToPoll(input));
|
return new SubCommandFormattable (guild.addChoiceToPoll(input.args));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandEnd extends SubCommand
|
public class SubCommandEnd extends SubCommand
|
||||||
{
|
{
|
||||||
@@ -14,7 +15,7 @@ public class SubCommandEnd extends SubCommand
|
|||||||
public SubCommandEnd(KittyRole roleLevel, KittyRating contentRating) {super(roleLevel, contentRating); }
|
public SubCommandEnd(KittyRole roleLevel, KittyRating contentRating) {super(roleLevel, contentRating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (guild.endPoll());
|
return new SubCommandFormattable (guild.endPoll());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class SubCommandResults extends SubCommand
|
|||||||
public SubCommandResults(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandResults(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
String results = "";
|
String results = "";
|
||||||
int totalVotes = 0;
|
int totalVotes = 0;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandShow extends SubCommand
|
public class SubCommandShow extends SubCommand
|
||||||
{
|
{
|
||||||
@@ -15,7 +16,7 @@ public class SubCommandShow extends SubCommand
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
if(!guild.polling)
|
if(!guild.polling)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandStart extends SubCommand
|
public class SubCommandStart extends SubCommand
|
||||||
{
|
{
|
||||||
@@ -14,9 +15,9 @@ public class SubCommandStart extends SubCommand
|
|||||||
public SubCommandStart(KittyRole roleLevel, KittyRating contentRating) {super(roleLevel, contentRating); }
|
public SubCommandStart(KittyRole roleLevel, KittyRating contentRating) {super(roleLevel, contentRating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (guild.startPoll(input));
|
return new SubCommandFormattable (guild.startPoll(input.args));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,13 +9,14 @@ import dataStructures.KittyPoll;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandVote extends SubCommand
|
public class SubCommandVote extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandVote(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandVote(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
if(guild.polling)
|
if(guild.polling)
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,7 @@ public class SubCommandVote extends SubCommand
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int voteNum = Integer.parseInt(input.substring(input.indexOf(" ")).trim())-1;
|
int voteNum = Integer.parseInt(input.args.substring(input.args.indexOf(" ")).trim())-1;
|
||||||
if(voteNum >= guild.choices.size() || voteNum < 0)
|
if(voteNum >= guild.choices.size() || voteNum < 0)
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (String.format(LocStrings.stub("PollVoteNotValidVote"), voteNum));
|
return new SubCommandFormattable (String.format(LocStrings.stub("PollVoteNotValidVote"), voteNum));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package commands.raffle;
|
package commands.raffle;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
|
import core.LocStrings;
|
||||||
import core.SubCommandFramework;
|
import core.SubCommandFramework;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
|
|
||||||
@@ -16,9 +17,12 @@ public class CommandRaffleMain extends Command
|
|||||||
framework.addCommand("join", new SubCommandJoin(KittyRole.General, KittyRating.Safe));
|
framework.addCommand("join", new SubCommandJoin(KittyRole.General, KittyRating.Safe));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHelpText() { return LocStrings.stub("RaffleInfo"); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
framework.run(guild, channel, user, input.args).Call(res);
|
framework.run(guild, channel, user, input).Call(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,13 +8,14 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandEnd extends SubCommand
|
public class SubCommandEnd extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandEnd(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandEnd(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
if(guild.endRaffle())
|
if(guild.endRaffle())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,14 +3,19 @@ package commands.raffle;
|
|||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
import core.SubCommand;
|
import core.SubCommand;
|
||||||
import core.SubCommandFormattable;
|
import core.SubCommandFormattable;
|
||||||
import dataStructures.*;
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandJoin extends SubCommand
|
public class SubCommandJoin extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandJoin(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandJoin(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
if(guild.joinRaffle(user))
|
if(guild.joinRaffle(user))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ import dataStructures.KittyGuild;
|
|||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandSpin extends SubCommand
|
public class SubCommandSpin extends SubCommand
|
||||||
{
|
{
|
||||||
public SubCommandSpin(KittyRole level, KittyRating rating) { super(level, rating); }
|
public SubCommandSpin(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ package commands.raffle;
|
|||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
import core.SubCommand;
|
import core.SubCommand;
|
||||||
import core.SubCommandFormattable;
|
import core.SubCommandFormattable;
|
||||||
import dataStructures.*;
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandStart extends SubCommand
|
public class SubCommandStart extends SubCommand
|
||||||
{
|
{
|
||||||
@@ -12,11 +17,11 @@ public class SubCommandStart extends SubCommand
|
|||||||
public int beanCost;
|
public int beanCost;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
beanCost = Integer.parseInt(input);
|
beanCost = Integer.parseInt(input.args);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
@@ -29,7 +34,7 @@ public class SubCommandStart extends SubCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new SubCommandFormattable (LocStrings.stub("RaffleStartFailure"));
|
return new SubCommandFormattable (String.format(LocStrings.stub("RaffleStartFailure"), beanCost));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ import commands.general.CommandTweet;
|
|||||||
import commands.general.CommandWolfram;
|
import commands.general.CommandWolfram;
|
||||||
import commands.general.CommandYeet;
|
import commands.general.CommandYeet;
|
||||||
import commands.guildrole.CommandGuildRoleMain;
|
import commands.guildrole.CommandGuildRoleMain;
|
||||||
|
import commands.mod.CommandModMain;
|
||||||
|
import commands.music.CommandMusicMain;
|
||||||
import commands.poll.CommandPollMain;
|
import commands.poll.CommandPollMain;
|
||||||
import commands.raffle.CommandRaffleMain;
|
import commands.raffle.CommandRaffleMain;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
@@ -115,6 +117,7 @@ public class CommandManager
|
|||||||
// Mod
|
// Mod
|
||||||
this.register(LocCommands.stub("givebeans"), new CommandGiveBeans(KittyRole.Mod, KittyRating.Safe));
|
this.register(LocCommands.stub("givebeans"), new CommandGiveBeans(KittyRole.Mod, KittyRating.Safe));
|
||||||
this.register(LocCommands.stub("rpg"), new CommandRPG(KittyRole.Mod, KittyRating.Safe));
|
this.register(LocCommands.stub("rpg"), new CommandRPG(KittyRole.Mod, KittyRating.Safe));
|
||||||
|
this.register(LocCommands.stub("mod"), new CommandModMain(KittyRole.Mod, KittyRating.Safe));
|
||||||
|
|
||||||
// General
|
// General
|
||||||
this.register(LocCommands.stub("fetch"), new CommandFetch(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("fetch"), new CommandFetch(KittyRole.General, KittyRating.Safe));
|
||||||
@@ -150,7 +153,7 @@ public class CommandManager
|
|||||||
this.register(LocCommands.stub("character"), new CommandCharacterMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("character"), new CommandCharacterMain(KittyRole.General, KittyRating.Safe));
|
||||||
this.register(LocCommands.stub("raffle"), new CommandRaffleMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("raffle"), new CommandRaffleMain(KittyRole.General, KittyRating.Safe));
|
||||||
this.register(LocCommands.stub("poll"), new CommandPollMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("poll"), new CommandPollMain(KittyRole.General, KittyRating.Safe));
|
||||||
|
this.register(LocCommands.stub("music"), new CommandMusicMain(KittyRole.General, KittyRating.Safe));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allows the command manager to keep track of a command. Takes a pair (the un-localized and localzied commands)
|
// Allows the command manager to keep track of a command. Takes a pair (the un-localized and localzied commands)
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import java.util.concurrent.Semaphore;
|
|||||||
|
|
||||||
import javax.security.auth.login.LoginException;
|
import javax.security.auth.login.LoginException;
|
||||||
|
|
||||||
|
//import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||||
|
//import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
||||||
|
|
||||||
import core.lua.PluginManager;
|
import core.lua.PluginManager;
|
||||||
import dataStructures.*;
|
import dataStructures.*;
|
||||||
import main.Main;
|
import main.Main;
|
||||||
@@ -17,6 +20,7 @@ import net.dv8tion.jda.core.entities.*;
|
|||||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||||
import offline.Ref;
|
import offline.Ref;
|
||||||
import utils.AdminControl;
|
import utils.AdminControl;
|
||||||
|
//import utils.AudioUtils;
|
||||||
import utils.GlobalLog;
|
import utils.GlobalLog;
|
||||||
import utils.LogFilter;
|
import utils.LogFilter;
|
||||||
|
|
||||||
@@ -50,6 +54,9 @@ public class ObjectBuilderFactory
|
|||||||
// Command manager
|
// Command manager
|
||||||
private static CommandManager commandManager;
|
private static CommandManager commandManager;
|
||||||
|
|
||||||
|
//Audio track manager
|
||||||
|
// private static AudioPlayerManager audioPlayer = new DefaultAudioPlayerManager();
|
||||||
|
|
||||||
// Localization classes - these are singletons, but should be initialized before almost all other
|
// Localization classes - these are singletons, but should be initialized before almost all other
|
||||||
// things so their inclusion in the factory is to ensure they're started at the correct time.
|
// things so their inclusion in the factory is to ensure they're started at the correct time.
|
||||||
@SuppressWarnings("unused") private static LocStrings locStrings;
|
@SuppressWarnings("unused") private static LocStrings locStrings;
|
||||||
@@ -319,8 +326,13 @@ public class ObjectBuilderFactory
|
|||||||
if(user == null)
|
if(user == null)
|
||||||
{
|
{
|
||||||
Guild jdaGuild = kitty.getGuildById(guildID);
|
Guild jdaGuild = kitty.getGuildById(guildID);
|
||||||
|
if(jdaGuild == null) return null;
|
||||||
|
|
||||||
Member jdaMember = jdaGuild.getMemberById(userID);
|
Member jdaMember = jdaGuild.getMemberById(userID);
|
||||||
|
if(jdaMember == null) return null;
|
||||||
|
|
||||||
User jdaUser = jdaMember.getUser();
|
User jdaUser = jdaMember.getUser();
|
||||||
|
if(jdaUser == null) return null;
|
||||||
|
|
||||||
user = extractUserByJDAUser(guildID, jdaMember.getNickname(), jdaUser.getId(), jdaUser.getAvatarUrl(), jdaUser.getId());
|
user = extractUserByJDAUser(guildID, jdaMember.getNickname(), jdaUser.getId(), jdaUser.getAvatarUrl(), jdaUser.getId());
|
||||||
updateUser(user, jdaMember);
|
updateUser(user, jdaMember);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public abstract class SubCommand
|
|||||||
|
|
||||||
// Called by the Command manager - this will run the command
|
// Called by the Command manager - this will run the command
|
||||||
// if the issuing user has the permission to do so!
|
// if the issuing user has the permission to do so!
|
||||||
protected final SubCommandFormattable Invoke(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
protected final SubCommandFormattable Invoke(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
if(!CanCall(guild, channel, user))
|
if(!CanCall(guild, channel, user))
|
||||||
return null;
|
return null;
|
||||||
@@ -60,5 +60,5 @@ public abstract class SubCommand
|
|||||||
return roleLevel;
|
return roleLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input);
|
public abstract SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input);
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyUser;
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
import utils.GlobalLog;
|
import utils.GlobalLog;
|
||||||
|
|
||||||
public class SubCommandFramework
|
public class SubCommandFramework
|
||||||
@@ -25,18 +26,25 @@ public class SubCommandFramework
|
|||||||
GlobalLog.log("Registered SubCommand " + name);
|
GlobalLog.log("Registered SubCommand " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubCommandFormattable run(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
public SubCommandFormattable run(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
SubCommandFormattable res = null;
|
SubCommand res = commands.get(input.args.split(" ")[0].toLowerCase());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
res = commands.get(input.split(" ")[0].toLowerCase()).Invoke(guild, channel, user, input.substring(input.indexOf(" ")));
|
input.args = input.args.substring(input.args.indexOf(' ')).trim();
|
||||||
|
}
|
||||||
|
catch(Exception e){}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return res.Invoke(guild, channel, user, input);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
res = commands.get(input.split(" ")[0].toLowerCase()).Invoke(guild, channel, user, "");
|
String help = Stats.instance.getHelpText(input.key);
|
||||||
|
if(help != null)
|
||||||
|
return new SubCommandFormattable(help);
|
||||||
|
return new SubCommandFormattable("Something has gone very wrong.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|||||||
import core.DatabaseManager;
|
import core.DatabaseManager;
|
||||||
import core.DatabaseTrackedObject;
|
import core.DatabaseTrackedObject;
|
||||||
import utils.AdminControl;
|
import utils.AdminControl;
|
||||||
|
import utils.AudioUtils;
|
||||||
|
|
||||||
// Context for a given guild for kittybot. Primarily designed to hold guild-specific settings.
|
// Context for a given guild for kittybot. Primarily designed to hold guild-specific settings.
|
||||||
public class KittyGuild extends DatabaseTrackedObject
|
public class KittyGuild extends DatabaseTrackedObject
|
||||||
@@ -21,6 +22,7 @@ public class KittyGuild extends DatabaseTrackedObject
|
|||||||
public ArrayList<String> emoji = new ArrayList<String>();
|
public ArrayList<String> emoji = new ArrayList<String>();
|
||||||
public ArrayList <KittyPoll> choices = new ArrayList<KittyPoll>();
|
public ArrayList <KittyPoll> choices = new ArrayList<KittyPoll>();
|
||||||
public AdminControl control;
|
public AdminControl control;
|
||||||
|
public AudioUtils audio;
|
||||||
public ArrayList <KittyUser> raffleUsersUnchosen = new ArrayList<KittyUser>();
|
public ArrayList <KittyUser> raffleUsersUnchosen = new ArrayList<KittyUser>();
|
||||||
public ArrayList <KittyUser> raffleUsersChosen = new ArrayList<KittyUser>();
|
public ArrayList <KittyUser> raffleUsersChosen = new ArrayList<KittyUser>();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package network;
|
||||||
|
|
||||||
|
import com.google.api.services.youtube.YouTube;
|
||||||
|
|
||||||
|
import offline.Ref;
|
||||||
|
|
||||||
|
public class NetworkYoutube
|
||||||
|
{
|
||||||
|
private static YouTube youtube;
|
||||||
|
|
||||||
|
public NetworkYoutube()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,4 +39,43 @@ public class AdminControl
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean kickMember(String memberID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
guildCon.kick(guild.getMemberById(memberID)).complete();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean muteMember(String memberID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
guildCon.setMute(guild.getMemberById(memberID), true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean banMember(String memberID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
guildCon.ban(guild.getMemberById(memberID), 0).complete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package utils;
|
||||||
|
/***
|
||||||
|
* https://developers.google.com/youtube/v3/code_samples/code_snippets?apix_params=%7B%22part%22%3A%22snippet%22%2C%22maxResults%22%3A25%2C%22q%22%3A%22surfing%22%7D
|
||||||
|
* https://github.com/sedmelluq/LavaPlayer#jda-integration
|
||||||
|
* https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/core/entities/VoiceChannel.html
|
||||||
|
* https://developers.google.com/youtube/registering_an_application#Create_API_Keys
|
||||||
|
*/
|
||||||
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
|
import net.dv8tion.jda.core.entities.VoiceChannel;
|
||||||
|
import net.dv8tion.jda.core.managers.AudioManager;
|
||||||
|
|
||||||
|
public class AudioUtils
|
||||||
|
{
|
||||||
|
private Guild guild;
|
||||||
|
AudioManager audio;
|
||||||
|
AudioPlayer player;
|
||||||
|
|
||||||
|
|
||||||
|
public AudioUtils(Guild guild)
|
||||||
|
{
|
||||||
|
this.guild = guild;
|
||||||
|
audio = guild.getAudioManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean joinChannel(String channelName)
|
||||||
|
{
|
||||||
|
VoiceChannel channel = null;
|
||||||
|
channel = guild.getVoiceChannelsByName(channelName, true).get(0);
|
||||||
|
if(channel != null)
|
||||||
|
{
|
||||||
|
audio.openAudioConnection(channel);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean leaveChannel()
|
||||||
|
{
|
||||||
|
if(audio.isConnected())
|
||||||
|
{
|
||||||
|
audio.closeAudioConnection();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user