public async Task Order([Remainder] string order) { using (Context.Channel.EnterTypingState()) { if (order.Length > 1) { var outp = _DB.CheckForExistingOrders(Context.User.Id); if (outp) { await ReplyAsync("You already have an order!"); return; } SandwichUser u = await _UDB.FindUser(Context.User.Id); u.Level = u.Orders / 10; if (u == null) { await _UDB.CreateNewUser((SocketUser)Context.User); await ReplyAsync("You've been registered!"); u = await _UDB.FindUser(Context.User.Id); } if (u.Credits < 1.0) { await ReplyAsync("You will need atleast 1 credit for this."); return; } string orderid; try { IGuild usr = await Context.Client.GetGuildAsync(_SS.USRGuildId); //Isn't there a better way to do these? ITextChannel usrc = await usr.GetTextChannelAsync(_SS.KitchenId); ITextChannel usrclog = await usr.GetTextChannelAsync(_SS.LogId); orderid = _DB.GenerateId(3); orderid = _DB.VerifyIdUniqueness(orderid); var neworder = await _DB.NewOrder(order, orderid, DateTime.Now, OrderStatus.Waiting, Context); _QS.AddOrder(neworder); var builder = new EmbedBuilder(); builder.ThumbnailUrl = Context.User.GetAvatarUrl(); builder.Title = $" New order from {Context.Guild.Name} (`{Context.Guild.Id}`)"; var desc = $"Ordered by: **{Context.User.Username}#{Context.User.Discriminator}** (`{Context.User.Id}`)\n" + $"Id: `{orderid}`\n" + $"```{order}```"; builder.Description = desc; builder.Color = new Color(71, 120, 198); builder.WithFooter(x => { x.Text = "Is this order abusive? Please ping @Artist Manager immediately!"; }); builder.Timestamp = DateTime.Now; _SS.totalOrders += 1; var artist = usr.Roles.FirstOrDefault(x => x.Name.ToLower() == "sandwich artist"); //FIX if (artist != null) { await usrc.SendMessageAsync($"{artist.Mention}", embed : builder); } else { await usrc.SendMessageAsync($" ", embed : builder); } } catch (Exception e) { await ReplyAsync("This error should not happen! Contact Fires#1043 immediately!"); Console.WriteLine(e); await ReplyAsync($"```{e}```"); return; } IDMChannel dm = await Context.User.GetOrCreateDMChannelAsync(); IUserMessage m = await ReplyAsync(":thumbsup:"); try { await dm.SendMessageAsync($"Thank you for ordering. Please wait while an artist accepts you. :slight_smile: - ID `{orderid}`"); } catch (Exception e) { Console.WriteLine(e); await m.ModifyAsync(msg => { msg.Content = $":thumbsdown: {Context.User.Mention} We failed to dm you. You're order has been automatically deleted. Please enable DMs and re order. http://i.imgur.com/vY7tThf.png OR http://i.imgur.com/EtaA78Q.png"; }); IGuild usr = await Context.Client.GetGuildAsync(_SS.USRGuildId); ITextChannel usrc = await usr.GetTextChannelAsync(_SS.KitchenId); await usrc.SendMessageAsync($"**IGNORE ORDER {orderid} AS IT HAS BEEN REMOVED**"); } } else { await ReplyAsync("Your order must be longer then 2 characters."); } } }