[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5676":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},5676,"serenity","serenity-rs\u002Fserenity","serenity-rs","A Rust library for the Discord API.","https:\u002F\u002Fdiscord.gg\u002Fserenity-rs",null,"Rust",5522,663,24,33,0,1,7,22,4,39.47,"ISC License",false,"current",true,[27,28,29,30],"discord","discord-api","hacktoberfest","rust","2026-06-12 02:01:13","[![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:\u002F\u002Fgithub.com\u002Fserenity-rs\u002Fpoise) framework built on top of serenity.\nTo send and receive data from voice channels, see the\n[songbird](https:\u002F\u002Fgithub.com\u002Fserenity-rs\u002Fsongbird) 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(&self, ctx: Context, msg: Message) {\n        if msg.content == \"!ping\" {\n            if let Err(why) = msg.channel_id.say(&ctx.http, \"Pong!\").await {\n                println!(\"Error sending message: {why:?}\");\n            }\n        }\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    \u002F\u002F Login with a bot token from the environment\n    let token = env::var(\"DISCORD_TOKEN\").expect(\"Expected a token in the environment\");\n    \u002F\u002F 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    \u002F\u002F Create a new instance of the Client, logging in as a bot.\n    let mut client =\n        Client::builder(&token, intents).event_handler(Handler).await.expect(\"Err creating client\");\n\n    \u002F\u002F 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\u002Fafter 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:\u002F\u002Fgithub.com\u002Fserenity-rs\u002Fpoise) 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:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fcache\u002Fstruct.Cache.html\n[`Client::builder`]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fclient\u002Fstruct.Client.html#method.builder\n[`EventHandler::message`]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fclient\u002Ftrait.EventHandler.html#method.message\n[`Context`]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fclient\u002Fstruct.Context.html\n[`Event`]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fmodel\u002Fevent\u002Fenum.Event.html\n[`Event::MessageCreate`]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fmodel\u002Fevent\u002Fenum.Event.html#variant.MessageCreate\n[`Shard`]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fgateway\u002Fstruct.Shard.html\n[`examples`]: https:\u002F\u002Fgithub.com\u002Fserenity-rs\u002Fserenity\u002Fblob\u002Fcurrent\u002Fexamples\n[`rest`]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fclient\u002Frest\u002Findex.html\n[`validate_token`]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Futils\u002Ffn.validate_token.html\n[cache docs]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fcache\u002Findex.html\n[ci]: https:\u002F\u002Fgithub.com\u002Fserenity-rs\u002Fserenity\u002Factions\n[ci-badge]: https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fserenity-rs\u002Fserenity\u002Fci.yml?branch=current&style=flat-square\n[client's module-level documentation]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fclient\u002Findex.html\n[crates.io link]: https:\u002F\u002Fcrates.io\u002Fcrates\u002Fserenity\n[crates.io version]: https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Fserenity.svg?style=flat-square\n[discord docs]: https:\u002F\u002Fdocs.discord.com\u002Fdevelopers\u002Fintro\n[docs]: https:\u002F\u002Fdocs.rs\u002Fserenity\n[docs-badge]: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdocs-online-5023dd.svg?style=flat-square\n[examples]: https:\u002F\u002Fgithub.com\u002Fserenity-rs\u002Fserenity\u002Ftree\u002Fcurrent\u002Fexamples\n[gateway docs]: https:\u002F\u002Fdocs.rs\u002Fserenity\u002F*\u002Fserenity\u002Fgateway\u002Findex.html\n[guild]: https:\u002F\u002Fdiscord.gg\u002Fserenity-rs\n[guild-badge]: https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F381880193251409931.svg?style=flat-square&colorB=7289DA\n[project:lavalink-rs]: https:\u002F\u002Fgitlab.com\u002Fvicky5124\u002Flavalink-rs\u002F\n[project:songbird]: https:\u002F\u002Fgithub.com\u002Fserenity-rs\u002Fsongbird\n[project:poise]: https:\u002F\u002Fgithub.com\u002Fkangalioo\u002Fpoise\n[project:shuttle]: https:\u002F\u002Fgithub.com\u002Fshuttle-hq\u002Fshuttle\n[repo:lavalink]: https:\u002F\u002Fgithub.com\u002Ffreyacodes\u002FLavalink\n[repo:andesite]: https:\u002F\u002Fgithub.com\u002Fnatanbc\u002Fandesite\n[repo:lavaplayer]: https:\u002F\u002Fgithub.com\u002Fsedmelluq\u002Flavaplayer\n[logo]: https:\u002F\u002Fraw.githubusercontent.com\u002Fserenity-rs\u002Fserenity\u002Fcurrent\u002Flogo.png\n[rust-version-badge]: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Frust-1.74.0+-93450a.svg?style=flat-square\n[rust-version-link]: https:\u002F\u002Fblog.rust-lang.org\u002F2023\u002F11\u002F16\u002FRust-1.74.0.html\n","Serenity 是一个用于 Discord API 的 Rust 库。它提供了丰富的功能，包括通过 `Client::builder` 实现的 bot 登录、使用 `validate_token` 进行令牌验证、事件处理机制以及自动管理的 Shard 和 Cache 系统。Shard 透明地处理连接分片，Cache 则自动更新并缓存从 Discord API 接收到的数据，以减少不必要的 HTTP 请求。此库适用于需要与 Discord 平台进行交互的各种场景，如创建聊天机器人、实现自定义命令或处理语音数据等。对于希望利用 Rust 的性能优势同时开发 Discord 应用程序的开发者来说，Serenity 是一个理想的选择。",2,"2026-06-11 03:04:39","top_language"]