コード例 #1
0
ファイル: Images.cs プロジェクト: ta1H3n/Namiko
        public async Task DeleteImage(int id, [Remainder] string str = "")
        {
            bool insider = Context.Guild.Id == 418900885079588884;

            var image = ImageDb.GetImage(id);

            if (image == null)
            {
                await Context.Channel.SendMessageAsync($"There is no image with id: **{id}**");

                return;
            }
            if (!insider && image.GuildId != Context.Guild.Id)
            {
                await Context.Channel.SendMessageAsync($"There is no image with id **{id}** in your guild.");

                return;
            }

            await ImageDb.DeleteImage(id);

            await Context.Channel.SendMessageAsync($"Image **{id}** is gone forever. Why have you done this?");

            await ImgurAPI.EditImageAsync(ImgurAPI.ParseId(image.Url), null, image.Id.ToString() + " [DELETED]");
        }
コード例 #2
0
ファイル: Images.cs プロジェクト: ta1H3n/Namiko
        public async Task Image(int id, [Remainder] string str = "")
        {
            var image = ImageDb.GetImage(id);

            if (image == null || (image.GuildId != 0 && image.GuildId != Context.Guild.Id))
            {
                await Context.Channel.SendMessageAsync($"There is no image with id: {id}");

                return;
            }
            var embed = ImageUtil.ToEmbed(image).Build();
            await Context.Channel.SendMessageAsync("", false, embed);
        }