This repository has been archived by the owner on Oct 20, 2023. It is now read-only.
forked from chingkingm/Hoshinobot-plugin-petpet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_source.py
60 lines (53 loc) · 2.06 KB
/
data_source.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from io import BytesIO
from typing import List, Union
from .download import download_avatar, download_url
from .functions import *
from .models import Command, UserInfo
from .utils import to_image
commands = [
Command(("摸", "摸摸", "摸头", "摸摸头", "rua"), petpet, arg_num=1),
Command(("亲", "亲亲"), kiss),
Command(("贴", "贴贴", "蹭", "蹭蹭"), rub),
Command(("顶",), play),
Command(("拍",), pat),
Command(("撕",), rip),
Command(("丢", "扔"), throw),
Command(("抛", "掷"), throw_gif),
Command(("爬",), crawl),
Command(("精神支柱",), support),
Command(("一直",), always, convert=False),
Command(("加载中",), loading, convert=False),
Command(("转",), turn),
Command(("小天使",), littleangel, convert=False, arg_num=1),
Command(("不要靠近",), dont_touch),
Command(("一样",), alike),
Command(("滚",), roll),
Command(("玩游戏", "来玩游戏"), play_game, convert=False),
Command(("膜", "膜拜"), worship),
Command(("吃",), eat),
Command(("啃",), bite),
Command(("出警",), police),
Command(("问问", "去问问"), ask, convert=False, arg_num=1),
Command(("舔", "舔屏", "prpr"), prpr),
Command(("搓",), twist),
Command(("墙纸",), wallpaper),
Command(("国旗",), china_flag),
Command(("交个朋友",), make_friend, convert=False, arg_num=1),
Command(("继续干活",), back_to_work),
Command(("完美", "完美的"), perfect, convert=False),
]
async def download_image(user: UserInfo, convert: bool = True):
img = None
if user.qq:
img = await download_avatar(user.qq)
elif user.img_url:
img = await download_url(user.img_url)
if img:
user.img = to_image(img, convert)
async def make_image(
command: Command, sender: UserInfo, users: List[UserInfo], args: List[str] = []
) -> Union[str, BytesIO]:
await download_image(sender, command.convert)
for user in users:
await download_image(user, command.convert)
return await command.func(users, sender=sender, args=args)