Skip to content
Snippets Groups Projects
Commit 3e301d89 authored by Skyler Mäntysaari's avatar Skyler Mäntysaari
Browse files

Meta: Added a check so quit command cannot be executed by accident.

parent e0df4bf6
No related branches found
No related tags found
No related merge requests found
import discord import discord
import datetime import datetime
import asyncio
import os import os
from discord.ext import commands from discord.ext import commands
...@@ -71,6 +72,19 @@ class Meta: ...@@ -71,6 +72,19 @@ class Meta:
@commands.is_owner() @commands.is_owner()
async def _quit(self, ctx): async def _quit(self, ctx):
"""Quits the bot.""" """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() await self.bot.logout()
@commands.command(name="about") @commands.command(name="about")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment