summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ATRI/modules/google_translate/__init__.py (renamed from ATRIbot/plugins/Module/google_translate/__init__.py)22
-rw-r--r--ATRI/modules/response/__init__.py19
-rw-r--r--ATRI/modules/response/__pycache__/__init__.cpython-37.pycbin0 -> 531 bytes
-rw-r--r--ATRI/modules/response/__pycache__/__init__.cpython-38.pycbin0 -> 858 bytes
-rw-r--r--ATRI/plugins/__pycache__/anime_search.cpython-37.pycbin0 -> 18176 bytes
-rw-r--r--ATRI/plugins/__pycache__/anime_search.cpython-38.pycbin0 -> 18158 bytes
-rw-r--r--ATRI/plugins/__pycache__/bilibili.cpython-37.pycbin0 -> 2350 bytes
-rw-r--r--ATRI/plugins/__pycache__/bilibili.cpython-38.pycbin0 -> 2352 bytes
-rw-r--r--ATRI/plugins/__pycache__/cloudmusic.cpython-37.pycbin0 -> 2137 bytes
-rw-r--r--ATRI/plugins/__pycache__/cloudmusic.cpython-38.pycbin0 -> 2092 bytes
-rw-r--r--ATRI/plugins/__pycache__/hbook.cpython-38.pycbin0 -> 1191 bytes
-rw-r--r--ATRI/plugins/__pycache__/hitokoto.cpython-37.pycbin0 -> 1059 bytes
-rw-r--r--ATRI/plugins/__pycache__/hitokoto.cpython-38.pycbin0 -> 1073 bytes
-rw-r--r--ATRI/plugins/__pycache__/other.cpython-37.pycbin0 -> 1676 bytes
-rw-r--r--ATRI/plugins/__pycache__/other.cpython-38.pycbin0 -> 1754 bytes
-rw-r--r--ATRI/plugins/__pycache__/pixiv.cpython-37.pycbin0 -> 4622 bytes
-rw-r--r--ATRI/plugins/__pycache__/pixiv.cpython-38.pycbin0 -> 4369 bytes
-rw-r--r--ATRI/plugins/__pycache__/setu.cpython-37.pycbin0 -> 1216 bytes
-rw-r--r--ATRI/plugins/__pycache__/setu.cpython-38.pycbin0 -> 1237 bytes
-rw-r--r--ATRI/plugins/__pycache__/switch.cpython-37.pycbin0 -> 1460 bytes
-rw-r--r--ATRI/plugins/__pycache__/switch.cpython-38.pycbin0 -> 1456 bytes
-rw-r--r--ATRI/plugins/__pycache__/test.cpython-37.pycbin0 -> 1789 bytes
-rw-r--r--ATRI/plugins/__pycache__/welcome.cpython-37.pycbin0 -> 2693 bytes
-rw-r--r--ATRI/plugins/__pycache__/welcome.cpython-38.pycbin0 -> 2692 bytes
-rw-r--r--ATRI/plugins/anime_search.py (renamed from ATRIbot/plugins/anime_search_photo.py)75
-rw-r--r--ATRI/plugins/bilibili.py (renamed from ATRIbot/plugins/bilibili.py)13
-rw-r--r--ATRI/plugins/cloudmusic.py (renamed from ATRIbot/plugins/cloudmusic.py)14
-rw-r--r--ATRI/plugins/hbook.py56
-rw-r--r--ATRI/plugins/hitokoto.py33
-rw-r--r--ATRI/plugins/other.py95
-rw-r--r--ATRI/plugins/pixiv.py174
-rw-r--r--ATRI/plugins/send.py (renamed from ATRIbot/plugins/send.py)59
-rw-r--r--ATRI/plugins/setu.py49
-rw-r--r--ATRI/plugins/switch.py79
-rw-r--r--ATRI/plugins/switch/switch.json1
-rw-r--r--ATRI/plugins/welcome.py88
-rw-r--r--ATRIbot/config.py77
-rw-r--r--ATRIbot/plugins/Module/google_translate/__pycache__/__init__.cpython-37.pycbin3205 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/anime_search_in_photo.cpython-37.pycbin18059 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/anime_search_photo.cpython-37.pycbin18073 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/chat.cpython-37.pycbin2726 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/covid19.cpython-37.pycbin2291 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/hbook.cpython-37.pycbin2463 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/hitokoto.cpython-37.pycbin1411 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/other.cpython-37.pycbin2498 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/pixiv.cpython-37.pycbin1473 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/pixiv_seach_photo.cpython-37.pycbin994 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/r6invalid.cpython-37.pycbin1371 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/setu.cpython-37.pycbin3596 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/translate.cpython-37.pycbin1795 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/weather.cpython-37.pycbin6252 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/welcome.cpython-37.pycbin2253 -> 0 bytes
-rw-r--r--ATRIbot/plugins/__pycache__/ytu.cpython-37.pycbin1557 -> 0 bytes
-rw-r--r--ATRIbot/plugins/chat.py109
-rw-r--r--ATRIbot/plugins/covid19.py78
-rw-r--r--ATRIbot/plugins/hitokoto.py30
-rw-r--r--ATRIbot/plugins/mojang.py59
-rw-r--r--ATRIbot/plugins/other.py28
-rw-r--r--ATRIbot/plugins/pixiv.py73
-rw-r--r--ATRIbot/plugins/setu.py125
-rw-r--r--ATRIbot/plugins/weather.py216
-rw-r--r--ATRIbot/plugins/welcome.py89
-rw-r--r--config.py111
-rw-r--r--requirements.txt10
-rw-r--r--run.py27
65 files changed, 852 insertions, 957 deletions
diff --git a/ATRIbot/plugins/Module/google_translate/__init__.py b/ATRI/modules/google_translate/__init__.py
index b1d0c43..ef0428a 100644
--- a/ATRIbot/plugins/Module/google_translate/__init__.py
+++ b/ATRI/modules/google_translate/__init__.py
@@ -52,6 +52,28 @@ def mr(q, TKK):
return (str(a) + "." + str(a ^ b))
+"""
+def Sr(a, TKK):
+ a = ''.join(a['a']['b']['q'])
+ return mr(a, TKK)
+d = {
+ 'a':{
+ 'a': ['q'],
+ 'b': {
+ 'q': ['me']
+ },
+ 'c': 1,
+ 'g': 1
+ },
+ 'b': 1,
+ 'c': None,
+ 'j': False,
+}
+TKK = '426151.3141811846'
+tk = Sr(d, TKK)
+print(tk)
+"""
+
session = requests.session()
diff --git a/ATRI/modules/response/__init__.py b/ATRI/modules/response/__init__.py
new file mode 100644
index 0000000..4a47140
--- /dev/null
+++ b/ATRI/modules/response/__init__.py
@@ -0,0 +1,19 @@
+# -*- coding:utf-8 -*-
+import requests
+from aiohttp import ClientSession
+
+def request_api(url):
+ response = requests.request("GET", url)
+ html = response.text
+ return html
+
+def request_api_params(url, params):
+ response = requests.get(url, params = params)
+ html = response.text
+ return html
+
+async def post_bytes(url, headers=None,data=None):
+ async with ClientSession() as asyncsession:
+ async with asyncsession.post(url,headers=headers,data=data) as response:
+ b = await response.read()
+ return b \ No newline at end of file
diff --git a/ATRI/modules/response/__pycache__/__init__.cpython-37.pyc b/ATRI/modules/response/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000..c5598a0
--- /dev/null
+++ b/ATRI/modules/response/__pycache__/__init__.cpython-37.pyc
Binary files differ
diff --git a/ATRI/modules/response/__pycache__/__init__.cpython-38.pyc b/ATRI/modules/response/__pycache__/__init__.cpython-38.pyc
new file mode 100644
index 0000000..692ea38
--- /dev/null
+++ b/ATRI/modules/response/__pycache__/__init__.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/anime_search.cpython-37.pyc b/ATRI/plugins/__pycache__/anime_search.cpython-37.pyc
new file mode 100644
index 0000000..c7c40bc
--- /dev/null
+++ b/ATRI/plugins/__pycache__/anime_search.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/anime_search.cpython-38.pyc b/ATRI/plugins/__pycache__/anime_search.cpython-38.pyc
new file mode 100644
index 0000000..0c46a36
--- /dev/null
+++ b/ATRI/plugins/__pycache__/anime_search.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/bilibili.cpython-37.pyc b/ATRI/plugins/__pycache__/bilibili.cpython-37.pyc
new file mode 100644
index 0000000..8e47f80
--- /dev/null
+++ b/ATRI/plugins/__pycache__/bilibili.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/bilibili.cpython-38.pyc b/ATRI/plugins/__pycache__/bilibili.cpython-38.pyc
new file mode 100644
index 0000000..92adcfc
--- /dev/null
+++ b/ATRI/plugins/__pycache__/bilibili.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/cloudmusic.cpython-37.pyc b/ATRI/plugins/__pycache__/cloudmusic.cpython-37.pyc
new file mode 100644
index 0000000..d9be200
--- /dev/null
+++ b/ATRI/plugins/__pycache__/cloudmusic.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/cloudmusic.cpython-38.pyc b/ATRI/plugins/__pycache__/cloudmusic.cpython-38.pyc
new file mode 100644
index 0000000..ec145a4
--- /dev/null
+++ b/ATRI/plugins/__pycache__/cloudmusic.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/hbook.cpython-38.pyc b/ATRI/plugins/__pycache__/hbook.cpython-38.pyc
new file mode 100644
index 0000000..ec17b05
--- /dev/null
+++ b/ATRI/plugins/__pycache__/hbook.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/hitokoto.cpython-37.pyc b/ATRI/plugins/__pycache__/hitokoto.cpython-37.pyc
new file mode 100644
index 0000000..64721e3
--- /dev/null
+++ b/ATRI/plugins/__pycache__/hitokoto.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/hitokoto.cpython-38.pyc b/ATRI/plugins/__pycache__/hitokoto.cpython-38.pyc
new file mode 100644
index 0000000..38d950b
--- /dev/null
+++ b/ATRI/plugins/__pycache__/hitokoto.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/other.cpython-37.pyc b/ATRI/plugins/__pycache__/other.cpython-37.pyc
new file mode 100644
index 0000000..3395bcb
--- /dev/null
+++ b/ATRI/plugins/__pycache__/other.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/other.cpython-38.pyc b/ATRI/plugins/__pycache__/other.cpython-38.pyc
new file mode 100644
index 0000000..65d379a
--- /dev/null
+++ b/ATRI/plugins/__pycache__/other.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/pixiv.cpython-37.pyc b/ATRI/plugins/__pycache__/pixiv.cpython-37.pyc
new file mode 100644
index 0000000..636e8ba
--- /dev/null
+++ b/ATRI/plugins/__pycache__/pixiv.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/pixiv.cpython-38.pyc b/ATRI/plugins/__pycache__/pixiv.cpython-38.pyc
new file mode 100644
index 0000000..697407e
--- /dev/null
+++ b/ATRI/plugins/__pycache__/pixiv.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/setu.cpython-37.pyc b/ATRI/plugins/__pycache__/setu.cpython-37.pyc
new file mode 100644
index 0000000..2cd406d
--- /dev/null
+++ b/ATRI/plugins/__pycache__/setu.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/setu.cpython-38.pyc b/ATRI/plugins/__pycache__/setu.cpython-38.pyc
new file mode 100644
index 0000000..3231cd6
--- /dev/null
+++ b/ATRI/plugins/__pycache__/setu.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/switch.cpython-37.pyc b/ATRI/plugins/__pycache__/switch.cpython-37.pyc
new file mode 100644
index 0000000..3ed1f40
--- /dev/null
+++ b/ATRI/plugins/__pycache__/switch.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/switch.cpython-38.pyc b/ATRI/plugins/__pycache__/switch.cpython-38.pyc
new file mode 100644
index 0000000..d08619c
--- /dev/null
+++ b/ATRI/plugins/__pycache__/switch.cpython-38.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/test.cpython-37.pyc b/ATRI/plugins/__pycache__/test.cpython-37.pyc
new file mode 100644
index 0000000..f0040dc
--- /dev/null
+++ b/ATRI/plugins/__pycache__/test.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/welcome.cpython-37.pyc b/ATRI/plugins/__pycache__/welcome.cpython-37.pyc
new file mode 100644
index 0000000..9877bbc
--- /dev/null
+++ b/ATRI/plugins/__pycache__/welcome.cpython-37.pyc
Binary files differ
diff --git a/ATRI/plugins/__pycache__/welcome.cpython-38.pyc b/ATRI/plugins/__pycache__/welcome.cpython-38.pyc
new file mode 100644
index 0000000..4bd27aa
--- /dev/null
+++ b/ATRI/plugins/__pycache__/welcome.cpython-38.pyc
Binary files differ
diff --git a/ATRIbot/plugins/anime_search_photo.py b/ATRI/plugins/anime_search.py
index f26a1aa..edbdc91 100644
--- a/ATRIbot/plugins/anime_search_photo.py
+++ b/ATRI/plugins/anime_search.py
@@ -4,78 +4,109 @@ import json
from aiohttp import ClientSession
from nonebot import on_command, CommandSession
-#FROM Joenothing-lst
-async def get_bytes(url, headers=None):
- async with ClientSession() as asyncsession:
- async with asyncsession.get(url,headers=headers) as response:
- b = await response.read()
- return b
+async def get_bytes(url, headers = None):
+ async with ClientSession() as asyncSession:
+ async with asyncSession.get(url, headers = headers) as response:
+ a = await response.read()
+ return a
SIMPLE = "万与丑专业丛东丝丢两严丧个丬丰临为丽举么义乌乐乔习乡书买乱争于亏云亘亚产亩亲亵亸亿仅从仑仓仪们价众优伙会伛伞伟传伤伥伦伧伪伫体余佣佥侠侣侥侦侧侨侩侪侬俣俦俨俩俪俭债倾偬偻偾偿傥傧储傩儿兑兖党兰关兴兹养兽冁内冈册写军农冢冯冲决况冻净凄凉凌减凑凛几凤凫凭凯击凼凿刍划刘则刚创删别刬刭刽刿剀剂剐剑剥剧劝办务劢动励劲劳势勋勐勚匀匦匮区医华协单卖卢卤卧卫却卺厂厅历厉压厌厍厕厢厣厦厨厩厮县参叆叇双发变叙叠叶号叹叽吁后吓吕吗吣吨听启吴呒呓呕呖呗员呙呛呜咏咔咙咛咝咤咴咸哌响哑哒哓哔哕哗哙哜哝哟唛唝唠唡唢唣唤唿啧啬啭啮啰啴啸喷喽喾嗫呵嗳嘘嘤嘱噜噼嚣嚯团园囱围囵国图圆圣圹场坂坏块坚坛坜坝坞坟坠垄垅垆垒垦垧垩垫垭垯垱垲垴埘埙埚埝埯堑堕塆墙壮声壳壶壸处备复够头夸夹夺奁奂奋奖奥妆妇妈妩妪妫姗姜娄娅娆娇娈娱娲娴婳婴婵婶媪嫒嫔嫱嬷孙学孪宁宝实宠审宪宫宽宾寝对寻导寿将尔尘尧尴尸尽层屃屉届属屡屦屿岁岂岖岗岘岙岚岛岭岳岽岿峃峄峡峣峤峥峦崂崃崄崭嵘嵚嵛嵝嵴巅巩巯币帅师帏帐帘帜带帧帮帱帻帼幂幞干并广庄庆庐庑库应庙庞废庼廪开异弃张弥弪弯弹强归当录彟彦彻径徕御忆忏忧忾怀态怂怃怄怅怆怜总怼怿恋恳恶恸恹恺恻恼恽悦悫悬悭悯惊惧惨惩惫惬惭惮惯愍愠愤愦愿慑慭憷懑懒懔戆戋戏戗战戬户扎扑扦执扩扪扫扬扰抚抛抟抠抡抢护报担拟拢拣拥拦拧拨择挂挚挛挜挝挞挟挠挡挢挣挤挥挦捞损捡换捣据捻掳掴掷掸掺掼揸揽揿搀搁搂搅携摄摅摆摇摈摊撄撑撵撷撸撺擞攒敌敛数斋斓斗斩断无旧时旷旸昙昼昽显晋晒晓晔晕晖暂暧札术朴机杀杂权条来杨杩杰极构枞枢枣枥枧枨枪枫枭柜柠柽栀栅标栈栉栊栋栌栎栏树栖样栾桊桠桡桢档桤桥桦桧桨桩梦梼梾检棂椁椟椠椤椭楼榄榇榈榉槚槛槟槠横樯樱橥橱橹橼檐檩欢欤欧歼殁殇残殒殓殚殡殴毁毂毕毙毡毵氇气氢氩氲汇汉污汤汹沓沟没沣沤沥沦沧沨沩沪沵泞泪泶泷泸泺泻泼泽泾洁洒洼浃浅浆浇浈浉浊测浍济浏浐浑浒浓浔浕涂涌涛涝涞涟涠涡涢涣涤润涧涨涩淀渊渌渍渎渐渑渔渖渗温游湾湿溃溅溆溇滗滚滞滟滠满滢滤滥滦滨滩滪漤潆潇潋潍潜潴澜濑濒灏灭灯灵灾灿炀炉炖炜炝点炼炽烁烂烃烛烟烦烧烨烩烫烬热焕焖焘煅煳熘爱爷牍牦牵牺犊犟状犷犸犹狈狍狝狞独狭狮狯狰狱狲猃猎猕猡猪猫猬献獭玑玙玚玛玮环现玱玺珉珏珐珑珰珲琎琏琐琼瑶瑷璇璎瓒瓮瓯电画畅畲畴疖疗疟疠疡疬疮疯疱疴痈痉痒痖痨痪痫痴瘅瘆瘗瘘瘪瘫瘾瘿癞癣癫癯皑皱皲盏盐监盖盗盘眍眦眬着睁睐睑瞒瞩矫矶矾矿砀码砖砗砚砜砺砻砾础硁硅硕硖硗硙硚确硷碍碛碜碱碹磙礼祎祢祯祷祸禀禄禅离秃秆种积称秽秾稆税稣稳穑穷窃窍窑窜窝窥窦窭竖竞笃笋笔笕笺笼笾筑筚筛筜筝筹签简箓箦箧箨箩箪箫篑篓篮篱簖籁籴类籼粜粝粤粪粮糁糇紧絷纟纠纡红纣纤纥约级纨纩纪纫纬纭纮纯纰纱纲纳纴纵纶纷纸纹纺纻纼纽纾线绀绁绂练组绅细织终绉绊绋绌绍绎经绐绑绒结绔绕绖绗绘给绚绛络绝绞统绠绡绢绣绤绥绦继绨绩绪绫绬续绮绯绰绱绲绳维绵绶绷绸绹绺绻综绽绾绿缀缁缂缃缄缅缆缇缈缉缊缋缌缍缎缏缐缑缒缓缔缕编缗缘缙缚缛缜缝缞缟缠缡缢缣缤缥缦缧缨缩缪缫缬缭缮缯缰缱缲缳缴缵罂网罗罚罢罴羁羟羡翘翙翚耢耧耸耻聂聋职聍联聩聪肃肠肤肷肾肿胀胁胆胜胧胨胪胫胶脉脍脏脐脑脓脔脚脱脶脸腊腌腘腭腻腼腽腾膑臜舆舣舰舱舻艰艳艹艺节芈芗芜芦苁苇苈苋苌苍苎苏苘苹茎茏茑茔茕茧荆荐荙荚荛荜荞荟荠荡荣荤荥荦荧荨荩荪荫荬荭荮药莅莜莱莲莳莴莶获莸莹莺莼萚萝萤营萦萧萨葱蒇蒉蒋蒌蓝蓟蓠蓣蓥蓦蔷蔹蔺蔼蕲蕴薮藁藓虏虑虚虫虬虮虽虾虿蚀蚁蚂蚕蚝蚬蛊蛎蛏蛮蛰蛱蛲蛳蛴蜕蜗蜡蝇蝈蝉蝎蝼蝾螀螨蟏衅衔补衬衮袄袅袆袜袭袯装裆裈裢裣裤裥褛褴襁襕见观觃规觅视觇览觉觊觋觌觍觎觏觐觑觞触觯詟誉誊讠计订讣认讥讦讧讨让讪讫训议讯记讱讲讳讴讵讶讷许讹论讻讼讽设访诀证诂诃评诅识诇诈诉诊诋诌词诎诏诐译诒诓诔试诖诗诘诙诚诛诜话诞诟诠诡询诣诤该详诧诨诩诪诫诬语诮误诰诱诲诳说诵诶请诸诹诺读诼诽课诿谀谁谂调谄谅谆谇谈谊谋谌谍谎谏谐谑谒谓谔谕谖谗谘谙谚谛谜谝谞谟谠谡谢谣谤谥谦谧谨谩谪谫谬谭谮谯谰谱谲谳谴谵谶谷豮贝贞负贠贡财责贤败账货质贩贪贫贬购贮贯贰贱贲贳贴贵贶贷贸费贺贻贼贽贾贿赀赁赂赃资赅赆赇赈赉赊赋赌赍赎赏赐赑赒赓赔赕赖赗赘赙赚赛赜赝赞赟赠赡赢赣赪赵赶趋趱趸跃跄跖跞践跶跷跸跹跻踊踌踪踬踯蹑蹒蹰蹿躏躜躯车轧轨轩轪轫转轭轮软轰轱轲轳轴轵轶轷轸轹轺轻轼载轾轿辀辁辂较辄辅辆辇辈辉辊辋辌辍辎辏辐辑辒输辔辕辖辗辘辙辚辞辩辫边辽达迁过迈运还这进远违连迟迩迳迹适选逊递逦逻遗遥邓邝邬邮邹邺邻郁郄郏郐郑郓郦郧郸酝酦酱酽酾酿释里鉅鉴銮錾钆钇针钉钊钋钌钍钎钏钐钑钒钓钔钕钖钗钘钙钚钛钝钞钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀铁铂铃铄铅铆铈铉铊铋铍铎铏铐铑铒铕铗铘铙铚铛铜铝铞铟铠铡铢铣铤铥铦铧铨铪铫铬铭铮铯铰铱铲铳铴铵银铷铸铹铺铻铼铽链铿销锁锂锃锄锅锆锇锈锉锊锋锌锍锎锏锐锑锒锓锔锕锖锗错锚锜锞锟锠锡锢锣锤锥锦锨锩锫锬锭键锯锰锱锲锳锴锵锶锷锸锹锺锻锼锽锾锿镀镁镂镃镆镇镈镉镊镌镍镎镏镐镑镒镕镖镗镙镚镛镜镝镞镟镠镡镢镣镤镥镦镧镨镩镪镫镬镭镮镯镰镱镲镳镴镶长门闩闪闫闬闭问闯闰闱闲闳间闵闶闷闸闹闺闻闼闽闾闿阀阁阂阃阄阅阆阇阈阉阊阋阌阍阎阏阐阑阒阓阔阕阖阗阘阙阚阛队阳阴阵阶际陆陇陈陉陕陧陨险随隐隶隽难雏雠雳雾霁霉霭靓静靥鞑鞒鞯鞴韦韧韨韩韪韫韬韵页顶顷顸项顺须顼顽顾顿颀颁颂颃预颅领颇颈颉颊颋颌颍颎颏颐频颒颓颔颕颖颗题颙颚颛颜额颞颟颠颡颢颣颤颥颦颧风飏飐飑飒飓飔飕飖飗飘飙飚飞飨餍饤饥饦饧饨饩饪饫饬饭饮饯饰饱饲饳饴饵饶饷饸饹饺饻饼饽饾饿馀馁馂馃馄馅馆馇馈馉馊馋馌馍馎馏馐馑馒馓馔馕马驭驮驯驰驱驲驳驴驵驶驷驸驹驺驻驼驽驾驿骀骁骂骃骄骅骆骇骈骉骊骋验骍骎骏骐骑骒骓骔骕骖骗骘骙骚骛骜骝骞骟骠骡骢骣骤骥骦骧髅髋髌鬓魇魉鱼鱽鱾鱿鲀鲁鲂鲄鲅鲆鲇鲈鲉鲊鲋鲌鲍鲎鲏鲐鲑鲒鲓鲔鲕鲖鲗鲘鲙鲚鲛鲜鲝鲞鲟鲠鲡鲢鲣鲤鲥鲦鲧鲨鲩鲪鲫鲬鲭鲮鲯鲰鲱鲲鲳鲴鲵鲶鲷鲸鲹鲺鲻鲼鲽鲾鲿鳀鳁鳂鳃鳄鳅鳆鳇鳈鳉鳊鳋鳌鳍鳎鳏鳐鳑鳒鳓鳔鳕鳖鳗鳘鳙鳛鳜鳝鳞鳟鳠鳡鳢鳣鸟鸠鸡鸢鸣鸤鸥鸦鸧鸨鸩鸪鸫鸬鸭鸮鸯鸰鸱鸲鸳鸴鸵鸶鸷鸸鸹鸺鸻鸼鸽鸾鸿鹀鹁鹂鹃鹄鹅鹆鹇鹈鹉鹊鹋鹌鹍鹎鹏鹐鹑鹒鹓鹔鹕鹖鹗鹘鹚鹛鹜鹝鹞鹟鹠鹡鹢鹣鹤鹥鹦鹧鹨鹩鹪鹫鹬鹭鹯鹰鹱鹲鹳鹴鹾麦麸黄黉黡黩黪黾鼋鼌鼍鼗鼹齄齐齑齿龀龁龂龃龄龅龆龇龈龉龊龋龌龙龚龛龟志制咨只里系范松没尝尝闹面准钟别闲干尽脏拼"
TRADITION = "萬與醜專業叢東絲丟兩嚴喪個爿豐臨為麗舉麼義烏樂喬習鄉書買亂爭於虧雲亙亞產畝親褻嚲億僅從侖倉儀們價眾優夥會傴傘偉傳傷倀倫傖偽佇體餘傭僉俠侶僥偵側僑儈儕儂俁儔儼倆儷儉債傾傯僂僨償儻儐儲儺兒兌兗黨蘭關興茲養獸囅內岡冊寫軍農塚馮衝決況凍淨淒涼淩減湊凜幾鳳鳧憑凱擊氹鑿芻劃劉則剛創刪別剗剄劊劌剴劑剮劍剝劇勸辦務勱動勵勁勞勢勳猛勩勻匭匱區醫華協單賣盧鹵臥衛卻巹廠廳曆厲壓厭厙廁廂厴廈廚廄廝縣參靉靆雙發變敘疊葉號歎嘰籲後嚇呂嗎唚噸聽啟吳嘸囈嘔嚦唄員咼嗆嗚詠哢嚨嚀噝吒噅鹹呱響啞噠嘵嗶噦嘩噲嚌噥喲嘜嗊嘮啢嗩唕喚呼嘖嗇囀齧囉嘽嘯噴嘍嚳囁嗬噯噓嚶囑嚕劈囂謔團園囪圍圇國圖圓聖壙場阪壞塊堅壇壢壩塢墳墜壟壟壚壘墾坰堊墊埡墶壋塏堖塒塤堝墊垵塹墮壪牆壯聲殼壺壼處備復夠頭誇夾奪奩奐奮獎奧妝婦媽嫵嫗媯姍薑婁婭嬈嬌孌娛媧嫻嫿嬰嬋嬸媼嬡嬪嬙嬤孫學孿寧寶實寵審憲宮寬賓寢對尋導壽將爾塵堯尷屍盡層屭屜屆屬屢屨嶼歲豈嶇崗峴嶴嵐島嶺嶽崠巋嶨嶧峽嶢嶠崢巒嶗崍嶮嶄嶸嶔崳嶁脊巔鞏巰幣帥師幃帳簾幟帶幀幫幬幘幗冪襆幹並廣莊慶廬廡庫應廟龐廢廎廩開異棄張彌弳彎彈強歸當錄彠彥徹徑徠禦憶懺憂愾懷態慫憮慪悵愴憐總懟懌戀懇惡慟懨愷惻惱惲悅愨懸慳憫驚懼慘懲憊愜慚憚慣湣慍憤憒願懾憖怵懣懶懍戇戔戲戧戰戩戶紮撲扡執擴捫掃揚擾撫拋摶摳掄搶護報擔擬攏揀擁攔擰撥擇掛摯攣掗撾撻挾撓擋撟掙擠揮撏撈損撿換搗據撚擄摑擲撣摻摜摣攬撳攙擱摟攪攜攝攄擺搖擯攤攖撐攆擷擼攛擻攢敵斂數齋斕鬥斬斷無舊時曠暘曇晝曨顯晉曬曉曄暈暉暫曖劄術樸機殺雜權條來楊榪傑極構樅樞棗櫪梘棖槍楓梟櫃檸檉梔柵標棧櫛櫳棟櫨櫟欄樹棲樣欒棬椏橈楨檔榿橋樺檜槳樁夢檮棶檢欞槨櫝槧欏橢樓欖櫬櫚櫸檟檻檳櫧橫檣櫻櫫櫥櫓櫞簷檁歡歟歐殲歿殤殘殞殮殫殯毆毀轂畢斃氈毿氌氣氫氬氳彙漢汙湯洶遝溝沒灃漚瀝淪滄渢溈滬濔濘淚澩瀧瀘濼瀉潑澤涇潔灑窪浹淺漿澆湞溮濁測澮濟瀏滻渾滸濃潯濜塗湧濤澇淶漣潿渦溳渙滌潤澗漲澀澱淵淥漬瀆漸澠漁瀋滲溫遊灣濕潰濺漵漊潷滾滯灩灄滿瀅濾濫灤濱灘澦濫瀠瀟瀲濰潛瀦瀾瀨瀕灝滅燈靈災燦煬爐燉煒熗點煉熾爍爛烴燭煙煩燒燁燴燙燼熱煥燜燾煆糊溜愛爺牘犛牽犧犢強狀獷獁猶狽麅獮獰獨狹獅獪猙獄猻獫獵獼玀豬貓蝟獻獺璣璵瑒瑪瑋環現瑲璽瑉玨琺瓏璫琿璡璉瑣瓊瑤璦璿瓔瓚甕甌電畫暢佘疇癤療瘧癘瘍鬁瘡瘋皰屙癰痙癢瘂癆瘓癇癡癉瘮瘞瘺癟癱癮癭癩癬癲臒皚皺皸盞鹽監蓋盜盤瞘眥矓著睜睞瞼瞞矚矯磯礬礦碭碼磚硨硯碸礪礱礫礎硜矽碩硤磽磑礄確鹼礙磧磣堿镟滾禮禕禰禎禱禍稟祿禪離禿稈種積稱穢穠穭稅穌穩穡窮竊竅窯竄窩窺竇窶豎競篤筍筆筧箋籠籩築篳篩簹箏籌簽簡籙簀篋籜籮簞簫簣簍籃籬籪籟糴類秈糶糲粵糞糧糝餱緊縶糸糾紆紅紂纖紇約級紈纊紀紉緯紜紘純紕紗綱納紝縱綸紛紙紋紡紵紖紐紓線紺絏紱練組紳細織終縐絆紼絀紹繹經紿綁絨結絝繞絰絎繪給絢絳絡絕絞統綆綃絹繡綌綏絛繼綈績緒綾緓續綺緋綽緔緄繩維綿綬繃綢綯綹綣綜綻綰綠綴緇緙緗緘緬纜緹緲緝縕繢緦綞緞緶線緱縋緩締縷編緡緣縉縛縟縝縫縗縞纏縭縊縑繽縹縵縲纓縮繆繅纈繚繕繒韁繾繰繯繳纘罌網羅罰罷羆羈羥羨翹翽翬耮耬聳恥聶聾職聹聯聵聰肅腸膚膁腎腫脹脅膽勝朧腖臚脛膠脈膾髒臍腦膿臠腳脫腡臉臘醃膕齶膩靦膃騰臏臢輿艤艦艙艫艱豔艸藝節羋薌蕪蘆蓯葦藶莧萇蒼苧蘇檾蘋莖蘢蔦塋煢繭荊薦薘莢蕘蓽蕎薈薺蕩榮葷滎犖熒蕁藎蓀蔭蕒葒葤藥蒞蓧萊蓮蒔萵薟獲蕕瑩鶯蓴蘀蘿螢營縈蕭薩蔥蕆蕢蔣蔞藍薊蘺蕷鎣驀薔蘞藺藹蘄蘊藪槁蘚虜慮虛蟲虯蟣雖蝦蠆蝕蟻螞蠶蠔蜆蠱蠣蟶蠻蟄蛺蟯螄蠐蛻蝸蠟蠅蟈蟬蠍螻蠑螿蟎蠨釁銜補襯袞襖嫋褘襪襲襏裝襠褌褳襝褲襇褸襤繈襴見觀覎規覓視覘覽覺覬覡覿覥覦覯覲覷觴觸觶讋譽謄訁計訂訃認譏訐訌討讓訕訖訓議訊記訒講諱謳詎訝訥許訛論訩訟諷設訪訣證詁訶評詛識詗詐訴診詆謅詞詘詔詖譯詒誆誄試詿詩詰詼誠誅詵話誕詬詮詭詢詣諍該詳詫諢詡譸誡誣語誚誤誥誘誨誑說誦誒請諸諏諾讀諑誹課諉諛誰諗調諂諒諄誶談誼謀諶諜謊諫諧謔謁謂諤諭諼讒諮諳諺諦謎諞諝謨讜謖謝謠謗諡謙謐謹謾謫譾謬譚譖譙讕譜譎讞譴譫讖穀豶貝貞負貟貢財責賢敗賬貨質販貪貧貶購貯貫貳賤賁貰貼貴貺貸貿費賀貽賊贄賈賄貲賃賂贓資賅贐賕賑賚賒賦賭齎贖賞賜贔賙賡賠賧賴賵贅賻賺賽賾贗讚贇贈贍贏贛赬趙趕趨趲躉躍蹌蹠躒踐躂蹺蹕躚躋踴躊蹤躓躑躡蹣躕躥躪躦軀車軋軌軒軑軔轉軛輪軟轟軲軻轤軸軹軼軤軫轢軺輕軾載輊轎輈輇輅較輒輔輛輦輩輝輥輞輬輟輜輳輻輯轀輸轡轅轄輾轆轍轔辭辯辮邊遼達遷過邁運還這進遠違連遲邇逕跡適選遜遞邐邏遺遙鄧鄺鄔郵鄒鄴鄰鬱郤郟鄶鄭鄆酈鄖鄲醞醱醬釅釃釀釋裏钜鑒鑾鏨釓釔針釘釗釙釕釷釺釧釤鈒釩釣鍆釹鍚釵鈃鈣鈈鈦鈍鈔鍾鈉鋇鋼鈑鈐鑰欽鈞鎢鉤鈧鈁鈥鈄鈕鈀鈺錢鉦鉗鈷缽鈳鉕鈽鈸鉞鑽鉬鉭鉀鈿鈾鐵鉑鈴鑠鉛鉚鈰鉉鉈鉍鈹鐸鉶銬銠鉺銪鋏鋣鐃銍鐺銅鋁銱銦鎧鍘銖銑鋌銩銛鏵銓鉿銚鉻銘錚銫鉸銥鏟銃鐋銨銀銣鑄鐒鋪鋙錸鋱鏈鏗銷鎖鋰鋥鋤鍋鋯鋨鏽銼鋝鋒鋅鋶鐦鐧銳銻鋃鋟鋦錒錆鍺錯錨錡錁錕錩錫錮鑼錘錐錦鍁錈錇錟錠鍵鋸錳錙鍥鍈鍇鏘鍶鍔鍤鍬鍾鍛鎪鍠鍰鎄鍍鎂鏤鎡鏌鎮鎛鎘鑷鐫鎳鎿鎦鎬鎊鎰鎔鏢鏜鏍鏰鏞鏡鏑鏃鏇鏐鐔钁鐐鏷鑥鐓鑭鐠鑹鏹鐙鑊鐳鐶鐲鐮鐿鑔鑣鑞鑲長門閂閃閆閈閉問闖閏闈閑閎間閔閌悶閘鬧閨聞闥閩閭闓閥閣閡閫鬮閱閬闍閾閹閶鬩閿閽閻閼闡闌闃闠闊闋闔闐闒闕闞闤隊陽陰陣階際陸隴陳陘陝隉隕險隨隱隸雋難雛讎靂霧霽黴靄靚靜靨韃鞽韉韝韋韌韍韓韙韞韜韻頁頂頃頇項順須頊頑顧頓頎頒頌頏預顱領頗頸頡頰頲頜潁熲頦頤頻頮頹頷頴穎顆題顒顎顓顏額顳顢顛顙顥纇顫顬顰顴風颺颭颮颯颶颸颼颻飀飄飆飆飛饗饜飣饑飥餳飩餼飪飫飭飯飲餞飾飽飼飿飴餌饒餉餄餎餃餏餅餑餖餓餘餒餕餜餛餡館餷饋餶餿饞饁饃餺餾饈饉饅饊饌饢馬馭馱馴馳驅馹駁驢駔駛駟駙駒騶駐駝駑駕驛駘驍罵駰驕驊駱駭駢驫驪騁驗騂駸駿騏騎騍騅騌驌驂騙騭騤騷騖驁騮騫騸驃騾驄驏驟驥驦驤髏髖髕鬢魘魎魚魛魢魷魨魯魴魺鮁鮃鯰鱸鮋鮓鮒鮊鮑鱟鮍鮐鮭鮚鮳鮪鮞鮦鰂鮜鱠鱭鮫鮮鮺鯗鱘鯁鱺鰱鰹鯉鰣鰷鯀鯊鯇鮶鯽鯒鯖鯪鯕鯫鯡鯤鯧鯝鯢鯰鯛鯨鯵鯴鯔鱝鰈鰏鱨鯷鰮鰃鰓鱷鰍鰒鰉鰁鱂鯿鰠鼇鰭鰨鰥鰩鰟鰜鰳鰾鱈鱉鰻鰵鱅鰼鱖鱔鱗鱒鱯鱤鱧鱣鳥鳩雞鳶鳴鳲鷗鴉鶬鴇鴆鴣鶇鸕鴨鴞鴦鴒鴟鴝鴛鴬鴕鷥鷙鴯鴰鵂鴴鵃鴿鸞鴻鵐鵓鸝鵑鵠鵝鵒鷳鵜鵡鵲鶓鵪鶤鵯鵬鵮鶉鶊鵷鷫鶘鶡鶚鶻鶿鶥鶩鷊鷂鶲鶹鶺鷁鶼鶴鷖鸚鷓鷚鷯鷦鷲鷸鷺鸇鷹鸌鸏鸛鸘鹺麥麩黃黌黶黷黲黽黿鼂鼉鞀鼴齇齊齏齒齔齕齗齟齡齙齠齜齦齬齪齲齷龍龔龕龜誌製谘隻裡係範鬆冇嚐嘗鬨麵準鐘彆閒乾儘臟拚"
-# 简体转繁体
def toTraditionString(str):
output_str_list = []
str_len = len(str)
+
for i in range(str_len):
found_index = SIMPLE.find(str[i])
+
if not (found_index == -1):
output_str_list.append(TRADITION[found_index])
+
else:
output_str_list.append(str[i])
- return "".join(output_str_list)
+
+ return "".join(output_str_list)
-
-# 繁体转简体
def toSimpleString(str):
output_str_list = []
str_len = len(str)
+
for i in range(str_len):
found_index = TRADITION.find(str[i])
+
if not (found_index == -1):
output_str_list.append(SIMPLE[found_index])
+
else:
output_str_list.append(str[i])
- return "".join(output_str_list)
-
+
+ return "".join(output_str_list)
-@on_command('anime_search_in_photo', aliases=['以图搜番'], only_to_me=False)
+@on_command(
+ 'anime_search',
+ aliases = ['以图搜番'],
+ only_to_me = False
+)
async def _(session: CommandSession):
+ user = session.event.user_id
msg = session.current_arg.strip()
+
if not msg:
- msg = session.get('message', prompt='请发送一张图片')
- await session.send('开始以图搜番\n(如搜索时间过长或无反应则为图片格式有问题)')
+ msg = session.get('message', prompt = "请发送一张图片")
+
+ await session.send("开始以图搜番\n(如搜索时间过长或无反应则为图片格式有问题)")
+
p = '\\[CQ\\:image\\,file\\=.*?\\,url\\=(.*?)\\]'
+
img = re.findall(p, msg)
+
if img:
URL = f'https://trace.moe/api/search?url={img[0]}'
- print(URL)
+
req = await get_bytes(URL)
+
if req:
data = json.loads(req.decode())
+
d = {}
+
for i in range(len(data['docs'])):
if data['docs'][i]['title_chinese'] in d.keys():
- d[data['docs'][i]['title_chinese']][0]+=data['docs'][i]['similarity']
+ d[data['docs'][i]['title_chinese']][0] += data['docs'][i]['similarity']
+
else:
m = data['docs'][i]['at']/60
s = data['docs'][i]['at']%60
+
if data['docs'][i]['episode'] == '':
n = 1
+
else:
n = data['docs'][i]['episode']
+
d[toSimpleString(data['docs'][i]['title_chinese'])] = [data['docs'][i]['similarity'],f'第{n}集',f'{int(m)}分{int(s)}秒处']
- result = sorted(d.items(),key=lambda x:x[1],reverse=True)
+
+ result = sorted(
+ d.items(),
+ key = lambda x:x[1],
+ reverse = True
+ )
+
t = 0
- msg0 = f'提供的图片按照相似度找到{len(d)}个结果:'
+
+ msg0 = f'[CQ:at,qq={user}]\n根据所提供的图片按照相似度找到{len(d)}个结果:'
+
for i in result:
- t += 1
- msg = (f'\n——————————\n({t})\n相似度:{i[1][0]}\n动漫名:《{i[0]}》\n时间点:{i[1][1]} {i[1][2]}')
+ t +=1
+ lk = ('%.2f%%' % (i[1][0] * 100))
+ msg = (f'\n——————————\n({t})\n相似度:{lk}\n动漫名:《{i[0]}》\n时间点:{i[1][1]} {i[1][2]}')
msg0 += msg
+
await session.send(msg0)
+
else:
- await session.send('搜索似乎失败了呢...') \ No newline at end of file
+ await session.send("搜索似乎失败了呢...") \ No newline at end of file
diff --git a/ATRIbot/plugins/bilibili.py b/ATRI/plugins/bilibili.py
index 24960df..818e6a9 100644
--- a/ATRIbot/plugins/bilibili.py
+++ b/ATRI/plugins/bilibili.py
@@ -3,14 +3,7 @@ import nonebot
from orjson import loads
from html import unescape
-
-import requests
-
-def request_api(url):
- response = requests.request("GET", url)
- html = response.text
- return html
-
+from ATRI.modules import response
REPORT_FORMAT = """({aid})信息如下:
@@ -76,7 +69,7 @@ async def fk_tx_app_bilibili(session: nonebot.NLPSession):
ad = 'av' + aid
print(ad)
- dc = json.loads(request_api(url))
+ dc = json.loads(response.request_api(url))
pic = dc["data"]["pic"]
@@ -96,4 +89,4 @@ async def fk_tx_app_bilibili(session: nonebot.NLPSession):
img = f'[CQ:image,file={pic}]',
)
- )
+ ) \ No newline at end of file
diff --git a/ATRIbot/plugins/cloudmusic.py b/ATRI/plugins/cloudmusic.py
index 4452eee..ad85cad 100644
--- a/ATRIbot/plugins/cloudmusic.py
+++ b/ATRI/plugins/cloudmusic.py
@@ -3,13 +3,7 @@ import nonebot
from orjson import loads
from html import unescape
-import requests
-
-def request_api(url):
- response = requests.request("GET", url)
- html = response.text
- return html
-
+from ATRI.modules import response
REPORT_FORMAT = """Status: {status}
Song id: {id}
@@ -42,7 +36,7 @@ async def fk_tx_app_cloudmusic(session: nonebot.NLPSession):
url = f'https://api.imjad.cn/cloudmusic/?type=song&id={wid}&br=320000'
print(url)
- dc = json.loads(request_api(url))
+ dc = json.loads(response.request_api(url))
await session.send(
REPORT_FORMAT.format(
@@ -74,7 +68,7 @@ async def cloudmusic_link(session: nonebot.NLPSession):
url = f'https://api.imjad.cn/cloudmusic/?type=song&id={wid}&br=320000'
print(url)
- dc = json.loads(request_api(url))
+ dc = json.loads(response.request_api(url))
await session.send(
REPORT_FORMAT.format(
@@ -84,4 +78,4 @@ async def cloudmusic_link(session: nonebot.NLPSession):
url = dc["data"][0]["url"],
md5 = dc["data"][0]["md5"],
)
- )
+ ) \ No newline at end of file
diff --git a/ATRI/plugins/hbook.py b/ATRI/plugins/hbook.py
new file mode 100644
index 0000000..b0733f8
--- /dev/null
+++ b/ATRI/plugins/hbook.py
@@ -0,0 +1,56 @@
+# -*- coding:utf-8 -*-
+import re
+import json
+from nonebot import on_command, CommandSession
+
+from ATRI.modules import response # type: ignore
+
+
+@on_command('hbook', aliases = ['本子', '本子搜索', '本子查询'], only_to_me = False)
+async def _(session: CommandSession):
+ with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f:
+ data = json.load(f)
+
+ if data["hbook"] == 0:
+ h_msg = session.current_arg.strip()
+
+ if not h_msg:
+ h_msg = session.get('message', prompt='要冲了吗?速发关键词')
+
+ h_type = session.event.detail_type
+ h_user = session.event.user_id
+
+ header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36'}
+ keyword = {'show':'title,titleen,tags','keyboard':h_msg}
+
+ res = await response.post_bytes('https://b-upp.com/search/', headers=header, data=keyword)
+ res = res.decode()
+
+ if '没有搜索到相关的内容' in res:
+ n_msg = '...似乎没有找到[{}]相关的本子呢'.format(h_msg)
+ await session.send(message=n_msg)
+
+ else:
+ p = '<a href="(.*?)" target="_blank" title="(.*?)">'
+ data = re.findall(p,res)
+ n = len(data)
+
+ if h_type == 'group':
+ limit = 3
+
+ elif h_type == 'private':
+ limit = 10
+
+ if n > limit: # type: ignore
+ n = limit # type: ignore
+
+ msg = f'根据提供信息,已查询到{n}本关键词为[{h_msg}]的本子:'
+ if h_type == 'group':
+ msg = f'[CQ:at,qq={h_user}]\n根据提供信息,已查询到{n}本关键词为[{h_msg}]的本子:'
+ for i in range(n):
+ msg0 = ('\n——————————\n本子链接:https://b-upp.com%s \n本子标题:%s '%(data[i]))
+ msg += msg0
+ await session.send(message=msg)
+
+ else:
+ await session.send('该功能已禁用...') \ No newline at end of file
diff --git a/ATRI/plugins/hitokoto.py b/ATRI/plugins/hitokoto.py
new file mode 100644
index 0000000..2f542c3
--- /dev/null
+++ b/ATRI/plugins/hitokoto.py
@@ -0,0 +1,33 @@
+# -*- coding:utf-8 -*-
+import json
+from nonebot import on_command, on_natural_language, CommandSession
+from nonebot import NLPSession, NLPResult
+from ATRI.modules import response
+
+
+url = f'https://api.imjad.cn/hitokoto/?cat=a&charset=utf-8&length=50&encode=json&fun=sync&source='
+
+
+HITOKOTO_REPLY = """{hitokoto}
+ from {author}"""
+
+
+@on_command('hitokoto', aliases = ['一言'], only_to_me = False)
+async def hitokoto(session: CommandSession):
+ rep = response.request_api(url)
+
+ if not rep:
+ session.finish('获取失败')
+
+ dc = json.loads(response.request_api(url))
+
+ await session.send(
+ HITOKOTO_REPLY.format(
+ hitokoto = dc["hitokoto"],
+ author = dc["author"]
+ )
+ )
+
+@on_natural_language('一言', only_to_me = False)
+async def _(session: NLPSession):
+ return NLPResult(60.0, ('hitokoto',), None) \ No newline at end of file
diff --git a/ATRI/plugins/other.py b/ATRI/plugins/other.py
new file mode 100644
index 0000000..abecb18
--- /dev/null
+++ b/ATRI/plugins/other.py
@@ -0,0 +1,95 @@
+# -*- coding:utf-8 -*-
+import random
+import nonebot
+from nonebot import on_command, CommandSession
+from nonebot.helpers import render_expression
+
+
+bot = nonebot.get_bot()
+master = bot.config.SUPERUSERS
+
+
+HELP_REPLY = (
+ 'ええと...让我想想...',
+ '嗯...',
+ '阿这',
+ '不会使用嘛...ええと'
+)
+
+
+# 论如何将 Python 写出 Java 的味道
+# 接下来给各位展示一下
+# 咱的屎山
+
+@on_command(
+ '抽签',
+ only_to_me = False
+)
+async def _(session: CommandSession):
+ await session.send(
+ str(
+ random.choice(
+ [
+ '大凶',
+ '大胸',
+ '小凶',
+ '小胸',
+ '凶',
+ '吉',
+ '中吉',
+ '大吉',
+ '特大吉',
+ '超特大吉'
+ ]
+ )
+ )
+ )
+
+@on_command(
+ '掷骰子',
+ aliases = [
+ '扔骰子',
+ '骰子'
+ ],
+ only_to_me = False
+)
+async def _(session: CommandSession):
+ await session.send(
+ str(
+ random.randint(
+ 1,6
+ )
+ )
+ )
+
+@on_command(
+ '关于',
+ aliases = [
+ '关于机器人'
+ ],
+ only_to_me = False
+)
+async def _(session: CommandSession):
+ await session.send(
+ f"""想了解ATRI嘛
+ 写出咱的是Kyomotoi
+ 他的主页:https://lolihub.icu
+ 项目地址:https://github.com/Kyomotoi/ATRI
+ 欢迎star~w!"""
+ )
+
+@on_command(
+ 'help',
+ aliases = [
+ '帮助',
+ '如何使用ATRI',
+ '机器人帮助'
+ ],
+ only_to_me = False
+)
+async def _(session: CommandSession):
+ await session.send(
+ f"""{render_expression(HELP_REPLY)}
+ 看这吧!
+ https://lolihub.icu/#/robot/user"""
+ ) \ No newline at end of file
diff --git a/ATRI/plugins/pixiv.py b/ATRI/plugins/pixiv.py
new file mode 100644
index 0000000..d5b5b62
--- /dev/null
+++ b/ATRI/plugins/pixiv.py
@@ -0,0 +1,174 @@
+# -*- coding:utf-8 -*-
+import time
+import json
+from nonebot import on_command, CommandSession
+import nonebot
+
+from ATRI.modules import response # type: ignore
+
+
+bot = nonebot.get_bot()
+master = bot.config.SUPERUSERS
+
+URL_1 = f'https://api.imjad.cn/pixiv/v1/?type=illust&id=' #单图搜索
+URL_2 = f'https://api.imjad.cn/pixiv/v1/?type=member_illust&id=' #画师作品搜索
+URL_3 = f'https://api.imjad.cn/pixiv/v1/?type=rank' #每日排行榜
+
+
+IMG_SEACH_REPLY = """[CQ:at,qq={user}]
+搜索结果如下:
+Pid: {pid}
+Title: {title}
+宽高: {width}x{height}
+Tags: {tags}
+账号名称: {account}
+名称: {name}
+Link: {user_link}
+{img}
+---------------
+完成时间:{time}s"""
+
+
+@on_command('pixiv_seach_img', aliases = ['p站搜图', 'P站搜图', '批站搜图'], only_to_me = False)
+async def _(session: CommandSession):
+ with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f:
+ data = json.load(f)
+
+ if data["pixiv_seach_img"] == 0:
+ user = session.event.user_id
+ pid = session.current_arg.strip()
+
+ if not pid:
+ pid = session.get('message', prompt = '请告诉ATRI需要查询的Pid码')
+
+ start =time.perf_counter()
+ await session.send('开始P站搜图\n如搜索时间过长或许为图片过大上传较慢')
+
+ URL = URL_1 + pid
+
+ dc = json.loads(response.request_api(URL))
+
+ if not dc:
+ session.finish('ATRI在网络上走散了...请重试...')
+
+ img = f'https://pixiv.cat/{pid}.jpg'
+
+ end = time.perf_counter()
+
+ await session.send(
+ IMG_SEACH_REPLY.format(
+ user = user,
+ pid = pid,
+ title = dc["response"][0]["title"],
+ width = dc["response"][0]["width"],
+ height = dc["response"][0]["height"],
+ tags = dc["response"][0]["tags"],
+ account = dc["response"][0]["user"]["account"],
+ name = dc["response"][0]["user"]["name"],
+ user_link = f'https://www.pixiv.net/users/' + f'{dc["response"][0]["user"]["id"]}',
+ img = f'[CQ:image, file={img}]',
+ time = round(end - start, 3)
+ )
+ )
+
+ else:
+ await session.send('该功能已被禁用...')
+
+
+@on_command('pixiv_seach_author', aliases = ['画师'], only_to_me = False)
+async def _(session: CommandSession):
+ with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f:
+ data = json.load(f)
+
+ if data["pixiv_seach_author"] == 0:
+ user = session.event.user_id
+ author_id = session.current_arg.strip()
+
+ if not author_id:
+ author_id = session.get('message', prompt = '请告诉ATRI需要查询的画师ID')
+
+ start =time.perf_counter()
+ await session.send(f'开始获取画师{author_id}的前三项作品\n如获取时间过长或许为图片过大上传较慢')
+
+ URL = URL_2 + author_id
+
+ dc = json.loads(response.request_api(URL))
+
+ if not dc:
+ session.finish('ATRI在网络上走散了...请重试...')
+
+ d ={}
+
+ for i in range(0,3):
+ pid = dc["response"][i]["id"]
+ pidURL = f'https://pixiv.cat/{pid}.jpg'
+ d[i] = [f'{pid}',f'{pidURL}']
+
+ msg0 = (f'[CQ:at,qq={user}]\n画师id:{author_id},接下来展示前三作品')
+
+ result = sorted(
+ d.items(),
+ key = lambda x:x[1],
+ reverse = True
+ )
+
+ t = 0
+
+ for i in result:
+ t += 1
+ msg = (f'\n---------------\n({t})\nPid: {i[1][0]}\n[CQ:image, file={i[1][1]}]')
+ msg0 += msg
+ end = time.perf_counter()
+
+ msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s')
+ msg0 += msg1
+
+ await session.send(msg0)
+
+ else:
+ await session.send('该功能已被禁用...')
+
+
+@on_command('pixiv_daily_rank', aliases = ['P站排行榜', '批站排行榜', 'p站排行榜'], only_to_me = False)
+async def _(session: CommandSession):
+ with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f:
+ data = json.load(f)
+
+ if data["pixiv_daily_rank"] == 0:
+ user = session.event.user_id
+
+ await session.send('ATRI正在获取P站每日排行榜前五作品...')
+
+ start =time.perf_counter()
+ dc = json.loads(response.request_api(URL_3))
+
+ d = {}
+
+ for i in range(0,5):
+ pid = dc["response"][0]["works"][i]["work"]["id"]
+ pidURL = f'https://pixiv.cat/{pid}.jpg'
+ d[i] = [f'{pid}',f'{pidURL}']
+
+ msg0 = (f'[CQ:at,qq={user}]')
+
+ result = sorted(
+ d.items(),
+ key = lambda x:x[1],
+ reverse = True
+ )
+
+ t = 0
+
+ for i in result:
+ t += 1
+ msg = (f'\n---------------\n({t})\nPid: {i[1][0]}\n[CQ:image, file={i[1][1]}]')
+ msg0 += msg
+ end = time.perf_counter()
+
+ msg1 = (f'\n---------------\n完成时间:{round(end - start, 3)}s')
+ msg0 += msg1
+
+ await session.send(msg0)
+
+ else:
+ await session.send('该功能已被禁用...') \ No newline at end of file
diff --git a/ATRIbot/plugins/send.py b/ATRI/plugins/send.py
index 03df48b..6cc57e1 100644
--- a/ATRIbot/plugins/send.py
+++ b/ATRI/plugins/send.py
@@ -1,11 +1,12 @@
# -*- coding:utf-8 -*-
+import time
import nonebot
from nonebot import on_command, CommandSession
bot = nonebot.get_bot()
master = bot.config.SUPERUSERS
-ban_group = bot.config.BANGROUP
+ban_group = bot.config.BANGROUP # type: ignore
@on_command('send_all_group', aliases=['公告', '群发', '推送'], only_to_me=False)
@@ -16,19 +17,19 @@ async def send_all_group(session: CommandSession):
if not msg:
msg = session.get('message', prompt='请告诉吾辈需要群发的内容~!')
- group_list = await session.bot.get_group_list()
+ group_list = await session.bot.get_group_list() # type: ignore
for group in group_list:
if group['group_id'] not in ban_group:
try:
- await bot.send_group_msg(group_id = group['group_id'], message = msg)
+ await bot.send_group_msg(group_id = group['group_id'], message = msg) # type: ignore
except:
pass
- await session.send('吾辈推送...完成!')
+ await session.send('推送完成!')
@on_command('send_to_group', aliases=['对群'], only_to_me=False)
@@ -37,7 +38,7 @@ async def send_to_group(session: CommandSession):
msg = session.current_arg.strip()
if not msg:
- msg = session.get('message', prompt='请告诉吾辈完整内容呢...\n例:对群 12345647(群号) message')
+ msg = session.get('message', prompt='请告诉吾辈完整内容呢...\n例:对群 12345647(群号) message 1')
lg = msg.split(' ')
@@ -48,17 +49,17 @@ async def send_to_group(session: CommandSession):
if rei:
for i in range(1, rei):
try:
- await bot.send_group_msg(group_id = group, message = msg)
+ await bot.send_group_msg(group_id = group, message = msg) # type: ignore
except:
await session.send('发送失败,请重试')
else:
try:
- await bot.send_group_msg(group_id = group, message = msg)
+ await bot.send_group_msg(group_id = group, message = msg) # type: ignore
except:
await session.send('发送失败,请重试')
- await session.send('吾辈推送...完成!')
+ await session.send('推送完成!')
@on_command('send_to_qq', aliases=['对QQ'], only_to_me=False)
@@ -75,8 +76,46 @@ async def send_to_qq(session: CommandSession):
msg = lg[1]
try:
- await bot.send_private_msg(user_id = qq, message = msg)
+ await bot.send_private_msg(user_id = qq, message = msg) # type: ignore
except:
await session.send('发送失败,请重试')
- await session.send('吾辈推送...完成!')
+ await session.send('推送完成!')
+
+
+@on_command('send_to_group_pr', aliases=['对群私聊'], only_to_me=False)
+async def _(session: CommandSession):
+ if session.event.user_id in master:
+ msg = session.current_arg.strip()
+
+ if not msg:
+ msg = session.get('message', prompt='请告诉吾辈完整内容呢...\n例:对群 12345647(群号) message 1')
+
+ lg = msg.split(' ')
+
+ group = lg[0]
+ msg = lg[1]
+ rei = int(lg[2]) + 1
+
+ group_user_list = await session.bot.get_group_member_list(group_id = group) # type: ignore
+
+ for i in group_user_list:
+ time.sleep(0.5)
+ userid = i['user_id']
+ print(userid)
+
+ if rei:
+ for a in range(1, rei):
+ time.sleep(0.5)
+ try:
+ await bot.send_private_msg(user_id = userid, message = msg) # type: ignore
+ except:
+ await session.send('发送失败,请重试')
+
+ else:
+ try:
+ await bot.send_private_msg(user_id = userid, message = msg) # type: ignore
+ except:
+ await session.send('发送失败,请重试')
+
+ await session.send('推送完成!') \ No newline at end of file
diff --git a/ATRI/plugins/setu.py b/ATRI/plugins/setu.py
new file mode 100644
index 0000000..315803b
--- /dev/null
+++ b/ATRI/plugins/setu.py
@@ -0,0 +1,49 @@
+# -*- coding:utf-8 -*-
+import time
+import json
+import nonebot
+from nonebot import on_command, CommandSession
+
+from ATRI.modules import response # type: ignore
+
+
+bot = nonebot.get_bot()
+master = bot.config.SUPERUSERS
+apikey = bot.config.LOLICONAPI # type: ignore
+
+URL = 'https://api.lolicon.app/setu/'
+
+SETU_REPLY = """Title: {title}
+Pid: {pid}
+[CQ:image,file={setu}]
+---------------
+完成时间:{time}s"""
+
+
+@on_command('setu', aliases = ['图来'], only_to_me = False)
+async def _(session: CommandSession):
+ with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f:
+ data = json.load(f)
+
+ if data["setu"] == 0:
+ start = time.perf_counter()
+ values = {
+ "apikey": apikey,
+ "r18": "0",
+ "num": "1"
+ }
+
+ dc = json.loads(response.request_api_params(URL, values))
+ end = time.perf_counter()
+
+ await session.send(
+ SETU_REPLY.format(
+ title=dc["data"][0]["title"],
+ pid=dc["data"][0]["pid"],
+ setu=dc["data"][0]["url"],
+ time = round(end - start, 3)
+ )
+ )
+
+ else:
+ await session.send('该功能已被禁用...') \ No newline at end of file
diff --git a/ATRI/plugins/switch.py b/ATRI/plugins/switch.py
new file mode 100644
index 0000000..4ba24e3
--- /dev/null
+++ b/ATRI/plugins/switch.py
@@ -0,0 +1,79 @@
+# -*- coding:utf-8 -*-
+import json
+import nonebot
+from nonebot import on_command, CommandSession
+
+
+bot = nonebot.get_bot()
+master = bot.config.SUPERUSERS
+
+
+@on_command('switch', aliases = ['开启', '关闭'], only_to_me = False)
+async def _(session: CommandSession):
+ with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f:
+ data = json.load(f)
+
+ if session.event.user_id in master:
+ command = session.event.raw_message.split(' ', 1)
+ switch = command[0]
+ com = command[1]
+
+ if switch == '开启':
+ if com == 'p站搜图':
+ data["pixiv_seach_img"] = 0
+
+ elif com == '画师':
+ data["pixiv_seach_author"] = 0
+
+ elif com == 'P站排行榜':
+ data["pixiv_daily_rank"] = 0
+
+ elif com == '好友添加':
+ data["approve_friend_add"] = 0
+
+ elif com == '群邀请':
+ data["approve_invite_join_group"] = 0
+
+ elif com == '涩图':
+ data["setu"] = 0
+
+ elif com == '本子':
+ data["hbook"] = 0
+
+ else:
+ pass
+
+ elif switch == '关闭':
+ if com == 'p站搜图':
+ data["pixiv_seach_img"] = 1
+
+ elif com == '画师':
+ data["pixiv_seach_author"] = 1
+
+ elif com == 'P站排行榜':
+ data["pixiv_daily_rank"] = 1
+
+ elif com == '好友添加':
+ data["approve_friend_add"] = 1
+
+ elif com == '群邀请':
+ data["approve_invite_join_group"] = 1
+
+ elif com == '涩图':
+ data["setu"] = 1
+
+ elif com == '本子':
+ data["hbook"] = 1
+
+ else:
+ pass
+
+ a = json.dumps(data)
+ f2 = open(f'ATRI\\plugins\\switch\\switch.json', 'w')
+ f2.write(a)
+ f2.close
+
+ await session.send('设置完成!')
+
+ else:
+ await session.send('恁哪位?') \ No newline at end of file
diff --git a/ATRI/plugins/switch/switch.json b/ATRI/plugins/switch/switch.json
new file mode 100644
index 0000000..99d82c4
--- /dev/null
+++ b/ATRI/plugins/switch/switch.json
@@ -0,0 +1 @@
+{"pixiv_seach_img": 0, "pixiv_seach_author": 1, "pixiv_daily_rank": 0, "approve_friend_add": 0, "approve_invite_join_group": 0, "setu": 0, "hbook": 0} \ No newline at end of file
diff --git a/ATRI/plugins/welcome.py b/ATRI/plugins/welcome.py
new file mode 100644
index 0000000..16cd706
--- /dev/null
+++ b/ATRI/plugins/welcome.py
@@ -0,0 +1,88 @@
+# -*- coding:utf-8 -*-
+import json
+import nonebot
+from nonebot import on_notice
+from nonebot.notice_request import NoticeSession, RequestSession
+from nonebot.plugin import on_request
+from aiocqhttp.exceptions import ActionFailed
+
+bot = nonebot.get_bot()
+master = bot.config.SUPERUSERS
+
+
+@on_notice('group_increase')
+async def _(session: NoticeSession):
+ user = session.event.user_id
+ me = session.event.self_id
+
+ if user == me:
+ await session.send('在下アトリ,今后请多指教呐❤')
+ else:
+ await session.send(f'[CQ:at,qq={user}]\nねえ❤...是新人欸!\nここでは遠慮はいらないのだからね❤')
+
+@on_notice('firend_add')
+async def _(session: NoticeSession, CommandSession):
+ user = session.event.user_id
+ await bot.send_private_msg(
+ user_id = master, # type: ignore
+ message = f'{user}\n想认识ATRI欸欸欸!!'
+ )
+
+ with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f:
+ data = json.load(f)
+
+ if data["approve_friend_add"] == 0:
+ await bot.send_private_msg(
+ user_id = master, # type: ignore
+ message = '由于主人已同意ATRI接近陌生人,故请求已同意!'
+ )
+ await bot.send_private_msg(
+ user_id = user, # type: ignore
+ message = f'初次见面,我是アトリ!咱可是高性能ですから~!\nATRI的使用方法(恁可少想有的没的8,老涩批):https://lolihub.icu/#/robot/user'
+ )
+
+ else:
+ await bot.send_private_msg(
+ user_id = master, # type: ignore
+ message = '由于主人不同意ATRI接近陌生人,故请求已回拒...'
+ )
+ await bot.send_private_msg(
+ user_id = user, # type: ignore
+ message = f'主人似乎不想让ATRI接触陌生人呢...'
+ )
+
+
+@on_request('group')
+async def _(session: RequestSession):
+ group = session.event.group_id
+ user = session.event.user_id
+
+ with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f:
+ data = json.load(f)
+
+ if session.event.sub_type == 'invite':
+
+ if data["approve_invite_join_group"] == 0:
+ await session.bot.send_private_msg(
+ user_id = user, # type: ignore
+ message = '嗯哼?想邀请ATRI入群嘛,正好!咱主人想让咱出去看看大世界!'
+ )
+ await session.bot.send_private_msg(
+ user_id = master, # type: ignore
+ message = f'ATRI收到一个新邀请:\n裙: {group}\n邀请人: {user}\n已同意'
+ )
+
+ try:
+ await session.approve()
+ except ActionFailed as e:
+ print(e.retcode)
+
+ else:
+ await session.bot.send_private_msg(
+ user_id = user, # type: ignore
+ message = '主人告诉咱不能随便乱跑...\n作者联系方式:https://lolihub.icu/#/about'
+ )
+ await session.bot.send_private_msg(
+ user_id = master, # type: ignore
+ message = f'ATRI收到一个新邀请:裙: {group}\n邀请人: {user}\n已拒绝'
+ ) \ No newline at end of file
diff --git a/ATRIbot/config.py b/ATRIbot/config.py
deleted file mode 100644
index 81fffeb..0000000
--- a/ATRIbot/config.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# -*- coding:utf-8 -*-
-from nonebot.default_config import *
-
-#配置监听的 IP 和端口
-HOST = '127.0.0.1'
-PORT = 8080
-
-#咱的主人(QQ号)
-SUPERUSERS = {}
-
-#机器人赋名,替代@
-NICKNAME = {}
-
-#自定义命令开头
-COMMAND_START = {}
-
-#推送屏蔽群名单
-BANGROUP = []
-
-#LOLICONAPI url:https://api.lolicon.app/#/setu
-LOLICONAPI = ""
-
-#腾讯ai url:https://ai.qq.com/
-TX_APP_ID = ""
-TX_APPKEY = ""
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#判定 请勿更改!
-print("正在导入吾辈最最最重要的记忆......")
-if SUPERUSERS:
- print("吾辈的主人已加载!")
-else:
- print("吾辈没找到主人...如需帮助,请查看安装手册")
-
-if NICKNAME:
- print("吾辈的称呼已加载!")
-else:
- print("吾辈忘记自己叫啥惹...如需帮助,请查看安装手册")
-
-if COMMAND_START:
- print("呼叫吾辈的特别小工具已加载!")
-else:
- print("吾辈无法找到呼唤咱的特别小工具...如需帮助,请查看安装手册")
-
-if bangroup:
- print("屏蔽群发的群已加载!")
-else:
- print("主人似乎没给咱指定不需要接受群发的群号呢...那吾辈就可以更全面地进行推送了w")
-
-if LOLICONAPI:
- print("涩图key已加载!")
-else:
- print("吾辈似乎没给咱打开涩图大门的钥匙呢...如需帮助,请查看安装手册")
-
-if TX_APP_ID:
- print("吾辈的腾讯识别码已加载!")
-else:
- print("吾辈没法找到自己的腾讯识别码呢...如需帮助,请查看安装手册")
-
-if TX_APPKEY:
- print("吾辈的腾讯key已加载!")
-else:
- print("主人似乎没给咱腾讯key呢...如需帮助,请查看安装手册")
diff --git a/ATRIbot/plugins/Module/google_translate/__pycache__/__init__.cpython-37.pyc b/ATRIbot/plugins/Module/google_translate/__pycache__/__init__.cpython-37.pyc
deleted file mode 100644
index c9cca07..0000000
--- a/ATRIbot/plugins/Module/google_translate/__pycache__/__init__.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/anime_search_in_photo.cpython-37.pyc b/ATRIbot/plugins/__pycache__/anime_search_in_photo.cpython-37.pyc
deleted file mode 100644
index a606652..0000000
--- a/ATRIbot/plugins/__pycache__/anime_search_in_photo.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/anime_search_photo.cpython-37.pyc b/ATRIbot/plugins/__pycache__/anime_search_photo.cpython-37.pyc
deleted file mode 100644
index 8eb81e7..0000000
--- a/ATRIbot/plugins/__pycache__/anime_search_photo.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/chat.cpython-37.pyc b/ATRIbot/plugins/__pycache__/chat.cpython-37.pyc
deleted file mode 100644
index ad1818d..0000000
--- a/ATRIbot/plugins/__pycache__/chat.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/covid19.cpython-37.pyc b/ATRIbot/plugins/__pycache__/covid19.cpython-37.pyc
deleted file mode 100644
index f1a5940..0000000
--- a/ATRIbot/plugins/__pycache__/covid19.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/hbook.cpython-37.pyc b/ATRIbot/plugins/__pycache__/hbook.cpython-37.pyc
deleted file mode 100644
index c634d3b..0000000
--- a/ATRIbot/plugins/__pycache__/hbook.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/hitokoto.cpython-37.pyc b/ATRIbot/plugins/__pycache__/hitokoto.cpython-37.pyc
deleted file mode 100644
index cddfff3..0000000
--- a/ATRIbot/plugins/__pycache__/hitokoto.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/other.cpython-37.pyc b/ATRIbot/plugins/__pycache__/other.cpython-37.pyc
deleted file mode 100644
index 9934055..0000000
--- a/ATRIbot/plugins/__pycache__/other.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/pixiv.cpython-37.pyc b/ATRIbot/plugins/__pycache__/pixiv.cpython-37.pyc
deleted file mode 100644
index 72467ee..0000000
--- a/ATRIbot/plugins/__pycache__/pixiv.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/pixiv_seach_photo.cpython-37.pyc b/ATRIbot/plugins/__pycache__/pixiv_seach_photo.cpython-37.pyc
deleted file mode 100644
index d672578..0000000
--- a/ATRIbot/plugins/__pycache__/pixiv_seach_photo.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/r6invalid.cpython-37.pyc b/ATRIbot/plugins/__pycache__/r6invalid.cpython-37.pyc
deleted file mode 100644
index 3798fd4..0000000
--- a/ATRIbot/plugins/__pycache__/r6invalid.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/setu.cpython-37.pyc b/ATRIbot/plugins/__pycache__/setu.cpython-37.pyc
deleted file mode 100644
index 1bca92b..0000000
--- a/ATRIbot/plugins/__pycache__/setu.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/translate.cpython-37.pyc b/ATRIbot/plugins/__pycache__/translate.cpython-37.pyc
deleted file mode 100644
index 17bf117..0000000
--- a/ATRIbot/plugins/__pycache__/translate.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/weather.cpython-37.pyc b/ATRIbot/plugins/__pycache__/weather.cpython-37.pyc
deleted file mode 100644
index b931e84..0000000
--- a/ATRIbot/plugins/__pycache__/weather.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/welcome.cpython-37.pyc b/ATRIbot/plugins/__pycache__/welcome.cpython-37.pyc
deleted file mode 100644
index c86739f..0000000
--- a/ATRIbot/plugins/__pycache__/welcome.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/__pycache__/ytu.cpython-37.pyc b/ATRIbot/plugins/__pycache__/ytu.cpython-37.pyc
deleted file mode 100644
index 3bce10b..0000000
--- a/ATRIbot/plugins/__pycache__/ytu.cpython-37.pyc
+++ /dev/null
Binary files differ
diff --git a/ATRIbot/plugins/chat.py b/ATRIbot/plugins/chat.py
deleted file mode 100644
index 93526e3..0000000
--- a/ATRIbot/plugins/chat.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- coding:utf-8 -*-
-import time
-import httpx
-import string
-import nonebot
-import hashlib
-from AyaBot.plugins import *
-from random import randint
-from urllib.parse import urlencode
-from nonebot.helpers import render_expression
-from nonebot import on_command, CommandSession, on_natural_language, NLPSession, IntentCommand
-
-bot = nonebot.get_bot()
-mastwr = bot.config.SUPERUSERS
-
-ERROR_REPLY = (
- '吾辈不是很能理解主人的意思...',
- '(。´・ω・)ん?',
- 'ん?',
- 'あつ...脑子坏了..理解不能',
- '吾辈想听主人再说一次...'
-)
-
-class Chat(object):
- URL = 'https://api.ai.qq.com/fcgi-bin/nlp/nlp_textchat'
- app_id = bot.config.TX_APP_ID
- app_key = bot.config.TX_APPKEY
- print(app_id, app_key)
- nonce_str_example = 'fa577ce340859f9fe'
- ct = lambda: time.time()
-
- @classmethod
- def get_nonce_str(self):
- nonce_str = ''
- len_str = string.digits + string.ascii_letters
- for i in range(len(self.nonce_str_example)):
- nonce_str += len_str[randint(0, len(len_str) - 1)]
- return nonce_str
-
- @classmethod
- def sign(self, req_data):
- new_list = sorted(req_data.items())
- encode_list = urlencode(new_list)
- req_data = encode_list + "&" + "app_key" + "=" + self.app_key
- md5 = hashlib.md5()
- md5.update(req_data.encode('utf-8'))
- data = md5.hexdigest()
- return data.upper()
-
- @classmethod
- async def request(self, text):
- req_data = {
- 'app_id': self.app_id,
- 'time_stamp': int(self.ct()),
- 'nonce_str': self.get_nonce_str(),
- 'session': 10000,
- 'question': text,
- }
- print(req_data)
- req_data['sign'] = self.sign(req_data)
- req_data = sorted(req_data.items())
- requests = httpx.AsyncClient()
- result = await requests.get(self.URL, params=req_data)
- await requests.aclose()
- result = result.json()
- print(result)
- if result['ret'] == 0:
- return result['data']['answer']
- return render_expression(ERROR_REPLY)
-
-
-@on_command('chat')
-async def chat(session: CommandSession):
- if chat_switch:
- msg = session.state.get('msg')
- reply = await Chat.request(msg)
- await session.finish(reply)
- return
- else:
- await session.send('えつ,アトリ被主人告知不能与陌生人说话')
-
-@on_natural_language
-async def _(session: NLPSession):
- return IntentCommand(60.0, ('chat'), {'msg': session.msg_text})
-
-chat_switch = True
-@on_command('chat_switch', aliases=['开启', '关闭'], only_to_me=False)
-async def _(session: CommandSession):
- if session.event.user_id in master:
- command = session.event.raw_message.split(' ', 1)
- switch = command[0]
- com = command[1]
- global chat_switch
- if switch == '开启':
- if com == '闲聊':
- chat_switch = True
- else:
- pass
-
- elif switch == '关闭':
- if com == '闲聊':
- chat_switch = False
- else:
- pass
-
- await session.send('完成')
-
- else:
- await session.send('恁哪位?')
diff --git a/ATRIbot/plugins/covid19.py b/ATRIbot/plugins/covid19.py
deleted file mode 100644
index decb7c4..0000000
--- a/ATRIbot/plugins/covid19.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding:utf-8 -*-
-import json
-import requests
-from nonebot import on_command, CommandSession
-from AyaBot.plugins.module import google_translate
-
-
-# 国外版 数据更新非常及时
-# 必须挂木弟子
-# 成功把之前的屎优化了!OHHHHHHHHHHHH
-# 如需使用国内版,请查看下面的链接,下载后与这个文件替换
-# https://github.com/Kyomotoi/covid19/tree/master/Domestic
-
-
-
-url = "https://covid-19-coronavirus-statistics.p.rapidapi.com/v1/total"
-
-
-LIST = """截至: {lastChecked}
-国家: {location}
-已治愈: {recovered}
-已经死亡: {deaths}
-总感染数: {confirmed}
-现存感染人数: {nowConfirmed}
-最后检查时间: {lastReported}"""
-
-
-@on_command('covid19', aliases=['疫情', '疫情查询', '疫情情况'], only_to_me=False)
-async def covid19(session: CommandSession):
- country = session.get('country', prompt='请键入需要查询的国家(例:中国)')
- if country == '美国':
- pass
- else:
- re_msg = google_translate.translate(country[:4999], to='en', source='zh-CN')
- # if re_msg[0]!='':
- # await session.send(re_msg[0])
- await session.send('开始搜寻...\n如返回Global则为国家名有问题')
- try:
- querystring = {"country":"cy"}
- if country == '美国':
- re_msg = 'US'
- querystring["country"] = re_msg
- else:
- querystring["country"] = re_msg[0]
- print(querystring)
- headers = {
- 'x-rapidapi-host': "covid-19-coronavirus-statistics.p.rapidapi.com",
- 'x-rapidapi-key': "a852be0d03msh8bd4299fe71bfeep100861jsn185ea925449c"
- }
- response = requests.request("GET", url, headers=headers, params=querystring)
- # print(response.text)
- html = response.text
- c19 = json.loads(html)
- await session.send(LIST.format(
- lastChecked=c19["data"]["lastReported"],
- location=c19["data"]["location"],
- recovered=c19["data"]["recovered"],
- deaths=c19["data"]["deaths"],
- confirmed=c19["data"]["confirmed"],
- nowConfirmed=c19["data"]["confirmed"] - c19["data"]["deaths"] - c19["data"]["recovered"],
- lastReported=c19["data"]["lastChecked"],
- )
- )
- except:
- print('error')
- await session.send('搜索出问题了呢,重新试试?')
-
-async def _(session: CommandSession):
- stripped_arg = session.current_arg_text.strip()
- if session.is_first_run:
- if stripped_arg:
- session.state['country'] = stripped_arg
- return
-
- if not stripped_arg:
- session.pause('要查询的国家不能为空,请重新输入')
- session.state[session.current_key] = stripped_arg
diff --git a/ATRIbot/plugins/hitokoto.py b/ATRIbot/plugins/hitokoto.py
deleted file mode 100644
index d5f05a3..0000000
--- a/ATRIbot/plugins/hitokoto.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding:utf-8 -*-
-import asyncio
-import requests
-from typing import Any
-from functools import partial
-from nonebot import on_command, CommandSession
-
-
-class AsyncResponse:
- def __init__(self, response: requests.Response):
- self.raw_response = response
-
-async def run_sync_func(func, *args, **kwargs) -> Any:
- return await asyncio.get_event_loop().run_in_executor(
- None, partial(func, *args, **kwargs))
-
-async def request(method, url, **kwargs) -> AsyncResponse:
- return AsyncResponse(await run_sync_func(requests.request,
- method=method, url=url, **kwargs))
-
-
-url = "https://api.imjad.cn/hitokoto/?cat=a&charset=utf-8&length=50&encode=&fun=sync&source="
-
-
-@on_command('hitokoto', aliases=['一言'], only_to_me=False)
-async def _(session: CommandSession):
- res = requests.get(url)
- if not res.ok:
- session.finish('获取失败')
- session.finish(res.text) \ No newline at end of file
diff --git a/ATRIbot/plugins/mojang.py b/ATRIbot/plugins/mojang.py
deleted file mode 100644
index f134e90..0000000
--- a/ATRIbot/plugins/mojang.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import json
-import requests
-from mcstatus import MinecraftServer
-from nonebot import on_command, CommandSession
-
-
-@on_command('mc_server_status', aliases=['服务器状态查询'], only_to_me=False)
-async def _(session: CommandSession):
- ip = session.current_arg.strip()
- if not ip:
- ip = session.get('server', prompt='请告诉吾辈服务器ip,或输入服务器名(如需添加请联系作者)')
-
- if ip == '南外手艺':
- ip = str('mc.nflsedition.com:26164')
-
- elif ip == 'hypixel':
- ip = str('mc.hypixel.net')
-
- elif ip == 'shotbow':
- ip = str('us.shotbow.net')
-
- elif ip == 'potterworld':
- ip = str('potterworldmc.com')
-
- else:
- pass
-
- server = MinecraftServer.lookup(ip)
- status = server.status()
- await session.send(f'IP:{ip}\nPlayers: {0}\nms: {1}'.format(status.players.online, status.latency))
-
-
-@on_command('check_mc_id', aliases=['mc正版查询', 'MC正版查询'], only_to_me=False)
-async def check_mc_id(session: CommandSession):
- player = session.current_arg.strip()
- if not player:
- player = session.get('player', prompt='请告诉吾辈需要查询的id')
-
- url = f'https://api.mojang.com/users/profiles/minecraft/{player}'
- print(url)
-
- try:
- response = requests.request("GET", url)
-
- try:
- html = response.text
- ms = json.loads(html)
-
- name = ms["name"]
- uuid = ms["id"]
-
- await session.send(f'status: success!\nPlayer: {name}\nuuid: {uuid}\nNamemc: https://mine.ly/{name}.1')
-
- except:
- await session.send(f'{player}可能为非正版玩家,无法查询到其信息')
-
- except:
- print('error')
- await session.send('mojang似乎炸了...等一会吧')
diff --git a/ATRIbot/plugins/other.py b/ATRIbot/plugins/other.py
deleted file mode 100644
index a2933e9..0000000
--- a/ATRIbot/plugins/other.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding:utf-8 -*-
-import nonebot
-from nonebot import on_command, CommandSession, permission as perm
-
-
-bot = nonebot.get_bot()
-
-
-@on_command('关于', aliases=['关于', '关于机器人'], only_to_me=False)
-async def _(session: CommandSession):
- await session.send('阿?想了解咱?\n写出咱的是Kyomotoi~\n他的主页:https://lolihub.icu\n项目地址:https://github.com/Kyomotoi/ATRI')
-
-@on_command('帮助', aliases=['帮助', '食用方法'], only_to_me=False)
-async def _(session: CommandSession):
- await session.send('嗯...不会用咱的话,看这吧!https://lolihub.icu/#/robot/user')
-
-@on_command('seach_this_group_p', aliases=['本群总人数', '总人数', '群人数'], only_to_me=False, permission=perm.GROUP)
-async def _(session: CommandSession):
- try:
- seach_group_member = await session.bot.get_group_member_list(
- group_id=session.event.group_id
- )
- except:
- print('error')
- await session.send('获取数据时出问题,请重试')
- return
-
- await session.send(f'本群目前共有{len(seach_group_member)}人')
diff --git a/ATRIbot/plugins/pixiv.py b/ATRIbot/plugins/pixiv.py
deleted file mode 100644
index bfa2998..0000000
--- a/ATRIbot/plugins/pixiv.py
+++ /dev/null
@@ -1,73 +0,0 @@
-import json
-import requests
-from nonebot import on_command, CommandSession
-
-
-@on_command('pixivsearch', aliases=['p站搜索'], only_to_me=False)
-async def pixivsearch(session: CommandSession):
- gets = session.get('gets', prompt='请告诉吾辈需要查询的pid码')
- try:
- URL = 'https://api.imjad.cn/pixiv/v1/?type=illust&id=' + gets
- print(URL)
- response = requests.request("GET", URL)
- html = response.text
- sr = json.loads(html)
-
- i = sr["response"][0]["id"]
- title = sr["response"][0]["title"]
- width = sr["response"][0]["width"]
- height = sr["response"][0]["height"]
- tags = sr["response"][0]["tags"]
- userid = sr["response"][0]["user"]["id"]
- account = sr["response"][0]["user"]["account"]
- name = sr["response"][0]["user"]["name"]
-
- user_link = f'https://www.pixiv.net/users/{userid}'
- img = f'https://pixiv.cat/{gets}.jpg'
-
- await session.send(f'搜索结果如下:\nPid: {i}\nTitle: {title}\n宽高: {width}x{height}\nTags: {tags}\n账号名称: {account}\n名称: {name}\nLink: {user_link}\n[CQ:image,file={img}]')
-
- except:
- print('error')
- await session.send('连接似乎失败了呢...请稍后尝试')
-
-async def _(session: CommandSession):
- stripped_arg = session.current_arg_text.strip()
- if session.is_first_run:
- if stripped_arg:
- session.state['gets'] = stripped_arg
- return
-
- if not stripped_arg:
- session.pause('请输入需要查询的pid码')
- session.state[session.current_key] = stripped_arg
-
-
-@on_command('pixiv_search_img', aliases=['p站搜图', 'P站搜图', '批站搜图'], only_to_me=False)
-async def pixiv_search_img(session: CommandSession):
- gets = session.get('gets', prompt='请告诉吾辈需要搜索的pid码')
-
- try:
- URL = f'https://pixiv.cat/{gets}.jpg'
-
- if URL:
- nc = str('success!')
-
- await session.send(f'status: {nc}\nPid: {gets}\n[CQ:image,file={URL}]')
-
-
- except:
- await session.send('吾辈尽力了...或许是连接失败??')
-
-@pixiv_search_img.args_parser
-async def _(session: CommandSession):
- stripped_arg = session.current_arg_text.strip()
- if session.is_first_run:
- if stripped_arg:
- session.state['gets'] = stripped_arg
- return
-
- if not stripped_arg:
- session.pause('请告诉吾辈需要搜索的pid码')
- session.state[session.current_key] = stripped_arg \ No newline at end of file
diff --git a/ATRIbot/plugins/setu.py b/ATRIbot/plugins/setu.py
deleted file mode 100644
index 2ab4af5..0000000
--- a/ATRIbot/plugins/setu.py
+++ /dev/null
@@ -1,125 +0,0 @@
-# -*- coding:utf-8 -*-
-import re
-import json
-import nonebot
-import requests
-from aiohttp import ClientSession
-from nonebot import on_command, CommandSession
-
-bot = nonebot.get_bot()
-
-async def post_bytes(url, headers=None,data=None):
- async with ClientSession() as asyncsession:
- async with asyncsession.post(url,headers=headers,data=data) as response:
- b = await response.read()
- return b
-
-
-a = '1'
-b = '1'
-c = '3'
-
-hphoto_switch = True
-hbook_switch = True
-@on_command('hphoto_switch', aliases=['开启', '关闭'], only_to_me=False)
-async def _(session: CommandSession):
- if session.ctx['user_id'] in session.bot.config.SUPERUSERS:
- command = session.ctx['raw_message'].split(' ', 1)
- switch = command[0]
- com = command[1]
- global hphoto_switch
- if switch == '开启':
- if com == '涩图':
- hphoto_switch = True
- elif com == '本子':
- hbook_switch = True
- else:
- pass
- elif switch == '关闭':
- if com == '涩图':
- hphoto_switch = False
- elif com == '本子':
- hbook_switch = False
- else:
- pass
- await session.send('完成')
- else:
- await session.send('恁哪位?')
-
-
-@on_command('hphoto', aliases=['涩图', '涩图来!', '涩图来', '图来', '开冲', '来点好康的', '来丶好康的', '车来'], only_to_me=False)
-async def _(session: CommandSession):
- if hphoto_switch:
-
- url = 'https://api.lolicon.app/setu/'
- apikey = bot.config.LOLICONAPI
- values = {
- "apikey": apikey,
- "r18": "0",
- "num": "1"
- }
- response = requests.get(url, params=values)
- html = response.text
- se = json.loads(html)
- # print(se)
- title=se["data"][0]["title"]
- pid=se["data"][0]["pid"]
- setu=se["data"][0]["url"]
- await session.send(f'Title: {title}\nPid: {pid}\n[CQ:image,file={setu}]')
-
- # if r == '2':
- # URL = 'https://danbooru.donmai.us/post.json'
- # values = {
- # "api_key": ""
- # }
- # response = requests.get(URL, params=values)
- # html = response.text
- # hp = json.loads(html)
- # re = random.randint(0,19)
- # pt = hp[re]["file_url"]
- # await session.send(f'[CQ:image,file={pt}]')
- # if r == '3':
- # URL = 'https://yande.re/post.json'
- # values = {
- # "api_key": ""
- # }
- # response = requests.get(URL, params=values)
- # html = response.text
- # hp = json.loads(html)
- # re = random.randint(0,39)
- # pt = hp[re]["jpeg_url"]
- # await session.send(f'[CQ:image,file={pt}]')
-
-
-@on_command('hbook', aliases=['本子', '找本子', '本子查询'], only_to_me=False)
-async def _(session: CommandSession):
- if hbook_switch:
- h_msg = session.current_arg.strip()
- if not h_msg:
- h_msg = session.get('message', prompt='要冲了吗?速发关键词')
- h_type = session.ctx['message_type']
- h_qq = session.ctx['user_id']
- header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36'}
- keyword = {'show':'title,titleen,tags','keyboard':h_msg}
- responce = await post_bytes('https://b-upp.com/search/', headers=header, data=keyword)
- responce = responce.decode()
- if '没有搜索到相关的内容' in responce:
- n_msg = '...似乎没有找到[{}]相关的本子呢'.format(h_msg)
- await session.send(message=n_msg)
- else:
- p = '<a href="(.*?)" target="_blank" title="(.*?)">'
- data = re.findall(p,responce)
- n = len(data)
- if h_type == 'group':
- limit = 3
- elif h_type == 'private':
- limit = 10
- if n > limit:
- n = limit
- msg = f'根据提供信息,已查询到{n}本关键词为[{h_msg}]的本子:'
- if h_type == 'group':
- msg = f'[CQ:at,qq={h_qq}]\n根据提供信息,已查询到{n}本关键词为[{h_msg}]的本子:'
- for i in range(n):
- msg0 = ('\n——————————\n本子链接:https://b-upp.com%s \n本子标题:%s '%(data[i]))
- msg += msg0
- await session.send(message=msg) \ No newline at end of file
diff --git a/ATRIbot/plugins/weather.py b/ATRIbot/plugins/weather.py
deleted file mode 100644
index 1819f68..0000000
--- a/ATRIbot/plugins/weather.py
+++ /dev/null
@@ -1,216 +0,0 @@
-# -*- coding:utf-8 -*-
-import json
-import requests
-from nonebot import on_command, CommandSession
-from AyaBot.plugins.module import google_translate
-
-API_URL = 'https://api.weatherbit.io/v2.0/current?city='
-API_URL_2 = '&key=1df2eb2951f3470a94cb323bb4647c18'
-API_URL_3 = 'https://www.tianqiapi.com/free/day?appid=36628957&appsecret=WKn4dtVg&city='
-
-
-LIST = """{city} 情况如下:
-截至: {ob_time}
-天气: {description}
-温度: {temp}
-风速: {wind_spd}
-风向: {wind_cdir}
-云覆盖率(%): {clouds}"""
-
-LIST_ALL = """{city} 详细情况如下:
-纬度(°): {lat}
-经度(°): {lon}
-日出时间(HH:MM): {sunrise}
-日落时间(HH:MM): {sunset}
-本地时区: {timezone}
-源站ID: {station}
-上次观察时间(YYYY-MM-DD HH:MM): {ob_time}
-当前周期小时(YYYY-MM-DD HH:MM): {datetime}
-压力(mb): {pres}
-海平面压力(mb): {slp}
-风速(m/s): {wind_spd}
-风向(°): {wind_dir}
-缩写风向: {wind_cdir}
-风向全称: {wind_cdir_full}
-温度(℃): {temp}
-感觉温度(℃): {app_temp}
-相对湿度(%): {rh}
-露点(℃): {dewpt}
-云覆盖率(%): {clouds}
-一天的一部分(d/n): {pod}
-现在天气: {description}
-可见度(km): {vis}
-液体当量沉淀速率(mm/hr): {precip}
-降雪(mm/h): {snow}
-紫外线指数(0-11+): {uv}
-空气质量指数[美国-EPA标准0-+500] [Clear Sky]: {aqi}
-漫射水平太阳辐照度(W/m^2) [Clear Sky]: {dhi}
-普通太阳直射辐射(W/m^2) [Clear Sky]: {dni}
-全球水平太阳辐照度(W/m^2): {ghi}
-估计的太阳辐射(W/m^2): {solar_rad}
-太阳斜角(°): {elev_angle}
-太阳时角(°): {h_angle}"""
-
-LIST_CN = """{city} 今日信息如下:
-更新时间:{time}
-天气情况:{wea}
-空气质量:{air}
-温度:
- 现在温度:{tem}
- 最高温度:{temday}
- 最低温度:{temnight}
-风向:{win}
-风力等级:{winspeed}
-风速:{winmeter}"""
-
-
-@on_command('weather', aliases=['天气'], only_to_me=False)
-async def weather(session: CommandSession):
- cy_ct = session.get('weather', prompt='输入的信息似乎出问题了呢...例:天气 CN 北京 或 天气 JP 东京')
- ms = cy_ct.split(' ')
- try:
- country = ms[0]
- city = ms[1]
- re_msg = google_translate.translate(city[:4999], to='en', source='zh-CN')
- URL = API_URL + re_msg[0] + ',' + country + API_URL_2
- # print(URL)
- res = requests.get(URL)
- res.encoding = 'utf-8'
- html = res.text
- wt = json.loads(html)
- await session.send(LIST.format(
- city=wt["data"][0]["city_name"],
- ob_time=wt["data"][0]["ob_time"],
- description=wt["data"][0]["weather"]["description"],
- temp=wt["data"][0]["temp"],
- wind_spd=wt["data"][0]["wind_spd"],
- wind_cdir=wt["data"][0]["wind_cdir"],
- clouds=wt["data"][0]["clouds"],
- )
- )
- except:
- print('error')
- await session.send('搜索似乎出问题了呢...请重试')
-
-@on_command('wtlist', aliases=['天气详细'])
-async def wtlist(session: CommandSession):
- cy_ct = session.get('wtlist', prompt='输入的信息似乎出问题了呢...例:天气 CN 北京 或 天气 JP 东京')
- ms = cy_ct.split(' ')
- try:
- country = ms[0]
- city = ms[1]
- re_msg = google_translate.translate(city[:4999], to='en', source='zh-CN')
- URL = API_URL + re_msg[0] + ',' + country + API_URL_2
- # print(URL)
- res = requests.get(URL)
- res.encoding = 'utf-8'
- html = res.text
- wt = json.loads(html)
- await session.send(LIST_ALL.format(
- rh=wt["data"][0]["rh"],
- pod=wt["data"][0]["pod"],
- lon=wt["data"][0]["lon"],
- pres=wt["data"][0]["pres"],
- timezone=wt["data"][0]["timezone"],
- ob_time=wt["data"][0]["ob_time"],
- clouds=wt["data"][0]["clouds"],
- solar_rad=wt["data"][0]["solar_rad"],
- city=wt["data"][0]["city_name"],
- wind_spd=wt["data"][0]["wind_spd"],
- last_ob_time=wt["data"][0]["last_ob_time"],
- wind_cdir_full=wt["data"][0]["wind_cdir_full"],
- wind_cdir=wt["data"][0]["wind_cdir"],
- temp=wt["data"][0]["temp"],
- slp=wt["data"][0]["slp"],
- vis=wt["data"][0]["vis"],
- h_angle=wt["data"][0]["h_angle"],
- sunset=wt["data"][0]["sunset"],
- dni=wt["data"][0]["dni"],
- dewpt=wt["data"][0]["dewpt"],
- snow=wt["data"][0]["snow"],
- uv=wt["data"][0]["uv"],
- precip=wt["data"][0]["precip"],
- wind_dir=wt["data"][0]["wind_dir"],
- sunrise=wt["data"][0]["sunrise"],
- ghi=wt["data"][0]["ghi"],
- dhi=wt["data"][0]["dhi"],
- aqi=wt["data"][0]["aqi"],
- lat=wt["data"][0]["lat"],
- description=wt["data"][0]["weather"]["description"],
- datetime=wt["data"][0]["datetime"],
- station=wt["data"][0]["station"],
- elev_angle=wt["data"][0]["elev_angle"],
- app_temp=wt["data"][0]["app_temp"],
- )
- )
- except:
- await session.send('搜索似乎出问题了呢...请重试')
-
-
-@on_command('weathercn', aliases=['国内天气详细'], only_to_me=False)
-async def weathercn(session: CommandSession):
- city = session.get('weathercn', prompt='输入格式似乎有问题呢...例:国内天气详细 北京')
- ms = city.split(' ')
- try:
- msg = ms[0]
- print(msg)
- res = API_URL_3 + msg
- print(res)
- res1 = requests.get(res)
- res1.encoding = 'utf-8'
- html = res1.text
- wt = json.loads(html)
- await session.send(LIST_CN.format(
- city=wt["city"],
- time=wt["update_time"],
- wea=wt["wea"],
- tem=wt["tem"],
- temday=wt["tem_day"],
- temnight=wt["tem_night"],
- win=wt["win"],
- winspeed=wt["win_speed"],
- winmeter=wt["win_meter"],
- air=wt["air"]
- )
- )
- except:
- await session.send('获取数据时出问题,请尝试发送:天气')
- return
-
-
-
-async def _(session: CommandSession):
- stripped_arg = session.current_arg_text.strip()
- if session.is_first_run:
- if stripped_arg:
- session.state['weather'] = stripped_arg
- return
-
- if not stripped_arg:
- session.pause('要查询的城市不能为空,请重新输入')
- session.state[session.current_key] = stripped_arg
-
-async def _(session: CommandSession):
- stripped_arg = session.current_arg_text.strip()
- if session.is_first_run:
- if stripped_arg:
- session.state['wtlist'] = stripped_arg
- return
-
- if not stripped_arg:
- session.pause('要查询的城市不能为空,请重新输入')
- session.state[session.current_key] = stripped_arg
-
-async def _(session: CommandSession):
- stripped_arg = session.current_arg_text.strip()
- if session.is_first_run:
- if stripped_arg:
- session.state['weathercn'] = stripped_arg
- return
-
- if not stripped_arg:
- session.pause('要查询的城市不能为空,请重新输入')
- session.state[session.current_key] = stripped_arg
diff --git a/ATRIbot/plugins/welcome.py b/ATRIbot/plugins/welcome.py
deleted file mode 100644
index da0a4c3..0000000
--- a/ATRIbot/plugins/welcome.py
+++ /dev/null
@@ -1,89 +0,0 @@
-import nonebot
-from nonebot import on_command, on_notice
-from nonebot import CommandSession
-from nonebot.notice_request import NoticeSession, RequestSession
-from nonebot.plugin import on_request
-from aiocqhttp.exceptions import ActionFailed
-
-bot = nonebot.get_bot()
-master = bot.config.SUPERUSERS
-
-
-@on_notice('group_increase')
-async def _(session: NoticeSession):
- q = session.event.user_id
- me = session.event.self_id
-
- if q == me :
- await session.send('在下アトリ,今后请多指教呐❤')
- else:
- await session.send(f'ねえ❤...是新人欸!\nここでは遠慮はいらないのだからね❤')
-
-@on_notice('group_decrease')
-async def _(session: NoticeSession):
- q = session.event.user_id
- qm = session.event.operator_id
-
- if qm == q:
- inf = await bot.get_stranger_info(user_id = q)
-
- name = inf['nickname']
-
- await session.send(f'ねえ...{name}({q}) 跑了...')
-
-@on_notice('firend_add')
-async def _(session: NoticeSession):
- u = session.event.user_id
- await bot.send_private_msg(self_id = session.self_id, user_id = u, message=f'有人来加我啦!\n{u}')
-
-
-@on_request('group')
-async def bot_request(session: RequestSession):
- g = session.event.group_id
- u = session.event.user_id
- mt = master[0]
- print(mt)
-
- if session.event.sub_type == 'invite':
-
- if welcome_switch:
-
- await session.bot.send_private_msg(self_id = session.self_id, user_id = u, message='嗯哼?想邀请吾辈入群嘛,既然这样,那吾辈来了呐。\n作者联系方式:\nhttps://lolihub.icu/#/about')
-
- await session.bot.send_private_msg(self_id = session.self_id, user_id = mt, message=f'吾辈收到一个新邀请:\n裙: {g}\n邀请人: {u}')
-
- try:
- await session.approve()
- except ActionFailed as e:
- print(e.retcode)
-
- else:
- await session.bot.send_private_msg(self_id = session.self_id, user_id = u, message='主人告诉吾辈不能同意任何人的请求呢...\n作者联系方式:\nhttps://lolihub.icu/#/about')
-
- await session.bot.send_private_msg(self_id = session.self_id, user_id = mt, message=f'吾辈收到一个新的邀请请求,由于主人并未告知吾辈可以邀请,故做出拒绝的回应。\n裙: {g}\n邀请人: {u}')
-
-
-welcome_switch = True
-@on_command('welcome_switch', aliases=['开启', '关闭'], only_to_me=False)
-async def _(session: CommandSession):
- if session.event.user_id in master:
- command = session.event.raw_message.split(' ', 1)
- switch = command[0]
- com = command[1]
- global welcome_switch
- if switch == '开启':
- if com == '邀请':
- welcome_switch = True
- else:
- pass
-
- elif switch == '关闭':
- if com == '邀请':
- welcome_switch = False
- else:
- pass
-
- await session.send('完成')
-
- else:
- await session.send('恁哪位?')
diff --git a/config.py b/config.py
new file mode 100644
index 0000000..d1e4198
--- /dev/null
+++ b/config.py
@@ -0,0 +1,111 @@
+# -*- coding:utf-8 -*-
+import os
+import time
+from nonebot.default_config import *
+
+#配置监听的 IP 和 端口
+HOST = '127.0.0.1'
+PORT = 8080
+
+#机器人的主人(QQ号)
+SUPERUSERS = [1172294279]
+
+#机器人名称,替代 @ 和 命令开头
+NICKNAME = {}
+
+#自定义命令开头
+COMMAND_START = {}
+
+#API url:https://api.lolicon.app/#/setu
+LOLICONAPI = "574300555ee56eb2be5e03"
+
+#API url:https://ai.qq.com/
+TX_APP_ID = "2149641190"
+TX_APPKEY = "Au8cFoAPWyGJBGpv"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#以下请勿删除
+
+print("正在导入记忆模块ing...")
+
+if SUPERUSERS:
+ print("主人已识别!")
+else:
+ print("ATRI无法从记忆储蓄模块找到主人...如需帮助,请查看安装手册")
+ time.sleep(1)
+ print("仿生人没有主人是无法继续存在的!将于三秒后执行休眠...")
+ time.sleep(3)
+ os._exit(0)
+
+if NICKNAME:
+ print("对ATRI的特别称呼已加载!")
+else:
+ print("ATRI没特别的小昵称嘛...彳亍8")
+ print("既然这样那叫我ATRI就好力!")
+ NICKNAME = {'ATRI', 'アトリ'}
+ time.sleep(1)
+ wait = input("是否继续: Y/N\n")
+ if wait == "Y" or 'y':
+ pass
+ else:
+ os._exit(0)
+
+if COMMAND_START:
+ print("呼叫指令已加载!")
+else:
+ print("如果没指定特别呼叫ATRI的手势的话,直接称呼我名称吧!")
+ COMMAND_START = {'ATRI', ''}
+ time.sleep(1)
+ wait = input("是否继续: Y/N\n")
+ if wait == "Y" or 'y':
+ pass
+ else:
+ os._exit(0)
+
+if LOLICONAPI:
+ print("涩图大门的钥匙已到手!")
+else:
+ print("似乎没拿到大门的钥匙呢...如需帮助,请查看安装手册")
+ print("...跳过!")
+ time.sleep(1)
+ wait = input("是否继续: Y/N\n")
+ if wait == "Y" or 'y':
+ pass
+ else:
+ os._exit(0)
+
+if TX_APP_ID:
+ print("TX知识库识别码已加载!")
+else:
+ print("ATRI无法在记忆储蓄模块找到TX知识库识别码呢...如需帮助,请查看安装手册")
+ print("...跳过!")
+ time.sleep(1)
+ wait = input("是否继续: Y/N\n")
+ if wait == "Y" or 'y':
+ pass
+ else:
+ os._exit(0)
+
+if TX_APPKEY:
+ print("TX识别密匙已加载!")
+else:
+ print("ATRI无法在记忆模块中找到TX识别密匙呢...如需帮助,请查看安装手册")
+ time.sleep(1)
+ wait = input("是否继续: Y/N\n")
+ if wait == "Y" or 'y':
+ pass
+ else:
+ os._exit(0) \ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index a57ffd0..56fa24a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,4 @@
-opencv3>=4.0.0.21
-nonebot>=1.6.0
-aiohttp>=2.3.10
-aiocqhttp>=1.2.5
-demjson>=2.2.4
-requests>=2.23.0
+nonebot[scheduler]~=1.6.0
+aiohttp>=3.6
+requests>=2.24
+orjson>=3.3.0 \ No newline at end of file
diff --git a/run.py b/run.py
index 431762a..0384a2e 100644
--- a/run.py
+++ b/run.py
@@ -1,24 +1,21 @@
# -*- coding:utf-8 -*-
import time
COPYRIGHT = (
- r"""ATRI | アトリ
-Copyright © 2018-2020 Kyomotoi,All Rights Reserved
-Project: https://github.com/Kyomotoi/Aya
-Blog: lolihub.icu
-==================================================="""
+ r"""====================ATRI | アトリ====================
+* CoolQ + NoneBot + Python
+* Copyright © 2018-2020 Kyomotoi,All Rights Reserved
+* Project: https://github.com/Kyomotoi/ATRI
+* Blog: lolihub.icu
+====================================================="""
)
print(COPYRIGHT)
-time.sleep(0)
+time.sleep(2)
+import config # type: ignore
+time.sleep(2)
+print("ATRI正在苏醒...")
-from ATRIbot import config
-time.sleep(0)
-print("开始执行主程序...RCnb!")
-
-
-time.sleep(0)
from os import path
-from ATRIbot.plugins import module
if __name__ == '__main__':
@@ -26,6 +23,6 @@ if __name__ == '__main__':
nonebot.init(config)
nonebot.load_builtin_plugins()
nonebot.load_plugins(
- path.join(path.dirname(__file__), 'ATRIbot', 'plugins'),
- 'ATRIbot.plugins')
+ path.join(path.dirname(__file__), 'ATRI', 'plugins'),
+ 'ATRI.plugins')
nonebot.run() \ No newline at end of file