nonebot-plugin-rollpig 0.2.1__py3-none-any.whl → 0.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ from nonebot import on_command, require
5
5
  from nonebot.adapters.onebot.v11 import Event, MessageSegment
6
6
  from nonebot.log import logger
7
7
  from nonebot.plugin import PluginMetadata
8
+ import requests
8
9
 
9
10
  # 确保依赖插件先被 NoneBot 注册
10
11
  require("nonebot_plugin_htmlrender")
@@ -19,6 +20,7 @@ __plugin_meta__ = PluginMetadata(
19
20
  description="抽取属于自己的小猪",
20
21
  usage="""
21
22
  今日小猪 - 抽取今天属于你的小猪
23
+ 随机小猪 - 从pighub随机获取一张猪猪图
22
24
  """,
23
25
  type="application",
24
26
  homepage="https://github.com/Bearlele/nonebot-plugin-rollpig",
@@ -34,7 +36,23 @@ RES_DIR = PLUGIN_DIR / "resource"
34
36
  # 今日记录
35
37
  TODAY_PATH = store.get_plugin_data_file("today.json")
36
38
 
37
- cmd = on_command("今天是什么小猪", aliases={"今日小猪"})
39
+ cmd = on_command("今天是什么小猪", aliases={"今日小猪"}, block=True)
40
+ roll_pig = on_command("随机小猪", block=True)
41
+
42
+ @roll_pig.handle()
43
+ async def _(event: Event):
44
+ try:
45
+ response = requests.get("https://pighub.top/api/all-images")
46
+ response.raise_for_status() # 检查请求是否成功
47
+ data = response.json()
48
+ if data and data["images"]:
49
+ pig = random.choice(data["images"])
50
+ image_url = "https://pighub.top/data/" + pig["thumbnail"].split("/")[-1]
51
+ await roll_pig.finish(MessageSegment.image(image_url))
52
+ else:
53
+ await roll_pig.finish("没有找到小猪图片")
54
+ except requests.exceptions.RequestException as e:
55
+ await roll_pig.finish(f"请求出错:{e}")
38
56
 
39
57
 
40
58
  def load_json(path, default):
@@ -57,7 +75,6 @@ def find_image_file(pig_id: str) -> Path | None:
57
75
  return file
58
76
  return None
59
77
 
60
-
61
78
  # 载入小猪信息
62
79
  PIG_LIST = load_json(PIGINFO_PATH, [])
63
80
  if not PIG_LIST:
@@ -238,5 +238,29 @@
238
238
  "name": "猪排",
239
239
  "description": "建议烤熟食用",
240
240
  "analysis": "充满危机的世界里,你深知比起花哨的外表,实实在在恢复的那几格饥饿值才是最靠谱的保障。"
241
+ },
242
+ {
243
+ "id": "pig_god",
244
+ "name": "智慧小猪之神",
245
+ "description": "能带来智慧和好运的神奇小猪。",
246
+ "analysis": "你拥有超凡的智慧和乐于助人的心。虽然看起来可爱呆萌,但你总能在关键时刻给予指引,是猪的守护神,象征着幸运和成功。"
247
+ },
248
+ {
249
+ "id": "tank_pig",
250
+ "name": "坦克猪",
251
+ "description": "等待驾驶的重装小猪",
252
+ "analysis": "你拥有呆萌外表和钢铁之心。平时或许处于“待机”状态,看起来有些慵懒,但只要找对启动方式(按F),你就能化身坚不可摧的堡垒,碾压一切困难。"
253
+ },
254
+ {
255
+ "id": "lao_zhu_li",
256
+ "name": "老猪历",
257
+ "description": "资深有经验的猪前辈",
258
+ "analysis": "你拥有深厚的资历和丰富的经验。在大家眼中,你德高望重,遇事沉稳,总能用积累的智慧指引方向,是值得信赖的可靠前辈。"
259
+ },
260
+ {
261
+ "id": "invisible_pig",
262
+ "name": "隐形猪",
263
+ "description": "擅长隐身的神秘小猪",
264
+ "analysis": "你自带低调气场,擅长隐藏行踪。在人群中你虽不显眼,但总能默默观察一切,像个神秘的旁观者,拥有独特的洞察力。"
241
265
  }
242
266
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot_plugin_rollpig
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: 今天是什么小猪
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -57,6 +57,8 @@ nb plugin install nonebot_plugin_rollpig
57
57
  - 重复抽取不会改变结果 🐷
58
58
  - 每天 0 点自动重置 🐖
59
59
 
60
+ **随机小猪** - 从PigHub随机获取一张猪猪图 🐖
61
+
60
62
  ---
61
63
 
62
64
  ### 🐖 新增小猪 🐖
@@ -1,4 +1,4 @@
1
- nonebot_plugin_rollpig/__init__.py,sha256=paIp_Tqb-qBhe3tbvD5kEm2QIAHf3Frr6kDOY-ZexwI,3607
1
+ nonebot_plugin_rollpig/__init__.py,sha256=LQf4_AmGVwpiiVMMMeaeHZCXZ8E_NDvkLqZ4HU6XW-w,4396
2
2
  nonebot_plugin_rollpig/resource/image/android-pig.png,sha256=WwY2rtsABH8YbDDIoQDR6WdHW8qpStm_lF8eXZ4K-Tc,37845
3
3
  nonebot_plugin_rollpig/resource/image/apple-pig.png,sha256=HSh8SRguD65ZZLnbnTgtNiAqqNzZKuFijtKIC3TLZDU,41533
4
4
  nonebot_plugin_rollpig/resource/image/bacon.png,sha256=7G86_W17C14qCRDKCGuRES4yfidIrIMz2gxOat3Gnn8,55722
@@ -13,7 +13,9 @@ nonebot_plugin_rollpig/resource/image/explosive-pig.png,sha256=XRM33JxTbQ1Bqw2Wg
13
13
  nonebot_plugin_rollpig/resource/image/goblin-pig.png,sha256=if1Zvs70PIxDKWhhXACvhC1iBkESTg_cLCXvazXfQXc,59660
14
14
  nonebot_plugin_rollpig/resource/image/heaven-pig.png,sha256=040-bRaWpqBRNos1ZJtCK4nex63538JYI0gH99zUQLY,16832
15
15
  nonebot_plugin_rollpig/resource/image/human.png,sha256=y2MZg0Ccf5ixRHDx4fF6UIra6BI2HS5Ta_KRmbWULTI,5318
16
+ nonebot_plugin_rollpig/resource/image/invisible_pig.png,sha256=GjzA7fGZO7YS-nUqs4TqYh5Di3YupB-mGzzXf4Q0j44,16190
16
17
  nonebot_plugin_rollpig/resource/image/landmine-pig.png,sha256=UD3OMdPLushgE2GloIMyilut0QPoW3ui8_komc4xV-0,66099
18
+ nonebot_plugin_rollpig/resource/image/lao_zhu_li.png,sha256=qvQvyd1seC1-DDIdtDAlc3vPVxNGCLpcZc6uzmhqZgU,30435
17
19
  nonebot_plugin_rollpig/resource/image/magic-pig.png,sha256=QOA-_NYiVU-9tFDvL1-YrPnyoOshO3VDMNm5nflVWcY,45549
18
20
  nonebot_plugin_rollpig/resource/image/mc_porkchop.png,sha256=M8HF032rs9bbH-3TPB3go-WCrWwtbdZ6QTJamrPfaqM,35825
19
21
  nonebot_plugin_rollpig/resource/image/mechanical-pig.png,sha256=fy0WZeg-P0XDaQlKwYoGeZ3x-yVJ92M8VKLshr9R1qY,27301
@@ -26,6 +28,7 @@ nonebot_plugin_rollpig/resource/image/pig-souffle.png,sha256=WQkawKPidErANfWbgdM
26
28
  nonebot_plugin_rollpig/resource/image/pig-stamp.png,sha256=XjXECXX3ycWhAULjyc46sKVoYheedsdCfhJvmGXxutc,14028
27
29
  nonebot_plugin_rollpig/resource/image/pig-turtle.png,sha256=S16Wphg2_S4HmSifx4r3K6pNOQr7ADptZQjDymL2wc8,95055
28
30
  nonebot_plugin_rollpig/resource/image/pig.png,sha256=4ipCbYjK6rVqDLIeUH3HSCgUO8T5vTWybFa2hrXzfk4,10494
31
+ nonebot_plugin_rollpig/resource/image/pig_god.png,sha256=Hb1jUepKCczklcxnkqj6C9BdYtPaebUqMLwnDljxk_k,39122
29
32
  nonebot_plugin_rollpig/resource/image/pork-skewer.png,sha256=zmupRrODQ3VqqlsXLiDsQ5VWyNgnIOvqTP7S2_0Ig5U,9122
30
33
  nonebot_plugin_rollpig/resource/image/rainbow-pig.png,sha256=oMgqUANyXws4jpvIdCge4F0o13dEzMkABGMnsNM3mhU,67432
31
34
  nonebot_plugin_rollpig/resource/image/roasted-pig.png,sha256=KsIVHZslhVP0e3aklKw3-w_LfFVdIcZI_aFcg_VAxrE,39770
@@ -33,15 +36,16 @@ nonebot_plugin_rollpig/resource/image/skeleton-pig.png,sha256=hAKL6v5W2gyjuHKciE
33
36
  nonebot_plugin_rollpig/resource/image/snow-pig.png,sha256=IYvo1qUUsKC5JLGcHEcMWroyONO1L4Xcf15eBel-l90,18550
34
37
  nonebot_plugin_rollpig/resource/image/soul-pig.png,sha256=PlAp7k_DneuLpmN79NHqdsd_dM_o9bjmnTN7htzUaDE,13984
35
38
  nonebot_plugin_rollpig/resource/image/tangyuan_pig.png,sha256=igvJN9grj_hBDeKampFa6WJTg4VjrkyxpUdWzq4AoNk,1640768
39
+ nonebot_plugin_rollpig/resource/image/tank_pig.png,sha256=tKJ7Lowe1zo3eRH1N7ngKIPretGMW5UV7EaTVmbUYkg,52611
36
40
  nonebot_plugin_rollpig/resource/image/taxi-pig.png,sha256=d75kqIQbQK7U64SV4oKwnXMxKTCgmheo14gP1kmu7Zg,54313
37
41
  nonebot_plugin_rollpig/resource/image/vangogh_pig.png,sha256=twRQfwU4nE3f0UacjxFzUK5kpCQ5CzBaQmBYZDXN6Sc,2578934
38
42
  nonebot_plugin_rollpig/resource/image/watermelon-pig.png,sha256=Fuoe-svB661glzMeHbuA9RXJhKNvJ8DhQLuAfZbG6Rc,1325162
39
43
  nonebot_plugin_rollpig/resource/image/wild-boar.png,sha256=daBhmLS0SFVqhYtn12QsNjg1KzNh5oiuI7wFN-J4xbM,13378
40
44
  nonebot_plugin_rollpig/resource/image/zhuge-liang.png,sha256=yvF5hNUzBXJIHi-vwg5f4YD_aEtqUJeIarpyiNReios,49905
41
45
  nonebot_plugin_rollpig/resource/image/zombie-pig.png,sha256=fKQlp_kI3x8wMlVUT6U-rilMLpH0TpT_-ViNVWBSbcM,20797
42
- nonebot_plugin_rollpig/resource/pig.json,sha256=PqBF8X5TLqK1dOEtrKBd51hHJ4_h5XY3afGaUKRe3YI,11905
46
+ nonebot_plugin_rollpig/resource/pig.json,sha256=0YHz5eLZOSwo-3Yh44UgXrZ4vTmpvSDMx9Ejh0htlxM,13236
43
47
  nonebot_plugin_rollpig/resource/template.html,sha256=vX7vbT3BmmsXhswiUIHqHNLds_CcUQIuZKdnz5bVthc,1060
44
- nonebot_plugin_rollpig-0.2.1.dist-info/licenses/LICENSE,sha256=zn7XqavdCw11Nln_m8Eu0S7C3rZ9C-VGbqbrVGeSTGg,1087
45
- nonebot_plugin_rollpig-0.2.1.dist-info/METADATA,sha256=X8THu5giwml8LXvGdIai2epotm-FP4fAtbhKB1WK7Ig,2658
46
- nonebot_plugin_rollpig-0.2.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
47
- nonebot_plugin_rollpig-0.2.1.dist-info/RECORD,,
48
+ nonebot_plugin_rollpig-0.2.3.dist-info/licenses/LICENSE,sha256=zn7XqavdCw11Nln_m8Eu0S7C3rZ9C-VGbqbrVGeSTGg,1087
49
+ nonebot_plugin_rollpig-0.2.3.dist-info/METADATA,sha256=oZINPcuDR7NUb6oIPeN4RYfNuRGw8o5AyFisOp3xy5w,2720
50
+ nonebot_plugin_rollpig-0.2.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
51
+ nonebot_plugin_rollpig-0.2.3.dist-info/RECORD,,