From f9bb49ff8b7a401305b75cb2a6e0e8922c0be554 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= <supositware@macbook-pro-de-loic.home>
Date: Tue, 9 Jul 2019 01:47:24 +0200
Subject: [PATCH] list all tag from server

---
 commands/utility/taglist.js | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/commands/utility/taglist.js b/commands/utility/taglist.js
index b7e44174..80179d41 100644
--- a/commands/utility/taglist.js
+++ b/commands/utility/taglist.js
@@ -14,6 +14,11 @@ class taglistCommand extends Command {
 					id: 'raw',
 					match: 'rest',
 					optional: true
+				},
+				{
+					id: 'list',
+					match: 'flag',
+					flag: '--list',
 				}
 			],
 			description: {
@@ -25,6 +30,12 @@ class taglistCommand extends Command {
 	}
 
 	async exec(message, args) {
+		if (args.list) {
+			let tagList = await Tag.findAll({attributes: ['trigger'], where: {serverID: message.guild.id}});
+			const tagString = tagList.map(t => t.trigger).join(', ') || 'No tags set.';
+			return message.channel.send(`List of tags:\n${tagString}`);
+		}
+
 		if (args.raw) {
 			let tagList = await Tag.findOne({attributes: ['trigger','response','ownerID'], where: {trigger: args.raw, serverID: message.guild.id}});