-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessage.cs
84 lines (74 loc) · 2.07 KB
/
Message.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Slack
{
/// <summary>
/// Slack Message
/// </summary>
public class Message
{
/// <summary>
/// Optional attachment collection
/// </summary>
[JsonProperty(PropertyName = "attachments")]
public List<Attachment> Attachments { get; set; }
/// <summary>
/// Optional override of destination channel
/// </summary>
[JsonProperty(PropertyName = "channel")]
public string Channel { get; set; }
/// <summary>
/// Optional emoji displayed with the message
/// </summary>
[JsonProperty(PropertyName = "icon_emoji")]
public string IconEmoji { get; set; }
/// <summary>
/// Optional url for icon displayed with the message
/// </summary>
[JsonProperty(PropertyName = "icon_url")]
public Uri IconUrl { get; set; }
/// <summary>
/// Enable linkification of channel and usernames
/// </summary>
[JsonProperty(PropertyName = "linknames")]
public bool LinkNames { get; set; }
/// <summary>
/// Optional override markdown mode. Default: true
/// </summary>
[JsonProperty(PropertyName = "mrkdwn")]
public bool Mrkdwn { get; set; } = true;
/// <summary>
/// Parse mode <see cref="ParseMode"/>
/// </summary>
[JsonProperty(PropertyName = "parse")]
public string Parse { get; set; }
/// <summary>
/// This is the text that will be posted to the channel
/// </summary>
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }
/// <summary>
/// Optional override of the username that is displayed
/// </summary>
[JsonProperty(PropertyName = "username")]
public string Username { get; set; }
/// <summary>
/// Clone the <see cref="Message"/> to the new channel
/// </summary>
/// <param name="newChannel">The new channel.</param>
/// <returns>a <see cref="Message"/>.</returns>
public Message Clone(string newChannel = null)
{
return new Message
{
Attachments = Attachments,
Text = Text,
IconEmoji = IconEmoji,
IconUrl = IconUrl,
Username = Username,
Channel = newChannel ?? Channel
};
}
}
}