class SlackSmartBot
def kill_repl(dest, user, repl_id)
if has_access?(__method__, user)
save_stats(__method__)
if !@run_repls.key?(repl_id)
respond "The run repl with id #{repl_id} doesn't exist"
elsif (@run_repls[repl_id].user != user.name or @run_repls[repl_id].team_id != user.team_id) and !config.team_id_masters.include?("#{user.team_id}_#{user.name}")
respond "Only #{@run_repls[repl_id].user} or a master admin can kill this repl."
else
pids = `pgrep -P #{@run_repls[repl_id].pid}`.split("\n").map(&:to_i) pids.each do |pd|
begin
Process.kill("KILL", pd)
rescue
end
end
respond "The repl #{@run_repls[repl_id].name} (id: #{repl_id}) has been killed."
@run_repls.delete(repl_id)
end
end
end
end