Giter Site home page Giter Site logo

hitokoto-osc / hitokoto-dingtalk-client Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 27 KB

hitokoto-osc 项目的客户端,提供将api结果推送到钉钉的功能

License: MIT License

PHP 18.54% Shell 13.08% JavaScript 16.67% Python 16.36% Go 24.23% Makefile 9.47% Dockerfile 1.66%
hitokoto hitokoto-osc yi-yan

hitokoto-dingtalk-client's Introduction

hitokoto-dingtalk-client

获取一句 hitokoto 并推送到钉钉群,给无聊的工作增加一点乐趣

依赖管理

为了减少三方依赖,本仓库提供的客户端均采用语言标准库能力,不依赖任何第三方库

开发计划

对外提供各种语言的版本,对内提供一致的api,方便感兴趣的朋友们进行二开

命令行参数

  • --api-urlhitokoto api 或其镜像接口地址
  • --robot-url钉钉机器人链接

抽象编程 API

此处提供伪代码,实际命名规则与参数类型根据目标语言的约定而改变

api 参数 功能
get-argument(name , default) 名称,默认值 获取命令行参数
get-hitokoto(api-url) 一言API地址或其镜像 获取一言
post-with-json(robot-url , data) 机器人API地址 推送到钉钉服务器
make-data(source , creator , sentence) 从哪里来,谁创建的,说了什么 构造发送给钉钉的数据

编译运行

所有版本均提供 Makefile 和命令行与两种运行方法。二者的区别为 Makefile 为编译型语言提供标准编译支持,命令行则需要自行编译

Makefile

使用 phplinux-shellnodejspythongolang 中的任何一个,替换命令中的 LANGUAGE$language 即可

$ language=LANGUAGE
$ make clean $language \
    api-url https://v1.hitokoto.cn \
    robot-url=https://oapi.dingtalk.com/robot/xxxxx

命令行

  • php
$ chmod +x ./dingtalk.php
$ ./dingtalk.php [--api-url https://v1.hitokoto.cn] --robot-url https://oapi.dingtalk.com/robot/xxxxx
  • shell

目前仅支持定义 --robot-url

$ chmod +x ./dingtalk.sh
$ ./dingtalk.sh --robot-url https://oapi.dingtalk.com/robot/xxxxx
  • nodejs
$ chmod +x ./dingtalk.js
$ ./dingtalk.js [--api-url https://v1.hitokoto.cn] --robot-url https://oapi.dingtalk.com/robot/xxxxx
  • python3
$ chmod +x ./dingtalk.py
$ ./dingtalk.py [--api-url https://v1.hitokoto.cn] --robot-url https://oapi.dingtalk.com/robot/xxxxx
  • golang
$ go run ./dingtalk.go [--api-url https://v1.hitokoto.cn] --robot-url https://oapi.dingtalk.com/robot/xxxxx
  • java

参考 hitokoto-java-sdk

shell

shell 版本仅支持 centos,所以本仓库特别提供了基于 docker 的运行方法

  • Makefile
$ make linux-shell-with-docker
  • 命令行
$ docker build -t hitokoto/client:v1 . --build-arg robot_url=https://oapi.dingtalk.com/robot/xxxxx
$ docker run --rm hitokoto/client:v1

推送效果

-w500

hitokoto-dingtalk-client's People

Contributors

mend-bolt-for-github[bot] avatar o8x avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lovechen

hitokoto-dingtalk-client's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

dockerfile
Dockerfile

  • Check this box to trigger a request for Renovate to run again on this repository

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.