Skip to content

Commit

Permalink
Downgrade nbnhhsh
Browse files Browse the repository at this point in the history
  • Loading branch information
DoroWolf committed Jan 15, 2025
1 parent 7204179 commit 4639ca9
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 253 deletions.
2 changes: 0 additions & 2 deletions modules/ask/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from .bugtracker import bugtracker_tool
from .ip_whois import ip_whois_tool
from .mcv import mcv_tool
from .meme import meme_tool
from .random import random_choice_tool, random_number_tool, random_uuid_tool
from .search import search_tool
from .self_knowledge import self_knowledge_tool
Expand All @@ -13,7 +12,6 @@
ip_whois_tool,
mcv_tool,
server_tool,
meme_tool,
random_choice_tool,
random_number_tool,
random_uuid_tool,
Expand Down
19 changes: 0 additions & 19 deletions modules/ask/tools/meme.py

This file was deleted.

32 changes: 0 additions & 32 deletions modules/meme/__init__.py

This file was deleted.

34 changes: 0 additions & 34 deletions modules/meme/jiki.py

This file was deleted.

13 changes: 0 additions & 13 deletions modules/meme/locales/en_us.json

This file was deleted.

13 changes: 0 additions & 13 deletions modules/meme/locales/zh_cn.json

This file was deleted.

13 changes: 0 additions & 13 deletions modules/meme/locales/zh_tw.json

This file was deleted.

50 changes: 0 additions & 50 deletions modules/meme/moegirl.py

This file was deleted.

35 changes: 0 additions & 35 deletions modules/meme/nbnhhsh.py

This file was deleted.

42 changes: 0 additions & 42 deletions modules/meme/urban.py

This file was deleted.

47 changes: 47 additions & 0 deletions modules/nbnhhsh/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import orjson as json

from core.builtins import Bot
from core.component import module
from core.dirty_check import check
from core.logger import Logger
from core.utils.http import post_url

n = module("nbnhhsh",
desc="{nbnhhsh.help.desc}",
doc=True,
developers=["Dianliang233"],
support_languages=["zh_cn"]
)


@n.command("<term> {{nbnhhsh.help}}")
async def _(msg: Bot.MessageSession, term: str):
res_nbnhhsh = await nbnhhsh(msg, term)
chk = await check(res_nbnhhsh)
res = f"{term.lower()}\n"
for i in chk:
res += i["content"]
await msg.finish(res.strip())


async def nbnhhsh(msg: Bot.MessageSession, term: str):
req = json.dumps({'text': term})
data = await post_url('https://lab.magiconch.com/api/nbnhhsh/guess',
data=req,
headers={'Content-Type': 'application/json', 'Accept': '*/*',
'Content-Length': str(len(req))},
fmt='json')
Logger.debug(data)
try:
result = data[0]
except IndexError:
await msg.finish(msg.locale.t("nbnhhsh.message.not_found"))
if 'trans' in result:
trans = result['trans']
return "、".join(trans)
if 'inputting' in result:
inputting = result['inputting']
if inputting:
return f'{msg.locale.t("nbnhhsh.message.guess", term=term)}{"、".join(inputting)}'
else:
await msg.finish(msg.locale.t("nbnhhsh.message.not_found"))
6 changes: 6 additions & 0 deletions modules/nbnhhsh/locales/zh_cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"nbnhhsh.help.desc": "能不能好好说话?拼音首字母缩写转义工具。",
"nbnhhsh.help": "输入含有首字母缩写的文字获取含义。",
"nbnhhsh.message.guess": "有可能是:",
"nbnhhsh.message.not_found": "没有匹配到拼音首字母缩写。"
}

0 comments on commit 4639ca9

Please sign in to comment.