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

fix & refactor: 修复轮盘与夺舍的bug,删除过时配置 #117

Merged
merged 3 commits into from
Sep 17, 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
5 changes: 1 addition & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Nonebot",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/bot.py",
"console": "integratedTerminal",
Expand Down
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"python.formatting.provider": "autopep8"
"[python]": {
"diffEditor.ignoreTrimWhitespace": false,
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnType": true,
"editor.formatOnSave": true
},
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "basic"
}
25 changes: 2 additions & 23 deletions bot.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import nonebot
from nonebot.adapters.onebot.v11 import Adapter as ONEBOT_V11Adapter

# Custom your logger
#
# from nonebot.log import logger, default_format
# logger.add("error.log",
# rotation="00:00",
# diagnose=False,
# level="ERROR",
# format=default_format)

# You can pass some keyword args config to init function

nonebot.init()
app = nonebot.get_asgi()

driver = nonebot.get_driver()
driver.register_adapter(ONEBOT_V11Adapter)


# Please DO NOT modify this file unless you know what you are doing!
# As an alternative, you should use command `nb` or modify `pyproject.toml` to load plugins
nonebot.load_from_toml("pyproject.toml")

# Modify some config / config depends on loaded configs
#
# config = driver.config
# do something...


if __name__ == "__main__":
nonebot.logger.warning("Always use `nb run` to start the bot instead of manually running!")
nonebot.run(app="__mp_main__:app")
nonebot.run()
10 changes: 0 additions & 10 deletions config.yml

This file was deleted.

9 changes: 0 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,5 @@ services:
- /opt/dockerstore/mongo/data:/data/db
- /opt/dockerstore/mongo/logs:/var/log/mongodb

qsign:
container_name: qsign
image: xzhouqd/qsign:8.9.63
environment:
- PORT=8080
- COUNT=3
- ANDROID_ID=114514
restart: always

networks:
pallasbot:
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ jieba-fast = "^0.53"
pypinyin = "^0.49.0"
asyncer = "^0.0.2"
nonebot-plugin-apscheduler = "^0.3.0"
nonebot-plugin-gocqhttp = "^0.6.4"
setuptools = "^74.1.2"

[tool.poetry.dev-dependencies]
nb-cli = "^1.2.0"

[tool.nonebot]
adapters = [
{ name = "OneBot V11", module_name = "nonebot.adapters.onebot.v11" }
]
plugins = ["nonebot_plugin_apscheduler"]
plugin_dirs = ["src/plugins"]

Expand Down
2 changes: 1 addition & 1 deletion src/common/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def roulette_mode(self) -> int:
:return: 0 踢人 1 禁言
'''
mode = self._find('roulette_mode')
return mode if mode else plugin_config.default_roulette_mode
return mode if mode != None else plugin_config.default_roulette_mode

def set_roulette_mode(self, mode: int) -> None:
'''
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/take_name/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ async def is_change_name_notice(bot: Bot, event: NoticeEvent, state: T_State) ->
async def watch_name_handle(bot: Bot, event: NoticeEvent, state: T_State):
group_id = event.group_id
user_id = event.user_id
bot_id = event.self_id

try:
info = await bot.call_api('get_group_member_info', **{
Expand All @@ -117,7 +118,7 @@ async def watch_name_handle(bot: Bot, event: NoticeEvent, state: T_State):
try:
await bot.call_api('set_group_card', **{
'group_id': group_id,
'user_id': user_id,
'user_id': bot_id,
'card': card
})

Expand Down
Loading