some refractor
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import logging
|
||||
from asyncio import sleep
|
||||
from typing import Union, Optional
|
||||
|
||||
import disnake
|
||||
from disnake import FFmpegPCMAudio
|
||||
from disnake.ext import commands
|
||||
|
||||
|
||||
async def play_audio(audio, bot, vc):
|
||||
@@ -16,3 +19,11 @@ async def play_audio(audio, bot, vc):
|
||||
await sleep(0.5)
|
||||
await sleep(1)
|
||||
await vp.disconnect()
|
||||
|
||||
|
||||
async def get_audio_list(inter: Union[disnake.ApplicationCommandInteraction, commands.Context],
|
||||
search: Optional[str],
|
||||
return_embed: bool = False,
|
||||
) -> None:
|
||||
|
||||
await list_files()
|
||||
|
||||
Reference in New Issue
Block a user