[Hunting] Add support for clearing global leaderboard (#221)
* Add support for clearing global leaderboard * Microbump
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
from typing import Literal
|
||||
|
||||
import asyncio
|
||||
import discord
|
||||
import datetime
|
||||
from logging import warning
|
||||
import math
|
||||
import random
|
||||
import time
|
||||
from typing import Literal
|
||||
|
||||
from redbot.core import checks, commands, Config
|
||||
from redbot.core.utils.chat_formatting import bold, box, humanize_list, humanize_number, pagify
|
||||
from redbot.core.utils.menus import menu, DEFAULT_CONTROLS
|
||||
import discord
|
||||
from redbot.core import Config, checks, commands
|
||||
from redbot.core.utils.chat_formatting import (bold, box, humanize_list,
|
||||
humanize_number, pagify)
|
||||
from redbot.core.utils.menus import DEFAULT_CONTROLS, menu
|
||||
from redbot.core.utils.predicates import MessagePredicate
|
||||
|
||||
|
||||
__version__ = "3.1.4"
|
||||
__version__ = "3.1.5"
|
||||
|
||||
|
||||
class Hunting(commands.Cog):
|
||||
@@ -226,12 +227,36 @@ class Hunting(commands.Cog):
|
||||
|
||||
await ctx.send(bold(message))
|
||||
|
||||
@checks.is_owner()
|
||||
@hunting.command()
|
||||
async def clearleaderboard(self, ctx):
|
||||
"""
|
||||
Clear all the scores from the leaderboard.
|
||||
"""
|
||||
warning_string = (
|
||||
"Are you sure you want to clear all the scores from the leaderboard?\n"
|
||||
"This is a global wipe and **cannot** be undone!\n"
|
||||
"Type \"Yes\" to confirm, or \"No\" to cancel."
|
||||
)
|
||||
|
||||
await ctx.send(warning_string)
|
||||
pred = MessagePredicate.yes_or_no(ctx)
|
||||
try:
|
||||
await self.bot.wait_for("message", check=pred, timeout=15)
|
||||
if pred.result is True:
|
||||
await self.config.clear_all_users()
|
||||
return await ctx.send("Done!")
|
||||
else:
|
||||
return await ctx.send("Alright, not clearing the leaderboard.")
|
||||
except asyncio.TimeoutError:
|
||||
return await ctx.send("Response timed out.")
|
||||
|
||||
@checks.mod_or_permissions(manage_guild=True)
|
||||
@hunting.command()
|
||||
async def timing(self, ctx, interval_min: int, interval_max: int, bang_timeout: int):
|
||||
"""
|
||||
Change the hunting timing.
|
||||
|
||||
|
||||
`interval_min` = Minimum time in seconds for a new bird. (120s min)
|
||||
`interval_max` = Maximum time in seconds for a new bird. (240s min)
|
||||
`bang_timeout` = Time in seconds for users to shoot a bird before it flies away. (10s min)
|
||||
|
||||
Reference in New Issue
Block a user