Skip to content

Commit

Permalink
fix: qqgroup not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluefissure committed Apr 19, 2022
1 parent 44b58aa commit 49b1243
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions ffxivbot/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ async def connect(self):
elif "OneBot" in user_agent and "Bearer" in ws_access_token:
# onebot基于rfc6750往token加入了Bearer
ws_access_token = ws_access_token.replace("Bearer", "").strip()
else:
LOGGER.error(f"Unkown UA: {user_agent}")
await self.close()

bot = None
# with transaction.atomic():
Expand All @@ -131,12 +134,12 @@ async def connect(self):
LOGGER.error(
"%s:%s:API:AUTH_FAIL from %s" % (ws_self_id, ws_access_token, true_ip)
)
# await self.close()
await self.close()
except:
LOGGER.error("Unauthed connection from %s" % (true_ip))
LOGGER.error(headers)
# traceback.print_exc()
# await self.close()
await self.close()

async def redis_disconnect(self, *args):
LOGGER.info("Redis of channel {} disconnected".format(self.channel_name))
Expand Down Expand Up @@ -183,7 +186,7 @@ async def receive(self, text_data):
msg += "[CQ:at,qq={}]".format(block["data"]["qq"])
receive["message"] = msg
priority = 1
push_to_mq = True
push_to_mq = receive["message"].startswith("/") or receive["message"].startswith("\\")
if "group_id" in receive:
priority += 1
group_id = receive["group_id"]
Expand Down
2 changes: 1 addition & 1 deletion ffxivbot/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def on_notice(self, receive, **kwargs):
group_id = receive["group_id"]
user_id = receive["user_id"]
try:
group = QQGroup.objects.get(group_id=group_id)
(group, __) = QQGroup.objects.get_or_create(group_id=group_id)
welcome_msg = group.welcome_msg.strip()
if welcome_msg:
msg = "[CQ:at,qq=%s]" % (user_id) + welcome_msg
Expand Down

0 comments on commit 49b1243

Please sign in to comment.