Skip to content

Ceymikeydev/InjectionLib

 
 

Repository files navigation

License Contributors Issues Discord

Discord webhooks java

Implementing

How to add the library to your project. Its available for both maven and gradle

Gradle implementation

repositories {
    maven { url "https://repo.ceymikey.dev/releases" }
}

dependencies {
    implementation "dev.ceymikey:injectionlib:{VERSION}"
}

Maven implementation

<repositories>
    <repository>
        <id>ceymikey-releases</id>
        <url>https://repo.ceymikey.dev/releases</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>dev.ceymikey</groupId>
        <artifactId>injectionlib</artifactId>
        <version>{VERSION}</version>
    </dependency>
</dependencies>

Basic usage

Basic usage of the library in your projects code. The library provides you an option to build an embed using the EmbedBuilder class and choose when to send it using the inject method call.

package com.example.test;

import dev.ceymikey.injection.EmbedBuilder;
import dev.ceymikey.injection.DiscordPayload;

public class TestClass {
    public void testMethod() {
        /* Use the EmbedBuilder class to build a new embed */
        /* with the correct properties */
        EmbedBuilder builder = new EmbedBuilder.Construct()
                .setUrl("WEBHOOK_URL")
                .setTitle("This is a test embed title!")
                .setDescription("This is a test embed description!")
                .setColor(12370112) // Gray color (RGB)
                .setFooter("Small text at the bottom of the embed")
                .build();
        /* This sends the actual embed */
        /* This gives you the freedom to build the embed early */
        /* and send it later on in your code whenever you want */
        DiscordPayload.inject(builder);
    }
}

Result

This will be the result of our code after calling the testMethod with the correct webhook url.

About

A library for sending json data to a discord webhook in java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%