Skip to content

Commit

Permalink
Merge pull request #1 from ZrdJ/develop
Browse files Browse the repository at this point in the history
Building first test version 3.8.0.1
  • Loading branch information
codejanovic authored Apr 20, 2024
2 parents fc16d38 + c613f97 commit 77d73fe
Show file tree
Hide file tree
Showing 49 changed files with 1,677 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
33 changes: 33 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on: [ push, pull_request ]

jobs:
build:
name: Build for JDK ${{ matrix.java }}
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'zrdj/javachord' }}
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 17, 21 ]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B -U compile test --file pom.xml
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
77 changes: 76 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,76 @@
# Javachord
[![License](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)]()
[![](https://jitpack.io/v/ZrdJ/javachord.svg)](https://jitpack.io/#ZrdJ/javachord)
![GitHub Workflow Status (branch)](https://github.com/zrdj/javachord/actions/workflows/maven.yml/badge.svg)

# Javachord

This library aims to provide a typed wrapper for creating Application Commands and Message Components using extendable
class structures.

## Maven
Add the Jitpack repository to your build file

```xml

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
```

Release artifact

```xml

<dependency>
<groupId>com.github.zrdj</groupId>
<artifactId>javachord</artifactId>
<version>3.8.0.1</version>
</dependency>
```

# Versioning

As this library is tied directly to [Javacord](https://github.com/Javacord/Javacord), packages will be released based on
the version of [Javacord](https://github.com/Javacord/Javacord) and extended by an additional build version, which will
only indicate that something in this library has changed.
So for the version `3.8.0` of [Javacord](https://github.com/Javacord/Javacord), this library will be released in
version `3.8.0.X`. This library will always release a matching version
of [Javacord](https://github.com/Javacord/Javacord), even if there are no changes to this libraries code.

# Basic Usage

Make sure you register the current DiscordApi with Javachord by using `Javachord.Instance.Get.register()` method as in
the example below

```java
...
private DiscordApi _discord;
private final String _token = System.getProperty("token");
private final long _serverId = Long.parseLong(System.getProperty("serverId"));

public void start() {
_discord = new DiscordApiBuilder()
.setToken(_token)
.setIntents(
Intent.GUILDS
, Intent.GUILD_MEMBERS
, Intent.GUILD_MESSAGES
, Intent.GUILD_BANS
, Intent.GUILD_INVITES
, Intent.GUILD_PRESENCES
, Intent.MESSAGE_CONTENT
)
.login()
.join()
;
var server = _discord.getServerById(_serverId).get();
Javachord.Instance.Get.register(_discord, server);
System.out.printf("Discord bot successfully initialized with ID %s%n", _discord.getYourself().getIdAsString());
}
...
```

Javachord components will register themselves globally as soon as they get created.
71 changes: 71 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>

<groupId>com.github.zrdj</groupId>
<artifactId>javachord</artifactId>
<version>3.8.0.1</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- Sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.javacord</groupId>
<artifactId>javacord</artifactId>
<version>3.8.0</version>
<type>pom</type>
</dependency>
</dependencies>


</project>
Loading

0 comments on commit 77d73fe

Please sign in to comment.