mirror of
https://github.com/Noratrieb/killua-bot.git
synced 2026-01-14 15:15:01 +01:00
integer division, i love it so much
This commit is contained in:
parent
dffc5c1aa4
commit
322432ca37
8 changed files with 4 additions and 11 deletions
|
|
@ -5,8 +5,6 @@
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ public class TriviaApproval extends ReactionAdapter {
|
||||||
if (event.getUser() != null) {
|
if (event.getUser() != null) {
|
||||||
if (event.getUser().getIdLong() == Config.NILS_ID) {
|
if (event.getUser().getIdLong() == Config.NILS_ID) {
|
||||||
String emote = event.getReaction().getReactionEmote().getName();
|
String emote = event.getReaction().getReactionEmote().getName();
|
||||||
System.out.println(ConsoleColors.BLUE + "[TriviaApproval 47] Received Emote " + emote + ConsoleColors.RESET);
|
|
||||||
if (emote.equals(APPROVE_EMOTE)) {
|
if (emote.equals(APPROVE_EMOTE)) {
|
||||||
event.getTextChannel().sendMessage("Question approved.").queue();
|
event.getTextChannel().sendMessage("Question approved.").queue();
|
||||||
System.out.println(ConsoleColors.BLUE + "[TriviaApproval 50] Question Approved: " + question.getQuestion() + ConsoleColors.RESET);
|
System.out.println(ConsoleColors.BLUE + "[TriviaApproval 50] Question Approved: " + question.getQuestion() + ConsoleColors.RESET);
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,6 @@ public class TriviaCommand extends Command {
|
||||||
answers[3] = "0";
|
answers[3] = "0";
|
||||||
new TriviaApproval(event, new TriviaQuestion(answers));
|
new TriviaApproval(event, new TriviaQuestion(answers));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
System.out.println(ConsoleColors.BLUE_BOLD + "[TriviaCommand.AddSection 139] Received Next Message. status: " + status + ConsoleColors.RESET);
|
|
||||||
answers[status] = event.getMessage().getContentRaw();
|
answers[status] = event.getMessage().getContentRaw();
|
||||||
if (status >= 3) {
|
if (status >= 3) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class EmoteAddCommand extends Command {
|
public class EmoteAddCommand extends Command {
|
||||||
|
|
@ -114,8 +115,8 @@ public class EmoteAddCommand extends Command {
|
||||||
private byte[] resizeImage(byte[] bytes, String format, int size) throws IOException {
|
private byte[] resizeImage(byte[] bytes, String format, int size) throws IOException {
|
||||||
reply("Image size too big (" + bytes.length / 1000 + "kB). Resizing image...");
|
reply("Image size too big (" + bytes.length / 1000 + "kB). Resizing image...");
|
||||||
Image image = ImageIO.read(new ByteArrayInputStream(bytes));
|
Image image = ImageIO.read(new ByteArrayInputStream(bytes));
|
||||||
int ratio = image.getHeight(null) / image.getWidth(null);
|
double ratio = (double)image.getHeight(null) / (double)image.getWidth(null);
|
||||||
image = image.getScaledInstance(size, size * ratio, Image.SCALE_SMOOTH);
|
image = image.getScaledInstance(size, (int) (size * ratio), Image.SCALE_SMOOTH);
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
|
||||||
BufferedImage bufferedImg = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
|
BufferedImage bufferedImg = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import java.util.Scanner;
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) throws LoginException {
|
public static void main(String[] args) throws LoginException {
|
||||||
Config.init(1);
|
Config.init(0);
|
||||||
JDABuilder builder = JDABuilder.createDefault(Config.TOKEN);
|
JDABuilder builder = JDABuilder.createDefault(Config.TOKEN);
|
||||||
builder.setCompression(Compression.ZLIB);
|
builder.setCompression(Compression.ZLIB);
|
||||||
builder.setActivity(Activity.watching("over Gon"));
|
builder.setActivity(Activity.watching("over Gon"));
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ public class CommandHandler {
|
||||||
if (event.getMessage().getContentRaw().toLowerCase().startsWith(Config.PREFIX)) {
|
if (event.getMessage().getContentRaw().toLowerCase().startsWith(Config.PREFIX)) {
|
||||||
String[] split = parser.splitOffCommandName(event.getMessage().getContentRaw());
|
String[] split = parser.splitOffCommandName(event.getMessage().getContentRaw());
|
||||||
String command = split[0];
|
String command = split[0];
|
||||||
System.out.println(ConsoleColors.GREEN + "[CHandler 35] cmd: '" + command + "'" + " args: '" + split[1] + "'" + ConsoleColors.RESET);
|
|
||||||
if (commands.containsKey(command)) {
|
if (commands.containsKey(command)) {
|
||||||
commands.get(command).onMessageReceived(event, split[1]);
|
commands.get(command).onMessageReceived(event, split[1]);
|
||||||
} else if (hiddenCommands.containsKey(command)) {
|
} else if (hiddenCommands.containsKey(command)) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ public class CommandListener extends ListenerAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(@NotNull MessageReceivedEvent event) {
|
public void onMessageReceived(@NotNull MessageReceivedEvent event) {
|
||||||
if (!event.getAuthor().isBot()) {
|
if (!event.getAuthor().isBot()) {
|
||||||
System.out.println(ConsoleColors.CYAN + "[CListener 13] Received message." + ConsoleColors.RESET);
|
|
||||||
CommandHandler.call(event);
|
CommandHandler.call(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ public class ReactionEventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onReactionAdd(MessageReactionAddEvent event){
|
public static void onReactionAdd(MessageReactionAddEvent event){
|
||||||
System.out.println(ConsoleColors.PURPLE + "[ReactionEventManager 21] Reaction added: " + event.getReactionEmote() + ConsoleColors.RESET);
|
|
||||||
long message = event.getMessageIdLong();
|
long message = event.getMessageIdLong();
|
||||||
ReactionListener listener = currentReactions.get(message);
|
ReactionListener listener = currentReactions.get(message);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue