GithubHelp home page GithubHelp logo

oreomeow / warpplus Goto Github PK

View Code? Open in Web Editor NEW
179.0 1.0 31.0 412 KB

Get WARP+ referral quota and notify users with Telegram Bot

License: GNU General Public License v3.0

Python 95.16% Shell 3.65% Dockerfile 1.19%
python-telegram-bot wgcf warp-plus

warpplus's Introduction

WARP+ 推荐奖励 Telegram Bot

warpplus

利用 Telegram Bot 获取 WARP+ 推荐奖励流量并通知用户

功能 (Functions)

  • 刷取一定次数
    • 不指定次数按 +∞ 刷取
    • 指定次数刷取
    • 刷取结果统计
  • 添加管理命令
  • 支持他人刷取
  • 查询当前流量
  • 设置定时任务
  • 支持多种语言

部署 (Deploy)

Warning 需要 Python >= 3.7

克隆仓库

git clone --depth=1 https://github.com/Oreomeow/warpplus && cd warpplus

安装依赖

pip3 install -r requirements.txt

配置参数

  • 通过 @BotFather 获取 Bot API Token

  • 通过 WARP APP 获取 ID

    WARP APP 图示

  • 根据 config.example.json 在同目录生成 config.json 配置文件

    {
        "TOKEN": "# Telegram bot API Token (可在 @botfather 获取,如 10xxx4:AAFcqxxxxgER5uw)",
        "USER_ID": "# Telegram 用户 ID (给 @getidsbot 发送 /start 获取到的纯数字 ID,如 1434078534)",
        "GIFT_LIMIT": "# 限制其他用户单次刷取次数,如 10,不限制则输入 0",
        "REFERRER": "# WARP 应用 (如 1.1.1.1) 内的设备 ID",
    }

运行测试

python3 warpplus.py

Ctrl + C 退出

持久化运行

从以下方法中任选其一即可,或参考 Linux 守护进程的启动方法

  • Systemd (推荐)

    一键脚本

    bash install.sh

    查看 warpplus 状态

    systemctl status warpplus

    查看 warpplus 日志

    journalctl -u warpplus

    启动 warpplus

    systemctl start warpplus

    停止 warpplus

    systemctl stop warpplus

    重启 warpplus

    systemctl restart warpplus

    杀死 warpplus 所有子进程

    systemctl kill warpplus
  • nohup

    nohup python3 warpplus.py > warpplus.log 2>&1 &

    查看日志

    tail -f warpplus.log
  • Screen

    1. 创建会话

      screen -S warpplus
      python3 warpplus.py

      然后,按下 Ctrl + ACtrl + D ,回到原来的会话

    2. 如果要查看日志,可以使用 screen -r warpplus ;如果要停掉会话,按下 Ctrl + CCtrl + D

  • Tmux

    1. 安装

      # Debian or Ubuntu
      apt install -y tmux
      
      # CentOS or RedHat
      yum install -y tmux
    2. 新建会话

      tmux new -s warpplus
      python3 warpplus.py
    3. 分离会话

      tmux detach

      或键盘按下 Ctrl + B D 即可将当前会话与窗口分离

    4. 如果要查看日志,可以使用 tmux attach -t warpplus ;如果要杀死会话 tmux kill-session -t warpplus

/bind 命令说明

/bind <referrer> - 绑定 WARP 应用 (如 1.1.1.1) 内的设备 ID
/bind t <access_token> - 绑定 wgcf-account.toml 中的 access_token
/bind i <device_id> - 绑定 wgcf-account.toml 中的 device_id
/bind <access_token> <device_id> - 绑定成对

其中 <referrer><device_id> 其实是同一个,只是 <referrer> 可以在手机 APP 1.1.1.1 中找到,而从 wgcf-account.toml 提取的 <access_token><device_id> 必须绑定成对,否则无法进行流量查询

在安装了 wgcf 的机器上可以使用 Scripts/get.sh 进行快捷提取

也可以运行以下命令提取

if ! [ -f '/etc/wireguard/wgcf-account.toml' ]; then
    echo "wgcf-account.toml 文件不存在,请查看是否已安装 wgcf。相关仓库 https://github.com/fscarmen/warp"
else
    ACCESS_TOKEN=$(grep 'access_token' /etc/wireguard/wgcf-account.toml | cut -d \' -f2)
    DEVICE_ID=$(grep 'device_id' /etc/wireguard/wgcf-account.toml | cut -d \' -f2)

    echo "====================== 请复制以下内容 (不包括此行) ======================"
    echo "${ACCESS_TOKEN} ${DEVICE_ID}"
    echo "====================== 请复制以上内容 (不包括此行) ======================"
fi

命令 (Commands)

start - 开始使用
query - 查询流量
plus - (<n>) 💂‍♂️管理员账号添加流量,不输入次数视为 +∞
bind - [点击查看具体用法] 绑定账号
unbind - 解除绑定
gift - (<n>) 获取流量,不输入次数视为 +∞
stop - 💂‍♂️管理员停止运行中的任务

贡献 (Contributors)

鸣谢 (Thanks)

warpplus's People

Contributors

oreomeow avatar silentely avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

warpplus's Issues

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.