Skip to content

Commit

Permalink
<jx3>[feat]统战YY;[feat]门派小药;[feat]骗子查询;[feat]活动日历;[feat]随机帖子;<develope…
Browse files Browse the repository at this point in the history
…r_tools>[feat]在线反馈
  • Loading branch information
HornCopper committed Apr 20, 2024
1 parent 44b14a8 commit 844b211
Show file tree
Hide file tree
Showing 62 changed files with 578 additions and 136 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ _基于Nonebot 2的多功能的群聊机器人_

各种功能于一体的群聊机器人,基于[Nonebot 2](https://v2.nonebot.dev)

项目基于`GPL-3.0`开源,欢迎借鉴,不欢迎商用,不欢迎帝君以任何形式使用本仓库任何源码,有声明的除外。
项目基于`AGPL-3.0`开源,欢迎借鉴,不欢迎商用,不欢迎帝君以任何形式使用本仓库任何源码,有声明的除外。

本项目与`QQ`无关,请勿用于搭建QQ机器人等服务。仅供娱乐与学习,下载后请于24小时内删除。

Expand Down
Empty file removed src/__init__.py
Empty file.
8 changes: 4 additions & 4 deletions src/constant/jx3/skilldatalib.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ async def getAllSkillsInfo(Kungfu: str) -> str:
if Kungfu == "隐龙诀":
Kungfu == "隐龙决" # 由于`JX3Box`的`API`的数据错误问题,目前只能这样适配,等到数据纠正后删除这块代码。
skill = read(ASSETS + "/jx3/skills/" + Kungfu + ".json")
if skill == False:
if not skill:
await getSkills()
await getAllSkillsInfo(Kungfu)
if Kungfu == False:
if not Kungfu:
return False
skills = json.loads(skill)
node = []
Expand Down Expand Up @@ -218,7 +218,7 @@ async def getSingleSkill(kungfu: str, skillName: str):
kungfu = aliases(kungfu)
if kungfu == "隐龙诀":
kungfu == "隐龙决" # 由于`JX3Box`的`API`的数据错误问题,目前只能这样适配,等到数据纠正后删除这块代码。其实是推栏的代码错了笑死。
if kungfu == False:
if not kungfu:
return False
try:
data = json.loads(read(ASSETS + "/jx3/skills/" + kungfu + ".json"))
Expand Down Expand Up @@ -262,7 +262,7 @@ async def getSingleSkill(kungfu: str, skillName: str):

async def getSingleTalent(Kungfu: str, TalentName: str):
kungfuname = aliases(Kungfu)
if kungfuname == False:
if not kungfuname:
return "此心法不存在哦,请检查后重试~"
try:
data = json.loads(
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/ban/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def in_it(qq: str):

@ban.handle()
async def _(bot: Bot, event: Event, args: Message = CommandArg()):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await ban.finish(error(10))
sb = args.extract_plain_text()
self_protection = False
Expand All @@ -62,7 +62,7 @@ async def _(bot: Bot, event: Event, args: Message = CommandArg()):

@unban.handle()
async def _(bot: Bot, event: Event, args: Message = CommandArg()):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await ban.finish(error(10))
sb = args.extract_plain_text()
if checknumber(sb) is False:
Expand Down
8 changes: 0 additions & 8 deletions src/plugins/ban/info.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/plugins/banword/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@banword.handle()
async def __(event: GroupMessageEvent, args: Message = CommandArg()): # 违禁词封锁
bw = args.extract_plain_text()
if checker(str(event.user_id), 5) == False:
if not checker(str(event.user_id), 5):
await banword.finish(error(5))
if bw:
now = json.loads(read(TOOLS + "/banword.json"))
Expand All @@ -23,7 +23,7 @@ async def __(event: GroupMessageEvent, args: Message = CommandArg()): # 违禁

@unbanword.handle()
async def ___(event: GroupMessageEvent, args: Message = CommandArg()):
if checker(str(event.user_id), 5) == False:
if not checker(str(event.user_id), 5):
await unbanword.finish(error(5))
cmd = args.extract_plain_text()
if cmd:
Expand Down
8 changes: 0 additions & 8 deletions src/plugins/blacklist/info.json

This file was deleted.

5 changes: 1 addition & 4 deletions src/plugins/developer_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from .adopt_bot import *
from .mgr_tools import *
try:
from .failed import *
except:
pass
from .feedback import *
15 changes: 7 additions & 8 deletions src/plugins/developer_tools/adopt_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

@current_application.handle()
async def _(event: Event):
if os.path.exists(TOOLS + "/application.json") == False:
if not os.path.exists(TOOLS + "/application.json"):
write(TOOLS + "/application.json", "[]")
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await current_application.finish(error(10))
current = json.loads(read(TOOLS + "/application.json"))
prefix = "当前有下列群聊可以处理:\n"
Expand All @@ -26,10 +26,10 @@ async def _(event: Event):

@process_application.handle()
async def _(bot: Bot, event: Event, args: Message = CommandArg()):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await process_application.finish(error(10))
args = args.extract_plain_text()
if checknumber(args) == False:
if not checknumber(args):
await process_application.finish("唔……同意申请的命令后面直接加群号即可哦~")
current = json.loads(read(TOOLS + "/application.json"))
for i in current:
Expand All @@ -48,10 +48,10 @@ async def _(bot: Bot, event: Event, args: Message = CommandArg()):


async def _(bot: Bot, event: Event, args: Message = CommandArg()):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await deny_application.finish(error(10))
args = args.extract_plain_text()
if checknumber(args) == False:
if not checknumber(args):
await deny_application.finish("唔……同意申请的命令后面直接加群号即可哦~")
current = json.loads(read(TOOLS + "/application.json"))
for i in current:
Expand All @@ -71,5 +71,4 @@ async def _(bot: Bot, event: Event, args: Message = CommandArg()):

@donate.handle()
async def _():
await donate.finish(
"感谢您对音卡的支持,点击下方链接可以支持音卡:\nhttps://inkar-suki.codethink.cn/Inkar-Suki-Docs/#/donate\n请注意:音卡**绝对不是**付费,赞助全自愿!!")
await donate.finish("感谢您对音卡的支持,点击下方链接可以支持音卡:\nhttps://inkar-suki.codethink.cn/Inkar-Suki-Docs/#/donate\n请注意:音卡**绝对不是**付费,赞助全自愿!!")
1 change: 0 additions & 1 deletion src/plugins/developer_tools/failed.py

This file was deleted.

31 changes: 31 additions & 0 deletions src/plugins/developer_tools/feedback.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from src.tools.basic import *

github_token = Config.ght

async def createIssue(uin: str, comment: str):
title = "【反馈】Inkar Suki · 使用反馈"
date = convert_time(getCurrentTime())
msg = f"日期:{date}\n用户:{uin}\n留言:{comment}"
url = f"https://api.github.com/repos/{Config.repo_name}/issues"
headers = {
"Authorization": f"token {github_token}",
"Accept": "application/vnd.github.v3+json"
}
data = {
"title": title,
"body": msg
}
response = await post_url(url, headers=headers, json=data)
return response

feedback_ = on_command("feedback", aliases={"反馈"}, priority=5)

@feedback_.handle()
async def _(event: Event, args: Message = CommandArg()):
msg = args.extract_plain_text()
user = str(event.user_id)
if len(msg) <= 8:
await feedback_.finish("唔……反馈至少需要8字以上,包括标点符号。")
else:
await createIssue(user, msg)
await feedback_.finish("已经将您的反馈内容提交至Inkar Suki GitHub,处理完毕后我们会通过电子邮件等方式通知您,音卡感谢您的反馈!")
1 change: 0 additions & 1 deletion src/plugins/developer_tools/info.json

This file was deleted.

14 changes: 7 additions & 7 deletions src/plugins/developer_tools/mgr_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@purge.handle()
async def ___(event: Event):
if checker(str(event.user_id), 1) == False:
if not checker(str(event.user_id), 1):
await purge.finish(error(1))
try:
for i in os.listdir(CACHE):
Expand All @@ -31,7 +31,7 @@ async def ___(event: Event):

@shutdown.handle()
async def ____(event: Event):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await shutdown.finish(error(10))
await shutdown.send("请稍候,正在关闭中……")
await shutdown.send("关闭成功!请联系Owner到后台手动开启哦~")
Expand All @@ -42,7 +42,7 @@ async def ____(event: Event):

@restart.handle()
async def _(event: Event):
if checker(str(event.user_id), 5) == False:
if not checker(str(event.user_id), 5):
await restart.finish(error(5))
with open("./src/plugins/developer_tools/example.py", mode="w") as cache:
await restart.send("好啦,开始重启,整个过程需要些许时间,还请等我一下哦~")
Expand All @@ -53,7 +53,7 @@ async def _(event: Event):

@echo.handle()
async def echo_(event: Event, args: Message = CommandArg()):
if checker(str(event.user_id), 9) == False:
if not checker(str(event.user_id), 9)
await echo.finish(error(9))
await echo.finish(args)

Expand Down Expand Up @@ -100,7 +100,7 @@ async def _(bot: Bot, event: Event, args: Message = CommandArg()):

@call_api.handle()
async def _(event: Event, args: Message = CommandArg()):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await call_api.finish(error(10))
cmd = args.extract_plain_text()
result = await get_url(f"{Config.cqhttp}{cmd}")
Expand All @@ -111,7 +111,7 @@ async def _(event: Event, args: Message = CommandArg()):

@git.handle()
async def _(event: Event, args: Message = CommandArg()):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await git.finish(error(10))
output = ""
commit = args.extract_plain_text()
Expand All @@ -134,7 +134,7 @@ async def _(event: Event, args: Message = CommandArg()):

@voice.handle()
async def _(bot: Bot, event: GroupMessageEvent, args: Message = CommandArg()):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await voice.finish(error(10))
sth = args.extract_plain_text()
final_msg = f"[CQ:tts,text={sth}]"
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/drifting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def _(bot: Bot, event: Event, args: Message = CommandArg()):

@lookup.handle()
async def _(event: Event, args: Message = CommandArg()):
if checker(str(event.user_id), 10) == False:
if not checker(str(event.user_id), 10):
await lookup.finish(error(10))
args = args.extract_plain_text()
if not checknumber(args):
Expand Down
1 change: 0 additions & 1 deletion src/plugins/event_notice/info.json

This file was deleted.

1 change: 0 additions & 1 deletion src/plugins/geography/info.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/plugins/github/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def _(bot: Bot, event: GroupMessageEvent, args: Message = CommandArg()):
personal_data = await bot.call_api("get_group_member_info", group_id=event.group_id, user_id=event.user_id, no_cache=True)
group_admin = personal_data["role"] in ["owner", "admin"]
if not group_admin:
if checker(str(event.user_id), 5) == False:
if not checker(str(event.user_id), 5):
await webhook.finish(error(5))
repo_name = args.extract_plain_text()
status_code = await get_status("https://github.com/" + repo_name)
Expand Down Expand Up @@ -87,7 +87,7 @@ async def _(bot: Bot, event: GroupMessageEvent, args: Message = CommandArg()):
personal_data = await bot.call_api("get_group_member_info", group_id=event.group_id, user_id=event.user_id, no_cache=True)
group_admin = personal_data["role"] in ["owner", "admin"]
if not group_admin:
if checker(str(event.user_id), 9) == False:
if not checker(str(event.user_id), 9)
await unbind.finish(error(9))
repo = args.extract_plain_text()
group = str(event.group_id)
Expand Down
1 change: 0 additions & 1 deletion src/plugins/github/info.json

This file was deleted.

8 changes: 0 additions & 8 deletions src/plugins/grab/info.json

This file was deleted.

1 change: 0 additions & 1 deletion src/plugins/help/info.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/plugins/jx3/achievement/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def achi_v2(server: str = None, name: str = None, achievement: str = None,
content = "\n".join(contents)
html = read(VIEWS + "/jx3/achievement/achievement.html")
font = ASSETS + "/font/custom.ttf"
saohua = await get_api(f"https://www.jx3api.com/data/saohua/random?token={token}")
saohua = await get_api(f"{Config.jx3api_link}/data/saohua/random")
saohua = saohua["data"]["text"]
html = html.replace("$customfont", font).replace("$tablecontent", content).replace(
"$randomsaohua", saohua).replace("$appinfo", f" · 成就百科 · {server} · {name} · {achievement}")
Expand Down Expand Up @@ -169,7 +169,7 @@ async def zone_achi(server: str = None, name: str = None, zone: str = None, mode
content = "\n".join(contents)
html = read(VIEWS + "/jx3/achievement/achievement.html")
font = ASSETS + "/font/custom.ttf"
saohua = await get_api(f"https://www.jx3api.com/data/saohua/random?token={token}")
saohua = await get_api(f"{Config.jx3api_link}/data/saohua/random")
saohua = saohua["data"]["text"]
html = html.replace("$customfont", font).replace("$tablecontent", content).replace(
"$randomsaohua", saohua).replace("$appinfo", f" · 成就百科 · {server} · {name} · {mode}{zone}")
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/jx3/announce/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from src.tools.basic import *

async def getAnnounce():
final_url = f"{Config.jx3api_link}/data/news/announce?robot={bot}&token={token}"
data = await get_api(final_url)
return data["data"]["url"]
2 changes: 1 addition & 1 deletion src/plugins/jx3/attributes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ async def get_attr_main(server, id, group_id):
if not server:
return [PROMPT_ServerNotExist]
uid = await get_uid(server, id)
if uid == False:
if not uid
return ["唔……未找到该玩家。"]
param = {
"zone": Zone_mapping(server),
Expand Down
18 changes: 18 additions & 0 deletions src/plugins/jx3/awesome/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from .api import *

cheater = on_command("jx3_cheater", aliases={"查人", "骗子"}, priority=5)

@cheater.handle()
async def _(event: GroupMessageEvent, args: Message = CommandArg()):
uin = args.extract_plain_text()
if not checknumber(uin):
await cheater.finish("唔……查人请给出纯数字的QQ号!")
if int(uin) > 9999999999 or int(uin) < 100000:
await cheater.finish("唔……该QQ号无效!")
data = await getAwesomeRecord(uin)
if not data:
await cheater.finish("查询完毕,没有发现贴吧有Ta的记录哦~")
else:
await cheater.send("查询完毕,已发现贴吧记录,正在生成图片……")
data = get_content_local(data)
await cheater.finish(ms.image(data))
Loading

0 comments on commit 844b211

Please sign in to comment.