Deployment checking utlities added

milan
Shwoomple 2022-02-20 12:37:40 +05:30
parent e451ea04ff
commit f6778e6ee1
7 changed files with 133 additions and 4 deletions

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

13
.idea/compiler.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Hacky-Quizbot" />
</profile>
</annotationProcessing>
</component>
</project>

18
.idea/gradle.xml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="11" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

20
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

12
.idea/misc.xml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -2,13 +2,24 @@ package linux.general.hackyquizbot;
import org.javacord.api.DiscordApi;
import org.javacord.api.DiscordApiBuilder;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main {
public class Main{
public static void main(String[] args) {
// Insert your bot's token here
String token = args[0];
//String token = args[0];
CheckDeploy check = new CheckDeploy(3000, "/home/milan/test.txt");
check.start();
while(true) {
System.out.println("Woo!");
}
/*
DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();
// Add a listener which answers with "Pong!" if someone writes "!ping"
@ -20,6 +31,52 @@ public class Main {
// Print the invite url of your bot
System.out.println("You can invite the bot by using the following url: " + api.createBotInvite());
*/
}
public static class CheckDeploy extends Thread{
private int interval;
private String id;
private String filename;
public CheckDeploy(int interval, String filename) {
this.interval = interval;
this.filename = filename;
}
public String grabId() {
File file = new File(this.filename);
Scanner reader;
String id = new String();
try {
reader = new Scanner(file);
while(reader.hasNextLine()) {
id = reader.nextLine();
}
reader.close();
}catch (FileNotFoundException e) {
System.err.println("File not found");
}
return id;
}
public void run() {
this.id = this.grabId(); //replace with correct filename
while(true) {
String new_id = this.grabId();
if(!new_id.equals(this.id)) {
System.exit(0);
}
try {
sleep(this.interval);
}catch (Exception e) {
System.err.println(e.getMessage());
}
}
}
}
}