-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from beanbeanjuice/integration
Ready for Release v2.3.2
- Loading branch information
Showing
27 changed files
with
397 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
src/main/java/com/beanbeanjuice/command/interaction/DieCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package com.beanbeanjuice.command.interaction; | ||
|
||
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 to die. | ||
* | ||
* @author beanbeanjuice | ||
*/ | ||
public class DieCommand implements ICommand { | ||
|
||
@Override | ||
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) { | ||
String url = CafeBot.getInteractionHandler().getDieImage(); | ||
String sender = user.getName(); | ||
|
||
ArrayList<User> receivers = new ArrayList<>(); | ||
int count = 0; | ||
|
||
if (!args.isEmpty()) { | ||
while (CafeBot.getGeneralHelper().getUser(args.get(count)) != null) { | ||
receivers.add(CafeBot.getGeneralHelper().getUser(args.get(count++))); | ||
if (count == args.size()) { | ||
break; | ||
} | ||
} | ||
} | ||
|
||
StringBuilder stringBuilder = new StringBuilder(); | ||
for (int i = count; i < args.size(); i++) { | ||
stringBuilder.append(args.get(i)); | ||
if (i != args.size() - 1) { | ||
stringBuilder.append(" "); | ||
} | ||
} | ||
|
||
String message; | ||
|
||
if (receivers.size() == 0) { | ||
message = "**" + sender + "** *died*! SOMEONE HELP!"; | ||
} else { | ||
message = "**" + sender + "** *died* with **" + CafeBot.getInteractionHandler().getReceiverString(receivers) + "**..."; | ||
} | ||
|
||
if (stringBuilder.isEmpty()) { | ||
event.getChannel().sendMessage(message).embed(CafeBot.getInteractionHandler().actionEmbed(url)).queue(); | ||
} else { | ||
event.getChannel().sendMessage(message).embed(CafeBot.getInteractionHandler().actionWithDescriptionEmbed(url, stringBuilder.toString())).queue(); | ||
} | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "die"; | ||
} | ||
|
||
@Override | ||
public ArrayList<String> getAliases() { | ||
return new ArrayList<>(); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Die with someone!"; | ||
} | ||
|
||
@Override | ||
public String exampleUsage() { | ||
return "`!!die @beanbeanjuice` or `!!die @beanbeanjuice :O`"; | ||
} | ||
|
||
@Override | ||
public Usage getUsage() { | ||
Usage usage = new Usage(); | ||
usage.addUsage(CommandType.SENTENCE, "Users + Extra Message", false); | ||
return usage; | ||
} | ||
|
||
@Override | ||
public CategoryType getCategoryType() { | ||
return CategoryType.INTERACTION; | ||
} | ||
|
||
} |
93 changes: 93 additions & 0 deletions
93
src/main/java/com/beanbeanjuice/command/interaction/SleepCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package com.beanbeanjuice.command.interaction; | ||
|
||
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 to sleep. | ||
* | ||
* @author beanbeanjuice | ||
*/ | ||
public class SleepCommand implements ICommand { | ||
|
||
@Override | ||
public void handle(CommandContext ctx, ArrayList<String> args, User user, GuildMessageReceivedEvent event) { | ||
String url = CafeBot.getInteractionHandler().getSleepImage(); | ||
String sender = user.getName(); | ||
|
||
ArrayList<User> receivers = new ArrayList<>(); | ||
int count = 0; | ||
|
||
if (!args.isEmpty()) { | ||
while (CafeBot.getGeneralHelper().getUser(args.get(count)) != null) { | ||
receivers.add(CafeBot.getGeneralHelper().getUser(args.get(count++))); | ||
if (count == args.size()) { | ||
break; | ||
} | ||
} | ||
} | ||
|
||
StringBuilder stringBuilder = new StringBuilder(); | ||
for (int i = count; i < args.size(); i++) { | ||
stringBuilder.append(args.get(i)); | ||
if (i != args.size() - 1) { | ||
stringBuilder.append(" "); | ||
} | ||
} | ||
|
||
String message; | ||
|
||
if (receivers.size() == 0) { | ||
message = "**" + sender + "** is *sleeping*! Anyone wanna join? *wink wink*"; | ||
} else { | ||
message = "**" + sender + "** is *sleeping* with **" + CafeBot.getInteractionHandler().getReceiverString(receivers) + "**. :O"; | ||
} | ||
|
||
if (stringBuilder.isEmpty()) { | ||
event.getChannel().sendMessage(message).embed(CafeBot.getInteractionHandler().actionEmbed(url)).queue(); | ||
} else { | ||
event.getChannel().sendMessage(message).embed(CafeBot.getInteractionHandler().actionWithDescriptionEmbed(url, stringBuilder.toString())).queue(); | ||
} | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "sleep"; | ||
} | ||
|
||
@Override | ||
public ArrayList<String> getAliases() { | ||
return new ArrayList<>(); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Sleep with someone!"; | ||
} | ||
|
||
@Override | ||
public String exampleUsage() { | ||
return "`!!sleep @beanbeanjuice` or `!!sleep @beanbeanjuice :O`"; | ||
} | ||
|
||
@Override | ||
public Usage getUsage() { | ||
Usage usage = new Usage(); | ||
usage.addUsage(CommandType.SENTENCE, "Users + Extra Message", false); | ||
return usage; | ||
} | ||
|
||
@Override | ||
public CategoryType getCategoryType() { | ||
return CategoryType.INTERACTION; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.