Esempio n. 1
0
        public static async Task Maindo(SocketMessage arg)
        {
            string KeyForJob = $"JOB";

            if (StoreHandler.LoadData(arg.Author.Id, KeyForJob) != null)
            {
                var Job   = UserStuff.GetJob(arg.Author.Id);
                var Embed = new EmbedBuilder()
                {
                    Author = new EmbedAuthorBuilder()
                    {
                        IconUrl = arg.Author.GetAvatarUrl(),
                        Name    = $"{arg.Author.Username}'s Job",
                    },
                    Color  = new Color(85, 255, 157),
                    Footer = new EmbedFooterBuilder()
                    {
                        Text = Job.Timestamp >= new DateTime(2010, 1, 1) ? $"Has had job for {(DateTime.UtcNow - Job.Timestamp).Days} days" : "MGX"
                    },
                    Timestamp = DateTime.UtcNow,
                    Fields    = new List <EmbedFieldBuilder>()
                    {
                        {
                            new EmbedFieldBuilder()
                            {
                                Name  = "Name",
                                Value = $"{Job.Name}"
                            }
                        },
                        {
                            new EmbedFieldBuilder()
                            {
                                Name  = "Pay",
                                Value = $"${Job.Pay}"
                            }
                        },
                        {
                            new EmbedFieldBuilder()
                            {
                                Name  = $"People w/{Job.Name}",
                                Value = $"{StoreHandler.ReturnCountOfPattern(StoreHandler.LoadData(arg.Author.Id, KeyForJob))}"
                            }
                        },
                        {
                            new EmbedFieldBuilder()
                            {
                                Name  = $"Is Available",
                                Value = $"{Job.StillAvailable}"
                            }
                        },
                    }
                };

                await arg.Channel.SendMessageAsync("", false, Embed.Build());
            }
            else
            {
                await arg.Channel.SendMessageAsync($"You kind of need a job to view your job: `{Program.Prefix}joblist`");
            }
        }
Esempio n. 2
0
        public static async Task Maindo(SocketMessage arg)
        {
            await arg.Channel.SendMessageAsync("Ping the person you want to trade with!");

            SocketUser TradingWith = (await new WaitForResponse()
            {
                TimeLimitS = 10,
                ChannelId = arg.Channel.Id,
                UserId = arg.Author.Id
            }.Start()).MentionedUsers.First();
            IEmote Response = await new Prompt()
            {
                ChannelForPrompt = arg.Channel,
                MaxTime          = 15,
                Options          = new List <Emoji>()
                {
                    { new Emoji("\uD83D\uDC4D") },
                    { new Emoji("\uD83D\uDC4E") }
                }.ToArray(),
                   Target = TradingWith,
                   Title  = $"Do you ({TradingWith.Mention}) accept to trade your job with ({arg.Author.Mention})?",
            }.ShowPrompt();

            if (Response != null && Response.Name == "👍")
            {
                Entities.job TradersJob = UserStuff.GetJob(arg.Author.Id);
                Entities.job TradeesJob = UserStuff.GetJob(TradingWith.Id);
                if (TradersJob != null && TradeesJob != null)
                {
                    UserStuff.SaveJob(arg.Author.Id, TradeesJob);
                    UserStuff.SaveJob(TradingWith.Id, TradersJob);
                    await arg.Channel.SendMessageAsync("Successfully traded jobs!");
                }
                else
                {
                    await arg.Channel.SendMessageAsync("One or more users don't have a job.");
                }
            }
        }
Esempio n. 3
0
        public static async Task Maindo(SocketMessage arg)
        {
            List <Entities.job> RandomChosen = new List <Entities.job>()
            {
                { UserStuff.GenerateRandomJob(false) },
                { UserStuff.GenerateRandomJob(false) },
            };
            var Embed = new EmbedBuilder()
            {
                Color       = new Color(251, 125, 255),
                Description = "Job List",
                Footer      = new EmbedFooterBuilder()
                {
                    Text    = arg.Author.Username,
                    IconUrl = arg.Author.GetAvatarUrl() != null?arg.Author.GetAvatarUrl() : Program.Client.CurrentUser.GetAvatarUrl(),
                },
                Timestamp = DateTime.UtcNow,
                Fields    = new List <EmbedFieldBuilder>()
                {
                    {
                        new EmbedFieldBuilder()
                        {
                            IsInline = false,
                            Name     = "1. " + RandomChosen[0].Name,
                            Value    = $"`Pay - ${RandomChosen[0].Pay}`",
                        }
                    },
                    {
                        new EmbedFieldBuilder()
                        {
                            IsInline = false,
                            Name     = "2. " + RandomChosen[1].Name,
                            Value    = $"`Pay - ${RandomChosen[1].Pay}`",
                        }
                    }
                },
            };

            var JobList = new Prompt()
            {
                ChannelForPrompt = arg.Channel,
                MaxTime          = 15,
                Options          = new List <Emoji>()
                {
                    { OneEm },
                    { TwoEm },
                }.ToArray(),
                Target = arg.Author,
                Embed  = Embed,
            };

            var JobChosen = await JobList.ShowPrompt();

            Console.WriteLine(JobChosen);

            if (JobChosen != null)
            {
                if (StoreHandler.LoadData(arg.Author.Id, $"JOB") != null)
                {
                    var Prompt = new Prompt()
                    {
                        ChannelForPrompt = arg.Channel,
                        MaxTime          = 15,
                        Options          = new List <Emoji>()
                        {
                            { new Emoji("\uD83D\uDC4D") },
                            { new Emoji("\uD83D\uDC4E") }
                        }.ToArray(),
                        Target = arg.Author,
                        Title  = "You have to quit your current job to get a new one. Continue?"
                    };

                    var Answer = await Prompt.ShowPrompt();

                    if (Answer != null && Answer.Name == "👎")
                    {
                        await arg.Channel.SendMessageAsync("Nothing has changed.");

                        return;
                    }

                    await Prompt.Message.DeleteAsync();
                }
                if (JobChosen.Name == OneEm.Name)
                {
                    UserStuff.SaveJob(arg.Author.Id, RandomChosen[0]);
                }
                else if (JobChosen.Name == TwoEm.Name)
                {
                    UserStuff.SaveJob(arg.Author.Id, RandomChosen[1]);
                }
                else
                {
                    return;
                }
                await arg.Channel.SendMessageAsync($"Congrats! You're now listed as: `{UserStuff.GetJob(arg.Author.Id).Name}`");
            }

            await JobList.Message.DeleteAsync();
        }