-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from noneplugin/feat/orm
- Loading branch information
Showing
8 changed files
with
762 additions
and
666 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
*__pycache__/ | ||
dist/ | ||
.vscode/ | ||
.vscode/ | ||
.env | ||
data.db |
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 |
---|---|---|
|
@@ -9,32 +9,19 @@ | |
from nonebot.exception import ParserExit | ||
from nonebot.matcher import Matcher | ||
from nonebot.params import CommandArg, CommandStart, EventToMe, ShellCommandArgv | ||
from nonebot.plugin import PluginMetadata | ||
from nonebot.plugin import PluginMetadata, inherit_supported_adapters | ||
from nonebot.rule import ArgumentParser, Rule | ||
|
||
require("nonebot_plugin_saa") | ||
require("nonebot_plugin_session") | ||
require("nonebot_plugin_userinfo") | ||
require("nonebot_plugin_datastore") | ||
require("nonebot_plugin_orm") | ||
require("nonebot_plugin_htmlrender") | ||
|
||
from nonebot_plugin_saa import Image, MessageFactory | ||
from nonebot_plugin_saa import __plugin_meta__ as saa_plugin_meta | ||
from nonebot_plugin_session import SessionIdType, SessionLevel | ||
from nonebot_plugin_session import __plugin_meta__ as session_plugin_meta | ||
from nonebot_plugin_session import extract_session | ||
from nonebot_plugin_userinfo import __plugin_meta__ as userinfo_plugin_meta | ||
from nonebot_plugin_session import SessionIdType, SessionLevel, extract_session | ||
from nonebot_plugin_userinfo import get_user_info | ||
|
||
assert saa_plugin_meta.supported_adapters | ||
assert session_plugin_meta.supported_adapters | ||
assert userinfo_plugin_meta.supported_adapters | ||
supported_adapters = ( | ||
saa_plugin_meta.supported_adapters | ||
& session_plugin_meta.supported_adapters | ||
& userinfo_plugin_meta.supported_adapters | ||
) | ||
|
||
from .game import Game, MoveResult, Player, Pos | ||
from .go import Go | ||
from .gomoku import Gomoku | ||
|
@@ -50,12 +37,14 @@ | |
), | ||
type="application", | ||
homepage="https://github.com/noneplugin/nonebot-plugin-boardgame", | ||
supported_adapters=supported_adapters, | ||
supported_adapters=inherit_supported_adapters( | ||
"nonebot_plugin_saa", "nonebot_plugin_session", "nonebot_plugin_userinfo" | ||
), | ||
extra={ | ||
"unique_name": "boardgame", | ||
"example": "@小Q 五子棋\n落子 G8\n结束下棋", | ||
"author": "meetwq <[email protected]>", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
}, | ||
) | ||
|
||
|
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
42 changes: 0 additions & 42 deletions
42
nonebot_plugin_boardgame/migrations/b737d3c58568_init_db.py
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
nonebot_plugin_boardgame/migrations/dc81a3212383_init_db.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""init_db | ||
修订 ID: dc81a3212383 | ||
父修订: | ||
创建时间: 2023-10-20 14:29:37.795528 | ||
""" | ||
from __future__ import annotations | ||
|
||
from collections.abc import Sequence | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
revision: str = "dc81a3212383" | ||
down_revision: str | Sequence[str] | None = None | ||
branch_labels: str | Sequence[str] | None = "nonebot_plugin_boardgame" | ||
depends_on: str | Sequence[str] | None = None | ||
|
||
|
||
def upgrade(name: str = "") -> None: | ||
if name: | ||
return | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"nonebot_plugin_boardgame_gamerecord", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("game_id", sa.String(length=128), nullable=False), | ||
sa.Column("session_id", sa.String(length=128), nullable=False), | ||
sa.Column("name", sa.String(length=32), nullable=False), | ||
sa.Column("start_time", sa.DateTime(), nullable=False), | ||
sa.Column("update_time", sa.DateTime(), nullable=False), | ||
sa.Column("player_black_id", sa.String(length=64), nullable=False), | ||
sa.Column("player_black_name", sa.Text(), nullable=False), | ||
sa.Column("player_white_id", sa.String(length=64), nullable=False), | ||
sa.Column("player_white_name", sa.Text(), nullable=False), | ||
sa.Column("positions", sa.Text(), nullable=False), | ||
sa.Column("is_game_over", sa.Boolean(), nullable=False), | ||
sa.PrimaryKeyConstraint( | ||
"id", name=op.f("pk_nonebot_plugin_boardgame_gamerecord") | ||
), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(name: str = "") -> None: | ||
if name: | ||
return | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("nonebot_plugin_boardgame_gamerecord") | ||
# ### end Alembic commands ### |
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
Oops, something went wrong.