Example #1
0
        public async Task CreateRoleSyncAsync(SocketRole socketRole, string productId, ulong?watchMessageId = null)
        {
            var result = await _gumroad.GetProductAsync(_config["gumroad:token"], productId);

            if (!result.IsSuccess)
            {
                await ReplyAsync("Sorry, I couldn't find any products matching that ID.");

                return;
            }

            var product = new RexoProduct
            {
                Id              = result.Product.Id,
                Name            = result.Product.Name,
                PreviewImageUrl = result.Product.PreviewUrl,
                ShortUrl        = result.Product.ShortUrl,
                GuildId         = Context.Guild.Id,
                RoleId          = socketRole.Id,
                WatchMessageId  = watchMessageId
            };

            _db.Products.Add(product);
            _db.SaveChanges();

            await ReplyAsync($"Successfully added `{product.Name}` to the syncing service!");
        }