mirror of
https://github.com/revanced/revanced-discord-bot.git
synced 2025-04-29 22:14:28 +02:00
feat: add option to check for first thread message only
This commit is contained in:
parent
6867816272
commit
cbc336cc63
@ -41,7 +41,8 @@
|
|||||||
},
|
},
|
||||||
"thread_options": {
|
"thread_options": {
|
||||||
"lock_on_response": false,
|
"lock_on_response": false,
|
||||||
"close_on_response": false
|
"close_on_response": false,
|
||||||
|
"only_on_first_message": false
|
||||||
},
|
},
|
||||||
"respond_to_reference": false
|
"respond_to_reference": false
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,8 @@
|
|||||||
"respond_to_reference": true,
|
"respond_to_reference": true,
|
||||||
"thread_options": {
|
"thread_options": {
|
||||||
"close_on_response": true,
|
"close_on_response": true,
|
||||||
"lock_on_response": false
|
"lock_on_response": false,
|
||||||
|
"only_on_first_message": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -93,6 +93,7 @@ pub struct MessageResponse {
|
|||||||
pub struct ThreadOptions {
|
pub struct ThreadOptions {
|
||||||
pub close_on_response: bool,
|
pub close_on_response: bool,
|
||||||
pub lock_on_response: bool,
|
pub lock_on_response: bool,
|
||||||
|
pub only_on_first_message: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
@ -167,11 +167,13 @@ pub async fn handle_message_response(ctx: &serenity::Context, new_message: &sere
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only edit this thread if the message is the first one
|
// only edit this thread if the message is the first one
|
||||||
if !channel_id
|
|
||||||
.messages(&ctx.http, |b| b.limit(1).before(new_message))
|
if thread_options.only_on_first_message
|
||||||
.await
|
&& !channel_id
|
||||||
.unwrap()
|
.messages(&ctx.http, |b| b.limit(1).before(new_message))
|
||||||
.is_empty()
|
.await
|
||||||
|
.unwrap()
|
||||||
|
.is_empty()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user