public async Task TagMakeCommandAsync(string tagName = null) { // find a msg that the calling user has reacted with the right emote to IEmote starEmote = new Emoji("⭐"); var message = await EventReactionAddedService.GetMessageByReactionAdded(starEmote, Context); if (message == null) { await ReplyAsync($"You need to select a message (using an {starEmote} reaction) to use this command."); } await ReplyAsync("What do you want to name your tag?"); var userResponseTagName = await NextMessageAsync(true, true, TimeSpan.FromSeconds(30)); if (userResponseTagName == null) { await ReplyAsync("You took too long choosing a name. Try again."); return; } var success = await DatabaseTags.AddTagToDatabase(Context, userResponseTagName.Content, message.Message.Content); if (success) { await ReplyAsync($"Tag '{userResponseTagName}' added."); } else { await ReplyAsync("Couldn't add tag - a tag with this name already exists."); } }
public async Task TagAddCommandAsync(string tagName, [Remainder] string content = null) { bool messageContainsAttachment = Context.Message.Attachments.Any(); if (content == null && !messageContainsAttachment) { await ReplyAsync( "You did not enter anything to put inside the tag. The syntax is `.tag add name content`."); return; } StringBuilder tagContents = new StringBuilder(); if (content != null) { tagContents.AppendLine(content); } if (messageContainsAttachment) { foreach (var attachment in Context.Message.Attachments) { tagContents.AppendLine(attachment.Url); } } var success = await DatabaseTags.AddTagToDatabase(Context, tagName, tagContents.ToString()); if (success) { await ReplyAsync($"Tag '{tagName}' added."); } else { await ReplyAsync("Couldn't add tag - a tag with this name already exists."); } }