Begin to work on thread support

This commit is contained in:
jude
2024-03-03 11:58:22 +00:00
parent 8e6e1a18b7
commit dcee9e0d2a
3 changed files with 82 additions and 59 deletions

View File

@@ -26,7 +26,7 @@ use crate::{
interval_parser::parse_duration,
models::{
reminder::{
builder::{MultiReminderBuilder, ReminderScope},
builder::{ChannelWithThread, MultiReminderBuilder, ReminderScope},
content::Content,
errors::ReminderError,
},
@@ -406,7 +406,8 @@ pub async fn create_reminder(
let id = i.get(2).unwrap().as_str().parse::<u64>().unwrap();
if pref == "#" {
ReminderScope::Channel(id)
let channel_with_thread = ChannelWithThread { channel_id: id, thread_id: None };
ReminderScope::Channel(channel_with_thread)
} else {
ReminderScope::User(id)
}
@@ -482,7 +483,11 @@ pub async fn create_reminder(
if list.is_empty() {
if ctx.guild_id().is_some() {
vec![ReminderScope::Channel(ctx.channel_id().get())]
let channel_with_threads = ChannelWithThread {
channel_id: ctx.channel_id().get(),
thread_id: None,
};
vec![ReminderScope::Channel(channel_with_threads)]
} else {
vec![ReminderScope::User(ctx.author().id.get())]
}