Compare commits

...

3 commits

View file

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