[Virion] A library that helps you use Discord Webhook

Overview

DiscordHelper

How to register Web Hook URL

How to register Web Hook URL

use NewThing\DiscordHelper\DiscordHelper;

DiscordHelper::setURL($YourWebHookURL);


EX)
protected function onLoad(): void
{
    DiscordHelper::setURL('https://discordapp.com/api/webhooks/kscwiqgdieidwowpsdwvdo');
    //It is not really web hook =)
}
How to send discorrd message

How to send discorrd message

use NewThing\DiscordHelper\DiscordHelper;
use NewThing\DiscordHelper\Message;

$msg = new Message($content);
DiscordHelper::send($embed->call());

Other funtions of Message

$msg->setBotName('HOOK BOT NAME CHANGE TEST');
$msg->setTTS(true or false);
How to send discord embed

How to send discord embed

use NewThing\DiscordHelper\DiscordHelper;
use NewThing\DiscordHelper\Embed;
use NewThing\DiscordHelper\EmbedColor;

$embed = new Embed($content);
$embed = new Embed('THIS IS TITLE', $color); //If you want to set custom color, you put hexdec( "6 digit color code" ) in $color
DiscordHelper::send($embed->call());

Other funtions of Message

$embed->setDescription("THIS IS DESCRIPTION");
$embed->setFooter('THIS IS FOOTER', $icon_url);
$embed->setImage($image_url);
$embed->setAuthor('THIS IS AUTHOR', $link);
$embed->addField('FIELD 1','THIS IS INLINE FIELD',true);
$embed->addField('FIELD 2','THIS IS OUTLINE FIELD',false);
$embed->setBotName('HOOK BOT NAME CHANGE TEST');
$embed->setTTS(true or false);
Embed color list

Color list

use NewThing\DiscordHelper\EmbedColor;

EmbedColor::DEFAULT;
EmbedColor::WHITE;
EmbedColor::AQUA;
EmbedColor::GREEN;
EmbedColor::BLUE;
EmbedColor::YELLOW;
EmbedColor::PURPLE;
EmbedColor::LUMINOUS_VIVID_PINK;
EmbedColor::FUCHSIA;
EmbedColor::GOLD;
EmbedColor::ORANGE;
EmbedColor::RED;
EmbedColor::GREY;
EmbedColor::NAVY;
EmbedColor::DARK_AQUA;
EmbedColor::DARK_GREEN;
EmbedColor::DARK_BLUE;
EmbedColor::DARK_PURPLE;
EmbedColor::DARK_VIVID_PINK;
EmbedColor::DARK_GOLD;
EmbedColor::DARK_ORANGE;
EmbedColor::DARK_RED;
EmbedColor::DARK_GREY;
EmbedColor::DARKER_GREY;
EmbedColor::LIGHT_GREY;
EmbedColor::DARK_NAVY;
EmbedColor::BLURPLE;
EmbedColor::GREYPLE;
EmbedColor::DARK_BUT_NOT_BLACK;
EmbedColor::NOT_QUITE_BLACK;
Example
<?php

declare(strict_types=1);

/**
 * @name Discord
 * @api 4.0.0
 * @version 0.1
 * @author MIN
 * @main Min\Discord
 */

namespace Min;

use NewThing\DiscordHelper\DiscordHelper;
use NewThing\DiscordHelper\Embed;
use NewThing\DiscordHelper\EmbedColor;
use NewThing\DiscordHelper\Message;
use pocketmine\plugin\PluginBase;

class Discord extends PluginBase
{
    protected function onLoad(): void
    {
        DiscordHelper::setURL('set your web hook url');
    }

    protected function onEnable(): void
    {
        $this->sendEmbed();
        $this->sendMessage();
    }

    private function sendEmbed(): void
    {
        $embed = new Embed('THIS IS TITLE', EmbedColor::RED);
        $embed->setBotName('HOOK BOT NAME CHANGE TEST');
        $embed->addField('FIELD 1', 'THIS IS INLINE FIELD 1', true);
        $embed->addField('FIELD 2', 'THIS IS INLINE FIELD 2', true);
        $embed->addField('FIELD 3', 'THIS IS INLINE FIELD 3', true);
        $embed->addField('FIELD 4', 'THIS IS INLINE FIELD 4', true);
        $embed->addField('FIELD 5', 'THIS IS INLINE FIELD 5', true);
        $embed->addField('FIELD 6', 'THIS IS INLINE FIELD 6', true);
        $embed->addField('FIELD 1', 'THIS IS OUTLINE FIELD 1', false);
        $embed->addField('FIELD 2', 'THIS IS OUTLINE FIELD 2', false);
        $embed->addField('FIELD 3', 'THIS IS OUTLINE FIELD 3', false);
        $embed->setDescription('THIS IS DESCRIPTION');
        $embed->setImage('https://cdn.discordapp.com/icons/903992974285869076/04401aecf133a04bd8c3efa678cecb2a.webp?size=96');
        $embed->setAuthor('THIS IS AUTHOR', 'https://github.com/MIN0707');
        $embed->setFooter('THIS IS FOOTER', 'https://cdn.discordapp.com/icons/903992974285869076/04401aecf133a04bd8c3efa678cecb2a.webp?size=96');
        DiscordHelper::send($embed->call());
    }

    private function sendMessage(): void
    {
        $message = new Message('THIS IS CONTENT');
        $message->setTTS(true);
        $message->setBotName('HOOK BOT NAME CHANGE TEST');
        DiscordHelper::send($message->call());
    }
}
You might also like...
Contact Form7 - KeepinCRM connector via Webhook

Contact Form7 - KeepinCRM connector Плагін для відправки даних з форм на Contact Form7 до KeepinCRM через Webhook. Встановлення Вивантажити плагін арх

A simple and fast pmmp js es6 promise virion

Promises A simple and fast pmmp js es6 promise virion Api usage these examples are in base injectable php these should be easily transferable. Example

A virion for PocketMine-MP.

libIPGeolocation A virion for PocketMine-MP. You can use this to get the geolocation of an IP from ip-api.com. Usage You can see some example in here:

PocketMine-MP virion for easy handling of ScoreBoard packets

PocketMine-MP virion for easy handling of ScoreBoard packets

InventoryUI - the PocketMine virion that implements the dummy inventory

InventoryUI This is the PocketMine virion that implements the dummy inventory. Differences from previous APIs Chests and other blocks are not placed.

A virion for PocketMine-MP to create and manage fake blocks

🧊 fakeblocks Create and manage fakeblocks Description: A virion for PocketMine-MP to create and manage fake blocks. This virion indicates to the clie

This is a clone of Discord's homepage built using Wordpress.
This is a clone of Discord's homepage built using Wordpress.

Discord-UI-Clone Description This is a clone of Discord's homepage built using Wordpress, it is configured to run on the Pantheon platform. Live Demo

Owner
We are develop @pmmp Plugins
null
Allow any Discord user to sign in to your website and save their discord user information for later use.

Simple Discord SSO ( Single Sign-On ) Requires at least: 5.0 Tested up to: 5.8.3 Stable tag: 1.0.2 Requires PHP: 7.4 License: GPLv2 or later License U

null 2 Oct 7, 2022
A Discord Webhook Application with the Coinbase API

Ein PHP-Skript um einen Kryptowährungspreis in Discord darzustellen. Installation Windows Voraussetzungen Docker vollständig installiert Discord und e

Nevah 3 Oct 15, 2022
An easy code to send messages on a discord text channel with webhook.

Status Webhook-Discord An easy code to send messages on a discord text channel with webhook. Don't forget to check the latest version of Webhook-Disco

Victor 1 Dec 3, 2021
DiscordLookup | Get more out of Discord with Discord Lookup! Snowflake Decoder, Guild List with Stats, Invite Info and more...

DiscordLookup Get more out of Discord with Discord Lookup! Snowflake Decoder, Guild List with Stats, Invite Info and more... Website Getting Help Tool

Felix 69 Dec 23, 2022
Laradeploy offers you to automate deployment using a GitHub webhook.

Introduction Laradeploy offers you to automate deployment using a GitHub webhook. Simple and fast just make a git push to GitHub deploy the new modifi

Gentrit Abazi 10 Feb 21, 2022
Receiver is a drop-in webhook handling library for Laravel.

Receiver Receiver is a drop-in webhook handling library for Laravel. Webhooks are a powerful part of any API lifecycle. Receiver aims to make handling

Adam Campbell 270 Jan 6, 2023
[virion] It Implements Simple Using Form Library System

SimpleForm [virion] It Implements Simple Using Form Library System How To Use First, declare the use statement. use AidenKR\SimpleForm\SimpleForm; use

Aiden 2 Sep 18, 2021
Cooldown Library (virion) for PocketMine-MP

libCooldown Cooldown Library (virion) for PocketMine-MP Example // libCooldown::newTimer(int $cooldown_time, bool $first_ignore = true): libCooldown;

null 4 Aug 9, 2022
UI virion (library) for PocketMine-MP plugins

Remark - Easy and Asynchronous Commands and Forms Quick Guide - Learn Remark by building a plugin. Install - Add Remark as a library to your plugin. E

DiamondStrider1 8 Jan 1, 2023
Provides simple interfaces to implement a webhook-based tweeting system

webhook-tweeter This package aims to provide simple interfaces to implement a webhook-based tweeting system. This can, for example, be used to tweet a

Ricardo Boss 2 May 7, 2022