Ejemplo n.º 1
0
        public async Task AdminBalance(CommandContext ctx)
        {
            //Locks command to Planetarium Server and Server Owner.
            //if (ctx.Guild.Id == 539405872346955788 && ctx.Member.IsOwner)
            if (ctx.Guild.Id == 826783795842777098) //Test Server
            {
                var      username   = ctx.Member.Username;
                var      oldmessage = ctx.Message;
                TipModel profile    = new TipModel();
                var      comms      = new Communication();

                Console.WriteLine("Balance Called");
                //get user's profile and check if they are an admin, if not don't acknowledge the command exists.
                profile = await Tips.ProfileExistsNew(ctx.Member.Id);

                if (profile.Role == "Admin")
                {
                    var eyes = DiscordEmoji.FromName(ctx.Client, ":eyes:");
                    await ctx.Message.CreateReactionAsync(eyes).ConfigureAwait(false);

                    var value = Tips.AdminBalanceCheck();
                    await comms.AdminBalance(ctx, oldmessage, username, value.Result);
                }
            }
        }
Ejemplo n.º 2
0
        public async Task Tip(CommandContext ctx, DiscordUser dis = null, int amount = 0)
        {
            var username = ctx.Member.Username;
            var eyes     = DiscordEmoji.FromName(ctx.Client, ":eyes:");
            await ctx.Message.CreateReactionAsync(eyes).ConfigureAwait(false);

            var oldmessage = ctx.Message;
            //
            TipModel caller = new TipModel();
            var      comms  = new Communication();

            if (amount <= 0 || dis == null)
            {
                await comms.HelpError(ctx, oldmessage, ctx.Member.Username);
            }
            else
            {
                string mentionedUserId         = dis.Mention;
                string filteredMentionedUserID = mentionedUserId.Substring(2, mentionedUserId.Length - 3);
                ulong  uLMentionedUserId       = ulong.Parse(filteredMentionedUserID);
                var    result = await Tips.TipsSystemAsync(ctx.User.Id, uLMentionedUserId, amount);

                Console.WriteLine(result);

                // Get user's profile so we can pass their details to the communication function;
                caller = await Tips.ProfileExistsNew(ctx.Member.Id);

                //Check how much NCG is left in the bot in case it was called by an admin.
                var softcap = Tips.AdminBalanceCheck();
                //NEB - Not Enough Balance
                //PASS - Can't Tip yourself.
                //Fail - Failed Tip
                //Complete - All green
                //AComplete - Admin Custom "All Green"

                switch (result)
                {
                case Status.NEB:
                    await comms.NotEnoughBalance(ctx, oldmessage, ctx.Member.Username);

                    break;

                case Status.PASS:
                    await comms.TipYourself(ctx, oldmessage, ctx.Member.Username);

                    break;

                case Status.FAIL:
                    await comms.FailedTep(ctx, oldmessage, ctx.Member.Username);

                    break;

                case Status.COMPLETE:
                    await comms.SuccessFulTip(ctx, oldmessage, ctx.Member.Username, caller, dis.Mention, amount, 0);

                    break;

                case Status.ACOMPLETE:
                    await comms.SuccessFulTip(ctx, oldmessage, ctx.Member.Username, caller, dis.Mention, amount, softcap.Result);

                    break;

                default:
                    await comms.FailedTep(ctx, oldmessage, ctx.Member.Username);

                    break;
                }
            }
        }