Make exception for bot owner in NonNewAccountPermission
This commit is contained in:
Generated
+1
-1
@@ -2013,7 +2013,7 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "payphone"
|
name = "payphone"
|
||||||
version = "4.4.46"
|
version = "4.4.47"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "payphone"
|
name = "payphone"
|
||||||
version = "4.4.46"
|
version = "4.4.47"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
default-run = "payphone"
|
default-run = "payphone"
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
"--redis-urls",
|
"--redis-urls",
|
||||||
"redis://redis-cluster.redis",
|
"redis://redis-cluster.redis",
|
||||||
"--bot-owner-id",
|
"--bot-owner-id",
|
||||||
"1357199907512914051"
|
"1486270291410817114"
|
||||||
]
|
]
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
|
|||||||
@@ -50,10 +50,9 @@ pub struct NonNewAccountPermission;
|
|||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Permission<State, Extras> for NonNewAccountPermission {
|
impl Permission<State, Extras> for NonNewAccountPermission {
|
||||||
async fn check(&self, ctx: &CommandContext<State, Extras>) -> Result<bool, CommandError> {
|
async fn check(&self, ctx: &CommandContext<State, Extras>) -> Result<bool, CommandError> {
|
||||||
Ok(
|
Ok(ctx.event.author.id.get() == ctx.rt.state.bot_owner_id
|
||||||
UtcDateTime::from_unix_timestamp(ctx.event.author.id.timestamp() / 1000).unwrap()
|
|| UtcDateTime::from_unix_timestamp(ctx.event.author.id.timestamp() / 1000).unwrap()
|
||||||
< UtcDateTime::now() - Duration::days(30),
|
< UtcDateTime::now() - Duration::days(30))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn on_handle_denied(
|
async fn on_handle_denied(
|
||||||
|
|||||||
Reference in New Issue
Block a user