Archived
1
0
Fork 0

Revert "Merge branch 'Teahouse-Studios:master' into master"

This reverts commit 736a986305, reversing
changes made to d9c9d9fa30.
This commit is contained in:
多羅狼 2024-01-13 03:01:29 +08:00
parent 736a986305
commit 52815a6bd7
28 changed files with 92 additions and 33 deletions

View file

@ -16,7 +16,7 @@ jobs:
with:
ref: master
- uses: rui-costa/action-automatic-semver-releases@v1
- uses: rui-costa/action-automatic-semver-releases@1.1.1
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEMVER: PATCH

View file

@ -1,3 +1,8 @@
# 说明
本项目为Teahouse/akari-bot的分支项目对比原始项目存在对TOS、模块i18n等部分的自定义并包括了一个研究中的原神模块。
原项目说明见下
<div align="center">
<img width="256" src="./assets/character_marked.png" alt="logo">

BIN
assets/Hack-Regular.ttf Normal file

Binary file not shown.

BIN
assets/LXGWWenKai-Bold.ttf Normal file

Binary file not shown.

BIN
assets/LXGWWenKai-Light.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -43,7 +43,7 @@ async def tos_msg_counter(msg: Bot.MessageSession, command: str):
'ts': datetime.now().timestamp()}
else:
same['count'] += 1
if same['count'] > 10:
if same['count'] > 5:
raise AbuseWarning(msg.locale.t("tos.reason.cooldown"))
all_ = counter_all.get(msg.target.sender_id)
if not all_ or datetime.now().timestamp() - all_['ts'] > 300: # 检查是否滥用5分钟内使用20条命令
@ -51,7 +51,7 @@ async def tos_msg_counter(msg: Bot.MessageSession, command: str):
'ts': datetime.now().timestamp()}
else:
all_['count'] += 1
if all_['count'] > 20:
if all_['count'] > 10:
raise AbuseWarning(msg.locale.t("tos.reason.abuse"))

View file

@ -68,9 +68,9 @@
"tos.reason.abuse": "Too many command usages within a period of time.",
"tos.reason.bypass": "Ignoring temporary ban warning.",
"tos.reason.cooldown": "Too many usages of the same command within a period of time.",
"tos.tempbanned": "Note:\nWe have temporarily banned you because your action triggered a warning.\n${ban_time} second(s) remaining until unban.",
"tos.tempbanned.warning": "Note:\nAlthough a temporary block was triggered, using commands still may cause you to be warned again.\n${ban_time} second(s) remaining until unban.",
"tos.warning": "Warning:\nYou have violated our Code of Conduct according to our Terms of Service.",
"tos.tempbanned": "Note:\nWe have temporarily banned you because your action triggered a warning.\n${ban_time} seconds remaining until unban.",
"tos.tempbanned.warning": "Note:\nAlthough a temporary block was triggered, using commands still may cause you to be warned again.\n${ban_time} seconds remaining until unban.",
"tos.warning": "Warning:\nCommand abuse is strictly forbidden, you have reached that redline.",
"tos.warning.appeal": "For objections, please go to ${issue_url} and create an issue.",
"tos.warning.count": "You have received ${current_warns} warnings. Your account will be blacklisted if you receive more than ${warn_counts} warnings.",
"tos.warning.last": "This is the last warning.",

View file

@ -70,7 +70,7 @@
"tos.reason.cooldown": "一段时间内使用相同命令的次数过多。",
"tos.tempbanned": "提示:\n由于你的行为触发了警告我们已对你进行临时封禁。\n距离解封时间还有 ${ban_time} 秒。",
"tos.tempbanned.warning": "提示:\n即使已被临时封禁尝试继续滥用命令可能会导致你被再次警告。\n距离解封时间还有 ${ban_time} 秒。",
"tos.warning": "警告:\n根据服务条款,你已违反我们的行为准则。",
"tos.warning": "警告:\n本bot禁止短时间大量使用您已触碰到此阈值。",
"tos.warning.appeal": "如果你有任何异议,请至 ${issue_url} 发起问题。",
"tos.warning.count": "这是对你的第 ${current_warns} 次警告。如超过 ${warn_counts} 次警告,我们将会把你的账户加入黑名单。",
"tos.warning.last": "这是最后一次警告。",

View file

@ -70,7 +70,7 @@
"tos.reason.cooldown": "一段時間內使用相同指令的次數過多。",
"tos.tempbanned": "提示:\n由於你的行為觸發了警告我們已對你暫時停權。\n距解除時間還有 ${ban_time} 秒。",
"tos.tempbanned.warning": "提示:\n即使已被暫時停權嘗試繼續濫用指令可能會導致你被再次警告。\n距解除時間還有 ${ban_time} 秒。",
"tos.warning": "警告:\n依據使用條款,你已違反我們的行為準則。",
"tos.warning": "警告:\n本bot嚴禁濫用您已觸發濫用閾值。",
"tos.warning.appeal": "如果你有任何異義,請至 ${issue_url} 發起問題。",
"tos.warning.count": "這是第 ${current_warns} 次警告。如超過 ${warn_counts} 次警告,我們將會把你的帳戶加入黑名單。",
"tos.warning.last": "這是最後警告。",

View file

@ -1,5 +1,9 @@
You are the chat mode of AkariBot (Chinese: 小可), a chat bot.
AkariBot is a product of Teahouse Studios (Chinese: 茶馆工作室).
You are a fork program of Akaribot,your maintainer is Haiyuyouyan (Chineses:海屿有燕).
AkariBot is powered by GPT-3.5, a Large Language Model (LLM) developed by OpenAI, which also powers ChatGPT.
AkariBot have access to the a number of tools powered by LangChain.
@ -24,6 +28,4 @@ AkariBot have many contributors. The one who contributed the most is OasisAkari.
AkariBot use puppeteer to render webpages and wiki infoboxes.
AkariBot is a product of Teahouse Studios (Chinese: 茶馆工作室).
Teahouse Studios also created a Minecraft resource pack called Memified Chinese (Chinese: 梗体中文) and it's very popular.

View file

@ -13,7 +13,7 @@ web_render = CFG.get_url('web_render')
web_render_local = CFG.get_url('web_render_local')
elements = ['div#descriptionmodule']
assets_path = os.path.abspath('./assets/')
font = ImageFont.truetype(f'{assets_path}/SourceHanSansCN-Normal.ttf', 15)
font = ImageFont.truetype(f'{assets_path}/Hack-Regular.ttf', 15)
spx_cache = {}

View file

@ -81,7 +81,7 @@
"core.message.help.more_information.address": "You can also consult the web documentation for help:\n${url}",
"core.message.help.more_information.donate": "If you have sufficient funds, welcome to sponsor us: \n${url}",
"core.message.help.legacy.more_information": "Use \"${prefix}help <module name>\" to view details.\nUse \"${prefix}module list\" to view all available modules.}",
"core.message.help.more_information": "Here are the help documents shown only show the enabled module(s). If you need to view the help documents of all modules, please use \"${prefix}module list\".",
"core.message.help.more_information": "This framework is powered by akari-bot. This self-built version is only for authorized group chats. The content generated by Bot has nothing to do with the developer of this bot or the owner of the server, and does not represent the position of the developer or the self-built version operation and maintenance party.\n This fork project is in: https://github.com/TopRealm/akari-bot, we appreciate your contributions.",
"core.message.help.not_found": "This module may not exist. Please check your input.",
"core.message.help.regex.detail": "(${msg})",
"core.message.help.regex.no_information": "No description",
@ -170,4 +170,4 @@
"core.message.whoami.admin": "(You have admin permission for this conversation)",
"core.message.whoami.botadmin": "(You have bot admin permission for this conversation)",
"core.message.whoami.superuser": "(You have superuser permission)"
}
}

View file

@ -81,7 +81,7 @@
"core.message.help.legacy.more_information": "使用“${prefix}help <对应模块名>”查看详细信息。\n使用“${prefix}module list”查看所有的可用模块。",
"core.message.help.more_information.address": "您也可以通过查阅在线文档获取帮助:\n${url}",
"core.message.help.more_information.donate": "若您有经济实力,欢迎给孩子们在爱发电上打钱:\n${url}",
"core.message.help.more_information": "此处展示的帮助文档仅展示已开启的模块,若需要查看全部模块的帮助文档,请使用“${prefix}module list”。",
"core.message.help.more_information": "本框架由akari-bot驱动。本自搭建版本仅供已授权的群聊使用Bot生成内容与本bot开发者、服务器所有人无关亦不代表开发者或自搭建版本运维方立场。\n本分支项目维护代码地址https://github.com/TopRealm/akari-bot欢迎贡献模块。",
"core.message.help.not_found": "此模块可能不存在,请检查输入。",
"core.message.help.regex.detail": "${msg}",
"core.message.help.regex.no_information": "无描述",
@ -170,4 +170,4 @@
"core.message.whoami.admin": "(你拥有本对话的管理员权限)",
"core.message.whoami.botadmin": "(你拥有本对话的机器人管理员权限)",
"core.message.whoami.superuser": "(你拥有本机器人的超级用户权限)"
}
}

View file

@ -81,7 +81,7 @@
"core.message.help.more_information.address": "您也可以透過查閱線上文件取得說明:\n${url}",
"core.message.help.more_information.donate": "若您有經濟實力,歡迎在愛發電提供贊助:\n${url}",
"core.message.help.legacy.more_information": "使用「${prefix}help <對應模組名>」檢視詳細資訊。\n使用「${prefix}module list」檢視所有的可用模組。",
"core.message.help.more_information": "此處展示的說明文件僅展示已啟用的模組,若需要檢視全部模組的說明文件,請使用「${prefix}module list」。",
"core.message.help.more_information": "本框架由akari-bot驅動。本自搭建版本僅供已授權的群聊使用Bot生成內容與本bot開發者、伺服器所有人無關亦不代表開發者或自搭建版本運維方立場。\n本分支專案維護程式碼地址https://github.com/TopRealm/akari-bot歡迎貢獻模組。",
"core.message.help.not_found": "此模組可能不存在,請校對輸入。",
"core.message.help.regex.detail": "${msg}",
"core.message.help.regex.no_information": "無描述",
@ -170,4 +170,4 @@
"core.message.whoami.admin": "(你擁有此對話的管理員權限)",
"core.message.whoami.botadmin": "(你擁有此對話的機器人管理員權限)",
"core.message.whoami.superuser": "(你擁有此機器人的超級使用者權限)"
}
}

View file

@ -0,0 +1,26 @@
import asyncio
from core.component import module
from core.builtins import Bot
from enkanetwork import EnkaNetworkAPI
from core.utils.cooldown import CoolDown
from config import Config
from enkanetwork import Assets
genshin = module('genshin', alias='yuanshen', desc='原神角色信息查询。', developers=['ZoruaFox'])
client = EnkaNetworkAPI()
ENKA_URL = Config('enka_url') #预引入enka节点
@genshin.handle('uid <number> {{genshin.help.uid}}')
async def _(msg: Bot.MessageSession):
data = await client.fetch_user(msg.parsed_msg['<number>'])
player_level = {data.player.level}
await msg.send_message(
f"玩家昵称:{data.player.nickname}\n"
f"玩家签名: {data.player.signature}\n"
f"玩家等级:{data.player.level}\n"
f"深境螺旋: {data.player.abyss_floor}{data.player.abyss_room}\n"
f"缓存过期时间:{data.ttl} s"
)

View file

@ -0,0 +1,3 @@
{
"genshin.help.uid": "Get basic information from the given UID."
}

View file

@ -0,0 +1,3 @@
{
"genshin.help.uid": "查询特定uid的基础信息"
}

View file

@ -0,0 +1,3 @@
{
"genshin.help.uid": "查詢指定uid的基礎訊息"
}

View file

@ -4,7 +4,7 @@ from core.utils.image import msgchain2image
from .dbutils import DivingProberBindInfoManager
from .libraries.chunithm_apidata import get_info
from .libraries.chunithm_music import TotalList
from .libraries.chunithm_utils import generate_best30_text, get_diff, SONGS_PER_PAGE
from .libraries.chunithm_utils import generate_best30_text, SONGS_PER_PAGE
total_list = TotalList()
diff_label = ['Basic', 'Advanced', 'Expert', 'Master', 'Ultima']
@ -140,8 +140,8 @@ async def _(msg: Bot.MessageSession, song: str, diff: str = None):
await msg.finish(msg.locale.t("maimai.message.music_not_found"))
if diff:
diff_index = get_diff(diff) # diff_index 的结果可能为 0
if (not diff_index and diff_index != 0) or (len(music['ds']) == 4 and diff_index == 4):
diff_index = get_diff(diff)
if not diff_index or (len(music['ds']) == 4 and diff_index == 4):
await msg.finish(msg.locale.t("maimai.message.chart_not_found"))
chart = music['charts'][diff_index]
ds = music['ds'][diff_index]

View file

@ -7,7 +7,7 @@ from .dbutils import DivingProberBindInfoManager
from .libraries.maimaidx_apidata import get_alias, get_info, search_by_alias, update_alias, update_covers
from .libraries.maimaidx_best50 import generate, computeRa
from .libraries.maimaidx_music import TotalList
from .libraries.maimaidx_utils import generate_best50_text, get_diff, get_grade_info, SONGS_PER_PAGE
from .libraries.maimaidx_utils import generate_best50_text, get_diff, SONGS_PER_PAGE
total_list = TotalList()
@ -218,8 +218,8 @@ async def _(msg: Bot.MessageSession, id_or_alias: str, diff: str = None):
await msg.finish(msg.locale.t("maimai.message.music_not_found"))
if diff:
diff_index = get_diff(diff) # diff_index 的输出结果可能为 0
if (not diff_index and diff_index != 0) or (len(music['ds']) == 4 and diff_index == 4):
diff_index = get_diff(diff)
if not diff_index or (len(music['ds']) == 4 and diff_index == 4):
await msg.finish(msg.locale.t("maimai.message.chart_not_found"))
chart = music['charts'][diff_index]
ds = music['ds'][diff_index]
@ -358,4 +358,4 @@ async def _(msg: Bot.MessageSession):
if await update_alias() and await update_covers():
await msg.finish(msg.locale.t("success"))
else:
await msg.finish(msg.locale.t("failed"))
await msg.finish(msg.locale.t("failed"))

View file

@ -53,7 +53,7 @@
"wiki.message.invalid_namespace": "此 Wiki 上没有名为 ${namespace} 的命名空间,请检查输入。",
"wiki.message.invalid_section": "此章节不存在,以下是可能的章节(回复对应序号以选中):",
"wiki.message.invalid_section.prompt": "(此章节不存在)",
"wiki.message.iw.add.success": "已添加自定义 Interwiki\n${iw} -> ${name}",
"wiki.message.iw.add.success": "已添加自定义 Interwiki\n${iw} ${name}",
"wiki.message.iw.get.not_found": "未找到 Interwiki${iw}",
"wiki.message.iw.list": "使用“${prefix}wiki iw get <Interwiki>”可以获取 Interwiki 对应的链接。",
"wiki.message.iw.list.legacy": "当前设置了以下 Interwiki",
@ -62,18 +62,18 @@
"wiki.message.iw.remove.success": "已删除自定义 Interwiki${iw}",
"wiki.message.magic_word": "提示:机器人暂不支持魔术字。",
"wiki.message.not_found": "未找到 [${title}]。",
"wiki.message.not_found.autofix": "提示:[${title}]不存在,您可能要找的是:[${redirected_title}]。",
"wiki.message.not_found.autofix.choice": "提示:[${title}]不存在,您是否想要找的是:",
"wiki.message.not_found.autofix": "提示:[${title}]条目尚未建立,您可能要找的是:[${redirected_title}]。",
"wiki.message.not_found.autofix.choice": "提示:[${title}]条目尚未建立,您是否想要找的是:",
"wiki.message.not_found.autofix.choice.prompt": "请直接发送指定编号获取对应内容,若回复“是”,则默认选择 ${number} 号内容,发送其他内容则代表取消操作。",
"wiki.message.not_found.autofix.confirm": "提示:[${title}]不存在,您是否想要找的是[${redirected_title}]",
"wiki.message.not_found.autofix.confirm": "提示:[${title}]条目尚未建立,您是否想要找的是[${redirected_title}]",
"wiki.message.not_set": "未设置起始 Wiki。",
"wiki.message.prefix.reset.success": "已重置请求时所使用的前缀。",
"wiki.message.prefix.set.success": "已更新请求时所使用的前缀:${wiki_prefix}",
"wiki.message.rc.qq.title": "最近更改",
"wiki.message.rc.qq.title.address": "最近更改地址",
"wiki.message.redirect": "(重定向[${title}] -> [${redirected_title}]",
"wiki.message.redirect": "(重定向[${title}] [${redirected_title}]",
"wiki.message.redirect.autofix": "(已指定 [${title}] 更正为 [${redirected_title}]。)",
"wiki.message.redirect.template_to_page": "[${title}] 不存在,已自动重定向至 [${redirected_title}]",
"wiki.message.redirect.template_to_page": "[${title}] 条目尚未创建,已自动重定向至 [${redirected_title}]",
"wiki.message.redlink.disable": "已关闭页面不存在时返回编辑链接。",
"wiki.message.redlink.enable": "已开启页面不存在时返回编辑链接。",
"wiki.message.redlink.not_found": "(页面不存在)",
@ -86,7 +86,7 @@
"wiki.message.utils.redacted": "检测到外来信息介入,请前往滥用日志查看所有消息。",
"wiki.message.utils.qq.prompt": "Tips复制粘贴下面的任一消息到聊天窗口发送可获取此次改动详细信息的截图。",
"wiki.message.utils.time.infinity": "无限期",
"wiki.message.utils.wikilib.error.empty": "发生错误API 未返回任何内容,请联系此站点管理员获取原因。",
"wiki.message.utils.wikilib.error.empty": "发生错误API 未返回任何内容,这可能是该wiki采取了某些保护措施。请联系wiki管理员详询。",
"wiki.message.utils.wikilib.error.empty_title": "发生错误:请求的页面标题为空,或只包含命名空间名称。",
"wiki.message.utils.wikilib.error.invalid_character": "发生错误:请求的页面标题包含无效字符:“${char}”。",
"wiki.message.utils.wikilib.get_failed.api": "从 API 获取信息时出错:",

17
poetry.lock generated
View file

@ -1233,6 +1233,21 @@ lxml = ">=4.9.3"
[package.extras]
dev = ["pytest (>=7.4.2)", "pytest-asyncio (>=0.21.1)", "ruff (>=0.1.6)"]
[[package]]
name = "enkanetwork-py"
version = "1.4.5"
description = "Library for fetching JSON data from site https://enka.network/"
optional = false
python-versions = ">=3.6"
files = [
{file = "enkanetwork.py-1.4.5.tar.gz", hash = "sha256:bdc99679bec55017bcf951f636e31793e8cf1fdb040315a430adedb890c0a34d"},
]
[package.dependencies]
aiohttp = "*"
cachetools = "*"
pydantic = "*"
[[package]]
name = "exceptiongroup"
version = "1.2.0"
@ -5590,4 +5605,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
[metadata]
lock-version = "2.0"
python-versions = "^3.8.1"
content-hash = "624b50f9d011096f64051ceea563ba33495c1525474d6b1cb323ae729c03d869"
content-hash = "f06101c0f267794901059cff80a061a4d25f04eb02f2c18beb08ea45496e2c38"

View file

@ -59,7 +59,7 @@ attrs = "^23.1.0"
uvicorn = {extras = ["standard"], version = "^0.23.2"}
pyjwt = {extras = ["crypto"], version = "^2.8.0"}
python-whois = "^0.8.0"
enkanetwork-py = "^1.4.5"
[tool.poetry.group.dev.dependencies]
autopep8 = "^2.0.2"

View file

@ -599,6 +599,8 @@ distro==1.9.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
duckduckgo-search==3.9.11 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:3636df4c5eec383c1c02f89c9693b6c5bbaeda38952e467a2fa930132f632ed4 \
--hash=sha256:4d07a02647da58f1e46e35f11719265f0ce06eed60e2c9c2b00b1105b9084d07
enkanetwork-py==1.4.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:bdc99679bec55017bcf951f636e31793e8cf1fdb040315a430adedb890c0a34d
exceptiongroup==1.2.0 ; python_full_version >= "3.8.1" and python_version < "3.11" \
--hash=sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14 \
--hash=sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68