First commit - Bring everything from dev cog minus NSFW support

This commit is contained in:
Drapersniper
2020-09-25 16:58:31 +01:00
parent a6ff5b8e9c
commit 8e70b4cd59
39 changed files with 1321 additions and 243 deletions

View File

@@ -1,4 +1,8 @@
import asyncio
import contextlib
import logging
import time
from enum import Enum, unique
from typing import MutableMapping
@@ -6,6 +10,8 @@ import discord
from redbot.core import commands
log = logging.getLogger("red.cogs.Audio.task.callback")
class CacheLevel:
__slots__ = ("value",)
@@ -205,3 +211,9 @@ class PlaylistScope(Enum):
@staticmethod
def list():
return list(map(lambda c: c.value, PlaylistScope))
def task_callback(task: asyncio.Task) -> None:
with contextlib.suppress(asyncio.CancelledError, asyncio.InvalidStateError):
if exc := task.exception():
log.exception(f"{task.get_name()} raised an Exception", exc_info=exc)