Skip to content

Commit

Permalink
Fix a message check bug caused by IDE auto-rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
aicorein committed Mar 4, 2024
1 parent 9c9fea0 commit 1652079
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion melobot/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class MetaInfo:
def __init__(self) -> None:
self.VER = "2.0.1"
self.VER = "2.0.2"
self.PROJ_NAME = "MeloBot"
self.PROJ_DESC = "A qbot module with friendly interface, session control and plugin-supported."
self.PROJ_SRC = "https://github.com/aicorein/melobot"
Expand Down
22 changes: 11 additions & 11 deletions melobot/models/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,59 +137,59 @@ class BotProxy:
"""

def __init__(self) -> None:
self.__bot__: object
self.__origin__: object

def _bind(self, bot_origin: object) -> None:
self.__bot__ = bot_origin
self.__origin__ = bot_origin

@property
def loop(self) -> aio.AbstractEventLoop:
return self.__bot__.loop
return self.__origin__.loop

@property
def logger(self) -> Logger:
"""
bot 全局日志器
"""
return self.__bot__.logger
return self.__origin__.logger

@property
def config(self) -> BotConfig:
"""
bot 全局配置
"""
return self.__bot__.config
return self.__origin__.config

@property
def plugins(self) -> Dict[str, PluginProxy]:
"""
获取 bot 当前所有插件信息
"""
return {
id: plugin._Plugin__proxy for id, plugin in self.__bot__.plugins.items()
id: plugin._Plugin__proxy for id, plugin in self.__origin__.plugins.items()
}

@property
def is_activate(self) -> bool:
return not self.__bot__.slack
return not self.__origin__.slack

def slack(self) -> None:
"""
使 bot 不再发送 action。但 ACTION_PRESEND 钩子依然会触发
"""
self.__bot__.slack = True
self.__origin__.slack = True

def activate(self) -> None:
"""
使 bot 可以发送 action
"""
self.__bot__.slack = False
self.__origin__.slack = False

async def close(self) -> None:
"""
关闭 bot
"""
await self.__bot__.close()
await self.__origin__.close()

def is_module_run(self) -> bool:
"""
Expand All @@ -201,7 +201,7 @@ async def restart(self) -> None:
"""
重启 bot。只可在模块运行模式下使用
"""
await self.__bot__.restart()
await self.__origin__.restart()

def call_later(self, callback: partial, delay: float):
"""
Expand Down
4 changes: 2 additions & 2 deletions melobot/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def is_temp(self) -> bool:
"""是否为临时会话(属于私聊的一种)"""
return "temp_source" in self.raw.keys()

def is_group(self) -> bool:
"""是否为群系统消息"""
def is_group_notice(self) -> bool:
"""是否为群系统消息,特别注意是消息!"""
return self.raw["message_type"] == "group" and self.raw["sub_type"] == "notice"

_TEMP_SRC_MAP = {
Expand Down

0 comments on commit 1652079

Please sign in to comment.