コード例 #1
0
        public async Task WaifuMal(string name, long malId)
        {
            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name, true, includeMAL: true), this);

            if (waifu == null)
            {
                return;
            }

            var mal = waifu.Mal ?? new MalWaifu {
                WaifuName = waifu.Name
            };

            mal.LastUpdated  = DateTime.Now;
            mal.MalConfirmed = true;
            mal.MalId        = malId;

            if ((await WaifuDb.UpdateMalWaifu(mal)) > 0)
            {
                await Context.Channel.SendMessageAsync($":white_check_mark: {waifu.Name} updated.");
            }
            else
            {
                await Context.Channel.SendMessageAsync($":x: Failed to update {name}");
            }
        }