Added ToString to several Rest models

This commit is contained in:
RogueException
2016-05-12 10:35:37 -03:00
parent 0eb9ff6bd3
commit 4d565d1b29
10 changed files with 19 additions and 3 deletions

View File

@@ -153,9 +153,6 @@ namespace Discord.Rest
Update(model);
}
/// <inheritdoc />
public override string ToString() => Name ?? Id.ToString();
IGuild IGuildChannel.Guild => Guild;
async Task<IGuildInvite> IGuildChannel.CreateInvite(int? maxAge, int? maxUses, bool isTemporary, bool withXkcd)
=> await CreateInvite(maxAge, maxUses, isTemporary, withXkcd).ConfigureAwait(false);

View File

@@ -333,6 +333,8 @@ namespace Discord.Rest
}
}
public override string ToString() => Name ?? Id.ToString();
IEnumerable<Emoji> IGuild.Emojis => Emojis;
ulong IGuild.EveryoneRoleId => EveryoneRole.Id;
IEnumerable<string> IGuild.Features => Features;

View File

@@ -28,5 +28,7 @@ namespace Discord.Rest
ChannelId = model.ChannelId;
IsEnabled = model.Enabled;
}
public override string ToString() => $"{Id} ({(IsEnabled ? "Enabled" : "Disabled")})";
}
}

View File

@@ -77,6 +77,8 @@ namespace Discord.Rest
await Discord.BaseClient.SyncGuildIntegration(Guild.Id, Id).ConfigureAwait(false);
}
public override string ToString() => $"{Name ?? Id.ToString()} ({(IsEnabled ? "Enabled" : "Disabled")})";
IGuild IGuildIntegration.Guild => Guild;
IRole IGuildIntegration.Role => Role;
IUser IGuildIntegration.User => User;

View File

@@ -7,5 +7,7 @@
/// <inheritdoc />
public string Name { get; private set; }
public override string ToString() => Name ?? Id.ToString();
}
}

View File

@@ -51,5 +51,7 @@ namespace Discord.Rest
throw new InvalidOperationException("Unable to leave a guild the current user owns, use Delete() instead.");
await Discord.BaseClient.DeleteGuild(Id).ConfigureAwait(false);
}
public override string ToString() => Name ?? Id.ToString();
}
}

View File

@@ -26,5 +26,7 @@ namespace Discord.Rest
SampleHostname = model.SampleHostname;
SamplePort = model.SamplePort;
}
public override string ToString() => $"{Name ?? Id.ToString()}";
}
}

View File

@@ -137,6 +137,9 @@ namespace Discord.Rest
await Discord.BaseClient.DeleteMessage(Channel.Id, Id).ConfigureAwait(false);
}
public override string ToString() => $"{Author.ToString()}: {Text}";
IUser IMessage.Author => Author;
IReadOnlyList<Attachment> IMessage.Attachments => Attachments;
IReadOnlyList<Embed> IMessage.Embeds => Embeds;

View File

@@ -23,5 +23,7 @@ namespace Discord.Rest
Integrations = model.Integrations;
}
public override string ToString() => $"{Name ?? Id.ToString()} ({Type})";
}
}

View File

@@ -54,6 +54,8 @@ namespace Discord.Rest
return new DMChannel(Discord, model);
}
public override string ToString() => $"{Username ?? Id.ToString()}";
/// <inheritdoc />
string IUser.CurrentGame => null;
/// <inheritdoc />