Example #1
0
        /// <summary>
        /// The program runs all discord services and loads all the data here.
        /// </summary>
        public void LoadDiscord()
        {
            bot = new Bot(x =>
            {
                x.Name            = "Miki";
                x.Version         = "0.4.1";
                x.Token           = Global.ApiKey;
                x.ShardCount      = Global.shardCount;
                x.ConsoleLogLevel = LogLevel.ALL;
            });

            bot.Events.OnCommandError = async(ex, cmd, msg) =>
            {
                RuntimeEmbed e = new RuntimeEmbed();
                e.Title = Locale.GetEntity(0).GetString(Locale.ErrorMessageGeneric);
                e.Color = new IA.SDK.Color(1, 0.4f, 0.6f);

                if (Notification.CanSendNotification(msg.Author.Id, DatabaseEntityType.USER, DatabaseSettingId.ERRORMESSAGE))
                {
                    e.Description = "Miki has encountered a problem in her code with your request. We will send you a log and instructions through PM.";

                    await e.SendToChannel(msg.Channel);

                    e.Title       = $"You used the '{cmd.Name}' and it crashed!";
                    e.Description = "Please screenshot this message and send it to the miki issue page (https://github.com/velddev/miki/issues)";
                    e.AddField(f =>
                    {
                        f.Name     = "Error Message";
                        f.Value    = ex.Message;
                        f.IsInline = true;
                    });

                    e.AddField(f =>
                    {
                        f.Name     = "Error Log";
                        f.Value    = "```" + ex.StackTrace + "```";
                        f.IsInline = true;
                    });

                    e.CreateFooter();
                    e.Footer.Text = "Did you not want this message? use `>toggleerrors` to disable it!";

                    await msg.Author.SendMessage(e);

                    return;
                }
                e.Description = "... but you've disabled error messages, so we won't send you a PM :)";
                await e.SendToChannel(msg.Channel);
            };

            bot.AddDeveloper(121919449996460033);

            if (!string.IsNullOrEmpty(devId))
            {
                bot.AddDeveloper(ulong.Parse(devId));
            }

            bot.Client.JoinedGuild += Client_JoinedGuild;
        }
Example #2
0
        public async Task BuyMarriageSlotAsync(EventContext e)
        {
            using (var context = new MikiContext())
            {
                User user = await context.Users.FindAsync(e.Author.Id.ToDbLong());

                int limit = 10;

                if (user.IsDonator(context))
                {
                    limit += 5;
                }

                IDiscordEmbed embed = new RuntimeEmbed(new EmbedBuilder());

                if (user.MarriageSlots >= limit)
                {
                    embed.Description = $"For now, **{limit} slots** is the max. sorry :(";

                    if (limit == 15)
                    {
                        embed.AddField("Pro tip!", "Donators get 5 more slots!");
                    }

                    embed.Color = new IA.SDK.Color(1f, 0.6f, 0.4f);
                    await embed.SendToChannel(e.Channel);

                    return;
                }

                int costForUpgrade = (user.MarriageSlots - 4) * 2500;

                embed.Description = $"Do you want to buy a marriage slot for **{costForUpgrade}**?\n\nType `>yes` to confirm.";
                embed.Color       = new IA.SDK.Color(0.4f, 0.6f, 1f);
                await embed.SendToChannel(e.Channel);

                CommandHandler c = new CommandHandlerBuilder()
                                   .AddPrefix(">")
                                   .DisposeInSeconds(20)
                                   .SetOwner(e.message)
                                   .AddCommand(
                    new RuntimeCommandEvent("yes")
                    .Default(async(cont) =>
                {
                    await ConfirmBuyMarriageSlot(cont, costForUpgrade);
                }))
                                   .Build();

                Bot.instance.Events.AddPrivateCommandHandler(e.message, c);
            }
        }
Example #3
0
        private async Task ConfirmBuyMarriageSlot(EventContext cont, int costForUpgrade)
        {
            using (var context = new MikiContext())
            {
                User user = await context.Users.FindAsync(cont.Author.Id.ToDbLong());

                if (user.Currency >= costForUpgrade)
                {
                    user.MarriageSlots++;
                    user.Currency -= costForUpgrade;
                    IDiscordEmbed notEnoughMekosErrorEmbed = new RuntimeEmbed(new EmbedBuilder());
                    notEnoughMekosErrorEmbed.Color       = new IA.SDK.Color(0.4f, 1f, 0.6f);
                    notEnoughMekosErrorEmbed.Description = cont.GetResource("buymarriageslot_success", user.MarriageSlots);
                    await notEnoughMekosErrorEmbed.SendToChannel(cont.Channel);

                    await context.SaveChangesAsync();

                    await cont.commandHandler.RequestDisposeAsync();
                }
                else
                {
                    IDiscordEmbed notEnoughMekosErrorEmbed = new RuntimeEmbed(new EmbedBuilder());
                    notEnoughMekosErrorEmbed.Color       = new IA.SDK.Color(1, 0.4f, 0.6f);
                    notEnoughMekosErrorEmbed.Description = cont.GetResource("buymarriageslot_insufficient_mekos", (costForUpgrade - user.Currency));
                    await notEnoughMekosErrorEmbed.SendToChannel(cont.Channel);

                    await cont.commandHandler.RequestDisposeAsync();
                }
            }
        }
Example #4
0
        public async Task ShowMekosAsync(EventContext e)
        {
            ulong targetId = e.message.MentionedUserIds.Count > 0 ? e.message.MentionedUserIds.First() : 0;

            if (e.message.MentionedUserIds.Count > 0)
            {
                if (targetId == 0)
                {
                    await e.ErrorEmbed(e.GetResource("miki_module_accounts_mekos_no_user")).SendToChannel(e.Channel);

                    return;
                }
                IDiscordUser userCheck = await e.Guild.GetUserAsync(targetId);

                if (userCheck.IsBot)
                {
                    await e.ErrorEmbed(e.GetResource("miki_module_accounts_mekos_bot")).SendToChannel(e.Channel);

                    return;
                }
            }

            using (var context = new MikiContext())
            {
                User user = await context.Users.FindAsync(targetId != 0?(long)targetId : e.Author.Id.ToDbLong());

                IDiscordEmbed embed = new RuntimeEmbed(new EmbedBuilder());
                embed.Title       = "🔸 Mekos";
                embed.Description = e.GetResource("miki_user_mekos", user.Name, user.Currency);
                embed.Color       = new IA.SDK.Color(1f, 0.5f, 0.7f);

                await embed.SendToChannel(e.Channel);
            }
        }
Example #5
0
        public async Task CryAsync(EventContext e)
        {
            string[] images = new string[]
            {
                "http://i.imgur.com/TTUBf2r.gif",
                "http://i.imgur.com/o66oQyX.png",
                "http://i.imgur.com/6AP78bD.png",
                "http://i.imgur.com/IvMvs2K.gif",
                "http://i.imgur.com/0kdQ38I.gif",
                "http://i.imgur.com/0kdQ38I.gif",
                "http://i.imgur.com/YHYLO4E.gif",
                "http://i.imgur.com/wXqxiDs.gif",
                "http://i.imgur.com/jzafqAh.gif",
                "http://i.imgur.com/2HPoWSf.gif",
                "http://i.imgur.com/W7prbbo.gif",
                "http://i.imgur.com/cKqKcG3.gif",
                "http://i.imgur.com/GKO0EQD.gif",
                "http://i.imgur.com/cu825ub.gif",
                "http://i.imgur.com/TP6dYGh.gif"
            };

            RuntimeEmbed em = new RuntimeEmbed(new Discord.EmbedBuilder())
            {
                ImageUrl = images[Global.random.Next(0, images.Length)]
            };
            await em.SendToChannel(e.Channel);
        }
Example #6
0
        public async Task GreentextAsync(EventContext e)
        {
            string[] images = new string[]
            {
                "http://i.imgur.com/J2DLbV4.png",
                "http://i.imgur.com/H0kDub9.jpg",
                "http://i.imgur.com/pBOG489.jpg",
                "http://i.imgur.com/dIxeGOe.jpg",
                "http://i.imgur.com/p7lFyrY.jpg",
                "http://i.imgur.com/8qPmX5V.jpg",
                "http://i.imgur.com/u9orsoj.png",
                "http://i.imgur.com/EQGpV8A.jpg",
                "http://i.imgur.com/qGv3Xj1.jpg",
                "http://i.imgur.com/KFArF4B.png",
                "http://i.imgur.com/6Dv3W8V.png",
                "http://i.imgur.com/TJPnX57.png",
                "http://i.imgur.com/jle1rXs.png",
                "http://i.imgur.com/6V2wcjt.png",
                "http://i.imgur.com/KW5dBMg.jpg",
                "http://i.imgur.com/vdrAAuI.png",
                "http://i.imgur.com/QnRkQ7q.png",
                "http://i.imgur.com/sjNWj0r.jpg",
                "http://i.imgur.com/SXj7kg7.jpg",
                "http://i.imgur.com/eVwqceu.jpg",
                "http://i.imgur.com/JDOySvx.png",
                "http://i.imgur.com/fetJh3C.jpg",
                "http://i.imgur.com/iRKMtHT.png",
                "http://i.imgur.com/uxLqZXl.jpg",
                "http://i.imgur.com/6RDjjzP.jpg",
                "http://i.imgur.com/hNqXdxF.png",
                "http://i.imgur.com/xADVyFD.jpg",
                "http://i.imgur.com/JH8WqAg.jpg",
                "http://i.imgur.com/LvodsHR.jpg",
                "http://i.imgur.com/4y4wI21.jpg",
                "http://i.imgur.com/y6REP8l.png",
                "http://i.imgur.com/8gQdkwx.jpg",
                "http://i.imgur.com/JVBkdyo.jpg",
                "http://i.imgur.com/3VCDWyy.jpg",
                "http://i.imgur.com/5lGh8Vo.jpg",
                "http://i.imgur.com/ZwZvQYP.jpg",
                "http://i.imgur.com/USQa4GH.jpg",
                "http://i.imgur.com/FXHFLCH.jpg",
                "http://i.imgur.com/vRRK4qd.png",
                "http://i.imgur.com/0OycISQ.jpg",
                "http://i.imgur.com/0OycISQ.jpg",
                "http://i.imgur.com/g2vdQ6i.jpg",
                "http://i.imgur.com/3vDUWgr.png",
                "http://i.imgur.com/TN58jEQ.jpg",
                "http://i.imgur.com/94wckTB.png"
            };

            RuntimeEmbed em = new RuntimeEmbed(new Discord.EmbedBuilder())
            {
                ImageUrl = images[MikiRandom.Next(0, images.Length)]
            };
            await em.SendToChannel(e.Channel);
        }
Example #7
0
        public async Task ShowMekosAsync(EventContext e)
        {
            using (var context = new MikiContext())
            {
                User user = await context.Users.FindAsync(e.Author.Id.ToDbLong());

                IDiscordEmbed embed = new RuntimeEmbed(new EmbedBuilder());
                embed.Title       = "🔸 Mekos";
                embed.Description = $"{user.Name} has **{user.Currency}** mekos!";
                embed.Color       = new IA.SDK.Color(1f, 0.5f, 0.7f);

                await embed.SendToChannel(e.Channel);
            }
        }
Example #8
0
        public async Task StareAsync(EventContext e)
        {
            string[] images = new string[]
            {
                "http://i.imgur.com/Bp9vfcf.gif",
                "http://i.imgur.com/7nFd5ve.gif",
                "http://i.imgur.com/rmfWuM0.gif"
            };

            RuntimeEmbed em = new RuntimeEmbed(new Discord.EmbedBuilder());

            em.ImageUrl = images[MikiRandom.Next(0, images.Length)];

            await em.SendToChannel(e.Channel);
        }
Example #9
0
        public async Task ConfusedAsync(EventContext e)
        {
            string[] images = new string[]
            {
                "http://i.imgur.com/RCotXAK.png",
                "http://i.imgur.com/yN5cwQq.jpg",
                "http://i.imgur.com/5TkmRWv.png",
                "http://i.imgur.com/QBFQzCQ.png",
                "http://i.imgur.com/KjSp1W4.png",
                "http://i.imgur.com/mX6D68m.jpg",
                "http://i.imgur.com/ogA5GeN.jpg",
                "http://i.imgur.com/eCHsHQZ.jpg",
                "http://i.imgur.com/r0u2dBx.jpg",
                "http://i.imgur.com/d8oMJUg.jpg",
                "http://i.imgur.com/dkV331J.jpg",
                "http://i.imgur.com/U9N4oGR.jpg",
                "http://i.imgur.com/GA0ZtvR.jpg",
                "http://i.imgur.com/NQ2e3Dq.gifv",
                "http://i.imgur.com/5HTugJ6.jpg",
                "http://i.imgur.com/MJrBLij.png",
                "http://i.imgur.com/JgjCHPd.jpg",
                "http://i.imgur.com/KIDXXHw.gifv",
                "http://i.imgur.com/Eu0Yyqq.jpg",
                "http://i.imgur.com/P5V369I.png",
                "http://i.imgur.com/DtVEGde.gifv",
                "http://i.imgur.com/xxNH850.jpg",
                "http://i.imgur.com/gytATzW.jpg",
                "http://i.imgur.com/UrDJVC0.jpg",
                "http://i.imgur.com/3GkAnYo.png",
                "http://i.imgur.com/qTXPgyI.jpg",
                "http://i.imgur.com/GmIXuso.png",
                "http://i.imgur.com/UM8XpgR.gif",
                "http://i.imgur.com/GhoKM0u.gif",
                "http://i.imgur.com/ehskzgF.gif",
                "http://i.imgur.com/2biawgF.gif",
                "http://i.imgur.com/D2WXDbd.gif",
                "http://i.imgur.com/1ogeK3A.gif",
                "http://i.imgur.com/djNBrtj.jpg",
                "http://i.imgur.com/VyabzAv.jpg"
            };

            RuntimeEmbed em = new RuntimeEmbed(new Discord.EmbedBuilder());

            em.ImageUrl = images[MikiRandom.Next(0, images.Length)];

            await em.SendToChannel(e.Channel);
        }
Example #10
0
        public async Task SmugAsync(EventContext e)
        {
            string[] images = new string[]
            {
                "http://i.imgur.com/zUwqrhM.png",
                "http://i.imgur.com/TYqPh89.jpg",
                "http://i.imgur.com/xyOSaCt.png",
                "http://i.imgur.com/gyw0ifl.png",
                "http://i.imgur.com/kk0xvtx.png",
                "http://i.imgur.com/UIuyUne.jpg",
                "http://i.imgur.com/9zgIjY1.jpg",
                "http://i.imgur.com/Ku1ONAD.jpg",
                "http://i.imgur.com/7lB5bRT.jpg",
                "http://i.imgur.com/BoVHipF.jpg",
                "http://i.imgur.com/vN48mwz.png",
                "http://i.imgur.com/fGI4zLe.jpg",
                "http://i.imgur.com/Gc4gmwQ.jpg",
                "http://i.imgur.com/JMrmKt7.jpg",
                "http://i.imgur.com/a7sbJz2.jpg",
                "http://i.imgur.com/NebmjhR.png",
                "http://i.imgur.com/5ccbrFI.png",
                "http://i.imgur.com/XJL4Vmo.jpg",
                "http://i.imgur.com/eg0q1ez.png",
                "http://i.imgur.com/JJFxxmA.jpg",
                "http://i.imgur.com/2cTDF3b.jpg",
                "http://i.imgur.com/Xc0Duqv.png",
                "http://i.imgur.com/YgMdPkd.jpg",
                "http://i.imgur.com/BvAv6an.jpg",
                "http://i.imgur.com/KRLP5JT.jpg",
                "http://i.imgur.com/yXcsCK3.jpg",
                "http://i.imgur.com/QXG56kG.png",
                "http://i.imgur.com/OFBz1YJ.png",
                "http://i.imgur.com/9ulVckY.png",
                "http://i.imgur.com/VLXeSJK.png",
                "http://i.imgur.com/baiMBP6.png"
            };

            RuntimeEmbed em = new RuntimeEmbed(new Discord.EmbedBuilder())
            {
                ImageUrl = images[MikiRandom.Next(0, images.Length)]
            };
            await em.SendToChannel(e.Channel);
        }
Example #11
0
        public async Task GreentextAsync(EventContext e)
        {
            string[] images = new string[]
            {
                "http://i.imgur.com/4YWLl8k.png",
                "http://i.imgur.com/Y0ceUvy.jpg",
                "http://i.imgur.com/iT0JmUQ.jpg",
                "http://i.imgur.com/oDomO9J.jpg",
                "http://i.imgur.com/KiXLoow.jpg",
                "http://i.imgur.com/8ImcmvP.jpg",
                "http://i.imgur.com/CBNW6A5.png",
                "http://i.imgur.com/N9pu80t.jpg",
                "http://i.imgur.com/csTRvKz.jpg",
                "http://i.imgur.com/WkFbLtP.png",
                "http://i.imgur.com/h4a8wPH.png"
            };

            RuntimeEmbed em = new RuntimeEmbed(new Discord.EmbedBuilder())
            {
                ImageUrl = images[Global.random.Next(0, images.Length)]
            };
            await em.SendToChannel(e.Channel);
        }
Example #12
0
        public async Task PoutAsync(EventContext e)
        {
            string[] images = new string[]
            {
                "http://i.imgur.com/hsjBcz1.jpg",
                "http://i.imgur.com/oJSVNzT.jpg",
                "http://i.imgur.com/gWtmHoN.jpg",
                "http://i.imgur.com/VFG9zKV.png",
                "http://i.imgur.com/BUBiL0f.jpg",
                "http://i.imgur.com/UdlZ69E.gif",
                "http://i.imgur.com/yhryAf9.png",
                "http://i.imgur.com/d9DG2sJ.png",
                "http://i.imgur.com/uTB2HIY.png",
                "http://i.imgur.com/dVtR9vI.png",
                "http://i.imgur.com/rt7Vgn3.jpg",
                "http://i.imgur.com/uTB2HIY.png"
            };

            RuntimeEmbed em = new RuntimeEmbed(new Discord.EmbedBuilder());

            em.ImageUrl = images[MikiRandom.Next(0, images.Length)];

            await em.SendToChannel(e.Channel);
        }
Example #13
0
        public async Task CryAsync(EventContext e)
        {
            string[] images = new string[]
            {
                "http://i.imgur.com/TTUBf2r.gif",
                "http://i.imgur.com/TP6dYGh.gif",
                "http://i.imgur.com/o66oQyX.png",
                "http://i.imgur.com/6AP78bD.png",
                "http://i.imgur.com/IvMvs2K.gif",
                "http://i.imgur.com/0kdQ38I.gif",
                "http://i.imgur.com/0kdQ38I.gif",
                "http://i.imgur.com/YHYLO4E.gif",
                "http://i.imgur.com/wXqxiDs.gif",
                "http://i.imgur.com/jzafqAh.gif",
                "http://i.imgur.com/2HPoWSf.gif",
                "http://i.imgur.com/W7prbbo.gif",
                "http://i.imgur.com/cKqKcG3.gif",
                "http://i.imgur.com/GKO0EQD.gif",
                "http://i.imgur.com/cu825ub.gif",
                "http://i.imgur.com/TP6dYGh.gif",
                "http://i.imgur.com/uZ2WXyL.mp4",
                "http://i.imgur.com/DhkvnpB.gif",
                "http://i.imgur.com/LbpaJMG.gif",
                "http://i.imgur.com/V7iS3ZR.gif",
                "http://i.imgur.com/TLoHpfE.gif",
                "http://i.imgur.com/35tYOoB.gif",
                "http://i.imgur.com/Q6I2fiy.gif",
                "http://i.imgur.com/7Tw9dPP.gif",
                "http://i.imgur.com/aIiuJg8.gif",
                "http://i.imgur.com/0xIG1kG.gif",
                "http://i.imgur.com/nE0Tdp0.gif",
                "http://i.imgur.com/mvyAx5q.gif",
                "http://i.imgur.com/diq8LxU.mp4",
                "http://i.imgur.com/Zv7au0h.gif",
                "http://i.imgur.com/sOyqImI.gif",
                "http://i.imgur.com/ZRbHJcb.gif",
                "http://i.imgur.com/kysvK28.gif",
                "http://i.imgur.com/6tGAJ75.mp4",
                "http://i.imgur.com/5k6aD7Z.gif",
                "http://i.imgur.com/B29MytB.gif",
                "http://i.imgur.com/FQx8zRj.gif",
                "http://i.imgur.com/5vUBsz4.gif",
                "http://i.imgur.com/rBMTG5o.gif",
                "http://i.imgur.com/qfcReCj.gif",
                "http://i.imgur.com/CRdCCoH.gif",
                "http://i.imgur.com/FVt8Jqr.gif",
                "http://i.imgur.com/mjziZGI.gif",
                "http://i.imgur.com/DEgkwBe.gif",
                "http://i.imgur.com/hfRw1my.mp4",
                "http://i.imgur.com/Sus5vcM.gif",
                "http://i.imgur.com/HLmnS6S.gif",
                "http://i.imgur.com/w9UjKVR.gif",
                "http://i.imgur.com/QZvnKHs.gif",
                "http://i.imgur.com/Mw49bFm.gif",
                "http://i.imgur.com/UVxws3C.gif",
                "http://i.imgur.com/ekhYSVB.gif",
                "http://i.imgur.com/VOMpsf6.mp4",
                "http://i.imgur.com/ZFnoy0i.gif",
                "http://i.imgur.com/180yuVH.gif",
                "http://i.imgur.com/3zVAY49.gif",
                "http://i.imgur.com/AFDevRo.gif",
                "http://i.imgur.com/T23nHVO.mp4",
                "http://i.imgur.com/qZWhIOw.gif",
                "http://i.imgur.com/Iy2VjHw.gif",
                "http://i.imgur.com/DbUYdpj.gif",
                "http://i.imgur.com/XqYZOiv.gif",
                "http://i.imgur.com/sYV2GBp.gif",
                "http://i.imgur.com/hxbNeGL.gif",
                "http://i.imgur.com/RXdJczP.gif",
                "http://i.imgur.com/JzmQgZq.gif",
                "http://i.imgur.com/NkLgdj8.gif",
                "http://i.imgur.com/kMzX2d4.gif",
                "http://i.imgur.com/WLNfW3d.gif",
                "http://i.imgur.com/Oxk8HUp.gif",
                "http://i.imgur.com/HTlRErM.gif",
                "http://i.imgur.com/KKgROec.gif",
                "http://i.imgur.com/W0WetV3.gif",
                "http://i.imgur.com/Ny9alj7.gif",
                "http://i.imgur.com/HNBYRZb.gif",
                "http://i.imgur.com/WOqFHee.gif",
                "http://i.imgur.com/rmlZXaP.gif",
                "http://i.imgur.com/mcVLAXi.gif",
                "http://i.imgur.com/SalWtcC.gif",
                "http://i.imgur.com/pkT7JFw.gif",
                "http://i.imgur.com/Tx15hPX.gif",
                "http://i.imgur.com/YANiZ2a.gif",
                "http://i.imgur.com/31WnXZ7.gif"
            };

            RuntimeEmbed em = new RuntimeEmbed(new Discord.EmbedBuilder())
            {
                ImageUrl = images[MikiRandom.Next(0, images.Length)]
            };
            await em.SendToChannel(e.Channel);
        }