-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 88e3d69
Showing
24 changed files
with
1,260 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Eduardo Mateus | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
Para documentação em português, consulte o [README em Português](docs/README.pt.md). | ||
# Discord Webhook Java Library | ||
|
||
![JitPack](https://img.shields.io/jitpack/version/com.github.eduardomcb/discord-webhook) | ||
![GitHub](https://img.shields.io/github/license/eduardomcb/discord-webhook) | ||
|
||
This is a Java library that simplifies the process of sending messages to Discord webhooks. It offers an easy way to integrate Discord channel messages into your Java projects. | ||
|
||
## Table of Contents | ||
|
||
- [Installation](#installation) | ||
- [Getting Started](#getting-started) | ||
- [Usage](#usage) | ||
- [Contributions](#contributions) | ||
- [License](#license) | ||
|
||
## Installation | ||
|
||
To install this library, follow the steps below: | ||
|
||
### Step 1/2: Add this to your `pom.xml` file: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.github.eduardomcb</groupId> | ||
<artifactId>discord-webhook</artifactId> | ||
<version>1.0.0</version> | ||
</dependency> | ||
``` | ||
|
||
### Step 2/2: Execute via the command line | ||
|
||
Open the terminal and execute the following command: | ||
|
||
```bash | ||
$ mvn install | ||
``` | ||
|
||
## Getting Started | ||
|
||
To get started, create a Discord webhook URL that you can use to send messages. You can do this by following these steps: | ||
|
||
1. Open Discord and go to the server or channel where you want to send messages. | ||
2. Click on "Server Settings" or "Channel Settings." | ||
3. In the left sidebar, click on "Integrations." | ||
4. Click the "Create Webhook" button and follow the prompts to create your webhook URL. | ||
|
||
## Usage | ||
|
||
Here's a basic example of how to use this library to send a message to a Discord webhook: | ||
|
||
```java | ||
// Create a simple message | ||
Message message = new Message() | ||
.setContent("Hello, world!"); | ||
|
||
// Create a WebhookManager object and configure it | ||
WebhookManager webhookManager = new WebhookManager() | ||
.setChannelUrl("YOUR_WEBHOOK_URL_HERE") | ||
.setMessage(message); | ||
|
||
// Send the message and handle the response | ||
webhookManager.setListener(new WebhookClient.Callback() { | ||
@Override | ||
public void onSuccess(String response) { | ||
System.out.println("Message sent successfully"); | ||
} | ||
|
||
@Override | ||
public void onFailure(int statusCode, String errorMessage) { | ||
System.out.println("Code: " + statusCode + " error: " + errorMessage); | ||
} | ||
}); | ||
|
||
webhookManager.exec(); | ||
``` | ||
|
||
Replace `"YOUR_WEBHOOK_URL_HERE"` with the actual webhook URL you created. | ||
|
||
## Contributions | ||
|
||
If you'd like to contribute to the development of this library, feel free to open an [issue](https://github.com/eduardomcb/discord-webhook/issues) or submit a [pull request](https://github.com/eduardomcb/discord-webhook/pulls) on GitHub. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'maven-publish' | ||
} | ||
|
||
group = 'com.github.eduardomcb' | ||
version = '1.0.0' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
dependencies { | ||
testImplementation platform('org.junit:junit-bom:5.9.1') | ||
testImplementation 'org.junit.jupiter:junit-jupiter' | ||
implementation 'org.json:json:20230227' | ||
} | ||
|
||
jar { | ||
duplicatesStrategy(DuplicatesStrategy.EXCLUDE) | ||
|
||
manifest { | ||
attributes "Main-Class": "com.eduardomcb.discord.webhook.Main" | ||
} | ||
|
||
from { | ||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } | ||
} | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = "https://maven.pkg.github.com/eduardomcb/discord-webhook" | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
|
||
|
||
publications { | ||
maven(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
For English documentation, please see the [English README](README.md). | ||
# Biblioteca Java para Webhooks do Discord | ||
|
||
![JitPack](https://img.shields.io/jitpack/version/com.github.eduardomcb/discord-webhook) | ||
![GitHub](https://img.shields.io/github/license/eduardomcb/discord-webhook) | ||
|
||
Esta é uma biblioteca Java que simplifica o processo de envio de mensagens para webhooks do Discord. Ela oferece uma maneira fácil de integrar mensagens de canal do Discord em seus projetos Java. | ||
|
||
## Sumário | ||
|
||
- [Instalação](#instalação) | ||
- [Começando](#começando) | ||
- [Uso](#uso) | ||
- [Contribuições](#contribuições) | ||
- [Licença](#licença) | ||
|
||
## Instalação | ||
|
||
Para instalar esta biblioteca, siga os passos abaixo: | ||
|
||
### Passo 1/2: Adicione isso ao seu arquivo `pom.xml`: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.github.eduardomcb</groupId> | ||
<artifactId>discord-webhook</artifactId> | ||
<version>1.0.0</version> | ||
</dependency> | ||
``` | ||
|
||
### Passo 2/2: Execute via linha de comando | ||
|
||
Abra o terminal e execute o seguinte comando: | ||
|
||
```bash | ||
$ mvn install | ||
``` | ||
|
||
## Começando | ||
|
||
Para começar, crie uma URL de webhook do Discord que você possa usar para enviar mensagens. Você pode fazer isso seguindo estas etapas: | ||
|
||
1. Abra o Discord e vá para o servidor ou canal onde deseja enviar mensagens. | ||
2. Clique em "Configurações do Servidor" ou "Configurações do Canal". | ||
3. Na barra lateral esquerda, clique em "Integrações". | ||
4. Clique no botão "Criar Webhook" e siga as instruções para criar sua URL de webhook. | ||
|
||
## Uso | ||
|
||
Aqui está um exemplo básico de como usar esta biblioteca para enviar uma mensagem para um webhook do Discord: | ||
|
||
```java | ||
// Crie uma mensagem simples | ||
Message message = new Message() | ||
.setContent("Hello, world!"); | ||
|
||
// Crie um objeto WebhookManager e configure-o | ||
WebhookManager webhookManager = new WebhookManager() | ||
.setChannelUrl("SUA_URL_DE_WEBHOOK_AQUI") | ||
.setMessage(message); | ||
|
||
// Envie a mensagem e lide com a resposta | ||
webhookManager.setListener(new WebhookClient.Callback() { | ||
@Override | ||
public void onSuccess(String response) { | ||
System.out.println("Mensagem enviada com sucesso"); | ||
} | ||
|
||
@Override | ||
public void onFailure(int statusCode, String errorMessage) { | ||
System.out.println("Código: " + statusCode + " erro: " + errorMessage); | ||
} | ||
}); | ||
|
||
webhookManager.exec(); | ||
``` | ||
|
||
Substitua `"SUA_URL_DE_WEBHOOK_AQUI"` pela URL de webhook real que você criou. | ||
|
||
## Contribuições | ||
|
||
Se você deseja contribuir para o desenvolvimento desta biblioteca, sinta-se à vontade para abrir uma [issue](https://github.com/eduardomcb/discord-webhook/issues) ou enviar um [pull request](https://github.com/eduardomcb/discord-webhook/pulls) no GitHub. | ||
|
||
## Licença | ||
|
||
Este projeto está licenciado sob a Licença MIT - consulte o arquivo [LICENSE](LICENSE) para obter detalhes. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Mon May 29 19:10:41 BRT 2023 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.