Make exception for bot owner in NonNewAccountPermission

This commit is contained in:
2026-04-03 05:57:35 -03:00
parent b0a6950005
commit c9b81219e5
4 changed files with 6 additions and 7 deletions
Generated
+1 -1
View File
@@ -2013,7 +2013,7 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]]
name = "payphone"
version = "4.4.46"
version = "4.4.47"
dependencies = [
"anyhow",
"async-trait",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "payphone"
version = "4.4.46"
version = "4.4.47"
edition = "2024"
default-run = "payphone"
+1 -1
View File
@@ -101,7 +101,7 @@
"--redis-urls",
"redis://redis-cluster.redis",
"--bot-owner-id",
"1357199907512914051"
"1486270291410817114"
]
envFrom:
- secretRef:
+3 -4
View File
@@ -50,10 +50,9 @@ pub struct NonNewAccountPermission;
#[async_trait]
impl Permission<State, Extras> for NonNewAccountPermission {
async fn check(&self, ctx: &CommandContext<State, Extras>) -> Result<bool, CommandError> {
Ok(
UtcDateTime::from_unix_timestamp(ctx.event.author.id.timestamp() / 1000).unwrap()
< UtcDateTime::now() - Duration::days(30),
)
Ok(ctx.event.author.id.get() == ctx.rt.state.bot_owner_id
|| UtcDateTime::from_unix_timestamp(ctx.event.author.id.timestamp() / 1000).unwrap()
< UtcDateTime::now() - Duration::days(30))
}
async fn on_handle_denied(