labymod / discord-webhook Goto Github PK
View Code? Open in Web Editor NEWA lightweight library for Discord™ Webhooks
Home Page: https://packagist.org/packages/labymod/discord-webhook
License: MIT License
A lightweight library for Discord™ Webhooks
Home Page: https://packagist.org/packages/labymod/discord-webhook
License: MIT License
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Add a fluent interface to build messages/embeds. Similar to the symfony config-definition builder.
The benefit would be that you can better see how the messages would look like when they're being sent and it makes building complex embeds easier (and cooler) I guess.
Could look something like this:
$builder = new WebhookBuilder();
$builder
->embeds()
->embed()
->title('embed ONE title')
->timestamp(new \DateTime())
->fields()
->field()
->name('field title')
->value('some field value')
->end()
->end()
->end()
->embed()
->title('embed TWO title')
->author()
->name('scrummer')
->iconUrl('https://my.icon.url/icon.jpg')
->end()
-> end()
->end()
;
$builder->send();
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Create a symfony bundle with or within this library.
Goals are:
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Make it possible to add message components like actions, buttons, etc.
@see https://discord.com/developers/docs/interactions/message-components#component-object
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Goal is to create a external repo for a Symfony bundle to easily integrate discord webhooks into any symfony application.
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | - |
Currently it is quite an overhead to create simple webhooks. Even the simplest ones require at least this boilerplate:
$webhook = new Webhook('your very long webhook url here');
$webhook->setMessage('My cool message');
$webhook->send();
New class: SimpleWebhook
You are able to set the default url in two ways:
DWH_DEFAULT_URL=https://xy
SimpleWebhook::setDefaultUrl('xy');
Then, in your application it is as simple as this to send basic webhooks with text-messages:
\DiscordWebhook\SimpleWebhook::sendMessage('my message');
SimpleWebhook
class with static APIQ | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Configure & send messages with embeds to a given discord channel
Unlike the old library (Webhooks) we want to design the interface to create embeds less painful.
An option would be to create a universal embed class and configure the type with constants.
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Make the constructor accept a string OR an array of webhook URLs.
Currently you have to pack also a single URL into an array even if you do not intend to use more than one URL.
// OLD:
new \DiscordWebhook\Webhook(['https://discord.com/webhook/url']);
// NEW, these two options:
new \DiscordWebhook\Webhook(['https://discord.com/webhook/url']);
new \DiscordWebhook\Webhook('https://discord.com/webhook/url');
// ofc. if you want more WHs just add them to the array:
new \DiscordWebhook\Webhook([
'https://discord.com/webhook/url/one',
'https://discord.com/webhook/url/two',
'https://discord.com/webhook/url/three'
]);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.