Made API models internal. Removed Discord.Net.API.
This commit is contained in:
9
src/Discord.Net.Core/Entities/Channels/Direction.cs
Normal file
9
src/Discord.Net.Core/Entities/Channels/Direction.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum Direction
|
||||
{
|
||||
Before,
|
||||
After,
|
||||
Around
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using Discord.API.Rest;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Discord
|
||||
public interface IMessageChannel : IChannel
|
||||
{
|
||||
/// <summary> Sends a message to this message channel. </summary>
|
||||
Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, EmbedBuilder embed = null, RequestOptions options = null);
|
||||
Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null);
|
||||
#if NETSTANDARD1_3
|
||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary>
|
||||
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, RequestOptions options = null);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Discord.API.Rest;
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Discord.API.Rest;
|
||||
using Discord.Audio;
|
||||
using Discord.Audio;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum DefaultMessageNotifications
|
||||
{
|
||||
/// <summary> By default, all messages will trigger notifications. </summary>
|
||||
AllMessages = 0,
|
||||
/// <summary> By default, only mentions will trigger notifications. </summary>
|
||||
MentionsOnly = 1
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.Emoji;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
@@ -14,7 +12,7 @@ namespace Discord
|
||||
public bool RequireColons { get; }
|
||||
public IReadOnlyList<ulong> RoleIds { get; }
|
||||
|
||||
private GuildEmoji(ulong id, string name, bool isManaged, bool requireColons, IReadOnlyList<ulong> roleIds)
|
||||
internal GuildEmoji(ulong id, string name, bool isManaged, bool requireColons, IReadOnlyList<ulong> roleIds)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
@@ -22,10 +20,6 @@ namespace Discord
|
||||
RequireColons = requireColons;
|
||||
RoleIds = roleIds;
|
||||
}
|
||||
internal static GuildEmoji Create(Model model)
|
||||
{
|
||||
return new GuildEmoji(model.Id.Value, model.Name, model.Managed, model.RequireColons, ImmutableArray.Create(model.Roles));
|
||||
}
|
||||
|
||||
public override string ToString() => Name;
|
||||
private string DebuggerDisplay => $"{Name} ({Id})";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Discord.API.Rest;
|
||||
using Discord.Audio;
|
||||
using Discord.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
10
src/Discord.Net.Core/Entities/Guilds/MfaLevel.cs
Normal file
10
src/Discord.Net.Core/Entities/Guilds/MfaLevel.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum MfaLevel
|
||||
{
|
||||
/// <summary> Users have no additional MFA restriction on this guild. </summary>
|
||||
Disabled = 0,
|
||||
/// <summary> Users must have MFA enabled on their account to perform administrative actions. </summary>
|
||||
Enabled = 1
|
||||
}
|
||||
}
|
||||
8
src/Discord.Net.Core/Entities/Guilds/PermissionTarget.cs
Normal file
8
src/Discord.Net.Core/Entities/Guilds/PermissionTarget.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum PermissionTarget
|
||||
{
|
||||
Role,
|
||||
User
|
||||
}
|
||||
}
|
||||
14
src/Discord.Net.Core/Entities/Guilds/VerificationLevel.cs
Normal file
14
src/Discord.Net.Core/Entities/Guilds/VerificationLevel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum VerificationLevel
|
||||
{
|
||||
/// <summary> Users have no additional restrictions on sending messages to this guild. </summary>
|
||||
None = 0,
|
||||
/// <summary> Users must have a verified email on their account. </summary>
|
||||
Low = 1,
|
||||
/// <summary> Users must fulfill the requirements of Low, and be registered on Discord for at least 5 minutes. </summary>
|
||||
Medium = 2,
|
||||
/// <summary> Users must fulfill the requirements of Medium, and be a member of this guild for at least 10 minutes. </summary>
|
||||
High = 3
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.IO;
|
||||
using Model = Discord.API.Image;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
/// <summary>
|
||||
@@ -30,10 +28,5 @@ namespace Discord
|
||||
Stream = File.OpenRead(path);
|
||||
}
|
||||
#endif
|
||||
|
||||
public Model ToModel()
|
||||
{
|
||||
return new Model(Stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
62
src/Discord.Net.Core/Entities/Messages/Embed.cs
Normal file
62
src/Discord.Net.Core/Entities/Messages/Embed.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
||||
public class Embed : IEmbed
|
||||
{
|
||||
public string Type { get; }
|
||||
|
||||
public string Description { get; internal set; }
|
||||
public string Url { get; internal set; }
|
||||
public string Title { get; internal set; }
|
||||
public DateTimeOffset? Timestamp { get; internal set; }
|
||||
public Color? Color { get; internal set; }
|
||||
public EmbedImage? Image { get; internal set; }
|
||||
public EmbedVideo? Video { get; internal set; }
|
||||
public EmbedAuthor? Author { get; internal set; }
|
||||
public EmbedFooter? Footer { get; internal set; }
|
||||
public EmbedProvider? Provider { get; internal set; }
|
||||
public EmbedThumbnail? Thumbnail { get; internal set; }
|
||||
public ImmutableArray<EmbedField> Fields { get; internal set; }
|
||||
|
||||
internal Embed(string type)
|
||||
{
|
||||
Type = type;
|
||||
Fields = ImmutableArray.Create<EmbedField>();
|
||||
}
|
||||
internal Embed(string type,
|
||||
string title,
|
||||
string description,
|
||||
string url,
|
||||
DateTimeOffset? timestamp,
|
||||
Color? color,
|
||||
EmbedImage? image,
|
||||
EmbedVideo? video,
|
||||
EmbedAuthor? author,
|
||||
EmbedFooter? footer,
|
||||
EmbedProvider? provider,
|
||||
EmbedThumbnail? thumbnail,
|
||||
ImmutableArray<EmbedField> fields)
|
||||
{
|
||||
Type = type;
|
||||
Title = title;
|
||||
Description = description;
|
||||
Url = url;
|
||||
Color = color;
|
||||
Timestamp = timestamp;
|
||||
Image = image;
|
||||
Video = video;
|
||||
Author = author;
|
||||
Footer = footer;
|
||||
Provider = provider;
|
||||
Thumbnail = thumbnail;
|
||||
Fields = fields;
|
||||
}
|
||||
|
||||
public override string ToString() => Title;
|
||||
private string DebuggerDisplay => $"{Title} ({Type})";
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,22 @@
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.EmbedAuthor;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public struct EmbedAuthor
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string IconUrl { get; set; }
|
||||
public string ProxyIconUrl { get; set; }
|
||||
public string Name { get; internal set; }
|
||||
public string Url { get; internal set; }
|
||||
public string IconUrl { get; internal set; }
|
||||
public string ProxyIconUrl { get; internal set; }
|
||||
|
||||
private EmbedAuthor(string name, string url, string iconUrl, string proxyIconUrl)
|
||||
internal EmbedAuthor(string name, string url, string iconUrl, string proxyIconUrl)
|
||||
{
|
||||
Name = name;
|
||||
Url = url;
|
||||
IconUrl = iconUrl;
|
||||
ProxyIconUrl = proxyIconUrl;
|
||||
}
|
||||
internal static EmbedAuthor Create(Model model)
|
||||
{
|
||||
return new EmbedAuthor(model.Name, model.Url, model.IconUrl, model.ProxyIconUrl);
|
||||
}
|
||||
|
||||
private string DebuggerDisplay => $"{Name} ({Url})";
|
||||
public override string ToString() => Name;
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Embed = Discord.API.Embed;
|
||||
using Field = Discord.API.EmbedField;
|
||||
using Author = Discord.API.EmbedAuthor;
|
||||
using Footer = Discord.API.EmbedFooter;
|
||||
using Thumbnail = Discord.API.EmbedThumbnail;
|
||||
using ImageEmbed = Discord.API.EmbedImage;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public class EmbedBuilder
|
||||
{
|
||||
private readonly Embed _model;
|
||||
private readonly List<Field> _fields;
|
||||
|
||||
public EmbedBuilder()
|
||||
{
|
||||
_model = new Embed { Type = "rich" };
|
||||
_fields = new List<Field>();
|
||||
}
|
||||
|
||||
public string Title { get { return _model.Title; } set { _model.Title = value; } }
|
||||
public string Description { get { return _model.Description; } set { _model.Description = value; } }
|
||||
public string Url { get { return _model.Url; } set { _model.Url = value; } }
|
||||
public string ThumbnailUrl { get; set; }
|
||||
public string ImageUrl { get; set; }
|
||||
public DateTimeOffset? Timestamp { get; set; }
|
||||
public Color? Color { get { return _model.Color.HasValue ? new Color(_model.Color.Value) : (Color?)null; } set { _model.Color = value?.RawValue; } }
|
||||
public EmbedAuthorBuilder Author { get; set; }
|
||||
public EmbedFooterBuilder Footer { get; set; }
|
||||
|
||||
public EmbedBuilder WithTitle(string title)
|
||||
{
|
||||
Title = title;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithDescription(string description)
|
||||
{
|
||||
Description = description;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithUrl(string url)
|
||||
{
|
||||
Url = url;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithThumbnailUrl(string thumbnailUrl)
|
||||
{
|
||||
ThumbnailUrl = thumbnailUrl;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithImageUrl(string imageUrl)
|
||||
{
|
||||
ImageUrl = imageUrl;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithCurrentTimestamp()
|
||||
{
|
||||
Timestamp = DateTimeOffset.UtcNow;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithTimestamp(DateTimeOffset dateTimeOffset)
|
||||
{
|
||||
Timestamp = dateTimeOffset;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithColor(Color color)
|
||||
{
|
||||
Color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmbedBuilder WithAuthor(EmbedAuthorBuilder author)
|
||||
{
|
||||
Author = author;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithAuthor(Action<EmbedAuthorBuilder> action)
|
||||
{
|
||||
var author = new EmbedAuthorBuilder();
|
||||
action(author);
|
||||
Author = author;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithFooter(EmbedFooterBuilder footer)
|
||||
{
|
||||
Footer = footer;
|
||||
return this;
|
||||
}
|
||||
public EmbedBuilder WithFooter(Action<EmbedFooterBuilder> action)
|
||||
{
|
||||
var footer = new EmbedFooterBuilder();
|
||||
action(footer);
|
||||
Footer = footer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmbedBuilder AddField(Action<EmbedFieldBuilder> action)
|
||||
{
|
||||
var field = new EmbedFieldBuilder();
|
||||
action(field);
|
||||
_fields.Add(field.ToModel());
|
||||
return this;
|
||||
}
|
||||
|
||||
internal Embed Build()
|
||||
{
|
||||
_model.Author = Author?.ToModel();
|
||||
_model.Footer = Footer?.ToModel();
|
||||
_model.Timestamp = Timestamp?.ToUniversalTime();
|
||||
_model.Thumbnail = ThumbnailUrl != null ? new Thumbnail { Url = ThumbnailUrl } : null;
|
||||
_model.Image = ImageUrl != null ? new ImageEmbed { Url = ImageUrl } : null;
|
||||
_model.Fields = _fields.ToArray();
|
||||
return _model;
|
||||
}
|
||||
}
|
||||
|
||||
public class EmbedFieldBuilder
|
||||
{
|
||||
private readonly Field _model;
|
||||
|
||||
public string Name { get { return _model.Name; } set { _model.Name = value; } }
|
||||
public string Value { get { return _model.Value; } set { _model.Value = value; } }
|
||||
public bool IsInline { get { return _model.Inline; } set { _model.Inline = value; } }
|
||||
|
||||
public EmbedFieldBuilder()
|
||||
{
|
||||
_model = new Field();
|
||||
}
|
||||
|
||||
public EmbedFieldBuilder WithName(string name)
|
||||
{
|
||||
Name = name;
|
||||
return this;
|
||||
}
|
||||
public EmbedFieldBuilder WithValue(string value)
|
||||
{
|
||||
Value = value;
|
||||
return this;
|
||||
}
|
||||
public EmbedFieldBuilder WithIsInline(bool isInline)
|
||||
{
|
||||
IsInline = isInline;
|
||||
return this;
|
||||
}
|
||||
|
||||
internal Field ToModel() => _model;
|
||||
}
|
||||
|
||||
public class EmbedAuthorBuilder
|
||||
{
|
||||
private readonly Author _model;
|
||||
|
||||
public string Name { get { return _model.Name; } set { _model.Name = value; } }
|
||||
public string Url { get { return _model.Url; } set { _model.Url = value; } }
|
||||
public string IconUrl { get { return _model.IconUrl; } set { _model.IconUrl = value; } }
|
||||
|
||||
public EmbedAuthorBuilder()
|
||||
{
|
||||
_model = new Author();
|
||||
}
|
||||
|
||||
public EmbedAuthorBuilder WithName(string name)
|
||||
{
|
||||
Name = name;
|
||||
return this;
|
||||
}
|
||||
public EmbedAuthorBuilder WithUrl(string url)
|
||||
{
|
||||
Url = url;
|
||||
return this;
|
||||
}
|
||||
public EmbedAuthorBuilder WithIconUrl(string iconUrl)
|
||||
{
|
||||
IconUrl = iconUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
internal Author ToModel() => _model;
|
||||
}
|
||||
|
||||
public class EmbedFooterBuilder
|
||||
{
|
||||
private readonly Footer _model;
|
||||
|
||||
public string Text { get { return _model.Text; } set { _model.Text = value; } }
|
||||
public string IconUrl { get { return _model.IconUrl; } set { _model.IconUrl = value; } }
|
||||
|
||||
public EmbedFooterBuilder()
|
||||
{
|
||||
_model = new Footer();
|
||||
}
|
||||
|
||||
public EmbedFooterBuilder WithText(string text)
|
||||
{
|
||||
Text = text;
|
||||
return this;
|
||||
}
|
||||
public EmbedFooterBuilder WithIconUrl(string iconUrl)
|
||||
{
|
||||
IconUrl = iconUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
internal Footer ToModel() => _model;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,20 @@
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.EmbedField;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public struct EmbedField
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool Inline { get; set; }
|
||||
public string Name { get; internal set; }
|
||||
public string Value { get; internal set; }
|
||||
public bool Inline { get; internal set; }
|
||||
|
||||
private EmbedField(string name, string value, bool inline)
|
||||
internal EmbedField(string name, string value, bool inline)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
Inline = inline;
|
||||
}
|
||||
internal static EmbedField Create(Model model)
|
||||
{
|
||||
return new EmbedField(model.Name, model.Value, model.Inline);
|
||||
}
|
||||
|
||||
private string DebuggerDisplay => $"{Name} ({Value}";
|
||||
public override string ToString() => Name;
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.EmbedFooter;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public struct EmbedFooter
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public string IconUrl { get; set; }
|
||||
public string ProxyUrl { get; set; }
|
||||
public string Text { get; internal set; }
|
||||
public string IconUrl { get; internal set; }
|
||||
public string ProxyUrl { get; internal set; }
|
||||
|
||||
private EmbedFooter(string text, string iconUrl, string proxyUrl)
|
||||
internal EmbedFooter(string text, string iconUrl, string proxyUrl)
|
||||
{
|
||||
Text = text;
|
||||
IconUrl = iconUrl;
|
||||
ProxyUrl = proxyUrl;
|
||||
}
|
||||
internal static EmbedFooter Create(Model model)
|
||||
{
|
||||
return new EmbedFooter(model.Text, model.IconUrl, model.ProxyIconUrl);
|
||||
}
|
||||
|
||||
private string DebuggerDisplay => $"{Text} ({IconUrl})";
|
||||
public override string ToString() => Text;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.EmbedImage;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
@@ -11,19 +10,13 @@ namespace Discord
|
||||
public int? Height { get; }
|
||||
public int? Width { get; }
|
||||
|
||||
private EmbedImage(string url, string proxyUrl, int? height, int? width)
|
||||
internal EmbedImage(string url, string proxyUrl, int? height, int? width)
|
||||
{
|
||||
Url = url;
|
||||
ProxyUrl = proxyUrl;
|
||||
Height = height;
|
||||
Width = width;
|
||||
}
|
||||
internal static EmbedImage Create(Model model)
|
||||
{
|
||||
return new EmbedImage(model.Url, model.ProxyUrl,
|
||||
model.Height.IsSpecified ? model.Height.Value : (int?)null,
|
||||
model.Width.IsSpecified ? model.Width.Value : (int?)null);
|
||||
}
|
||||
|
||||
private string DebuggerDisplay => $"{Url} ({(Width != null && Height != null ? $"{Width}x{Height}" : "0x0")})";
|
||||
public override string ToString() => Url;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.EmbedProvider;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
@@ -9,15 +8,11 @@ namespace Discord
|
||||
public string Name { get; }
|
||||
public string Url { get; }
|
||||
|
||||
private EmbedProvider(string name, string url)
|
||||
internal EmbedProvider(string name, string url)
|
||||
{
|
||||
Name = name;
|
||||
Url = url;
|
||||
}
|
||||
internal static EmbedProvider Create(Model model)
|
||||
{
|
||||
return new EmbedProvider(model.Name, model.Url);
|
||||
}
|
||||
|
||||
private string DebuggerDisplay => $"{Name} ({Url})";
|
||||
public override string ToString() => Name;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.EmbedThumbnail;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
@@ -11,19 +10,13 @@ namespace Discord
|
||||
public int? Height { get; }
|
||||
public int? Width { get; }
|
||||
|
||||
private EmbedThumbnail(string url, string proxyUrl, int? height, int? width)
|
||||
internal EmbedThumbnail(string url, string proxyUrl, int? height, int? width)
|
||||
{
|
||||
Url = url;
|
||||
ProxyUrl = proxyUrl;
|
||||
Height = height;
|
||||
Width = width;
|
||||
}
|
||||
internal static EmbedThumbnail Create(Model model)
|
||||
{
|
||||
return new EmbedThumbnail(model.Url, model.ProxyUrl,
|
||||
model.Height.IsSpecified ? model.Height.Value : (int?)null,
|
||||
model.Width.IsSpecified ? model.Width.Value : (int?)null);
|
||||
}
|
||||
|
||||
private string DebuggerDisplay => $"{Url} ({(Width != null && Height != null ? $"{Width}x{Height}" : "0x0")})";
|
||||
public override string ToString() => Url;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.EmbedVideo;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
@@ -10,18 +9,12 @@ namespace Discord
|
||||
public int? Height { get; }
|
||||
public int? Width { get; }
|
||||
|
||||
private EmbedVideo(string url, int? height, int? width)
|
||||
internal EmbedVideo(string url, int? height, int? width)
|
||||
{
|
||||
Url = url;
|
||||
Height = height;
|
||||
Width = width;
|
||||
}
|
||||
internal static EmbedVideo Create(Model model)
|
||||
{
|
||||
return new EmbedVideo(model.Url,
|
||||
model.Height.IsSpecified ? model.Height.Value : (int?)null,
|
||||
model.Width.IsSpecified ? model.Width.Value : (int?)null);
|
||||
}
|
||||
|
||||
private string DebuggerDisplay => $"{Url} ({(Width != null && Height != null ? $"{Width}x{Height}" : "0x0")})";
|
||||
public override string ToString() => Url;
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
using Discord.API;
|
||||
using System;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using Model = Discord.API.Emoji;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public struct Emoji
|
||||
{
|
||||
public ulong Id { get; }
|
||||
public ulong? Id { get; }
|
||||
public string Name { get; }
|
||||
|
||||
public string Url => CDN.GetEmojiUrl(Id);
|
||||
public string Url => Id != null ? CDN.GetEmojiUrl(Id.Value) : null;
|
||||
|
||||
internal Emoji(ulong id, string name)
|
||||
internal Emoji(ulong? id, string name)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
}
|
||||
internal static Emoji Create(Model emoji)
|
||||
{
|
||||
return new Emoji(emoji.Id.GetValueOrDefault(), emoji.Name);
|
||||
}
|
||||
|
||||
public static Emoji Parse(string text)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,6 @@
|
||||
/// <summary>
|
||||
/// The embed the message should display
|
||||
/// </summary>
|
||||
public Optional<EmbedBuilder> Embed { get; set; }
|
||||
public Optional<Embed> Embed { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
13
src/Discord.Net.Core/Entities/Messages/MessageType.cs
Normal file
13
src/Discord.Net.Core/Entities/Messages/MessageType.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum MessageType
|
||||
{
|
||||
Default = 0,
|
||||
RecipientAdd = 1,
|
||||
RecipientRemove = 2,
|
||||
Call = 3,
|
||||
ChannelNameChange = 4,
|
||||
ChannelIconChange = 5,
|
||||
ChannelPinnedMessage = 6
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using Model = Discord.API.Overwrite;
|
||||
|
||||
namespace Discord
|
||||
namespace Discord
|
||||
{
|
||||
public struct Overwrite
|
||||
{
|
||||
@@ -18,8 +16,5 @@ namespace Discord
|
||||
TargetType = targetType;
|
||||
Permissions = permissions;
|
||||
}
|
||||
|
||||
public Overwrite(Model model)
|
||||
: this(model.TargetId, model.TargetType, new OverwritePermissions(model.Allow, model.Deny)) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Discord.API.Rest;
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.Game;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
@@ -18,12 +17,6 @@ namespace Discord
|
||||
}
|
||||
private Game(string name)
|
||||
: this(name, null, StreamType.NotStreaming) { }
|
||||
internal static Game Create(Model model)
|
||||
{
|
||||
return new Game(model.Name,
|
||||
model.StreamUrl.GetValueOrDefault(null),
|
||||
model.StreamType.GetValueOrDefault(null) ?? StreamType.NotStreaming);
|
||||
}
|
||||
|
||||
public override string ToString() => Name;
|
||||
private string DebuggerDisplay => StreamUrl != null ? $"{Name} ({StreamUrl})" : Name;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Discord.API.Rest;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
8
src/Discord.Net.Core/Entities/Users/StreamType.cs
Normal file
8
src/Discord.Net.Core/Entities/Users/StreamType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum StreamType
|
||||
{
|
||||
NotStreaming = 0,
|
||||
Twitch = 1
|
||||
}
|
||||
}
|
||||
13
src/Discord.Net.Core/Entities/Users/UserStatus.cs
Normal file
13
src/Discord.Net.Core/Entities/Users/UserStatus.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum UserStatus
|
||||
{
|
||||
Unknown,
|
||||
Online,
|
||||
Idle,
|
||||
AFK,
|
||||
DoNotDisturb,
|
||||
Invisible,
|
||||
Offline
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user