feat(moderation): enhance message capture and storage with thread support
- Added functions to retrieve message location, sticker metadata, and display content in messageCapture.ts. - Updated captureMessage function to store thread information and sticker metadata in the database. - Modified messageStore.ts to support querying messages and attachments by thread ID. - Updated types.ts to include thread_id in AttachmentRecord. - Altered database schema in muxer-queue.ts to add thread_id column to attachments. - Introduced ChannelSummary interface and listWatchableChannels method in voiceController.ts to fetch watchable channels. - Added API endpoint in webserver.ts to retrieve channels for a given guild.
This commit is contained in:
@@ -25,6 +25,12 @@ export interface VoiceChannelSummary {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ChannelSummary {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export class VoiceController {
|
||||
private activeGuildId: string | null = null;
|
||||
private activeChannelId: string | null = null;
|
||||
@@ -63,6 +69,27 @@ export class VoiceController {
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
async listWatchableChannels(guildId: string): Promise<ChannelSummary[]> {
|
||||
const guild = this.getGuild(guildId);
|
||||
await guild.channels.fetch().catch(() => null);
|
||||
|
||||
return guild.channels.cache
|
||||
.filter((channel) =>
|
||||
["GUILD_TEXT", "GUILD_PUBLIC_THREAD", "GUILD_PRIVATE_THREAD"].includes(
|
||||
channel.type,
|
||||
),
|
||||
)
|
||||
.map((channel) => {
|
||||
const parentName = channel.isThread?.() ? channel.parent?.name : null;
|
||||
return {
|
||||
id: channel.id,
|
||||
name: parentName ? `${parentName} / ${channel.name}` : channel.name,
|
||||
type: channel.type,
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
async connect(guildId: string, channelId: string): Promise<VoiceStatus> {
|
||||
if (!this.client.isReady()) {
|
||||
throw new AppError(
|
||||
|
||||
Reference in New Issue
Block a user