Compare commits
4 Commits
ethanolchi
...
kuanhulio/
Author | SHA1 | Date | |
---|---|---|---|
e48493b36c | |||
4931100b44 | |||
ec1e2add21 | |||
4277f65051 |
@ -41,7 +41,9 @@ Key Features
|
||||
Installing
|
||||
----------
|
||||
|
||||
**Python 3.8 or higher is required**
|
||||
**Python 3.8 or higher is required***
|
||||
|
||||
***Do not use 3.9.7 as Python 3.9.7 has a bug that causes a TypeError with __init__ methods in subclasses.** View more `here <https://bugs.python.org/issue45121/>`_.
|
||||
|
||||
To install the library without full voice support, you can just run the following command:
|
||||
|
||||
|
@ -28,6 +28,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import collections
|
||||
import collections.abc
|
||||
from functools import cached_property
|
||||
|
||||
import inspect
|
||||
import importlib.util
|
||||
@ -72,7 +73,9 @@ from .cog import Cog
|
||||
if TYPE_CHECKING:
|
||||
import importlib.machinery
|
||||
|
||||
from discord.role import Role
|
||||
from discord.message import Message
|
||||
from discord.abc import PartialMessageableChannel
|
||||
from ._types import (
|
||||
Check,
|
||||
CoroFunc,
|
||||
@ -94,10 +97,17 @@ CXT = TypeVar("CXT", bound="Context")
|
||||
|
||||
class _FakeSlashMessage(discord.PartialMessage):
|
||||
activity = application = edited_at = reference = webhook_id = None
|
||||
attachments = components = reactions = stickers = mentions = []
|
||||
author: Union[discord.User, discord.Member]
|
||||
attachments = components = reactions = stickers = []
|
||||
tts = False
|
||||
|
||||
raw_mentions = discord.Message.raw_mentions
|
||||
clean_content = discord.Message.clean_content
|
||||
channel_mentions = discord.Message.channel_mentions
|
||||
raw_role_mentions = discord.Message.raw_role_mentions
|
||||
raw_channel_mentions = discord.Message.raw_channel_mentions
|
||||
|
||||
author: Union[discord.User, discord.Member]
|
||||
|
||||
@classmethod
|
||||
def from_interaction(
|
||||
cls, interaction: discord.Interaction, channel: Union[discord.TextChannel, discord.DMChannel, discord.Thread]
|
||||
@ -108,6 +118,22 @@ class _FakeSlashMessage(discord.PartialMessage):
|
||||
|
||||
return self
|
||||
|
||||
@cached_property
|
||||
def mentions(self) -> List[Union[discord.Member, discord.User]]:
|
||||
client = self._state._get_client()
|
||||
if self.guild:
|
||||
ensure_user = lambda id: self.guild.get_member(id) or client.get_user(id) # type: ignore
|
||||
else:
|
||||
ensure_user = client.get_user
|
||||
|
||||
return discord.utils._unique(filter(None, map(ensure_user, self.raw_mentions)))
|
||||
|
||||
@cached_property
|
||||
def role_mentions(self) -> List[Role]:
|
||||
if self.guild is None:
|
||||
return []
|
||||
return discord.utils._unique(filter(None, map(self.guild.get_role, self.raw_role_mentions)))
|
||||
|
||||
|
||||
def when_mentioned(bot: Union[Bot, AutoShardedBot], msg: Message) -> List[str]:
|
||||
"""A callable that implements a command prefix equivalent to being mentioned.
|
||||
|
@ -188,7 +188,7 @@ class HTTPClient:
|
||||
self.proxy_auth: Optional[aiohttp.BasicAuth] = proxy_auth
|
||||
self.use_clock: bool = not unsync_clock
|
||||
|
||||
user_agent = "DiscordBot (https://github.com/Rapptz/discord.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}"
|
||||
user_agent = "DiscordBot (https://github.com/iDevision/enhanced-discord.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}"
|
||||
self.user_agent: str = user_agent.format(__version__, sys.version_info, aiohttp.__version__)
|
||||
|
||||
def recreate(self) -> None:
|
||||
|
Reference in New Issue
Block a user