Make exception for bot owner in NonNewAccountPermission
This commit is contained in:
Generated
+1
-1
@@ -2013,7 +2013,7 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
|
||||
|
||||
[[package]]
|
||||
name = "payphone"
|
||||
version = "4.4.46"
|
||||
version = "4.4.47"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "payphone"
|
||||
version = "4.4.46"
|
||||
version = "4.4.47"
|
||||
edition = "2024"
|
||||
default-run = "payphone"
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
"--redis-urls",
|
||||
"redis://redis-cluster.redis",
|
||||
"--bot-owner-id",
|
||||
"1357199907512914051"
|
||||
"1486270291410817114"
|
||||
]
|
||||
envFrom:
|
||||
- secretRef:
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user