Revert "Add files via upload"
This commit is contained in:
parent
c1cafeab2e
commit
64ce2b4887
31 changed files with 199 additions and 686 deletions
|
|
@ -1,2 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4" />
|
|
||||||
Binary file not shown.
46
pom.xml
46
pom.xml
|
|
@ -1,46 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>Cryptix-Data-Mining</groupId>
|
|
||||||
<artifactId>Cryptix-Data-Mining</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>1.9</source>
|
|
||||||
<target>1.9</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>jcenter</id>
|
|
||||||
<name>jcenter-bintray</name>
|
|
||||||
<url>http://jcenter.bintray.com</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>jitpack.io</id>
|
|
||||||
<url>https://jitpack.io</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.rethinkdb</groupId>
|
|
||||||
<artifactId>rethinkdb-driver</artifactId>
|
|
||||||
<version>2.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.dv8tion</groupId>
|
|
||||||
<artifactId>JDA</artifactId>
|
|
||||||
<version>LATEST</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package discord.data.mining;
|
|
||||||
|
|
||||||
import com.rethinkdb.net.Connection;
|
|
||||||
|
|
||||||
import static com.rethinkdb.RethinkDB.r;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Hax
|
|
||||||
* @github github.com/Schlauer-Hax
|
|
||||||
* @time 19:40 07.08.2018
|
|
||||||
* @project Cryptix-Data-Mining
|
|
||||||
* @package discord.data.mining
|
|
||||||
* @class Database
|
|
||||||
**/
|
|
||||||
|
|
||||||
public class Database {
|
|
||||||
|
|
||||||
static Connection conn;
|
|
||||||
|
|
||||||
public static void connect() {
|
|
||||||
conn = r.connection()
|
|
||||||
.hostname("localhost")
|
|
||||||
.db("DM")
|
|
||||||
.port(28015)
|
|
||||||
.connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Connection getConn() {
|
|
||||||
return conn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
package discord.data.mining.Listener;
|
|
||||||
|
|
||||||
import discord.data.mining.Main;
|
|
||||||
import discord.data.mining.sendMessage;
|
|
||||||
import net.dv8tion.jda.core.AccountType;
|
|
||||||
import net.dv8tion.jda.core.EmbedBuilder;
|
|
||||||
import net.dv8tion.jda.core.JDA;
|
|
||||||
import net.dv8tion.jda.core.JDABuilder;
|
|
||||||
import net.dv8tion.jda.core.events.Event;
|
|
||||||
import net.dv8tion.jda.core.events.ReadyEvent;
|
|
||||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
|
||||||
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author GregTCLTK
|
|
||||||
* @time 21:22 29.06.2018
|
|
||||||
* @project Cryptix-Data-Mining
|
|
||||||
* @package discord.data.mining.Listener
|
|
||||||
* @class onReactionAdd
|
|
||||||
**/
|
|
||||||
|
|
||||||
|
|
||||||
public class eventListener extends ListenerAdapter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGenericEvent(Event event) {
|
|
||||||
Main.Messageperh++;
|
|
||||||
sendMessage.sendMessage(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
package discord.data.mining.Listener;
|
|
||||||
|
|
||||||
import discord.data.mining.Main;
|
|
||||||
import net.dv8tion.jda.core.JDA;
|
|
||||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
|
||||||
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author GregTCLTK
|
|
||||||
* @time 09:42 01.07.2018
|
|
||||||
* @project Cryptix-Data-Mining
|
|
||||||
* @package discord.data.mining.Listener
|
|
||||||
* @class managerListener
|
|
||||||
**/
|
|
||||||
|
|
||||||
public class managerListener extends ListenerAdapter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessageReceived(MessageReceivedEvent event) {
|
|
||||||
if (event.getAuthor().getId().contains("401817301919465482") || event.getAuthor().getId().contains("261083609148948488")) {
|
|
||||||
if (event.getMessage().getContentRaw().equals("dm!shutdown")) {
|
|
||||||
|
|
||||||
for (JDA Bots : Main.bots) {
|
|
||||||
Bots.shutdown();
|
|
||||||
}
|
|
||||||
for (JDA Clients : Main.clients) {
|
|
||||||
Clients.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
package discord.data.mining.Listener;
|
|
||||||
|
|
||||||
import discord.data.mining.Logger;
|
|
||||||
import discord.data.mining.Main;
|
|
||||||
import net.dv8tion.jda.core.JDA;
|
|
||||||
import net.dv8tion.jda.core.entities.Guild;
|
|
||||||
import net.dv8tion.jda.core.entities.Invite;
|
|
||||||
import net.dv8tion.jda.core.events.ReadyEvent;
|
|
||||||
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Hax
|
|
||||||
* @time 12:04 30.06.2018
|
|
||||||
* @project Cryptix-Data-Mining
|
|
||||||
* @package discord.data.mining.Listener
|
|
||||||
* @class onready
|
|
||||||
**/
|
|
||||||
|
|
||||||
public class onready extends ListenerAdapter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReady(ReadyEvent event) {
|
|
||||||
Logger.info("Client " + event.getJDA().getSelfUser().getName() + "#" +event.getJDA().getSelfUser().getDiscriminator() + "\nGuilds: " + event.getJDA().getGuilds().size() + "\nUser: " + event.getJDA().getUsers().size());
|
|
||||||
Main.onlineclients.add(event.getJDA().getSelfUser().getName());
|
|
||||||
Logger.info("Arraylist size " + Main.onlineclients.size() + " " + Main.clients.size());
|
|
||||||
for (Guild guild : event.getJDA().getGuilds()) {
|
|
||||||
if (!guild.getId().equals("448554629282922527")) {
|
|
||||||
if (!Main.guilds.contains(guild)) {
|
|
||||||
Main.guilds.add(guild);
|
|
||||||
} else {
|
|
||||||
Logger.info("Leave " + guild.getName());
|
|
||||||
guild.leave().queue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Main.onlineclients.size() == Main.clients.size()) {
|
|
||||||
Logger.info("All clients loaded");
|
|
||||||
for (JDA jda : Main.clients) {
|
|
||||||
jda.addEventListener(new eventListener());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -7,7 +7,7 @@ import java.time.Instant;
|
||||||
/**
|
/**
|
||||||
* @author GregTCLTK
|
* @author GregTCLTK
|
||||||
* @time 21:26 30.06.2018
|
* @time 21:26 30.06.2018
|
||||||
* @project Cryptix-Data-Mining
|
* @project Discord-Data-Mining
|
||||||
* @package discord.data.mining
|
* @package discord.data.mining
|
||||||
* @class Logger
|
* @class Logger
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package discord.data.mining;
|
package discord.data.mining;
|
||||||
|
|
||||||
import discord.data.mining.Listener.eventListener;
|
import discord.data.mining.Listener.MessageReceivedListener;
|
||||||
import discord.data.mining.Listener.managerListener;
|
import discord.data.mining.Listener.ReadyListener;
|
||||||
import discord.data.mining.Listener.onready;
|
|
||||||
import net.dv8tion.jda.core.AccountType;
|
import net.dv8tion.jda.core.AccountType;
|
||||||
import net.dv8tion.jda.core.JDA;
|
import net.dv8tion.jda.core.JDA;
|
||||||
import net.dv8tion.jda.core.JDABuilder;
|
import net.dv8tion.jda.core.JDABuilder;
|
||||||
|
|
@ -16,34 +15,33 @@ import static discord.data.mining.SECRETS.managerTokens;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static long MessageLog = 462507170383134720L;
|
static long MessageLog = 462507170383134720L;
|
||||||
public static long ReactionLog = 462524422713245696L;
|
static long ReactionLog = 462524422713245696L;
|
||||||
public static long ConsoleLog = 462556910206320640L;
|
static long ConsoleLog = 462556910206320640L;
|
||||||
public static ArrayList<JDA> clients = new ArrayList<>();
|
public static ArrayList<JDA> clients = new ArrayList<>();
|
||||||
public static ArrayList<JDA> bots = new ArrayList<>();
|
public static ArrayList<JDA> bots = new ArrayList<>();
|
||||||
public static ArrayList<JDA> manager = new ArrayList<>();
|
public static ArrayList<JDA> manager = new ArrayList<>();
|
||||||
public static int currentBot = 0;
|
public static int currentBot = 0;
|
||||||
public static ArrayList<String> onlineclients = new ArrayList<>();
|
public static ArrayList<String> onlineclients = new ArrayList<>();
|
||||||
public static long Messageperh = 0;
|
public static long Actionperh = 0;
|
||||||
public static ArrayList<Guild> guilds = new ArrayList<>();
|
public static ArrayList<Guild> guilds = new ArrayList<>();
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
Database.connect();
|
|
||||||
for (String Token : managerTokens) {
|
for (String Token : managerTokens) {
|
||||||
manager.add(new JDABuilder(AccountType.BOT).setAutoReconnect(true).setToken(Token).addEventListener(new managerListener()).buildAsync());
|
manager.add(new JDABuilder(AccountType.BOT).setAutoReconnect(true).setToken(Token).addEventListener(new MessageReceivedListener()).buildAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
|
|
||||||
onlinethread.main();
|
onlinethread.main();
|
||||||
for (String Token : clienttokens) {
|
for (String Token : clienttokens) {
|
||||||
clients.add(new JDABuilder(AccountType.CLIENT).setToken(Token).addEventListener(new onready()).setAutoReconnect(true).buildAsync());
|
clients.add(new JDABuilder(AccountType.CLIENT).setToken(Token).addEventListener(new ReadyListener()).setAutoReconnect(true).buildAsync());
|
||||||
}
|
}
|
||||||
for (String Token : botTokens) {
|
for (String Token : botTokens) {
|
||||||
bots.add(new JDABuilder(AccountType.BOT).setAutoReconnect(true).setToken(Token).buildAsync());
|
bots.add(new JDABuilder(AccountType.BOT).setAutoReconnect(true).setToken(Token).buildAsync());
|
||||||
}
|
}
|
||||||
test2.main();
|
Stats.start();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
package discord.data.mining;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Hax
|
|
||||||
* @time 10:01 30.06.2018
|
|
||||||
* @project Cryptix-Data-Mining
|
|
||||||
* @package discord.data.mining
|
|
||||||
* @class SECRETS
|
|
||||||
**/
|
|
||||||
|
|
||||||
public class SECRETS {
|
|
||||||
public static ArrayList<String> clienttokens = new ArrayList<>() {{
|
|
||||||
add("NDYyNTI0MzE1NjkxMTIyNjg5.DhjJfQ.PTAsNfKWTicXs-7kmF5wvUTA75Q");
|
|
||||||
add("NDAwOTM0NTkyODg4MDQ1NTY4.DhAfEA.E2DUMYaTrduN_KVtCVyhoK9CC3I");
|
|
||||||
add("NDYxNDEzNTg1NzEzNzU4MjA5.Dhjtqw.Bkl4NLqzxkIv236FhRzEkuDUhiI");
|
|
||||||
add("NDYyNjM4MjE3Njc4ODE1MjM0.DhkyOQ.iysUR97o1KqjSui5Top1oHpFOJQ");
|
|
||||||
}};
|
|
||||||
public static ArrayList<String> botTokens = new ArrayList<>() {{
|
|
||||||
add("NDYyNTA3NzQzMzI0OTMwMDUx.Dhi3ag.Nc2kDhoJCgj6hCLM3Bb0hUmGfvw");
|
|
||||||
add("NDYyNTQ3OTYwNjMxMTMyMTYx.Dhjc7Q.qeFYt5Op3xJ-TCHuZnM_mscTe2w");
|
|
||||||
add("NDYyNTU1NDM5MDI5MDI2ODE2.Dhjj1Q.NyiVkrdIk73p7kaJIZMNx79UGxc");
|
|
||||||
add("NDYyNTU1NjUwODEyMDE4Njg5.DhjkCA.sUWSnt9MhO7xg2zEQf5NqZ-41o0");
|
|
||||||
add("NDYyNTU2MDU3MTgxNDg3MTA0.Dhjkgw.3tX8m9FTp63c0GbLmZSar-PpkO8");
|
|
||||||
add("NDYyOTEwOTQ5Mjc2Mzg1Mjgw.Dhou7Q.Pa-GzDYiY3lfEp9BC_-MUyFs9kE");
|
|
||||||
add("NDYyOTExMjA5MzQ4NTMwMTc2.Dhovag.0EPOnxUBJaf6j1Lpd-u01dDFAtE");
|
|
||||||
add("NDYyOTExMzQyODAyNzYzNzc2.DhovuA.eBi8xM3cErZA-uNEOBTwYPyiuqc");
|
|
||||||
add("NDYyOTExOTYxNzI2ODQ0OTMw.Dhov3w.YbznrvNpphyR3OsE5p7kl1E-Tuc");
|
|
||||||
add("NDYyOTEyMTM1MTgyMTU1Nzc2.DhowCA.catECZ6Ghjd18GaYwaWG1o90qOw");
|
|
||||||
add("NDYyOTMxMzQ0OTMwODk3OTIw.DhpB7g.oPCmHpopM7OOfelJc-HkmYBf7xo");
|
|
||||||
add("NDYyOTMxNDc5ODAyOTM3MzY0.DhpCDQ.MRTSNgfrtZLg117lJRJGoMPL_As");
|
|
||||||
add("NDYyOTMxNjI2MzMxMDc4NjU4.DhpCLw.YkI8CQPu7ykwHN7ALEnGp_zV6dg");
|
|
||||||
add("NDYyOTMxNzM2MDU0MjAyMzY5.DhpCSg.Eia-HhBIfMCvgm9Dyi9KdOgh5Bc");
|
|
||||||
add("NDYyOTMxODY2MjM3MDA5OTIw.DhpCbg.sfPuDPNbjbwUviFXo7j6VrqaIrg");
|
|
||||||
add("NDYyOTMzMzk5ODM4MTMwMTg3.DhpD1g.LzTF1QA3UV-TvOMP4wb7AtsIwdo");
|
|
||||||
add("NDYyOTMzODE1OTc5OTMzNjk2.DhpEOQ.PiYSzer3H-7ekhmS0VpF-XXjpD4");
|
|
||||||
add("NDYyOTM0Mjk0NDI4NjQ3NDM0.DhpEqg.7Ioh3N4dqJ7aB35dOvKUMRdC4mc");
|
|
||||||
add("NDYyOTM0MTgwNDg2MDUzODk4.DhpEkQ.5RZ7_F69PywlPp0fNeGSAlEb5a0");
|
|
||||||
add("NDYyOTM1NDc3NTMyNzUzOTIx.DhpFxg.Kqe8Fl6PhdE0-pZoIoAgqs4I8Ms");
|
|
||||||
}};
|
|
||||||
public static ArrayList<String> managerTokens = new ArrayList<>() {{
|
|
||||||
add("NDYyNTU3NjMyODA1MzM5MTQ3.Dhj7Xg.bxgNa_DOPpxPAMP1PI3xqvMwS3o");
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,7 @@ package discord.data.mining;
|
||||||
/**
|
/**
|
||||||
* @author Hax
|
* @author Hax
|
||||||
* @time 12:01 30.06.2018
|
* @time 12:01 30.06.2018
|
||||||
* @project Cryptix-Data-Mining
|
* @project Discord-Data-Mining
|
||||||
* @package discord.data.mining
|
* @package discord.data.mining
|
||||||
* @class onlinethread
|
* @class onlinethread
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,20 @@ package discord.data.mining;
|
||||||
/**
|
/**
|
||||||
* @author Skidder
|
* @author Skidder
|
||||||
* @time 09:11 30.06.2018
|
* @time 09:11 30.06.2018
|
||||||
* @project Cryptix-Data-Mining
|
* @project Discord-Data-Mining
|
||||||
* @package discord.data.mining
|
* @package discord.data.mining
|
||||||
* @class sendMessage
|
* @class sendMessage
|
||||||
**/
|
**/
|
||||||
|
|
||||||
import net.dv8tion.jda.core.EmbedBuilder;
|
import net.dv8tion.jda.core.EmbedBuilder;
|
||||||
import net.dv8tion.jda.core.JDA;
|
import net.dv8tion.jda.core.JDA;
|
||||||
import net.dv8tion.jda.core.entities.Message;
|
|
||||||
import net.dv8tion.jda.core.events.Event;
|
import net.dv8tion.jda.core.events.Event;
|
||||||
|
import net.dv8tion.jda.core.events.message.MessageDeleteEvent;
|
||||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||||
import net.dv8tion.jda.core.events.message.react.MessageReactionAddEvent;
|
import net.dv8tion.jda.core.events.message.react.MessageReactionAddEvent;
|
||||||
import net.dv8tion.jda.core.events.message.react.MessageReactionRemoveEvent;
|
import net.dv8tion.jda.core.events.message.react.MessageReactionRemoveEvent;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import static com.rethinkdb.RethinkDB.r;
|
|
||||||
|
|
||||||
public class sendMessage {
|
public class sendMessage {
|
||||||
public static void sendMessage(Event inputevent) {
|
public static void sendMessage(Event inputevent) {
|
||||||
|
|
@ -31,16 +27,6 @@ public class sendMessage {
|
||||||
if (inputevent instanceof MessageReceivedEvent) {
|
if (inputevent instanceof MessageReceivedEvent) {
|
||||||
MessageReceivedEvent event = (MessageReceivedEvent) inputevent;
|
MessageReceivedEvent event = (MessageReceivedEvent) inputevent;
|
||||||
if (!event.getGuild().getId().equals("448554629282922527")) {
|
if (!event.getGuild().getId().equals("448554629282922527")) {
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
|
||||||
String time = sdf.format(cal.getTime());
|
|
||||||
r.table("messages").insert(
|
|
||||||
r.hashMap("MessageID", event.getMessage().getIdLong())
|
|
||||||
.with("AuthorID", event.getAuthor().getIdLong())
|
|
||||||
.with("GuildID", event.getGuild().getIdLong())
|
|
||||||
.with("Content", event.getMessage().getContentRaw())
|
|
||||||
.with("Time", time)
|
|
||||||
).run(Database.getConn());
|
|
||||||
BOT.getTextChannelById(Main.MessageLog)
|
BOT.getTextChannelById(Main.MessageLog)
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
|
|
@ -57,27 +43,27 @@ public class sendMessage {
|
||||||
.build()
|
.build()
|
||||||
).queue();
|
).queue();
|
||||||
}
|
}
|
||||||
|
} else if (inputevent instanceof MessageDeleteEvent) {
|
||||||
|
MessageDeleteEvent event = (MessageDeleteEvent) inputevent;
|
||||||
|
if (!event.getGuild().getId().equals("448554629282922527")) {
|
||||||
|
BOT.getTextChannelById(Main.MessageLog)
|
||||||
|
.sendMessage(
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setColor(16711680)
|
||||||
|
.setTitle("Message deleted", "https://canary.discordapp.com/channels/" + event.getGuild().getId() + "/")
|
||||||
|
.setThumbnail(event.getGuild().getIconUrl())
|
||||||
|
.addField("Guild Name", event.getGuild().getName(), true)
|
||||||
|
.addField("Guild ID", event.getGuild().getId(), true)
|
||||||
|
.addField("Guild Owner", event.getGuild().getOwner().getUser().getName() + "#" + event.getGuild().getOwner().getUser().getDiscriminator(), true)
|
||||||
|
.addField("Channel Name", "#" + event.getChannel().getName(), true)
|
||||||
|
.setFooter(event.getJDA().getSelfUser().getName(), event.getJDA().getSelfUser().getAvatarUrl())
|
||||||
|
.setTimestamp(Instant.now())
|
||||||
|
.build()
|
||||||
|
).queue();
|
||||||
|
}
|
||||||
} else if (inputevent instanceof MessageReactionAddEvent) {
|
} else if (inputevent instanceof MessageReactionAddEvent) {
|
||||||
MessageReactionAddEvent event = (MessageReactionAddEvent) inputevent;
|
MessageReactionAddEvent event = (MessageReactionAddEvent) inputevent;
|
||||||
if (!event.getGuild().getId().equals("448554629282922527")) {
|
if (!event.getGuild().getId().equals("448554629282922527")) {
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
|
||||||
String time = sdf.format(cal.getTime());
|
|
||||||
event.getTextChannel().getMessageById(event.getMessageId()).queue(
|
|
||||||
msg -> {
|
|
||||||
StringBuilder reactions = new StringBuilder();
|
|
||||||
msg.getReactions().forEach(messageReaction -> reactions.append(messageReaction.getReactionEmote().getName()+" ("+messageReaction.getCount()+")"));
|
|
||||||
r.table("reactionadd").insert(
|
|
||||||
r.hashMap("MessageID", msg.getIdLong())
|
|
||||||
.with("AuthorID", msg.getIdLong())
|
|
||||||
.with("GuildID", event.getGuild().getIdLong())
|
|
||||||
.with("Content", msg.getContentRaw())
|
|
||||||
.with("Time", time)
|
|
||||||
.with("NewReaction", event.getReaction().getReactionEmote().getName())
|
|
||||||
.with("Reactions", reactions.toString())
|
|
||||||
).run(Database.getConn());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
BOT.getTextChannelById(Main.ReactionLog)
|
BOT.getTextChannelById(Main.ReactionLog)
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
|
|
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
package discord.data.mining;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.font.FontRenderContext;
|
|
||||||
import java.awt.font.LineMetrics;
|
|
||||||
import java.awt.geom.Ellipse2D;
|
|
||||||
import java.awt.geom.Line2D;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Hax
|
|
||||||
* @time 12:46 30.06.2018
|
|
||||||
* @project Cryptix-Data-Mining
|
|
||||||
* @package discord.data.mining
|
|
||||||
* @class test
|
|
||||||
**/
|
|
||||||
|
|
||||||
public class test extends JPanel {
|
|
||||||
|
|
||||||
int[] data = {
|
|
||||||
21, 14, 18, 03, 86, 88, 74, 87, 54, 77,
|
|
||||||
61, 55, 48, 60, 49, 36, 38, 27, 20, 18
|
|
||||||
};
|
|
||||||
final int PAD = 20;
|
|
||||||
|
|
||||||
protected void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
Graphics2D g2 = (Graphics2D)g;
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
int w = getWidth();
|
|
||||||
int h = getHeight();
|
|
||||||
// Draw ordinate.
|
|
||||||
g2.draw(new Line2D.Double(PAD, PAD, PAD, h-PAD));
|
|
||||||
// Draw abcissa.
|
|
||||||
g2.draw(new Line2D.Double(PAD, h-PAD, w-PAD, h-PAD));
|
|
||||||
// Draw labels.
|
|
||||||
Font font = g2.getFont();
|
|
||||||
FontRenderContext frc = g2.getFontRenderContext();
|
|
||||||
LineMetrics lm = font.getLineMetrics("0", frc);
|
|
||||||
float sh = lm.getAscent() + lm.getDescent();
|
|
||||||
// Ordinate label.
|
|
||||||
String s = "data";
|
|
||||||
float sy = PAD + ((h - 2*PAD) - s.length()*sh)/2 + lm.getAscent();
|
|
||||||
for(int i = 0; i < s.length(); i++) {
|
|
||||||
String letter = String.valueOf(s.charAt(i));
|
|
||||||
float sw = (float)font.getStringBounds(letter, frc).getWidth();
|
|
||||||
float sx = (PAD - sw)/2;
|
|
||||||
g2.drawString(letter, sx, sy);
|
|
||||||
sy += sh;
|
|
||||||
}
|
|
||||||
// Abcissa label.
|
|
||||||
s = "x axis";
|
|
||||||
sy = h - PAD + (PAD - sh)/2 + lm.getAscent();
|
|
||||||
float sw = (float)font.getStringBounds(s, frc).getWidth();
|
|
||||||
float sx = (w - sw)/2;
|
|
||||||
g2.drawString(s, sx, sy);
|
|
||||||
// Draw lines.
|
|
||||||
double xInc = (double)(w - 2*PAD)/(data.length-1);
|
|
||||||
double scale = (double)(h - 2*PAD)/getMax();
|
|
||||||
g2.setPaint(Color.green.darker());
|
|
||||||
for(int i = 0; i < data.length-1; i++) {
|
|
||||||
double x1 = PAD + i*xInc;
|
|
||||||
double y1 = h - PAD - scale*data[i];
|
|
||||||
double x2 = PAD + (i+1)*xInc;
|
|
||||||
double y2 = h - PAD - scale*data[i+1];
|
|
||||||
g2.draw(new Line2D.Double(x1, y1, x2, y2));
|
|
||||||
}
|
|
||||||
// Mark data points.
|
|
||||||
g2.setPaint(Color.red);
|
|
||||||
for(int i = 0; i < data.length; i++) {
|
|
||||||
double x = PAD + i*xInc;
|
|
||||||
double y = h - PAD - scale*data[i];
|
|
||||||
g2.fill(new Ellipse2D.Double(x-2, y-2, 4, 4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getMax() {
|
|
||||||
int max = -Integer.MAX_VALUE;
|
|
||||||
for(int i = 0; i < data.length; i++) {
|
|
||||||
if(data[i] > max)
|
|
||||||
max = data[i];
|
|
||||||
}
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
JFrame f = new JFrame();
|
|
||||||
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
||||||
f.add(new test());
|
|
||||||
f.setSize(400,400);
|
|
||||||
f.setLocation(200,200);
|
|
||||||
f.setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
||||||
package discord.data.mining;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.font.FontRenderContext;
|
|
||||||
import java.awt.font.LineMetrics;
|
|
||||||
import java.awt.geom.Ellipse2D;
|
|
||||||
import java.awt.geom.Line2D;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Hax
|
|
||||||
* @time 12:52 30.06.2018
|
|
||||||
* @project Cryptix-Data-Mining
|
|
||||||
* @package discord.data.mining
|
|
||||||
* @class test2
|
|
||||||
**/
|
|
||||||
|
|
||||||
public class test2 {
|
|
||||||
|
|
||||||
public static void main() {
|
|
||||||
|
|
||||||
Thread diagramm = new Thread(() -> {
|
|
||||||
TimerTask timerTask = new TimerTask() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Date date = new Date();
|
|
||||||
Calendar calendar = GregorianCalendar.getInstance();
|
|
||||||
calendar.setTime(date);
|
|
||||||
if (calendar.get(Calendar.MINUTE)==0) {
|
|
||||||
try {
|
|
||||||
FileReader fr = new FileReader("stats.txt");
|
|
||||||
BufferedReader br = new BufferedReader(fr);
|
|
||||||
|
|
||||||
String zeile = "";
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
while ((zeile = br.readLine()) != null) {
|
|
||||||
stringBuilder.append(zeile);
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
|
|
||||||
String[] stats = stringBuilder.toString().split(" ");
|
|
||||||
String statsstring = stringBuilder.toString();
|
|
||||||
statsstring = statsstring.replaceFirst(stats[0]+" ", "");
|
|
||||||
statsstring = statsstring+" "+Main.Messageperh;
|
|
||||||
FileWriter fw = new FileWriter("stats.txt");
|
|
||||||
BufferedWriter bw = new BufferedWriter(fw);
|
|
||||||
bw.write(statsstring);
|
|
||||||
bw.close();
|
|
||||||
Main.Messageperh =0;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (calendar.get(Calendar.HOUR_OF_DAY)==0&&calendar.get(Calendar.MINUTE)==0) {
|
|
||||||
try {
|
|
||||||
FileReader fr = new FileReader("stats.txt");
|
|
||||||
BufferedReader br = new BufferedReader(fr);
|
|
||||||
|
|
||||||
String zeile = "";
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
while ((zeile = br.readLine()) != null) {
|
|
||||||
stringBuilder.append(zeile);
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
String[] datas = stringBuilder.toString().split(" ");
|
|
||||||
ArrayList<Integer> data = new ArrayList<>();
|
|
||||||
for (String dataa:datas) {
|
|
||||||
data.add(Integer.parseInt(dataa));
|
|
||||||
}
|
|
||||||
int max = -Integer.MAX_VALUE;
|
|
||||||
for(int i = 0; i < data.size(); i++) {
|
|
||||||
if(data.get(i) > max)
|
|
||||||
max = data.get(i);
|
|
||||||
}
|
|
||||||
BufferedImage bufferedImage = ImageIO.read(new File("Diagramm.jpg"));
|
|
||||||
Graphics2D g2 = bufferedImage.createGraphics();
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
int w = bufferedImage.getWidth();
|
|
||||||
int h = bufferedImage.getHeight();
|
|
||||||
// Draw ordinate.
|
|
||||||
g2.draw(new Line2D.Double(24, 24, 24, h - 24));
|
|
||||||
// Draw abcissa.
|
|
||||||
g2.draw(new Line2D.Double(24, h - 24, w - 24, h - 24));
|
|
||||||
// Draw labels.
|
|
||||||
Font font = g2.getFont();
|
|
||||||
FontRenderContext frc = g2.getFontRenderContext();
|
|
||||||
LineMetrics lm = font.getLineMetrics("0", frc);
|
|
||||||
float sh = lm.getAscent() + lm.getDescent();
|
|
||||||
// Ordinate label.
|
|
||||||
String s = "data";
|
|
||||||
float sy = 24 + ((h - 2 * 24) - s.length() * sh) / 2 + lm.getAscent();
|
|
||||||
for (int i = 0; i < s.length(); i++) {
|
|
||||||
String letter = String.valueOf(s.charAt(i));
|
|
||||||
float sw = (float) font.getStringBounds(letter, frc).getWidth();
|
|
||||||
float sx = (24 - sw) / 2;
|
|
||||||
g2.drawString(letter, sx, sy);
|
|
||||||
sy += sh;
|
|
||||||
}
|
|
||||||
// Abcissa label.
|
|
||||||
s = "x axis";
|
|
||||||
sy = h - 24 + (24 - sh) / 2 + lm.getAscent();
|
|
||||||
float sw = (float) font.getStringBounds(s, frc).getWidth();
|
|
||||||
float sx = (w - sw) / 2;
|
|
||||||
g2.drawString(s, sx, sy);
|
|
||||||
// Draw lines.
|
|
||||||
double xInc = (double) (w - 2 * 24) / (data.size() - 1);
|
|
||||||
double scale = (double) (h - 2 * 24) / max;
|
|
||||||
g2.setPaint(Color.green.darker());
|
|
||||||
for (int i = 0; i < data.size() - 1; i++) {
|
|
||||||
double x1 = 24 + i * xInc;
|
|
||||||
double y1 = h - 24 - scale * data.get(i);
|
|
||||||
double x2 = 24 + (i + 1) * xInc;
|
|
||||||
double y2 = h - 24 - scale * data.get(i + 1);
|
|
||||||
g2.draw(new Line2D.Double(x1, y1, x2, y2));
|
|
||||||
}
|
|
||||||
// Mark data points.
|
|
||||||
g2.setPaint(Color.red);
|
|
||||||
for (int i = 0; i < data.size(); i++) {
|
|
||||||
double x = 24 + i * xInc;
|
|
||||||
double y = h - 24 - scale * data.get(i);
|
|
||||||
g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4));
|
|
||||||
}
|
|
||||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
||||||
ImageIO.write(bufferedImage, "jpg", os);
|
|
||||||
Main.manager.get(0).getTextChannelById("462534066869370882").sendFile(new ByteArrayInputStream(os.toByteArray()), "test.jpg").queue();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
new Timer().schedule(timerTask, 30000, 60000);
|
|
||||||
});
|
|
||||||
diagramm.start();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue