diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96bbc97..2a5115d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/libasynDiscordWebHook-API/pom.xml b/libasynDiscordWebHook-API/pom.xml index 3bc8f8a..056406d 100644 --- a/libasynDiscordWebHook-API/pom.xml +++ b/libasynDiscordWebHook-API/pom.xml @@ -5,7 +5,7 @@ com.ialdrich23xx libasynwebhook - 1.0.1 + 1.1.0 com.ialdrich23xx.libasynwebhook.api diff --git a/libasynDiscordWebHook-API/src/main/java/com/ialdrich23xx/libasynwebhook/api/discord/body/Base.java b/libasynDiscordWebHook-API/src/main/java/com/ialdrich23xx/libasynwebhook/api/discord/body/Base.java index 551b04d..5938a7c 100644 --- a/libasynDiscordWebHook-API/src/main/java/com/ialdrich23xx/libasynwebhook/api/discord/body/Base.java +++ b/libasynDiscordWebHook-API/src/main/java/com/ialdrich23xx/libasynwebhook/api/discord/body/Base.java @@ -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 { @@ -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 embeds = new ArrayList<>(); @@ -78,6 +78,22 @@ public List 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; @@ -105,6 +121,8 @@ public Map toArray() { result.put("embeds", embedList.toArray()); } + if (this.isForum()) result.put("thread_name", this.getForumTitle()); + return result; } diff --git a/libasynDiscordWebHook-PM/src/ialdrich23xx/libasynwebhook/discord/body/Base.php b/libasynDiscordWebHook-PM/src/ialdrich23xx/libasynwebhook/discord/body/Base.php index 94d1766..674d12e 100644 --- a/libasynDiscordWebHook-PM/src/ialdrich23xx/libasynwebhook/discord/body/Base.php +++ b/libasynDiscordWebHook-PM/src/ialdrich23xx/libasynwebhook/discord/body/Base.php @@ -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 = []; @@ -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; @@ -125,6 +143,8 @@ public function toArray(): array } } + if ($this->isForum()) $result["thread_name"] = $this->getForumTitle(); + return $result; } diff --git a/libasynDiscordWebHook-PM/virion.yml b/libasynDiscordWebHook-PM/virion.yml index fb4c0a1..dbea01c 100644 --- a/libasynDiscordWebHook-PM/virion.yml +++ b/libasynDiscordWebHook-PM/virion.yml @@ -1,5 +1,5 @@ name: libasynWebHook antigen: ialdrich23xx\libasynwebhook api: 4.0.0 -version: 1.0.1 +version: 1.1.0 author: iAldrich23xX \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3c78a83..ccb6b9f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.ialdrich23xx libasynwebhook - 1.0.1 + 1.1.0 pom