Added ToString to several Rest models
This commit is contained in:
@@ -153,9 +153,6 @@ namespace Discord.Rest
|
|||||||
Update(model);
|
Update(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string ToString() => Name ?? Id.ToString();
|
|
||||||
|
|
||||||
IGuild IGuildChannel.Guild => Guild;
|
IGuild IGuildChannel.Guild => Guild;
|
||||||
async Task<IGuildInvite> IGuildChannel.CreateInvite(int? maxAge, int? maxUses, bool isTemporary, bool withXkcd)
|
async Task<IGuildInvite> IGuildChannel.CreateInvite(int? maxAge, int? maxUses, bool isTemporary, bool withXkcd)
|
||||||
=> await CreateInvite(maxAge, maxUses, isTemporary, withXkcd).ConfigureAwait(false);
|
=> await CreateInvite(maxAge, maxUses, isTemporary, withXkcd).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -333,6 +333,8 @@ namespace Discord.Rest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => Name ?? Id.ToString();
|
||||||
|
|
||||||
IEnumerable<Emoji> IGuild.Emojis => Emojis;
|
IEnumerable<Emoji> IGuild.Emojis => Emojis;
|
||||||
ulong IGuild.EveryoneRoleId => EveryoneRole.Id;
|
ulong IGuild.EveryoneRoleId => EveryoneRole.Id;
|
||||||
IEnumerable<string> IGuild.Features => Features;
|
IEnumerable<string> IGuild.Features => Features;
|
||||||
|
|||||||
@@ -28,5 +28,7 @@ namespace Discord.Rest
|
|||||||
ChannelId = model.ChannelId;
|
ChannelId = model.ChannelId;
|
||||||
IsEnabled = model.Enabled;
|
IsEnabled = model.Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => $"{Id} ({(IsEnabled ? "Enabled" : "Disabled")})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ namespace Discord.Rest
|
|||||||
await Discord.BaseClient.SyncGuildIntegration(Guild.Id, Id).ConfigureAwait(false);
|
await Discord.BaseClient.SyncGuildIntegration(Guild.Id, Id).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => $"{Name ?? Id.ToString()} ({(IsEnabled ? "Enabled" : "Disabled")})";
|
||||||
|
|
||||||
IGuild IGuildIntegration.Guild => Guild;
|
IGuild IGuildIntegration.Guild => Guild;
|
||||||
IRole IGuildIntegration.Role => Role;
|
IRole IGuildIntegration.Role => Role;
|
||||||
IUser IGuildIntegration.User => User;
|
IUser IGuildIntegration.User => User;
|
||||||
|
|||||||
@@ -7,5 +7,7 @@
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
|
|
||||||
|
public override string ToString() => Name ?? Id.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,5 +51,7 @@ namespace Discord.Rest
|
|||||||
throw new InvalidOperationException("Unable to leave a guild the current user owns, use Delete() instead.");
|
throw new InvalidOperationException("Unable to leave a guild the current user owns, use Delete() instead.");
|
||||||
await Discord.BaseClient.DeleteGuild(Id).ConfigureAwait(false);
|
await Discord.BaseClient.DeleteGuild(Id).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => Name ?? Id.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,5 +26,7 @@ namespace Discord.Rest
|
|||||||
SampleHostname = model.SampleHostname;
|
SampleHostname = model.SampleHostname;
|
||||||
SamplePort = model.SamplePort;
|
SamplePort = model.SamplePort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => $"{Name ?? Id.ToString()}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ namespace Discord.Rest
|
|||||||
await Discord.BaseClient.DeleteMessage(Channel.Id, Id).ConfigureAwait(false);
|
await Discord.BaseClient.DeleteMessage(Channel.Id, Id).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string ToString() => $"{Author.ToString()}: {Text}";
|
||||||
|
|
||||||
IUser IMessage.Author => Author;
|
IUser IMessage.Author => Author;
|
||||||
IReadOnlyList<Attachment> IMessage.Attachments => Attachments;
|
IReadOnlyList<Attachment> IMessage.Attachments => Attachments;
|
||||||
IReadOnlyList<Embed> IMessage.Embeds => Embeds;
|
IReadOnlyList<Embed> IMessage.Embeds => Embeds;
|
||||||
|
|||||||
@@ -23,5 +23,7 @@ namespace Discord.Rest
|
|||||||
|
|
||||||
Integrations = model.Integrations;
|
Integrations = model.Integrations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => $"{Name ?? Id.ToString()} ({Type})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ namespace Discord.Rest
|
|||||||
return new DMChannel(Discord, model);
|
return new DMChannel(Discord, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString() => $"{Username ?? Id.ToString()}";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
string IUser.CurrentGame => null;
|
string IUser.CurrentGame => null;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
Reference in New Issue
Block a user