public async Task CheckJailConfig() { var modelResult = await CheckStaffAndRetrieveModel(); if (modelResult.IsFailure()) { return; } var configResult = await _jailSettings.GetJailConfig(Context.Guild.Id); var config = configResult.IsFailure() ? new JailConfigModel() : configResult.Get(); await SendChannelMessage(embed : config.CreateJailCommandEmbed()); }
public async Task Jail(string target) { _logging.Verbose("Jail function called"); var modelResult = await CheckStaffAndRetrieveModel(); if (modelResult.IsFailure()) { return; } _logging.Info($"{Context.User.Username}#{Context.User.Discriminator} in Guild {Context.Guild.Name}({Context.Guild.Id}) calling Jail..."); var configRes = await _jailSettings.GetJailConfig(Context.Guild.Id); if (configRes.IsFailure()) { return; } var config = configRes.Get(); var userRes = await GetTarget(target); if (userRes.IsFailure()) { return; } var user = userRes.Get(); var updateEvent = await user.EditRoles(MapRoles(Context.Guild, user)(config.Roles)); await SendChannelMessage( $"> **User {MentionUtils.MentionUser(user.Id)} has been jailed.** (Done by {MentionUtils.MentionUser(Context.User.Id)})"); await _jailData.Store(Context.Guild.Id, updateEvent.ToModel()); await SetJailDetails(updateEvent, config.LogChannel); }