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

Add clan and login to web, modify a lot about database #30

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
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