github.com/Mrs4s/go-cqhttp@v1.2.0/docs/quick_start.md (about)

     1  #  开始
     2  
     3  欢迎来到 go-cqhttp 文档 目前还在咕
     4  
     5  > 注意, 最新文档已经移动到 [go-cqhttp-docs](https://github.com/ishkong/go-cqhttp-docs), 当前文档只做兼容性保留, 所以内容可能有不足.
     6  
     7  # 基础教程
     8  ## 下载
     9  从[release](https://github.com/Mrs4s/go-cqhttp/releases)界面下载最新版本的go-cqhttp
    10  
    11  - Windows下32位文件为  `go-cqhttp-v*-windows-386.zip`
    12  - Windows下64位文件为 `go-cqhttp-v*-windows-amd64.zip`
    13  - Windows下arm用(如使用高通CPU的笔记本)文件为 `go-cqhttp-v*-windows-arm.zip`
    14  - Linux下32位文件为 `go-cqhttp-v*-linux-386.tar.gz`
    15  - Linux下64位文件为 `go-cqhttp-v*-linux-amd64.tar.gz`
    16  - Linux下arm用(如树莓派)文件为 `go-cqhttp-v*-linux-arm.tar.gz`
    17  - MD5文件为 `*.md5` ,用于校验文件完整性
    18  - 如果没有你所使用的系统版本或者希望自己构建,请移步[进阶指南-如何自己构建](#如何自己构建)
    19  
    20  ## 解压
    21  
    22  - Windows下请使用自己熟悉的解压软件自行解压
    23  - Linux下在命令行中输入 `tar -xzvf [文件名]` 
    24  
    25  ## 使用
    26  
    27  ### Windows
    28  
    29  #### 标准方法
    30  
    31  1.  双击`go-cqhttp.exe`此时将提示
    32  ```
    33  [WARNING]: 尝试加载配置文件 config.hjson 失败: 文件不存在
    34  [INFO]: 默认配置文件已生成,请编辑 config.hjson 后重启程序.
    35  ```
    36  2. 参照[config.md](https://github.com/Mrs4s/go-cqhttp/blob/master/docs/config.md)和你所用到的插件的 `README` 填入参数
    37  3. 再次双击`go-cqhttp.exe`
    38  ```
    39  [INFO]: 登录成功 欢迎使用: balabala
    40  ```
    41  
    42  如出现需要认证的信息,请自行认证设备。
    43  
    44  此时,基础配置完成
    45  
    46  #### 懒人法
    47  
    48  1. [下载包含Windows.bat的zip](https://github.com/fkx4-p/go-cqhttp-lazy/archive/master.zip)
    49  2. 解压
    50  3. 将`Windows.bat`复制/剪切到**go-cqhttp**文件夹
    51  4. 双击运行
    52  
    53  效果如下
    54  
    55  ```
    56  QQ account:
    57  [QQ账号]
    58  QQ password:
    59  [QQ密码]
    60  enable http?(Y/n)
    61  [是否开启http(y/n),默认开启]
    62  enable ws?(Y/n)
    63  [是否开启websocket(y/n),默认开启]
    64  请按任意键继续. . .
    65  ```
    66  
    67  5. 双击`go-cqhttp.exe`
    68  ```
    69  [INFO]: 登录成功 欢迎使用: balabala
    70  ```
    71  
    72  如出现需要认证的信息,请自行认证设备。
    73  
    74  此时,基础配置完成
    75  
    76  ### Linux
    77  
    78  #### 标准方法
    79  
    80  1. 打开一个命令行/ssh
    81  2. `cd`到解压目录
    82  3. 输入 `./go-cqhttp`,`Enter`运行 ,此时将提示
    83  ```
    84  [WARNING]: 尝试加载配置文件 config.hjson 失败: 文件不存在
    85  [INFO]: 默认配置文件已生成,请编辑 config.hjson 后重启程序.
    86  ```
    87  
    88  4. 参照[config.md](https://github.com/Mrs4s/go-cqhttp/blob/master/docs/config.md)和你所用到的插件的 `README` 填入参数
    89  5. 再次输入 `./go-cqhttp`,`Enter`运行
    90  ```
    91  [INFO]: 登录成功 欢迎使用: balabala
    92  ```
    93  
    94  如出现需要认证的信息,请自行认证设备。
    95  
    96  此时,基础配置完成
    97  
    98  #### 懒人法
    99  
   100  暂时咕咕咕了
   101  
   102  ## 验证http是否成功配置
   103  
   104  此时,如果在本地开启的服务器,可以在浏览器输入`http://127.0.0.1:5700/send_private_msg?user_id=[接收者qq号]&message=[发送的信息]`来发送一条测试信息
   105  
   106  如果出现`{"data":{"message_id":balabala},"retcode":0,"status":"ok"}`则证明已经成功配置HTTP
   107  
   108  *注:请 连 中括号 也替换掉,就像这样:*`http://127.0.0.1:5700/send_private_msg?user_id=10001&message=ffeecoishp`
   109  
   110  # 进阶指南
   111  
   112  ## 跳过启动的五秒延时
   113  
   114  使用命令行参数 `faststart`即可跳过启动的五秒钟延时,例如
   115  
   116  ```
   117  .\go-cqhttp.exe faststart
   118  ```
   119  
   120  ## 如何自己构建
   121  
   122  1. [下载源码](https://github.com/Mrs4s/go-cqhttp/archive/master.zip)并解压 || 使用`git clone https://github.com/Mrs4s/go-cqhttp.git`来拉取
   123  
   124  2. [下载golang binary release](https://golang.google.cn/dl/)并安装或者[自己构建golang](https://golang.google.cn/doc/install/source)
   125  
   126  3. 在`cmd`或Linux命令行中,`cd`到目录中
   127  
   128  4. 输入`go build -ldflags "-s -w -extldflags '-static'"`,`Enter`运行
   129  
   130  *注:可以使用*`go env -w GOPROXY=https://goproxy.cn,direct`*来加速国内依赖安装速度*
   131  
   132  ## 更新
   133  
   134  ### 方法一
   135  
   136  从[release](https://github.com/Mrs4s/go-cqhttp/releases)界面下载最新版本的go-cqhttp
   137  并替换之前的版本
   138  
   139  ### 方法二
   140  
   141  使用更新参数,在命令行中打开go-cqhttp所在目录
   142  #### windows
   143  输入指令
   144  `go-cqhttp.exe update`
   145  
   146  如果在国内连接github下载速度可能很慢,可以使用镜像源下载
   147  
   148  `go-cqhttp.exe update https://github.rc1844.workers.dev`
   149  
   150  几个可用的镜像源
   151  - `https://hub.fastgit.org`
   152  - `https://github.com.cnpmjs.org`
   153  - `https://github.bajins.com`
   154  - `https://github.rc1844.workers.dev`
   155  
   156  #### linux
   157  方法与windows基本一致,将 `go-cqhttp.exe` 替换为 `./go-cqhttp`即可