mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-10-21 16:27:15 +08:00
🔥 移除内置对联
(请自行安装nb商店插件),修复群聊学习
,优化提示
This commit is contained in:
parent
d8e81fefdd
commit
d4c53b1138
@ -22,7 +22,7 @@ from .config import config_manager
|
|||||||
chat_config = config_manager.config
|
chat_config = config_manager.config
|
||||||
command_start_ = command_start.copy()
|
command_start_ = command_start.copy()
|
||||||
if '' in command_start_:
|
if '' in command_start_:
|
||||||
command_start.remove('')
|
command_start_.remove('')
|
||||||
|
|
||||||
NO_PERMISSION_WORDS = [f'{NICKNAME}就喜欢说这个,哼!', f'你管得着{NICKNAME}吗!']
|
NO_PERMISSION_WORDS = [f'{NICKNAME}就喜欢说这个,哼!', f'你管得着{NICKNAME}吗!']
|
||||||
ENABLE_WORDS = [f'{NICKNAME}会尝试学你们说怪话!', f'好的呢,让{NICKNAME}学学你们的说话方式~']
|
ENABLE_WORDS = [f'{NICKNAME}会尝试学你们说怪话!', f'好的呢,让{NICKNAME}学学你们的说话方式~']
|
||||||
|
@ -33,7 +33,7 @@ class GenshinInfoManager:
|
|||||||
检查是否已绑定私人cookie
|
检查是否已绑定私人cookie
|
||||||
:return: bool
|
:return: bool
|
||||||
"""
|
"""
|
||||||
return bool(await PrivateCookie.get_or_none(user_id=self.user_id, uid=self.uid))
|
return await PrivateCookie.filter(user_id=self.user_id, uid=self.uid).exists()
|
||||||
|
|
||||||
async def update_all(self, include_talent: bool = False) -> str:
|
async def update_all(self, include_talent: bool = False) -> str:
|
||||||
"""
|
"""
|
||||||
@ -116,7 +116,11 @@ class GenshinInfoManager:
|
|||||||
return data
|
return data
|
||||||
elif data['retcode'] == 1034:
|
elif data['retcode'] == 1034:
|
||||||
logger.info('原神信息', f'更新<m>{self.uid}</m>的玩家数据时出错,状态码为1034,<r>疑似验证码</r>')
|
logger.info('原神信息', f'更新<m>{self.uid}</m>的玩家数据时出错,状态码为1034,<r>疑似验证码</r>')
|
||||||
return '遇验证码阻拦,需手动前往米游社进行验证后才能继续使用'
|
return (
|
||||||
|
'遇验证码阻拦,需手动前往米游社进行验证后才能继续使用'
|
||||||
|
if await self.is_bind()
|
||||||
|
else '未绑定私人Cookie,更新米游社数据时遇验证码阻拦而失败'
|
||||||
|
)
|
||||||
elif data['retcode'] != 0:
|
elif data['retcode'] != 0:
|
||||||
logger.info('原神信息', f'更新<m>{self.uid}</m>的玩家数据时出错,消息为<r>{data["message"]}</r>')
|
logger.info('原神信息', f'更新<m>{self.uid}</m>的玩家数据时出错,消息为<r>{data["message"]}</r>')
|
||||||
return data['message']
|
return data['message']
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
<h1 align="center">nonebot-plugin-couplets</h1>
|
|
||||||
<h4 align="center">Nonebot2对对联插件</h4>
|
|
||||||
<p align="center" >
|
|
||||||
<a href="https://pypi.python.org/pypi/nonebot-plugin-couplets">
|
|
||||||
<img src="https://img.shields.io/pypi/v/nonebot-plugin-couplets" alt="pypi">
|
|
||||||
</a>
|
|
||||||
<img src="https://img.shields.io/badge/Python-3.8+-yellow" alt="python">
|
|
||||||
<img src="https://img.shields.io/badge/Nonebot-2.0.0b5-green" alt="python">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## 安装
|
|
||||||
> 需要配合nonebot2使用,安装方法详见[nb文档](https://v2.nonebot.dev/)
|
|
||||||
- 通过nb脚手架安装(推荐)
|
|
||||||
```
|
|
||||||
nb plugin install nonebot-plugin-couplets
|
|
||||||
```
|
|
||||||
- 通过pip安装
|
|
||||||
```
|
|
||||||
pip install nonebot-plugin-couplets
|
|
||||||
|
|
||||||
# 还需要在bot.py加载插件,在bot.py中添加
|
|
||||||
nonebot.load_plugin("nonebot-plugin-couplets")
|
|
||||||
```
|
|
||||||
- 通过poetry安装
|
|
||||||
```
|
|
||||||
poetry add nonebot-plugin-couplets
|
|
||||||
|
|
||||||
# 还需要在bot.py加载插件,同上
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## 指令
|
|
||||||
```
|
|
||||||
对联 <上联内容> (数量)
|
|
||||||
· 数量可选,默认为1
|
|
||||||
```
|
|
||||||
例如,`对联 苟利国家生死以 3`
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
from typing import List
|
|
||||||
|
|
||||||
import httpx
|
|
||||||
from nonebot import on_command
|
|
||||||
from nonebot.adapters.onebot.v11 import Message, MessageEvent
|
|
||||||
from nonebot.adapters.onebot.v11.helpers import Numbers
|
|
||||||
from nonebot.params import CommandArg
|
|
||||||
from nonebot.plugin import PluginMetadata
|
|
||||||
from nonebot.typing import T_State
|
|
||||||
|
|
||||||
__plugin_meta__ = PluginMetadata(
|
|
||||||
name="对对联",
|
|
||||||
description="人工智能和你对对联",
|
|
||||||
usage="对联<内容>(数量)",
|
|
||||||
extra={
|
|
||||||
'type': '娱乐',
|
|
||||||
"author": "惜月 <277073121@qq.com>",
|
|
||||||
"version": "1.0.0",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
couplets = on_command('对联', aliases={'对对联'}, priority=13, block=True, state={
|
|
||||||
'pm_usage': '对联<内容>(数量)',
|
|
||||||
'pm_describe': '人工智能和你对对联',
|
|
||||||
'pm_priority': 15
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
@couplets.handle()
|
|
||||||
async def _(event: MessageEvent, state: T_State, msg: Message = CommandArg(), num: List[float] = Numbers()):
|
|
||||||
msg = msg.extract_plain_text().strip()
|
|
||||||
if msg:
|
|
||||||
for n in num:
|
|
||||||
msg = msg.replace(str(int(n)), '')
|
|
||||||
if msg:
|
|
||||||
state['text'] = msg
|
|
||||||
if num:
|
|
||||||
state['num'] = int(num[0]) if num[0] <= 10 else 10
|
|
||||||
else:
|
|
||||||
state['num'] = 1
|
|
||||||
|
|
||||||
|
|
||||||
@couplets.got('text', prompt='请输入上联内容')
|
|
||||||
async def couplets_handler(event: MessageEvent, state: T_State):
|
|
||||||
url = f'https://seq2seq-couplet-model.rssbrain.com/v0.2/couplet/{state["text"]}'
|
|
||||||
async with httpx.AsyncClient() as client:
|
|
||||||
res = await client.get(url=url)
|
|
||||||
res = res.json()
|
|
||||||
result = '\n'.join(['➤' + res['output'][n] for n in range(state['num'])])
|
|
||||||
await couplets.finish(f'上联:\n➤{state["text"]}\n下联:\n{result}')
|
|
@ -1,33 +0,0 @@
|
|||||||
[tool.poetry]
|
|
||||||
name = "nonebot-plugin-couplets"
|
|
||||||
version = "1.0.0"
|
|
||||||
description = "Nonebot2对对联插件"
|
|
||||||
authors = ["惜月 <277073121@qq.com>"]
|
|
||||||
readme = "README.md"
|
|
||||||
license = "AGPL"
|
|
||||||
keywords = ["nonebot", "nonebot2", "couplets"]
|
|
||||||
homepage = "https://github.com/CMHopeSunshine/LittlePaimon/tree/Bot/src/plugins/nonebot_plugin_couplets"
|
|
||||||
repository = "https://github.com/CMHopeSunshine/LittlePaimon/tree/Bot/src/plugins/nonebot_plugin_couplets"
|
|
||||||
documentation = "https://github.com/CMHopeSunshine/LittlePaimon/tree/Bot/src/plugins/nonebot_plugin_couplets#readme"
|
|
||||||
packages = [
|
|
||||||
{ include = "nonebot_plugin_couplets/*.py", from = ".."}
|
|
||||||
]
|
|
||||||
|
|
||||||
[[tool.poetry.source]]
|
|
||||||
name = "ali"
|
|
||||||
default = true
|
|
||||||
url = "https://mirrors.aliyun.com/pypi/simple/"
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
|
||||||
python = "^3.8"
|
|
||||||
nonebot2 = "^2.0.0-beta.1"
|
|
||||||
nonebot-adapter-onebot = "^2.0.0-beta.1"
|
|
||||||
nonebot-plugin-apscheduler = "^0.1.2"
|
|
||||||
httpx = "^0.23.0"
|
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
|
||||||
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["poetry_core>=1.0.0"]
|
|
||||||
build-backend = "poetry.core.masonry.api"
|
|
Loading…
Reference in New Issue
Block a user