Skip to content

Commit

Permalink
Merge pull request #250 from beanbeanjuice/integration
Browse files Browse the repository at this point in the history
Ready for Release v2.4.3
  • Loading branch information
beanbeanjuice committed May 30, 2021
2 parents b4d8b56 + a96023a commit 6123441
Show file tree
Hide file tree
Showing 23 changed files with 413 additions and 81 deletions.
11 changes: 7 additions & 4 deletions README.md
Expand Up @@ -22,7 +22,7 @@
<img src="http://cdn.beanbeanjuice.com/images/cafeBot/readme/logo.gif" alt="Logo" width="260" height="186">
</a>

<h3 align="center">cafeBot</h3>
<h1 align="center">cafeBot</h1>

<p align="center">
A cafe bot for your discord server!
Expand All @@ -38,8 +38,6 @@
</p>
</p>



<!-- TABLE OF CONTENTS -->
<details open="open">
<summary><h2 style="display: inline-block">Table of Contents</h2></summary>
Expand Down Expand Up @@ -136,21 +134,26 @@ As you can see, this was shown using the command `!!help order`. It shows each p
* `ping` - Show bot information!
* `feature-request` - Request a bot feature.
* `bug-report` - Report a bug with the bot.
* `support` - Get support for the bot!
* `invite-bot` - A command to get an invite link for the bot!
* `user-info` - Get user information about someone.
* `member-count` - Get the member count for your server!
##### 2. **CAFE**
* `menu` - Show the list of Cafe menu items.
* `serve` - Get beanCoins! Essentially you run this command by doing `!!serve (dictionary word)`! This must be an english word. The longer the word, the more money you get. However, the more popular the word is, the less money you will get for it.
* `order` - Order a menu item for someone!
* `balance` - Check your balance!
##### 3. **FUN**
* `coffee-meme` - Get a coffee meme!
* `tea-meme` - Get a tea meme!
* `meme` - Send a meme in the current channel. (SFW)
* `joke` - Send a joke in the current channel. (SFW)
* `add-poll` - Create a poll! Currently, you can only have 3 polls due to server costs. This will go up in the future!
* `add-raffle` - Create a raffle! Currently, you can only have 3 raffles due to server costs. This will go up in the future!
* `avatar` - Get yours or someone else's avatar image!
* `get-birthday` - Get yours or someone else's birthday!
* `set-birthday` - Set your birthday! (YYYY-MM-DD)
* `set-birthday` - Set your birthday! `(YYYY-MM-DD)`
* `remove-birthday` - Remove your birthday.
* `counting-statistics` - Get counting information for your server!
##### 4. **GAMES**
* `8-ball` - Ask a yes or no question!
Expand Down
24 changes: 10 additions & 14 deletions build.gradle
Expand Up @@ -45,41 +45,37 @@ repositories {
dependencies {

// JUnit, for Unit Testing
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.8.0-M1'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine'

// Jetbrains Annotations
implementation group: 'org.jetbrains', name: 'annotations', version: '20.1.0'
implementation group: 'org.jetbrains', name: 'annotations', version: '21.0.1'

// Discord JDA, for Discord things
implementation group: 'net.dv8tion', name: 'JDA', version: '4.2.1_262'
implementation group: 'net.dv8tion', name: 'JDA', version: '4.2.1_265'

// Twitch Connections
implementation group: 'com.github.twitch4j', name: 'twitch4j', version: '1.3.1'
implementation group: 'com.github.twitch4j', name: 'twitch4j', version: '1.4.0'

// Lava Player
implementation group: 'com.sedmelluq', name: 'lavaplayer', version: '1.3.76'
implementation group: 'com.sedmelluq', name: 'lavaplayer', version: '1.3.77'

// Spotify API
implementation group: 'se.michaelthelin.spotify', name: 'spotify-web-api-java', version: '6.5.2'
implementation group: 'se.michaelthelin.spotify', name: 'spotify-web-api-java', version: '6.5.4'

// JSOUP for Parsing
implementation group: 'org.jsoup', name: 'jsoup', version: '1.13.1'

// JSON
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.12.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.3'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.3'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.12.3'

// Logback
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'

// SQL Connection
implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.2'

// Jackson for JSON
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.3'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.3'
implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.3'

// Time Stuff (For Birthdays)
implementation group: 'joda-time', name: 'joda-time', version: '2.10.10'
Expand Down
@@ -0,0 +1,69 @@
package com.beanbeanjuice.command.fun;

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.Member;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;

import java.util.ArrayList;

/**
* An {@link ICommand} used to check the {@link net.dv8tion.jda.api.entities.Guild Guild} member count.
*
* @author beanbeanjuice
*/
public class MemberCountCommand implements ICommand {

@Override
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) {
int count = 0;

for (Member member : event.getGuild().getMembers()) {
if (!member.getUser().isBot()) {
count++;
}
}

event.getChannel().sendMessage(CafeBot.getGeneralHelper().successEmbed(
"Member Count",
"You currently have `" + count + "` members in your server!"
)).queue();
}

@Override
public String getName() {
return "member-count";
}

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

@Override
public String getDescription() {
return "Check the member count for your server!";
}

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

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

@Override
public CategoryType getCategoryType() {
return CategoryType.GENERIC;
}
}
@@ -0,0 +1,64 @@
package com.beanbeanjuice.command.fun;

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 to remove your birthday.
*
* @author beanbeanjuice
*/
public class RemoveBirthdayCommand implements ICommand {

@Override
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) {
if (CafeBot.getBirthdayHandler().removeBirthday(user.getId())) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().successEmbed(
"Removed Birthday",
"Successfully removed your birthday!"
)).queue();
return;
}

event.getChannel().sendMessage(CafeBot.getGeneralHelper().sqlServerError()).queue();
}

@Override
public String getName() {
return "remove-birthday";
}

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

@Override
public String getDescription() {
return "Remove your birthday.";
}

@Override
public String exampleUsage() {
return "`!!remove-birthday";
}

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

@Override
public CategoryType getCategoryType() {
return CategoryType.FUN;
}
}
Expand Up @@ -25,7 +25,9 @@ public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildM
if (CafeBot.getBirthdayHandler().updateBirthday(user.getId(), date)) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().successEmbed(
"Updated Birthday",
"Successfully updated your birthday to " + date.toString() + " (YYYY-MM-DD)"
"Successfully updated your birthday to " + date + " (YYYY-MM-DD)\n\n*By setting your birthday, " +
"you are agreeing to be notified in EVERY server that this bot is in, granted that they have enabled " +
"birthday notifications. To opt out, do `" + ctx.getPrefix() + "remove-birthday`.*"
)).queue();
return;
}
Expand Down
67 changes: 67 additions & 0 deletions src/main/java/com/beanbeanjuice/command/fun/TeaMemeCommand.java
@@ -0,0 +1,67 @@
package com.beanbeanjuice.command.fun;

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.helper.RedditAPI;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;

/**
* An {@link ICommand} to send Tea memes.
*
* @author beanbeanjuice
*/
public class TeaMemeCommand implements ICommand {

@Override
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) {
event.getChannel().sendMessage(new RedditAPI().getRedditEmbed(getSubreddits().get(CafeBot.getGeneralHelper().getRandomNumber(0, getSubreddits().size())))).queue();
}

@NotNull
private ArrayList<String> getSubreddits() {
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("TeaPorn");
arrayList.add("TeaPictures");
return arrayList;
}

@Override
public String getName() {
return "tea-meme";
}

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

@Override
public String getDescription() {
return "Get a tea meme!";
}

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

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

@Override
public CategoryType getCategoryType() {
return CategoryType.FUN;
}
}
@@ -0,0 +1,61 @@
package com.beanbeanjuice.command.generic;

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 to get an invite link for the bot.
*
* @author beanbeanjuice
*/
public class BotInviteCommand implements ICommand {

@Override
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) {
event.getChannel().sendMessage(CafeBot.getGeneralHelper().successEmbed(
"Bot Invite Link",
"Click [this](https://discord.com/api/oauth2/authorize?client_id=787162619504492554&permissions=305917254&scope=bot) to invite the bot to your server!"
)).queue();
}

@Override
public String getName() {
return "invite-bot";
}

@Override
public ArrayList<String> getAliases() {
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("invitebot");
arrayList.add("bot-invite");
arrayList.add("botinvite");
return arrayList;
}

@Override
public String getDescription() {
return "Get an invite for the bot to add it to your server!";
}

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

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

@Override
public CategoryType getCategoryType() {
return CategoryType.GENERIC;
}
}
Expand Up @@ -29,10 +29,7 @@ public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildM
private MessageEmbed bugReportEmbed() {
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setTitle("Bug Report", BUG_REPORT_URL);
embedBuilder.setDescription("""
If you want to submit a bug report, please click on the title above.
Or alternatively, head to https://github.com/beanbeanjuice/cafeBot/issues/new/choose""");
embedBuilder.setDescription("You can submit a [bug report](" + BUG_REPORT_URL + ") on github!");
embedBuilder.setColor(CafeBot.getGeneralHelper().getRandomColor());
return embedBuilder.build();
}
Expand Down
Expand Up @@ -29,10 +29,7 @@ public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildM
private MessageEmbed featureRequestEmbed() {
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setTitle("Feature Request", FEATURE_REQUEST_URL);
embedBuilder.setDescription("""
If you want to submit a feature request, please click on the title above.
Or alternatively, head to https://github.com/beanbeanjuice/cafeBot/issues/new/choose""");
embedBuilder.setDescription("You can submit a [feature request](" + FEATURE_REQUEST_URL + ") on github!");
embedBuilder.setColor(CafeBot.getGeneralHelper().getRandomColor());
return embedBuilder.build();
}
Expand Down

0 comments on commit 6123441

Please sign in to comment.