File tree 3 files changed +20
-0
lines changed
3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export const BOT_COMMANDS = {
16
16
channels : "guilds/{guildId}/channels" ,
17
17
member : "guilds/{guildId}/members" ,
18
18
roles : "guilds/{guildId}/roles" ,
19
+ channel : "channels/{channelId}" ,
19
20
// doc: https://discord.com/developers/docs/resources/message#get-channel-messages
20
21
messages : "channels/{channelId}/messages?limit={limit}" ,
21
22
} ;
Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ export interface DiscordGuild {
26
26
approximate_presence_count : number ;
27
27
}
28
28
29
+ export interface DiscordChannelMetadata {
30
+ archived : boolean ;
31
+ create_timestamp ?: string ;
32
+ }
33
+
29
34
export interface DiscordChannel {
30
35
id : string ;
31
36
name : string ;
@@ -47,6 +52,7 @@ export interface DiscordChannel {
47
52
member_count ?: number ;
48
53
message_count ?: number ;
49
54
total_message_sent ?: number ;
55
+ thread_metadata ?: DiscordChannelMetadata ;
50
56
}
51
57
52
58
export interface DiscordRole {
Original file line number Diff line number Diff line change @@ -90,6 +90,19 @@ export function useFetchDiscordChannels(
90
90
) ;
91
91
}
92
92
93
+ export function useDiscordChannel (
94
+ channelId : string | undefined ,
95
+ shouldFetch : boolean = true
96
+ ) {
97
+ const command = BOT_COMMANDS . channel . replace ( "{channelId}" , channelId || "" ) ;
98
+ return useSWR < DiscordChannel , string > (
99
+ shouldFetch && channelId
100
+ ? `${ DISCORD_PROXY_BOT_URL } ?command=${ command } `
101
+ : null ,
102
+ jsonFetcher ( )
103
+ ) ;
104
+ }
105
+
93
106
export function useIsBotMemberOfGuild (
94
107
guildId : string | undefined ,
95
108
shouldFetch : boolean = true
You can’t perform that action at this time.
0 commit comments