-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
150 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[project] | ||
name = "little_dove" | ||
version = "0.1.0" | ||
description = "little_dove" | ||
readme = "README.md" | ||
requires-python = ">=3.10, <4.0" | ||
|
||
[tool.nonebot] | ||
adapters = [ | ||
{ name = "OneBot V11", module_name = "nonebot.adapters.onebot.v11" } | ||
] | ||
plugins = ["qq-group-admin-plugin","nonebot_plugin_gocqhttp","haruka_bot","nonebot_plugin_wordcloud","nonebot_plugin_easy_group_manager"] | ||
|
||
|
||
plugin_dirs = ["src/plugins"] | ||
builtin_plugins = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import nonebot | ||
|
||
from . import ( | ||
clear,scheduler | ||
clear | ||
) | ||
|
||
driver = nonebot.get_driver() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import nonebot | ||
|
||
from . import ( | ||
rebirth,scheduler | ||
) | ||
|
||
driver = nonebot.get_driver() | ||
|
||
|
||
@driver.on_bot_connect | ||
async def _(): | ||
bot = nonebot.get_bot("3320741388") | ||
|
||
|
||
""" | ||
qq重生 | ||
""" | ||
|
||
__usage__ = """ | ||
""" | ||
__help_plugin_name__ = 'qq重生' | ||
|
||
__permission__ = 1 | ||
__help__version__ = '0.1.0' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# from typing import Optional | ||
from nonebot import get_driver | ||
from pydantic import BaseModel, Extra | ||
|
||
|
||
class Config(BaseModel, extra=Extra.ignore): | ||
sd_host: str = 'frp.runtime20.space' # sd的host地址 | ||
sd_port: int = 52097 # sd server的端口 | ||
sd_groups: list = ["1170115778", "617875321", | ||
"190842825", "689583064","715025692"] # 每天需要发送sd ai图片的groups | ||
sd_hour: int = 2 # 每天需要发送sd ai图片时间,小时 | ||
sd_minute: int = 59 # 每天需要发送sd ai图片时间,分钟 | ||
|
||
|
||
driver = get_driver() | ||
global_config = driver.config | ||
plugin_config = Config.parse_obj(global_config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
1141560393 | ||
1766718182 | ||
2508486536 | ||
3320741388 | ||
2024085613 | ||
810575702 | ||
173392947 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from nonebot import on_command, get_bot | ||
from nonebot.adapters import Message | ||
from nonebot.adapters.onebot.v11 import Bot, GroupMessageEvent | ||
from nonebot.adapters.onebot.v11.permission import GROUP_ADMIN, GROUP_OWNER | ||
from nonebot.matcher import Matcher | ||
from nonebot.params import CommandArg | ||
from nonebot.permission import SUPERUSER | ||
# Custom utils | ||
from .utils import read_accounts_from_file | ||
from .SDUtils import SDUtils | ||
from nonebot.exception import ActionFailed | ||
|
||
from .config import plugin_config | ||
|
||
|
||
# 查询尊贵vip名单 | ||
matcher_vip_list = on_command( | ||
'vip', priority=4, permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER) | ||
|
||
matcher_rebir = on_command( | ||
'重生', priority=1, permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER) | ||
|
||
|
||
@matcher_rebir.handle() | ||
async def _(bot: Bot, event: GroupMessageEvent): | ||
# make sure bot is bot | ||
bot = get_bot("3320741388") | ||
sd = SDUtils(sd_host=plugin_config.sd_host, sd_port=plugin_config.sd_port) | ||
gid = int(event.group_id) | ||
try: | ||
msg = await sd.generate_ai_image_msg(group_id=gid) | ||
except ActionFailed as e: | ||
await bot.send(event, e) | ||
await bot.send(event, message=msg) | ||
|
||
|
||
@matcher_vip_list.handle() | ||
async def _(matcher: Matcher): | ||
vip_list = read_accounts_from_file() | ||
await matcher.send(f"💎尊享svip年费会员列表:{vip_list}") |
2 changes: 1 addition & 1 deletion
2
qq-group-admin-plugin/scheduler.py → qq-group-rebirth/scheduler.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
utils | ||
""" | ||
|
||
def read_accounts_from_file() -> str: | ||
""" | ||
从文件中读取每一行账号信息 | ||
""" | ||
try: | ||
with open("qq-group-admin-plugin/configs/vip_list.txt", 'r', encoding='utf-8') as file: | ||
accounts = [int(line.strip()) for line in file.readlines()] | ||
return accounts | ||
except FileNotFoundError: | ||
print(f"File not found:") | ||
return [] | ||
|
||
def order_member_by_time_dsa(data: str): | ||
"""查询成员按最后一次发言时间排序 | ||
""" | ||
try: | ||
|
||
vip_lists = read_accounts_from_file() | ||
# Only keep fields:user_id, sex, nickname, last_sent_time, join_time | ||
new_data = [{'user_id': d['user_id'], 'sex': d['sex'], 'nickname': d['nickname'], | ||
'last_sent_time': d['last_sent_time'], 'join_time': d['join_time']} for d in data] | ||
# Exclude accounts from the file | ||
filtered_data = [ | ||
item for item in new_data if item['user_id'] not in vip_lists] | ||
# Ordered by last_sent_time | ||
json_data_sorted = sorted( | ||
filtered_data, key=lambda x: x['last_sent_time']) | ||
# Return bottom 10 items | ||
final_data = json_data_sorted[-10:] | ||
|
||
return final_data | ||
except KeyError: | ||
return [] |