File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,13 @@ TWITCH_CLIENT_SECRET='YOUR_TWITCH_CLIENT_SECRET'
1717CONFIG_UPDATE_INTERVAL_YOUTUBE = ' 10'
1818CONFIG_UPDATE_INTERVAL_TWITCH = ' 2'
1919CONFIG_DISCORD_LOGS_CHANNEL = ' YOUR_DISCORD_LOGS_CHANNEL'
20- CONFIG_DISCORD_WAIT_FOR_GUILD_CACHE_TIME = ' YOUR_TIME_IN_SECONDS'
20+
21+ # # The following values are recommened to be at the default values.
22+ # # If you want to change them, please make sure you know what you are doing.
23+ # # Times are in seconds.
24+ CONFIG_DISCORD_WAIT_FOR_GUILD_CACHE_TIME = ' 10'
25+ CONFIG_DISCORD_COLLECTOR_TIMEOUT = ' 60'
26+ CONFIG_DISCORD_COMPONENTS_PAGE_SIZE = ' 10' # The number of channels to display per page in the components (ex. https://github.com/GalvinPython/feedr/pull/154)
2127
2228# Postgres URLs
2329POSTGRES_URL = ' postgresql://user:password@server:port/database'
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ import {
4545 addNewStreamerToTrack ,
4646 checkIfStreamerIsAlreadyTracked ,
4747} from "./db/twitch" ;
48+ import { config } from "./config" ;
4849
4950import client from "." ;
5051
@@ -975,7 +976,7 @@ const commands: Record<string, Command> = {
975976 let currentPage = 0 ;
976977 let currentFilter : FilterType = "all" ;
977978
978- const pageSize = 10 ;
979+ const pageSize = config . discordComponentsPageSize ;
979980
980981 const filterEntries = ( filter : FilterType ) => {
981982 if ( filter === Platform . YouTube )
@@ -1090,7 +1091,7 @@ const commands: Record<string, Command> = {
10901091
10911092 const collector = message . createMessageComponentCollector ( {
10921093 componentType : ComponentType . Button ,
1093- time : 60_000 ,
1094+ time : config . discordCollectorTimeout ,
10941095 filter : ( i ) => i . user . id === interaction . user . id ,
10951096 } ) ;
10961097
@@ -1160,8 +1161,8 @@ const commands: Record<string, Command> = {
11601161 await interaction . editReply ( {
11611162 components : [ ] ,
11621163 } ) ;
1163- } catch {
1164- console . error ( "Failed to edit reply" ) ;
1164+ } catch ( err ) {
1165+ console . error ( "Failed to edit reply:" , err ) ;
11651166 }
11661167 } ) ;
11671168 } ,
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ export interface Config {
55 updateIntervalTwitch : number ;
66 databaseUrl : string | undefined ;
77 discordWaitForGuildCacheTime : number ;
8+ discordCollectorTimeout : number ;
9+ discordComponentsPageSize : number ;
810}
911
1012export const config : Config = {
@@ -21,6 +23,12 @@ export const config: Config = {
2123 ?. CONFIG_DISCORD_WAIT_FOR_GUILD_CACHE_TIME
2224 ? parseInt ( process . env ?. CONFIG_DISCORD_WAIT_FOR_GUILD_CACHE_TIME ) * 1000
2325 : 10_000 ,
26+ discordCollectorTimeout : process . env ?. CONFIG_DISCORD_COLLECTOR_TIMEOUT
27+ ? parseInt ( process . env ?. CONFIG_DISCORD_COLLECTOR_TIMEOUT ) * 1000
28+ : 60_000 ,
29+ discordComponentsPageSize : process . env ?. CONFIG_DISCORD_COMPONENTS_PAGE_SIZE
30+ ? parseInt ( process . env ?. CONFIG_DISCORD_COMPONENTS_PAGE_SIZE )
31+ : 10 ,
2432} ;
2533
2634interface Env {
You can’t perform that action at this time.
0 commit comments