Ejemplo n.º 1
0
        /// <inheritdoc />
        internal override async Task OnLoginAsync(TokenType tokenType, string token)
        {
            API.UserJson user = await ApiClient.GetMyUserAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false);

            ApiClient.CurrentUserId = user.Id;
            base.CurrentUser        = RestSelfUser.Create(this, user);
        }
Ejemplo n.º 2
0
        internal new static RestSelfUser Create(BaseDiscordClient discord, Model model)
        {
            var entity = new RestSelfUser(discord, model.Id);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Converts an existing <see cref="RestSelfUser"/> to an abstracted <see cref="IRestSelfUser"/> value.
 /// </summary>
 /// <param name="restSelfUser">The existing <see cref="RestSelfUser"/> to be abstracted.</param>
 /// <exception cref="ArgumentNullException">Throws for <paramref name="restSelfUser"/>.</exception>
 /// <returns>An <see cref="IRestSelfUser"/> that abstracts <paramref name="restSelfUser"/>.</returns>
 public static IRestSelfUser Abstract(this RestSelfUser restSelfUser)
 => new RestSelfUserAbstraction(restSelfUser);
Ejemplo n.º 4
0
 /// <inheritdoc />
 public Task ModifyAsync(Action <SelfUserProperties> func, RequestOptions options = null)
 => RestSelfUser.ModifyAsync(func, options);
Ejemplo n.º 5
0
 /// <summary>
 /// Constructs a new <see cref="RestSelfUserAbstraction"/> around an existing <see cref="Rest.RestSelfUser"/>.
 /// </summary>
 /// <param name="restSelfUser">The value to use for <see cref="Rest.RestSelfUser"/>.</param>
 /// <exception cref="ArgumentNullException">Throws for <paramref name="restSelfUser"/>.</exception>
 public RestSelfUserAbstraction(RestSelfUser restSelfUser)
     : base(restSelfUser)
 {
 }