Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Bots-Discord
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Skyler Mäntysaari
Bots-Discord
Commits
3e301d89
Commit
3e301d89
authored
6 years ago
by
Skyler Mäntysaari
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Music-bot/cogs/meta.py
+14
-0
14 additions, 0 deletions
Music-bot/cogs/meta.py
with
14 additions
and
0 deletions
Music-bot/cogs/meta.py
+
14
−
0
View file @
3e301d89
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
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment