示例#1
0
        public async Task AnnounceUserJoined(SocketGuildUser user)
        {
            BotConfig config = new BotConfig();

            config         = Update.UpdateConfig(config);
            config.Members = BotConfig.Load().Members + 1;
            config.Save();

            var ranks = new RankSaves();

            ranks.newMembersCount  = RankSaves.Load().newMembersCount + 1;
            ranks.userCount        = RankSaves.Load().userCount;
            ranks.musicCount       = RankSaves.Load().musicCount;
            ranks.programmingCount = RankSaves.Load().programmingCount;
            ranks.graphicsCount    = RankSaves.Load().graphicsCount;
            ranks.Save();

            var newMemberRank = BotConfig.Load().NewMemberRank;
            var role          = user.Guild.Roles.FirstOrDefault(x => x.Name.ToString() == newMemberRank);

            await(user as IGuildUser).AddRoleAsync(role);

            var welcomeChannel = Context.Guild.GetChannelAsync(BotConfig.Load().welcomeChannelId);

            if (welcomeChannel != null)
            {
                var message = await Context.Channel.SendMessageAsync("Hey " + Context.User.Mention + ", read the above post, read the rules and then head into #bot-commands and get your roles to enter the full discord!");

                await Delete.DelayDeleteMessage(message, 60);
            }
            else
            {
                await errors.sendErrorTemp(Context.Channel, "Welcome channel not found, make sure the config.json is set up correctly!", Colours.errorCol);
            }
        }
示例#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");
        }
示例#3
0
        public async Task Accept()
        {
            var chan          = Context.Channel;
            var userName      = Context.User as SocketGuildUser;
            var newMemberRole = Context.Guild.Roles.FirstOrDefault(x => x.Name.ToString() == ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").newMemRole);

            if (newMemberRole != null)
            {
                if (userName.Roles.Contains(newMemberRole))
                {
                    var user = Context.User;

                    var config = new BotConfig();
                    var role   = Context.Guild.Roles.FirstOrDefault(x => x.Name.ToString() == ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").accMemRole);

                    var remrole = Context.Guild.Roles.FirstOrDefault(x => x.Name.ToString() == ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").newMemRole);

                    await(user as IGuildUser).AddRoleAsync(role);
                    await(user as IGuildUser).RemoveRoleAsync(remrole);

                    var message = await ReplyAsync("You Have Accepted The Rules! Enjoy Being A Full Member!");

                    await Delete.DelayDeleteMessage(message, 10);

                    await Context.Message.DeleteAsync();
                }
            }
            else
            {
                await errors.sendError(chan, "The new members role is not set up correctly in the config!", Colors.generalCol);
            }

            await Context.Message.DeleteAsync();
        }
示例#4
0
        public async Task createServer()
        {
            if (!File.Exists(appdir + "servers/" + Context.Guild.Id.ToString() + ".json"))
            {
                var newServer = File.Create(Path.Combine(appdir, "servers/" + Context.Guild.Id.ToString() + ".json"));

                newServer.Close();

                save.serverID     = "";
                save.serverPrefix = "";
                save.newMemRole   = "";
                save.accMemRole   = "";
                save.monRole      = "";
                save.NSFWRole     = "";
                save.Save("servers/" + Context.Guild.Id.ToString() + ".json");
            }

            save.serverID     = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverID;
            save.serverPrefix = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix;
            save.newMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").newMemRole;
            save.accMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").accMemRole;
            save.monRole      = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").monRole;
            save.NSFWRole     = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").NSFWRole;

            save.Save("servers/" + Context.Guild.Id.ToString() + ".json");

            var message = await ReplyAsync("File Has Been Created! Continue With Setup by Doing --prefix (prefix you want)");

            await Delete.DelayDeleteMessage(message, 10);

            await Context.Message.DeleteAsync();
        }
示例#5
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");
        }
示例#6
0
        public async Task CreateSubRank([Remainder] string title = null)
        {
            await Context.Message.DeleteAsync();

            if (title != null)
            {
                if (SubRanksSaves.Load().MaxRanks > SubRanksSaves.Load().SubRanks)
                {
                    // Creating object and pushing to file
                    SubRanksSaves SubRanks = new SubRanksSaves();
                    SubRanks.MaxRanks = SubRanksSaves.Load().MaxRanks;
                    for (int i = 0; i < SubRanksSaves.Load().MaxRanks; i++)
                    {
                        SubRanks.Ranks[i] = SubRanksSaves.Load().Ranks[i];
                    }
                    SubRanks.Ranks[SubRanksSaves.Load().SubRanks - 1] = title;
                    SubRanks.SubRanks = SubRanksSaves.Load().SubRanks + 1;
                    SubRanks.Save();

                    // Create Role
                    var perms = new GuildPermissions(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
                    await Context.Guild.CreateRoleAsync(title, perms, null, false, null);

                    // Success Message
                    var embed = new EmbedBuilder()
                    {
                        Color = Colours.adminCol
                    };
                    embed.Title       = "Create Sub Rank";
                    embed.Description = "The sub rank '" + title + "' was created successfully!";
                    var message = await Context.Channel.SendMessageAsync("", false, embed);

                    await Delete.DelayDeleteMessage(message, 30);
                }
                else
                {
                    await errors.sendErrorTemp(Context.Channel, "You have used up all sub ranks!", Colours.errorCol);
                }
            }
            else
            {
                await errors.sendErrorTemp(Context.Channel, "You need to specify the rank title.", Colours.errorCol);
            }
        }
示例#7
0
        public async Task setNewmemrole([Remainder] string newmem)
        {
            if (newmem != null)
            {
                save.serverID     = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverID;
                save.serverPrefix = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix;
                save.newMemRole   = newmem;
                save.accMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").accMemRole;
                save.monRole      = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").monRole;
                save.NSFWRole     = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").NSFWRole;

                save.Save("servers/" + Context.Guild.Id.ToString() + ".json");

                var message = await ReplyAsync("New Member Role Has Been Set! Continue With Setup by Setting the Accepted Member Role --accmemrole (role you want)");

                await Delete.DelayDeleteMessage(message, 10);
            }

            await Context.Message.DeleteAsync();
        }
示例#8
0
        public async Task setPrefix([Remainder] string prefix)
        {
            if (prefix != null)
            {
                save.serverID     = Context.Guild.Id.ToString();
                save.newMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").newMemRole;
                save.accMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").accMemRole;
                save.monRole      = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").monRole;
                save.NSFWRole     = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").NSFWRole;
                save.serverPrefix = prefix;
                save.Save("servers/" + save.serverID + ".json");


                var message = await ReplyAsync("Prefix Has Been Set! Continue With Setup by Doing --newmemrole (role you want)");

                await Delete.DelayDeleteMessage(message, 10);
            }

            await Context.Message.DeleteAsync();
        }
示例#9
0
        public async Task setNsfwrole([Remainder] string nsfwrole)
        {
            if (nsfwrole != null)
            {
                save.serverID     = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverID;
                save.serverPrefix = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix;
                save.newMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").newMemRole;
                save.accMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").accMemRole;
                save.monRole      = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").monRole;
                save.NSFWRole     = nsfwrole;

                save.Save("servers/" + Context.Guild.Id.ToString() + ".json");

                var message = await ReplyAsync("NSFW Role Has Been Set! You Have Completed Setup And Can Now Use The Prefix You Have Defined Previously. If You Somehow Forget The Prefix Feel Free To Use --dm and DM the creator of the bot!");

                await Delete.DelayDeleteMessage(message, 10);
            }

            await Context.Message.DeleteAsync();
        }
示例#10
0
        public async Task setMonrole([Remainder] string monrole)
        {
            if (monrole != null)
            {
                save.serverID     = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverID;
                save.serverPrefix = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").serverPrefix;
                save.newMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").newMemRole;
                save.accMemRole   = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").accMemRole;
                save.monRole      = monrole;
                save.NSFWRole     = ServerConfig.Load("servers/" + Context.Guild.Id.ToString() + ".json").NSFWRole;

                save.Save("servers/" + Context.Guild.Id.ToString() + ".json");


                var message = await ReplyAsync("Money Role Has Been Set! Continue With Setup by Setting the NSFW Role --nsfwrole (role you want)");

                await Delete.DelayDeleteMessage(message, 10);
            }

            await Context.Message.DeleteAsync();
        }
示例#11
0
        public async Task Bid(string amount)
        {
            int bid;

            if (auctionCheck.Equals("live"))
            {
                var message = await ReplyAsync("There's no auction at this time, ask someone to start one.");

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

                await Delete.DelayDeleteMessage(message, 10);

                return;
            }
            else
            {
                try
                {
                    bid = Math.Abs(int.Parse(amount));
                }
                catch
                {
                    var message = await ReplyAsync("That is not a valid bid, I am not stupid!");

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

                    await Delete.DelayDeleteMessage(message, 10);

                    return;
                }
                if (bid <= hightBid)
                {
                    var message = await ReplyAsync("Your bid is too low, increase it and try again.");

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

                    await Delete.DelayDeleteMessage(message, 10);

                    return;
                }

                hightBid   = bid;
                highBidder = Context.User as SocketGuildUser;

                await UpDateHighBidder(Context.Message as SocketUserMessage, bid);

                var message2 = await ReplyAsync($"The current highest bidder is {highBidder.Mention} with a bid of {hightBid} :moneybag: ");
            }


            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");
        }