Discord.sh 项目常见问题解决方案

Discord.sh 项目常见问题解决方案

discord.sh Write-only command-line Discord webhooks integration written in 100% Bash script discord.sh 项目地址: https://gitcode.com/gh_mirrors/di/discord.sh

1. 项目基础介绍和主要编程语言

discord.sh 是一个开源项目,它提供了一个纯 Bash 脚本,用于创建和发送非常定制化和美观的 Discord 消息。这个项目被设计为极简且轻量级,它依赖于 curljq 来发送 HTTP 请求和解析 JSON 数据。主要使用的编程语言是 Bash。

2. 新手常见问题及解决步骤

问题一:如何设置 Discord webhook?

解决步骤:

  1. 在 Discord 的目标文本频道中创建一个 webhook。
  2. 克隆或下载 discord.sh 项目到本地。
  3. 使用以下三种方式之一来指定 webhook 端点:
    • 将 webhook URL 作为参数传递给 discord.sh,使用 --webhook-url 选项。
    • 设置环境变量 DISCORD_WEBHOOK
    • 在与 discord.sh 脚本相同的目录下创建一个名为 webhook 的文件,文件中只包含 webhook URL。

问题二:如何使用自定义用户名和头像发送消息?

解决步骤:

  1. 在运行 discord.sh 脚本时,添加 --username--avatar 选项。
  2. 例如:
    ./discord.sh --webhook-url="$WEBHOOK" --username "NotificationBot" --avatar "https://i.imgur.com/12jyR5Q.png" --text "Hello, world!"
    

问题三:如何发送带有嵌入内容的消息?

解决步骤:

  1. 使用 --title--description--color 等选项来定义嵌入内容。
  2. 例如,发送一个完整的嵌入消息:
    ./discord.sh \
    --webhook-url="$WEBHOOK" \
    --username "NotificationBot" \
    --avatar "https://i.imgur.com/12jyR5Q.png" \
    --text "Check out this embed" \
    --title "New Notification" \
    --description "This is a description\nPretty cool huh" \
    --color "0xFFFFFF" \
    --url "https://github.com/fieu/discord.sh" \
    --author "discord.sh" \
    --author-url "https://github.com/fieu/discord.sh" \
    --author-icon "https://i.imgur.com/12jyR5Q.png" \
    --image "https://i.imgur.com/12jyR5Q.png" \
    --thumbnail "https://i.imgur.com/12jyR5Q.png" \
    --field "Author: ChaoticWeg" \
    --field "Author: fieu" \
    --footer "discord.sh" \
    --footer-icon "https://i.imgur.com/12jyR5Q.png"
    
  3. 请确保所有选项的值都正确无误,并且按照脚本要求的格式提供。

通过以上步骤,新手用户可以顺利地开始使用 discord.sh 项目,并发送定制化的 Discord 消息。

discord.sh Write-only command-line Discord webhooks integration written in 100% Bash script discord.sh 项目地址: https://gitcode.com/gh_mirrors/di/discord.sh

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

滑辰煦Marc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值