コード例 #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);
        }
コード例 #2
0
ファイル: RestSelfUser.cs プロジェクト: PBPUser/dstx
        internal new static RestSelfUser Create(BaseDiscordClient discord, Model model)
        {
            var entity = new RestSelfUser(discord, model.Id);

            entity.Update(model);
            return(entity);
        }
コード例 #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);
コード例 #4
0
 /// <inheritdoc />
 public Task ModifyAsync(Action <SelfUserProperties> func, RequestOptions options = null)
 => RestSelfUser.ModifyAsync(func, options);
コード例 #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)
 {
 }