Update to edition 2024
This commit is contained in:
parent
e9f4381e38
commit
61c9a3165f
5 changed files with 18 additions and 18 deletions
|
@ -1,8 +1,8 @@
|
|||
[package]
|
||||
name = "its-matrix-bot"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.84"
|
||||
edition = "2024"
|
||||
rust-version = "1.85"
|
||||
|
||||
description = "IT-Syndikat matrix bot"
|
||||
repository = "https://git.it-syndikat.org/IT-Syndikat/its-matrix-bot"
|
||||
|
|
16
src/bot.rs
16
src/bot.rs
|
@ -6,14 +6,16 @@ use std::{
|
|||
};
|
||||
|
||||
use color_eyre::{
|
||||
eyre::{bail, eyre, Context},
|
||||
Help, Result,
|
||||
eyre::{Context, bail, eyre},
|
||||
};
|
||||
use matrix_sdk::{
|
||||
Client, RoomState,
|
||||
config::SyncSettings,
|
||||
event_handler::Ctx,
|
||||
room::Room,
|
||||
ruma::{
|
||||
OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId, SecondsSinceUnixEpoch,
|
||||
api::client::receipt::create_receipt::v3::ReceiptType,
|
||||
events::{
|
||||
receipt::ReceiptThread,
|
||||
|
@ -25,23 +27,21 @@ use matrix_sdk::{
|
|||
},
|
||||
},
|
||||
},
|
||||
OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId, SecondsSinceUnixEpoch,
|
||||
},
|
||||
Client, RoomState,
|
||||
};
|
||||
use never_say_never::Never;
|
||||
use reqwest::Url;
|
||||
use serde::Deserialize;
|
||||
use time::{
|
||||
OffsetDateTime, UtcOffset,
|
||||
convert::{Day, Hour, Minute, Second},
|
||||
ext::NumericalDuration,
|
||||
macros::format_description,
|
||||
OffsetDateTime, UtcOffset,
|
||||
};
|
||||
use tokio::time::sleep;
|
||||
use tracing::{event, info, instrument, span, Level};
|
||||
use tracing::{Level, event, info, instrument, span};
|
||||
|
||||
use crate::{its_api::ItsApi, session_path, sqlite_store_path, SessionData};
|
||||
use crate::{SessionData, its_api::ItsApi, session_path, sqlite_store_path};
|
||||
|
||||
const STATE_POLLING_FREQUENCY: Duration = Duration::from_secs(10);
|
||||
|
||||
|
@ -455,9 +455,9 @@ impl Bot {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use time::{macros::datetime, Duration, UtcOffset};
|
||||
use time::{Duration, UtcOffset, macros::datetime};
|
||||
|
||||
use super::{format_isitopen_response, OpenState};
|
||||
use super::{OpenState, format_isitopen_response};
|
||||
|
||||
#[test]
|
||||
fn test_format_isitopen_response() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use reqwest::{Client, Url};
|
||||
use serde::Deserialize;
|
||||
use thiserror::Error;
|
||||
use tracing::{event, instrument, Level};
|
||||
use tracing::{Level, event, instrument};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
|
|
|
@ -12,10 +12,10 @@ use std::path::{Path, PathBuf};
|
|||
|
||||
use bot::{Bot, Config};
|
||||
use clap::Parser as _;
|
||||
use color_eyre::{eyre::Context, Result};
|
||||
use color_eyre::{Result, eyre::Context};
|
||||
use matrix_sdk::authentication::matrix::MatrixSession;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::{event, instrument, Level};
|
||||
use tracing::{Level, event, instrument};
|
||||
use xdg::BaseDirectories;
|
||||
|
||||
mod bot;
|
||||
|
@ -96,7 +96,7 @@ async fn load_config(path: &Path) -> Result<Config> {
|
|||
|
||||
fn install_tracing() {
|
||||
use tracing_subscriber::{
|
||||
prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt, EnvFilter,
|
||||
EnvFilter, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt,
|
||||
};
|
||||
|
||||
let fmt_layer = tracing_subscriber::fmt::layer().with_target(false);
|
||||
|
|
|
@ -2,17 +2,17 @@ use std::io::Write;
|
|||
|
||||
use clap::Args;
|
||||
use color_eyre::{
|
||||
eyre::{bail, eyre, OptionExt},
|
||||
Result,
|
||||
eyre::{OptionExt, bail, eyre},
|
||||
};
|
||||
use futures::StreamExt;
|
||||
use matrix_sdk::{
|
||||
Client,
|
||||
authentication::matrix::MatrixSession,
|
||||
config::SyncSettings,
|
||||
crypto::{format_emojis, SasState},
|
||||
crypto::{SasState, format_emojis},
|
||||
encryption::verification::{Verification, VerificationRequestState},
|
||||
ruma::{events::key::verification::VerificationMethod, UserId},
|
||||
Client,
|
||||
ruma::{UserId, events::key::verification::VerificationMethod},
|
||||
};
|
||||
use tokio::io::{AsyncBufReadExt, BufReader, Lines, Stdin};
|
||||
use tokio_util::task::AbortOnDropHandle;
|
||||
|
|
Loading…
Add table
Reference in a new issue