Beispiel #1
0
        public async Task <IDiscordTextChannel> GetDMChannelAsync()
        {
            var currentUser = await client.GetSelfAsync();

            if (Id == currentUser.Id)
            {
                throw new InvalidOperationException("Can't create a DM channel with self.");
            }
            return(await client.CreateDMAsync(Id));
        }
Beispiel #2
0
        /// <inheritdoc />
        public async Task <IDiscordGuildUser> GetSelfAsync()
        {
            IDiscordUser user = await client.GetSelfAsync()
                                .ConfigureAwait(false);

            if (user == null)
            {
                throw new InvalidOperationException("Could not find self user");
            }

            return(await GetMemberAsync(user.Id));
        }