Skip to content

micartey/webhookly

Repository files navigation

webhookly

📚 Introduction

webhookly is a Java dependency to send messages via discord webhooks. The work has already been done by k3kdude and just been refactored. The following example allows you to send a message to a channel.

Motivation

DiscordWebhook is currently only a gist and a single class. This is aweful for developers and everyone who wants to use this as a dependency. I also didn't like the code-style. Therefore, I refactored it.

🚀 Getting Started

Firstly, you should add the dependency to your dependency file. You can do this by either building it yourself OR (recommended) use Jitpack: https://jitpack.io/#micartey/webhookly/master-SNAPSHOT

Afterward, you can send a message as follows:

DiscordWebhook webhook = new DiscordWebhook(...);
webhook.setAvatarUrl(...);
webhook.setUsername("Some Name");

EmbedObject embed = new EmbedObject()
        .setTitle("A Title")
        .setColor(new Color(174, 63 ,65))
        .setDescription("Line 1 \\n Line 2")
        .setFooter(new Footer("A Footer", ""));

webhook.getEmbeds().add(embed);
webhook.execute();