Skip to content

Commit

Permalink
🐛 [Bugfix] General Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
foxwhite25 committed May 25, 2022
1 parent 06b4ebf commit 85e8261
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions qq/client.py
Expand Up @@ -151,6 +151,7 @@ def __init__(
}

connector: Optional[aiohttp.BaseConnector] = options.pop('connector', None)
print(connector)
proxy: Optional[str] = options.pop('proxy', None)
proxy_auth: Optional[aiohttp.BasicAuth] = options.pop('proxy_auth', None)
unsync_clock: bool = options.pop('assume_unsync_clock', True)
Expand Down
3 changes: 1 addition & 2 deletions qq/ext/commands/converter.py
Expand Up @@ -154,7 +154,7 @@ async def convert(self, ctx: Context, argument: str) -> qq.Object:
class MemberConverter(IDConverter[qq.Member]):
"""转换为 :class:`~qq.Member`。
所有查找都是通过本地频道进行的。如果在 DM context 中,则查找由全局缓存完成。
所有查找都是通过本地频道进行的。如果在 DM context 中,则查找由全局缓存完成。
查找策略如下(按顺序):
Expand Down Expand Up @@ -191,7 +191,6 @@ async def convert(self, ctx: Context, argument: str) -> qq.Member:
bot = ctx.bot
match = self._get_id_match(argument) or re.match(r'<@!?([0-9]{15,20})>$', argument)
guild = ctx.guild
result = None
user_id = None
if match is None:
# not a mention...
Expand Down
1 change: 0 additions & 1 deletion qq/guild.py
Expand Up @@ -853,7 +853,6 @@ async def fetch_roles(self) -> List[Role]:
.. note::
该方法是一个 API 调用。对于一般用法,请考虑 :attr:`roles`。
.. versionadded:: 1.3
Raises
-------
Expand Down
2 changes: 1 addition & 1 deletion qq/http.py
Expand Up @@ -223,7 +223,7 @@ async def request(
# continue

# the usual error cases
if response.status in [403, 401]:
if response.status in [404, 403, 401]:
raise Forbidden(response, data, route=route)
elif response.status == 404:
raise NotFound(response, data, route=route)
Expand Down
2 changes: 1 addition & 1 deletion qq/iterators.py
Expand Up @@ -393,7 +393,7 @@ def _get_retrieve(self):
async def fill_messages(self):
if not hasattr(self, 'channel'):
# do the required set up
channel = await self.messageable._get_channel()
channel, private = await self.messageable._get_channel()
self.channel = channel

if self._get_retrieve():
Expand Down
5 changes: 3 additions & 2 deletions qq/utils.py
Expand Up @@ -26,13 +26,14 @@
import json
import re
import sys
import unicodedata
from bisect import bisect_left
from inspect import isawaitable as _isawaitable, signature as _signature
from operator import attrgetter
from typing import Any, Callable, TypeVar, overload, Optional, Iterable, List, TYPE_CHECKING, Generic, Type, Dict, \
ForwardRef, Literal, Tuple, Union, Iterator, AsyncIterator, Sequence

import unicodedata

T = TypeVar('T')
T_co = TypeVar('T_co', covariant=True)
_Iter = Union[Iterator[T], AsyncIterator[T]]
Expand Down Expand Up @@ -469,7 +470,7 @@ def escape_mentions(text: str) -> str:
删除了提及的文本。
"""

return re.sub(r'@(所有成员|[!&]?[0-9]{17,20})', '@\u200b\\1', text)
return re.sub(r'<@(everyone|[!&]?\d{17,20})>', '', text)


def find(predicate: Callable[[T], Any], seq: Iterable[T]) -> Optional[T]:
Expand Down

0 comments on commit 85e8261

Please sign in to comment.