Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加六级后不投币的配置 #309

Merged
merged 5 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/sample/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"IsWatchVideo": true, //是否观看视频
"IsShareVideo": true, //是否分享视频
"NumberOfCoins": 5, //每日设定的投币数 [0,5]
"SaveCoinsWhenLv6": false, //达到六级后是否开始白嫖
"SelectLike": true, //投币时是否同时点赞[false,true]
"SupportUpIds": "", //优先选择支持的up主Id集合,多个以英文逗号分隔,如:"123,456"。配置后会优先从指定的up主下挑选视频进行观看、分享和投币,不配置或配置为-1则表示没有特别支持的up,会从关注和排行耪中随机获取支持视频
"DayOfAutoCharge": -1, //每月几号自动充电[-1,31],-1表示不指定,默认月底最后一天;0表示不充电
Expand Down
2 changes: 2 additions & 0 deletions docker/sample/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ services:

# 目标投币数量:
- Ray_DailyTaskConfig__NumberOfCoins:
# 达到六级后是否开始白嫖:
- Ray_DailyTaskConfig__SaveCoinsWhenLv6:

# 天选抽奖指定排除关键字
- Ray_LiveLotteryTaskConfig__ExcludeAwardNames:
Expand Down
1 change: 1 addition & 0 deletions gitHubActions/bak/bilibili-daily-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ env:
Ray_Security__RandomSleepMaxMin: ${{secrets.RANDOMSLEEPMAXMIN}}
# 每日任务:
Ray_DailyTaskConfig__NumberOfCoins: ${{secrets.NUMBEROFCOINS}}
Ray_DailyTaskConfig__SaveCoinsWhenLv6: ${{secrets.SAVECOINSWHENLV6}}
Ray_DailyTaskConfig__SelectLike: ${{secrets.SELECTLIKE}}
Ray_DailyTaskConfig__SupportUpIds: ${{secrets.SUPPORTUPIDS}}
Ray_DailyTaskConfig__DayOfAutoCharge: ${{secrets.DAYOFAUTOCHARGE}}
Expand Down
1 change: 1 addition & 0 deletions gitHubActions/bak/empty-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ env:
Ray_Security__RandomSleepMaxMin: ${{secrets.RANDOMSLEEPMAXMIN}}
# 每日任务:
Ray_DailyTaskConfig__NumberOfCoins: ${{secrets.NUMBEROFCOINS}}
Ray_DailyTaskConfig__SaveCoinsWhenLv6: ${{secrets.SAVECOINSWHENLV6}}
Ray_DailyTaskConfig__SelectLike: ${{secrets.SELECTLIKE}}
Ray_DailyTaskConfig__SupportUpIds: ${{secrets.SUPPORTUPIDS}}
Ray_DailyTaskConfig__DayOfAutoCharge: ${{secrets.DAYOFAUTOCHARGE}}
Expand Down
9 changes: 7 additions & 2 deletions src/Ray.BiliBiliTool.Application/DailyTaskAppService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public override void DoTask()
UserInfo userInfo = Login();
DailyTaskInfo dailyTaskInfo = GetDailyTaskStatus();
WatchAndShareVideo(dailyTaskInfo);
AddCoinsForVideo();
AddCoinsForVideo(userInfo);

//签到:
LiveSign();
Expand Down Expand Up @@ -122,8 +122,13 @@ private void WatchAndShareVideo(DailyTaskInfo dailyTaskInfo)
/// 投币任务
/// </summary>
[TaskInterceptor("投币", rethrowWhenException: false)]
private void AddCoinsForVideo()
private void AddCoinsForVideo(UserInfo userInfo)
{
if (_dailyTaskOptions.SaveCoinsWhenLv6 && userInfo.Level_info.Current_level >= 6)
{
_logger.LogInformation("已经为LV6大佬,开始白嫖");
return;
}
_donateCoinDomainService.AddCoinsForVideos();
}

Expand Down
6 changes: 6 additions & 0 deletions src/Ray.BiliBiliTool.Config/Options/DailyTaskOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public class DailyTaskOptions
/// </summary>
public int NumberOfCoins { get; set; } = 5;

/// <summary>
/// 达到六级后是否开始白嫖
/// </summary>
public bool SaveCoinsWhenLv6 { get; set; } = false;


/// <summary>
/// 投币时是否点赞[false,true]
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Ray.BiliBiliTool.Console/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"IsWatchVideo": true, //是否观看视频
"IsShareVideo": true, //是否分享视频
"NumberOfCoins": 5, //每日设定的投币数 [0,5]
"SaveCoinsWhenLv6": false, //达到六级后是否开始白嫖[false,true]
"SelectLike": true, //投币时是否同时点赞[false,true]
"SupportUpIds": "", //优先选择支持的up主Id集合,多个以英文逗号分隔,如:"123,456"。配置后会优先从指定的up主下挑选视频进行观看、分享和投币,不配置或配置为-1则表示没有特别支持的up,会从关注和排行耪中随机获取支持视频
"DayOfAutoCharge": -1, //每月几号自动充电[-1,31],-1表示不指定,默认月底最后一天;0表示不充电
Expand Down
2 changes: 2 additions & 0 deletions src/Ray.BiliBiliTool.Console/commandLineMappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"--runTasks": "RunTasks",

"--numberOfCoins": "DailyTaskConfig:NumberOfCoins",
"--saveCoinsWhenLv6": "DailyTaskConfig:SaveCoinsWhenLv6",
"--selectLike": "DailyTaskConfig:SelectLike",
"--supportUpIds": "DailyTaskConfig:SupportUpIds",
"--dayOfAutoCharge": "DailyTaskConfig:DayOfAutoCharge",
Expand Down Expand Up @@ -35,6 +36,7 @@
"-runTasks": "RunTasks",

"-numberOfCoins": "DailyTaskConfig:NumberOfCoins",
"-saveCoinsWhenLv6": "DailyTaskConfig:SaveCoinsWhenLv6",
"-selectLike": "DailyTaskConfig:SelectLike",
"-supportUpIds": "DailyTaskConfig:SupportUpIds",
"-dayOfAutoCharge": "DailyTaskConfig:DayOfAutoCharge",
Expand Down
2 changes: 2 additions & 0 deletions src/Ray.BiliBiliTool.DomainService/DonateCoinDomainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,13 @@ private int GetNeedDonateCoinNum()
{
//获取自定义配置投币数
int configCoins = _dailyTaskOptions.NumberOfCoins;

if (configCoins <= 0)
{
_logger.LogInformation("已配置为跳过投币任务");
return configCoins;
}


//已投的硬币
int alreadyCoins = _coinDomainService.GetDonatedCoins();
Expand Down