mirror of
https://github.com/MelisaDev/melisa.git
synced 2024-09-22 19:22:01 +03:00
fix with formatter
This commit is contained in:
parent
bbab69c800
commit
78745c3334
8 changed files with 12 additions and 10 deletions
|
@ -74,7 +74,7 @@ class Client:
|
||||||
mobile: bool = False,
|
mobile: bool = False,
|
||||||
allowed_mentions: Optional[AllowedMentions] = None,
|
allowed_mentions: Optional[AllowedMentions] = None,
|
||||||
logs: Union[None, int, str, Dict[str, Any]] = "INFO",
|
logs: Union[None, int, str, Dict[str, Any]] = "INFO",
|
||||||
cache: CacheManager = None
|
cache: CacheManager = None,
|
||||||
):
|
):
|
||||||
self._loop = asyncio.get_event_loop()
|
self._loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from ..utils.types import Coro
|
||||||
async def channel_create_listener(self, gateway, payload: dict):
|
async def channel_create_listener(self, gateway, payload: dict):
|
||||||
channel = _choose_channel_type(payload)
|
channel = _choose_channel_type(payload)
|
||||||
|
|
||||||
await self.dispatch("on_channel_create", (channel, ))
|
await self.dispatch("on_channel_create", (channel,))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ async def channel_delete_listener(self, gateway, payload: dict):
|
||||||
|
|
||||||
channel = channel_cls.from_dict(payload)
|
channel = channel_cls.from_dict(payload)
|
||||||
|
|
||||||
await self.dispatch("on_channel_delete", (channel, ))
|
await self.dispatch("on_channel_delete", (channel,))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ async def guild_create_listener(self, gateway, payload: dict):
|
||||||
self.cache.set_guild(guild)
|
self.cache.set_guild(guild)
|
||||||
|
|
||||||
if guild_was_cached_as_none is False:
|
if guild_was_cached_as_none is False:
|
||||||
await self.dispatch("on_guild_create", (guild, ))
|
await self.dispatch("on_guild_create", (guild,))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ async def guild_delete_listener(self, gateway, payload: dict):
|
||||||
|
|
||||||
self.cache.remove_guild(guild.id)
|
self.cache.remove_guild(guild.id)
|
||||||
|
|
||||||
await self.dispatch("on_guild_remove", (guild, ))
|
await self.dispatch("on_guild_remove", (guild,))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from ..utils.types import Coro
|
||||||
|
|
||||||
async def message_create_listener(self, gateway, payload: dict):
|
async def message_create_listener(self, gateway, payload: dict):
|
||||||
message = Message.from_dict(payload)
|
message = Message.from_dict(payload)
|
||||||
await self.dispatch("on_message_create", (message, ))
|
await self.dispatch("on_message_create", (message,))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ async def on_ready_listener(self, gateway, payload: dict):
|
||||||
|
|
||||||
self.user = User.from_dict(payload.get("user"))
|
self.user = User.from_dict(payload.get("user"))
|
||||||
|
|
||||||
await self.dispatch("on_shard_ready", (gateway.shard_id, ))
|
await self.dispatch("on_shard_ready", (gateway.shard_id,))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CacheManager:
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
auto_models: Optional[List[AutoCacheModels]] = None,
|
auto_models: Optional[List[AutoCacheModels]] = None,
|
||||||
auto_unused_attributes: Optional[Dict[Any, List[str]]] = None
|
auto_unused_attributes: Optional[Dict[Any, List[str]]] = None,
|
||||||
):
|
):
|
||||||
self._auto_models: List[AutoCacheModels] = (
|
self._auto_models: List[AutoCacheModels] = (
|
||||||
[] if auto_models is None else auto_models
|
[] if auto_models is None else auto_models
|
||||||
|
@ -98,7 +98,7 @@ class CacheManager:
|
||||||
if hasattr(guild, "channels"):
|
if hasattr(guild, "channels"):
|
||||||
channels = guild.channels.values()
|
channels = guild.channels.values()
|
||||||
|
|
||||||
if not AutoCacheModels.TEXT_CHANNELS in self._auto_models:
|
if AutoCacheModels.TEXT_CHANNELS not in self._auto_models:
|
||||||
channels = filter(
|
channels = filter(
|
||||||
lambda channel: channel.type != ChannelType.GUILD_TEXT, channels
|
lambda channel: channel.type != ChannelType.GUILD_TEXT, channels
|
||||||
)
|
)
|
||||||
|
@ -137,7 +137,9 @@ class CacheManager:
|
||||||
Data of guilds tso insert to the cache
|
Data of guilds tso insert to the cache
|
||||||
"""
|
"""
|
||||||
|
|
||||||
guilds_dict = dict(map(lambda i: (i["id"], UnavailableGuild.from_dict(i)), guilds))
|
guilds_dict = dict(
|
||||||
|
map(lambda i: (i["id"], UnavailableGuild.from_dict(i)), guilds)
|
||||||
|
)
|
||||||
|
|
||||||
self._raw_guilds.update(guilds_dict)
|
self._raw_guilds.update(guilds_dict)
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue