@@ -115,7 +115,7 @@ namespace Discord.Rest
/// <inheritdoc />
public async Task Update()
{
var response = await Discord.Base Client.GetGuild(Id).ConfigureAwait(false);
var response = await Discord.API Client.GetGuild(Id).ConfigureAwait(false);
Update(response);
}
/// <inheritdoc />
@@ -125,7 +125,7 @@ namespace Discord.Rest
var args = new ModifyGuildParams();
func(args);
var model = await Discord.Base Client.ModifyGuild(Id, args).ConfigureAwait(false);
var model = await Discord.API Client.ModifyGuild(Id, args).ConfigureAwait(false);
Update(model);
}
/// <inheritdoc />
@@ -135,35 +135,35 @@ namespace Discord.Rest
var args = new ModifyGuildEmbedParams();
func(args);
var model = await Discord.Base Client.ModifyGuildEmbed(Id, args).ConfigureAwait(false);
var model = await Discord.API Client.ModifyGuildEmbed(Id, args).ConfigureAwait(false);
Update(model);
}
/// <inheritdoc />
public async Task ModifyChannels(IEnumerable<ModifyGuildChannelsParams> args)
{
await Discord.Base Client.ModifyGuildChannels(Id, args).ConfigureAwait(false);
await Discord.API Client.ModifyGuildChannels(Id, args).ConfigureAwait(false);
}
/// <inheritdoc />
public async Task ModifyRoles(IEnumerable<ModifyGuildRolesParams> args)
{
var models = await Discord.Base Client.ModifyGuildRoles(Id, args).ConfigureAwait(false);
var models = await Discord.API Client.ModifyGuildRoles(Id, args).ConfigureAwait(false);
Update(models);
}
/// <inheritdoc />
public async Task Leave()
{
await Discord.Base Client.LeaveGuild(Id).ConfigureAwait(false);
await Discord.API Client.LeaveGuild(Id).ConfigureAwait(false);
}
/// <inheritdoc />
public async Task Delete()
{
await Discord.Base Client.DeleteGuild(Id).ConfigureAwait(false);
await Discord.API Client.DeleteGuild(Id).ConfigureAwait(false);
}
/// <inheritdoc />
public async Task<IEnumerable<User>> GetBans()
{
var models = await Discord.Base Client.GetGuildBans(Id).ConfigureAwait(false);
var models = await Discord.API Client.GetGuildBans(Id).ConfigureAwait(false);
return models.Select(x => new PublicUser(Discord, x));
}
/// <inheritdoc />
@@ -175,20 +175,20 @@ namespace Discord.Rest
{
PruneDays = pruneDays
};
await Discord.Base Client.CreateGuildBan(Id, userId, args).ConfigureAwait(false);
await Discord.API Client.CreateGuildBan(Id, userId, args).ConfigureAwait(false);
}
/// <inheritdoc />
public Task RemoveBan(IUser user) => RemoveBan(user.Id);
/// <inheritdoc />
public async Task RemoveBan(ulong userId)
{
await Discord.Base Client.RemoveGuildBan(Id, userId).ConfigureAwait(false);
await Discord.API Client.RemoveGuildBan(Id, userId).ConfigureAwait(false);
}
/// <summary> Gets the channel in this guild with the provided id, or null if not found. </summary>
public async Task<GuildChannel> GetChannel(ulong id)
{
var model = await Discord.Base Client.GetChannel(Id, id).ConfigureAwait(false);
var model = await Discord.API Client.GetChannel(Id, id).ConfigureAwait(false);
if (model != null)
return ToChannel(model);
return null;
@@ -196,7 +196,7 @@ namespace Discord.Rest
/// <summary> Gets a collection of all channels in this guild. </summary>
public async Task<IEnumerable<GuildChannel>> GetChannels()
{
var models = await Discord.Base Client.GetGuildChannels(Id).ConfigureAwait(false);
var models = await Discord.API Client.GetGuildChannels(Id).ConfigureAwait(false);
return models.Select(x => ToChannel(x));
}
/// <summary> Creates a new text channel. </summary>
@@ -205,7 +205,7 @@ namespace Discord.Rest
if (name == null) throw new ArgumentNullException(nameof(name));
var args = new CreateGuildChannelParams() { Name = name, Type = ChannelType.Text };
var model = await Discord.Base Client.CreateGuildChannel(Id, args).ConfigureAwait(false);
var model = await Discord.API Client.CreateGuildChannel(Id, args).ConfigureAwait(false);
return new TextChannel(this, model);
}
/// <summary> Creates a new voice channel. </summary>
@@ -214,28 +214,28 @@ namespace Discord.Rest
if (name == null) throw new ArgumentNullException(nameof(name));
var args = new CreateGuildChannelParams { Name = name, Type = ChannelType.Voice };
var model = await Discord.Base Client.CreateGuildChannel(Id, args).ConfigureAwait(false);
var model = await Discord.API Client.CreateGuildChannel(Id, args).ConfigureAwait(false);
return new VoiceChannel(this, model);
}
/// <summary> Gets a collection of all integrations attached to this guild. </summary>
public async Task<IEnumerable<GuildIntegration>> GetIntegrations()
{
var models = await Discord.Base Client.GetGuildIntegrations(Id).ConfigureAwait(false);
var models = await Discord.API Client.GetGuildIntegrations(Id).ConfigureAwait(false);
return models.Select(x => new GuildIntegration(this, x));
}
/// <summary> Creates a new integration for this guild. </summary>
public async Task<GuildIntegration> CreateIntegration(ulong id, string type)
{
var args = new CreateGuildIntegrationParams { Id = id, Type = type };
var model = await Discord.Base Client.CreateGuildIntegration(Id, args).ConfigureAwait(false);
var model = await Discord.API Client.CreateGuildIntegration(Id, args).ConfigureAwait(false);
return new GuildIntegration(this, model);
}
/// <summary> Gets a collection of all invites to this guild. </summary>
public async Task<IEnumerable<InviteMetadata>> GetInvites()
{
var models = await Discord.Base Client.GetGuildInvites(Id).ConfigureAwait(false);
var models = await Discord.API Client.GetGuildInvites(Id).ConfigureAwait(false);
return models.Select(x => new InviteMetadata(Discord, x));
}
/// <summary> Creates a new invite to this guild. </summary>
@@ -251,7 +251,7 @@ namespace Discord.Rest
Temporary = isTemporary,
XkcdPass = withXkcd
};
var model = await Discord.Base Client.CreateChannelInvite(DefaultChannelId, args).ConfigureAwait(false);
var model = await Discord.API Client.CreateChannelInvite(DefaultChannelId, args).ConfigureAwait(false);
return new InviteMetadata(Discord, model);
}
@@ -269,7 +269,7 @@ namespace Discord.Rest
{
if (name == null) throw new ArgumentNullException(nameof(name));
var model = await Discord.Base Client.CreateGuildRole(Id).ConfigureAwait(false);
var model = await Discord.API Client.CreateGuildRole(Id).ConfigureAwait(false);
var role = new Role(this, model);
await role.Modify(x =>
@@ -287,20 +287,20 @@ namespace Discord.Rest
public async Task<IEnumerable<GuildUser>> GetUsers()
{
var args = new GetGuildMembersParams();
var models = await Discord.Base Client.GetGuildMembers(Id, args).ConfigureAwait(false);
var models = await Discord.API Client.GetGuildMembers(Id, args).ConfigureAwait(false);
return models.Select(x => new GuildUser(this, x));
}
/// <summary> Gets a paged collection of all users in this guild. </summary>
public async Task<IEnumerable<GuildUser>> GetUsers(int limit, int offset)
{
var args = new GetGuildMembersParams { Limit = limit, Offset = offset };
var models = await Discord.Base Client.GetGuildMembers(Id, args).ConfigureAwait(false);
var models = await Discord.API Client.GetGuildMembers(Id, args).ConfigureAwait(false);
return models.Select(x => new GuildUser(this, x));
}
/// <summary> Gets the user in this guild with the provided id, or null if not found. </summary>
public async Task<GuildUser> GetUser(ulong id)
{
var model = await Discord.Base Client.GetGuildMember(Id, id).ConfigureAwait(false);
var model = await Discord.API Client.GetGuildMember(Id, id).ConfigureAwait(false);
if (model != null)
return new GuildUser(this, model);
return null;
@@ -316,9 +316,9 @@ namespace Discord.Rest
var args = new GuildPruneParams() { Days = days };
GetGuildPruneCountResponse model;
if (simulate)
model = await Discord.Base Client.GetGuildPruneCount(Id, args).ConfigureAwait(false);
model = await Discord.API Client.GetGuildPruneCount(Id, args).ConfigureAwait(false);
else
model = await Discord.Base Client.BeginGuildPrune(Id, args).ConfigureAwait(false);
model = await Discord.API Client.BeginGuildPrune(Id, args).ConfigureAwait(false);
return model.Pruned;
}