mirror of
https://github.com/Xtao-Labs/iShotaBot.git
synced 2024-11-30 19:30:41 +00:00
fix: miyoushe splash
This commit is contained in:
parent
10c43d0647
commit
7f0e16c7f2
@ -25,3 +25,4 @@ amap_key = ABCD
|
|||||||
bili_cookie = ABCD
|
bili_cookie = ABCD
|
||||||
bili_auth_user = 777000,111000
|
bili_auth_user = 777000,111000
|
||||||
bili_auth_chat = 777000,111000
|
bili_auth_chat = 777000,111000
|
||||||
|
mys_cookie = ABCD
|
||||||
|
@ -7,7 +7,7 @@ from pyrogram.enums import ParseMode
|
|||||||
from pyrogram.errors import FloodWait
|
from pyrogram.errors import FloodWait
|
||||||
from pyrogram.types import InlineQueryResultCachedPhoto
|
from pyrogram.types import InlineQueryResultCachedPhoto
|
||||||
|
|
||||||
from defs.glover import splash_channel, splash_channel_username
|
from defs.glover import splash_channel, splash_channel_username, config
|
||||||
from defs.request import cache_file
|
from defs.request import cache_file
|
||||||
from init import bot, request, logger
|
from init import bot, request, logger
|
||||||
from models.models.splash import Splash as SplashModel
|
from models.models.splash import Splash as SplashModel
|
||||||
@ -16,7 +16,11 @@ from models.services.splash import SplashService
|
|||||||
|
|
||||||
|
|
||||||
async def get_splash() -> List[SplashApi]:
|
async def get_splash() -> List[SplashApi]:
|
||||||
data = await request.get("https://bbs-api.miyoushe.com/apihub/api/getAppSplash")
|
mys_cookie = config.get("api", "mys_cookie", fallback="")
|
||||||
|
headers = {
|
||||||
|
"cookie": mys_cookie,
|
||||||
|
}
|
||||||
|
data = await request.get("https://bbs-api.miyoushe.com/apihub/api/getAppSplash", headers=headers)
|
||||||
splash_list = []
|
splash_list = []
|
||||||
if data.is_success:
|
if data.is_success:
|
||||||
data = data.json()
|
data = data.json()
|
||||||
|
@ -17,7 +17,7 @@ async def repeater_handler(client: Client, message: Message):
|
|||||||
try:
|
try:
|
||||||
last_msg[group_id]
|
last_msg[group_id]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
last_msg[group_id] = ""
|
last_msg[group_id] = {}
|
||||||
try:
|
try:
|
||||||
last_repeat_msg[group_id]
|
last_repeat_msg[group_id]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -34,8 +34,14 @@ async def repeater_handler(client: Client, message: Message):
|
|||||||
):
|
):
|
||||||
raise ContinuePropagation
|
raise ContinuePropagation
|
||||||
|
|
||||||
if msg != last_msg[group_id] or msg == last_repeat_msg[group_id]:
|
last_msg_text = last_msg[group_id].get("text", "")
|
||||||
last_msg[group_id] = msg
|
last_msg_id = last_msg[group_id].get("id", 0)
|
||||||
|
|
||||||
|
if message.id == last_msg_id:
|
||||||
|
raise ContinuePropagation
|
||||||
|
|
||||||
|
if msg != last_msg_text or msg == last_repeat_msg[group_id]:
|
||||||
|
last_msg[group_id] = {"text": msg, "id": message.id}
|
||||||
repeat_count[group_id] = 0
|
repeat_count[group_id] = 0
|
||||||
else:
|
else:
|
||||||
repeat_count[group_id] += 1
|
repeat_count[group_id] += 1
|
||||||
@ -43,6 +49,6 @@ async def repeater_handler(client: Client, message: Message):
|
|||||||
if repeat_count[group_id] >= 2:
|
if repeat_count[group_id] >= 2:
|
||||||
await client.send_message(group_id, t_msg)
|
await client.send_message(group_id, t_msg)
|
||||||
repeat_count[group_id] = 0
|
repeat_count[group_id] = 0
|
||||||
last_msg[group_id] = ""
|
last_msg[group_id] = {}
|
||||||
last_repeat_msg[group_id] = msg
|
last_repeat_msg[group_id] = msg
|
||||||
raise ContinuePropagation
|
raise ContinuePropagation
|
||||||
|
Loading…
Reference in New Issue
Block a user