Skip to content

Commit

Permalink
[Release] add channel forum type & set title forum
Browse files Browse the repository at this point in the history
  • Loading branch information
AldrichGlyzck committed Apr 8, 2023
1 parent 564c177 commit dcb1cdf
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
name: Release v${{ env.VERSION }}
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
body: "The artifacts are kept up to date with the branch release."
body: "v1.1.0 define is channel of discord is forum & set title of 'post' forum"
commit: ${{ github.sha }}
allowUpdates: true
removeArtifacts: false
Expand Down
2 changes: 1 addition & 1 deletion libasynDiscordWebHook-API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.ialdrich23xx</groupId>
<artifactId>libasynwebhook</artifactId>
<version>1.0.1</version>
<version>1.1.0</version>
</parent>

<groupId>com.ialdrich23xx.libasynwebhook.api</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.ialdrich23xx.libasynwebhook.api.discord.body.embed.EmbedManager;
import com.ialdrich23xx.libasynwebhook.api.discord.body.embed.base.Structure;

import java.lang.reflect.Array;
import java.util.*;

public class Base extends Structure {
Expand All @@ -13,6 +12,7 @@ public class Base extends Structure {
private String username = null;
private String avatar = null;
private Boolean textToSpeech = false;
private String threadName = null;

private List<EmbedManager> embeds = new ArrayList<>();

Expand Down Expand Up @@ -78,6 +78,22 @@ public List<EmbedManager> getEmbeds() {
return this.embeds;
}

public Base setForumTitle(String forumTitle) {
this.threadName = forumTitle;

return this;
}

public String getForumTitle()
{
return this.threadName;
}

public Boolean isForum()
{
return this.threadName != null;
}

@Override
public Boolean build() {
if (this.getAvatar() != null && !Loader.getInstance().isValidUrl(this.getAvatar())) return false;
Expand Down Expand Up @@ -105,6 +121,8 @@ public Map<String, Object> toArray() {
result.put("embeds", embedList.toArray());
}

if (this.isForum()) result.put("thread_name", this.getForumTitle());

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Base extends Structure implements JsonSerializable
private ?string $username = null;
private ?string $avatar = null;
private bool $textToSpeech = false;
private ?string $threadName = null;

/** @var EmbedManager[] */
private array $embeds = [];
Expand Down Expand Up @@ -97,6 +98,23 @@ public function getEmbeds(): array
return $this->embeds;
}

public function setForumTitle(string $title): self
{
$this->threadName = $title;

return $this;
}

public function getForumTitle(): ?string
{
return $this->threadName;
}

public function isForum(): bool
{
return !is_null($this->threadName);
}

public function build(): bool
{
if (!is_null($this->getAvatar()) && !Loader::getInstance()->isValidUrl($this->getAvatar())) return false;
Expand Down Expand Up @@ -125,6 +143,8 @@ public function toArray(): array
}
}

if ($this->isForum()) $result["thread_name"] = $this->getForumTitle();

return $result;
}

Expand Down
2 changes: 1 addition & 1 deletion libasynDiscordWebHook-PM/virion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: libasynWebHook
antigen: ialdrich23xx\libasynwebhook
api: 4.0.0
version: 1.0.1
version: 1.1.0
author: iAldrich23xX
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.ialdrich23xx</groupId>
<artifactId>libasynwebhook</artifactId>
<version>1.0.1</version>
<version>1.1.0</version>

<packaging>pom</packaging>

Expand Down

0 comments on commit dcb1cdf

Please sign in to comment.