@@ -69,9 +69,10 @@ def on_creds(msg)
69
69
save_credentials
70
70
end
71
71
72
- def list_ctfs ( ctfs , target )
72
+ def list_ctfs ( ctfs , target , limit = nil )
73
73
msg = ''
74
- ctfs . each do |ctf |
74
+ amount = limit . nil? ? ctfs . size : limit
75
+ ctfs . take ( amount ) . each do |ctf |
75
76
msg << CTF . format ( ctf , mark_hs : config [ :mark_highschool ] )
76
77
if @credentials . has_key? ( ctf . title )
77
78
creds = @credentials [ ctf . title ] . reject ( &:nil? ) . map { |x | "'#{ x } '" } . join ( ':' )
@@ -80,13 +81,16 @@ def list_ctfs(ctfs, target)
80
81
msg << "\n "
81
82
end
82
83
target . notice ( msg )
84
+ if amount != ctfs . size
85
+ target . notice ( "and #{ ctfs . size - amount } more. To see all request over PM." )
86
+ end
83
87
end
84
88
85
89
def list_current_ctfs ( target , notify_empty = true )
86
90
current_ctfs = @fetcher . current_ctfs
87
91
if !current_ctfs . empty?
88
92
target . notice ( "Current CTF's:\n " )
89
- list_ctfs ( current_ctfs , msg )
93
+ list_ctfs ( current_ctfs , msg , target . is_a? ( Cinch :: Channel ) ? CONFIG [ :event_limit ] : nil )
90
94
else
91
95
return unless notify_empty
92
96
target . notice ( "There are no current CTF's\n " )
@@ -97,7 +101,7 @@ def list_upcoming_ctfs(target, notify_empty=true)
97
101
upcoming_ctfs = @fetcher . upcoming_ctfs
98
102
if !upcoming_ctfs . empty?
99
103
target . notice ( "Upcoming CTF's in the next #{ config [ :lookahead ] } :\n " )
100
- list_ctfs ( upcoming_ctfs , target )
104
+ list_ctfs ( upcoming_ctfs , target , target . is_a? ( Cinch :: Channel ) ? CONFIG [ :event_limit ] : nil )
101
105
else
102
106
return unless notify_empty
103
107
target . notice ( "There are no upcoming CTF's in the next #{ config [ :lookahead ] } \n " )
0 commit comments