{"id":15143584,"url":"https://github.com/cortexpe/discordwebhookapi","last_synced_at":"2025-08-18T01:36:30.613Z","repository":{"id":43210353,"uuid":"162234790","full_name":"CortexPE/DiscordWebhookAPI","owner":"CortexPE","description":"A PocketMine-MP Virion to easily send messages via Discord Webhooks","archived":false,"fork":false,"pushed_at":"2023-11-04T02:17:29.000Z","size":59,"stargazers_count":53,"open_issues_count":11,"forks_count":28,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-06T19:48:39.226Z","etag":null,"topics":["api","discord-js","discordapp","pocketmine-mp","pocketmine-mp-virion","virion"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CortexPE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-18T05:27:46.000Z","updated_at":"2025-01-22T14:50:27.000Z","dependencies_parsed_at":"2025-02-08T22:32:11.937Z","dependency_job_id":"5e4e4efd-4456-4258-a92b-037e8d3f9702","html_url":"https://github.com/CortexPE/DiscordWebhookAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CortexPE/DiscordWebhookAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CortexPE%2FDiscordWebhookAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CortexPE%2FDiscordWebhookAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CortexPE%2FDiscordWebhookAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CortexPE%2FDiscordWebhookAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CortexPE","download_url":"https://codeload.github.com/CortexPE/DiscordWebhookAPI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CortexPE%2FDiscordWebhookAPI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270932581,"owners_count":24670241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","discord-js","discordapp","pocketmine-mp","pocketmine-mp-virion","virion"],"created_at":"2024-09-26T10:02:05.807Z","updated_at":"2025-08-18T01:36:30.560Z","avatar_url":"https://github.com/CortexPE.png","language":"PHP","readme":"\u003ch1\u003eDiscordWebhookAPI\u003cimg src=\"https://raw.githubusercontent.com/CortexPE/DiscordWebhookAPI/master/dwapi.png\" height=\"64\" width=\"64\" align=\"left\"\u003e\u003c/img\u003e\u0026nbsp;\u003cimg src=\"https://poggit.pmmp.io/ci.shield/CortexPE/DiscordWebhookAPI/~\"\u003e\u003c/img\u003e\u003c/h1\u003e\n\u003cbr /\u003e\n\nA PocketMine-MP Virion to easily send messages via Discord Webhooks\n\n# Usage:\nInstallation is easy, you may get a compiled phar [here](https://poggit.pmmp.io/ci/CortexPE/DiscordWebhookAPI/~) or integrate the virion itself into your plugin.\n\nThis virion is purely object oriented. So, to use it you'll have to import the `Webhook` object, the `Message` object and the optional `Embed` object (if necessary)\n\n## Basic Usage:\n### Import the classes\nYou'll need to import these classes in order to easily use it within our code.\n```php\n\u003c?php\n\nuse CortexPE\\DiscordWebhookAPI\\Message;\nuse CortexPE\\DiscordWebhookAPI\\Webhook;\nuse CortexPE\\DiscordWebhookAPI\\Embed; // optional\n```\n### Construct a Discord `Webhook` object\nYou'll need the Webhook's URL. For more information regarding how to create Discord webhooks on a Discord Text Channel, Please [click here](https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks).\n```php\n$webHook = new Webhook(\"YOUR WEBHOOK URL\");\n```\n### Construct a Discord `Message` object\nYou'll need to create a new `Message` object for every message that you want to send... You can use different message objects for separate webhooks and this object **DOES NOT** depend on the `Webhook` object. It is stand-alone and it would work by itself.\n```php\n$msg = new Message();\n$msg-\u003esetUsername(\"USERNAME\"); // optional\n$msg-\u003esetAvatarURL(\"https://cortexpe.xyz/utils/kitsu.png\"); // optional\n$msg-\u003esetContent(\"INSERT TEXT HERE\"); // optional. Maximum length is 2000 characters, the limit is set by discord, therefore it is not hardcoded within this API\n```\n### Sending the message\nYou can easily send the message to the webhook now! :tada: This will schedule a new AsyncTask on the Server's AsyncPool to prevent blocking the Main Thread. Do take note however, that **you CANNOT send a blank message.** doing so will only produce an error received from Discord itself.\n```php\n$webHook-\u003esend($msg);\n```\nHow easy was that? ^-^ Now for the much more advanced and cooler stuff, Embeds!\n### Embeds\nBefore you send the message, you might want to add an embed. A message can have several embeds in it! You only have to construct an embed and use the `Message-\u003eaddEmbed()` method to add it into the message object.\n```php\n$embed = new Embed();\n```\nNow, the embed has to have something in it to function properly, so we'll add in a title (optional) and a description (optional). **All of the fields are optional, but it should contain ATLEAST one field or it would refuse to add it into the message**\n```php\n$embed-\u003esetTitle(\"Embed Title Here\");\n$embed-\u003esetDescription(\"A very awesome description\");\n```\nWe can even set a footer text! The text on the bottom part of the embeds...\n```php\n$embed-\u003esetFooter(\"Erin is kawaii UwU\");\n```\nOr even, add an icon to the footer...\n```php\n$embed-\u003esetFooter(\"Erin is kawaii UwU\",\"https://cortexpe.xyz/utils/kitsu.png\");\n```\nNow that the embed has been constructed and has a valid content, we will have to add it to the `Message` object... We'll need to use the `Message-\u003eaddEmbed()` method for that.\n```php\n$msg-\u003eaddEmbed($embed);\n```\n**That's all for the Basic Usage of the API. To learn more, You can explore it by reading the API's source code yourself (the code is simple and explanatory) or by using your favorite IDE to index it yourself. :3**\n# Sample Code used to test this API earlier:\n```php\n// Construct a discord webhook with its URL\n$webHook = new Webhook(\"YOUR WEBHOOK URL\");\n\n// Construct a new Message object\n$msg = new Message();\n\n$msg-\u003esetUsername(\"USERNAME\");\n$msg-\u003esetAvatarURL(\"https://cortexpe.xyz/utils/kitsu.png\");\n$msg-\u003esetContent(\"INSERT TEXT HERE\");\n\n// Create an embed object with #FF0000 (RED) as the embed's color and \"EMBED 1\" as the title\n$embed = new Embed();\n$embed-\u003esetTitle(\"EMBED 1\");\n$embed-\u003esetColor(0xFF0000);\n$msg-\u003eaddEmbed($embed);\n\n$embed = new Embed();\n$embed-\u003esetTitle(\"EMBED 2\");\n$embed-\u003esetColor(0x00FF00);\n$embed-\u003esetAuthor(\"AUTHOR\", \"https://CortexPE.xyz\", \"https://cortexpe.xyz/utils/kitsu.png\");\n$embed-\u003esetDescription(\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\");\n$msg-\u003eaddEmbed($embed);\n\n$embed = new Embed();\n$embed-\u003esetTitle(\"EMBED 3\");\n$embed-\u003esetColor(0x0000FF);\n$embed-\u003eaddField(\"FIELD ONE\", \"Some text here\");\n$embed-\u003eaddField(\"FIELD TWO\", \"Some text here\", true);\n$embed-\u003eaddField(\"FIELD THREE\", \"Some text here\", true);\n$embed-\u003esetThumbnail(\"https://cortexpe.xyz/utils/kitsu.png\");\n$embed-\u003esetImage(\"https://cortexpe.xyz/utils/kitsu.png\");\n$embed-\u003esetFooter(\"Erin is kawaii UwU\",\"https://cortexpe.xyz/utils/kitsu.png\");\n$msg-\u003eaddEmbed($embed);\n\n$webHook-\u003esend($msg);\n```\n-----\n**This API was made with :heart: by CortexPE, Enjoy!~ :3**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcortexpe%2Fdiscordwebhookapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcortexpe%2Fdiscordwebhookapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcortexpe%2Fdiscordwebhookapi/lists"}