Example #1
0
        public static async Task <Channel> GetOrCreateDmChannel(this IDiscordCache cache, DiscordApiClient rest, ulong recipientId)
        {
            if (cache.TryGetDmChannel(recipientId, out var cacheChannel))
            {
                return(cacheChannel);
            }

            var restChannel = await rest.CreateDm(recipientId);

            await cache.SaveChannel(restChannel);

            return(restChannel);
        }