Skip to content

Commit

Permalink
remake sqlitedao with battlemaster and cmdv2 affected, add clan and l…
Browse files Browse the repository at this point in the history
…ogin to web
  • Loading branch information
SonodaHanami committed Oct 22, 2020
1 parent 8b33892 commit 81daa0a
Show file tree
Hide file tree
Showing 47 changed files with 5,664 additions and 387 deletions.
2 changes: 1 addition & 1 deletion deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
web:
image: zzbslayer/kokkoro_bot:latest
ports:
- "5100:5001"
- "5560:5001"
volumes:
- ~/.kokkoro:/root/.kokkoro
command: python3.8 -u /bot/run_web.py
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
web:
image: zzbslayer/kokkoro_bot:latest
ports:
- "5100:5001"
- "5560:5001"
volumes:
- ./:/bot/
- ~/.kokkoro:/root/.kokkoro
Expand Down
8 changes: 4 additions & 4 deletions kokkoro/bot/discord/discord_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def remove_mention_me(raw_message) -> (str, bool):
Pattern in official document is <@![a-z0-9A-Z]+>
e.g. <@!12345>
But the `at` sent by ios discord is <@[a-z0-9A-Z]>
But the `at` sent by iOS discord is <@[a-z0-9A-Z]>
e.g. <@12345>
So temp solution is <@!?[a-z0-9A-Z]+>
'''
dc_at_pattern = r'<@!?[a-z0-9A-Z]+>'
dc_at_pattern = r'<@!?[a-z0-9A-Z]+>'
def normalize_message(raw_message: str) -> str:
"""
规范化 at 信息,"<@!123> waht<@!312>a12" => "@123 waht @312 a12"
Expand All @@ -33,7 +33,7 @@ def normalize_message(raw_message: str) -> str:

def normalize_at(raw_at):
"""
规范化 at 信息,"<@!123>" => " @123 "
规范化 at 信息,"<@!123>" => " @123 "
ios: "<@123>" => " @123 "
"""
return f' @{raw_at[3:-1]} ' if '!' in raw_at else f' @{raw_at[2:-1]} '
return f' @{raw_at[3:-1]} ' if '!' in raw_at else f' @{raw_at[2:-1]} '
1 change: 1 addition & 0 deletions kokkoro/config_example/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import matplotlib.font_manager as font_manager

from .__bot__ import *
from .__web__ import *

for module in MODULES_ON:
try:
Expand Down
2 changes: 2 additions & 0 deletions kokkoro/config_example/__web__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PUBLIC_ADDRESS="http://DOMAIN_OR_IP_ADDRESS:5560"
PUBLIC_BASEPATH="/"
7 changes: 5 additions & 2 deletions kokkoro/modules/pcrclanbattle/clanbattle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .argparse import ArgParser
from .exception import *

from kokkoro import config
from kokkoro.typing import *
from kokkoro.common_interface import KokkoroBot, EventInterface
from kokkoro.service import Service
Expand All @@ -22,7 +23,7 @@ def cb_cmd(prefixes, parser:ArgParser) -> Callable:
prefixes = cb_prefix(prefixes)
if not isinstance(prefixes, Iterable):
raise ValueError('`name` of cb_cmd must be `str` or `Iterable[str]`')

def deco(func):
@wraps(func)
async def wrapper(bot: KokkoroBot, ev: EventInterface):
Expand All @@ -44,6 +45,8 @@ async def wrapper(bot: KokkoroBot, ev: EventInterface):


from .cmdv2 import *
if config.ENABLE_WEB:
from .cmd_web import *


QUICK_START = f'''
Expand Down Expand Up @@ -105,4 +108,4 @@ async def cb_help(bot: KokkoroBot, ev:EventInterface):
# content='命令一览表')
# await session.send(msg)

from . import report
from . import report
Loading

0 comments on commit 81daa0a

Please sign in to comment.