Skip to content

Commit

Permalink
Merge pull request #128 from Ailitonia/dev
Browse files Browse the repository at this point in the history
Releases: pre-release v0.9.1
  • Loading branch information
Ailitonia authored Jun 27, 2023
2 parents 14637fe + d890d25 commit 5d5a602
Show file tree
Hide file tree
Showing 35 changed files with 1,411 additions and 330 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

_基于 [Nonebot2](https://github.com/nonebot/nonebot2)[go-cqhttp](https://github.com/Mrs4s/go-cqhttp) 的 qq 机器人_

![Nonebot2](https://img.shields.io/badge/Nonebot2-Release_v2.0.0_beta.5-brightgreen)
![go-cqhttp](https://img.shields.io/badge/go--cqhttp-v1.0.0_rc3-brightgreen)
![Nonebot2](https://img.shields.io/badge/Nonebot2-Release_v2.0.0rc2-brightgreen)
![go-cqhttp](https://img.shields.io/badge/go--cqhttp-v1.0.0_rc5-brightgreen)
<br>
![GitHub](https://img.shields.io/github/license/Ailitonia/omega-miya)
![Python](https://img.shields.io/badge/Python-3.10+-blue)
Expand All @@ -18,11 +18,11 @@ _基于 [Nonebot2](https://github.com/nonebot/nonebot2) 和 [go-cqhttp](https://

## 当前适配 nonebot2 版本

[Nonebot2 Release v2.0.0-beta.5](https://github.com/nonebot/nonebot2/releases/tag/v2.0.0-beta.5)
[Nonebot2 Release v2.0.0rc2](https://github.com/nonebot/nonebot2/releases/tag/v2.0.0rc2)

## 当前适配 go-cqhttp 版本

[go-cqhttp v1.0.0-rc3](https://github.com/Mrs4s/go-cqhttp/releases/tag/v1.0.0-rc3)
[go-cqhttp v1.0.0-rc5](https://github.com/Mrs4s/go-cqhttp/releases/tag/v1.0.0-rc5)

## 功能 & 特点

Expand Down
10 changes: 6 additions & 4 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
from nonebot.adapters.onebot.v11.adapter import Adapter as OneBotAdapter
from nonebot.log import logger, default_format

# win环境下proxy配置
# win 环境下 asyncio.loop 配置
import asyncio
if sys.version_info[0] == 3 and sys.version_info[1] >= 8 and sys.platform.startswith('win'):
if sys.version_info[0] == 3 and 10 > sys.version_info[1] >= 8 and sys.platform.startswith('win'):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
elif sys.version_info[0] == 3 and sys.version_info[1] >= 10 and sys.platform.startswith('win'):
asyncio.set_event_loop(asyncio.ProactorEventLoop())

# Log file path
bot_log_path = os.path.abspath(os.path.join(sys.path[0], 'log'))
if not os.path.exists(bot_log_path):
os.makedirs(bot_log_path)

# Custom logger
log_info_name = f'{datetime.today().strftime("%Y%m%d-%H%M%S")}-INFO.log'
log_error_name = f'{datetime.today().strftime("%Y%m%d-%H%M%S")}-ERROR.log'
log_info_name = f'{datetime.now().strftime("%Y%m%d-%H%M%S")}-INFO.log'
log_error_name = f'{datetime.now().strftime("%Y%m%d-%H%M%S")}-ERROR.log'
log_info_path = os.path.join(bot_log_path, log_info_name)
log_error_path = os.path.join(bot_log_path, log_error_name)

Expand Down
2 changes: 1 addition & 1 deletion omega_miya/database/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class PixivArtworkOrm(Base):
uid = Column(BigInteger, nullable=False, index=True, comment='作者uid')
title = Column(String(128), nullable=False, index=True, comment='作品标题title')
uname = Column(String(128), nullable=False, index=True, comment='作者名')
classified = Column(Integer, nullable=False, index=True, comment='标记标签, 0=未标记, 1=已人工标记或从可信已标记来源获取')
classified = Column(Integer, nullable=False, index=True, comment='标记标签, 0=未标记, 1=已人工标记或从可信已标记来源获取, 2=AI生成作品')
nsfw_tag = Column(Integer, nullable=False, index=True, comment='nsfw标签, -1=未标记, 0=safe, 1=setu. 2=r18')
width = Column(Integer, nullable=False, comment='原始图片宽度')
height = Column(Integer, nullable=False, comment='原始图片高度')
Expand Down
12 changes: 12 additions & 0 deletions omega_miya/local_resource/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ def __call__(self, *args) -> "LocalResource":
new_obj.path = self.path.joinpath(*[str(x) for x in args])
return new_obj

@property
def is_exist(self) -> bool:
return self.path.exists()

@property
def is_file(self) -> bool:
return self.is_exist and self.path.is_file()

@property
def is_dir(self) -> bool:
return self.is_exist and self.path.is_dir()

@staticmethod
def check_directory(func: Callable[P, R]) -> Callable[P, R]:
"""装饰一个方法, 需要实例 path 为文件夹时才能运行"""
Expand Down
Loading

0 comments on commit 5d5a602

Please sign in to comment.