public async Task SetPersonalQuote([Remainder] string quote = null) { //null me babi if (quote == null) { await ProfileDb.SetQuote(Context.User.Id, null); await Context.Channel.SendMessageAsync("Quote removed."); return; } //length check if (quote.Length > Constants.quoteCap) { await Context.Channel.SendMessageAsync($"Quotes have a { Constants.quoteCap } character limit. {quote.Length}/{Constants.quoteCap}"); return; } //setting quote + getting embed & quote await ProfileDb.SetQuote(Context.User.Id, quote); await Context.Channel.SendMessageAsync("Quote set!", false, UserUtil.QuoteEmbed(Context.User).Build()); }
public async Task DisplayPersonalQuote(IUser user = null, [Remainder] string str = "") { //variables EmbedBuilder embed; bool isMe = false; if (user == null) { user = Context.User; isMe = true; } // IReadOnlyCollection <SocketUser> users = Context.Message.MentionedUsers; if (users != null && users.Count > 1) { embed = UserUtil.StitchedQuoteEmbed(users); if (embed == null) { await Context.Channel.SendMessageAsync("No one had a proper \"Quote\" qq"); } else { await Context.Channel.SendMessageAsync("", false, embed.Build()); } return; } //checking quote embed = UserUtil.QuoteEmbed(user); if (embed == null) { await Context.Channel.SendMessageAsync($"{(isMe? "You don't" : $"{ user.Username } doesn't") } have an image or a quote. Set one with `sq` and `si` commands."); return; //sending quote }
public async Task SetPersonalImage([Remainder] string image = null) { image ??= Context.Message.Attachments.FirstOrDefault()?.Url; //to delete image if (image == null) { await ProfileDb.SetImage(Context.User.Id, null); await Context.Channel.SendMessageAsync("Image removed."); return; } //url check if (!WebUtil.IsValidUrl(image)) { await Context.Channel.SendMessageAsync("This URL is just like you... Invalid."); return; } //image validity check if (!WebUtil.IsImageUrl(image)) { await Context.Channel.SendMessageAsync("This URL is not an image, what do you want me to do with it?"); return; } //building embed await ProfileDb.SetImage(Context.User.Id, image); EmbedBuilder embed = UserUtil.QuoteEmbed(Context.User); await Context.Channel.SendMessageAsync("Image set!", false, embed.Build()); }