+ Added poll results, poll show, poll vote, rating, role

This commit is contained in:
Matthew Cech
2019-04-06 23:41:06 -07:00
parent e5a40ae329
commit 52afd92db1
6 changed files with 53 additions and 22 deletions
+29
View File
@@ -40,6 +40,19 @@ Sorry, you didn't win, try again! =
Allows you to bet your beans, set your amount after the command! Warning! House always wins!\nSets of 3 will get 5x, 4 will get 10x, and 5 will get 1000x = Allows you to bet your beans, set your amount after the command! Warning! House always wins!\nSets of 3 will get 5x, 4 will get 10x, and 5 will get 1000x =
You don't have enough beans! = You don't have enough beans! =
[CommandRole]
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. =
Changed %s to role `%s`! =
You aren't allowed to do that! You must have the KittyRole '%' or higher! =
Please enter `general`, `mod`, or `admin`! =
Your role is =
[CommandPollShow]
There is no poll running! =
And the choices are:\n =
Will show the current poll running =
The current poll is `%s`\n =
[CommandPing] [CommandPing]
Pong! = Pong! =
Will respond with Pong! = Will respond with Pong! =
@@ -55,6 +68,18 @@ Indicator changed to `%s` =
commands = commands =
Emit help for all commands as formatted HTML = Emit help for all commands as formatted HTML =
[CommandPollVote]
You successfully voted for =
You already voted =
That's not a vaild number! =
%s That's not a vaild vote! =
Vote in a poll with the choice number, won't work if no poll is running, you can't change your vote once you have cast it! Be careful! =
[CommandRating]
Kittybot content set to =
Warning: NSFW may slip through, images are only based on tags on their respective sites! =
Invalid content rating =
[CommandInfo] [CommandInfo]
I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https = //www.rinsnowmew.com/bot/ = I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https = //www.rinsnowmew.com/bot/ =
I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https://www.rinsnowmew.com/bot/ = I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https://www.rinsnowmew.com/bot/ =
@@ -75,6 +100,10 @@ I finished with my work! = D =
I finished with my work! :D = I finished with my work! :D =
Occupies a core for a few seconds = Occupies a core for a few seconds =
[CommandPollResults]
Will show current results of a poll and percentages of votes per choice =
%s people voted for %s `%s` with `%s%` !\n =
[CommandBoop] [CommandBoop]
%s booped %s! = %s booped %s! =
Woah! %s booped me! That's %s total! = Woah! %s booped me! That's %s total! =
+2 -3
View File
@@ -10,7 +10,7 @@ public class CommandPollResults extends Command
public CommandPollResults(KittyRole level, KittyRating rating) { super(level, rating); } public CommandPollResults(KittyRole level, KittyRating rating) { super(level, rating); }
@Override @Override
public String HelpText() { return "Will show current results of a poll and percentages of votes per choice"; } public String HelpText() { return Localizer.Stub("Will show current results of a poll and percentages of votes per choice"); }
@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)
@@ -26,8 +26,7 @@ public class CommandPollResults extends Command
for(int i = 0; i < votes.size(); i++) for(int i = 0; i < votes.size(); i++)
{ {
results += String.format(Localizer.Stub("%s people voted for %s `%s` with `%s%` !\n "), votes.get(i).votes, votes.get(i).choice, (int)(((double)votes.get(i).votes) / ((double)totalVotes) * 100));
results += votes.get(i).votes + " people voted for `" + votes.get(i).choice + "` with `" + (int)(((double)votes.get(i).votes) / ((double)totalVotes) * 100) + "%`!\n";
} }
res.Call(results); res.Call(results);
+4 -4
View File
@@ -8,18 +8,18 @@ public class CommandPollShow extends Command
public CommandPollShow(KittyRole level, KittyRating rating) { super(level, rating); } public CommandPollShow(KittyRole level, KittyRating rating) { super(level, rating); }
@Override @Override
public String HelpText() { return "Will show the current poll running"; } public String HelpText() { return Localizer.Stub("Will show the current poll running"); }
@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)
{ {
if(!guild.polling) if(!guild.polling)
{ {
res.Call("There is no poll running!"); res.Call(Localizer.Stub("There is no poll running!"));
return; return;
} }
String poll = "The current poll is `" + guild.poll + "`\n"; String poll = String.format(Localizer.Stub("The current poll is `%s`\n"), guild.poll);
poll += "And the choices are:\n"; poll += Localizer.Stub("And the choices are:\n");
for(int i = 0; i < guild.choices.size(); i++) for(int i = 0; i < guild.choices.size(); i++)
{ {
poll += (i+1) + ": `" + guild.choices.get(i).choice + "`\n"; poll += (i+1) + ": `" + guild.choices.get(i).choice + "`\n";
+7 -6
View File
@@ -8,7 +8,7 @@ public class CommandPollVote extends Command
public CommandPollVote(KittyRole level, KittyRating rating) { super(level, rating); } public CommandPollVote(KittyRole level, KittyRating rating) { super(level, rating); }
@Override @Override
public String HelpText() { return "Vote in a poll with the choice number, won't work if no poll is running, you can't change your vote once you have cast it! Be careful!"; } public String HelpText() { return Localizer.Stub("Vote in a poll with the choice number, won't work if no poll is running, you can't change your vote once you have cast it! Be careful!"); }
@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)
@@ -17,7 +17,7 @@ public class CommandPollVote extends Command
{ {
if(guild.hasVoted.contains(user.uniqueID)) if(guild.hasVoted.contains(user.uniqueID))
{ {
res.Call("You already voted"); res.Call(Localizer.Stub("You already voted"));
return; return;
} }
try try
@@ -25,21 +25,22 @@ public class CommandPollVote extends Command
int voteNum = Integer.parseInt(input.args)-1; int voteNum = Integer.parseInt(input.args)-1;
if(voteNum >= guild.choices.size() || voteNum < 0) if(voteNum >= guild.choices.size() || voteNum < 0)
{ {
res.Call(voteNum + " That's not a vaild vote!"); res.Call(String.format(Localizer.Stub("%s That's not a vaild vote!"), voteNum));
return; return;
} }
KittyPoll polled = guild.choices.get(voteNum); KittyPoll polled = guild.choices.get(voteNum);
polled.votes++; polled.votes++;
guild.hasVoted.add(user.uniqueID); guild.hasVoted.add(user.uniqueID);
res.Call("You successfully voted for `" + polled.choice + "`!"); res.Call(Localizer.Stub("You successfully voted for") + " `" + polled.choice + "`!");
return; return;
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
res.Call("That's not a vaild number!"); res.Call(Localizer.Stub("That's not a vaild number!"));
return; return;
} }
} }
res.Call("There is no poll running!"); res.Call(Localizer.Stub("There is no poll running!"));
} }
} }
+5 -4
View File
@@ -1,6 +1,7 @@
package commands; package commands;
import core.Command; import core.Command;
import core.Localizer;
import dataStructures.KittyChannel; import dataStructures.KittyChannel;
import dataStructures.KittyGuild; import dataStructures.KittyGuild;
import dataStructures.KittyRating; import dataStructures.KittyRating;
@@ -14,7 +15,7 @@ public class CommandRating extends Command
public CommandRating(KittyRole level, KittyRating rating) { super(level, rating); } public CommandRating(KittyRole level, KittyRating rating) { super(level, rating); }
@Override @Override
public String HelpText() { return "'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."; } public String HelpText() { return Localizer.Stub("'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."); }
// Called when the command is run! // Called when the command is run!
@Override @Override
@@ -54,11 +55,11 @@ public class CommandRating extends Command
} }
if(newRating != null) if(newRating != null)
res.Call("Kittybot content set to " + newRating); res.Call(Localizer.Stub("Kittybot content set to") + " " + newRating);
else else
res.Call("Invalid content rating `" + input.args + "`"); res.Call(Localizer.Stub("Invalid content rating") + " `" + input.args + "`");
if(newRating.equals("Filtered")) if(newRating.equals("Filtered"))
res.Call("Warning: NSFW may slip through, images are only based on tags on their respective sites!"); res.Call(Localizer.Stub("Warning: NSFW may slip through, images are only based on tags on their respective sites!"));
} }
} }
+6 -5
View File
@@ -1,6 +1,7 @@
package commands; package commands;
import core.Command; import core.Command;
import core.Localizer;
import dataStructures.*; import dataStructures.*;
public class CommandRole extends Command public class CommandRole extends Command
@@ -8,20 +9,20 @@ public class CommandRole extends Command
public CommandRole (KittyRole level, KittyRating rating) { super(level, rating); } public CommandRole (KittyRole level, KittyRating rating) { super(level, rating); }
@Override @Override
public String HelpText() { return "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."; } public String HelpText() { return Localizer.Stub("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."); }
@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)
{ {
if(input.args.isEmpty()) if(input.args.isEmpty())
{ {
res.Call("Your role is " + user.GetRole().name() + "!"); res.Call(Localizer.Stub("Your role is") + " " + user.GetRole().name() + "!");
return; return;
} }
if(user.GetRole().getValue() < KittyRole.Admin.getValue()) if(user.GetRole().getValue() < KittyRole.Admin.getValue())
{ {
res.Call("You aren't allowed to do that! You must have the KittyRole '" + KittyRole.Admin.toString() + "' or higher!"); res.Call(String.format(Localizer.Stub("You aren't allowed to do that! You must have the KittyRole '%' or higher!"), KittyRole.Admin.toString()));
return; return;
} }
@@ -45,7 +46,7 @@ public class CommandRole extends Command
break; break;
default: default:
res.Call("Please enter `general`, `mod`, or `admin`!"); res.Call(Localizer.Stub("Please enter `general`, `mod`, or `admin`!"));
return; return;
} }
String users = ""; String users = "";
@@ -55,6 +56,6 @@ public class CommandRole extends Command
users += input.mentions[i].name + " "; users += input.mentions[i].name + " ";
} }
res.Call("Changed " + users + " to role `" + newRole.name() + "`!"); res.Call(String.format(Localizer.Stub("Changed %s to role `%s`!"), users, newRole.name()));
} }
} }