Last active
February 20, 2025 18:10
-
-
Save quanticc/a32fa8f3a57f98aee9dc9e935f851e72 to your computer and use it in GitHub Desktop.
Discord4J with Maven or Gradle https://github.com/austinv11/Discord4J
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'java' | |
id 'idea' | |
// Allows running "gradle shadowJar" to create an executable JAR of your project | |
id 'com.github.johnrengelman.shadow' version '2.0.0' | |
} | |
// You should edit these to your case | |
group 'example' | |
version '1.0.0' | |
sourceCompatibility = 1.8 | |
repositories { | |
jcenter() | |
maven { | |
url "https://jitpack.io" | |
} | |
} | |
dependencies { | |
compile "com.github.austinv11:Discord4j:2.9.3" | |
// Allows you to log events from Discord4J | |
compile "ch.qos.logback:logback-classic:1.2.3" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- This file is not essential but helps to get you used to logback --> | |
<!-- Put this file under src/main/resources folder --> | |
<configuration scan="true"> | |
<!-- Avoid logger spam from web socket --> | |
<logger name="org.eclipse.jetty" level="INFO"/> | |
<!-- Configure Discord4J logger level --> | |
<logger name="sx.blah.discord.Discord4J" level="DEBUG"/> | |
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder> | |
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
</encoder> | |
</appender> | |
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
<fileNamePattern>logs/bot.%d{yyyy-MM-dd}.log</fileNamePattern> | |
<maxHistory>90</maxHistory> | |
</rollingPolicy> | |
<encoder> | |
<charset>UTF-8</charset> | |
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-40.40logger{39} : %msg%n</Pattern> | |
</encoder> | |
<prudent>true</prudent> | |
</appender> | |
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> | |
<queueSize>512</queueSize> | |
<appender-ref ref="FILE"/> | |
</appender> | |
<root level="debug"> | |
<appender-ref ref="CONSOLE"/> | |
<!-- Uncomment the next line to also log to a file --> | |
<!-- <appender-ref ref="ASYNC"/> --> | |
</root> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> | |
<!-- You should edit these to your case --> | |
<groupId>example</groupId> | |
<artifactId>bootstrap</artifactId> | |
<version>1.0.0</version> | |
<properties> | |
<maven.compiler.target>1.8</maven.compiler.target> | |
<maven.compiler.source>1.8</maven.compiler.source> | |
<maven.compiler.testTarget>1.8</maven.compiler.testTarget> | |
<maven.compiler.testSource>1.8</maven.compiler.testSource> | |
</properties> | |
<repositories> | |
<repository> | |
<id>jcenter</id> | |
<url>http://jcenter.bintray.com</url> | |
</repository> | |
<repository> | |
<id>jitpack.io</id> | |
<url>https://jitpack.io</url> | |
</repository> | |
</repositories> | |
<dependencies> | |
<dependency> | |
<groupId>com.github.austinv11</groupId> | |
<artifactId>Discord4J</artifactId> | |
<version>2.9.3</version> | |
</dependency> | |
<!-- Allows you to log events from Discord4J --> | |
<dependency> | |
<groupId>ch.qos.logback</groupId> | |
<artifactId>logback-classic</artifactId> | |
<version>1.2.3</version> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<!-- To create an executable fat JAR when using mvn package --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>3.0.0</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>shade</goal> | |
</goals> | |
<configuration> | |
<transformers> | |
<transformer | |
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | |
<mainClass>bootstrap.Main</mainClass> | |
</transformer> | |
</transformers> | |
<filters> | |
<filter> | |
<!-- | |
Exclude files that sign a jar | |
(one or multiple of the dependencies). | |
One may not repack a signed jar without | |
this, or you will get a | |
SecurityException at program start. | |
--> | |
<artifact>*:*</artifact> | |
<excludes> | |
<exclude>META-INF/*.SF</exclude> | |
<exclude>META-INF/*.RSA</exclude> | |
<exclude>META-INF/*.INF</exclude> <!-- This one may not be required --> | |
</excludes> | |
</filter> | |
</filters> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thnx fam