Compare commits

...

9 Commits

Author SHA1 Message Date
BodgeMaster 0d9de0c289 finally everything figured out regarding the build system 2022-02-20 02:23:44 +01:00
BodgeMaster 0b907f74a2 more build tinkering 2022-02-20 02:02:22 +01:00
BodgeMaster a374ddeca0 still fixing build issues 2022-02-20 00:59:28 +01:00
BodgeMaster 4ac923ac47 trying to get this to build on the server 2022-02-20 00:19:08 +01:00
BodgeMaster 0502e345cf update project configuration 2022-02-19 20:37:24 +01:00
BodgeMaster 91fe6cc9da test bot 2022-02-19 20:35:57 +01:00
BodgeMaster e0e42f92d2 fetch bot token from an internal website 2022-02-19 20:34:50 +01:00
BodgeMaster c29c408295 initial eclipse maven setup 2022-02-19 20:17:41 +01:00
BodgeMaster baaebd25fe added UTC to the date string 2022-02-19 19:56:57 +01:00
6 changed files with 129 additions and 2 deletions

39
.classpath Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

1
.gitignore vendored
View File

@ -85,3 +85,4 @@ local.properties
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
/target/

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hacky-quizbot</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,10 +1,12 @@
#!/bin/bash
echo "Deploying Hacky Quizbot...
$(date "+%Y-%m-%d %I:%M:%S%p %:z")
$(date "+%Y-%m-%d %I:%M:%S%p UTC%:z")
================================================================================"
# actually do stuff here
# build the thing into a big jar with all the dependencies
mvn clean compile assembly:single
# TODO: Somehow tell a service that manages the bot to shut it down and replace it with the updated version?
echo "================================================================================
Done."

37
pom.xml Normal file
View File

@ -0,0 +1,37 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>linux.general</groupId>
<artifactId>hackyquizbot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Hacky-Quizbot</name>
<description>Just a quiz bot for Discord that started development in the later half of crunch week.</description>
<dependencies>
<dependency>
<groupId>org.javacord</groupId>
<artifactId>javacord</artifactId>
<version>3.4.0</version>
<type>pom</type>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>linux.general.hackyquizbot.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,25 @@
package linux.general.hackyquizbot;
import org.javacord.api.DiscordApi;
import org.javacord.api.DiscordApiBuilder;
public class Main {
public static void main(String[] args) {
// Insert your bot's token here
String token = args[0];
DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();
// Add a listener which answers with "Pong!" if someone writes "!ping"
api.addMessageCreateListener(event -> {
if (event.getMessageContent().equalsIgnoreCase("!ping")) {
event.getChannel().sendMessage("Pong!");
}
});
// Print the invite url of your bot
System.out.println("You can invite the bot by using the following url: " + api.createBotInvite());
}
}