当前位置:   article > 正文

最新奥特曼autman一键安装脚本,可对接内置微信、微信客服、公众号、钉钉、飞书、tg客户端、tg机器人、Discord、Slack、Kook、Poe、Messenge_鲲鹏微信框架

鲲鹏微信框架

系统功能

1. 支持对接qq框架、qq频道、微信框架(酷V西瓜可爱猫千寻鲲鹏)、 内置微信、微信客服、公众号、钉钉、飞书、tg客户端、tg机器人、Discord、Slack、Kook、Poe、Messenger等。
2.支持关键词处理回复和事件处理操作,支持SSE连接,实时监听所有对接IM的消息。具备日志实时显示功能,方便调试。
3. 支持多语言插件,如html、ECMAScript5、nodejs、typescript、python3、php、shell、golang等,不仅限这些编程语言,内置了插件市场,即装即用。
4. 内置脚本运行容器,支持python3、javascript、shell、typescript 等多种语言脚本的定时任务管理,支持虚拟多容器和多脚本并发运行,也支持对接青龙面板并进行管理。
5. 支持京东、淘宝、拼多多、外卖等返利(查询当前价格,历史价格,平台比价)支持二维码扫码购买,收益查询。
6. 支持用户管理。
7. 支持自定义路由路径的微服务,即自定义路由,并自行编写处理逻辑。
8. 完善的API开放接口,可将autMan集成到自己的系统中

 脚本

  1. LOG_FILE="/var/log/autMan.log"
  2. function log::info() {
  3. # 基础日志
  4. printf "[%s] \033[32mINFO: \033[0m%s\n" "$(date +'%Y-%m-%d %H:%M:%S')" "$*" | tee -a "$LOG_FILE"
  5. }
  6. function log::error() {
  7. # 错误日志
  8. local item
  9. printf "[$(date +'%Y-%m-%d %H:%M:%S')] \033[31mERROR: \033[0m$*\n" | tee -a "$LOG_FILE"
  10. }
  11. function utils::quote() {
  12. # 转义引号
  13. # shellcheck disable=SC2046
  14. if [ $(echo "$*" | tr -d "\n" | wc -c) -eq 0 ]; then
  15. echo "''"
  16. elif [ $(echo "$*" | tr -d "[a-z][A-Z][0-9]:,.=~_/\n-" | wc -c) -gt 0 ]; then
  17. printf "%s" "$*" | sed -e "1h;2,\$H;\$!d;g" -e "s/'/\'\"\'\"\'/g" | sed -e "1h;2,\$H;\$!d;g" -e "s/^/'/g" -e "s/$/'/g"
  18. else
  19. echo "$*"
  20. fi
  21. }
  22. function check::exit_code() {
  23. # 检查返回码
  24. local code=${1:-}
  25. local app=${2:-}
  26. local desc=${3:-}
  27. local exit_script=${4:-}
  28. if [[ "${code}" == "0" ]]; then
  29. log::info "[${app}]" "${desc} succeeded."
  30. else
  31. log::error "[${app}]" "${desc} failed."
  32. [[ "$exit_script" == "exit" ]] && exit "$code"
  33. fi
  34. }
  35. function command::exec() {
  36. local command="$*"
  37. command="$(utils::quote "$command")"
  38. # 本地执行
  39. # log::info "[command]" "bash -c $(printf "%s" "${command//${SUDO_PASSWORD:-}/******}")"
  40. # shellcheck disable=SC2094
  41. COMMAND_OUTPUT=$(eval bash -c "${command}" 2>>"$LOG_FILE" | tee -a "$LOG_FILE")
  42. local status=$?
  43. return $status
  44. }
  45. function install::Debian_Ubuntu(){
  46. # Debian 安装命令
  47. log::info "[apt]" "apt update and download python"
  48. command::exec "apt update -y && apt install -y wget python3 python3-pip"
  49. check::exit_code "$?" "apt" "apt install python" "exit"
  50. # if [ ! -f "~/.pip/pip.conf" ]; then
  51. # mkdir -p ~/.pip
  52. # echo "[global]" >> ~/.pip/pip.conf
  53. # echo "index-url = https://pypi.tuna.tsinghua.edu.cn/simple" >> ~/.pip/pip.conf
  54. # fi
  55. log::info "[pip3]" "pip3 dependency installation"
  56. command::exec "pip3 install requests user_agent PyExecJS aiohttp -i https://pypi.tuna.tsinghua.edu.cn/simple"
  57. check::exit_code "$?" "pip3" "pip3 install" "exit"
  58. log::info "[node]" "node install"
  59. command::exec "curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && apt install -y nodejs"
  60. check::exit_code "$?" "node" "node install" "exit"
  61. log::info "[node]" "node dependency installation"
  62. command::exec "npm install axios request require crypto-js"
  63. check::exit_code "$?" "node" "node dependency install" "exit"
  64. # log::info "[php]" "php install "
  65. # command::exec "apt-get install -y php"
  66. # check::exit_code "$?" "php" "php install" "exit"
  67. }
  68. function install::CentOS_Oracle(){
  69. log::info "[yum]" "yum update and download python"
  70. command::exec "yum update -y && yum install -y wget python3 python3-pip"
  71. check::exit_code "$?" "yum" "yum install python" "exit"
  72. # if [ ! -f "~/.pip/pip.conf" ]; then
  73. # mkdir -p ~/.pip
  74. # echo "[global]" >> ~/.pip/pip.conf
  75. # echo "index-url = https://pypi.tuna.tsinghua.edu.cn/simple" >> ~/.pip/pip.conf
  76. # fi
  77. log::info "[pip3]" "pip3 dependency installation"
  78. command::exec "pip3 install requests user_agent PyExecJS aiohttp -i https://pypi.tuna.tsinghua.edu.cn/simple"
  79. check::exit_code "$?" "pip3" "pip3 install" "exit"
  80. log::info "[node]" "node install"
  81. command::exec "curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo -E bash - && yum install -y nodejs"
  82. check::exit_code "$?" "node" "node install" "exit"
  83. log::info "[node]" "node dependency installation"
  84. command::exec "npm install axios request require crypto-js"
  85. check::exit_code "$?" "node" "node dependency install" "exit"
  86. # log::info "[php]" "php install "
  87. # command::exec "yum install -y php"
  88. # check::exit_code "$?" "php" "php install" "exit"
  89. }
  90. function install::anuMan(){
  91. arch=$(uname -m)
  92. if [ "$arch" == "x86_64" ]; then
  93. a=amd64
  94. elif [ "$arch" == "aarch64" ]; then
  95. a=arm64
  96. fi
  97. latest_version=$(curl -s "2.55" | grep -oP '"tag_name": "\K.*?(?=")')
  98. command::exec "mkdir -p /root/autMan
  99. cd /root/autMan
  100. wget http://gh.301.ee/https://github.com/hdbjlizhe/fanli/releases/download/$latest_version/autMan_$a.tar.gz;
  101. tar -zxvf autMan_$a.tar.gz -C /root/autMan;
  102. rm -rf autMan_$a.tar.gz
  103. chmod 777 /root/autMan/autMan
  104. pkill -9 /root/autMan/autMan
  105. /root/autMan/autMan -d"
  106. check::exit_code "$?" "anuMan install"
  107. }
  108. function local_install(){
  109. os=$(grep -oP 'NAME=["]?([^"]+)' /etc/os-release | awk -F= '{print $2}' | tr -d '"' | head -1)
  110. if [[ ! "$os" ]]; then
  111. log::error "获取系统信息错误"
  112. exit
  113. else
  114. log::info "获取系统信息" "$os"
  115. fi
  116. log::info "开始安装基础环境"
  117. if [[ $os == *"Debian"* ]] || [[ $os == *"Ubuntu"* ]]; then
  118. install::Debian_Ubuntu
  119. elif [[ $os == *"CentOS"* ]] || [[ $os == *"Oracle"* ]]; then
  120. install::CentOS_Oracle
  121. fi
  122. log::info "开始安装AutMan"
  123. install::anuMan
  124. ps aux | grep autMan | grep -v grep 2>&1 > /dev/null
  125. if [ $? == 0 ];then
  126. log::info "autMan运行成功"
  127. else
  128. log::error "autMan运行失败,请手动运行"
  129. fi
  130. echo
  131. cat << EOF
  132. 安装路径:/root/autMan
  133. 运行命令:/root/autMan/autMan 前台运行 -t 交互运行 -d 后台默认运行
  134. EOF
  135. }
  136. function docker_check(){
  137. if ! (command -v docker &> /dev/null); then
  138. # 如果Docker不存在,根据操作系统类型执行安装
  139. log::info "Docker is being installed"
  140. if [ -f /etc/lsb-release ]; then
  141. arch=$(uname -m)
  142. if [ "$arch" == "x86_64" ]; then
  143. command::exec "add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\""
  144. elif [ "$arch" == "aarch64" ]; then
  145. command::exec "add-apt-repository \"deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\""
  146. fi
  147. # Ubuntu
  148. command::exec "curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  149. apt-get update
  150. apt install docker-ce docker-ce-cli containerd.io -y
  151. sudo systemctl enable --now docker
  152. "
  153. elif [ -f /etc/redhat-release ]; then
  154. # CentOS
  155. command::exec "mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  156. curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  157. yum clean all && yum repolist
  158. yum install -y yum-utils device-mapper-persistent-data lvm2
  159. yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  160. yum clean all && yum repolist
  161. yum install docker-ce -y
  162. mkdir -p /etc/docker
  163. sudo tee /etc/docker/daemon.json <<-'EOF'
  164. {
  165. \"registry-mirrors\": [
  166. \"https://dockerproxy.com\",
  167. \"https://hub-mirror.c.163.com\",
  168. \"https://mirror.baidubce.com\",
  169. \"https://ccr.ccs.tencentyun.com\"
  170. ]
  171. }
  172. EOF
  173. sudo systemctl daemon-reload
  174. sudo systemctl enable docker
  175. sudo systemctl restart docker"
  176. else
  177. echo "不支持的操作系统"
  178. exit 1
  179. fi
  180. if command -v docker &> /dev/null; then
  181. log::info "Docker installation successfully"
  182. else
  183. log::error "Docker installation failed"
  184. exit 1
  185. fi
  186. else
  187. log::info "Docker is installed"
  188. fi
  189. }
  190. function docker_install(){
  191. docker_check
  192. log::info "docker autMan installed"
  193. command::exec "docker run -d --name autman --restart always --network=host -v /root/autMan:/autMan hdbjlizhe/autman:latest"
  194. check::exit_code "$?" "docker autMan installed "
  195. echo -e "docker命令:\n查看日志 docker logs autman \n重启容器 docker restart autman "
  196. }
  197. function main(){
  198. echo -e "\033[1;3$((RANDOM%10%8))m
  199. █████╗ ██╗ ██╗████████╗███╗ ███╗ █████╗ ███╗ ██╗
  200. ██╔══██╗██║ ██║╚══██╔══╝████╗ ████║██╔══██╗████╗ ██║
  201. ███████║██║ ██║ ██║ ██╔████╔██║███████║██╔██╗ ██║
  202. ██╔══██║██║ ██║ ██║ ██║╚██╔╝██║██╔══██║██║╚██╗██║
  203. ██║ ██║╚██████╔╝ ██║ ██║ ╚═╝ ██║██║ ██║██║ ╚████║
  204. ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝ \033[0m"
  205. echo
  206. echo "有问题请带上日志文件联系作者,路径为:$LOG_FILE"
  207. echo
  208. echo -e "请选择安装方式:\n1. 本地安装\n2. Docker安装"
  209. read -p "输入选项数字(1或2): " choice
  210. case $choice in
  211. 1)
  212. # 本地安装的代码
  213. log::info "开始本地模式安装"
  214. local_install
  215. ;;
  216. 2)
  217. # Docker安装的代码
  218. log::info "开始docker模式安装"
  219. docker_install
  220. ;;
  221. *)
  222. echo "无效的选项"
  223. ;;
  224. esac
  225. # ...(继续执行其余部分的脚本)
  226. }
  227. main

一键安装

建议使用全新的机器来使用

bash <(curl -sL https://gitee.com/coolfors/autman/raw/master/autMan.sh)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/993909
推荐阅读
相关标签
  

闽ICP备14008679号