-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple sample send_discord_message
- Loading branch information
1 parent
eb722c2
commit 2102b7f
Showing
5 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Send Discord Message | ||
|
||
Send a message to a Discord channel. | ||
|
||
## Usage | ||
|
||
- Add your Discord API token to `flowpipe.pvars` | ||
- Run the pipeline and specify the `channel_id` and `message` args, e.g., `flowpipe pipeline run send_discord_message --arg 'channel_id=1234567890' --arg 'message=Hello world!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
discord_token = "YourBotToken" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mod "send_discord_message" { | ||
title = "Send Discord Message" | ||
description = "Send a message to a Discord channel." | ||
|
||
require { | ||
mod "github.com/turbot/flowpipe-mod-discord" { | ||
version = "0.0.1-rc.0" | ||
args = { | ||
token = var.discord_token | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
pipeline "send_discord_message" { | ||
title = "Send Discord Message" | ||
description = "Send a message to a Discord channel" | ||
|
||
param "discord_token" { | ||
description = "The Discord BOT token to use" | ||
type = string | ||
default = var.discord_token | ||
} | ||
|
||
param "discord_channel_id" { | ||
description = "The ID of the channel to send the message to" | ||
type = number | ||
} | ||
|
||
param "discord_message" { | ||
description = "The message to send." | ||
type = string | ||
} | ||
|
||
step "pipeline" "create_message" { | ||
pipeline = discord.pipeline.create_message | ||
args = { | ||
token = param.discord_token | ||
channel_id = param.discord_channel_id | ||
message = param.discord_message | ||
} | ||
} | ||
|
||
output "create_message_check" { | ||
value = !is_error(step.pipeline.create_message) ? "Message '${param.discord_message}' sent to ${param.discord_channel_id}" : "Error sending message: ${error_message(step.pipeline.create_message)}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
variable "discord_token" { | ||
type = string | ||
description = "The Discord bot token." | ||
} |