LXK0301京东签到脚本-自动提交互助码

LXK0301京东签到脚本-自动提交互助码

orzlee
2021-02-24 / 233 评论 / 9,016 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年05月08日,已超过1083天没有更新,若内容或图片失效,请留言反馈。

telegram.jpg

前言

今天24号,刚好是LXK0301助力码清除日期,晚上给忘记了,到中午才发现今天互助码重置。

瞬间感觉错误一个亿,之前就想过要折腾个自动提交互助码的脚本,就是太懒了。今天亡羊补牢,折腾折腾。有兴趣可以用阅读我之前的文章QuantumultX-京东签到撸京东豆openwrt-docker部署lxk0301京东自动签到脚本

安装Telegram-Cli

此安装环境是VPS,openwrt上安装用docker,当然VPS也可以使用docker!

科学上网必备,没有一个良好的网络环境为前提都是白折腾!!!

  • docker安装(推荐,省去一大堆麻烦事):
    镜像地址:ugeek/telegram-cli

    1. 安装镜像:

       docker create --name telegram-cli -e TZ=Asia/Shanghai -v 挂载本地目录:/root/.telegram-cli ugeek/telegram-cli:amd64
    2. 启动docker:

       docker start telegram-cli
    3. 执行telegram-cli命令行交互(先执行一次登陆,输入telegram注册的手机号码,号码记得加区号。)

       docker exec -it telegram-cli telegram-cli -N -W
  • 以下为编译安装步骤(docker或者编译二选一即可):

    1. 克隆telegram-cli:

       cd /root/work/telegram  ### 或者你自己想要存放的目录
       git clone --recursive https://github.com/vysheng/tg.git && cd tg
    2. 编译安装

       ### ubuntu
       sudo apt-get update
       sudo apt-get -y install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make
       ./configure
       make

      如果编译安装出现如下错误:
      telegram-cil-error.png
      解决方法:

       apt-get install -y libgcrypt20-dev libssl-dev
       ./configure --disable-openssl --prefix=/usr CFLAGS="$CFLAGS -w"
       make

    申请Telegram APP Key并且登陆telegram-cli

    1. 首先到telegram-apps里申请一个telegram App key(登陆时电话号码记得加国际区号)。
      telegram-app-login.png

    2. 复制Public keys:
      app-key.png

    3. 创建一个文件保存Public keys:

       nano /root/work/telegram/bot_key.pub
       ###鼠标右键粘贴
       ctrl+o ##保存 按完记得敲车键
       ctrl+x ##退出
    4. 登陆telegram-cil

       /root/work/telegram/tg/bin/telegram-cli -k /root/work/telegram/bot_key.pub
       ###输入账号绑定的手机号码,记得加区号
       ###输入telegram App收到的验证码

      telegram-cil-login.png
      IOS锁屏就会提示offline,打开手机telegram app就会提示online。

    5. 测试一下命令:
      telegram-cil频道名称如果有空格用下划线代替。
      发送命令格式/root/work/telegram/tg/bin/telegram-cli -W -e "msg 频道名称 命令"

       ### 发送一条统计当前互助码池命令
       /root/work/telegram/tg/bin/telegram-cli -W -e "msg Turing_Lab_Bot /count_activity_codes"

      回显信息比较乱,自己看手机或PC telegram APP Turing_Lab_Bot机器人 消息就好了。

编写脚本

把互助码准备好,编写脚本:

### 创建一个文件,保存脚本
nano /root/work/telegram/submit_activity_codes.sh

2021-05-08 优化加载会话列表,resolve_username 只加载需要发送命令的两个BOT,避免会话太多出现奇奇怪怪的问题。

2021-03-08 优化了定时任务脚本,速度更快,不会中断了,之前的脚本有问题,会经常中断(原因是因为脚本中执行发送消息命令太快-W参数加载消息会话列表没有完成就已经发出命令,导致命令出错!)。

复制以下内容,互助码自己替换,其他活动互助码自己添加(多个互助码用&拼接):

#!/bin/bash

telegramPath=TG Path #记得替换你telegram-cli目录/xxx/tg/bin

(
  echo "resolve_username TuringLabbot"
  echo "resolve_username LvanLamCommitCodebot"
  sleep 5
  ### @Turing_Lab_Bot
  ###京喜财富岛
  echo "msg Turing_Lab_Bot /submit_activity_codes jxcfd 互助码"
  ###京东闪购盲盒
  echo "msg Turing_Lab_Bot /submit_activity_codes sgmh 互助码"
  ###京东环球挑战赛
  echo "msg Turing_Lab_Bot /submit_activity_codes jdglobal 互助码"
  ###惊喜工厂
  echo "msg Turing_Lab_Bot /submit_activity_codes jxfactory 互助码"
  ###东东工厂
  echo "msg Turing_Lab_Bot /submit_activity_codes ddfactory 互助码"
  ###东东萌宠
  echo "msg Turing_Lab_Bot /submit_activity_codes pet 互助码"
  ##种豆得豆
  echo "msg Turing_Lab_Bot /submit_activity_codes bean 互助码"
  ###东东农场
  echo "msg Turing_Lab_Bot /submit_activity_codes farm 互助码"
  ### @Commit_Code_Bot
  ###JD签到领现金 提交助力码
  echo "msg Commit_Code_Bot /jdcash 互助码"
  ###JD签到领现金 提交助力码
  echo "msg Commit_Code_Bot /jdcrazyjoy 互助码"
  echo "safe_quit"
) | ${telegramPath}telegram-cli -D

-D参数关闭了输出,调试的时候可以删除该参数(虽然没什么用,因为你命令发出去还没有等回显就已经结束命令了)。

docker 用户将最后一行脚本替换成) | docker exec -i telegram-cli telegram-cli -N,删除telegramPath=TG Path #记得替换你telegram-cli目录/xxx/tg/bin即可

保存脚本

ctrl+o ##保存 按完记得敲回车键
ctrl+x ##退出

赋予脚本可执行权限

chmod +x /root/work/telegram/submit_activity_codes.sh

测试的时候记得注释大部分命令,留一到两个就行了,频繁提交小心被Bot Ban号。

bash /root/work/telegram/submit_activity_codes.sh

看看手机接收到的通知,一般接收到通知无非就是提交成功或助力池已满。

添加crontab定时任务

助力池每次清空日期为每月1,8,16,24号,延迟10分钟后执行:

crontab -e
10 0 1,8,16,24 * * bash /root/work/telegram/submit_activity_codes.sh

结语

其他Bot签到什么的可以举一反三。

这下一劳永逸,省的忘记错过一个亿。最近京东活动也比较多,没有助力活动任务很难完成,助力才是京东活动的灵魂。

6
取消
扫码打赏
支付金额随意哦!

评论 (233)

取消
  1. 头像
    faccforxxx
    Windows 10 · Google Chrome

    麻烦大佬看下什么问题,昨晚就没提交成功,单独运行登录也报这个错误,按照楼下的方法试了,依然这样的错误

    [root@instance-20200730-1408 ~/telegram]# docker exec -i telegram-cli telegram-cli -N -W change_user_group: can't find the user telegramd to switch to Telegram-cli version 1.4.1, Copyright (C) 2013-2015 Vitaly Valtman Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'. This is free software, and you are welcome to redistribute it under certain conditions; type `show_license' for details. Telegram-cli uses libtgl version 2.1.0 Telegram-cli includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/) I: config dir=[/root/.telegram-cli] >
    回复
    1. 头像
      orzlee 作者
      Linux · Google Chrome
      @ faccforxxx

      手动发个消息看看!

      回复
      1. 头像
        faccforxxx
        Windows 10 · Google Chrome
        @ orzlee

        手动发消息如下:
        [root@instance-20200730-1408 ~/telegram]# docker exec -it telegram-cli /bin/sh

        telegram-cli -W -e "msg Turing_Lab_Bot /count_activity_codes"

        change_user_group: can't find the user telegramd to switch to
        Telegram-cli version 1.4.1, Copyright (C) 2013-2015 Vitaly Valtman
        Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type show_license'. This is free software, and you are welcome to redistribute it under certain conditions; typeshow_license' for details.
        Telegram-cli uses libtgl version 2.1.0
        Telegram-cli includes software developed by the OpenSSL Project
        for use in the OpenSSL Toolkit. (http://www.openssl.org/)
        I: config dir=[/root/.telegram-cli]

        后面就没有了

        回复
        1. 头像
          orzlee 作者
          Linux · Google Chrome
          @ faccforxxx

          你等回显完了再输入“msg Turing_Lab_Bot /count_activity_codes”看看!

          回复
        2. 头像
          orzlee 作者
          Linux · Google Chrome
          @ faccforxxx

          只是没发消息,但是没有错误信息!

          回复
    2. 头像
      orzlee 作者
      Linux · Google Chrome
      @ faccforxxx

      没看到错误啊!

      回复
      1. 头像
        faccforxxx
        Windows 10 · Google Chrome
        @ orzlee

        打扰了大佬,机器重启了一下就好了表情,之前不知道咋回事,感谢大佬表情

        回复
        1. 头像
          orzlee 作者
          Linux · Google Chrome
          @ faccforxxx

          额,好的!

          回复
      2. 头像
        faccforxxx
        Windows 10 · Google Chrome
        @ orzlee

        平时执行完会弹出tg消息内容的,这次没有,而且运行提交脚本,错误如下:

        [root@instance-20200730-1408 ~/telegram]# bash /root/telegram/submit_activity_codes.sh change_user_group: can't find the user telegramd to switch to Telegram-cli version 1.4.1, Copyright (C) 2013-2015 Vitaly Valtman Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'. This is free software, and you are welcome to redistribute it under certain conditions; type `show_license' for details. Telegram-cli uses libtgl version 2.1.0 Telegram-cli includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/) I: config dir=[/root/.telegram-cli] <304E9C427ECFF2CF6A634EC3B5D7F4389A56775F9B318F6999B FAIL: 38: can not parse arg #1 <moaT5kRrbA&T0225KkcRxxM_AGGdRr1wKYIdwCjVQmoaT5kRrbA FAIL: 38: can not parse arg #1 > msg Turing_Lab_Bot /submit_activity_codes jxfactory 互助码 FAIL: 38: can not parse arg #1 <nYaS5kRrbA&T0225KkcRxxM_AGGdRr1wKYIdwCjVWnYaS5kRrbA FAIL: 38: can not parse arg #1 <AwNDI2ODk5MDM=&MTEzMzI0OTE0NTAwMDAwMDA0MzgxOTg0Mw== FAIL: 38: can not parse arg #1 <563j3dt75li&4npkonnsy7xi3ytzbgivwluan576sb47zmlrf2y FAIL: 38: can not parse arg #1 <4b8c308b695669fa21&e8b9f4e213c84581ad1414325f41130d FAIL: 38: can not parse arg #1 <kfNFYfAat9zd5YaBeE&YR9Zo0kYBAXpNknVejrn-6t9zd5YaBeE FAIL: 38: can not parse arg #1 > msg Commit_Code_Bot /jdcash eU9Ya-SwM6l3pz_RmnMTgw&eU9Ya-7nb6l3pG7UnyIR1Q FAIL: 38: can not parse arg #1 > msg Commit_Code_Bot /jdzz S5KkcRxYboAGGdkvwxfcKIQ&S5KkcRxxM_AGGdRr1wKYIdw FAIL: 38: can not parse arg #1 > safe_quit
        回复
        1. 头像
          faccforxxx
          Windows 10 · Google Chrome
          @ faccforxxx

          感觉评论有长度限制,重要信息没出来,接上面的

          Telegram-cli includes software developed by the OpenSSL Project
          for use in the OpenSSL Toolkit. (http://www.openssl.org/)
          I: config dir=[/root/.telegram-cli]
          <304E9C427ECFF2CF6A634EC3B5D7F4389A56775F9B318F6999B
          FAIL: 38: can not parse arg #1
          <moaT5kRrbA&T0225KkcRxxM_AGGdRr1wKYIdwCjVQmoaT5kRrbA
          FAIL: 38: can not parse arg #1

          回复
  2. 头像
    manta
    Windows 10 · Google Chrome

    搞定了,#!/bin/bash改成#!/bin/sh,sleep 5后加“;”号

    回复
  3. 头像
    manta
    Windows 10 · Google Chrome

    接上一条
    under certain conditions; type `show_license' for details.
    Telegram-cli uses libtgl version 2.1.0
    Telegram-cli includes software developed by the OpenSSL Project
    for use in the OpenSSL Toolkit. (http://www.openssl.org/)
    I: config dir=[/root/.telegram-cli]
    <2AA94131783CD55B65A01E9AE135202C3D4B6F95AA165C16C9D ###这个是助力码的一部分
    FAIL: 38: can not parse arg #1

    safe_quit

    All done. Exit
    halt

    回复
  4. 头像
    manta
    Windows 10 · Google Chrome

    贴个log,我用bash无法运行,所以改为sh,已替换脚本最后一行为docker…
    [root@NDM:/var/lib/docker/shardcodeUP]# sh submit_activity_codes.sh
    : not foundvity_codes.sh: line 2:
    'leep: invalid number '5
    change_user_group: can't find the user telegramd to switch to
    Telegram-cli version 1.4.1, Copyright (C) 2013-2015 Vitaly Valtman
    Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
    This is free software, and you are welcome to redistribute it

    回复
    1. 头像
      orzlee 作者
      Linux · Google Chrome
      @ manta

      貌似在sleep 5这里出错了!bash运行不了是什么错误?

      回复
      1. 头像
        manta
        Windows 10 · Google Chrome
        @ orzlee

        sleep 5去掉也是一样的

        回复
        1. 头像
          orzlee 作者
          Linux · Google Chrome
          @ manta

          你执行的命令发出来看看,你这不是bash跑啊,还是sh!

          回复
    2. 头像
      orzlee 作者
      Linux · Google Chrome
      @ manta

      foundvity_codes.sh是什么脚本?

      回复
      1. 头像
        manta
        Windows 10 · Google Chrome
        @ orzlee

        不知道啊,没这个脚本啊

        bash错误是 -sh: bash: not found

        回复
        1. 头像
          orzlee 作者
          Linux · Google Chrome
          @ manta

          把你输入的命令发出来看看!

          回复
          1. 头像
            manta
            Windows 10 · Google Chrome
            @ orzlee

            就是log的第一行,sh submit_activity_codes.sh,内容就是把“telegramPath=TG Path #记得替换你telegram-cli目录/xxx/tg/bin”这一行删了,最后一行改成docker的

            回复
            1. 头像
              orzlee 作者
              Linux · Google Chrome
              @ manta

              直接bash 脚本文件啊!

              回复
              1. 头像
                manta
                Windows 10 · Google Chrome
                @ orzlee

                bash submit_activity_codes.sh结果是:-sh: bash: not found
                改sh submit_activity_codes.sh才能运行…

                回复
                1. 头像
                  orzlee 作者
                  Linux · Google Chrome
                  @ manta

                  脚本第一行加上 #!/bin/bash 再试试!

                  回复
                  1. 头像
                    manta
                    Windows 10 · Google Chrome
                    @ orzlee

                    回复
                    1. 头像
                      orzlee 作者
                      Linux · Google Chrome
                      @ manta

                      输入 /bin/bash 脚本文件 看看!

                      回复
  5. 头像
    manta
    Windows 10 · Google Chrome

    arm设备的docker运行提示standard_init_linux.go:211: exec user process caused "exec format error",百度了下似乎是架构不一致无法运行,这个脚本只能在X86上运行吗?

    回复
    1. 头像
      orzlee 作者
      Linux · Google Chrome
      @ manta

      你单独运行脚本能不能跑?

      回复
      1. 头像
        manta
        Windows 10 · Google Chrome
        @ orzlee

        docker已经好了,但是脚本运行后电报里毫无反应,在终端里运行tel后输入“msg Turing_Lab_Bot /submit_acti…………”是可以的

        回复
        1. 头像
          manta
          Windows 10 · Google Chrome
          @ manta

          运行脚本后很快就输出“> > All done. Exit”了,但是电报里并没有发送消息

          回复
        2. 头像
          orzlee 作者
          Linux · Google Chrome
          @ manta

          直接跑脚本看看

          回复
      2. 头像
        manta
        Windows 10 · Google Chrome
        @ orzlee

        晚上试试,小白一个,刚接触docker……

        回复
      3. 头像
        manta
        Windows 10 · Google Chrome
        @ orzlee

        现在镜像都运行不起来,还没到脚本那一步呢……

        回复
        1. 头像
          orzlee 作者
          Linux · Google Chrome
          @ manta

          ugeek/telegram-cli:amd64 换成 ugeek/telegram-cli:arm

          回复
        2. 头像
          orzlee 作者
          Linux · Google Chrome
          @ manta

          https://hub.docker.com/r/ugeek/telegram-cli。看看作者说明,有arm架构!应该没问题!

          回复
  6. 头像
    MO
    MacOS · Google Chrome

    为什么我定时了它不会运行

    回复
    1. 头像
      orzlee 作者
      Linux · Google Chrome
      @ MO

      跑下脚本,看看是否报错!

      回复
      1. 头像
        MO
        Windows 10 · Google Chrome
        @ orzlee

        直接跑脚本我试过是可直接跑脚本我试过是可以的 机器人运行脚本命令没事 就是这个定时的毫无反应以的 机器人运行脚本命令没事 就是这个定时的毫无反应

        回复
        1. 头像
          orzlee 作者
          Linux · Google Chrome
          @ MO

          或者把输出日志重定向到其他文件,看看到底是没执行还是报错了!

          回复
        2. 头像
          orzlee 作者
          Linux · Google Chrome
          @ MO

          要看crontab运行日志才行!

          回复
      2. 头像
        MO
        MacOS · Google Chrome
        @ orzlee

        单独设置分钟可以运行 就是加了小时就不能运行了 这么奇怪的

        回复
      3. 头像
        MO
        MacOS · Google Chrome
        @ orzlee

        我是docker unraid和openwrt定时都运行不了 手动测试的时候却可以

        回复
        1. 头像
          orzlee 作者
          Linux · Google Chrome
          @ MO

          openwrt定时任务我还没用过,看看什么格式!

          回复
          1. 头像
            MO
            MacOS · Google Chrome
            @ orzlee

            格式是一样的 都是docker容器弄的

            回复
            1. 头像
              orzlee 作者
              Linux · Google Chrome
              @ MO

              定时任务格式发出来看看!

              回复
              1. 头像
                MO
                MacOS · Google Chrome
                @ orzlee

                03 18 * bash /root/work/telegram/submit_activity_codes.sh 这是6点3分没错吧

                回复
                1. 头像
                  orzlee 作者
                  Linux · Google Chrome
                  @ MO

                  写3就好了,不要加0在前面啊!

                  回复
                  1. 头像
                    MO
                    MacOS · Google Chrome
                    @ orzlee

                    这个我知道 但是就是运行不了 找不到什么原因

                    回复
                    1. 头像
                      orzlee 作者
                      Linux · Google Chrome
                      @ MO

                      看看cron日志!

                      回复
      4. 头像
        MO
        MacOS · Google Chrome
        @ orzlee

        手动运行可以 就是定时不生效

        回复
  7. 头像
    gocky
    Windows 10 · Google Chrome

    请问 ugeek/telegram-cli的docker镜像拉去失败是怎么回事呢
    Error response from daemon: manifest for ugeek/telegram-cli:latest not found: manifest unknown: manifest unknown

    回复
    1. 头像
      orzlee 作者
      Linux · Google Chrome
      @ gocky

      科学上网了吗

      回复
      1. 头像
        gocky
        Windows 10 · Google Chrome
        @ orzlee

        肯定的

        回复
        1. 头像
          orzlee 作者
          Linux · Google Chrome
          @ gocky

          别pull,直接创建就行了!

          回复
        2. 头像
          orzlee 作者
          Linux · Google Chrome
          @ gocky

          docker create --name telegram-cli -e TZ=Asia/Shanghai -v 挂载本地目录:/root/.telegram-cli ugeek/telegram-cli:amd64

          回复
          1. 头像
            gocky
            Windows 10 · Google Chrome
            @ orzlee

            谢谢!我试试

            回复
  8. 头像
    jacky
    Windows 10 · Google Chrome

    ugeek/telegram-cli的docker镜像拉去失败怎么破
    Error response from daemon: manifest for ugeek/telegram-cli:latest not found: manifest unknown: manifest unknown

    回复
    1. 头像
      orzlee 作者
      Linux · Google Chrome
      @ jacky

      在挂载目录添加pull.lock文件,文件内容为空就好了!目前作者删除了私有仓库密钥,避风头!

      回复
  9. 头像
    一只猫
    Windows 10 · Google Chrome

    编译安装都是错误怎么破,在openwrt里面弄的..

    回复
    1. 头像
      orzlee 作者
      iPhone · Safari
      @ 一只猫

      openwrt里面还没试过,尽量到vps上跑!openwrt依赖可能不全!

      回复
    2. 头像
      一只猫
      Windows 10 · Google Chrome
      @ 一只猫

      这个要在什么机器上运行呢..纯小白

      回复
      1. 头像
        orzlee 作者
        iPhone · Safari
        @ 一只猫

        我是在vps上跑的!

        回复
  10. 头像
    悉茗
    Windows 10 · Google Chrome

    最好提醒下注意配置科学上网环境,卡了好久才想到

    回复
    1. 头像
      orzlee 作者
      Windows 10 · Google Chrome
      @ 悉茗

      谢谢提醒

      回复
  11. 头像
    悉茗
    Windows 10 · Google Chrome

    有兴趣折腾一下中青看点吗,感觉也很适合放在 docker。
    https://gitee.com/Sunert/Scripts/tree/master/TaskConf/youth#nodejs-%E9%85%8D%E7%BD%AE%E5%AF%86%E9%92%A5-github-actions

    回复
    1. 头像
      orzlee 作者
      Windows 10 · Google Chrome
      @ 悉茗

      作者貌似没有提供Docker镜像,做成docker其实还有很多事要做。但是有NodeJS,直接安装node跑就好了,拉代码撸个脚本用cron定期跑就好了!定期更新可以参考LXK0301大佬的:https://gitee.com/lxk0301/jd_docker/blob/master/docker/docker_entrypoint.sh

      回复
      1. 头像
        悉茗
        Windows 10 · Google Chrome
        @ orzlee

        谢谢,到时候试试!

        回复
        1. 头像
          orzlee 作者
          Windows 10 · Google Chrome
          @ 悉茗

          https://gitee.com/lxk0301/jd_docker/tree/master/docker #Usage 你可以追加脚本到LXK0301的docker里面,非常方便

          回复
          1. 头像
            悉茗
            Windows 10 · Google Chrome
            @ orzlee

            https://hub.docker.com/r/aaron2397/sunert_scripts
            中青有镜像了

            回复
            1. 头像
              S.
              iPhone · Safari
              @ 悉茗

              中青有镜像之后怎么放到docker跑呀

              回复
              1. 头像
                orzlee 作者
                Linux · Google Chrome
                @ S.

                挂载远程或者本地脚本,到这里翻翻:https://github.com/wisz2021/jd_docker

                回复
  12. 头像
    AA
    Windows 10 · Google Chrome

    如何在vps上使用lxk0301大佬得脚本??

    回复
    1. 头像
      orzlee 作者
      Windows 10 · Google Chrome
      @ AA

      这个用Docker就好了!LXK0301:https://gitee.com/lxk0301/jd_docker
      可以阅读我的这篇文章:https://www.orzlee.com/toss/2021/02/08/openwrt-docker-deploys-lxk0301-jingdong-automatic-signin-script.html

      回复