Skip to content

Commit

Permalink
日常任务插件化
Browse files Browse the repository at this point in the history
  • Loading branch information
lzghzr committed Nov 19, 2018
1 parent 3bfb945 commit b107fe6
Show file tree
Hide file tree
Showing 18 changed files with 868 additions and 680 deletions.
309 changes: 25 additions & 284 deletions bilive/@types/bilive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ interface userData {
refreshToken: string
cookie: string
status: boolean
doSign: boolean
treasureBox: boolean
eventRoom: boolean
silver2coin: boolean
sendGift: boolean
sendGiftRoom: number
signGroup: boolean
}
interface optionsInfo {
[index: string]: configInfoData
Expand All @@ -63,13 +56,6 @@ interface optionsInfo {
refreshToken: configInfoData
cookie: configInfoData
status: configInfoData
doSign: configInfoData
treasureBox: configInfoData
eventRoom: configInfoData
silver2coin: configInfoData
sendGift: configInfoData
sendGiftRoom: configInfoData
signGroup: configInfoData
}
interface configInfoData {
description: string
Expand All @@ -80,35 +66,39 @@ interface configInfoData {
/*******************
****** User ******
*******************/
interface AppClient {
readonly actionKey: string
readonly platform: string
readonly appKey: string
readonly build: string
readonly device: string
readonly mobiApp: string
readonly TS: number
readonly RND: number
readonly DeviceID: string
readonly baseQuery: string
signQuery(params: string, ts?: boolean): string
signQueryBase(params?: string): string
readonly status: typeof status
interface requestHeaders {
[index: string]: string
}
declare class AppClient {
static actionKey: string
static platform: string
static appKey: string
static build: string
static device: string
static mobiApp: string
static TS: number
static RND: number
static DeviceID: string
static baseQuery: string
static signQuery(params: string, ts?: boolean): string
static signQueryBase(params?: string): string
static status: typeof status
captcha: string
userName: string
passWord: string
biliUID: number
accessToken: string
refreshToken: string
cookieString: string
headers: Headers
headers: requestHeaders
init(): Promise<void>
getCaptcha(): Promise<captchaResponse>
login(): Promise<loginResponse>
logout(): Promise<logoutResponse>
refresh(): Promise<loginResponse>
}
interface Online extends AppClient {
declare class Online extends AppClient {
uid: string
userData: userData
readonly nickname: string
jar: {
Expand All @@ -120,21 +110,7 @@ interface Online extends AppClient {
Stop(): void
getOnlineInfo(roomID?: number): Promise<'captcha' | 'stop' | void>
}
interface Daily extends Online {
uid: string
Start(): Promise<'captcha' | 'stop' | void>
Stop(): void
nextDay(): Promise<void>
daily(): Promise<void>
sign(): Promise<void>
treasureBox(): Promise<void>
eventRoom(): Promise<void>
silver2coin(): Promise<void>
sendGift(): Promise<void>
checkBag(): Promise<XHRresponse<bagInfo> | undefined>
signGroup(): Promise<void>
}
type User = Daily
type User = Online
/*******************
**** dm_client ****
*******************/
Expand Down Expand Up @@ -510,241 +486,6 @@ interface userOnlineHeart {
code: number
msg: string
}
/*******************
***** daily *******
*******************/
/**
* 签到信息
*
* @interface signInfo
*/
interface signInfo {
code: number
msg: string
data: signInfoData
}
interface signInfoData {
text: string
status: number
allDays: string
curMonth: string
newTask: number
hadSignDays: number
remindDays: number
}
/**
* 在线领瓜子宝箱
*
* @interface currentTask
*/
interface currentTask {
code: number
msg: string
data: currentTaskData
}
interface currentTaskData {
minute: number
silver: number
time_start: number
time_end: number
}
/**
* 领瓜子答案提交返回
*
* @interface award
*/
interface award {
code: number
msg: string
data: awardData
}
interface awardData {
silver: number
awardSilver: number
isEnd: number
}
/**
* 房间信息
*
* @interface roomInit
*/
interface roomInit {
code: number
msg: string
message: string
data: roomInitDataData
}
interface roomInitDataData {
room_id: number
short_id: number
uid: number
need_p2p: number
is_hidden: boolean
is_locked: boolean
is_portrait: boolean
live_status: number
hidden_till: number
lock_till: number
encrypted: boolean
pwd_verified: boolean
}
/**
* 分享房间返回
*
* @interface shareCallback
*/
interface shareCallback {
code: number
msg: string
message: string
}
/**
* 每日包裹
*
* @interface getBagGift
*/
interface getBagGift {
code: number
}
/**
* 包裹信息
*
* @interface bagInfo
*/
interface bagInfo {
code: number
msg: string
message: string
data: bagInfoData[]
}
interface bagInfoData {
id: number
uid: number
gift_id: number
gift_num: number
expireat: number
gift_type: number
gift_name: string
gift_price: string
img: string
count_set: string
combo_num: number
super_num: number
}
/**
* 赠送包裹礼物
*
* @interface sendBag
*/
interface sendBag {
code: number
msg: string
message: string
data: sendBagData
}
interface sendBagData {
tid: string
uid: number
uname: string
ruid: number
rcost: number
gift_id: number
gift_type: number
gift_name: string
gift_num: number
gift_action: string
gift_price: number
coin_type: string
total_coin: number
metadata: string
rnd: string
}
/**
* 应援团
*
* @interface linkGroup
*/
interface linkGroup {
code: number
msg: string
message: string
data: linkGroupData
}
interface linkGroupData {
list: linkGroupInfo[]
}
interface linkGroupInfo {
group_id: number
owner_uid: number
owner_name: string
group_type: number
group_level: number
group_cover: string
group_name: string
group_notice: string
group_status: number
}
/**
* 应援团签到返回
*
* @interface signGroup
*/
interface signGroup {
code: number
msg: string
message: string
data: signGroupData
}
interface signGroupData {
add_num: number
status: number
}
/**
* 银瓜子兑换硬币返回
*
* @interface silver2coin
*/
interface silver2coin {
code: number
msg: string
message: string
data: silver2coinData
}
interface silver2coinData {
silver: string
gold: string
tid: string
coin: number
}
/**
* 每日任务
*
* @interface taskInfo
*/
interface taskInfo {
code: number
msg: string
data: taskInfoData
}
interface taskInfoData {
[index: string]: taskInfoDoublewatchinfo
}
interface taskInfoDoublewatchinfo {
task_id: string | undefined
}
/**
* 兑换扭蛋币
*
* @interface capsule
*/
interface capsule {
code: number
msg: string
data: capsuleData | any[]
}
interface capsuleData {
capsule: SEND_GIFT_data_capsule
}
/*******************
***** options *****
*******************/
Expand All @@ -754,8 +495,8 @@ interface Options {
whiteList: Set<string>
shortRoomID: Map<number, number>
longRoomID: Map<number, number>
init: () => void
save: () => Promise<options>
init(): void
save(): Promise<options>
}
/*******************
****** plugin *****
Expand All @@ -766,8 +507,8 @@ interface IPlugin {
version: string
author: string
loaded: boolean
start?({ defaultOptions, whiteList }: { defaultOptions: options, whiteList: Set<string> }): Promise<void>
once?({ options, users }: { options: options, users: Map<string, User> }): Promise<void>
load?({ defaultOptions, whiteList }: { defaultOptions: options, whiteList: Set<string> }): Promise<void>
start?({ options, users }: { options: options, users: Map<string, User> }): Promise<void>
loop?({ cst, cstMin, cstHour, cstString, options, users }: { cst: Date, cstMin: number, cstHour: number, cstString: string, options: options, users: Map<string, User> }): Promise<void>
msg?({ message, options, users }: { message: raffleMessage | lotteryMessage | beatStormMessage, options: options, users: Map<string, User> }): Promise<void>
}
Loading

0 comments on commit b107fe6

Please sign in to comment.