From 9c45984817d1c1369496ee10bb49c00feee40cab Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Wed, 14 Apr 2021 20:40:01 +0800 Subject: [PATCH 01/17] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Arch Linux查包 --- worker/pkg.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 worker/pkg.py diff --git a/worker/pkg.py b/worker/pkg.py new file mode 100644 index 0000000..a523df2 --- /dev/null +++ b/worker/pkg.py @@ -0,0 +1,49 @@ +import requests + +from zzcore import StdAns + + +class Ans(StdAns): + #AllowGroup = [874769998,596678277,7343311] + + def GETMSG(self): + if len(self.parms) < 1: + msg = '请输入包名 如:/pkg linux' + return msg + elif self.parms[1] == 'help': + msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ + 'Community, Community-Testing仓库的软件' + return msg + else: + req = requests.get( + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() + if req['results'] == []: + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + # print(req) + if req['resultcount'] > 0: + name = '包名:' + req['results'][0]['Name'] + # pkgname = req['results'][0]['pkgname'] + version = '版本:' + req['results'][0]['Version'] + description = '描述:' + req['results'][0]['Description'] + maintainer = '维护:' + req['results'][0]['Maintainer'] + numvotes = '投票:' + str(req['results'][0]['NumVotes']) + + url = req['results'][0]['URL'] + if url is None: + url = '链接:None' + else: + url = '链接:' + url + msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ + + '\n' + numvotes + '\n' + url + '\n' + return msg + else: + repo = req['results'][0]['repo'] + pkgname = req['results'][0]['pkgname'] + pkgver = req['results'][0]['pkgver'] + pkgdesc = req['results'][0]['pkgdesc'] + url = req['results'][0]['url'] + # return repo,pkgname,pkgver,pkgdesc,url + # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n' + return msg + From 786ebd0d47d225c12c337501831c54d30a938700 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Wed, 14 Apr 2021 20:41:56 +0800 Subject: [PATCH 02/17] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 下载网易云音乐和舔狗日记 --- worker/song.py | 29 +++++++++++++++++++++++++++++ worker/tiangou.py | 20 ++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 worker/song.py create mode 100644 worker/tiangou.py diff --git a/worker/song.py b/worker/song.py new file mode 100644 index 0000000..02e4368 --- /dev/null +++ b/worker/song.py @@ -0,0 +1,29 @@ +from zzcore import StdAns +import requests +import urllib3 +urllib3.disable_warnings() + +class Ans(StdAns): + def GETMSG(self): + # self.parms[] + if len(self.parms) < 2: + return '不加参数是坏文明!' + url = 'https://music.xmengnet.cn/api' + + try: + # print(self.parms[1]) + getid = requests.get(url + '/search?keywords=' + self.raw_msg['raw_message'][5:], verify=False).json() + id = getid['result']['songs'][0]['id'] + # print(id) + downurl = requests.get(url + '/song/url?id=' + str(id), verify=False).json() + # print(downurl) + down = downurl['data'][0]['url'] + song = getid['result']['songs'][0]['name'] + '-' \ + + getid['result']['songs'][0]['artists'][0]['name'] + msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" + return msg+song+'的下载地址为:'+down + # msg = f'[CQ:music,type=163,id={id}]' + except Exception as e: + print(e) + msg = '什么东西坏掉了,大概是网易云吧...不可能是咱!' + return msg diff --git a/worker/tiangou.py b/worker/tiangou.py new file mode 100644 index 0000000..06e2193 --- /dev/null +++ b/worker/tiangou.py @@ -0,0 +1,20 @@ +from zzcore import StdAns, mysakuya +import requests + +class Ans(StdAns): + #AllowGroup = [874769998,596678277] + def GETMSG(self): + msg = f"[CQ:reply,id={self.raw_msg['message_id']}]" + try: + msg += tiangou() + except: + msg += '可能是api坏掉了,可不是咱!' + return msg + +def tiangou(): + r = requests.get(url='https://api.muxiaoguo.cn/api/tiangourj').json() + # print(r) + msg = None + if r['msg'] == 'success': + msg = r['data']['comment'] + return msg From 8bc6072ff357045faf447d01cf724b909db35a47 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 17 Apr 2021 13:13:22 +0800 Subject: [PATCH 03/17] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加‘笑死’ --- worker/xs.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 worker/xs.py diff --git a/worker/xs.py b/worker/xs.py new file mode 100644 index 0000000..4830669 --- /dev/null +++ b/worker/xs.py @@ -0,0 +1,16 @@ +from zzcore import StdAns, mysakuya +import requests + +class Ans(StdAns): + def GETMSG(self): + msg='' + try: + msg += xs() + except: + msg += '可能是机器人笑死了!' + return msg + +def xs(): + url = "http://api-x.aya1.xyz:6/" + text = requests.get(url=url).text + return text From 5149940c043e172c1aac2ce4bcc401d7eabf6d0c Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sun, 18 Apr 2021 10:36:30 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Kemomimi=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/k.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 worker/k.py diff --git a/worker/k.py b/worker/k.py new file mode 100644 index 0000000..4aac6e9 --- /dev/null +++ b/worker/k.py @@ -0,0 +1,38 @@ +from zzcore import StdAns +import requests +class Ans(StdAns): + def GETMSG(self): + try: + picurl,status=Kemomimi() + except: + print() + msg = '' + if status==200: + # 显示图标 + # msg += f'[CQ:xml,data=' \ + # f'' \ + # f'来喽!!' \ + # f'' \ + # f'' \ + # f']' + msg = f'[CQ:xml,data=\n' \ + f'\n' \ + f'ケモミミちゃん:Kemomimi酱来了~\n' \ + f' ' \ + f']' + # 显示卡片图片 + # msg += f'[CQ:cardimage,file={picurl},maxheight=200]' + else: + msg+='图库丢了哦,不是咱的问题呀!' + return msg + + +def Kemomimi(): + url="http://api.aya1.xyz:6/random.php" + # 获取重定向后的地址 + imgurl=requests.get(url).url + status = requests.get(url).status_code + # print(imgurl)\ + return imgurl,status From c8fa6ed313e35fc95cff6ff2d18ca9c0a181f255 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 8 May 2021 19:27:03 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 69 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index a523df2..ffc664e 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -1,10 +1,10 @@ import requests - +import time from zzcore import StdAns class Ans(StdAns): - #AllowGroup = [874769998,596678277,7343311] + # AllowGroup = [874769998,596678277,7343311] def GETMSG(self): if len(self.parms) < 1: @@ -27,14 +27,16 @@ class Ans(StdAns): description = '描述:' + req['results'][0]['Description'] maintainer = '维护:' + req['results'][0]['Maintainer'] numvotes = '投票:' + str(req['results'][0]['NumVotes']) - + updatetime = req['results'][0]['LastModified'] + updatetime = time.localtime(int(updatetime)) + updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) url = req['results'][0]['URL'] if url is None: url = '链接:None' else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n' + url + '\n' + + '\n' + numvotes + '\n更新日期' + updatetime[0:10] + '\n' + url + '\n' return msg else: repo = req['results'][0]['repo'] @@ -42,8 +44,65 @@ class Ans(StdAns): pkgver = req['results'][0]['pkgver'] pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] + updatetime = req['results'][0]['last_update'] + updatetime = updatetime.replace('T', ' ') + updatetime = updatetime[0:16] # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n' + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n更新日期:' \ + + updatetime[0:10] + '\n' + '\n上游:' + url return msg +import requests +import time +from zzcore import StdAns + +class Ans(StdAns): + # AllowGroup = [874769998,596678277,7343311] + + def GETMSG(self): + if len(self.parms) < 1: + msg = '请输入包名 如:/pkg linux' + return msg + elif self.parms[1] == 'help': + msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ + 'Community, Community-Testing仓库的软件' + return msg + else: + req = requests.get( + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() + if req['results'] == []: + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + # print(req) + if req['resultcount'] > 0: + name = '包名:' + req['results'][0]['Name'] + # pkgname = req['results'][0]['pkgname'] + version = '版本:' + req['results'][0]['Version'] + description = '描述:' + req['results'][0]['Description'] + maintainer = '维护:' + req['results'][0]['Maintainer'] + numvotes = '投票:' + str(req['results'][0]['NumVotes']) + updatetime = req['results'][0]['LastModified'] + updatetime = time.localtime(int(updatetime)) + updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) + url = req['results'][0]['URL'] + if url is None: + url = '链接:None' + else: + url = '链接:' + url + msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ + + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url + '\n' + return msg + else: + repo = req['results'][0]['repo'] + pkgname = req['results'][0]['pkgname'] + pkgver = req['results'][0]['pkgver'] + pkgdesc = req['results'][0]['pkgdesc'] + url = req['results'][0]['url'] + updatetime = req['results'][0]['last_update'] + updatetime = updatetime.replace('T', ' ') + updatetime = updatetime[0:16] + # return repo,pkgname,pkgver,pkgdesc,url + # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n更新日期:' \ + + updatetime[0:10] + '\n上游:' + url + return msg From 47ef41636fbb971fa3bb54343abfbc00750486f8 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 8 May 2021 19:27:49 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E6=9F=A5=E8=AF=A2aur=E6=89=93=E5=8C=85?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/mner.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 worker/mner.py diff --git a/worker/mner.py b/worker/mner.py new file mode 100644 index 0000000..3f06d05 --- /dev/null +++ b/worker/mner.py @@ -0,0 +1,27 @@ +import requests + +from zzcore import StdAns + + +class Ans(StdAns): + def GETMSG(self): + if len(self.parms) < 2: + msg = '请输入包名 如:/mner yjun' + return msg + else: + msg = '' + req = requests.get( + url='https://aur.archlinux.org/rpc/?v=5&type=search&by=maintainer&arg=' + self.parms[1]).json() + count = req['resultcount'] + if count != 0: + msg += '工具人 ' + self.parms[1] + ' 打包了' + str(count) + '个软件\n' + soft='' + if count < 5: + # soft = list() + for i in range(count): + soft= req['results'][i]['Name'] + else: + for i in range(5): + soft+=req['results'][i]['Name']+'\n' + soft+='....' + return msg+soft From 949cc00d2a4d4e0d70b9dd441c50a8dd83799edf Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 8 May 2021 21:54:26 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index ffc664e..6c5f389 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -72,14 +72,17 @@ class Ans(StdAns): req = requests.get( url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] # pkgname = req['results'][0]['pkgname'] version = '版本:' + req['results'][0]['Version'] description = '描述:' + req['results'][0]['Description'] - maintainer = '维护:' + req['results'][0]['Maintainer'] + if req['results'][0]['Maintainer'] is None: + maintainer='' + else: + maintainer = '维护:' + req['results'][0]['Maintainer'] numvotes = '投票:' + str(req['results'][0]['NumVotes']) updatetime = req['results'][0]['LastModified'] updatetime = time.localtime(int(updatetime)) From 3ee7e80c609afee314f3d7328b7e0c769020e407 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sun, 9 May 2021 15:56:36 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/worker/pkg.py b/worker/pkg.py index 6c5f389..87047e4 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -73,6 +73,8 @@ class Ans(StdAns): url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() if req['results'] == []: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() + if req['resultcount']==0: + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] From a9c9845ddda6ceeba02eac50bca00beccaf6292f Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 15 May 2021 15:17:54 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E5=8E=BB=E9=99=A4x86=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 69 ++++----------------------------------------------- 1 file changed, 5 insertions(+), 64 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index 87047e4..93ca57c 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -16,7 +16,7 @@ class Ans(StdAns): return msg else: req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() if req['results'] == []: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) @@ -41,73 +41,14 @@ class Ans(StdAns): else: repo = req['results'][0]['repo'] pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver'] + pkgver = req['results'][0]['pkgver']+'\n' pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] updatetime = req['results'][0]['last_update'] updatetime = updatetime.replace('T', ' ') - updatetime = updatetime[0:16] + updatetime = updatetime[0:16]+'\n' # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n更新日期:' \ - + updatetime[0:10] + '\n' + '\n上游:' + url - return msg -import requests -import time -from zzcore import StdAns - - -class Ans(StdAns): - # AllowGroup = [874769998,596678277,7343311] - - def GETMSG(self): - if len(self.parms) < 1: - msg = '请输入包名 如:/pkg linux' - return msg - elif self.parms[1] == 'help': - msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ - 'Community, Community-Testing仓库的软件' - return msg - else: - req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() - if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() - if req['resultcount']==0: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() - # print(req) - if req['resultcount'] > 0: - name = '包名:' + req['results'][0]['Name'] - # pkgname = req['results'][0]['pkgname'] - version = '版本:' + req['results'][0]['Version'] - description = '描述:' + req['results'][0]['Description'] - if req['results'][0]['Maintainer'] is None: - maintainer='' - else: - maintainer = '维护:' + req['results'][0]['Maintainer'] - numvotes = '投票:' + str(req['results'][0]['NumVotes']) - updatetime = req['results'][0]['LastModified'] - updatetime = time.localtime(int(updatetime)) - updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) - url = req['results'][0]['URL'] - if url is None: - url = '链接:None' - else: - url = '链接:' + url - msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url + '\n' - return msg - else: - repo = req['results'][0]['repo'] - pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver'] - pkgdesc = req['results'][0]['pkgdesc'] - url = req['results'][0]['url'] - updatetime = req['results'][0]['last_update'] - updatetime = updatetime.replace('T', ' ') - updatetime = updatetime[0:16] - # return repo,pkgname,pkgver,pkgdesc,url - # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n更新日期:' \ - + updatetime[0:10] + '\n上游:' + url + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ + + updatetime[0:10] + '\n上游:' + url return msg From 4e5c765d06d065793e7c74a4d4f3c4838ae10d53 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 15 May 2021 18:59:06 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index 93ca57c..6e800dc 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -18,14 +18,14 @@ class Ans(StdAns): req = requests.get( url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] # pkgname = req['results'][0]['pkgname'] version = '版本:' + req['results'][0]['Version'] description = '描述:' + req['results'][0]['Description'] - maintainer = '维护:' + req['results'][0]['Maintainer'] + maintainer = '维护:' + str(req['results'][0]['Maintainer']) numvotes = '投票:' + str(req['results'][0]['NumVotes']) updatetime = req['results'][0]['LastModified'] updatetime = time.localtime(int(updatetime)) From 39a76b799207e6e5e022306b0d0e1858573dc952 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Wed, 19 May 2021 18:05:30 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index 6e800dc..dae8c09 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -1,10 +1,10 @@ import requests -import time + from zzcore import StdAns class Ans(StdAns): - # AllowGroup = [874769998,596678277,7343311] + #AllowGroup = [874769998,596678277,7343311] def GETMSG(self): if len(self.parms) < 1: @@ -16,39 +16,36 @@ class Ans(StdAns): return msg else: req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + if req['resultcount'] == 0: + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) if req['resultcount'] > 0: name = '包名:' + req['results'][0]['Name'] # pkgname = req['results'][0]['pkgname'] version = '版本:' + req['results'][0]['Version'] description = '描述:' + req['results'][0]['Description'] - maintainer = '维护:' + str(req['results'][0]['Maintainer']) + maintainer = '维护:' + req['results'][0]['Maintainer'] numvotes = '投票:' + str(req['results'][0]['NumVotes']) - updatetime = req['results'][0]['LastModified'] - updatetime = time.localtime(int(updatetime)) - updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) + url = req['results'][0]['URL'] if url is None: url = '链接:None' else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期' + updatetime[0:10] + '\n' + url + '\n' + + '\n' + numvotes + '\n' + url + '\n' return msg else: repo = req['results'][0]['repo'] pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver']+'\n' + pkgver = req['results'][0]['pkgver'] pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] - updatetime = req['results'][0]['last_update'] - updatetime = updatetime.replace('T', ' ') - updatetime = updatetime[0:16]+'\n' # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ - + updatetime[0:10] + '\n上游:' + url + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n' return msg + From da6307064c0da4e22de5fce57062881c0bcf9edd Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sat, 22 May 2021 10:43:26 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8B=A5=E5=B9=B2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index dae8c09..e4ce432 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -1,10 +1,10 @@ import requests - +import time from zzcore import StdAns class Ans(StdAns): - #AllowGroup = [874769998,596678277,7343311] + # AllowGroup = [874769998,596678277,7343311] def GETMSG(self): if len(self.parms) < 1: @@ -16,9 +16,9 @@ class Ans(StdAns): return msg else: req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json() + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() if req['results'] == []: - req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() + req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() if req['resultcount'] == 0: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() # print(req) @@ -27,25 +27,30 @@ class Ans(StdAns): # pkgname = req['results'][0]['pkgname'] version = '版本:' + req['results'][0]['Version'] description = '描述:' + req['results'][0]['Description'] - maintainer = '维护:' + req['results'][0]['Maintainer'] + maintainer = '维护:' + str(req['results'][0]['Maintainer']) numvotes = '投票:' + str(req['results'][0]['NumVotes']) - + updatetime = req['results'][0]['LastModified'] + updatetime = time.localtime(int(updatetime)) + updatetime = time.strftime("%Y-%m-%d %H:%M:%S", updatetime) url = req['results'][0]['URL'] if url is None: url = '链接:None' else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n' + url + '\n' + + '\n' + numvotes + '\n更新日期' + updatetime[0:10] + '\n' + url return msg else: repo = req['results'][0]['repo'] pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver'] + pkgver = req['results'][0]['pkgver']+'\n' pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] + updatetime = req['results'][0]['last_update'] + updatetime = updatetime.replace('T', ' ') + updatetime = updatetime[0:16]+'\n' # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') - msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n' + msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ + + updatetime[0:10] + '\n上游:' + url return msg - From 4712ce4e87f2638b06634dd02c1b996e15607860 Mon Sep 17 00:00:00 2001 From: xmengnet <51263043+xmengnet@users.noreply.github.com> Date: Sun, 30 May 2021 12:46:25 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index e4ce432..df5fe2f 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -7,12 +7,12 @@ class Ans(StdAns): # AllowGroup = [874769998,596678277,7343311] def GETMSG(self): - if len(self.parms) < 1: + if len(self.parms) <= 1: msg = '请输入包名 如:/pkg linux' return msg - elif self.parms[1] == 'help': + elif self.parms[1] == 'help' : msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ - 'Community, Community-Testing仓库的软件' + 'Community, Community-Testing仓库以及AUR的软件' return msg else: req = requests.get( @@ -38,7 +38,7 @@ class Ans(StdAns): else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期' + updatetime[0:10] + '\n' + url + + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url return msg else: repo = req['results'][0]['repo'] @@ -52,5 +52,5 @@ class Ans(StdAns): # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ - + updatetime[0:10] + '\n上游:' + url + + updatetime + '上游:' + url return msg From 17f3365e6feeac6bcee6350c669302e0fa306679 Mon Sep 17 00:00:00 2001 From: xmengnet <794508986@qq.com> Date: Mon, 31 May 2021 20:41:09 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E4=BB=93=E5=BA=93=E8=BD=AF=E4=BB=B6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/pkg.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/worker/pkg.py b/worker/pkg.py index df5fe2f..4cca9ad 100644 --- a/worker/pkg.py +++ b/worker/pkg.py @@ -7,17 +7,23 @@ class Ans(StdAns): # AllowGroup = [874769998,596678277,7343311] def GETMSG(self): - if len(self.parms) <= 1: - msg = '请输入包名 如:/pkg linux' + if len(self.parms) < 2: + msg = '请输入包名 如:/pkg linux testing 查询 Testing 的 linux 软件' return msg - elif self.parms[1] == 'help' : + elif self.parms[1] == 'help': msg = '使用 /pkg 包名 查询Core, Extra, Testing, Multilib, Multilib-Testing, ' \ - 'Community, Community-Testing仓库以及AUR的软件' + 'Community, Community-Testing仓库以及AUR的软件 ' return msg else: + repo = str() + try: + if len(self.parms) > 1: + repo = '&repo=' + self.parms[2].capitalize() + except: + print('repo empty') req = requests.get( - url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] ).json() - if req['results'] == []: + url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + repo).json() + if not req['results']: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json() if req['resultcount'] == 0: req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json() @@ -38,19 +44,19 @@ class Ans(StdAns): else: url = '链接:' + url msg = '仓库:AUR\n' + name + '\n' + version + '\n' + description + '\n' + maintainer \ - + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url + + '\n' + numvotes + '\n更新日期:' + updatetime + '\n' + url return msg else: repo = req['results'][0]['repo'] pkgname = req['results'][0]['pkgname'] - pkgver = req['results'][0]['pkgver']+'\n' + pkgver = req['results'][0]['pkgver'] + '\n' pkgdesc = req['results'][0]['pkgdesc'] url = req['results'][0]['url'] updatetime = req['results'][0]['last_update'] updatetime = updatetime.replace('T', ' ') - updatetime = updatetime[0:16]+'\n' + updatetime = updatetime[0:16] + '\n' # return repo,pkgname,pkgver,pkgdesc,url # print('仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '\n描述:' + pkgdesc + '\n上游:' + url + '\n') msg = '仓库:' + repo + '\n包名:' + pkgname + '\n版本:' + pkgver + '描述:' + pkgdesc + '\n更新日期:' \ - + updatetime + '上游:' + url + + updatetime + '上游:' + url return msg From b625b19c46ee4341861a46e565922e6c69cfe409 Mon Sep 17 00:00:00 2001 From: xmengnet <794508986@qq.com> Date: Mon, 7 Jun 2021 20:19:42 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/lsp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index bd7b688..a3d5d38 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -5,8 +5,7 @@ from config import LOLIKEYS class Ans(StdAns): - AllowGroup = [973510746, 805197917, 343700338, 125733077, 1084566280, - 920863253, 798595664, 655057127, 196268763, 247022495, 474907856, 940333876] + AllowGroup = [874769998,596678277,794290657,204097403] def GETMSG(self): @@ -51,6 +50,7 @@ def getsetu(apikey, keyword=''): url = 'https://api.lolicon.app/setu/' params = { 'apikey': apikey, + 'r18': 0, } if keyword != '': params['keyword'] = keyword @@ -66,7 +66,7 @@ def getsetu(apikey, keyword=''): #h, m = divmod(m, 60) #quota_min_ttl = f'{h}时{m}分{s}秒' if resp['code'] == 0: - quota = resp['quota'] + quota = resp['count'] try: picurl = resp['data'][0]['url'] code = 0 From ef5587b2e21cc1adb87f7a00892c7743cfad2ad5 Mon Sep 17 00:00:00 2001 From: xmengnet <794508986@qq.com> Date: Fri, 11 Jun 2021 09:06:40 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=EF=BC=8C=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/k.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/worker/k.py b/worker/k.py index 4aac6e9..eb0e9c1 100644 --- a/worker/k.py +++ b/worker/k.py @@ -1,13 +1,15 @@ from zzcore import StdAns import requests + + class Ans(StdAns): def GETMSG(self): try: - picurl,status=Kemomimi() + picurl, status = Kemomimi() except: print() msg = '' - if status==200: + if status == 200: # 显示图标 # msg += f'[CQ:xml,data=' \ # f'' \ @@ -25,14 +27,14 @@ class Ans(StdAns): # 显示卡片图片 # msg += f'[CQ:cardimage,file={picurl},maxheight=200]' else: - msg+='图库丢了哦,不是咱的问题呀!' + msg += '图库丢了哦,不是咱的问题呀!' return msg def Kemomimi(): - url="http://api.aya1.xyz:6/random.php" + url = "http://api.aya1.xyz:6/random0.php" # 获取重定向后的地址 - imgurl=requests.get(url).url + imgurl = requests.get(url).url status = requests.get(url).status_code # print(imgurl)\ - return imgurl,status + return imgurl, status From aacf0cde91222a45b1111511e07368c590168a22 Mon Sep 17 00:00:00 2001 From: xmengnet <794508986@qq.com> Date: Mon, 14 Jun 2021 13:50:03 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E5=B0=86=E5=9B=BE=E7=89=87=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=E9=97=AA=E7=85=A7=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/lsp.py | 76 ++++++++++++--------------------------------------- 1 file changed, 18 insertions(+), 58 deletions(-) diff --git a/worker/lsp.py b/worker/lsp.py index a3d5d38..5cbba8f 100644 --- a/worker/lsp.py +++ b/worker/lsp.py @@ -5,77 +5,37 @@ from config import LOLIKEYS class Ans(StdAns): - AllowGroup = [874769998,596678277,794290657,204097403] + AllowGroup = [874769998, 596678277, 794290657, 204097403] def GETMSG(self): - - keys = LOLIKEYS - - try: - nowkey = int(self.DATAGET()['nowkey']) - except: - nowkey = 0 - - if len(self.parms) < 2: - keyword = '' + if len(self.parms) == 1: + code, picurl = getsetu() else: keyword = self.parms[1] if mysakuya(self, keyword) == False: return "不许你们看咲夜的涩图!!" - - code, quota, picurl = getsetu(keys[nowkey], keyword) - - msg = '' - if code == -1 or code == -2: - msg += f'>_< 天啦喽,loli 不见了 Code:{code}' - elif code == 3: - msg += '咱没查到,也有可能是Pixiv坏掉惹' - elif code == 0: - if len(self.parms) < 2 or (len(self.parms) > 2 and self.parms[2] == 'p'): - msg += f'[CQ:image,file={picurl}]' - else: - msg += f'[CQ:reply,id={self.mid}]咱帮你🔍{keyword}找到了这个\n{picurl}' - - if quota == 0: - nowkey = (nowkey+1) % (len(keys)) - if code == 429: - msg += f'>_< 已经没有 loli 啦,帮你换到了key{nowkey},再试一下吧' - else: - msg += f'额度用光了,下次将使用 key{nowkey}' - self.DATASET({'nowkey': nowkey}) - return msg + code, picurl = getsetu(keyword) + if code == 0: + return f'[CQ:reply,id={self.mid}][CQ:image,file={picurl},type=flash]' + else: + return f'[CQ:reply,id={self.mid}] 什么东西出错了,code:{code}' -def getsetu(apikey, keyword=''): +def getsetu(keyword=''): url = 'https://api.lolicon.app/setu/' params = { - 'apikey': apikey, - 'r18': 0, + 'apikey': LOLIKEYS, + 'keyword': keyword, + 'r18': 0 } - if keyword != '': - params['keyword'] = keyword try: - resp = requests.get(url=url, params=params).json() + resp = requests.get(url=url, params=params, timeout=5).json() except: - return -1, -1, '' + return 500, '' - #quota = str(resp['quota']) - #seconds = resp['quota_min_ttl'] - #m, s = divmod(seconds, 60) - #h, m = divmod(m, 60) - #quota_min_ttl = f'{h}时{m}分{s}秒' + picurl = '' if resp['code'] == 0: - quota = resp['count'] - try: - picurl = resp['data'][0]['url'] - code = 0 - except: - picurl = '' - code = -3 - return code, quota, picurl - elif resp['code'] == 429: - return 429, 0, '' - else: - # print(resp['code']) - return -2, -1, '' + picurl = "https://r.zjuyk.site/" + resp['data'][0]['url'] + + return resp['code'], picurl