public async Task AddChef(IGuildUser chef)
        {
            if (SS.chefList.FirstOrDefault(a => a.Value.ChefId == Context.User.Id).Value != null)
            {
                Chef s = SS.chefList.FirstOrDefault(a => a.Value.ChefId == Context.User.Id).Value;
                if (s.canBlacklist)
                {
                    string n = string.Format(chef.Username + "#" + chef.Discriminator);
                    if (!SS.chefList.ContainsKey(n))
                    {
                        Chef c = new Chef(n, chef.Id, chef.Discriminator, 0, 0, DateTime.Now.ToString("MMMM dd, yyyy"), ChefStatus.Trainee);
                        SS.chefList.Add(n, c);
                        await ReplyAsync($"<@{chef.Id}> had been added as a Trainee Sandwich Artist!");

                        SS.Save();
                    }
                    else
                    {
                        await ReplyAsync("An entry for this user already exists!");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public async Task OrderInfo(int id)
        {
            if (SS.activeOrders.FirstOrDefault(s => s.Value.Id == id).Value != null)
            {
                Sandwich order = SS.activeOrders.FirstOrDefault(s => s.Value.Id == id).Value;
                Color    c     = new Color(102, 102, 153);
                await ReplyAsync("Here is your requested information!", embed : new EmbedBuilder()
                                 .AddField(builder =>
                {
                    builder.Name = "Order";
                    builder.Value = order.Desc;
                    builder.IsInline = true;
                })
                                 .AddField(builder =>
                {
                    builder.Name = "Artist";
                    if (order.OrderChef != null)
                    {
                        builder.Value = order.OrderChef.ChefName;
                    }
                    else
                    {
                        builder.Value = "None";
                    }
                    builder.IsInline = true;
                })
                                 .AddField(builder =>
                {
                    builder.Name = "Order Id";
                    builder.Value = order.Id;
                    builder.IsInline = true;
                })
                                 .AddField(builder =>
                {
                    builder.Name = "Order Server";
                    builder.Value = order.GuildName;
                    builder.IsInline = true;
                })
                                 .AddField(builder =>
                {
                    builder.Name = "Order Date";
                    builder.Value = order.date;
                    builder.IsInline = true;
                })
                                 .AddField(builder =>
                {
                    builder.Name = "Customer";
                    builder.Value = order.UserName + "#" + order.Discriminator;
                    builder.IsInline = true;
                })
                                 .AddField(builder =>
                {
                    builder.Name = "Order Status";
                    builder.Value = order.Status;
                    builder.IsInline = true;
                })
                                 .WithUrl("https://discord.gg/XgeZfE2")
                                 .WithColor(c)
                                 .WithThumbnailUrl(order.AvatarUrl)
                                 .WithTitle("Order information")
                                 .WithTimestamp(DateTime.Now));



                SS.Save();
            }
        }
Ejemplo n.º 3
0
        public async Task Deliver(string id)
        {
            _SS.Save();
            using (Context.Channel.EnterTypingState())
            {
                Sandwich o = await _DB.FindOrder(id);

                if (o.ArtistId == Context.User.Id)
                {
                    if (o.Status == OrderStatus.ReadyToDeliver)
                    {
                        Artist a = await _ADB.FindArtist(Context.User.Id);

                        //Collect variables
                        await ReplyAsync($"{Context.User.Mention} DMing you an invite! Go deliver it! Remember to be nice and ask for `;feedback`.");

                        IGuild s = await Context.Client.GetGuildAsync(o.GuildId);

                        SandwichUser user = await _UDB.FindUser(o.UserId);

                        await _UDB.UpOrders(user.Id);

                        ITextChannel ch = await s.GetTextChannelAsync(o.ChannelId);

                        IGuildUser u = await s.GetUserAsync(o.UserId);

                        IDMChannel dm = await u.GetOrCreateDMChannelAsync();

                        //Create Invite
                        IInvite inv = await ch.CreateInviteAsync(1800, 1, false, true);

                        IDMChannel artistdm = await Context.User.GetOrCreateDMChannelAsync();

                        //Build embed
                        var builder = new EmbedBuilder();
                        builder.ThumbnailUrl = o.AvatarUrl;
                        builder.Title        = $"Your order is being delivered by {Context.User.Username}#{Context.User.Discriminator}!";
                        var desc = $"```{o.Desc}```\n" +
                                   $"**Incoming sandwich! Watch {o.GuildName}!**";
                        builder.Description = desc;
                        builder.Color       = new Color(255, 181, 10);
                        builder.WithFooter(x =>
                        {
                            x.IconUrl = u.GetAvatarUrl();
                            x.Text    = $"Ordered at: {o.date}.";
                        });
                        builder.Timestamp = DateTime.UtcNow;
                        await dm.SendMessageAsync($"Your sandwich is being delivered soon! Watch out!", embed : builder);

                        //Finish up
                        await artistdm.SendMessageAsync("Invite: " + inv.ToString() + " \r\n Name: " + o.UserName);

                        o.Status = OrderStatus.Delivered;
                        await _ADB.UpdateMostRecentOrder(a);

                        await _UDB.GiveUserCredits(Context.User as IGuildUser, 5.0f);

                        await _DB.DelOrder(id);
                    }
                    else
                    {
                        await ReplyAsync("This order is not ready to be delivered yet.");
                    }
                }
                else
                {
                    await ReplyAsync("You have not claimed this order!");
                }
            }
        }