use of me.perrycate.groupmeutils.api.GroupMe in project groupme-utils by TheGuyWithTheFace.
the class Append method main.
public static void main(String[] args) {
System.out.println("starting");
// required info
String token = "YOUR TOKEN HERE";
// Test Group
String groupId = "GROUP ID HERE";
GroupMe groupme = new GroupMe(token);
Group group = groupme.getGroup(groupId);
Dumper dumper = new Dumper(groupme, group);
dumper.append(new File("testfile.txt"));
System.out.println("Complete");
}
use of me.perrycate.groupmeutils.api.GroupMe in project groupme-utils by TheGuyWithTheFace.
the class Dumper method main.
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
// User auth
System.out.println("Please enter your GroupMe API Token: ");
String token = s.nextLine();
GroupMe api = new GroupMe(token);
// Group Selection
System.out.println("Fetching groups list...");
Group[] groups = api.getGroups();
for (int i = 0; i < groups.length; i++) {
System.out.format("[%d] %s\n", i, groups[i].getName());
}
System.out.print("Please select a group to dump: ");
Group selectedGroup = groups[s.nextInt()];
System.out.println("Selected \"" + selectedGroup.getName() + "\".");
// Initialize dumper
Dumper dumper = new Dumper(api, selectedGroup);
// Skip newline
s.nextLine();
// Get file to use, determine if we're writing a new one or appending
System.out.print("Enter a file name: ");
File fileToWrite = new File(s.nextLine());
if (fileToWrite.isFile()) {
// Append if applicable
System.out.println("File already exists. Append to this file? [Y/n]");
String response = s.nextLine();
if (response.toLowerCase().trim().startsWith("n")) {
System.out.println("Fine then. Exiting...");
s.close();
return;
}
// Append
long startTime = System.currentTimeMillis();
// int messagesAdded = dumper.append(fileToWrite);
dumper.append(fileToWrite);
long elapsedTime = System.currentTimeMillis() - startTime;
// Exit
System.out.format("Completed in %d seconds. Goodbye!", (int) (elapsedTime / 1000 + .5));
} else {
// Dump otherwise.
System.out.println("Create new file " + fileToWrite + "? [Y/n]");
String response = s.nextLine();
if (response.toLowerCase().trim().startsWith("n")) {
System.out.println("Fine then. Exiting...");
s.close();
return;
}
// Append
long startTime = System.currentTimeMillis();
System.out.println("Dumping...");
int messagesDumped = dumper.dump(fileToWrite);
long elapsedTime = System.currentTimeMillis() - startTime;
// Exit
System.out.format("Dumped %d messages in %.1f seconds. Goodbye!", messagesDumped, (double) (elapsedTime / 1000));
}
s.close();
}
use of me.perrycate.groupmeutils.api.GroupMe in project groupme-utils by TheGuyWithTheFace.
the class Stats method main.
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
// User auth
System.out.println("Please enter your GroupMe API Token: ");
GroupMe api = new GroupMe(s.nextLine());
// Select group
System.out.println("Fetching groups list...");
Group[] groups = api.getGroups();
for (int i = 0; i < groups.length; i++) {
System.out.format("[%d] %s\n", i, groups[i].getName());
}
System.out.print("Please select a group to dump: ");
Group selectedGroup = groups[Integer.parseInt(s.nextLine())];
System.out.println("Selected \"" + selectedGroup.getName() + "\".");
// Create output file
System.out.println("Please enter a new file to save data to: ");
File out = new File(s.nextLine());
// Analyze and dump
Stats stats = new Stats(api, selectedGroup, out);
stats.write();
s.close();
}
use of me.perrycate.groupmeutils.api.GroupMe in project groupme-utils by TheGuyWithTheFace.
the class ListGroups method main.
public static void main(String[] args) {
System.out.println("Please enter your groupme API Token: ");
Scanner s = new Scanner(System.in);
String token = s.nextLine();
System.out.println("Fetching groups...");
GroupMe groupme = new GroupMe(token);
Group[] groups = groupme.getGroups();
for (int i = 0; i < groups.length; i++) {
System.out.println("Name: " + groups[i].getName());
System.out.print("Members: ");
Member[] members = groups[i].getMembers();
for (int j = 0; j < members.length; j++) {
System.out.print(members[j].getNickname() + " ");
}
System.out.println();
}
s.close();
}
use of me.perrycate.groupmeutils.api.GroupMe in project groupme-utils by TheGuyWithTheFace.
the class TestDump method main.
public static void main(String[] args) {
// required info
String token = "YOUR API TOKEN HERE";
String groupId = "GROUP ID HERE";
GroupMe groupme = new GroupMe(token);
Group group = groupme.getGroup(groupId);
Dumper dumper = new Dumper(groupme, group);
dumper.dump(new File("testdump.txt"));
System.out.println("Complete");
}