better logic, more funny
This commit is contained in:
parent
afbb41ec43
commit
a15ff0dbcd
23
folder.rb
23
folder.rb
@ -11,9 +11,18 @@ class Folder
|
||||
end
|
||||
|
||||
def curse(user)
|
||||
if @steves.include?(user.id)
|
||||
@steves.delete(user.id)
|
||||
@fallen.append(user.id)
|
||||
end
|
||||
end
|
||||
|
||||
def bless(user)
|
||||
if @fallen.include?(user.id)
|
||||
@steves.append(user.id)
|
||||
@fallen.delete(user.id)
|
||||
end
|
||||
end
|
||||
|
||||
def steve?(user)
|
||||
return (@steves.include?(user) or @fallen.include?(user))
|
||||
@ -35,21 +44,17 @@ class Folder
|
||||
end
|
||||
message = @submissions.sample
|
||||
i = 0
|
||||
#until message.sender != target or i == 5 do
|
||||
# message = @submissions.sample
|
||||
# i = i + 1
|
||||
#end
|
||||
until message.sender != target or i == 5 do
|
||||
message = @submissions.sample
|
||||
i = i + 1
|
||||
end
|
||||
if i == 5
|
||||
return nil
|
||||
end
|
||||
@submissions.delete(message)
|
||||
if File.exist?(message.content)
|
||||
if message.local and not File.exist?(message.content)
|
||||
return nil
|
||||
end
|
||||
|
||||
if message.local
|
||||
File.delete(message.content) if File.exist?(message.content)
|
||||
end
|
||||
return target,message
|
||||
end
|
||||
end
|
||||
|
5
main.rb
5
main.rb
@ -99,7 +99,9 @@ loop do
|
||||
logger.info("sleeping for #{timer} seconds")
|
||||
sleep timer
|
||||
t = Time.new
|
||||
if t.hour < 9 or t.hour > 2
|
||||
if t.hour < 9 and t.hour > 2
|
||||
puts t.hour
|
||||
logger.info("skipping send cuz it's late")
|
||||
next
|
||||
end
|
||||
sid,msg = folder.harass_steve()
|
||||
@ -111,6 +113,7 @@ loop do
|
||||
logger.info("sending submission #{msg.id}")
|
||||
if msg.local
|
||||
steve.send_file(File.open(msg.content,'r'))
|
||||
File.delete(msg.content)
|
||||
else
|
||||
steve.pm(msg.content)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user