From 3e301d896f6ce6ee5eb5d53e35f4c9be21aae31b Mon Sep 17 00:00:00 2001
From: Sami <sm@samip.fi>
Date: Mon, 17 Sep 2018 19:37:16 +0300
Subject: [PATCH] Meta: Added a check so quit command cannot be executed by
 accident.

---
 Music-bot/cogs/meta.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Music-bot/cogs/meta.py b/Music-bot/cogs/meta.py
index 337b456..23f555a 100644
--- a/Music-bot/cogs/meta.py
+++ b/Music-bot/cogs/meta.py
@@ -1,5 +1,6 @@
 import discord
 import datetime
+import asyncio
 import os
 from discord.ext import commands
 
@@ -71,6 +72,19 @@ class Meta:
     @commands.is_owner()
     async def _quit(self, ctx):
         """Quits the bot."""
+        channel = ctx.channel
+        await ctx.send(f'Please confirm the action, the bot will quit entirely.'
+                       f'You need to confirm it by saying just "confirm".')
+
+        def check(m):
+            return m.content == 'confirm' and m.channel == channel
+
+        try:
+            msg = await self.bot.wait_for('message', timeout=30.0, check=check)
+        except asyncio.TimeoutError:
+            return await ctx.send('You took long. Goodbye.')
+
+        await ctx.send(f'Confirmed, exiting...')
         await self.bot.logout()
 
     @commands.command(name="about")
-- 
GitLab