mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-23 21:48:18 +00:00
news60s 修复 API
This commit is contained in:
parent
239476acba
commit
635df5cf40
42
index.html
Normal file
42
index.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>无法访问!</title>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
|
||||
<meta name="robots" content="noindex, nofollow"/>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/>
|
||||
<link rel="stylesheet" id="cf_styles-css" href="https://cloudflare.com/cdn-cgi/styles/cf.errors.css" type="text/css"
|
||||
media="screen,projection"/>
|
||||
<link rel="stylesheet" id='cf_styles-ie-css' href="https://cloudflare.com/cdn-cgi/styles/cf.errors.ie.css"
|
||||
type="text/css" media="screen,projection"/>
|
||||
<style type="text/css">body {
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}</style>
|
||||
<script type="text/javascript" src="https://cloudflare.com/cdn-cgi/scripts/zepto.min.js"></script>
|
||||
<script type="text/javascript" src="https://cloudflare.com/cdn-cgi/scripts/cf.common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cf-wrapper">
|
||||
<div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">
|
||||
请启用cookie。
|
||||
</div>
|
||||
<div id="cf-error-details" class="cf-error-details-wrapper">
|
||||
<div class="cf-wrapper cf-header cf-error-overview">
|
||||
<h1 data-translate="block_headline">抱歉,您已被阻止</h1>
|
||||
</div>
|
||||
|
||||
<div class="cf-section cf-highlight">
|
||||
<div class="cf-wrapper">
|
||||
<div class="cf-screenshot-container cf-screenshot-full">
|
||||
|
||||
<span class="cf-no-screenshot error"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -3,7 +3,7 @@
|
||||
from os import sep
|
||||
from os.path import isfile
|
||||
from datetime import date
|
||||
from typing import Optional, Dict
|
||||
from typing import Optional
|
||||
|
||||
from pyrogram.enums.parse_mode import ParseMode
|
||||
from pagermaid import scheduler
|
||||
@ -20,22 +20,22 @@ news60s_cache_time: Optional[date] = None
|
||||
|
||||
async def get_news60s() -> None:
|
||||
global news60s_cache_time
|
||||
if news60s_cache_time == date.today() and isfile(f"data{sep}news60s.jpg"):
|
||||
if news60s_cache_time == date.today() and isfile(f"data{sep}news60s.png"):
|
||||
return
|
||||
resp = await client.get("https://api.03c3.cn/zb/")
|
||||
resp = await client.get("https://api.emoao.com/api/60s")
|
||||
if resp.is_error:
|
||||
raise ValueError(f"获取失败,错误码:{resp.status_code}")
|
||||
news60s_cache_time = date.today()
|
||||
safe_remove(f"data{sep}news60s.jpg")
|
||||
with open(f"data{sep}news60s.jpg", "wb") as f:
|
||||
safe_remove(f"data{sep}news60s.png")
|
||||
with open(f"data{sep}news60s.png", "wb") as f:
|
||||
f.write(resp.content)
|
||||
|
||||
|
||||
async def push_news60s(gid: int) -> None:
|
||||
if isfile(f"data{sep}news60s.jpg"):
|
||||
if isfile(f"data{sep}news60s.png"):
|
||||
await bot.send_photo(
|
||||
gid,
|
||||
f"data{sep}news60s.jpg"
|
||||
f"data{sep}news60s.png"
|
||||
)
|
||||
|
||||
|
||||
@ -49,9 +49,11 @@ async def news60s_subscribe() -> None:
|
||||
news60s_sub.del_id(gid)
|
||||
|
||||
|
||||
@listener(command="news60s",
|
||||
parameters="订阅/退订",
|
||||
description="查看 60s 看世界新闻,支持订阅/退订每天上午八点定时发送")
|
||||
@listener(
|
||||
command="news60s",
|
||||
parameters="订阅/退订",
|
||||
description="查看 60s 看世界新闻,支持订阅/退订每天上午八点定时发送"
|
||||
)
|
||||
async def news60s(message: Message):
|
||||
if not message.arguments:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user