Campus Campus
首页
文档
案例
Gitee (opens new window)
GitHub (opens new window)
首页
文档
案例
Gitee (opens new window)
GitHub (opens new window)
  • 介绍
  • 使用教程
  • 部署教程
    • jar包方式
      • 打包
      • 部署
    • Docker 启动
      • compose
      • run
  • coze-discord
zhiyuan
2024-02-01
目录

部署教程

# jar包方式

# 打包

项目根目录使用如下maven命令打包:

mvn clean package
1

如果使用的是IDEA工具,右上角的 Maven -> Lifecycle 中,依次点击 clean package

之后在 target 目录,可看到打好的 coze-discord-xxx.jar 包

# 部署

需安装好需要的环境

在jar包目录下,启动命令:

nohup java -jar xxxxx.jar > log.log &
1

启动之后在当前目录的 log.log 是启动日志

# Docker 启动

仓库地址:https://github.com/oddfar/coze-discord/pkgs/container/coze-discord (opens new window)

# compose

docker-compose pull && docker-compose up -d
1

docker-compose.yml

version: '3'

services:

  coze-discord:
    image: ghcr.io/oddfar/coze-discord:master
    container_name: coze-discord
    restart: always
    environment:
      # 时区上海
      TZ: Asia/Shanghai
      # 端口
      SERVER_PORT: 8080
      # 发送消息的Bot-Token
      DISCORD_BOT_TOKEN: xxxxxxxxx
      # 两个机器人所在的服务器ID
      DISCORD_GUILD_ID: 1xxxxxxxxxx3
      # 由coze托管的机器人ID
      DISCORD_COZE_BOT_ID: 1xxxxxxxxx2
      # 默认频道
      DISCORD_CHANNEL_ID: 1xxxxxxxxxxxx0
      # 代理:host+port,例如127.0.0.1:7890,为空则不开启
#      DISCORD_PROXY_HOST_PORT: 127.0.0.1:7890

    privileged: true
    network_mode: "host"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# run

拉取镜像

docker pull ghcr.io/oddfar/coze-discord:master
1

启动

docker run --net host -d --restart=always \
--name coze-discord \
--privileged \
-e TZ=Asia/Shanghai \
-e SERVER_PORT=8080 \
-e DISCORD_BOT_TOKEN="xxxxxxxxx" \
-e DISCORD_GUILD_ID="1xxxxxxxxxx3" \
-e DISCORD_COZE_BOT_ID="1xxxxxxxxx2" \
-e DISCORD_CHANNEL_ID="1xxxxxxxxxxxx0" \
ghcr.io/oddfar/coze-discord:master
1
2
3
4
5
6
7
8
9
10

其中,DISCORD_BOT_TOKEN,DISCORD_GUILD_ID,DISCORD_COZE_BOT_ID,DISCORD_CHANNEL_ID修改为自己的。

若需要配置代理增加一条环境变量

-e DISCORD_PROXY_HOST_PORT="127.0.0.1:7890"
1
最后更新: 2024/02/15, 5:02:00
使用教程

← 使用教程

Theme by Vdoing | Copyright © 2023-2024 oddfar | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式