Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ async fn main() -> anyhow::Result<()> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let token = env::var("DISCORD_TOKEN")?;

// Use intents to only receive guild message events.
Expand Down
3 changes: 3 additions & 0 deletions book/src/chapter_1_crates/section_2_http.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let client = Client::new(env::var("DISCORD_TOKEN")?);

let me = client.current_user().await?.model().await?;
Expand Down
3 changes: 3 additions & 0 deletions book/src/chapter_1_crates/section_3_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let token = env::var("DISCORD_TOKEN")?;
let intents = Intents::GUILD_MESSAGES;
let mut shard = Shard::new(ShardId::ONE, token, intents);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ use twilight_lavalink::Lavalink;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let token = env::var("DISCORD_TOKEN")?;
let lavalink_host = SocketAddr::from_str(&env::var("LAVALINK_HOST")?)?;
let lavalink_auth = env::var("LAVALINK_AUTHORIZATION")?;
Expand Down
3 changes: 3 additions & 0 deletions examples/cache-optimization/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ mod models;
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let event_types = EventTypeFlags::MESSAGE_CREATE
| EventTypeFlags::GUILD_CREATE
| EventTypeFlags::GUILD_UPDATE
Expand Down
3 changes: 3 additions & 0 deletions examples/gateway-queue-http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ impl Queue for HttpQueue {
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let token = env::var("DISCORD_TOKEN")?;
let intents = Intents::GUILDS | Intents::GUILD_VOICE_STATES;

Expand Down
3 changes: 3 additions & 0 deletions examples/gateway-request-members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use twilight_model::{gateway::payload::outgoing::RequestGuildMembers, id::Id};
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let mut shard = Shard::new(
ShardId::ONE,
env::var("DISCORD_TOKEN")?,
Expand Down
3 changes: 3 additions & 0 deletions examples/gateway-reshard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ use twilight_http::Client;
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let token = env::var("DISCORD_TOKEN")?;
let client = Client::new(token.clone());
let config = Config::new(token, Intents::GUILDS);
Expand Down
3 changes: 3 additions & 0 deletions examples/http-allowed-mentions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ async fn main() -> anyhow::Result<()> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

//if we want to set the default for allowed mentions we need to use the builder, keep in mind these calls can't be chained!
let client = Client::builder()
.token(env::var("DISCORD_TOKEN")?)
Expand Down
3 changes: 3 additions & 0 deletions examples/http-get-message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ async fn main() -> anyhow::Result<()> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let client = Client::new(env::var("DISCORD_TOKEN")?);
let channel_id = Id::new(381_926_291_785_383_946);

Expand Down
3 changes: 3 additions & 0 deletions examples/http-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ async fn main() -> anyhow::Result<()> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let client = Client::builder()
.proxy("localhost:3000".to_owned(), true)
.ratelimiter(None)
Expand Down
3 changes: 3 additions & 0 deletions examples/lavalink-basic-bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ async fn main() -> anyhow::Result<()> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let (mut shard, state) = {
let token = env::var("DISCORD_TOKEN")?;
let lavalink_host = SocketAddr::from_str(&env::var("LAVALINK_HOST")?)?;
Expand Down
3 changes: 3 additions & 0 deletions examples/model-webhook-slash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ async fn main() -> anyhow::Result<()> {
// Initialize the tracing subscriber.
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

// Local address to bind the service to.
let addr = SocketAddr::from(([127, 0, 0, 1], 3030));

Expand Down
3 changes: 3 additions & 0 deletions twilight-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ use twilight_model::gateway::payload::{incoming::MessageCreate, outgoing::Update
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt::init();

// Select rustls backend
rustls::crypto::ring::default_provider().install_default().unwrap();

let token = env::var("DISCORD_TOKEN")?;

let (shutdown_tx, shutdown_rx) = watch::channel(false);
Expand Down
Loading