Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.0.5 #19

Merged
merged 10 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ XYBot详细的部署教程可以在项目的Wiki中找到。📚 同时,XYBot
✅高度可自定义!
✅支持自我编写插件!

[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-red.svg)](https://opensource.org/licenses/)[![Version](https://img.shields.io/badge/Version-0.0.5pre-orange.svg)](https://github.com/HenryXiaoYang/XYBot)
[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-red.svg)](https://opensource.org/licenses/)[![Version](https://img.shields.io/badge/Version-0.0.5-orange.svg)](https://github.com/HenryXiaoYang/XYBot)
[![Blog](https://img.shields.io/badge/Blog-@HenryXiaoYang-yellow.svg)](https://yangres.com)

# 20240106:发现了更强大的微信机器人Hook 下一个版本会花点时间🤔
Expand Down Expand Up @@ -102,7 +102,9 @@ ChatGPT

#### ARM架构能不能运行?🤔️

不行😩
~~不行😩~~

可以是可以是,虚拟层自己套吧

真的不嫌烦吗?

Expand All @@ -112,7 +114,7 @@ ChatGPT

#### 使用有没有封号风险?🤔️

我连续用了9个月了,没被封😄
我连续用了~~3 6~~ 9个月了,没被封😄

## Credit

Expand All @@ -123,3 +125,24 @@ https://github.com/ChisBread/wechat-service/
https://github.com/cixingguangming55555/wechat-bot

https://github.com/chisbread/wechat-box

## ⭐️Star History⭐️

<picture>
<source
media="(prefers-color-scheme: dark)"
srcset="
https://api.star-history.com/svg?repos=HenryXiaoYang/XYBot&type=Date&theme=dark
"
/>
<source
media="(prefers-color-scheme: light)"
srcset="
https://api.star-history.com/svg?repos=HenryXiaoYang/XYBot&type=Date
"
/>
<img
alt="XYBot Star History"
src="https://api.star-history.com/svg?repos=HenryXiaoYang/XYBot&type=Date"
/>
</picture>
17 changes: 11 additions & 6 deletions database.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# Copyright (c) 2024. Henry Yang
#
# This program is licensed under the GNU General Public License v3.0.
#
# This program is licensed under the GNU General Public License v3.0.

import os
import sqlite3
from concurrent.futures import ThreadPoolExecutor

Expand All @@ -17,6 +12,16 @@
@singleton
class BotDatabase:
def __init__(self):
if not os.path.exists('userpoints.db'): # 检查数据库是否存在
logger.warning('监测到数据库不存在,正在创建数据库')
conn = sqlite3.connect('userpoints.db')
c = conn.cursor()
c.execute('''CREATE TABLE USERPOINTS (WXID TEXT PRIMARY KEY , POINTS INT, SIGNINSTAT INT, WHITELIST INT)''')
conn.commit()
c.close()
conn.close()
logger.warning('已创建数据库')

self.database = sqlite3.connect('userpoints.db', check_same_thread=False) # 连接数据库
self.wxid_list = self._get_wxid_list() # 获取已有用户列表

Expand Down
10 changes: 2 additions & 8 deletions plans/antiautolog.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Copyright (c) 2024. Henry Yang
#
# This program is licensed under the GNU General Public License v3.0.
#
# This program is licensed under the GNU General Public License v3.0.

import os
import random

Expand All @@ -20,7 +14,7 @@ def __init__(self):
current_directory = os.path.dirname(os.path.abspath(__file__))
main_config_path = os.path.join(current_directory, '../main_config.yml')
with open(main_config_path, 'r', encoding='utf-8') as f: # 读取设置
main_config = yaml.load(f.read(), Loader=yaml.FullLoader)
main_config = yaml.safe_load(f.read())

self.ip = main_config['ip']
self.port = main_config['port']
Expand All @@ -34,4 +28,4 @@ def job(self):
self.bot.send_txt_msg("filehelper", out_message) # 发送

def run(self):
schedule.every(10).minutes.do(self.job)
schedule.every(10).minutes.do(self.job) # 每10分钟执行一次
26 changes: 10 additions & 16 deletions plans/pic_cache_clear.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Copyright (c) 2024. Henry Yang
#
# This program is licensed under the GNU General Public License v3.0.
#
# This program is licensed under the GNU General Public License v3.0.

import os

import pywxdll
Expand All @@ -19,23 +13,23 @@ def __init__(self):
current_directory = os.path.dirname(os.path.abspath(__file__))
main_config_path = os.path.join(current_directory, '../main_config.yml')
with open(main_config_path, 'r', encoding='utf-8') as f: # 读取设置
main_config = yaml.load(f.read(), Loader=yaml.FullLoader)
main_config = yaml.safe_load(f.read())

self.ip = main_config['ip']
self.port = main_config['port']
self.timezone = main_config['timezone']
self.ip = main_config['ip'] # 机器人ip
self.port = main_config['port'] # 机器人端口
self.timezone = main_config['timezone'] # 时区
self.bot = pywxdll.Pywxdll(self.ip, self.port) # 机器人api

def job(self):
path = './resources/pic_cache/'
for filename in os.listdir(path):
file_path = os.path.join(path, filename)
path = './resources/pic_cache/' # 图片缓存路径
for filename in os.listdir(path): # 遍历文件夹
file_path = os.path.join(path, filename) # 获取文件路径
# 判断路径是否为文件
if os.path.isfile(file_path):
if os.path.isfile(file_path): # 如果是文件
# 删除文件
os.remove(file_path)

logger.info('[计划]清除随机图图缓存成功')
logger.info('[计划]清除随机图图缓存成功') # 记录日志

def run(self):
schedule.every(60).minutes.do(self.job)
schedule.every(60).minutes.do(self.job) # 每60分钟执行一次
6 changes: 0 additions & 6 deletions plans_interface.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Copyright (c) 2024. Henry Yang
#
# This program is licensed under the GNU General Public License v3.0.
#
# This program is licensed under the GNU General Public License v3.0.

class PlansInterface:
def run(self):
raise NotImplementedError("Subclasses must implement the 'run' method.")
6 changes: 0 additions & 6 deletions plans_manager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Copyright (c) 2024. Henry Yang
#
# This program is licensed under the GNU General Public License v3.0.
#
# This program is licensed under the GNU General Public License v3.0.

import importlib
import os

Expand Down
6 changes: 0 additions & 6 deletions plugin_interface.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Copyright (c) 2024. Henry Yang
#
# This program is licensed under the GNU General Public License v3.0.
#
# This program is licensed under the GNU General Public License v3.0.

class PluginInterface:
def run(self, recv):
raise NotImplementedError("Subclasses must implement the 'run' method.")
10 changes: 2 additions & 8 deletions plugin_manager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Copyright (c) 2024. Henry Yang
#
# This program is licensed under the GNU General Public License v3.0.
#
# This program is licensed under the GNU General Public License v3.0.

import importlib
import os

Expand All @@ -21,7 +15,7 @@ def __init__(self):
self.keywords = {}

with open('main_config.yml', 'r', encoding='utf-8') as f: # 读取设置
config = yaml.load(f.read(), Loader=yaml.FullLoader)
config = yaml.safe_load(f.read())

self.excluded_plugins = config['excluded_plugins']

Expand All @@ -40,7 +34,7 @@ def refresh_keywords(self):

for path in plugin_config_path:
with open(path, 'r', encoding='utf-8') as f: # 读取设置
config = yaml.load(f.read(), Loader=yaml.FullLoader)
config = yaml.safe_load(f.read())

keywords_list = config['keywords']
plugin_name = config['plugin_name']
Expand Down
Loading