some refractor

This commit is contained in:
2022-08-29 00:38:13 +03:00
parent caa8d6b20e
commit 4a33b35283
9 changed files with 87 additions and 89 deletions

View File

@@ -1,5 +1,9 @@
import asyncio
import json
import os
from typing import Union
import disnake
"""
Some prepare for commands
@@ -104,3 +108,9 @@ def determine_time(msg):
except:
pass
return parameter
def maybe_defer(inter: disnake.Interaction, *, delay: Union[float, int] = 2.0, **options) -> asyncio.Task:
"""Defer an interaction if it has not been responded to after ``delay`` seconds."""
loop = inter.bot.loop
if delay <= 0:
return loop.create_task(inter.response.defer(**options))