Skip to content

Commit

Permalink
合并最新提交
Browse files Browse the repository at this point in the history
  • Loading branch information
smoadrareun committed Jan 17, 2024
1 parent e64c846 commit 5ff11e7
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions nonebot_plugin_bilifan/src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,16 @@ async def likeInteract(self, room_id: int):
"click_time": 1,
"roomid": room_id,
}
self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
)
# for _ in range(3):
await self.__post(
url,
data=SingableDict(data).signed,
headers=self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
),
headers=self.headers,
)
# await asyncio.sleep(self.u.config['LIKE_CD'] if not self.u.config['ASYNC'] else 2)

Expand All @@ -204,15 +205,16 @@ async def likeInteractV3(self, room_id: int, up_id: int, self_uid: int):
"anchor_id": up_id,
"uid": self_uid,
}
self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
)
# for _ in range(3):
await self.__post(
url,
data=SingableDict(data).signed,
headers=self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
),
headers=self.headers,
)

async def shareRoom(self, room_id: int):
Expand All @@ -228,15 +230,16 @@ async def shareRoom(self, room_id: int):
"interact_type": 3,
"roomid": room_id,
}
self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
)
# for _ in range(5):
await self.__post(
url,
data=SingableDict(data).signed,
headers=self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
),
headers=self.headers,
)
# await asyncio.sleep(self.u.config['SHARE_CD'] if not self.u.config['ASYNC'] else 5)

Expand Down Expand Up @@ -275,16 +278,17 @@ async def sendDanmaku(self, room_id: int) -> str:
"color": "16777215",
"fontsize": "25",
}
self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
)
try:
resp = await self.__post(
url,
params=SingableDict(params).signed,
data=data,
headers=self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
),
headers=self.headers,
)
except BiliApiError as e:
if e.code == 0:
Expand Down Expand Up @@ -451,14 +455,15 @@ async def heartbeat(self, room_id: int, up_id: int):
"ts": int(time.time()),
}, # type: ignore
) # type: ignore
self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
)
return await self.__post(
url,
data=SingableDict(data).signed,
headers=self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
),
headers=self.headers,
)

async def wearMedal(self, medal_id: int):
Expand All @@ -476,14 +481,15 @@ async def wearMedal(self, medal_id: int):
"type": "1",
"version": "0",
}
self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
)
return await self.__post(
url,
data=SingableDict(data).signed,
headers=self.headers.update(
{
"Content-Type": "application/x-www-form-urlencoded",
},
),
headers=self.headers,
)

async def getGroups(self):
Expand Down

0 comments on commit 5ff11e7

Please sign in to comment.