Skip to content

Commit

Permalink
🐛 Fixed /invite
Browse files Browse the repository at this point in the history
  • Loading branch information
AirportR committed Apr 30, 2024
1 parent 06eabfb commit f78548e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ FullTClash名字来源于 Full Test base on Clash 。后端部分使用[Clash项
1. Netflix
2. Youtube
3. DisneyPlus
4. steam货币
4. Bilibili解锁
5. OpenAI(ChatGPT)
6. 落地ip风险(IP欺诈度)
7. 维基百科
8. TVBAnyware
9. Viu
8. 微软Copilot
9. Claude
10. 落地DNS区域检测
11. Spotify
12. SSH 22端口封禁检测
13. Tiktok

此外还有:

Expand Down Expand Up @@ -152,7 +156,7 @@ pip install -r requirements.txt
Windows系统名字后缀名.exe要加上,其他类Unix系统不需要加后缀名。
- 管理员配置(可选)
从3.6.10版本开始,bot在首次启动时会将接收到的第一条消息的发送者作为管理员,一般无需手动配置,除非您想设置多个管理员:
从3.6.11版本开始,bot在首次启动时会将接收到的第一条消息的发送者作为管理员,一般无需手动配置,除非您想设置多个管理员:
```yaml
admin:
- 12345678 # 改成自己的telegram uid
Expand Down
3 changes: 3 additions & 0 deletions addons/builtin/copilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ async def fetch_copilot(collector, session: aiohttp.ClientSession, proxy=None):
return True
if resp.status == 200:
text = await resp.text()
print(text)
# index = text.find("Copilot")
index = text.find("b-scopeListItem-conv")
index2 = text.find("Sorry, it looks like you've been signed out.")
print(index2)
try:
region = re.search(r'Region:"(\w\w)"', text).group(1)
# region2 = re.search(r'Region:"(.*)"', text).group(1)
Expand Down
20 changes: 14 additions & 6 deletions botmodule/command/authority.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
'slaveid': {}, # 记录后端id选择
}
task_type = ['testurl', 'analyzeurl', 'speedurl']
temp_queue = asyncio.Queue(maxsize=1)
# temp_queue = {}
QUEUE_MAP = {}


def generate_random_string(length: int):
Expand Down Expand Up @@ -123,6 +124,9 @@ async def get_url_from_invite(_, message2: "Message"):
exclude_text = texts_li[2]
url_li = geturl(text_li, True)
if url_li:
temp_queue: Union[asyncio.Queue, None] = QUEUE_MAP.get(ID, None)
if temp_queue is None:
await message2.reply("❌此任务队列已被销毁,请重试")
await temp_queue.put((url_li, include_text, exclude_text))
else:
await message2.reply("无效的URL")
Expand Down Expand Up @@ -176,24 +180,28 @@ async def invite_pass(client: Client, message: Message):
return
try:
async with timeout(timeout_value):
suburl, in_text, ex_text = await temp_queue.get()
iq = asyncio.Queue(1)
QUEUE_MAP[start_uid] = iq
suburl, in_text, ex_text = await iq.get()
except asyncio.TimeoutError:
logger.info(f"验证过期: {key}")
await bot_mes.edit_text("❌任务已取消\n\n原因: 接收订阅链接超时")
finally:
QUEUE_MAP.pop(start_uid, None)
INVITE_CACHE.pop(key, '')
if suburl:
from botmodule.bot import bot_put
await message.reply("✨提交成功,请返回群组查看测试结果。")
await asyncio.sleep(3)
await asyncio.sleep(1)
await bot_mes.delete()
# await bot_put(app, originmsg, put_type, None, sort=sort_str, coreindex=1, slaveid=slaveid)
print(
logger.info(
f"invite提交的任务项: {subtext[1]}\n测试项:{test_items}\n过滤器: {in_text}<->{ex_text}\n排序: {sort_str}\n"
f"coreindex: {coreindex}\n后端id: {slaveid}")
await bot_put(client, mes, subtext[1], test_items=test_items,
include_text=in_text, exclude_text=ex_text, url=suburl,
sort=sort_str, coreindex=coreindex, slaveid=slaveid)
else:
INVITE_CACHE.pop(key, '')

success_message_list.pop(start_uid, None)


Expand Down

0 comments on commit f78548e

Please sign in to comment.