namespace RegexBot; partial class RegexbotClient { /// /// Attempts to ban the given user from the specified guild. It is greatly preferred to call this method /// instead of manually executing the equivalent method found in Discord.Net. It notifies other services /// that the action originated from the bot, and allows them to handle the action appropriately. /// /// A structure containing results of the ban operation. /// The guild in which to attempt the ban. /// The user, module, or service which is requesting this action to be taken. /// The user which to perform the action to. /// Number of days of prior post history to delete on ban. Must be between 0-7. /// Reason for the action. Sent to the Audit Log and user (if specified). /// Specify whether to send a direct message to the target user informing them of the action. public Task BanAsync(SocketGuild guild, string source, ulong targetUser, int purgeDays, string? reason, bool sendDMToTarget) => _svcCommonFunctions.BanOrKickAsync(RemovalType.Ban, guild, source, targetUser, purgeDays, reason, sendDMToTarget); /// /// Similar to , but making use of an /// EntityCache lookup to determine the target. /// /// The guild in which to attempt the ban. /// The user, module, or service which is requesting this action to be taken. /// The user which to perform the action to (as a query to the entity cache). /// Number of days of prior post history to delete on ban. Must be between 0-7. /// Reason for the action. Sent to the Audit Log and user (if specified). /// Specify whether to send a direct message to the target user informing them of the action. public async Task BanAsync(SocketGuild guild, string source, string targetSearch, int purgeDays, string? reason, bool sendDMToTarget) { var result = EcQueryGuildUser(guild.Id, targetSearch); if (result == null) return new BanKickResult(null, false, true, RemovalType.Ban, 0); return await BanAsync(guild, source, (ulong)result.UserId, purgeDays, reason, sendDMToTarget); } /// /// Attempts to ban the given user from the specified guild. It is greatly preferred to call this method /// instead of manually executing the equivalent method found in Discord.Net. It notifies other services /// that the action originated from the bot, and allows them to handle the action appropriately. /// /// A structure containing results of the ban operation. /// The guild in which to attempt the kick. /// The user, module, or service which is requesting this action to be taken. /// The user which to perform the action towards. /// /// Reason for the action. Sent to the guild's audit log and, if /// is , the target. /// /// Specify whether to send a direct message to the target user informing them of the action. public Task KickAsync(SocketGuild guild, string source, ulong targetUser, string? reason, bool sendDMToTarget) => _svcCommonFunctions.BanOrKickAsync(RemovalType.Kick, guild, source, targetUser, default, reason, sendDMToTarget); /// /// Similar to , but making use of an /// EntityCache lookup to determine the target. /// /// The guild in which to attempt the kick. /// The user, module, or service which is requesting this action to be taken. /// The user which to perform the action towards (processed as a query to the entity cache). /// /// Reason for the action. Sent to the guild's audit log and, if /// is , the target. /// /// Specify whether to send a direct message to the target user informing them of the action. public async Task KickAsync(SocketGuild guild, string source, string targetSearch, string? reason, bool sendDMToTarget) { var result = EcQueryGuildUser(guild.Id, targetSearch); if (result == null) return new BanKickResult(null, false, true, RemovalType.Kick, 0); return await KickAsync(guild, source, (ulong)result.UserId, reason, sendDMToTarget); } }