-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmbed.cs
130 lines (113 loc) · 3.75 KB
/
Embed.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace CSCordEmbedsHelper
{
[Serializable]
public class Embed
{
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("timestamp")]
public string Timestamp { get; set; }
[JsonProperty("color")]
public int Color { get; set; }
[JsonProperty("footer")]
public Footer Footer { get; set; }
[JsonProperty("image")]
public Image Image { get; set; }
[JsonProperty("thumbnail")]
public Thumbnail Thumbnail { get; set; }
[JsonProperty("video")]
public Video Video { get; set; }
[JsonProperty("provider")]
public Provider Provider { get; set; }
[JsonProperty("author")]
public Author Author { get; set; }
[JsonProperty("fields")]
public List<Field> Fields { get; set; } = new List<Field>();
[JsonIgnore]
private DiscordMessage MessageInstance { get; set; }
public Embed()
{
}
public Embed(DiscordMessage messageInstance)
{
MessageInstance = messageInstance;
}
public Embed SetTitle(string title)
{
Title = title;
return this;
}
public Embed SetDescription(string description)
{
Description = description;
return this;
}
public Embed SetUrl(string url)
{
Url = url;
return this;
}
public Embed SetTimestamp(DateTime time)
{
Timestamp = time.ToString("yyyy-MM-ddTHH:mm:ssZ");
return this;
}
public Embed SetColor(int color)
{
Color = color;
return this;
}
public Embed SetFooter(string text, string icon = null, string proxyIcon = null)
{
Footer = new Footer() { Text = text, Icon = icon, ProxyIcon = proxyIcon };
return this;
}
public Embed SetImage(string url, string height = null, string width = null, string proxyIcon = null)
{
Image = new Image() { Url = url, Height = height, Width = width, ProxyIcon = proxyIcon };
return this;
}
public Embed SetThumbnail(string url, string height = null, string width = null, string proxyIcon = null)
{
Thumbnail = new Thumbnail() { Url = url, Height = height, Width = width, ProxyIcon = proxyIcon };
return this;
}
public Embed SetVideo(string url, string height = null, string width = null, string proxyVideo = null)
{
Video = new Video { Url = url, Height = height, Width = width, ProxyVideo = proxyVideo };
return this;
}
public Embed SetProvider(string name, string url = null)
{
Provider = new Provider() { Name = name, Url = url };
return this;
}
public Embed SetAuthor(string name, string url = null, string icon = null, string proxyIcon = null)
{
Author = new Author() { Name = name, Icon = icon, ProxyIcon = proxyIcon, Url = url };
return this;
}
public Embed AddField(string key, string value, bool inline = false)
{
Fields.Add(new Field()
{
Key = key,
Value = value,
Inline = inline
});
return this;
}
public DiscordMessage Build()
{
return MessageInstance;
}
}
}