This repository has been archived by the owner on Sep 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ZastrixArundell
committed
Jul 19, 2019
1 parent
ab7bee4
commit 2cea33a
Showing
4 changed files
with
91 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Changelog | ||
|
||
### 3.1.0 | ||
- All of the commands are multi-threaded. | ||
- Made custom classes for custom methods. | ||
- Using lambda expressions and uses less resources on methods. |
35 changes: 35 additions & 0 deletions
35
src/main/java/com/github/zastrixarundell/torambot/Parser.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,35 @@ | ||
package com.github.zastrixarundell.torambot; | ||
|
||
import org.javacord.api.entity.message.embed.EmbedBuilder; | ||
import org.javacord.api.entity.permission.Role; | ||
import org.javacord.api.event.message.MessageCreateEvent; | ||
|
||
import java.awt.*; | ||
|
||
import static com.github.zastrixarundell.torambot.Values.footerMessage; | ||
|
||
public class Parser | ||
{ | ||
|
||
public static void parseFooter(EmbedBuilder builder, MessageCreateEvent messageCreateEvent) | ||
{ | ||
//messageCreateEvent might be used in the future. | ||
if(Values.isRanOnHostingService()) | ||
builder.setFooter(footerMessage); | ||
} | ||
|
||
public static void parseColor(EmbedBuilder embed, MessageCreateEvent messageCreateEvent) | ||
{ | ||
if (messageCreateEvent.getServer().isPresent()) | ||
if (messageCreateEvent.getServer().get().getHighestRole(messageCreateEvent.getApi().getYourself()).isPresent()) | ||
{ | ||
Role role = messageCreateEvent.getServer().get().getHighestRole(messageCreateEvent.getApi().getYourself()).get(); | ||
if (role.getColor().isPresent()) | ||
{ | ||
Color color = role.getColor().get(); | ||
embed.setColor(color); | ||
} | ||
} | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/github/zastrixarundell/torambot/Values.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,26 @@ | ||
package com.github.zastrixarundell.torambot; | ||
|
||
public class Values | ||
{ | ||
|
||
final static String footerMessage = "Support me by going on: http://corneey.com/w2ObhY"; | ||
|
||
public final static String toramLogo = "https://toramonline.com/index.php?media/toram-online-logo.50/full&d=1463410056"; | ||
|
||
public final static String corynLogo = "http://coryn.club/images/cc_logo.gif"; | ||
|
||
public static final String userThumbnailGIF = "https://i.pinimg.com/originals/26/e2/92/26e29265cde55cf756ed4ae2062bdcff.gif"; | ||
|
||
private static boolean ranOnHostingService = false; | ||
|
||
private static String prefix = ">"; | ||
|
||
static void setPrefix(String prefix) { Values.prefix = prefix; } | ||
|
||
static void setRanOnHostingService(boolean ranOnHostingService) { Values.ranOnHostingService = ranOnHostingService; } | ||
|
||
static boolean isRanOnHostingService() { return ranOnHostingService; } | ||
|
||
public static String getPrefix() { return prefix; } | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/github/zastrixarundell/torambot/commands/toramwebsite/Methods.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,24 @@ | ||
package com.github.zastrixarundell.torambot.commands.toramwebsite; | ||
|
||
import com.github.zastrixarundell.torambot.Parser; | ||
import com.github.zastrixarundell.torambot.Values; | ||
import org.javacord.api.entity.message.embed.EmbedBuilder; | ||
import org.javacord.api.event.message.MessageCreateEvent; | ||
|
||
public class Methods | ||
{ | ||
|
||
protected static void sendErrorMessage(MessageCreateEvent messageCreateEvent) | ||
{ | ||
EmbedBuilder embed = new EmbedBuilder() | ||
.setTitle("Error while getting info!") | ||
.setDescription("An error happened! Is the site maybe down?") | ||
.setThumbnail(Values.toramLogo); | ||
|
||
Parser.parseFooter(embed, messageCreateEvent); | ||
Parser.parseColor(embed, messageCreateEvent); | ||
|
||
messageCreateEvent.getChannel().sendMessage(embed); | ||
} | ||
|
||
} |