-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This Repository has moved from AS1100K/aether to it's own repository. For previous commits see AS1100K/aether#17
- Loading branch information
Showing
8 changed files
with
623 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,78 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
# Run cargo test | ||
test: | ||
name: Test Suite | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }} | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Install Dependencies | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | ||
- name: Run cargo test | ||
run: cargo test | ||
|
||
# Run cargo clippy -- -D warnings | ||
clippy_check: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }} | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy | ||
- name: Install Dependencies | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | ||
- name: Run clippy | ||
run: cargo clippy -- -D warnings | ||
|
||
# Run cargo fmt --all -- --check | ||
format: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- name: Run cargo fmt | ||
run: cargo fmt --all -- --check |
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,23 @@ | ||
on: | ||
push: | ||
# Pattern matched against refs/tags | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
publish: | ||
name: Publish | ||
# Specify OS | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust Toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Publish Crate | ||
run: cargo publish --token ${CRATES_TOKEN} | ||
env: | ||
CRATES_TOKEN: ${{ secrets.CRATES_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,24 @@ | ||
[package] | ||
name = "bevy-discord" | ||
description = "A bevy plugin that can send messages to discord." | ||
version = "0.2.0-alpha.1" | ||
edition = "2021" | ||
authors = ["Aditya Kumar <[email protected]>"] | ||
readme = "README.md" | ||
repository = "https://github.com/AS1100K/aether/tree/main/plugins/discord" | ||
publish = true | ||
license = "GPL-3.0-only" | ||
keywords = ["bevy", "plugin", "discord"] | ||
|
||
[dependencies] | ||
bevy_app = "0.13.2" | ||
bevy_ecs = "0.13.2" | ||
reqwest = { version = "0.12.5", features = ["json", "rustls-tls"]} | ||
serde = { version = "1.0.203", features = ["derive"] } | ||
tracing = "0.1.40" | ||
tokio = { version = "1.38.0", features = ["rt-multi-thread", "rt"] } | ||
serde_json = { version = "1.0.117" } | ||
|
||
[dev-dependencies] | ||
anyhow = "1.0.86" | ||
azalea = "0.9.1" |
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,57 @@ | ||
# Bevy Discord Plugin | ||
|
||
 | ||
 | ||
 | ||
|
||
|
||
A very simple, bevy plugin that let you send messages through discord webhooks. _In Future releases, this plugin will support | ||
discord applications & bots and can send & receive messages by them._ | ||
|
||
## Example | ||
This example is shown inside azalea, but this plugin can be used with any bevy app. | ||
|
||
```rust,no_run | ||
use azalea::prelude::*; | ||
use azalea::Vec3; | ||
use bevy_discord::common::DiscordMessage; | ||
use bevy_discord::webhook::{DiscordWebhookPlugin, DiscordWebhookRes, SendMessageEvent}; | ||
#[tokio::main] | ||
async fn main() { | ||
let account = Account::offline("_aether"); | ||
let discord_webhook = DiscordWebhookRes::new() | ||
.add_channel( | ||
"channel_name", | ||
"webhook_url", | ||
"", | ||
"" | ||
); | ||
ClientBuilder::new() | ||
.set_handler(handle) | ||
.add_plugins(DiscordWebhookPlugin::new(discord_webhook)) | ||
.start(account, "localhost") | ||
.await | ||
.unwrap(); | ||
} | ||
#[derive(Default, Clone, Component)] | ||
pub struct State {} | ||
async fn handle(bot: Client, event: Event, _state: State) -> anyhow::Result<()> { | ||
match event { | ||
Event::Chat(m) => { | ||
let content = m.message(); | ||
println!("{}", &content.to_ansi()); | ||
let message = DiscordMessage::new() | ||
.content(content.to_string()); | ||
bot.ecs.lock().send_event(SendMessageEvent::new("channel_name", message)); | ||
} | ||
_ => {} | ||
} | ||
Ok(()) | ||
} | ||
``` |
Oops, something went wrong.