Compare commits

..

No commits in common. "226f75327fd207008190782a1f7cf71e37ef024e" and "5ea94e5453a37ab3c9eb277983cab07f43f7675d" have entirely different histories.

View file

@ -1,23 +1,20 @@
# Localizations
[EN](https://git.amok.dev/AmokDev/rust-discord-rpc/src/branch/master/README_EN.md) | RU
# Rust Discord Activity # Rust Discord Activity
_Простая Rust библиотека для управления Discord RPC для Windows, Linux и MacOS_ _A lightweight Rust library to control Discord Rich Presence for Windows, Linux and MacOS_
[Автор идеи](https://github.com/DylanCa/rust-discord-activity) [Author of the idea and 80% code](https://github.com/DylanCa/rust-discord-activity)
## Установка ## Installation
```bash ```bash
cargo add --git https://git.amok.dev/AmokDev/rust-discord-rpc cargo add --git https://git.amok.dev/AmokDev/rust-discord-rpc
``` ```
## Как использовать ## How to use
1. Создайте новый DiscordClient 1. Instantiate a new DiscordClient
2. Создайте объект Activity и задайте нужные данные, используя предоставленные структуры 2. Create your Activity and set desired data using provided structs
3. Создайте новую полезную нагрузку с вашей активностью 3. Create a new Payload with your Activity
4. Отправьте вашу полезную нагрузку через DiscordClient 4. Send your Payload through the DiscordClient
## Пример ## Example
```rust ```rust
let mut client = DiscordClient::new("<application_id>"); let mut client = DiscordClient::new("<application_id>");
@ -31,15 +28,15 @@ let timestamp = Timestamp::new(Some(now_in_millis - 10000), None);
let party = Party::new(None, Some((2, 4))); let party = Party::new(None, Some((2, 4)));
let mut button_vec = vec![]; let mut button_vec = vec![];
button_vec.push(Button::new("Первая кнопка".into(), "https://google.com".into())); button_vec.push(Button::new("First Button".into(), "https://google.com".into()));
button_vec.push(Button::new("Вторая кнопка".into(), "https://yahoo.com".into())); button_vec.push(Button::new("Second Button".into(), "https://yahoo.com".into()));
let mut activity = Activity::new(); let mut activity = Activity::new();
activity activity
.set_state(Some("Это состояние".into())) .set_state(Some("This is State".into()))
.set_activity_type(Some(ActivityType::LISTENING)) .set_activity_type(Some(ActivityType::LISTENING))
.set_details(Some("Это детали".parse().unwrap())) .set_details(Some("This is Details".parse().unwrap()))
.set_timestamps(Some(timestamp)) .set_timestamps(Some(timestamp))
.set_assets(Some(asset)) .set_assets(Some(asset))
.set_party(Some(party)) .set_party(Some(party))
@ -52,12 +49,12 @@ let _ = client.send_payload(payload);
``` ```
Это устанавливает новую активность для текущего пользователя Discord: This sets-up a new Activity for the current Discord user:
<img alt="Discord Rich Presence" src="https://imgur.com/gf9pOen.png" width="300"/> <img alt="Discord Rich Presence" src="https://imgur.com/gf9pOen.png" width="300"/>
# Спасибо за поддержку # Thanks for support
## Тестерам ## Testers
| Windows | MacOS | Linux | | Windows | MacOS | Linux |
|---------------|-------------|----------| |---------------|-------------|----------|
| AmokDev (я) | hellkarm | doxbiner | | AmokDev (me) | hellkarm | doxbiner |