70 lines
1.2 KiB
Ruby
70 lines
1.2 KiB
Ruby
|
class Folder
|
||
|
def initialize()
|
||
|
@steves = []
|
||
|
@fallen = []
|
||
|
@submissions = []
|
||
|
@idgen = 1
|
||
|
end
|
||
|
|
||
|
def add_steve(uid)
|
||
|
@steves.append(uid)
|
||
|
end
|
||
|
|
||
|
def curse(user)
|
||
|
@steves.delete(user.id)
|
||
|
@fallen.append(user.id)
|
||
|
end
|
||
|
|
||
|
def steve?(user)
|
||
|
return (@steves.include?(user) or @fallen.include?(user))
|
||
|
end
|
||
|
|
||
|
def submit(sub)
|
||
|
sub.set_id(@idgen)
|
||
|
@submissions.append(sub)
|
||
|
@idgen = @idgen + 1
|
||
|
end
|
||
|
|
||
|
def harass_steve()
|
||
|
if @steves.length <= 0
|
||
|
return nil
|
||
|
end
|
||
|
target = @steves.sample
|
||
|
if @submissions.length <= 0
|
||
|
return nil
|
||
|
end
|
||
|
message = @submissions.sample
|
||
|
i = 0
|
||
|
#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)
|
||
|
return nil
|
||
|
end
|
||
|
|
||
|
if message.local
|
||
|
File.delete(message.content) if File.exist?(message.content)
|
||
|
end
|
||
|
return target,message
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
class Submission
|
||
|
def initialize(content,local,sender)
|
||
|
@local = local
|
||
|
@content = content
|
||
|
@sender = sender
|
||
|
end
|
||
|
def set_id(i)
|
||
|
@id = i
|
||
|
end
|
||
|
attr_reader :local,:content,:sender,:id
|
||
|
end
|
||
|
|