public ApiResult AddAccount([FromBody] RequestUserInfoDTO request) { string reason = ""; if (userService.AddAccount(request, out reason)) { return(new ApiResult()); } else { return(new ApiResult() { Status = EnumApiStatus.BizError, Msg = reason }); } }
public async Task ProcessAccountNameAsync(string message) { if (_userService.AddAccount(_guildId, _user.Id, _accountType, message, out string errorMessage)) { if (_user is IGuildUser guildUser) { await _userService.UpdateNameAsync(guildUser); } await UserExtensions.SendMessageAsync(_user, $"Added the account successfully.\nYour accounts are:\n{_userService.PrintAccounts(_guildId, _user.Id)}"); _conversationService.CloseConversation(_user.Id); } else { await UserExtensions.SendMessageAsync(_user, $"{errorMessage}\n" + "Please try again or type \"cancel\" to cancel the interaction."); } }
public async Task AddAccountAsync(string accountType, string accountDetails) { if (!_userService.ListAccountTypes(Context.Guild.Id).Contains(accountType)) { await Context.Channel.SendMessageAsync($"Account type {accountType} not found."); return; } if (_userService.AddAccount(Context.Guild.Id, Context.User.Id, accountType, accountDetails, out string errorMessage)) { if (Context.User is IGuildUser guildUser) { await _userService.UpdateNameAsync(guildUser); } await Context.Channel.SendMessageAsync($"Account {accountDetails} was added to your {accountType} accounts."); return; } await Context.Channel.SendMessageAsync(errorMessage); await Context.Message.DeleteAsync(); }