summaryrefslogtreecommitdiff
path: root/ATRI/plugins/Chat1.py
blob: 47c8fdfb11bb1e64525823b676a3f1e9f952785c (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import os
import nonebot
from pathlib import Path
from random import choice, randint
from datetime import datetime
from nonebot import on_command, CommandSession

import config # type: ignore
from ATRI.modules.funcControl import checkNoob # type: ignore


bot = nonebot.get_bot()
master = config.MASTER()


def now_time():
    now_ = datetime.now()
    hour = now_.hour
    minute = now_.minute
    now = hour + minute / 60
    return now


@on_command('nanjya', patterns = [r"なんじゃ|何[がで]|どうして|为什么|为何|多[洗西]跌"], only_to_me = False)
async def _(session: CommandSession):
    user = session.event.user_id
    group = session.event.group_id
    if checkNoob(user, group):
        if 0 <= now_time() < 5.5:
            pass
        else:
            if randint(1,2) == 1:
                img = choice(
                    [
                        '1.jpg', '8.jpg', '14.jpg', '21.jpg'
                    ]
                )
                img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / 'senren' / f'{img}')
                await session.send(f'[CQ:image,file=file:///{img}]')

@on_command('wenhao', patterns = [r"'?'|?|¿"], only_to_me = False)
async def _(session: CommandSession):
    user = session.event.user_id
    group = session.event.group_id
    if checkNoob(user, group):
        if 0 <= now_time() < 5.5:
            pass
        else:
            if randint(1,3) == 1:
                res = randint(1,5)
                if 1 <= res < 2:
                    await session.send(
                        choice(
                            [
                                '?', '?', '嗯?', '(。´・ω・)ん?', 'ん?'
                            ]
                        )
                    )
                
                elif 2 <= res <= 5:
                    img = choice(
                        [
                            'WH.jpg', 'WH1.jpg', 'WH2.jpg', 'WH3.jpg', 'WH4.jpg'
                        ]
                    )
                    img = Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}'
                    img = os.path.abspath(img)
                    await session.send(f'[CQ:image,file=file:///{img}]')

@on_command('yesorno', patterns = [r"[好是]吗|[行能]不[行能]|彳亍不彳亍|可不可以"], only_to_me = False)
async def _(session: CommandSession):
    user = session.event.user_id
    group = session.event.group_id
    if checkNoob(user, group):
        if 0 <= now_time() < 5.5:
            pass
        else:
            res = randint(1,2)
            if res == 1:
                img = choice(
                    [
                        '2.png', '39.png'
                    ]
                )
                img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / 'senren' / f'{img}')
                await session.send(f'[CQ:image,file=file:///{img}]')

            elif res == 2:
                img = choice(
                    [
                        'YIQI_YES.png', 'YIQI_NO.jpg', 'KD.jpg', 'FD.jpg'
                    ]
                )
                img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / f'{img}')
                await session.send(f'[CQ:image,file=file:///{img}]')

@on_command('ysdd', aliases = [r"原声大碟"])
async def _(session: CommandSession):
    user = session.event.user_id
    group = session.event.group_id
    if checkNoob(user, group):
        voice = Path('.') / 'ATRI' / 'data' / 'voice' / 'ysdd.amr'
        voice = os.path.abspath(voice)
        await session.send(f'[CQ:record,file=file:///{voice}]')

@bot.on_message('group')
async def _(context):
    user = context["user_id"]
    group = context["group_id"]
    if checkNoob(user, group):
        if 0 <= now_time() < 5.5:
            pass
        else:
            if randint(1,20) == 4:
                img = choice(
                    [
                        '11.jpg', '12.jpg', '23.jpg'
                    ]
                )
                img = os.path.abspath(Path('.') / 'ATRI' / 'data' / 'emoji' / 'senren' / f'{img}')
                await bot.send_msg(message = f'[CQ:image,file=file:///{img}]', auto_escape = False) # type: ignore
            
            else:
                pass