Skip to content

Commit 9439c23

Browse files
/tracking add: List filtered channels in initial thread message
1 parent b21fe1a commit 9439c23

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Commands/TrackingCmds.cs

+14-2
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,25 @@ public async Task TrackingAddSlashCmd(SlashCommandContext ctx, [Parameter("membe
9898
}
9999

100100
await Program.db.SetAddAsync("trackedUsers", discordUser.Id);
101+
102+
string response = $"{Program.cfgjson.Emoji.On} Now tracking {discordUser.Mention} in this thread! :eyes:";
103+
if (filterChannels.Count > 0)
104+
{
105+
string channelList = "";
106+
foreach (var channel in filterChannels)
107+
{
108+
channelList += $"<#{channel}>, ";
109+
}
110+
channelList = channelList.Trim(',', ' ');
111+
response += $"\nTracking in: {channelList}";
112+
}
101113

102114
if (Program.db.HashExists("trackingThreads", discordUser.Id))
103115
{
104116
var channelId = Program.db.HashGet("trackingThreads", discordUser.Id);
105117
DiscordThreadChannel thread = (DiscordThreadChannel)await ctx.Client.GetChannelAsync((ulong)channelId);
106118

107-
await thread.SendMessageAsync($"{Program.cfgjson.Emoji.On} Now tracking {discordUser.Mention} in this thread! :eyes:");
119+
await thread.SendMessageAsync(response);
108120
thread.AddThreadMemberAsync(ctx.Member);
109121
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent($"{Program.cfgjson.Emoji.On} Now tracking {discordUser.Mention} in {thread.Mention}!"));
110122

@@ -113,7 +125,7 @@ public async Task TrackingAddSlashCmd(SlashCommandContext ctx, [Parameter("membe
113125
{
114126
var thread = await LogChannelHelper.ChannelCache["investigations"].CreateThreadAsync(DiscordHelpers.UniqueUsername(discordUser), DiscordAutoArchiveDuration.Week, DiscordChannelType.PublicThread);
115127
await Program.db.HashSetAsync("trackingThreads", discordUser.Id, thread.Id);
116-
await thread.SendMessageAsync($"{Program.cfgjson.Emoji.On} Now tracking {discordUser.Mention} in this thread! :eyes:");
128+
await thread.SendMessageAsync(response);
117129
await thread.AddThreadMemberAsync(ctx.Member);
118130
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent($"{Program.cfgjson.Emoji.On} Now tracking {discordUser.Mention} in {thread.Mention}!"));
119131
}

0 commit comments

Comments
 (0)