Archived
1
0
Fork 0

Merge branch 'master' into conflict

This commit is contained in:
ZoruaFox 2024-01-03 22:12:40 +08:00 committed by GitHub
commit 22403cc254
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 94 additions and 22 deletions

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

@ -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

@ -79,7 +79,7 @@
"core.message.help.legacy.base": "Base Command: ",
"core.message.help.legacy.external": "Extension Command: ",
"core.message.help.legacy.more_information": "Use \"${prefix}help <module name>\" to view details.\nUse \"${prefix}module list\" to view all available modules.\nYou can also consult the web documentation for help:\n${help_url}",
"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\".\nYou can also consult the web documentation for help:\n${help_url}\nIf you have sufficient funds, welcome to sponsor us: \n${donate_url}",
"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",
@ -168,4 +168,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

@ -79,7 +79,7 @@
"core.message.help.legacy.base": "基础命令:",
"core.message.help.legacy.external": "模块扩展命令:",
"core.message.help.legacy.more_information": "使用“${prefix}help <对应模块名>”查看详细信息。\n使用“${prefix}module list”查看所有的可用模块。\n您也可以通过查阅在线文档获取帮助\n${help_url}",
"core.message.help.more_information": "此处展示的帮助文档仅展示已开启的模块,若需要查看全部模块的帮助文档,请使用“${prefix}module list”。\n您也可以通过查阅在线文档获取帮助\n${help_url}\n若您有经济实力欢迎给孩子们在爱发电上打钱\n${donate_url}",
"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": "无描述",
@ -168,4 +168,4 @@
"core.message.whoami.admin": "(你拥有本对话的管理员权限)",
"core.message.whoami.botadmin": "(你拥有本对话的机器人管理员权限)",
"core.message.whoami.superuser": "(你拥有本机器人的超级用户权限)"
}
}

View file

@ -79,7 +79,7 @@
"core.message.help.legacy.base": "基礎指令:",
"core.message.help.legacy.external": "模組擴充指令:",
"core.message.help.legacy.more_information": "使用「${prefix}help <對應模組名>」檢視詳細資訊。\n使用「${prefix}module list」檢視所有的可用模組。\n您也可以透過查閱線上文件取得說明\n${help_url}",
"core.message.help.more_information": "此處展示的說明文件僅展示已啟用的模組,若需要檢視全部模組的說明文件,請使用「${prefix}module list」。\n您也可以透過查閱線上文件取得說明\n${help_url}\n若您有經濟實力歡迎在愛發電提供贊助\n${donate_url}",
"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": "無描述",
@ -168,4 +168,4 @@
"core.message.whoami.admin": "(你擁有此對話的管理員權限)",
"core.message.whoami.botadmin": "(你擁有此對話的機器人管理員權限)",
"core.message.whoami.superuser": "(你擁有此機器人的超級使用者權限)"
}
}

View file

@ -0,0 +1,27 @@
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

@ -52,7 +52,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",
@ -61,18 +61,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": "(页面不存在)",
@ -85,7 +85,7 @@
"wiki.message.utils.banned": "检测到外来信息介入,请前往滥用日志查看所有消息。",
"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 获取信息时出错:",

26
poetry.lock generated
View file

@ -558,6 +558,17 @@ files = [
[package.dependencies]
cffi = ">=1.0.0"
[[package]]
name = "cachetools"
version = "5.3.2"
description = "Extensible memoizing collections and decorators"
optional = false
python-versions = ">=3.7"
files = [
{file = "cachetools-5.3.2-py3-none-any.whl", hash = "sha256:861f35a13a451f94e301ce2bec7cac63e881232ccce7ed67fab9b5df4d3beaa1"},
{file = "cachetools-5.3.2.tar.gz", hash = "sha256:086ee420196f7b2ab9ca2db2520aca326318b68fe5ba8bc4d49cca91add450f2"},
]
[[package]]
name = "caio"
version = "0.9.13"
@ -1030,6 +1041,21 @@ click = ">=8.1.3"
httpx = {version = ">=0.24.1", extras = ["brotli", "http2", "socks"]}
lxml = ">=4.9.2"
[[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.1.3"

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

@ -284,6 +284,9 @@ brotlicffi==1.0.9.2 ; platform_python_implementation != "CPython" and python_ful
--hash=sha256:ba4a00263af40e875ec3d6c7f623cbf8c795b55705da18c64ec36b6bf0848bc5 \
--hash=sha256:df78aa47741122b0d5463f1208b7bb18bc9706dee5152d9f56e0ead4865015cd \
--hash=sha256:feb942814285bdc5e97efc77a04e48283c17dfab9ea082d79c0a7b9e53ef1eab
cachetools==5.3.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:086ee420196f7b2ab9ca2db2520aca326318b68fe5ba8bc4d49cca91add450f2 \
--hash=sha256:861f35a13a451f94e301ce2bec7cac63e881232ccce7ed67fab9b5df4d3beaa1
caio==0.9.13 ; python_full_version >= "3.8.1" and python_version < "4" \
--hash=sha256:0a04bcac15b0c18057ec57dd9666c4d5c1058958a8db5191b46a1e54931c4a6e \
--hash=sha256:114d6c158dc592849532fd0992cbfb85430f4f6e48323a3990c39e4741f81a25 \
@ -546,6 +549,8 @@ distro==1.9.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
duckduckgo-search==3.8.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:584ea097fa0475cebc278ee464ccd54ba78019dec15a0243723923dc40bc3939 \
--hash=sha256:9c85190c439f29e95d0cc9509a77d63dbcdbda49a4f9bdf8ff4b567f4a10a44d
enkanetwork-py==1.4.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:bdc99679bec55017bcf951f636e31793e8cf1fdb040315a430adedb890c0a34d
exceptiongroup==1.1.3 ; python_full_version >= "3.8.1" and python_version < "3.11" \
--hash=sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9 \
--hash=sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3