mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 00:08:54 +00:00
Massive dependencies bump
This commit is contained in:
parent
dd1867e222
commit
8632f0e99c
24 changed files with 744 additions and 841 deletions
1380
Cargo.lock
generated
1380
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
8
flake.lock
generated
8
flake.lock
generated
|
@ -37,16 +37,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1638239011,
|
||||
"narHash": "sha256-AjhmbT4UBlJWqxY0ea8a6GU2C2HdKUREkG43oRr3TZg=",
|
||||
"lastModified": 1654936503,
|
||||
"narHash": "sha256-soKzdhI4jTHv/rSbh89RdlcJmrPgH8oMb/PLqiqIYVQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31",
|
||||
"rev": "dab6df51387c3878cdea09f43589a15729cae9f4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "21.11",
|
||||
"ref": "nixos-22.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
description = "A discord bot for Dự Tuyển Tổng Hợp server";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/21.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
naersk.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
name = "youmubot-cf"
|
||||
version = "0.1.0"
|
||||
authors = ["Natsu Kagami <natsukagami@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
tokio = { version = "1", features = ["time"] }
|
||||
reqwest = "0.11"
|
||||
serenity = "0.10"
|
||||
Inflector = "0.11"
|
||||
codeforces = "0.3"
|
||||
regex = "1"
|
||||
lazy_static = "1"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
dashmap = "4"
|
||||
serde = { version = "1.0.137", features = ["derive"] }
|
||||
tokio = { version = "1.19.2", features = ["time"] }
|
||||
reqwest = "0.11.10"
|
||||
serenity = "0.11.2"
|
||||
Inflector = "0.11.4"
|
||||
codeforces = "0.3.1"
|
||||
regex = "1.5.6"
|
||||
lazy_static = "1.4.0"
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
dashmap = "5.3.4"
|
||||
|
||||
youmubot-prelude = { path = "../youmubot-prelude" }
|
||||
youmubot-db = { path = "../youmubot-db" }
|
||||
|
|
|
@ -56,7 +56,7 @@ impl youmubot_prelude::Announcer for Announcer {
|
|||
"Codeforces: Removing user {} - {}: failures count too high",
|
||||
key, user.handle,
|
||||
);
|
||||
db.remove(&key);
|
||||
// db.remove(&key);
|
||||
} else {
|
||||
db.insert(key, user);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ pub fn user_embed<'a>(user: &User, e: &'a mut CreateEmbed) -> &'a mut CreateEmbe
|
|||
.join(", ");
|
||||
e.color(user.color())
|
||||
.author(|a| a.name(&rank))
|
||||
.thumbnail(format!("https:{}", user.title_photo))
|
||||
.thumbnail(format!("{}", user.title_photo))
|
||||
.title(&user.handle)
|
||||
.url(user.profile_url())
|
||||
.description(format!(
|
||||
|
@ -90,7 +90,7 @@ pub fn rating_change_embed<'a>(
|
|||
};
|
||||
|
||||
e.author(|a| {
|
||||
a.icon_url(format!("http:{}", &user.avatar))
|
||||
a.icon_url(format!("{}", &user.avatar))
|
||||
.url(user.profile_url())
|
||||
.name(&user.handle)
|
||||
})
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
name = "youmubot-core"
|
||||
version = "0.1.0"
|
||||
authors = ["Natsu Kagami <natsukagami@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
serenity = { version = "0.10", features = ["collector"] }
|
||||
rand = "0.7"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
chrono = "0.4"
|
||||
static_assertions = "1.1"
|
||||
futures-util = "0.3"
|
||||
tokio = { version = "1", features = ["time"] }
|
||||
flume = "0.10"
|
||||
dashmap = "4"
|
||||
serenity = { version = "0.11.2", features = ["collector"] }
|
||||
rand = "0.8.5"
|
||||
serde = { version = "1.0.137", features = ["derive"] }
|
||||
chrono = "0.4.19"
|
||||
static_assertions = "1.1.0"
|
||||
futures-util = "0.3.21"
|
||||
tokio = { version = "1.19.2", features = ["time"] }
|
||||
flume = "0.10.13"
|
||||
dashmap = "5.3.4"
|
||||
|
||||
youmubot-db = { path = "../youmubot-db" }
|
||||
youmubot-prelude = { path = "../youmubot-prelude" }
|
||||
|
|
|
@ -36,7 +36,7 @@ async fn clean(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||
let channel = msg.channel_id.to_channel(&ctx).await?;
|
||||
match &channel {
|
||||
Channel::Private(_) => {
|
||||
let self_id = ctx.http.get_current_application_info().await?.id;
|
||||
let self_id = ctx.http.get_current_user().await?.id;
|
||||
messages
|
||||
.into_iter()
|
||||
.filter(|v| v.author.id == self_id)
|
||||
|
|
|
@ -85,7 +85,7 @@ pub async fn soft_ban(ctx: &Context, msg: &Message, mut args: Args) -> CommandRe
|
|||
pub async fn soft_ban_init(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
||||
let role_id = args.single::<RoleId>()?;
|
||||
let data = ctx.data.read().await;
|
||||
let guild = msg.guild(&ctx).await.unwrap();
|
||||
let guild = msg.guild(&ctx).unwrap();
|
||||
// Check whether the role_id is the one we wanted
|
||||
if !guild.roles.contains_key(&role_id) {
|
||||
return Err(Error::msg(format!("{} is not a role in this server.", role_id)).into());
|
||||
|
|
|
@ -62,7 +62,7 @@ pub async fn choose(ctx: &Context, m: &Message, mut args: Args) -> CommandResult
|
|||
let online_only = !flags.contains("everyone");
|
||||
|
||||
let users: Result<Vec<_>, Error> = {
|
||||
let guild = m.guild(&ctx).await.unwrap();
|
||||
let guild = m.guild(&ctx).unwrap();
|
||||
let presences = &guild.presences;
|
||||
let channel = m.channel_id.to_channel(&ctx).await?;
|
||||
if let Channel::Guild(channel) = channel {
|
||||
|
|
|
@ -85,7 +85,7 @@ pub async fn vote(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult
|
|||
let channel = msg.channel_id;
|
||||
let author = msg.author.clone();
|
||||
let asked = msg.timestamp;
|
||||
let until = asked + (chrono::Duration::from_std(*duration).unwrap());
|
||||
let until = *asked + (chrono::Duration::from_std(*duration).unwrap());
|
||||
let panel = channel.send_message(&ctx, |c| {
|
||||
c.content("@here").embed(|e| {
|
||||
e.author(|au| {
|
||||
|
@ -119,7 +119,7 @@ pub async fn vote(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult
|
|||
.await_reactions(&ctx)
|
||||
.removed(true)
|
||||
.timeout(*duration)
|
||||
.await
|
||||
.build()
|
||||
.fold(user_reactions, |mut set, reaction| async move {
|
||||
let (reaction, is_add) = match &*reaction {
|
||||
ReactionAction::Added(r) => (r, true),
|
||||
|
|
|
@ -172,7 +172,7 @@ async fn name(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||
};
|
||||
|
||||
// Rule out a couple of cases
|
||||
if user_id == ctx.http.get_current_application_info().await?.id {
|
||||
if user_id == ctx.http.get_current_user().await?.id {
|
||||
// This is my own user_id
|
||||
msg.reply(&ctx, "😠 My name is **Youmu Konpaku**!").await?;
|
||||
return Ok(());
|
||||
|
|
|
@ -51,6 +51,6 @@ pub async fn help(
|
|||
groups: &[&'static CommandGroup],
|
||||
owners: HashSet<UserId>,
|
||||
) -> CommandResult {
|
||||
help_commands::with_embeds(context, msg, args, help_options, groups, owners).await;
|
||||
help_commands::with_embeds(context, msg, args, help_options, groups, owners).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
name = "youmubot-db-sql"
|
||||
version = "0.1.0"
|
||||
authors = ["Natsu Kagami <nki@nkagami.me>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
sqlx = { version = "0.5", features = ["runtime-tokio-rustls", "sqlite", "chrono", "offline"] }
|
||||
thiserror = "1"
|
||||
chrono = "0.4"
|
||||
futures-util = "0.3"
|
||||
either = "1"
|
||||
sqlx = { version = "0.5.13", features = ["runtime-tokio-rustls", "sqlite", "chrono", "offline"] }
|
||||
thiserror = "1.0.31"
|
||||
chrono = "0.4.19"
|
||||
futures-util = "0.3.21"
|
||||
either = "1.6.1"
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
name = "youmubot-db"
|
||||
version = "0.1.0"
|
||||
authors = ["Natsu Kagami <natsukagami@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
serenity = "0.10"
|
||||
dotenv = "0.15"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
chrono = "0.4.9"
|
||||
serenity = "0.11.2"
|
||||
dotenv = "0.15.0"
|
||||
serde = { version = "1.0.137", features = ["derive"] }
|
||||
chrono = "0.4.19"
|
||||
|
||||
[dependencies.rustbreak]
|
||||
version = "2.0.0"
|
||||
|
|
|
@ -2,22 +2,22 @@
|
|||
name = "youmubot-osu"
|
||||
version = "0.1.0"
|
||||
authors = ["Natsu Kagami <natsukagami@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bincode = "1"
|
||||
bitflags = "1"
|
||||
chrono = "0.4"
|
||||
dashmap = "4"
|
||||
lazy_static = "1"
|
||||
bincode = "1.3.3"
|
||||
bitflags = "1.3.2"
|
||||
chrono = "0.4.19"
|
||||
dashmap = "5.3.4"
|
||||
lazy_static = "1.4.0"
|
||||
osuparse = { git = "https://github.com/eltrufas/osuparse", rev = "ad8f6e5e7771e7cbaa2ec96c376558f9731139af" }
|
||||
regex = "1"
|
||||
reqwest = "0.11"
|
||||
rosu-pp = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serenity = "0.10"
|
||||
regex = "1.5.6"
|
||||
reqwest = "0.11.10"
|
||||
rosu-pp = "0.5.1"
|
||||
serde = { version = "1.0.137", features = ["derive"] }
|
||||
serenity = "0.11.2"
|
||||
zip = "0.6.2"
|
||||
|
||||
youmubot-db = { path = "../youmubot-db" }
|
||||
|
@ -25,4 +25,4 @@ youmubot-db-sql = { path = "../youmubot-db-sql" }
|
|||
youmubot-prelude = { path = "../youmubot-prelude" }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1"
|
||||
serde_json = "1.0.81"
|
||||
|
|
|
@ -64,16 +64,14 @@ impl youmubot_prelude::Announcer for Announcer {
|
|||
if channels.is_empty() {
|
||||
return; // We don't wanna update an user without any active server
|
||||
}
|
||||
match std::array::IntoIter::new([
|
||||
Mode::Std,
|
||||
Mode::Taiko,
|
||||
Mode::Catch,
|
||||
Mode::Mania,
|
||||
])
|
||||
.map(|m| s.handle_user_mode(&ctx, now, &osu_user, user_id, channels.clone(), m))
|
||||
.collect::<stream::FuturesOrdered<_>>()
|
||||
.try_collect::<Vec<_>>()
|
||||
.await
|
||||
match [Mode::Std, Mode::Taiko, Mode::Catch, Mode::Mania]
|
||||
.into_iter()
|
||||
.map(|m| {
|
||||
s.handle_user_mode(&ctx, now, &osu_user, user_id, channels.clone(), m)
|
||||
})
|
||||
.collect::<stream::FuturesOrdered<_>>()
|
||||
.try_collect::<Vec<_>>()
|
||||
.await
|
||||
{
|
||||
Ok(v) => {
|
||||
osu_user.last_update = now;
|
||||
|
|
|
@ -73,7 +73,7 @@ impl BeatmapMetaCache {
|
|||
|
||||
/// Get a beatmap without a mode...
|
||||
pub async fn get_beatmap_default(&self, id: u64) -> Result<Beatmap> {
|
||||
for mode in std::array::IntoIter::new([Mode::Std, Mode::Taiko, Mode::Catch, Mode::Mania]) {
|
||||
for mode in [Mode::Std, Mode::Taiko, Mode::Catch, Mode::Mania].into_iter() {
|
||||
if let Ok(Some(bm)) = self.get_beatmap_db(id, mode).await {
|
||||
if bm.mode == mode {
|
||||
return Ok(bm);
|
||||
|
|
|
@ -76,7 +76,7 @@ impl BeatmapContent {
|
|||
|
||||
/// Get info given mods.
|
||||
pub fn get_info_with(&self, mods: Mods) -> Result<BeatmapInfo> {
|
||||
let stars = self.content.stars(mods.bits() as u32, None);
|
||||
let stars = self.content.stars().mods(mods.bits() as u32).calculate();
|
||||
Ok(BeatmapInfo {
|
||||
max_combo: stars.max_combo().unwrap_or(0),
|
||||
objects: self.content.hit_objects.len(),
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
name = "youmubot-prelude"
|
||||
version = "0.1.0"
|
||||
authors = ["Natsu Kagami <natsukagami@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
async-trait = "0.1"
|
||||
futures-util = "0.3"
|
||||
tokio = { version = "1", features = ["time"] }
|
||||
anyhow = "1.0.57"
|
||||
async-trait = "0.1.56"
|
||||
futures-util = "0.3.21"
|
||||
tokio = { version = "1.19.2", features = ["time"] }
|
||||
youmubot-db = { path = "../youmubot-db" }
|
||||
youmubot-db-sql = { path = "../youmubot-db-sql" }
|
||||
reqwest = "0.11"
|
||||
chrono = "0.4"
|
||||
flume = "0.10"
|
||||
dashmap = "4"
|
||||
reqwest = "0.11.10"
|
||||
chrono = "0.4.19"
|
||||
flume = "0.10.13"
|
||||
dashmap = "5.3.4"
|
||||
|
||||
[dependencies.serenity]
|
||||
version = "0.10"
|
||||
version = "0.11.2"
|
||||
default-features = true
|
||||
features = ["collector"]
|
||||
|
|
|
@ -241,7 +241,7 @@ pub async fn register_announcer(ctx: &Context, m: &Message, mut args: Args) -> C
|
|||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
let guild = m.guild(&ctx).await.expect("Guild-only command");
|
||||
let guild = m.guild(&ctx).expect("Guild-only command");
|
||||
let channel = m.channel_id.to_channel(&ctx).await?;
|
||||
AnnouncerChannels::open(&*data)
|
||||
.borrow_mut()?
|
||||
|
@ -284,7 +284,7 @@ pub async fn remove_announcer(ctx: &Context, m: &Message, mut args: Args) -> Com
|
|||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
let guild = m.guild(&ctx).await.expect("Guild-only command");
|
||||
let guild = m.guild(&ctx).expect("Guild-only command");
|
||||
AnnouncerChannels::open(&*data)
|
||||
.borrow_mut()?
|
||||
.entry(key.clone())
|
||||
|
|
|
@ -127,7 +127,7 @@ async fn paginate_with_first_message(
|
|||
.await?;
|
||||
}
|
||||
// Build a reaction collector
|
||||
let mut reaction_collector = message.await_reactions(&ctx).removed(true).await;
|
||||
let mut reaction_collector = message.await_reactions(&ctx).removed(true).build();
|
||||
let mut page = 0;
|
||||
|
||||
// Loop the handler function.
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
name = "youmubot"
|
||||
version = "0.1.0"
|
||||
authors = ["Natsu Kagami <natsukagami@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[features]
|
||||
default = ["core", "osu"] # codeforces disabled for now
|
||||
default = ["core", "codeforces", "osu"]
|
||||
core = []
|
||||
osu = ["youmubot-osu"]
|
||||
codeforces = ["youmubot-cf"]
|
||||
|
||||
[dependencies]
|
||||
serenity = "0.10"
|
||||
tokio = { version = "1", features = ["rt-multi-thread"] }
|
||||
dotenv = "0.15"
|
||||
env_logger = "0.7"
|
||||
serenity = "0.11.2"
|
||||
tokio = { version = "1.19.2", features = ["rt-multi-thread"] }
|
||||
dotenv = "0.15.0"
|
||||
env_logger = "0.9.0"
|
||||
youmubot-db = { path = "../youmubot-db" }
|
||||
youmubot-prelude = { path = "../youmubot-prelude" }
|
||||
youmubot-core = { path = "../youmubot-core" }
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use dotenv::var;
|
||||
use serenity::{
|
||||
client::bridge::gateway::GatewayIntents,
|
||||
framework::standard::{macros::hook, CommandResult, DispatchError, StandardFramework},
|
||||
model::{
|
||||
channel::{Channel, Message},
|
||||
|
@ -63,7 +62,6 @@ async fn is_not_channel_mod(ctx: &Context, msg: &Message) -> bool {
|
|||
match msg.channel_id.to_channel(&ctx).await {
|
||||
Ok(Channel::Guild(gc)) => gc
|
||||
.permissions_for_user(&ctx, msg.author.id)
|
||||
.await
|
||||
.map(|perms| !perms.contains(Permissions::MANAGE_MESSAGES))
|
||||
.unwrap_or(true),
|
||||
_ => true,
|
||||
|
@ -95,19 +93,18 @@ async fn main() {
|
|||
// Sets up a client
|
||||
let mut client = {
|
||||
// Attempt to connect and set up a framework
|
||||
Client::builder(token)
|
||||
let intents = GatewayIntents::GUILDS
|
||||
| GatewayIntents::GUILD_BANS
|
||||
| GatewayIntents::MESSAGE_CONTENT
|
||||
| GatewayIntents::GUILD_MESSAGES
|
||||
| GatewayIntents::GUILD_MESSAGE_REACTIONS
|
||||
| GatewayIntents::GUILD_PRESENCES
|
||||
| GatewayIntents::GUILD_MEMBERS
|
||||
| GatewayIntents::DIRECT_MESSAGES
|
||||
| GatewayIntents::DIRECT_MESSAGE_REACTIONS;
|
||||
Client::builder(token, intents)
|
||||
.framework(fw)
|
||||
.event_handler(handler)
|
||||
.intents(
|
||||
GatewayIntents::GUILDS
|
||||
| GatewayIntents::GUILD_BANS
|
||||
| GatewayIntents::GUILD_MESSAGES
|
||||
| GatewayIntents::GUILD_MESSAGE_REACTIONS
|
||||
| GatewayIntents::GUILD_PRESENCES
|
||||
| GatewayIntents::GUILD_MEMBERS
|
||||
| GatewayIntents::DIRECT_MESSAGES
|
||||
| GatewayIntents::DIRECT_MESSAGE_REACTIONS,
|
||||
)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
@ -163,7 +160,7 @@ async fn main() {
|
|||
|
||||
// Sets up a framework for a client
|
||||
async fn setup_framework(token: &str) -> StandardFramework {
|
||||
let http = serenity::http::Http::new_with_token(token);
|
||||
let http = serenity::http::Http::new(token);
|
||||
// Collect owners
|
||||
let owner = http
|
||||
.get_current_application_info()
|
||||
|
@ -240,7 +237,7 @@ async fn after_hook(ctx: &Context, msg: &Message, command_name: &str, error: Com
|
|||
}
|
||||
|
||||
#[hook]
|
||||
async fn on_dispatch_error(ctx: &Context, msg: &Message, error: DispatchError) {
|
||||
async fn on_dispatch_error(ctx: &Context, msg: &Message, error: DispatchError, _cmd_name: &str) {
|
||||
msg.reply(
|
||||
&ctx,
|
||||
&match error {
|
||||
|
|
Loading…
Add table
Reference in a new issue