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

[Feature] 增加TG群上传图片的功能( #116

Open
yunshuangqwq opened this issue Nov 23, 2024 · 1 comment
Open

[Feature] 增加TG群上传图片的功能( #116

yunshuangqwq opened this issue Nov 23, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@yunshuangqwq
Copy link

背景

群聊里有机器人上传图片还需要打开浏览器突然想着要是能在tg群里直接上传并让机器人返回链接就好啦

功能描述

填写key后增加一个指令回复图片消息的时候带上指令机器人上传图片并返回链接(主要是我不会不然就用上传接口做了)

解决方案

不到啊

替代方案

如果做不了的话可以告诉我要怎么实现嘛或者出一个教程(

附加信息

只是建议。。。不批直接关也行

@yunshuangqwq yunshuangqwq added the enhancement New feature or request label Nov 23, 2024
@yunshuangqwq
Copy link
Author

分享一个更新仓库的(自用不喜勿怪)
我这个逻辑是删除本仓库所有内容然后拉取上游仓库main分支的内容,数据无价记得备份!

使用方法

1,当然是有仓库啦
2,在.github/workflows创建一个名为update.yml的文件粘贴进去
3,点进仓库设置(Settings)→Actions→General往下翻在Workflow permissions条下面有个Read and write permissions把他打上勾(允许工作流读写仓库数据)点保存就行啦
4,配置代码里的用户信息(这样工作流才能获取到token)
5,运行
6,等待cf部署完了访问网站(图片数据不是github管的所以会保留)

工作流代码

name: Sy-Update

on:
  workflow_dispatch:

jobs:
  sync-and-update:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          token: ${{ secrets.GITHUB_TOKEN }}

      # 添加上游信息
      - name: Add upstream repository
        run: git remote add upstream https://github.com/x-dr/telegraph-Image.git

      # 获取所有分支信息
      - name: Fetch all upstream branches
        run: git fetch upstream

      # 检出上游仓库的更改并忽略.github文件夹(我是直接删除当前仓库的数据注意保留)然后删除再合并main分支
      - name: Checkout upstream changes excluding .github
        run: |
          git checkout upstream/main -- .
          git reset -- .github

      - name: Clean untracked files, preserving .github directory
        run: |
          git clean -fdx -e .github

      # 设置账号信息
      - name: Set up Git user
        run: |
          git config --local user.email "你注册github的邮箱"
          git config --local user.name "你的github用户名"

# 为README.md增加上游仓库的链接(保持原作者信息)
      - name: Clear and update main README.md first line
        run: |
          sed -i '1d' README.md
          echo -e "# telegraph-Image" | cat - README.md > temp && mv temp README.md
          echo -e "## 上游仓库:[点击跳转](https://github.com/x-dr/telegraph-Image)" | cat - README.md > temp && mv temp README.md

      # 给README.md一个更新让cf自动部署
      - name: Commit and push changes
        run: |
          git add README.md
          git commit -m "Update ck" || echo "No changes to commit"
          git push origin main --force
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant