Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mataku/fastlane-plugin-discord_webhook

A lightweight fastlane Plugin to send a message using Discord Webhook.
https://github.com/mataku/fastlane-plugin-discord_webhook

fastlane-plugin

Last synced: about 1 month ago
JSON representation

A lightweight fastlane Plugin to send a message using Discord Webhook.

Awesome Lists containing this project

README

        

# discord_webhook plugin

[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-discord_webhook)

## Getting Started

This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-discord_webhook`, add it to your project by running:

```bash
fastlane add_plugin discord_webhook
```

You must create a webhook before using library. See details: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks.

## About discord_webhook

A lightweight fastlane plugin to send a message using Discord Webhook

## Parameters

| Key | Description |
| --- | --- |
| `webhook_url` | Discord Webhook URL. |
| `username` | [Optional] Username. It will override webhook's username if specified. |
| `message` | The message you want to send. |
| `attachment_file_path` | [Optional] File path to upload. See details for supported types: https://discord.com/developers/docs/reference#uploading-files |
| `embed_payload` | [Optional] Embed Object. You can specify one object. See details: https://discord.com/developers/docs/resources/message#embed-object |

## Example

```ruby
# Send a simple message
lane :discord_message do
discord_webhook(
webhook_url: 'https://yourDiscordWebhookUrl',
message: 'hello',
# You can override username by specifying it if needed.
# username: 'mataku'
)
end
```

```ruby
# Send a message with a file
lane :discord_message_with_file do
discord_webhook(
webhook_url: 'https://yourDiscordWebhookUrl',
message: 'hello',
attachment_file_path: '/home/mataku/screenshot.png',
# Be careful to use relative path.
# Fastfile is into fastlane/, but fastlane tries to load from working directory.
)
end
```

```ruby
# Send a message with embed content
lane :discord_message_with_embed do
discord_webhook(
webhook_url: 'https://yourDiscordWebhookUrl',
message: 'hello',
embed_payload: {
title: 'embed_title',
description: 'embed_description',
url: 'https://github.com/mataku',
thumbnail: {
url: 'https://github.com/mataku.png'
}
}
)
end
```

### Mention

You can mention by using **User ID** or **Role ID**, not display name.

```ruby
lane :user_mention do
discord_webhook(
# ...
# Specify User ID, like <@USER_ID>
message: 'Hi, <@12340987651234567>'
)
end

lane :role_mention do
discord_webhook(
# ...
# Specify Role ID with &, like <@&ROLE_ID>
message: 'Hi, <@&123456798765123456>'
)
end
```

User ID reference | Role ID reference
:--: | :--:
![](./misc/user_id.png) | ![](./misc/role_id.png)

- - -

See details: https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID#h_01HRSTXPS5H5D7JBY2QKKPVKNA.

## Issues and Feedback

For any other issues and feedback about this plugin, please submit it to this repository.

## Troubleshooting

If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.