From 725682a180228c1187318a7d59066a0af52e02a8 Mon Sep 17 00:00:00 2001 From: OllieJW <71931263+OllieJW@users.noreply.github.com> Date: Fri, 18 Jun 2021 16:43:46 +0100 Subject: [PATCH] Updated README.md Added API instructions --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index 9c59700..53e4dc8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,39 @@ # CmdWebhooks CmdWebhooks Logs all Joins, Leaves, Commands, Chat and more to your Discord server using webhooks! + +# API +**Make the event: (If you arent using events, skip this)** +In this example we will make a Votifier Logger! +``` +import com.vexsoftware.votifier.model.VotifierEvent; + +@EventHandler +public void onVote(VotifierEvent event) { + +} +``` + +**Use CmdWebhooks:** +``` +// Get our webhook link ready +SendWebhook webhook = new SendWebhook("WEBHOOK_LINK"); + +// Get our Content Ready +webhook.setContent("Message to send to Discord"); + +// Sending our Message (Embed it in a try/catch) +try { + webhook.execute(); +} catch(Exception e){ + System.out.println("ERROR SENDING VOTE WEBHOOK!!!"); +} +``` + +**Register our event: (Main Class)** +``` +@Override +public void onEnable() { + this.getServer().getPluginManager().registerEvents(new VoteEvent(), this); +} +``` +