Skip to content

Commit

Permalink
Merge pull request #293 from LlmKira/kook
Browse files Browse the repository at this point in the history
Fix discord Intent Reco|Kook Platform | fix some bug
  • Loading branch information
sudoskys authored Oct 20, 2023
2 parents cd0edc1 + 1dbc79a commit 86c67a9
Show file tree
Hide file tree
Showing 21 changed files with 1,137 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .env.exp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ OPENAI_API_MODEL=gpt-3.5-turbo-0613
# DISCORD_BOT_PROXY_ADDRESS=socks5://127.0.0.1:7890
# DISCORD_BOT_PREFIX=!

# KOOK_BOT_TOKEN=xxx

AMQP_DSN=amqp://admin:admin@localhost:5672/
REDIS_DSN=redis://localhost:6379/0

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Feature `gpt-function-call`
|----------|------|------------|
| Telegram || |
| Discord || |
| Kook || |
| QQ || 计划中 |
| Wechat || |
| Twitter || |
Expand Down
1 change: 1 addition & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ implementing some or more features.
|----------|---------|-----------------|
| Telegram || |
| Discord || |
| Kook || |
| QQ || Working |
| Wechat || |
| Twitter || |
Expand Down
8 changes: 5 additions & 3 deletions llmkira/middleware/router/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @Author : sudoskys
# @File : __init__.py.py
# @Software: PyCharm
from typing import List
from typing import List, Union

from llmkira.cache.redis import cache
from llmkira.schema import singleton
Expand Down Expand Up @@ -32,9 +32,11 @@ async def _sync(self) -> RouterCache:
raise Exception(f"not found router info")
return sub_info

def get_router_by_user(self, to_: str, user_id: int) -> List[Router]:
def get_router_by_user(self, to_: str, user_id: Union[str, int]) -> List[Router]:
_all = self.router.router
return [router for router in _all if router.user_id == user_id and router.to_ == to_]
assert user_id, "user_id is None"
user_id = str(user_id)
return [router for router in _all if str(router.user_id) == str(user_id) and router.to_ == to_]

def get_router_by_sender(self, from_: str) -> List[Router]:
_all = self.router.router
Expand Down
2 changes: 2 additions & 0 deletions llmkira/receiver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .aps import aps_start
from .discord import DiscordReceiver
from .function import FunctionReceiver
from .kook import KookReceiver

load_dotenv()
logger.remove()
Expand All @@ -36,6 +37,7 @@
FunctionReceiver().function(),
TelegramReceiver().telegram(),
DiscordReceiver().discord(),
KookReceiver().kook(),
]

# 导入插件
Expand Down
Loading

0 comments on commit 86c67a9

Please sign in to comment.