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": {
|
||||
"lock_on_response": false,
|
||||
"close_on_response": false
|
||||
"close_on_response": false,
|
||||
"only_on_first_message": false
|
||||
},
|
||||
"respond_to_reference": false
|
||||
}
|
||||
|
@ -352,7 +352,8 @@
|
||||
"respond_to_reference": true,
|
||||
"thread_options": {
|
||||
"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 close_on_response: bool,
|
||||
pub lock_on_response: bool,
|
||||
pub only_on_first_message: bool,
|
||||
}
|
||||
|
||||
#[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
|
||||
if !channel_id
|
||||
.messages(&ctx.http, |b| b.limit(1).before(new_message))
|
||||
.await
|
||||
.unwrap()
|
||||
.is_empty()
|
||||
|
||||
if thread_options.only_on_first_message
|
||||
&& !channel_id
|
||||
.messages(&ctx.http, |b| b.limit(1).before(new_message))
|
||||
.await
|
||||
.unwrap()
|
||||
.is_empty()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user