chore: clean up use statements
This commit is contained in:
parent
79437deb17
commit
bb8a694b49
|
@ -3,13 +3,17 @@ use twitch_api2::{
|
||||||
types::UserId,
|
types::UserId,
|
||||||
twitch_oauth2::UserToken,
|
twitch_oauth2::UserToken,
|
||||||
};
|
};
|
||||||
use irc::client::prelude::Message;
|
use irc::{
|
||||||
use irc::proto::{Command, Response};
|
client::prelude::Message,
|
||||||
use crate::app::State;
|
proto::{Command, Response},
|
||||||
use crate::app::config::CommandExecutor;
|
};
|
||||||
use crate::app::rhai_tools::ExecutorState;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio_tungstenite::tungstenite::Message as WsMessage;
|
use tokio_tungstenite::tungstenite::Message as WsMessage;
|
||||||
|
use crate::app::{
|
||||||
|
State,
|
||||||
|
config::CommandExecutor,
|
||||||
|
rhai_tools::ExecutorState,
|
||||||
|
};
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Twitch {
|
pub struct Twitch {
|
||||||
pub client: TwitchClient<'static, reqwest::Client>,
|
pub client: TwitchClient<'static, reqwest::Client>,
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
mod template;
|
mod template;
|
||||||
mod route;
|
mod route;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use warp::{
|
||||||
use crate::app::State;
|
Filter, Rejection, Reply,
|
||||||
use warp::{Filter, Rejection, Reply};
|
http::StatusCode,
|
||||||
use std::convert::Infallible;
|
};
|
||||||
use warp::http::StatusCode;
|
|
||||||
use std::borrow::Cow;
|
|
||||||
use self::route::*;
|
use self::route::*;
|
||||||
|
use crate::app::State;
|
||||||
|
use std::{
|
||||||
|
borrow::Cow,
|
||||||
|
convert::Infallible,
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
pub async fn start_web(state: Arc<State>) {
|
pub async fn start_web(state: Arc<State>) {
|
||||||
let cookie_state = Arc::clone(&state);
|
let cookie_state = Arc::clone(&state);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use chrono::Duration;
|
||||||
use warp::{Filter, Reply, filters::BoxedFilter, http::Uri, Rejection};
|
use warp::{Filter, Reply, filters::BoxedFilter, http::Uri, Rejection};
|
||||||
use crate::app::{
|
use crate::app::{
|
||||||
State,
|
State,
|
||||||
|
@ -10,10 +11,9 @@ use crate::app::{
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
|
str::FromStr,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use std::str::FromStr;
|
|
||||||
use chrono::Duration;
|
|
||||||
|
|
||||||
pub fn commands_routes(state: Arc<State>) -> BoxedFilter<(impl Reply, )> {
|
pub fn commands_routes(state: Arc<State>) -> BoxedFilter<(impl Reply, )> {
|
||||||
warp::get()
|
warp::get()
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
use twitch_api2::types::RewardId;
|
use twitch_api2::{
|
||||||
|
helix::points::{GetCustomRewardRequest, CustomReward},
|
||||||
|
types::RewardId,
|
||||||
|
};
|
||||||
use warp::{
|
use warp::{
|
||||||
Filter, Reply,
|
Filter, Reply,
|
||||||
filters::BoxedFilter,
|
filters::BoxedFilter,
|
||||||
|
@ -9,7 +12,7 @@ use crate::app::{
|
||||||
config::Redemption,
|
config::Redemption,
|
||||||
web::{
|
web::{
|
||||||
CustomRejection,
|
CustomRejection,
|
||||||
template::redemptions::{RedemptionsTemplate, AddRedemptionTemplate},
|
template::redemptions::{RedemptionsTemplate, AddRedemptionTemplate, ListRedemptionsTemplate},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -17,8 +20,6 @@ use std::{
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use twitch_api2::helix::points::{GetCustomRewardRequest, CustomReward};
|
|
||||||
use crate::app::web::template::redemptions::ListRedemptionsTemplate;
|
|
||||||
|
|
||||||
pub fn redemptions_routes(state: Arc<State>) -> BoxedFilter<(impl Reply, )> {
|
pub fn redemptions_routes(state: Arc<State>) -> BoxedFilter<(impl Reply, )> {
|
||||||
warp::get()
|
warp::get()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use askama::Template;
|
use askama::Template;
|
||||||
use crate::app::config::Redemption;
|
|
||||||
use twitch_api2::helix::points::CustomReward;
|
use twitch_api2::helix::points::CustomReward;
|
||||||
|
use crate::app::config::Redemption;
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "redemptions.html")]
|
#[template(path = "redemptions.html")]
|
||||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -1,19 +1,22 @@
|
||||||
#![feature(try_blocks)]
|
#![feature(try_blocks, drain_filter)]
|
||||||
#![feature(drain_filter)]
|
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
|
|
||||||
use tokio::runtime::{Builder, Handle};
|
use futures::FutureExt;
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
use tokio::{
|
||||||
|
fs::OpenOptions,
|
||||||
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
|
runtime::{Builder, Handle},
|
||||||
|
};
|
||||||
use crate::app::{
|
use crate::app::{
|
||||||
State,
|
State,
|
||||||
config::Config,
|
config::Config,
|
||||||
user_config::UserConfig,
|
user_config::UserConfig,
|
||||||
};
|
};
|
||||||
use std::path::Path;
|
use std::{
|
||||||
use tokio::fs::OpenOptions;
|
path::Path,
|
||||||
use futures::FutureExt;
|
sync::Arc,
|
||||||
use std::sync::Arc;
|
};
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
let runtime = Builder::new_multi_thread()
|
let runtime = Builder::new_multi_thread()
|
||||||
|
|
Loading…
Reference in New Issue