Skip to content

Small library for sending custom webhook messages to Discord

License

Notifications You must be signed in to change notification settings

7orivorian/DWIJ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Webhook Interface for Java

GitHub all releases GitHub release (latest SemVer)

DWIJ makes sending custom webhook messages to Discord simple and painless.

Features

  • Customize every aspect of your messages, including username, content, avatar, embeds, links, and more!
  • Small size allows for seamless integration with your project <3

Importing

Maven

  • Include JitPack in your maven build file
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
  • Add DWIJ as a dependency
<dependency>
    <groupId>com.github.7orivorian</groupId>
    <artifactId>DWIJ</artifactId>
    <version>1.0.1</version>
</dependency>

Gradle

  • Add JitPack to your root build.gradle at the end of repositories
repositories {
    maven {
        url 'https://jitpack.io'
    }
}
  • Add the dependency
dependencies {
    implementation 'com.github.7orivorian:DWIJ:1.0.1'
}

Other

Use a .jar file from releases

Building

  • Clone this repository
  • Run mvn package

Packaged jar file can be found in the ./target/ directory.

Usage

class Main {
    public static void main(String[] args) {

        // Define urls to keep your code pretty ;P
        String webhookUrl = "<your_webhook_url_here>";
        String avatarUrl = "<your_avatar_url_here>";

        // Construct your fantastic message!
        WebhookMessage message = new WebhookMessage(webhookUrl)
                .withAvatar(avatarUrl)
                .withUsername("Happy boi")
                .withContent("Hello world!")
                .withTts(false)
                .withEmbed(
                        new Embed()
                                .withTitle("My embed title!")
                                .withUrl("https://github.com/7orivorian")
                                .withDescription("cute lil guyyy")
                                .withImage("https://i.pinimg.com/originals/1b/34/7c/1b347cf538cf2099ed59d88a68c312b9.jpg")
                                .withFooter("Powered by 7orivorian <3", "https://avatars.github.com/u/61598620?v=4")
                                .withColor(new Color(0x00EEFF))
                );

        // Send your message to all your friends :D
        try {
            message.execute();
        } catch (IOException e) {
            // Catch any exceptions for bug-squashing ease :>
            e.printStackTrace();
        }
    }
}

Created and maintained by 7orivorian.