public async Task ChangePassword(string serverName) { if (this.serverService.IsPasswordRequestInProgress(Context.User.Id)) { var nsp = this.serverService.GetNewPasswordProcess(Context.User.Id); await ReplyAsync($"You are in process of registering {nsp.ServerName} - please check DM."); return; } if (!await this.serverService.Exists(Context.Guild.Id, serverName)) { await ReplyAsync($"Server with this name does not exist! Please use {PutServerInfoString} in order to register server with this name!"); return; } var inReg = new NewServerPassword() { ServerName = serverName, UserId = Context.User.Id, GuildId = Context.Guild.Id, }; this.serverService.InformAboutNewPasswordRequest(inReg); await ReplyAsync("Check DM to complete process of changing password for this server"); }
public void InformAboutNewPasswordRequest(NewServerPassword newPassword) { this.NewServerPasswordRequests.TryAdd(newPassword.UserId, newPassword); this.NewServerPasswordRequestAdded?.Invoke(this, newPassword); }
private static void Program_NewServerPasswordRequestAdded(object sender, NewServerPassword e) { client.GetUser(e.UserId).SendMessageAsync($"To complete registration of server please provide password to server {e.ServerName} in next message to this bot."); }