summaryrefslogtreecommitdiff
path: root/ATRI/plugins/other.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-08-18 22:47:39 +0800
committerKyomotoi <[email protected]>2020-08-18 22:47:39 +0800
commit0d3d479a9b98aab47fb84ce0f5eadff17ff5d046 (patch)
treef57fb390c6155060d8119b6f1d2895e2aa07fb8e /ATRI/plugins/other.py
parent636a16033ccb426a888e4f8a7d411e5fcb68faf2 (diff)
downloadATRI-0d3d479a9b98aab47fb84ce0f5eadff17ff5d046.tar.gz
ATRI-0d3d479a9b98aab47fb84ce0f5eadff17ff5d046.tar.bz2
ATRI-0d3d479a9b98aab47fb84ce0f5eadff17ff5d046.zip
[Update]
Diffstat (limited to 'ATRI/plugins/other.py')
-rw-r--r--ATRI/plugins/other.py215
1 files changed, 145 insertions, 70 deletions
diff --git a/ATRI/plugins/other.py b/ATRI/plugins/other.py
index dd34dda..5946905 100644
--- a/ATRI/plugins/other.py
+++ b/ATRI/plugins/other.py
@@ -3,6 +3,7 @@ import random
import nonebot
from datetime import datetime
from random import choice
+from pathlib import Path
from nonebot import on_command, CommandSession
from nonebot.helpers import render_expression
@@ -32,104 +33,178 @@ HELP_REPLY = (
@on_command('抽签', only_to_me = False)
async def _(session: CommandSession):
user = session.event.user_id
- if 0 <= now_time() < 5.5:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
- )
- else:
- with open('ATRI/plugins/noobList/noobList.json', 'r') as f:
+ group = session.event.group_id
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f:
data = json.load(f)
-
- if str(user) in data.keys():
+ except:
+ data = {}
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f:
+ data1 = json.load(f)
+ except:
+ data1 = {}
+
+ if str(group) in data.keys():
+ pass
+ else:
+ if str(user) in data1.keys():
pass
else:
- await session.send(
- str(
- random.choice(
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
[
- '大凶',
- '大胸',
- '小凶',
- '小胸',
- '凶',
- '吉',
- '中吉',
- '大吉',
- '特大吉',
- '超特大吉'
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
]
)
)
- )
+ else:
+ await session.send(
+ str(
+ random.choice(
+ [
+ '大凶',
+ '大胸',
+ '小凶',
+ '小胸',
+ '凶',
+ '吉',
+ '中吉',
+ '大吉',
+ '特大吉',
+ '超特大吉'
+ ]
+ )
+ )
+ )
@on_command('掷骰子', aliases = ['扔骰子', '骰子'], only_to_me = False)
async def _(session: CommandSession):
user = session.event.user_id
- if 0 <= now_time() < 5.5:
- await session.send(
- choice(
- [
- 'zzzz......',
- 'zzzzzzzz......',
- 'zzz...好涩哦..zzz....',
- '别...不要..zzz..那..zzz..',
- '嘻嘻..zzz..呐~..zzzz..'
- ]
- )
- )
- else:
- with open('ATRI/plugins/noobList/noobList.json', 'r') as f:
+ group = session.event.group_id
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f:
data = json.load(f)
-
- if str(user) in data.keys():
+ except:
+ data = {}
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f:
+ data1 = json.load(f)
+ except:
+ data1 = {}
+
+ if str(group) in data.keys():
+ pass
+ else:
+ if str(user) in data1.keys():
pass
else:
- await session.send(
- str(
- random.randint(
- 1,6
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
+ )
+ )
+ else:
+ await session.send(
+ str(
+ random.randint(
+ 1,6
+ )
)
)
- )
@on_command('关于', aliases = ['关于机器人'], only_to_me = False)
async def _(session: CommandSession):
user = session.event.user_id
- with open('ATRI/plugins/noobList/noobList.json', 'r') as f:
- data = json.load(f)
-
- if str(user) in data.keys():
+ group = session.event.group_id
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f:
+ data = json.load(f)
+ except:
+ data = {}
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f:
+ data1 = json.load(f)
+ except:
+ data1 = {}
+
+ if str(group) in data.keys():
pass
else:
- await session.send(
- """想了解ATRI嘛
- 写出咱的是Kyomotoi
- 他的主页:https://blog.lolihub.icu/
- 项目地址:https://github.com/Kyomotoi/ATRI
- 欢迎star~w!"""
- )
+ if str(user) in data1.keys():
+ pass
+ else:
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
+ )
+ )
+ else:
+ await session.send(
+ """想了解ATRI嘛
+ 写出咱的是Kyomotoi
+ 他的主页:https://blog.lolihub.icu/
+ 项目地址:https://github.com/Kyomotoi/ATRI
+ 欢迎star~w!"""
+ )
@on_command('help', aliases = ['帮助', '如何使用ATRI', '机器人帮助'], only_to_me = False)
async def _(session: CommandSession):
user = session.event.user_id
- with open('ATRI/plugins/noobList/noobList.json', 'r') as f:
- data = json.load(f)
-
- if str(user) in data.keys():
+ group = session.event.group_id
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json', 'r') as f:
+ data = json.load(f)
+ except:
+ data = {}
+ try:
+ with open(Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json', 'r') as f:
+ data1 = json.load(f)
+ except:
+ data1 = {}
+
+ if str(group) in data.keys():
pass
else:
- await session.send(
- f"""{render_expression(HELP_REPLY)}
-请仔细阅读文档哦~~https://blog.lolihub.icu/#/ATRI/user"""
- )
+ if str(user) in data1.keys():
+ pass
+ else:
+ if 0 <= now_time() < 5.5:
+ await session.send(
+ choice(
+ [
+ 'zzzz......',
+ 'zzzzzzzz......',
+ 'zzz...好涩哦..zzz....',
+ '别...不要..zzz..那..zzz..',
+ '嘻嘻..zzz..呐~..zzzz..'
+ ]
+ )
+ )
+ else:
+ await session.send(
+ f"""{render_expression(HELP_REPLY)}
+ 请仔细阅读文档哦~~https://blog.lolihub.icu/#/ATRI/user"""
+ )
@on_command('report', aliases = ['来杯红茶'], only_to_me = True)