Esempio n. 1
0
 public ShopProductController(ShopProductRepository shopProductRepository
                              , IConfiguration configuration
                              , ProductRepostitory productRepostitory
                              , ProductPackageDetailsRepostitory productPackageDetailsRepostitory
                              , ShopOrderRepository shopOrderRepository
                              , ManageBankService manageBankService
                              , UsersPaymentRepository usersPaymentRepository
                              , UserAddressRepository userAddressRepository
                              , UserRepository userRepository
                              , ShopOrderPaymentRepository shopOrderPaymentRepository
                              , ProductUnitRepository productUnitRepository
                              , LogRepository logRepository
                              , WarehouseProductCheckRepository warehouseProductCheckRepository
                              , SmsRestClient smsRestClient
                              , OstanRepository ostanRepository)
 {
     _bankConfig                       = configuration.GetSection(nameof(BankConfig)).Get <BankConfig>();
     _shopProductRepository            = shopProductRepository;
     _configuration                    = configuration;
     _productRepostitory               = productRepostitory;
     _productPackageDetailsRepostitory = productPackageDetailsRepostitory;
     _shopOrderRepository              = shopOrderRepository;
     _manageBankService                = manageBankService;
     _usersPaymentRepository           = usersPaymentRepository;
     _userAddressRepository            = userAddressRepository;
     _userRepository                   = userRepository;
     _shopOrderPaymentRepository       = shopOrderPaymentRepository;
     _productUnitRepository            = productUnitRepository;
     _logRepository                    = logRepository;
     _warehouseProductCheckRepository  = warehouseProductCheckRepository;
     _smsRestClient                    = smsRestClient;
     _ostanRepository                  = ostanRepository;
 }
Esempio n. 2
0
        public async Task Auctioncheck()
        {
            var DM = await Context.User.GetOrCreateDMChannelAsync();

            if (auctionCheck.Equals("over") || auctionCheck.Equals(""))
            {
                var message = await DM.SendMessageAsync("Sorry there isn't an auction at this time.");

                await Delete.DelayDeleteMessage(Context.Message, 10);

                await Delete.DelayDeleteMessage(message, 10);

                return;
            }
            var auctionStatus = Context.Channel.GetMessageAsync(currentAuction);

            var embed = auctionStatus.Result.Embeds.FirstOrDefault() as Embed;
            await DM.SendMessageAsync("", false, embed);

            await Delete.DelayDeleteMessage(Context.Message, 10);


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 3
0
        public async Task Points()
        {
            var points = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;

            if (points >= 0)
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colors.fightCol
                };

                embed.Title       = $"{Context.User.Username}'s Points";
                embed.Description = $"You have " + points + " points from your fights!";
                await ReplyAsync("", false, embed.Build());
            }
            else
            {
                await errors.sendError(Context.Channel, "You appear to have negative points, contact a developer.", Colors.fightCol);
            }

            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 4
0
        private async Task Help()
        {
            var embed = new EmbedBuilder()
            {
                Color = Colors.helpCol
            };
            var footer = new EmbedFooterBuilder()
            {
                Text = "Requested by " + Context.User.Username
            };
            var generalField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help general", Value = "Displays General Commands."
            };
            var musicField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help music", Value = "Displays Music Commands."
            };
            var bankField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help bank", Value = "Displays Bank Commands."
            };
            var aucField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help auction", Value = "Displays Auction Commands."
            };
            var nsfwField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help nsfw", Value = "Displays NSFW Commands."
            };
            var adminField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help admin", Value = "Displays Admin Commands."
            };

            embed.Title       = $"╋━━━━━━◥◣ KnightBot Help ◢◤━━━━━━╋";
            embed.Description = "More Commands Will Be Added Soon!";
            embed.WithFooter(footer);
            embed.WithCurrentTimestamp();
            embed.AddField(generalField);
            embed.AddField(musicField);
            embed.AddField(bankField);
            embed.AddField(aucField);
            embed.AddField(nsfwField);
            embed.AddField(adminField);

            await Context.Channel.SendMessageAsync("", false, embed);


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 5
0
        private async Task UpDateHighBidder(SocketUserMessage messageDetails, int bid)
        {
            var exactMessage = await messageDetails.Channel.GetMessageAsync(currentAuction) as IUserMessage;

            var embed2   = new EmbedBuilder();
            var oldField = exactMessage.Embeds.FirstOrDefault().Fields.FirstOrDefault();

            embed2.AddField(x =>
            {
                x.Name     = oldField.Name;
                x.Value    = oldField.Value;
                x.IsInline = oldField.Inline;
            });

            embed2.AddField(x =>
            {
                x.Name     = "New Highest Bid!";
                x.IsInline = false;
                x.Value    = $"{currentItem} highest bid is {bid} by {highBidder}.";
            });


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
        public static void AddPaymentServices(this IServiceCollection services, IConfiguration config)
        {
            // Add bank services
            var bankConfig = new BankConfig();

            config.GetSection(nameof(BankConfig)).Bind(bankConfig);
            if (bankConfig.UseFake)
            {
                services.AddTransient <IBankService, FakeBankService>();
                services.AddTransient <IFakeBankValidatorService, FakeBankValidatorService>();
                services.AddTransient <IFakeBankClientService, FakeBankClientService>();
                services.AddTransient <IFakeBankClientRepository, FakeBankClientRepository>();
                services.AddTransient <IFakeBankMerchantService, FakeBankMerchantService>();
            }

            // Add validation services

            // Add payment services
            services.AddSingleton <IPaymentsService, PaymentsService>();
            services.AddSingleton <IPaymentMapper, PaymentMapper>();
            services.AddSingleton <IPaymentValidator, CardNumberPrefixValidator>();
            services.AddSingleton <IValidatorService, ValidatorService>();

            // Add automapper configs
            var mapperConfig = new MapperConfiguration(mc =>
            {
                mc.CreateMap <MakePaymentCommandDto, MakePaymentCommand>();
                mc.AddProfile <PaymentProfile>();
            });
        }
        public Response Add(BankConfig value)
        {
            Response response = new Response();

            try
            {
                var exist = List().branchconfigs.Where(x => x.ConfigName.ToLower() == value.ConfigName.ToLower());
                if (exist.Count() > 0)
                {
                    response.Status      = false;
                    response.Description = "Record already exists";
                    return(response);
                }
                using (IDbConnection conn = GetConnection())
                {
                    conn.Insert(value);
                    response.Status      = true;
                    response.Description = "Successful";
                }
            }
            catch (Exception ex)
            {
                response.Status      = false;
                response.Description = ex.Message;
            }
            return(response);
        }
Esempio n. 8
0
        public async Task EightBall([Remainder] string input)
        {
            int    randomIndex = rand.Next(predictionTexts.Length);
            string text        = predictionTexts[randomIndex];

            var embed = new EmbedBuilder()
            {
                Color = Colors.ballCol
            };

            embed.Title       = "**╋━━━━━━◥◣ Magic 8 Ball ◢◤━━━━━━╋**";
            embed.Description = Environment.NewLine + Context.User.Mention + ", " + text;

            await Context.Channel.SendMessageAsync("", false, embed);

            await Context.Message.DeleteAsync();


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 9
0
        public async Task Fight(IUser user)
        {
            if (Context.User.Mention != user.Mention && SwitchCaseString == "nofight")
            {
                SwitchCaseString = "fight_p1";
                player1          = Context.User.Mention;
                player2          = user.Mention;

                string[] whoStarts = new string[]
                {
                    Context.User.Mention,
                    user.Mention
                };

                Random rand = new Random();

                int    randomIndex = rand.Next(whoStarts.Length);
                string text        = whoStarts[randomIndex];

                whosTurn = text;
                if (text == Context.User.Mention)
                {
                    whoWaits = user.Mention;
                }
                else
                {
                    whoWaits = Context.User.Mention;
                }

                var embed = new EmbedBuilder()
                {
                    Color = Colors.fightCol
                };
                embed.Description = ("Fight started between " + Context.User.Mention + " and " + user.Mention + "!\n\n" + player1 + " you have " + health1 + " health!\n" + player2 + " you have " + health2 + " health!\n\n" + text + " your turn!");
                await ReplyAsync("", false, embed.Build());
            }
            else
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colors.fightCol
                };
                embed.Description = (Context.User.Mention + " Sorry but there is already a fight going on, or  you simply tried to fight yourself.");
                await ReplyAsync("", false, embed.Build());
            }
            await Context.Message.DeleteAsync();


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 10
0
 public ManageBankService(IConfiguration configuration
                          , UsersPaymentRepository usersPaymentRepository
                          , ShopProductRepository shopProductRepository
                          , ShopOrderRepository shopOrderRepository)
 {
     _bankConfig             = configuration.GetSection(nameof(BankConfig)).Get <BankConfig>();
     _usersPaymentRepository = usersPaymentRepository;
     _shopProductRepository  = shopProductRepository;
     _shopOrderRepository    = shopOrderRepository;
 }
Esempio n. 11
0
        private async Task NsfwHelp()
        {
            var embed = new EmbedBuilder()
            {
                Color = Colors.nsfwCol
            };
            var footer = new EmbedFooterBuilder()
            {
                Text = "Requested by " + Context.User.Username
            };
            var joinField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw join", Value = "Adds The NSFW Role To You."
            };
            var leaveField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw leave", Value = "Removes The NSFW Role From You."
            };
            var buttField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw butt", Value = "Perfect For Any Butt Lovers."
            };
            var boobsField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw boobs", Value = "Perfect For Any Boobs Lovers."
            };
            var gifField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "nsfw gif", Value = "Sends A Random Gif ;)"
            };

            embed.Title       = $"╋━━━━━━◥◣ KnightBot NSFW Help ◢◤━━━━━━╋";
            embed.Description = "Here Are All Of The NSFW Commands!";
            embed.WithFooter(footer);
            embed.WithCurrentTimestamp();
            embed.AddField(joinField);
            embed.AddField(leaveField);
            embed.AddField(buttField);
            embed.AddField(boobsField);
            embed.AddField(gifField);
            await Context.Channel.SendMessageAsync("", false, embed);

            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 12
0
        public async Task addMoney(SocketMessage msg)
        {
            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 13
0
        public async Task Auction(int startingBid, int amount, string item, [Remainder] string info = null)
        {
            if (auctionCheck.Equals("live"))
            {
                await ReplyAsync("A auction is currently live!");
            }
            else
            {
                if (auctionCheck.Equals("") || auctionCheck.Equals("over"))
                {
                    auctionCheck.Equals("Live");
                }
                else if (auctionCheck == "live")
                {
                    var messageToDel = await ReplyAsync("Auction already started, only auction can be held at a time!");

                    await Delete.DelayDeleteMessage(Context.Message, 10);

                    await Delete.DelayDeleteMessage(messageToDel, 10);

                    return;
                }
                var embed = new EmbedBuilder();

                embed.AddField(x =>
                {
                    x.Name  = $"Auction for {item} started {DateTime.UtcNow} UTC ";
                    x.Value = $"{amount} x {item} is up for auction with a starting bid of {startingBid}\nType !bid [amount] to bid.";
                });
                var message = await ReplyAsync("", embed : embed);

                hightBid = startingBid - 1;

                currentItem = item;

                currentAuction = message.Id;
            }


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 14
0
        private async Task AucHelp()
        {
            var embed = new EmbedBuilder()
            {
                Color = Colors.moneyCol
            };
            var footer = new EmbedFooterBuilder()
            {
                Text = "Requested by " + Context.User.Username
            };
            var auctionField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "auction <amount> <quantity> <item>", Value = "Starts A New Auction."
            };
            var auctionEndField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "auctionend", Value = "Ends The Current Auction."
            };
            var auctionCheckField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "auctioncheck", Value = "Checks If There Is A Current Auction."
            };
            var bidField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "bid <amount>", Value = "Bid On The Current Auction."
            };

            embed.Title       = $"╋━━━━━━◥◣ KnightBot Auction Help ◢◤━━━━━━╋";
            embed.Description = "Here Are All Of The Bank Commands!";
            embed.WithFooter(footer);
            embed.WithCurrentTimestamp();
            embed.AddField(auctionField);
            embed.AddField(auctionEndField);
            embed.AddField(auctionCheckField);
            embed.AddField(bidField);

            await Context.Channel.SendMessageAsync("", false, embed);

            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 15
0
        public static IBankConfigService BuildBankConfigServiceMock(BankConfig expectedConfig)
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);

            response.Content = new StringContent(JsonConvert.SerializeObject(expectedConfig), Encoding.UTF8, "application/json");

            var requestSenderMock      = new Mock <IHttpRequestSender>();
            IBankConfigService service = new BankConfigService(requestSenderMock.Object);

            requestSenderMock
            .Setup(x => x.GetAsync("/config"))
            .ReturnsAsync(response);

            return(service);
        }
Esempio n. 16
0
        public async Task Auctionover()
        {
            if (auctionCheck.Equals("over"))
            {
                await ReplyAsync("There is no auction right now.");
            }
            else
            {
                if (highBidder == null)
                {
                    await Context.Channel.SendMessageAsync("The auction has ended with 0 bids.");

                    auctionCheck   = "over";
                    hightBid       = 0;
                    currentItem    = null;
                    currentAuction = 0;
                    return;
                }
                var embed = new EmbedBuilder();
                embed.Title = $"{highBidder} won the auction for {currentItem}";
                embed.AddField(x =>
                {
                    x.Name     = $"Auction ended at {DateTime.UtcNow} UTC";
                    x.Value    = $"Once you pay {hightBid}, we will arrage payment and delivery of {currentItem} soon after. \n Congrats! :tada: ";
                    x.IsInline = false;
                });
                auctionCheck   = "over";
                highBidder     = null;
                hightBid       = 0;
                currentItem    = null;
                currentAuction = 0;
                await Context.Channel.SendMessageAsync("", false, embed);
            }


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
 public ShopProductController(ShopProductRepository shopProductRepository
                              , IConfiguration configuration
                              , ProductRepostitory productRepostitory
                              , ProductPackageDetailsRepostitory productPackageDetailsRepostitory
                              , ShopOrderRepository shopOrderRepository
                              , ManageBankService manageBankService
                              , UsersPaymentRepository usersPaymentRepository)
 {
     _bankConfig                       = configuration.GetSection(nameof(BankConfig)).Get <BankConfig>();
     _shopProductRepository            = shopProductRepository;
     _configuration                    = configuration;
     _productRepostitory               = productRepostitory;
     _productPackageDetailsRepostitory = productPackageDetailsRepostitory;
     _shopOrderRepository              = shopOrderRepository;
     _manageBankService                = manageBankService;
     _usersPaymentRepository           = usersPaymentRepository;
 }
Esempio n. 18
0
        private async Task BankHelp()
        {
            var embed = new EmbedBuilder()
            {
                Color = Colors.moneyCol
            };
            var footer = new EmbedFooterBuilder()
            {
                Text = "Requested by " + Context.User.Username
            };
            var bankField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "bank open", Value = "Opens A Bank Account In Your Name!"
            };
            var moneyField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "bank balance", Value = "Displays Your Current Balance!"
            };
            var transferField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "bank transfer <user> <amount>", Value = "Transfer Money To Another Player."
            };

            embed.Title       = $"╋━━━━━━◥◣ KnightBot Bank Help ◢◤━━━━━━╋";
            embed.Description = "Here Are All Of The Bank Commands!";
            embed.WithFooter(footer);
            embed.WithCurrentTimestamp();
            embed.AddField(bankField);
            embed.AddField(moneyField);
            embed.AddField(transferField);

            await Context.Channel.SendMessageAsync("", false, embed);


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 19
0
        private async Task GenHelp()
        {
            var embed = new EmbedBuilder()
            {
                Color = Colors.helpCol
            };
            var footer = new EmbedFooterBuilder()
            {
                Text = "Requested by " + Context.User.Username
            };
            var helpField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "help", Value = "Displays The Commands The KnightBot Can Do."
            };
            var dogField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "doggo", Value = "Displays A Random Dog Image!"
            };
            var catField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "cat", Value = "Displays A Random Cat Image!"
            };

            embed.Title       = $"╋━━━━━━◥◣ KnightBot General Help ◢◤━━━━━━╋";
            embed.Description = "More Commands Will Be Added Soon!";
            embed.WithFooter(footer);
            embed.WithCurrentTimestamp();
            embed.AddField(helpField);
            embed.AddField(dogField);
            embed.AddField(catField);

            await Context.Channel.SendMessageAsync("", false, embed);

            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 20
0
        private async Task AdminHelp()
        {
            var embed = new EmbedBuilder()
            {
                Color = Colors.adminCol
            };
            var footer = new EmbedFooterBuilder()
            {
                Text = "Requested by " + Context.User.Username
            };
            var kickField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "kick <user> <reason>", Value = "Kicks The Specified User."
            };
            var banField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "ban <user> <reason>", Value = "Bans The Specified User."
            };
            var clearField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "clear <Amount>", Value = "Clears 1-100 Messages."
            };

            embed.Title       = $"╋━━━━━━◥◣ KnightBot Admin Help ◢◤━━━━━━╋";
            embed.Description = "Here Are All Of The Bank Commands!";
            embed.WithFooter(footer);
            embed.WithCurrentTimestamp();
            embed.AddField(kickField);
            embed.AddField(banField);
            embed.AddField(clearField);

            await Context.Channel.SendMessageAsync("", false, embed);

            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 21
0
        public Response Update(BankConfig value)
        {
            Response response = new Response();

            try
            {
                using (IDbConnection conn = GetConnection())
                {
                    conn.Update(value);
                    response.Status      = true;
                    response.Description = "Successful";
                }
            }
            catch (Exception ex)
            {
                response.Status      = false;
                response.Description = ex.Message;
            }
            return(response);
        }
Esempio n. 22
0
        private async Task MusicHelp()
        {
            var embed = new EmbedBuilder()
            {
                Color = Colors.musicCol
            };
            var footer = new EmbedFooterBuilder()
            {
                Text = "Requested by " + Context.User.Username
            };
            var playField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "play <link directly to song on youtube>", Value = "Plays The Song In Your Voice Channel!"
            };
            var stopField = new EmbedFieldBuilder()
            {
                Name = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix + "stop", Value = "Stops The Songs That Is Currently Playing!"
            };

            embed.Title       = $"╋━━━━━━◥◣ KnightBot Music Help ◢◤━━━━━━╋";
            embed.Description = "Here Are All Of The Music Commands!";
            embed.WithFooter(footer);
            embed.WithCurrentTimestamp();
            embed.AddField(playField);
            embed.AddField(stopField);

            await Context.Channel.SendMessageAsync("", false, embed);


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
 public ManageBankService(IConfiguration configuration
                          , UsersPaymentRepository usersPaymentRepository
                          , ShopProductRepository shopProductRepository
                          , ShopOrderRepository shopOrderRepository
                          , SmsRestClient smsRestClient
                          , UserRepository userRepository
                          , ShopOrderStatusRepository shopOrderStatusRepository
                          , ShopOrderPaymentRepository shopOrderPaymentRepository
                          , TreeRepository treeRepository
                          , LogRepository logRepository)
 {
     _bankConfig                 = configuration.GetSection(nameof(BankConfig)).Get <BankConfig>();
     _usersPaymentRepository     = usersPaymentRepository;
     _shopProductRepository      = shopProductRepository;
     _shopOrderRepository        = shopOrderRepository;
     _smsRestClient              = smsRestClient;
     _userRepository             = userRepository;
     _shopOrderStatusRepository  = shopOrderStatusRepository;
     _shopOrderPaymentRepository = shopOrderPaymentRepository;
     _treeRepository             = treeRepository;
     _logRepository              = logRepository;
 }
Esempio n. 24
0
        public async Task Cat()
        {
            await Program.Logger(new LogMessage(LogSeverity.Debug, "[API]", "The Cat API Is Loading!"));

            using (var client = new HttpClient(new HttpClientHandler {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            }))
            {
                string websiteurl = "http://aws.random.cat//meow";
                client.BaseAddress = new Uri(websiteurl);
                HttpResponseMessage response = client.GetAsync("").Result;
                response.EnsureSuccessStatusCode();
                string result = await response.Content.ReadAsStringAsync();

                var    json     = JObject.Parse(result);
                string CatImage = json["file"].ToString();


                var embed = new EmbedBuilder()
                {
                    Color = Colors.generalCol
                };

                embed.WithImageUrl(CatImage);
                await Context.Channel.SendMessageAsync("", false, embed);
            }
            await Context.Message.DeleteAsync();

            var result2 = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result2 + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
Esempio n. 25
0
        public async void BankConfigIsReturned()
        {
            var expectedConfig = new BankConfig
            {
                PrimaryValidator = new ValidatorNode
                {
                    AccountNumber         = "2e86f48216567302527b69eae6c6a188097ed3a9741f43cc3723e570cf47644c",
                    IpAddress             = "54.183.17.224",
                    NodeIdentifier        = "2262026a562b0274163158e92e8fbc4d28e519bc5ba8c1cf403703292be84a51",
                    Port                  = null,
                    Protocol              = "http",
                    Version               = "v1.0",
                    DefaultTransactionFee = 1,
                    RootAccountFile       = "https://gist.githubusercontent.com/buckyroberts/0688f136b6c1332be472a8baf10f78c5/raw/323fcd29672e392be2b934b82ab9eac8d15e840f/alpha-00.json",
                    RootAccountFileHash   = "0f775023bee79884fbd9a90a76c5eacfee38a8ca52735f7ab59dab63a75cbee1",
                    SeedBlockIdentifier   = "",
                    DailyConfirmationRate = null,
                    Trust                 = "100.00"
                },
                AccountNumber         = "dfddf07ec15cbf363ecb52eedd7133b70b3ec896b488460bcecaba63e8e36be5",
                IpAddress             = "143.110.137.54",
                NodeIdentifier        = "6dbaff44058e630cb375955c82b0d3bd7bc7e20cad93e74909a8951f747fb8a4",
                Port                  = null,
                Protocol              = "http",
                Version               = "v1.0",
                DefaultTransactionFee = 1,
                NodeType              = NodeType.Bank
            };

            var service = BuildBankConfigServiceMock(expectedConfig);

            var bankConfig = await service.GetBankConfigAsync();

            var expectedConfigStr = JsonConvert.SerializeObject(expectedConfig);
            var actualConfigStr   = JsonConvert.SerializeObject(bankConfig);

            Assert.Equal(expectedConfigStr, actualConfigStr);
        }
Esempio n. 26
0
        public async Task GiveUp()
        {
            if (SwitchCaseString == "fight_p1")
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colors.fightCol
                };
                embed.Description = ("The Fight Has Stopped!");
                await ReplyAsync("", false, embed.Build());

                SwitchCaseString = "nofight";
                health1          = maxHealth;
                health2          = maxHealth;
            }
            else
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colors.fightCol
                };
                embed.Description = (Context.User.Mention + ", There is no fight to stop.");
                await ReplyAsync("", false, embed.Build());
            }
            await Context.Message.DeleteAsync();


            var result = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentMoney;

            int bal = 10;

            total = result + bal;

            save.userID        = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").userID;
            save.currentMoney  = total;
            save.currentPoints = BankConfig.Load("bank/" + Context.User.Id.ToString() + ".json").currentPoints;
            save.Save("bank/" + Context.User.Id.ToString() + ".json");
        }
 public Response Add([FromBody] BankConfig value)
 {
     return(repo.Add(value));
 }
Esempio n. 28
0
 public void OutPut()
 {
     Output.WriteLine(BankConfig.GetBankInfoList().ToJson());
 }
Esempio n. 29
0
 public EodLogic()
 {
     config        = _bankConfig.GetFirst();
     financialDate = config.FinancialDate;
 }
 public Response Update([FromBody] BankConfig value)
 {
     return(repo.Update(value));
 }