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