{"id":13410920,"url":"https://github.com/serenity-rs/serenity","last_synced_at":"2025-05-13T11:09:26.299Z","repository":{"id":37368546,"uuid":"73012103","full_name":"serenity-rs/serenity","owner":"serenity-rs","description":"A Rust library for the Discord API.","archived":false,"fork":false,"pushed_at":"2025-04-30T05:29:03.000Z","size":78672,"stargazers_count":5105,"open_issues_count":55,"forks_count":602,"subscribers_count":27,"default_branch":"current","last_synced_at":"2025-05-13T11:09:16.750Z","etag":null,"topics":["discord","discord-api","hacktoberfest","rust"],"latest_commit_sha":null,"homepage":"https://discord.gg/serenity-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serenity-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-11-06T18:59:56.000Z","updated_at":"2025-05-13T07:02:17.000Z","dependencies_parsed_at":"2024-01-02T21:23:47.343Z","dependency_job_id":"24d566a1-0b54-4456-b9a0-e46fbf416601","html_url":"https://github.com/serenity-rs/serenity","commit_stats":{"total_commits":2712,"total_committers":256,"mean_commits":10.59375,"dds":0.7407817109144543,"last_synced_commit":"46087950bb197817df19f16da0f457202d6f93ca"},"previous_names":["zeyla/serenity"],"tags_count":95,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serenity-rs%2Fserenity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serenity-rs%2Fserenity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serenity-rs%2Fserenity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serenity-rs%2Fserenity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serenity-rs","download_url":"https://codeload.github.com/serenity-rs/serenity/tar.gz/refs/heads/current","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253929367,"owners_count":21985802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord","discord-api","hacktoberfest","rust"],"created_at":"2024-07-30T20:01:10.213Z","updated_at":"2025-05-13T11:09:26.265Z","avatar_url":"https://github.com/serenity-rs.png","language":"Rust","funding_links":[],"categories":["Rust","API Libraries","Libraries","库 Libraries","💻 API Libraries"],"sub_categories":["Web programming","网络编程 Web programming","Rust"],"readme":"[![ci-badge][]][ci] [![docs-badge][]][docs] [![guild-badge][]][guild] [![crates.io version]][crates.io link] [![rust-version-badge]][rust-version-link]\n\n# serenity\n\n![serenity logo][logo]\n\nSerenity is a Rust library for the Discord API.\n\nView the [examples] on how to use serenity's API. To make a bot with slash commands or text\ncommands, see the [poise](https://github.com/serenity-rs/poise) framework built on top of serenity.\nTo send and receive data from voice channels, see the\n[songbird](https://github.com/serenity-rs/songbird) library.\n\nSerenity supports bot login via the use of [`Client::builder`].\n\nYou may also check your tokens prior to login via the use of\n[`validate_token`].\n\nOnce logged in, you may add handlers to your client to dispatch [`Event`]s,\nby implementing the handlers in a trait, such as [`EventHandler::message`].\nThis will cause your handler to be called when a [`Event::MessageCreate`] is\nreceived. Each handler is given a [`Context`], giving information about the\nevent. See the [client's module-level documentation].\n\nThe [`Shard`] is transparently handled by the library, removing\nunnecessary complexity. Sharded connections are automatically handled for\nyou. See the [gateway's documentation][gateway docs] for more information.\n\nA [`Cache`] is also provided for you. This will be updated automatically for\nyou as data is received from the Discord API via events. When calling a\nmethod on a [`Context`], the cache will first be searched for relevant data\nto avoid unnecessary HTTP requests to the Discord API. For more information,\nsee the [cache's module-level documentation][cache docs].\n\nNote that - although this documentation will try to be as up-to-date and\naccurate as possible - Discord hosts [official documentation][discord docs]. If\nyou need to be sure that some information piece is accurate, refer to their\ndocs.\n\n# Example Bot\n\nA basic ping-pong bot looks like:\n\n```rust,ignore\nuse std::env;\n\nuse serenity::async_trait;\nuse serenity::model::channel::Message;\nuse serenity::prelude::*;\n\nstruct Handler;\n\n#[async_trait]\nimpl EventHandler for Handler {\n    async fn message(\u0026self, ctx: Context, msg: Message) {\n        if msg.content == \"!ping\" {\n            if let Err(why) = msg.channel_id.say(\u0026ctx.http, \"Pong!\").await {\n                println!(\"Error sending message: {why:?}\");\n            }\n        }\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    // Login with a bot token from the environment\n    let token = env::var(\"DISCORD_TOKEN\").expect(\"Expected a token in the environment\");\n    // Set gateway intents, which decides what events the bot will be notified about\n    let intents = GatewayIntents::GUILD_MESSAGES\n        | GatewayIntents::DIRECT_MESSAGES\n        | GatewayIntents::MESSAGE_CONTENT;\n\n    // Create a new instance of the Client, logging in as a bot.\n    let mut client =\n        Client::builder(\u0026token, intents).event_handler(Handler).await.expect(\"Err creating client\");\n\n    // Start listening for events by starting a single shard\n    if let Err(why) = client.start().await {\n        println!(\"Client error: {why:?}\");\n    }\n}\n```\n\n## Full Examples\n\nFull examples, detailing and explaining usage of the basic functionality of the\nlibrary, can be found in the [`examples`] directory.\n\n# Installation\n\nAdd the following to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nserenity = \"0.12\"\ntokio = { version = \"1.21.2\", features = [\"macros\", \"rt-multi-thread\"] }\n```\n\n## MSRV Policy\n\nSerenity's minimum supported Rust version (MSRV) is Rust 1.74.\n\nWe opt to keep MSRV stable on the `current` branch. This means it will remain\nunchanged between minor releases. Occasionally, dependencies may violate SemVer\nand update their own MSRV in a breaking way. As a result, pinning their\nversions will become necessary to successfully build Serenity using an older\nRust release.\n\nThe `next` branch tracks the latest Rust release as its MSRV. This allows for\nswift development as new languages features are stabilized, and reduces\ntechnical debt in the long run. When a new major release is cut, the MSRV on\n`current` will be updated to that of `next`, and we will commit to supporting\nthat MSRV until the following major release.\n\n# Features\n\nFeatures can be enabled or disabled by configuring the library through\nCargo.toml:\n\n```toml\n[dependencies.serenity]\ndefault-features = false\nfeatures = [\"pick\", \"your\", \"feature\", \"names\", \"here\"]\nversion = \"0.12\"\n```\n\nThe default features are: `builder`, `cache`, `chrono`, `client`, `framework`, `gateway`,\n`http`, `model`, `standard_framework`, `utils`, and `rustls_backend`.\n\nThere are these alternative default features, they require to set `default-features = false`:\n\n- **default_native_tls**: Uses `native_tls_backend` instead of the default `rustls_backend`.\n- **default_no_backend**: Excludes the default backend, pick your own backend instead.\n\nIf you are unsure which to pick, use the default features by not setting `default-features = false`.\n\nThe following is a full list of features:\n\n- **builder**: The builders used in conjunction with models' methods.\n- **cache**: The cache will store information about guilds, channels, users, and\nother data, to avoid performing REST requests. If you are low on RAM, do not\nenable this.\n- **collector**: A collector awaits events, such as receiving a message from a user or reactions on a message, and allows for responding to the events in a convenient fashion. Collectors can be configured to enforce certain criteria the events must meet.\n- **client**: A manager for shards and event handlers, abstracting away the\nwork of handling shard events and updating the cache, if enabled.\n- **framework**: Enables the framework, which is a utility to allow simple\ncommand parsing, before/after command execution, prefix setting, and more.\n- **gateway**: A Shard, used as a higher-level interface for communicating with\nthe Discord gateway over a WebSocket client.\n- **http**: Functions providing a wrapper over Discord's REST API at a low\nenough level that optional parameters can be provided at will via a JsonMap.\n- **model**: Method implementations for models, acting as helper methods over\nthe HTTP functions.\n- **standard_framework**: A standard, default implementation of the Framework. **NOTE**: Deprecated as of v0.12.1. Using the [poise](https://github.com/serenity-rs/poise) framework is recommended instead.\n- **utils**: Utility functions for common use cases by users.\n- **voice**: Enables registering a voice plugin to the client, which will handle actual voice connections from Discord.\n[lavalink-rs][project:lavalink-rs] or [Songbird][project:songbird] are recommended voice plugins.\n- **default_native_tls**: Default features but using `native_tls_backend`\ninstead of `rustls_backend`.\n- **tokio_task_builder**: Enables tokio's `tracing` feature and uses `tokio::task::Builder` to spawn tasks with names if `RUSTFLAGS=\"--cfg tokio_unstable\"` is set.\n- **unstable_discord_api**: Enables features of the Discord API that do not have a stable interface. The features might not have official documentation or are subject to change.\n- **simd_json**: Enables SIMD accelerated JSON parsing and rendering for API calls, if supported on the target CPU architecture.\n- **temp_cache**: Enables temporary caching in functions that retrieve data via the HTTP API.\n- **chrono**: Uses the `chrono` crate to represent timestamps. If disabled, the `time` crate is used instead.\n- **interactions_endpoint**: Enables tools related to Discord's Interactions Endpoint URL feature\n\nTo enable all parts of the codebase, use the **\"full\"** feature.\n\nFor possibly more up-to-date information, check the Cargo.toml.\n\nSerenity offers two TLS-backends, `rustls_backend` by default, you need to pick\none if you do not use the default features:\n\n- **rustls_backend**: Uses Rustls for all platforms, a pure Rust\nTLS implementation.\n- **native_tls_backend**: Uses SChannel on Windows, Secure Transport on macOS,\nand OpenSSL on other platforms.\n\nIf you want all of the default features except for `cache` for example, you can\nlist all but that:\n\n```toml\n[dependencies.serenity]\ndefault-features = false\nfeatures = [\n    \"builder\",\n    \"chrono\",\n    \"client\",\n    \"framework\",\n    \"gateway\",\n    \"http\",\n    \"model\",\n    \"standard_framework\",\n    \"utils\",\n    \"rustls_backend\",\n]\nversion = \"0.12\"\n```\n\n# Dependencies\n\nIf you use the `native_tls_backend` and you are not developing on macOS or Windows, you will need:\n\n- openssl\n\n# Hosting\n\nIf you want a quick and easy way to host your bot, you can use [shuttle][project:shuttle],\na Rust-native cloud development platform that allows deploying Serenity bots for free.\n\n# Projects extending Serenity\n\n- [lavalink-rs][project:lavalink-rs]: An interface to [Lavalink][repo:lavalink] and [Andesite][repo:andesite], an audio sending node based on [Lavaplayer][repo:lavaplayer]\n- [Songbird][project:songbird]: An async Rust library for the Discord voice API.\n- [Poise][project:poise]: Experimental command framework, with advanced features like edit tracking, single function slash and prefix commands and flexible argument parsing.\n\n[`Cache`]: https://docs.rs/serenity/*/serenity/cache/struct.Cache.html\n[`Client::builder`]: https://docs.rs/serenity/*/serenity/client/struct.Client.html#method.builder\n[`EventHandler::message`]: https://docs.rs/serenity/*/serenity/client/trait.EventHandler.html#method.message\n[`Context`]: https://docs.rs/serenity/*/serenity/client/struct.Context.html\n[`Event`]: https://docs.rs/serenity/*/serenity/model/event/enum.Event.html\n[`Event::MessageCreate`]: https://docs.rs/serenity/*/serenity/model/event/enum.Event.html#variant.MessageCreate\n[`Shard`]: https://docs.rs/serenity/*/serenity/gateway/struct.Shard.html\n[`examples`]: https://github.com/serenity-rs/serenity/blob/current/examples\n[`rest`]: https://docs.rs/serenity/*/serenity/client/rest/index.html\n[`validate_token`]: https://docs.rs/serenity/*/serenity/utils/fn.validate_token.html\n[cache docs]: https://docs.rs/serenity/*/serenity/cache/index.html\n[ci]: https://github.com/serenity-rs/serenity/actions\n[ci-badge]: https://img.shields.io/github/actions/workflow/status/serenity-rs/serenity/ci.yml?branch=current\u0026style=flat-square\n[client's module-level documentation]: https://docs.rs/serenity/*/serenity/client/index.html\n[crates.io link]: https://crates.io/crates/serenity\n[crates.io version]: https://img.shields.io/crates/v/serenity.svg?style=flat-square\n[discord docs]: https://discord.com/developers/docs/intro\n[docs]: https://docs.rs/serenity\n[docs-badge]: https://img.shields.io/badge/docs-online-5023dd.svg?style=flat-square\n[examples]: https://github.com/serenity-rs/serenity/tree/current/examples\n[gateway docs]: https://docs.rs/serenity/*/serenity/gateway/index.html\n[guild]: https://discord.gg/serenity-rs\n[guild-badge]: https://img.shields.io/discord/381880193251409931.svg?style=flat-square\u0026colorB=7289DA\n[project:lavalink-rs]: https://gitlab.com/vicky5124/lavalink-rs/\n[project:songbird]: https://github.com/serenity-rs/songbird\n[project:poise]: https://github.com/kangalioo/poise\n[project:shuttle]: https://github.com/shuttle-hq/shuttle\n[repo:lavalink]: https://github.com/freyacodes/Lavalink\n[repo:andesite]: https://github.com/natanbc/andesite\n[repo:lavaplayer]: https://github.com/sedmelluq/lavaplayer\n[logo]: https://raw.githubusercontent.com/serenity-rs/serenity/current/logo.png\n[rust-version-badge]: https://img.shields.io/badge/rust-1.74.0+-93450a.svg?style=flat-square\n[rust-version-link]: https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserenity-rs%2Fserenity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserenity-rs%2Fserenity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserenity-rs%2Fserenity/lists"}