Coder Social home page Coder Social logo

douyu-task's Introduction

Douyu-Task

golang release license

Config

# 计划任务
cron:
  # 刷新背包荧光棒,每天 00:10:00 获取一次
  refresh: "0 10 0 * * *"
  # 送免费的荧光棒续牌子,每天 23:50:00 执行一次,如果有荧光棒当天过期则按照配置的顺序送出
  renewal: "0 50 23 * * *"

# 基本配置
douyu:
  # 必填,cookie: dy_did
  did: xxx
  # 必填,cookie: ltp0,建议使用无痕模式获取,不影响其他登录状态(issues#28)
  ltp0: xxx

  # 每日登录直播间号
  room: 9999

  # 无视免费礼物过期时间,默认关闭
  ignore_expired_check: false

  # 荧光棒分配
  assigns:
    # { room, count, all }
    # room 直播间号,如果是 0 的话,对已有牌子的直播间分别送上 count 数量的荧光棒
    # count 荧光棒数量
    # all 是否全部分配,建议最后一个直播间设置为 all: true,这样就可以把剩余的荧光棒全部分配出去
    - count: 1
    - room: 99999
      count: 10
    - room: 9999
      all: true

Cookie

Migrate V2 to V3

  • use douyu.ignore_expired_check instead of withOutTimeCheck

  • ntfy see more

Usage

> douyu-task -h
Usage:
  douyu-task [command]

Available Commands:
  cron        Run as cron job
  notify      Manage notify
  run         Run douyu job manually
  service     Manage service

Flags:
  -c, --config string   path to config file
  -h, --help            help for douyu-task
  -v, --version         version for douyu-task

Use "douyu-task [command] --help" for more information about a command.

Run job

Refresh

douyu-task run refresh

Badge

douyu-task run badge list

Gift

douyu-task run gift list
douyu-task run gift send <room id> <gift id> <count>

Run Cron

douyu-task
douyu-task cron

Service

# register as system service
douyu-task service --user --config douyu-task.yaml install
douyu-task service start
douyu-task service status

Docker Compose

version: "3"
services:
  douyu:
    image: starudream/douyu-task
    container_name: douyu
    restart: always
    command: /douyu-task -c /douyu/app.yaml cron
    volumes:
      - "./douyu/:/douyu"
    environment:
      DEBUG: "true"
      app.log.console.level: "info"
      app.log.file.enabled: "true"
      app.log.file.level: "debug"
      app.log.file.filename: "/douyu/app.log"

douyu-task's People

Contributors

chaostong avatar starudream avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

douyu-task's Issues

skip if no notify config

你好,

2023-11-20T23:50:02.804+08:00 ERR cron notify error: no notify config

目前配置里如果没配notify的话会当成错误。换成info,直接略过感觉会比较合理?

谢谢

每日任务似乎无法领取到荧光棒

将每周任务设置在每日任务当天后面执行

看日志,每日任务已经登录成功并且输出了所有牌子信息

但是接下来的每周任务执行时还是提示背包没有礼物

判断礼物过期时间错误

2023-07-26T13:21:01.170+08:00 INF renewal gifts today not expired, skip version=v2.0.2
凌晨定时器运行刷新获取的,赠送礼物定时器跑起来,提示荧光棒时间不是今天过期
image

panic: empty value

你好

谢谢新增的config flag,发现更新了v3.0.0之后送礼物会panic,不过实际上礼物已经送出去了。

cfg.yaml:

{"cron":{"refresh":"0 10 0 * * *","renewal":"0 50 23 * * *"},"douyu":{"assigns":[{"all":true,"room":500269}],"did":"xxx","ignore_expired_check":true,"ltp0":"xxx","room":9999}}

复现如下:

> ./result/bin/douyu-task run gift send 500269 268 50 --config ./cfg.yaml 


send gift to room id 500269, gift id 268, count 50, confirm? (y/n)y
panic: empty value

goroutine 1 [running]:
github.com/starudream/douyu-task/api.(*Gifts).TableString.Structs.func1(0xa75b60?)
	github.com/starudream/go-lib/tablew/[email protected]/helper.go:20 +0x36
github.com/starudream/go-lib/tablew/v2.Render(0xc000259a60)
	github.com/starudream/go-lib/tablew/[email protected]/helper.go:11 +0x48
github.com/starudream/go-lib/tablew/v2.Structs(...)
	github.com/starudream/go-lib/tablew/[email protected]/helper.go:17
github.com/starudream/douyu-task/api.(*Gifts).TableString(0xc0002f2900?)
	github.com/starudream/douyu-task/api/gift.go:20 +0x54
main.glob..func7.1(0xc0002bfc00?, {0xc0002b14f0, 0x3, 0x5})
	github.com/starudream/douyu-task/cmd/run.go:97 +0x5ab
github.com/spf13/cobra.(*Command).execute(0xc00031f500, {0xc0002b14a0, 0x5, 0x5})
	github.com/spf13/[email protected]/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0xc00031e300)
	github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x408fc5?)
	github.com/spf13/[email protected]/command.go:1039 +0x13
main.main()
	github.com/starudream/douyu-task/cmd/main.go:8 +0x1a

add config flag

你好,方便像别的task一样加入一个--config的flag来传config path么,谢谢

自动赠送荧光棒bug

room和remaining填写一样不赠送,room 9999 remaining改成自己养牌子的直播间 不赠送, room改成自己养牌子的直播间,remaining改成9999就赠送成功了
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.