Skip to content

Commit 635508d

Browse files
committed
Added property Message.IsServiceMessage
1 parent b8f0748 commit 635508d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
JSON: |
5656
{
5757
"status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }},
58-
"message": "{ \"commitId\": \"${{ github.event.head_commit.id }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"teamProjectName\": \"${{ github.event.repository.name }}\"}"
58+
"message": "{ \"commitId\": \"${{ github.sha }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"repoName\": \"${{ github.repository }}\"}"
5959
}
6060
run: |
6161
curl -X POST -H "Content-Type: application/json" -d "$JSON" ${{ secrets.DEPLOYED_WEBHOOK }}

src/Telegram.Bot/Extend.Types.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ public partial class Message
4949
? $"https://t.me/c/{(-1000000000000 - Chat.Id).ToString(CultureInfo.InvariantCulture)}/{Id.ToString(CultureInfo.InvariantCulture)}"
5050
: $"https://t.me/{Chat.Username}/{Id.ToString(CultureInfo.InvariantCulture)}"
5151
: null;
52+
53+
/// <summary><see langword="true"/> if it's a service message, <see langword="false"/> if it's a content message</summary>
54+
[JsonIgnore]
55+
public bool IsServiceMessage => this switch
56+
{
57+
{ Text: { } } or { Animation: { } } or { Audio: { } } or { Document: { } } or { PaidMedia: { } } or
58+
{ Photo: { } } or { Sticker: { } } or { Story: { } } or { Video: { } } or { VideoNote: { } } or { Voice: { } } or
59+
{ Contact: { } } or { Dice: { } } or { Game: { } } or { Poll: { } } or { Venue: { } } or { Location: { } } or
60+
{ Invoice: { } } or { Giveaway: { } } or { GiveawayWinners: { } } => false,
61+
_ => true
62+
};
5263
}
5364

5465
public partial class Chat

0 commit comments

Comments
 (0)