Support sending reminders to threads
This commit is contained in:
@ -13,7 +13,7 @@ use chrono_tz::Tz;
|
||||
use poise::{
|
||||
serenity_prelude::{
|
||||
model::id::{ChannelId, GuildId, UserId},
|
||||
ButtonStyle, Cache, CreateActionRow, CreateButton, CreateEmbed, ReactionType,
|
||||
ButtonStyle, Cache, ChannelType, CreateActionRow, CreateButton, CreateEmbed, ReactionType,
|
||||
},
|
||||
CreateReply,
|
||||
};
|
||||
@ -482,12 +482,23 @@ pub async fn create_reminder(
|
||||
let list = channels.map(|arg| parse_mention_list(&arg)).unwrap_or_default();
|
||||
|
||||
if list.is_empty() {
|
||||
if ctx.guild_id().is_some() {
|
||||
let channel_with_threads = ChannelWithThread {
|
||||
channel_id: ctx.channel_id().get(),
|
||||
thread_id: None,
|
||||
};
|
||||
vec![ReminderScope::Channel(channel_with_threads)]
|
||||
if let Some(channel) = ctx.guild_channel().await {
|
||||
if channel.kind == ChannelType::PublicThread
|
||||
|| channel.kind == ChannelType::PrivateThread
|
||||
{
|
||||
let parent = channel.parent_id.unwrap();
|
||||
let channel_with_threads = ChannelWithThread {
|
||||
channel_id: parent.get(),
|
||||
thread_id: Some(ctx.channel_id().get()),
|
||||
};
|
||||
vec![ReminderScope::Channel(channel_with_threads)]
|
||||
} else {
|
||||
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())]
|
||||
}
|
||||
|
Reference in New Issue
Block a user