Description
This commit is contained in:
parent
05add93a79
commit
234b01ad4d
6 changed files with 17 additions and 112 deletions
|
|
@ -13,7 +13,7 @@ import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
|||
* @class onReactionAdd
|
||||
**/
|
||||
|
||||
public class eventListener extends ListenerAdapter {
|
||||
public class GenericEventListener extends ListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onGenericEvent(Event event) {
|
||||
|
|
@ -10,10 +10,10 @@ import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
|||
* @time 09:42 01.07.2018
|
||||
* @project Discord-Data-Mining
|
||||
* @package discord.data.mining.Listener
|
||||
* @class managerListener
|
||||
* @class MessageReceivedListener
|
||||
**/
|
||||
|
||||
public class managerListener extends ListenerAdapter {
|
||||
public class MessageReceivedListener extends ListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(MessageReceivedEvent event) {
|
||||
|
|
@ -12,10 +12,10 @@ import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
|||
* @time 12:04 30.06.2018
|
||||
* @project Discord-Data-Mining
|
||||
* @package discord.data.mining.Listener
|
||||
* @class onready
|
||||
* @class ReadyListener
|
||||
**/
|
||||
|
||||
public class onready extends ListenerAdapter {
|
||||
public class ReadyListener extends ListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onReady(ReadyEvent event) {
|
||||
|
|
@ -35,7 +35,7 @@ public class onready extends ListenerAdapter {
|
|||
if (Main.onlineclients.size() == 3) {
|
||||
Logger.info("All clients loaded");
|
||||
for (JDA jda : Main.clients) {
|
||||
jda.addEventListener(new eventListener());
|
||||
jda.addEventListener(new GenericEventListener());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package discord.data.mining;
|
||||
|
||||
import discord.data.mining.Listener.managerListener;
|
||||
import discord.data.mining.Listener.onready;
|
||||
import discord.data.mining.Listener.MessageReceivedListener;
|
||||
import discord.data.mining.Listener.ReadyListener;
|
||||
import net.dv8tion.jda.core.AccountType;
|
||||
import net.dv8tion.jda.core.JDA;
|
||||
import net.dv8tion.jda.core.JDABuilder;
|
||||
|
|
@ -15,13 +15,13 @@ import static discord.data.mining.SECRETS.managerTokens;
|
|||
|
||||
public class Main {
|
||||
|
||||
public static long MessageLog = 462507170383134720L;
|
||||
public static long ReactionLog = 462524422713245696L;
|
||||
public static long ConsoleLog = 462556910206320640L;
|
||||
static long MessageLog = 462507170383134720L;
|
||||
static long ReactionLog = 462524422713245696L;
|
||||
static long ConsoleLog = 462556910206320640L;
|
||||
public static ArrayList<JDA> clients = new ArrayList<>();
|
||||
public static ArrayList<JDA> bots = 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 long Messageperh = 0;
|
||||
public static ArrayList<Guild> guilds = new ArrayList<>();
|
||||
|
|
@ -29,19 +29,19 @@ public class Main {
|
|||
public static void main(String[] args) {
|
||||
try {
|
||||
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);
|
||||
|
||||
onlinethread.main();
|
||||
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) {
|
||||
bots.add(new JDABuilder(AccountType.BOT).setAutoReconnect(true).setToken(Token).buildAsync());
|
||||
}
|
||||
test2.main();
|
||||
Stats.main();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ import java.util.*;
|
|||
* @time 12:52 30.06.2018
|
||||
* @project Discord-Data-Mining
|
||||
* @package discord.data.mining
|
||||
* @class test2
|
||||
* @class Stats
|
||||
**/
|
||||
|
||||
public class test2 {
|
||||
public class Stats {
|
||||
|
||||
public static void main() {
|
||||
|
||||
|
|
@ -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 Discord-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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue