Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
madawei2699 committed Nov 19, 2023
1 parent 64bd597 commit e6a55cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def extract_urls_from_event(event):
filetype_voice_extension_allowed = ['m4a', 'webm', 'mp3', 'wav']
max_file_size = 3 * 1024 * 1024

limiter_message_per_user = 10
limiter_time_period = 8 * 3600
limiter_message_per_user = 5
limiter_time_period = 24 * 3600
limiter = RateLimiter(limit=limiter_message_per_user, period=limiter_time_period)

def dialog_context_keep_latest(dialog_texts, max_length=1):
Expand Down Expand Up @@ -254,12 +254,12 @@ def handle_mentions(event, say, logger):
thread_ts = event["ts"]

if not is_active_user(user):
say(f'<@{user}>, 你的账户未激活,请添加微信 `improve365_cn` 联系管理员激活你的账户后再试用。', thread_ts=thread_ts)
say(f'<@{user}>, 你的账户未激活,请微信联系 `improve365_cn` 管理员激活你的账户后再试用。', thread_ts=thread_ts)
return

if not limiter.allow_request(user):
if not is_premium_user(user):
say(f'<@{user}>, you have reached the limit of {limiter_message_per_user} messages {limiter_time_period / 3600} hour, please subscribe to our Premium plan to support our service. You can find the payment link by clicking on the bot and selecting the Home tab.', thread_ts=thread_ts)
say(f'<@{user}>, 免费用户试用额度为 {limiter_message_per_user} 条对话每 {limiter_time_period / 3600} 小时, 你已超出该限制,请等待后再试。如欲购买请微信联系 `improve365_cn` 管理员。', thread_ts=thread_ts)
return

bot_process(event, say, logger)
Expand Down

0 comments on commit e6a55cc

Please sign in to comment.