예제 #1
0
        public async Task AcceptOrder(string id)
        {
            using (Context.Channel.EnterTypingState())
            {
                try
                {
                    Artist a = await _ADB.FindArtist(Context.User.Id);

                    Sandwich o = await _DB.FindOrder(id);

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

                    if (o == null)
                    {
                        await ReplyAsync("That id isn't correct bud."); return;
                    }
                    ;
                    if (o.Status != OrderStatus.Waiting)
                    {
                        await ReplyAsync("This order is not available. :angry: "); return;
                    }

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

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

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

                    IDMChannel dm = await u.GetOrCreateDMChannelAsync();

                    _QS.AcceptOrder();
                    o.Status   = OrderStatus.ReadyToDeliver;
                    o.ArtistId = Context.User.Id;
                    await _ADB.ChangeAcceptCount(a, ArtistStatChange.Increase);

                    await ch.SendMessageAsync($"{u.Mention}, a Sandwich Artist has accepted your sandwich. It will be delivered soon.");
                    await ReplyAsync($":thumbsup:");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }