private async Task HelloUnknownUser(DiscordBotContext dbContext, DiscordUser discordUser) { await ReplyAsync($"Hello {Context.User.Username}, it seems we don't know each other yet. " + $"I have reached out to you privately to get to known each better."); await GetToKnowHelper.GetToKnowUser(Context, _ladanseUrlBuilder, dbContext, discordUser); }
private async Task HelloForgottenUser(DiscordBotContext dbContext, DiscordUser discordUser) { await ReplyAsync($"Hello {Context.User.Username}, I remember you but I seem to have forgotten some of our adventure. " + $"I have reached out to you privately to get to know each other again."); await GetToKnowHelper.GetToKnowUser(Context, _ladanseUrlBuilder, dbContext, discordUser); }
private string GetAccessToken(DiscordBotContext dbContext, DiscordUser discordUser) { var accessTokenMapping = dbContext.AccessTokenMappings .FirstOrDefault(a => a.DiscordUser == discordUser && a.State == AccessTokenState.Active); return(accessTokenMapping?.AccessToken); }
public BasicAuthenticationHandler( IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, DiscordBotContext context, ISystemClock clock) : base(options, logger, encoder, clock) { _context = context; }
public ConnectController( LaDanseUrlBuilder laDanseUrlBuilder, LaDanseRestClient laDanseRestClient, ILogger <ConnectController> logger, DiscordBotContext dbContext) { _laDanseUrlBuilder = laDanseUrlBuilder; _laDanseRestClient = laDanseRestClient; _logger = logger; _dbContext = dbContext; }
public static async Task GetToKnowUser( SocketCommandContext socketCommandContext, LaDanseUrlBuilder laDanseUrlBuilder, DiscordBotContext dbContext, DiscordUser discordUser) { #region CleanUpAuthSessions var authSessions = dbContext.AuthSessions .Where(b => b.DiscordUser == discordUser) .ToList(); foreach (var authSession in authSessions) { if (authSession.State == AuthSessionState.Pending) { authSession.State = AuthSessionState.Removed; } } #endregion #region NewAuthSession var newAuthSession = new AuthSession { Nonce = RandomStringUtils.Random(32), CreatedOn = 0, DiscordUser = discordUser, State = AuthSessionState.Pending }; dbContext.AuthSessions.Add(newAuthSession); #endregion await socketCommandContext.User.SendMessageAsync( "Click on this URL and follow the instructions if you want us to get to know each other better ...\n\n" + laDanseUrlBuilder.GetDiscordAuthInformUrl(newAuthSession.Nonce, "http://localhost:57077/connect/website")); }
private async Task HelloKnownUser(DiscordBotContext dbContext, DiscordUser discordUser) { await ReplyAsync($"Hello {Context.User.Username}, nice to see you. How are you doing?"); }
public CommandItemRepo(DiscordBotContext context) { _context = context; }
public UserRepo(DiscordBotContext context) { _context = context; }
public ServerLogItemRepo(DiscordBotContext context) { _context = context; }