Skip to content

Commit

Permalink
add function: flag over avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
mikezom committed Jun 24, 2022
1 parent 03d81fb commit d84350b
Show file tree
Hide file tree
Showing 12 changed files with 199 additions and 59 deletions.
4 changes: 4 additions & 0 deletions config/function_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,9 @@
"随机塔菲": {
"name": "random_taffy",
"description": "随机播放sample来自塔菲按钮"
},
"国旗": {
"name": "avatar_flag",
"description": "给你的头像加一面国旗"
}
}
Binary file added data/avatar/flag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/avatar/result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/play/sine.silk
Binary file not shown.
Binary file modified data/play/sine.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion data/smzdm/smzdm.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"title": ["PLUS\u4f1a\u5458\uff1a\u7ebd\u5947 \u519c\u573a\u52a8\u7269\u4eff\u771f\u8f6f\u80f6\u6a21\u578b 12\u4ef6\u5957\u3010\u6536\u7eb3\u6876\u3011 36.9\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "SUPOR \u82cf\u6cca\u5c14 \u65b0\u84dd\u94bb\u7cfb\u5217 SF40FC973 \u5fae\u538b\u7535\u996d\u7172 4L 249\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff09", "\u767e\u4ebf\u8865\u8d34\uff1aApple \u82f9\u679c iPhone 13 Pro 5G\u667a\u80fd\u624b\u673a 128GB \u77f3\u58a8\u8272 6909\u5143\u5305\u90ae", "Apple \u82f9\u679c iPhone 13 Pro Max 5G\u667a\u80fd\u624b\u673a \u82cd\u5cad\u7eff 8079\u5143\u5305\u90ae", "88VIP\uff1a\u5c0f\u76ae \u5b9d\u5b9d\u9ad8\u94c1\u6c34\u679c\u8c37\u7269\u7c89 2\u6bb5 160g 46.89\u5143\uff08\u9700\u4e702\u4ef6\uff0c\u517193.78\u5143\u5305\u90ae\uff0c\u8fd410\u5143\u732b\u5361\u540e\uff0c\u53cc\u91cd\u4f18\u60e0\uff09", "\u6709\u5238\u7684\u4e0a\uff1aPower28 \u6d3b\u529b28 \u6d17\u8863\u6db2 1.5kg*2\u888b 8.9\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "PLUS\u4f1a\u5458\uff1aSONY \u7d22\u5c3c FE 24-105mm F4 G OSS \u6807\u51c6\u53d8\u7126\u955c\u5934 \u7d22\u5c3cFE\u5361\u53e3 77mm 6999\u5143\u5305\u90ae", "\u6709\u5238\u7684\u4e0a\uff1aBEIBIRUN \u8d1d\u6bd4\u6da6 \u53a8\u623f\u6e7f\u5dfe 60\u62bd*5\u5305 10.9\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "Maryya \u7f8e\u4e3d\u96c5 \u98df\u54c1\u5bc6\u5c01\u888b \u5c0f\u53f7+\u4e2d\u53f7 11.26\u5143\uff08\u9700\u4e703\u4ef6\uff0c\u517133.78\u5143\uff0c\u53cc\u91cd\u4f18\u60e0\uff09", "HONOR \u8363\u8000 Play5 \u6d3b\u529b\u7248 5G\u667a\u80fd\u624b\u673a 8GB+256GB 1289\u5143\u5305\u90ae", "\u4eb2\u5b50\u4f1a\u5458\uff1aFUJIFILM \u5bcc\u58eb instax mini \u76f8\u7eb8 86*54mm \u767d\u8fb9 20\u5f20 62\u5143\u5305\u90ae\uff08\u9700\u4e702\u4ef6\uff0c\u5171124\u5143\uff0c\u9700\u7528\u5238\uff09", "\u6709\u5238\u7684\u4e0a\uff1a\u5fc6\u591a\u5f69 \u73bb\u7483\u4fdd\u9c9c\u76d2 710+710\u6beb\u5347+\u9910\u5177 6.9\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "PLUS\u4f1a\u5458\uff1aViewSonic \u4f18\u6d3e Q7+ \u6295\u5f71\u673a 2949\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff096\u671f\u514d\u606f+\u6652\u5355\u9001\u817e\u8bafVIP\u5b63\u5361", "PLUS\u4f1a\u5458\uff1aFUWAN \u798f\u4e38 \u4e09\u7528\u62fc\u8272\u7acb\u5f0f\u732b\u6293\u677f 40*38*38cm 39.9\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff09", "\u4eac\u4e1c\u4eac\u9020 JZ-SSD512G-5 M.2 NVMe \u56fa\u6001\u786c\u76d8 512GB 289\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff09", "22\u65e50\u70b9\uff1aGW \u5149\u5a01 \u608d\u5c06\u7cfb\u5217 \u9ad8\u901f\u7248 \u56fa\u6001\u786c\u76d8 SATA 128GB 92\u5143", "deli \u5f97\u529b \u57fa\u7840\u6b3e\u7535\u52a8\u524a\u7b14\u673a \u6d45\u7c89\u8272 49\u5143\u5305\u90ae", "\u767e\u4ebf\u8865\u8d34\uff1aARC'TERYX \u59cb\u7956\u9e1f \u7537\u5b50\u5f92\u6b65\u957f\u88e4 CrestON 23023A 878.24\u5143\uff08\u9700\u4e70\u4e24\u4ef6\uff0c\u51711756.4\u5143\uff09", "\u6cca\u5361\u65bd \u5b9a\u578b\u55b7\u96fe\u53d1\u80f6 350ml 5.9\u5143 \u5305\u90ae\uff08\u9700\u7528\u5238\uff0c\u53ef\u7528\u7b7e\u5230\u7ea2\u5305\uff09", "\u5361\u5e1d\u4e50\u9cc4\u9c7c \u7537\u58eb\u725b\u76ae\u81ea\u52a8\u6263\u8170\u5e26 c146c10031_14 9.9\u5143\uff08\u9700\u7528\u5238\uff09", "SIEMENS \u897f\u95e8\u5b50 5UB14243NC01 \u4e94\u5b54\u5e26\u5f00\u5173\u63d2\u5ea7 \u96c5\u767d\u8272 1272\u5143\u5305\u90ae\uff08\u6ee1\u51cf\uff09", "\u79cb\u6c34\u4f0a\u4eba \u5973\u58eb\u65e0\u8896\u80cc\u5fc3 621305B553190 69\u5143\u5305\u90ae\uff08\u62cd\u4e0b\u7acb\u51cf\uff09", "Moist Diane \u9edb\u4e1d\u6069 \u81f4\u7f8e\u6469\u6d1b\u54e5\u6cb9\u6d17\u53d1\u6c34 450ml\uff08\u4e702\u8d60 \u6d17\u62a4\u65c5\u884c\u88c550ml*2\uff09 61.6\u5143\uff08\u9700\u4e704\u4ef6\uff0c\u5171246.4\u5143\u5305\u90ae\uff09", "\u4fc3\u9500\u6d3b\u52a8\uff1a\u4eac\u4e1c 618\u624b\u673a\u5c0f\u65f6\u8d2d \u8d2d\u673a\u81f3\u9ad8\u7acb\u51cf1000\u5143\uff0c\u62bd\u4eac\u8c46\u5566~", "\u4e34\u671f\u54c1\u3001\u6709\u5238\u7684\u4e0a\uff1a\u7ef4\u7ef4 \u5c71\u836f\u8c46\u5976\u7c89 500g 6.9\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "\u767e\u4ebf\u8865\u8d34\uff1aMI \u5c0f\u7c73 AX9000 \u4e09\u98919000M WiFi 6 \u8def\u7531\u5668 969.5\u5143\u5305\u90ae", "\u767e\u4ebf\u8865\u8d34\uff1aApple \u82f9\u679c AirPods 3\u4ee3 \u534a\u5165\u8033\u5f0f\u84dd\u7259\u8033\u673a 1139\u5143\u5305\u90ae", "22\u65e510\u70b9\uff1aLANCOME \u5170\u853b \u8f7b\u900f\u6c34\u6f3e\u9632\u6652\u4e73SPF50 PA++++ 50ml 299\u5143\uff08\u5305\u7a0e\u5305\u90ae\uff09", "\u4e91\u5357\u767d\u836f \u7559\u5170\u9999\u578b\u7259\u818f\u5957\u88c5 180g*3\u652f 69.9\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "\u5929\u732bU\u5148\uff1a\u6ce1\u6ce1\u739b\u7279 VITA\u6bcf\u65e5\u7a7f\u642d\u7cfb\u5217 \u76f2\u76d2+10\u5143\u4f18\u60e0\u5238 29.9\u5143\u5305\u90ae"], "link": ["https://www.smzdm.com/p/55935715/", "https://www.smzdm.com/p/55843381/", "https://www.smzdm.com/p/55932819/", "https://www.smzdm.com/p/55924796/", "https://www.smzdm.com/p/55933369/", "https://www.smzdm.com/p/55936410/", "https://www.smzdm.com/p/55937027/", "https://www.smzdm.com/p/55933921/", "https://www.smzdm.com/p/55932315/", "https://www.smzdm.com/p/55935284/", "https://www.smzdm.com/p/55923606/", "https://www.smzdm.com/p/55932099/", "https://www.smzdm.com/p/55923141/", "https://www.smzdm.com/p/55935658/", "https://www.smzdm.com/p/55884379/", "https://www.smzdm.com/p/55923943/", "https://www.smzdm.com/p/55935380/", "https://www.smzdm.com/p/55921430/", "https://www.smzdm.com/p/55937104/", "https://www.smzdm.com/p/55935082/", "https://www.smzdm.com/p/55929916/", "https://www.smzdm.com/p/55937035/", "https://www.smzdm.com/p/55852077/", "https://www.smzdm.com/p/55845534/", "https://www.smzdm.com/p/55936837/", "https://www.smzdm.com/p/55923184/", "https://www.smzdm.com/p/55922703/", "https://www.smzdm.com/p/55936365/", "https://www.smzdm.com/p/55935934/", "https://www.smzdm.com/p/55936934/"], "time": [1655778276, 1655635692, 1655775023, 1655750648, 1655780016, 1655779913, 1655779936, 1655776711, 1655774229, 1655778016, 1655745429, 1655773821, 1655779904, 1655778192, 1655779831, 1655779995, 1655778075, 1655779854, 1655780027, 1655777901, 1655780039, 1655780009, 1655635726, 1655635642, 1655779955, 1655743089, 1655779960, 1655779209, 1655778517, 1655779873], "update_time": 1655780174}
{"title": ["OPPO A43F1B01 \u6db2\u6676\u7535\u89c6 43\u82f1\u5bf8 989\u5143\uff08\u9700\u7528\u5238\uff09", "zmbeaute \u70df\u9170\u80fa\u7f8e\u767d\u6de1\u6591\u7cbe\u534e\u6db2 30ml 42.93\u5143\uff08\u9700\u4e702\u4ef6\uff0c\u517185.85\u5143\u5305\u7a0e\u5305\u90ae\uff0c\u53cc\u91cd\u4f18\u60e0\uff09", "\u767e\u4ebf\u8865\u8d34\uff1aLenovo \u8054\u60f3 YOGA 16s 2020 16\u82f1\u5bf8\u7b14\u8bb0\u672c\u7535\u8111\uff08R7-5800H\u300116GB\u3001512GB\u3001RTX3050\uff09 4398\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "BabyPantry \u5149\u5408\u661f\u7403 \u513f\u7ae5\u65e0\u7cd6\u68d2\u68d2\u7cd6 12\u652f 13.9\u5143\uff08\u9700\u4e703\u4ef6\uff0c\u517141.7\u5143\uff0c\u53cc\u91cd\u4f18\u60e0\uff09", "PLUS\u4f1a\u5458\uff1aTanMei \u5606\u7f8e \u53f9\u7f8e \u4fbf\u643a\u5f0f\u51b2\u7259\u5668 MS18 64\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "\u9650\u5730\u533a\uff1a\u5929\u8c31\u4e50\u98df \u9ed1\u5b89\u683c\u65af\u4e0a\u8111\u725b\u6392 180g 23.4\u5143\uff08\u6309\u9700\u51d1\u5355\u540e\uff09", "\u4e07\u4f73\u5b89 \u5c0f\u503c E3 \u667a\u80fd\u6444\u50cf\u5934 69\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff09", "PLUS\u4f1a\u5458\uff1a\u609f\u5370\u50cf A7931 \u9ad8\u6e05\u58c1\u6302\u5e55\u5e03 100\u82f1\u5bf8 4:3 \u767d\u5851 94\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "\u519c\u592b\u5c71\u6cc9 \u996e\u7528\u5929\u7136\u6c34 550ml*12\u74f6 15.9\u5143", "PLUS\u4f1a\u5458\uff1aGREE \u683c\u529b \u5929\u4e3d KFR-26GW/(26530)FNhAk-B3 \u58c1\u6302\u5f0f\u7a7a\u8c03 \u59271\u5339 2549\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "PLUS\u4f1a\u5458\uff1aFFALCON \u96f7\u9e1f \u96c04SE\u7cfb\u5217 32F165C \u6db2\u6676\u7535\u89c6 32\u82f1\u5bf8 1080P 529\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff0c\u6652\u5355\u8fd450\u5143E\u5361\uff09", "PLUS\u4f1a\u5458\uff1a\u5168\u68c9\u65f6\u4ee3 2100022145-000 \u5a74\u513f\u6c34\u6d17\u6c99\u5e03\u6d74\u5dfe \u5c0f\u9e2d\u5b50 95*95cm 59.86\u5143\uff08\u9700\u4e702\u4ef6\uff0c\u5171119.72\u5143\u5305\u90ae\uff09", "babycare \u513f\u7ae5\u5e73\u89d2\u5185\u88e4 \u4e24\u6761\u88c5 44\u5143\u5305\u90ae\uff08\u62cd\u4e0b\u7acb\u51cf\uff09", "88VIP\uff1aLONGINES \u6d6a\u7434 \u5fc3\u6708\u7cfb\u5217 \u5973\u58eb\u77f3\u82f1\u8868 L8.115.4.71.6 7029.05\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff09", "\u6d77\u5eb7\u5a01\u89c6 MD202 USB3.2 \u79fb\u52a8\u786c\u76d8\u76d2 84\u5143\uff08\u9700\u7528\u5238\uff09", "\u5df4\u9ece\u6b27\u83b1\u96c5 \u6e05\u6da6\u8461\u8404\u7c7d\u6c34\u6da6\u6d01\u9762\u4e73 125ml 59\u5143\u5305\u90ae", "FILTA \u51e1\u6001 \u5c0f\u51e1 E30 \u667a\u80fd\u6307\u7eb9\u5bc6\u7801\u9501 \u9eef\u54d1\u9ed1 \u57fa\u7840\u6b3e 299\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff09", "\u7f8e \u53f0\u5f0f\u53ef\u4f38\u7f29\u6298\u53e0\u684c\u9762\u98ce\u6247 14.99\u5143\u5305\u90ae\uff08\u97002\u4eba\u62fc\u8d2d\uff0c\u9700\u7528\u5238\uff09", "\u5c0f\u5929\u9e45 TG100V88WMUIADY5 \u5168\u81ea\u52a8\u6c34\u9b54\u65b9\u6eda\u7b52\u6d17\u8863\u673a 10KG 3099\u5143\u5305\u90ae\uff08\u62cd\u4e0b\u7acb\u51cf\uff09", "C&S \u6d01\u67d4 \u62bd\u7eb8 3\u5c42100\u62bd24\u5305\uff08195*123mm\uff09 25.9\u5143\uff08\u6ee1\u51cf\uff09", "\u767e\u4ebf\u8865\u8d34\uff1ahotwind \u70ed\u98ce \u5973\u58eb\u4f11\u95f2\u62d6\u978b 47\u5143\u5305\u90ae", "\u300a\u7eff\u5361\u5c0f\u5b66\u5b66\u9738\u51b2a\u5377\u00b7\u6570\u5b66\u300b\uff08\u4eba\u6559\u7248\u3001\u5e74\u7ea7\u4efb\u9009\uff09 17.8\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "PLUS\u4f1a\u5458\uff1aROUGEPEYRE \u7f57\u6770\u4f69\u5c14 \u5361\u5df4\u5c14\u5cb1 \u8d64\u971e\u73e0\u6df7\u917f \u5e72\u7ea2\u8461\u8404\u9152 13.5%vol 750ml 54.5\u5143\uff08\u9700\u4e702\u4ef6\uff0c\u5171109\u5143\uff0c\u53cc\u91cd\u4f18\u60e0\uff09", "\u4eac\u4e1c\u4eac\u9020 JZJZAMQ \u9888\u690e\u6309\u6469\u5668 139\u5143\u5305\u90ae\uff08\u53cc\u91cd\u4f18\u60e0\uff09", "M&G \u6668\u5149 ARPM2001 \u62d4\u5e3d\u4e2d\u6027\u7b14 \u9ed1\u8272 0.5mm 12\u652f\u88c5 13.9\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "LIUHE \u516d\u548c\u7f8e\u98df \u9e21\u7fc5\u4e2d\u4e32 560g 24.9\u5143\uff08\u9700\u4e704\u4ef6\uff0c\u517199.6\u5143\uff0c\u53cc\u91cd\u4f18\u60e0\uff09", "\u76f4\u64ad\u4e13\u4eab\uff1a\u8212\u5316 \u4f4e\u8102\u578b \u65e0\u4e73\u7cd6\u725b\u5976 220ml*12\u76d2*2\u7bb1 74.9\u5143\uff08\u5305\u90ae\uff09", "25\u65e510\u70b9\uff1a\u96c5\u8bd7\u5170\u9edb DW\u6301\u5986\u7c89\u5e95\u6db2 #1W2 30ml 233\u5143\uff08\u5305\u90ae\u5305\u7a0e\uff09", "PLUS \u666e\u4e50\u58eb 635BK \u4fee\u6b63\u5e26 \u9ed1\u8272\u672c\u4f531\u4e2a+10\u4e2a\u66ff\u82af \u591a\u8272\u53ef\u9009 42\u5143\u5305\u90ae\uff08\u9700\u7528\u5238\uff09", "Hasee \u795e\u821f mini PC5 \u8ff7\u4f60\u53f0\u5f0f\u7535\u8111\u4e3b\u673a\uff08N5095\u30018GB\u3001240GB SSD\uff09 1239\u5143\u5305\u90ae"], "link": ["https://www.smzdm.com/p/56090664/", "https://www.smzdm.com/p/56086816/", "https://www.smzdm.com/p/56094555/", "https://www.smzdm.com/p/56093586/", "https://www.smzdm.com/p/56088959/", "https://www.smzdm.com/p/56093920/", "https://www.smzdm.com/p/56094439/", "https://www.smzdm.com/p/56089697/", "https://www.smzdm.com/p/56093998/", "https://www.smzdm.com/p/56087409/", "https://www.smzdm.com/p/56079372/", "https://www.smzdm.com/p/56094362/", "https://www.smzdm.com/p/56094252/", "https://www.smzdm.com/p/56094505/", "https://www.smzdm.com/p/56094127/", "https://www.smzdm.com/p/56088076/", "https://www.smzdm.com/p/56087932/", "https://www.smzdm.com/p/56094376/", "https://www.smzdm.com/p/56089161/", "https://www.smzdm.com/p/56085648/", "https://www.smzdm.com/p/56083859/", "https://www.smzdm.com/p/56082520/", "https://www.smzdm.com/p/56079361/", "https://www.smzdm.com/p/56079037/", "https://www.smzdm.com/p/56090050/", "https://www.smzdm.com/p/56069092/", "https://www.smzdm.com/p/56094602/", "https://www.smzdm.com/p/56089887/", "https://www.smzdm.com/p/56089159/", "https://www.smzdm.com/p/56090081/"], "time": [1656044769, 1656040486, 1656049401, 1656048189, 1656042556, 1656049467, 1656049335, 1656043589, 1656048752, 1656040990, 1656035609, 1656049408, 1656049422, 1656049509, 1656048978, 1656041554, 1656041469, 1656049268, 1656042854, 1656049530, 1656037608, 1656049478, 1656035637, 1656035645, 1656044169, 1656035626, 1656049501, 1656043935, 1656042806, 1656044176], "update_time": 1656049577}
53 changes: 53 additions & 0 deletions libs/function/usr_cmd/avatar/flag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from graia.saya import Channel
from graia.ariadne.app import Ariadne
from graia.ariadne.model import Group, Member
from graia.ariadne.message.chain import MessageChain
from graia.ariadne.message.element import Image
from graia.ariadne.event.message import GroupMessage
from graia.broadcast.exceptions import ExecutionStop
from graia.saya.builtins.broadcast.schema import ListenerSchema
from graia.ariadne.message.parser.twilight import (
Twilight,
FullMatch,
)

from libs.control import Permission
from libs.helper.avatar import generate_avatar_with_flag, get_qq_avatar


channel = Channel.current()

@channel.use(
ListenerSchema(
listening_events=[GroupMessage],
inline_dispatchers=[
Twilight([FullMatch("/国旗")])
]
)
)
async def main(app: Ariadne, member: Member, group: Group):

try:
Permission.group_permission_check(group, "avatar_flag")
except Exception as e:
await app.send_group_message(
group,
MessageChain(f"本群不开放此功能,错误信息:{e}")
)
raise ExecutionStop()

try:
Permission.user_permission_check(member, Permission.DEFAULT)
except Exception as e :
await app.send_group_message(
group,
MessageChain(f"不配:{e}")
)

avatar = await get_qq_avatar(member.id)

await app.send_group_message(
group,
MessageChain([Image(path = generate_avatar_with_flag(avatar))])
)

2 changes: 1 addition & 1 deletion libs/function/usr_cmd/solidot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ async def main(app: Ariadne, member: Member, group: Group, anything: RegexResult
solidot_update()
await app.send_group_message(
group,
MessageChain(solidot_news(news_code)[:-1])
MessageChain(solidot_news(news_code))
)
23 changes: 23 additions & 0 deletions libs/helper/avatar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from PIL import Image as IMG
import aiohttp
from io import BytesIO

def generate_avatar_with_flag(avatar_fs, target_path: str = 'data/avatar/result.png'):
avatar = avatar_fs
flag = IMG.open('data/avatar/flag.png')

w,h = avatar.size
canvas = flag.resize((w,h))
avatar.paste(canvas, (0, 0), canvas)
avatar.save(target_path)

return target_path

async def get_qq_avatar(mem_id: int):
'''return the image file stream based on qq id'''
url = f'http://q1.qlogo.cn/g?b=qq&nk={str(mem_id)}&s=640'
async with aiohttp.ClientSession() as session:
async with session.get(url=url) as resp:
img_content = await resp.read()

return IMG.open(BytesIO(img_content)).convert("RGBA")
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
saya.require("libs.function.usr_cmd.jijin")

saya.require("libs.function.usr_cmd.smzdm.smzdm")

saya.require("libs.function.usr_cmd.avatar.flag")

with contextlib.suppress(KeyboardInterrupt, asyncio.exceptions.CancelledError):
app.launch_blocking()
Expand Down
Loading

0 comments on commit d84350b

Please sign in to comment.