Skip to content

Commit

Permalink
Merge pull request #191 from beanbeanjuice/integration
Browse files Browse the repository at this point in the history
Ready for Release v2.3.0
  • Loading branch information
beanbeanjuice committed May 24, 2021
2 parents cb83b06 + 24f2c31 commit 200042d
Show file tree
Hide file tree
Showing 53 changed files with 1,691 additions and 78 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ As you can see, this was shown using the command `!!help order`. It shows each p
* `get-birthday` - Get yours or someone else's birthday!
* `set-birthday` - Set your birthday! (YYYY-MM-DD)
* `counting-statistics` - Get counting information for your server!
##### 4. **INTERACTION**
##### 4. **GAMES**
* `8-ball` - Ask a yes or no question!
* `coin-flip` - Flip a coin!
* `dice-roll` - Roll a dice!
* `tic-tac-toe` - Play tic tac toe with someone!
* `connect-four` - Play connect four with someone!
##### 5. **INTERACTION**
* `hug` - Hug someone!
* `punch` - Punch someone!
* `kiss` - Kiss someone!
Expand All @@ -174,7 +180,7 @@ As you can see, this was shown using the command `!!help order`. It shows each p
* `dance` - Dance with someone!
* `dab` - Dab at someone!
* `bonk` - Bonk someone! Send them to `h o r n i` jail.
##### 5. **MUSIC**
##### 6. **MUSIC**
* `play` - Play a song or playlist!
* `now-playing` - Show the current song playing.
* `pause` - Pause the current song.
Expand All @@ -183,13 +189,13 @@ As you can see, this was shown using the command `!!help order`. It shows each p
* `shuffle` - Shuffle the current playlist.
* `skip` - Skip the current song.
* `stop` - Stop the queue and make the bot leave the channel.
##### 6. **TWITCH**
##### 7. **TWITCH**
* `set-live-channel` - Set the current channel to receive twitch live notifications. You need to add twitch channels for this to work.
* `add-twitch-channel` - Add a twitch channel to leave bot notifications for.
* `remove-twitch-channel` - Remove a twitch channel you are currently receiving notifications for.
* `get-twitch-channels` - Get a list of the twitch channels you are currently receiving notifications for.
* `set-live-notifications-role` - Set the role to be mentioned when someone goes live.
##### 7. **MODERATION**
##### 8. **MODERATION**
* `set-moderator-role` - Set the moderator role for the server. This is needed so that users with this role can run commands that require a moderator role.
* `set-muted-role` - Set the muted role for the server. This is needed so that users with this role can be stopped from talking in channels. This requires you to set it this way in each channel. This will not mute them if the role does not have the right permissions.
* `change-prefix` - Change the prefix from the bot to your desired prefix.
Expand Down
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ task buildWithDependencies(type: Jar) {

group 'com.beanbeanjuice'
mainClassName = 'com.beanbeanjuice.main.CafeBot'
version 'v2.2.1'
version 'v2.3.0'

repositories {

Expand Down Expand Up @@ -82,4 +82,7 @@ dependencies {

test {
useJUnitPlatform()
}
}

compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.beanbeanjuice.command.cafe;

import com.beanbeanjuice.main.CafeBot;
import com.beanbeanjuice.utility.cafe.object.CafeCustomer;
import com.beanbeanjuice.utility.sections.cafe.object.CafeCustomer;
import com.beanbeanjuice.utility.command.CommandContext;
import com.beanbeanjuice.utility.command.ICommand;
import com.beanbeanjuice.utility.command.usage.Usage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.beanbeanjuice.command.cafe;

import com.beanbeanjuice.main.CafeBot;
import com.beanbeanjuice.utility.cafe.object.MenuItem;
import com.beanbeanjuice.utility.sections.cafe.object.MenuItem;
import com.beanbeanjuice.utility.command.CommandContext;
import com.beanbeanjuice.utility.command.ICommand;
import com.beanbeanjuice.utility.command.usage.Usage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.beanbeanjuice.command.cafe;

import com.beanbeanjuice.main.CafeBot;
import com.beanbeanjuice.utility.cafe.object.CafeCustomer;
import com.beanbeanjuice.utility.cafe.object.MenuItem;
import com.beanbeanjuice.utility.sections.cafe.object.CafeCustomer;
import com.beanbeanjuice.utility.sections.cafe.object.MenuItem;
import com.beanbeanjuice.utility.command.CommandContext;
import com.beanbeanjuice.utility.command.ICommand;
import com.beanbeanjuice.utility.command.usage.Usage;
Expand All @@ -17,7 +17,7 @@
import java.util.ArrayList;

/**
* A command used to order {@link com.beanbeanjuice.utility.cafe.object.MenuItem MenuItem}s.
* A command used to order {@link com.beanbeanjuice.utility.sections.cafe.object.MenuItem MenuItem}s.
*
* @author beanbeanjuice
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.beanbeanjuice.command.cafe;

import com.beanbeanjuice.main.CafeBot;
import com.beanbeanjuice.utility.cafe.object.CafeCustomer;
import com.beanbeanjuice.utility.cafe.object.ServeWord;
import com.beanbeanjuice.utility.sections.cafe.object.CafeCustomer;
import com.beanbeanjuice.utility.sections.cafe.object.ServeWord;
import com.beanbeanjuice.utility.command.CommandContext;
import com.beanbeanjuice.utility.command.ICommand;
import com.beanbeanjuice.utility.command.usage.Usage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.beanbeanjuice.utility.command.usage.Usage;
import com.beanbeanjuice.utility.command.usage.categories.CategoryType;
import com.beanbeanjuice.utility.command.usage.types.CommandType;
import com.beanbeanjuice.utility.poll.Poll;
import com.beanbeanjuice.utility.poll.PollEmoji;
import com.beanbeanjuice.utility.sections.fun.poll.Poll;
import com.beanbeanjuice.utility.sections.fun.poll.PollEmoji;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.TextChannel;
Expand All @@ -21,7 +21,7 @@
import java.util.Arrays;

/**
* A command used to add a {@link com.beanbeanjuice.utility.poll.Poll Poll}.
* A command used to add a {@link com.beanbeanjuice.utility.sections.fun.poll.Poll Poll}.
*
* @author beanbeanjuice
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.beanbeanjuice.utility.command.usage.Usage;
import com.beanbeanjuice.utility.command.usage.categories.CategoryType;
import com.beanbeanjuice.utility.command.usage.types.CommandType;
import com.beanbeanjuice.utility.raffle.Raffle;
import com.beanbeanjuice.utility.sections.fun.raffle.Raffle;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.TextChannel;
Expand All @@ -19,7 +19,7 @@
import java.util.ArrayList;

/**
* A command used for {@link com.beanbeanjuice.utility.raffle.Raffle Raffle}s.
* A command used for {@link com.beanbeanjuice.utility.sections.fun.raffle.Raffle Raffle}s.
*
* @author beanbeanjuice
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildM
Integer currentNumber = CafeBot.getCountingHelper().getLastNumber(event.getGuild());

if (highestNumber == null || currentNumber == null) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().sqlServerError()).queue();
event.getChannel().sendMessage(CafeBot.getGeneralHelper().errorEmbed(
"Error Getting Counting Statistics",
"There was an error getting counting statistics. There are either no counting statistics " +
"for the server on this bot, or there is an SQL server error."
)).queue();
return;
}

Expand All @@ -40,6 +44,7 @@ private MessageEmbed countingStatisticsEmbed(@NotNull Integer highestNumber, @No
embedBuilder.addField("Highest Number", highestNumber.toString(), true);
embedBuilder.addField("Current Number", currentNumber.toString(), true);
embedBuilder.setColor(CafeBot.getGeneralHelper().getRandomColor());
embedBuilder.setFooter("These statistics are for the current server only.");
return embedBuilder.build();
}

Expand Down
75 changes: 75 additions & 0 deletions src/main/java/com/beanbeanjuice/command/games/CoinFlipCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.beanbeanjuice.command.games;

import com.beanbeanjuice.main.CafeBot;
import com.beanbeanjuice.utility.command.CommandContext;
import com.beanbeanjuice.utility.command.ICommand;
import com.beanbeanjuice.utility.command.usage.Usage;
import com.beanbeanjuice.utility.command.usage.categories.CategoryType;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;

import java.util.ArrayList;

/**
* An {@link ICommand} used for flipping coins.
*
* @author beanbeanjuice
*/
public class CoinFlipCommand implements ICommand {

@Override
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) {
int num = CafeBot.getGeneralHelper().getRandomNumber(1, 3);

if (num == 1) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().successEmbed(
"Coin Toss!",
"Heads"
)).queue();
return;
}

if (num == 2) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().successEmbed(
"Coin Toss!",
"Tails"
)).queue();
return;
}
}

@Override
public String getName() {
return "coin-flip";
}

@Override
public ArrayList<String> getAliases() {
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("coinflip");
arrayList.add("coin-toss");
arrayList.add("cointoss");
return arrayList;
}

@Override
public String getDescription() {
return "Flip a coin!";
}

@Override
public String exampleUsage() {
return "`!!coinflip`";
}

@Override
public Usage getUsage() {
return new Usage();
}

@Override
public CategoryType getCategoryType() {
return CategoryType.GAMES;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package com.beanbeanjuice.command.games;

import com.beanbeanjuice.main.CafeBot;
import com.beanbeanjuice.utility.command.CommandContext;
import com.beanbeanjuice.utility.command.ICommand;
import com.beanbeanjuice.utility.command.usage.Usage;
import com.beanbeanjuice.utility.command.usage.categories.CategoryType;
import com.beanbeanjuice.utility.command.usage.types.CommandType;
import com.beanbeanjuice.utility.sections.games.connectfour.ConnectFourGame;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;

import java.util.ArrayList;

/**
* An {@link ICommand} used for Connect Four games.
*
* @author beanbeanjuice
*/
public class ConnectFourCommand implements ICommand {

@Override
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) {
User player1 = user;
User player2 = CafeBot.getGeneralHelper().getUser(args.get(0));

if (player1.equals(player2)) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().errorEmbed(
"Cannot Play Yourself",
"You cannot play a connect four game against yourself!"
)).queue();
return;
}

if (player2.isBot()) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().errorEmbed(
"Cannot Play Against Bot",
"You cannot play this game against a bot!"
)).queue();
return;
}

ConnectFourGame game = new ConnectFourGame(player1, player2, event.getChannel());
if (!CafeBot.getConnectFourHandler().createGame(event.getGuild().getId(), game)) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().errorEmbed(
"Error Creating Connect Four Game",
"There is already an active connect four game on this server. Please wait for it to end."
)).queue();
}
}

@Override
public String getName() {
return "connect-four";
}

@Override
public ArrayList<String> getAliases() {
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("connectfour");
arrayList.add("connect-4");
arrayList.add("connect4");
return arrayList;
}

@Override
public String getDescription() {
return "Play connect four with someone!";
}

@Override
public String exampleUsage() {
return "`!!connect4 @beanbeanjuice`";
}

@Override
public Usage getUsage() {
Usage usage = new Usage();
usage.addUsage(CommandType.USER, "Opponent Mention", true);
return usage;
}

@Override
public CategoryType getCategoryType() {
return CategoryType.GAMES;
}
}
66 changes: 66 additions & 0 deletions src/main/java/com/beanbeanjuice/command/games/DiceRollCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.beanbeanjuice.command.games;

import com.beanbeanjuice.main.CafeBot;
import com.beanbeanjuice.utility.command.CommandContext;
import com.beanbeanjuice.utility.command.ICommand;
import com.beanbeanjuice.utility.command.usage.Usage;
import com.beanbeanjuice.utility.command.usage.categories.CategoryType;
import com.beanbeanjuice.utility.command.usage.types.CommandType;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;

import java.util.ArrayList;

/**
* An {@link ICommand} used for rolling dice.
*
* @author beanbeanjuice
*/
public class DiceRollCommand implements ICommand {

@Override
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) {
System.out.println(Integer.parseInt(args.get(0)));
event.getChannel().sendMessage(CafeBot.getGeneralHelper().successEmbed(
"Dice Roll!",
"You rolled a `" + CafeBot.getGeneralHelper().getRandomNumber(1, Integer.parseInt(args.get(0)) + 1) + "`."
)).queue();
}

@Override
public String getName() {
return "dice-roll";
}

@Override
public ArrayList<String> getAliases() {
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("diceroll");
arrayList.add("roll");
arrayList.add("dice");
return arrayList;
}

@Override
public String getDescription() {
return "Roll a dice between 1 and the specified number.";
}

@Override
public String exampleUsage() {
return "`!!roll 200`";
}

@Override
public Usage getUsage() {
Usage usage = new Usage();
usage.addUsage(CommandType.NUMBER, "What number?", true);
return usage;
}

@Override
public CategoryType getCategoryType() {
return CategoryType.GAMES;
}

}

0 comments on commit 200042d

Please sign in to comment.